I'm looking to make either a gs/xploder code or just modify the gdi of Cosmic Smash to create a level select code in the game. It seems like an interesting game for speedrunning, and I'd like to be able to practice individual levels on repeat rather than have to do full game runs for practice.
I don't have any real experience with game modding like this, but so far I've been able to use demul and cheat engine to find a few memory values I'll need for this process. Here's everything I've found so far:
Code: Select all
2C16E7A0 and 2C16E7A4 are level select variables in-game. After some levels are completed, you have a choice for the next one, hence 2 variables. When they're the same the game just takes you to the next level they designate. When they differ the game will give the branching choice, even if the 2 levels wouldn't normally be on a branch anywhere in the normal game. For ongoing repetition of levels, these will almost definitely need to be held at a specific value. I believe these only get updated at the start of a level.
2C16E794 is level select from main menu. Whatever value is here will be the starting level after hitting "game start" on the main menu. This value seems to still get updated at the end of each level transition, even though it doesn't seem to have any influence on future level selects after the first.
2C162F78 seems to be related to level select, as it updates as soon as the results screen of a level appears, but setting it inactive or setting it to strange values doesn't have an effect on the game. I feel like maybe this is used in some visual process, like the lighting of sections of the map or something similar, that needs to update with the levels but won't affect them if it's wrong.
2C17E79C behaves similarly to 2C16E794, as in it updates at the same times, but changing it doesn't seem to have an effect on starting level. Maybe 94 and 9C are a pair in the same way A0 and A4 are, but 94 ends up getting used from the main menu since the game would initialize both variables to 0 at the game over screen anyway. Likely not necessary for level select things.
2C20B320 Index for option screen. Starts at 0 and increases as you scroll down through the list. Maybe this could be used to somehow add more menu options, but likely this won't be necessary for level select.
2C20D2E8 Start Time variable. In the options screen, you can set your start of game timer to any value between 50 and 150 by steps of 5. If you modify the code that adds 5 every time the value is incremented, you can get results by ones without causing issues with the game, and the limits of 50 and 150 can both be bypassed with similar modification. This would probably be the best candidate for modification into a level select function, as you should be able to modify the code to have this variable written to one of the earlier locations instead. I've verified through cheat engine's debugger that these modifications can be made on a per instruction basis and the game still runs. In total you need to modify 4 instructions to remove both the limits and the 5 increment.
2C24072A Start Time variable in-game. This value gets updated right after the previous, and it seems this one is what the game bases its starting time off of, while the other variable is used to update the options menu. When you change the start time, D2E8 gets updated first and then 072A gets updated. If the function that updated this value instead updated 2C16E794 (main menu level select), you'd have the ability to choose any level from the start, and if the value is also pushed to 2C16E7A0 and A4 that level would be repeated indefinitely (at least, as far as my few hours of research thus far have shown). Therefore, I think these memory values should be enough to implement a practice code that allows selecting and repeating any given level from the main menu. One potential stumbling block is that this value (2C24072A) seems to get written to pretty often, even when you haven't changed the start time at all. It doesn't change during these rewrites though, only when the main D2E8 variable changes. Some further messing around with the debugger will likely be necessary to figure out how to adapt this update function for level select.
At this point, I need to figure out how the code I'm interacting with in cheat engine would be modified on the disc itself. Since I'm trying to repurpose existing menus and functions, I would think that some sort of gdi hex mod could probably get the job done, but with my inexperience I'm not sure if that's a path worth pursuing. This could probably be accomplished with a GS/Xploder code too, but in addition to the hassle of swapping a code disc every time I want to play I'd still need to figure out what parts of the GDI need modifying before I'd be able to make a code myself.
If anyone has suggestions on how to proceed, I'd love to hear them. Or, if this thread just goes stagnant and you find this years later on your own journey to modify this game, I hope the info here is at least somewhat helpful.