cvghivebrain / s1disasm

Sonic the Hedgehog (Mega Drive) Hivebrain 2022 disassembly
41 stars 8 forks source link

Potential idea to simplify structure #4

Open Awuwunya opened 2 years ago

Awuwunya commented 2 years ago

One big issue with structuring a Sonic disassembly (unless you're willing to sacrifice bit perfectness) is that the structure in the ROM is terrible. This presents issues where important object functions are just littered randomly and sometimes within objects. There is one possible solution we could use - put all the functions, or at least group many similar functions, into the same file, but as macros. This would have the actual name of the routine along all the code, but it will allow a single instruction to be placed where the actual function occurs, preserving bit-perfectness while allowing far more options for structure. This would also allow us to not split objects into multiple files or have random file includes within objects. Object includes could also contain a comment, indicating which functions are defined within it, to aid users in finding these definitions if needed.

cvghivebrain commented 2 years ago

Done for several objects. There's just the Sonic object left to recombine, which I want to label/comment thoroughly at the same time so it might take a few days.

DevsArchive commented 2 years ago

I'd like to make a point regarding the Sonic object, particularly with the floor collision code. Judging from what is known about the source code, the Sonic object up to Obj0A(? going off from memory here) is its own file, and anything related to floor collision (AnglePos onward, holding functions for both Sonic and general objects) was another file called "FCOL.ASM" or something like that. Personally, I find the usage of macros for the Sonic object to be a bit overkill and weird, when it could just be done like in the source code. That's just my 2 cents.