Even if you've heard it before a hundred times already: fantastic work, Dario!
Dario FF, on 14 April 2012 - 09:29 AM, said:
I rarely dabbled in ASM and never touched an EXE, so don't really expect me to even attempt to code in anything like that. I've just been sticking to cracking the file formats and writing tools for them. It's kinda amazing though how much this game can do without any code tampering though, but it could be a bit better regarding object definitions.
Only EXE hacks I would like to see are:
- Load files directly instead of using the CPKs. I'm not sure if this is even built in already! There's a work folder that was used in Unleashed for overriding files with the DLC, and I've seen reports of people sometimes crashing when there's some weird shit in the disk folder apart from the 3 Main cpks. This would likely be the best modification because it would reduce testing time to 0 instead of 2-3 minutes each time you modify something. Would also be bitchin' for mod distribution.
I actually looked into that, but I didn't get anywhere and feel like I just wasted my time. The CRI filesystem stuff is quite complex, and multithreaded, which makes reversing it a terrible chore. There's an old version of the CRI "FileMajik" SDK for PC around, but it's of little help as so much has changed in the version used by Sonic Generations. The game uses an awful lot of CRI libs, here's a list of build strings I extracted from the exe, if someone's interested:
Anyway, on startup, the game looks in these subfolders of "work" (if your language is set to English):
I extracted most of the respective .ar files from the bb?.cpks and placed the contents in these work folders. The game looks what files are present there, but as far as I can tell, they get never loaded. I could be wrong though, didn't check too thorougly. Maybe I shouldn't have unpacked the .ar archives, but I think it does expect extracted files...
Given that the CRI filesystem calls in the exe are so complex and confusing, my first thought for an "easy" solution was to trap all ReadFile WinApi calls by Sonic Generations and redirect them to a specific folder, if some bb?.cpk content is being read. However, I don't know if that would be very useful, as most files in the CPKs are packed (.ar/.pfd). So, implementing something like this would save you from rebuilding the entire CPKs, but you'd still have to build the other archive files.
If somebody wants to try and implement this idea, go ahead. I don't have as much time for hacking business these days as I used to, unfortunately.