Welcome, Guest!

Here are some links you may find helpful

Dreamcast DC Making a Level Select in Cosmic Smash

3l3tric

New member
Joined
Sep 18, 2020
Messages
1
Reaction score
2
Points
1
Hello! I was told to make a post here after posting a lot of this info elsewhere.

I'm currently working on modifying the dreamcast game Cosmic Smash to include a level select function. My main end goal is hex editing the gdi then making a selfbooting cdi to avoid having to swap discs with a code breaker code, but if I can't figure out how to manage the edit then the code breaker code will do for the time being.

So far, I've made a code breaker code, but it doesn't work properly and I'm not too sure why as there isn't too much documentation on code breaker codes out there (I've only found two sites with any, and one didn't include info on many prefixes including ones I needed).

Here's info on all the memory locations I've found so far:

Code:
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.


2C21B4A8  Input Register. This memory location responds to button presses on the dreamcast controller. For instance, FFFB in that memory location denotes an A button press. Needed for a code breaker approach.
2C21B4AA  Trigger press register. B4AA is the right trigger, B4AB is the left. Can also be used for code breaker approach.

and here is my prototype Code Breaker code that doesn't really work as of right now.

Code:
0E02FF7F
0021B4A8
03010001
8C16E794

0E04FFEF
0021B4A8
03010001
8C16E7A0
03010001
8C16E7A4

0E04FFDF
0021B4A8
03020001
8C16E7A0
03020001
8C16E7A4

The code is 3 sections. The first causes d-pad right presses to increment the level select used from the main menu, so pressing once causes the game to start one level ahead, twice two levels, so on.

The second and third codes are both needed for level select in-game. The second makes d-up increment the next level select indexes, while the third code decrements them with d-down.

As of right now though, their results are very... odd. For instance, using just the second code and incrementing the two level select indexes somehow makes them differ, with one leading to level 5 and the other to level 0. And those locations seem static, any time you press d-up between levels those levels come up, no matter how many times you press it. I suspect the increment function doesn't quite work like I think it does. The activator lines (the first two lines of each section) seem fine though, as there is a response to d-pad input.

At this point, to get the code breaker method of level select working, I'll need to find someone with some knowledge of making code breaker codes that can help diagnose the issue with the code I've made. And even if I'm able to get this method working, I still need to figure out some approach for a hex edit for a more convenient solution.
 
shape1
shape2
shape3
shape4
shape5
shape6
Top