Page 7 of 8

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 1:38 pm
by Zucca
lorenzo wrote:Btw @Zucca, did you manage to run the assembler on Linux?

I haven't had time yet. I needed to set up complex logging and backupping system here. But it's done now.

I still have the terminal open where I did the git pull. I'll prepare some coffee and then try it out. :handgestures-thumbupright:

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 2:02 pm
by Zucca
Code: Select all
$ cc -o ps2p2bin{,.c}
ps2p2bin.c: In function ‘buildRom’:
ps2p2bin.c:193:11: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long int’ [-Wformat=]
    printf("\nERROR: negative start address ($%X).", start), start = 0;
           ^


I guess I need to ignore the warnings...

EDIT: Had to refresh my memory. It was '-w' that disables the warnings.
Does the executable take in patch files? O.o
Code: Select all
usage: ps2p2bin.exe inputcodefile.p outputromfile.bin sharefile.h

Also I have no clue what to give as 'sharefile.h'. To me .h means header file.

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 3:42 pm
by lorenzo
Most of the work on those files was done by other guys, and since I don't use Linux, I can't help much. Try downloading the Sonic disassemblies.....It's how I got started and they seem to have packages ready for Linux, maybe you use those as reference. Here's the link

http://info.sonicretro.org/Disassemblies

There are tons of links there, but focus on just Sonic 1, 2 and 3.

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 5:13 pm
by etony33
I wish I understood most of this. Maybe I should take a course on computer programming.

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 6:51 pm
by Zucca
Got it!
I need to have macroassembler AS.
Luckily one is to be found from the repositories of my Linux distro, so I can compile it. Yay. This is progress.

Re: Phantasy Star Disassemblies

PostPosted: Mon Nov 06, 2017 7:33 pm
by Zucca
I'll convert bulld.bat to linux shell script. Then when it's working and well tested, I'll submit it to you, lorenzo (via github).

Re: Phantasy Star Disassemblies

PostPosted: Tue Nov 07, 2017 9:03 am
by lorenzo
Cool, thanks!

Re: Phantasy Star Disassemblies

PostPosted: Tue Nov 07, 2017 9:31 pm
by Zucca
I think I need to create a little more complex build script, since ps2.asm contains all the bincludes in windows pathname format where \ is the path component separator while on *NIX operating systems it's /.
I'm thinking of just live patching the code whenever the script is run. This way the code is still windows compatible.

Or does anyone know if windows can support / too as well as \?

EDIT02: The compilation was succesful. But I don't have the "fixheader" executable. So I'm trying to figure out what it does and how to do it on Linux.
EDIT02: My wild guess would be that the fixheader adds the signature to the rom file so that if you run the game on actual Genesis, it passes the ROM check and runs the code. At least on MESS the game is now running fine. Hey... First time compiling code for Genesis.

Re: Phantasy Star Disassemblies

PostPosted: Wed Nov 08, 2017 11:20 pm
by Zucca
@lorenzo: There you go.

Re: Phantasy Star Disassemblies

PostPosted: Thu Nov 09, 2017 9:08 am
by lorenzo
Thank you so much! Really appreciate it! I merged your changes.

Is it easy to port the build.sh file to ps3 and ps4 as well? I assume all I need to do is change all instances of ps2 with ps3/ps4, but I wanna ask just in case.

Re: Phantasy Star Disassemblies

PostPosted: Thu Nov 09, 2017 9:48 am
by Zucca
lorenzo wrote:Thank you so much! Really appreciate it! I merged your changes.
You're welcome. I've been enjoying using it already.

lorenzo wrote:Is it easy to port the build.sh file to ps3 and ps4 as well? I assume all I need to do is change all instances of ps2 with ps3/ps4, but I wanna ask just in case.

There's no porting needed! :dance:
The script assumes only few things:
  • The source for p2bin must reside in the same directory tree as the main asm. It automatically searches for '*p2bin.c' and compiles it into the project root directory.
  • User can specify their own p2bin executable using --p2bin switch (undocumented atm). But by default the script looks prebuilt binary from the same directory as the main asm.
  • It assumes p2bin command line syntax does not change. This means if other prject have their *p2bin.c modified and the use of it differs, the script might not be able to combine the resulting files from assembly compilation.
  • Dependencies must be installed of course. ;)
With that said... I'm gonna try it out with other games too. PSIII should work at least.

If the script works it might be better off to have it as an seperate project since users really can place the script anywhere. The real problem I see is the changes to *p2bin.c. If the source is the same for all the projects, then there's no problem.

Re: Phantasy Star Disassemblies

PostPosted: Thu Nov 09, 2017 2:51 pm
by lorenzo
Ok, so if I copy the linux_build folder in the ps3 and ps4 project folders, no changes are needed right? That's neat.

Before I do that, I'll wait until you finish your testing

Re: Phantasy Star Disassemblies

PostPosted: Thu Nov 09, 2017 4:03 pm
by Zucca
lorenzo wrote:Ok, so if I copy the linux_build folder in the ps3 and ps4 project folders, no changes are needed right? That's neat.
Exactly, but the user could have build.sh anywhere.
I may create a seperate project for the build script, that I then sync with the disassembly projects. After testing, I'd do the regular pull request to your projects.

lorenzo wrote:Before I do that, I'll wait until you finish your testing.
I'll try out the other games as well.

I'll plan to add binary patch creation support for the script as well. Meaning that it could then produce patches for say romhacking.net for example with a single command that first compiles the asm and then automatically creates the patch.

BTW... What's the preferred binary patch file format? I read that people use some Lunar patches or something like that...

Re: Phantasy Star Disassemblies

PostPosted: Thu Nov 09, 2017 5:07 pm
by Zucca
Code: Select all
zucca@wren ~/psbuild/mdps-asm-builder $ ./build.sh ../ps3disasm/ps3.asm /tmp/ps3.bin
Path patch applied...
Source compiled...
p2bin compiled...
Succesfully created '/tmp/ps3.bin'.

Code: Select all
zucca@wren ~/psbuild/mdps-asm-builder $ ./build.sh ../ps4disasm/ps4.asm /tmp/ps4.bin
Path patch applied...
Source compiled...
p2bin compiled...
Succesfully created '/tmp/ps4.bin'.
:geek:

And they both run on MESS emulator. :dance:

Next up I'll start to search if there's a source or program equivalent for fixheader.exe for Linux.

EDIT: @lorenzo - You have three more pull requests waiting. The porting went as I thought - basically just copying the script. Although you'd only need one. :P This is why I created the "main repo" for the script too.

Re: Phantasy Star Disassemblies

PostPosted: Fri Nov 10, 2017 9:17 am
by lorenzo
Zucca wrote:BTW... What's the preferred binary patch file format? I read that people use some Lunar patches or something like that...


As far as I know the .ips format is the most popular.


I will check and merge the changes you sent. Thanks again!