Romhacking => ROM Hacking Discussion => Topic started by: Demos1085 on October 09, 2020, 10:18:09 PM

Title: Questions about hacking Castlevania Dracula X.
Post by: Demos1085 on October 09, 2020, 10:18:09 PM
Good day friends, I have been a fan of the hacks created by this community for a long time and today I decided that I want to try creating my first rom hack, so I decide to start with what seem to be a simple project, I wish to create a hack that allows the player to play all the stages of Castlevania Dracula X for the SNES in a single play through, my preferred order would be Stage 1– 2 – 3 – 4' – 4 – 5' – 5 – 6 – 7, I wish to do this because the game is pretty short and does not have enough stages to really support two different routes like the original Castlevania Rondo of Blood did, from what I understand the simplest way to do this would be to identify the bits of data that tells the game which stage load next when the "win condition" from the current stage is achieved; in most stages the only available win condition is to touch the magic orb that appears when you beat the boss of the stage, but there are two stages that have an extra win condition each, Stage 3 sends you to Stage 4' if you fall in the pits of a specific room, and Stage 4 sends you to Stage 5' if you open certain door with the "key" sub weapon.

So my questions would be, ¿is my approach correct for what I want to do? And if it is so ¿what is the most efficient method to identify the data that tells the game which stage to load after the current one is cleared? and ¿how do I recognize what data represent each stage?

Thanks in advance for any guidance or advice that you could give me.   
Title: Re: Questions about hacking Castlevania Dracula X.
Post by: FAST6191 on October 12, 2020, 02:00:50 PM
There are various ways a game tends to do things like this.

Some games will have it defined at code level where it almost returns to the main loop and gets where it is going next from there. This sees you attack it at code level for the most part. If there is some kind of level counter it is easiest to attack that most of the time (whatever changes the counter will lead back to what you care about, sometimes changing the counter even does the trick if you only want it for you and can do some cheats).

Some games will each level end contain an exit/teleporter not entirely unlike a normal door or in level teleporter. This sees you attack it at from a level editing approach.

I tend to find games that mix it up quite radically (think Earthworm Jim) will be code level where games that are little more than platformers will have things, however other platformers will have all sorts of side/bonus missions so who knows.

If it is a level editing approach then games will tend to have their objects defined somehow (in this case I would be surprised if it was not some kind of coordinate system rather than the older/simpler game approach of every square gets a definition even if it is blank) and part of that definition usually gives conditions on the object (facing direction, contents of chest, probability... it really does not matter just note that some data is there). Find this for the exit/teleporter.

Bosses taking place on a different screen and then after they are defeated it fading to black tends to be more code oriented but if you first have to pick things up then that acts as a teleporter.

If some speedrunners have done some kind of skip (possibly involving doors) then this might yield some kind of info but don't go looking too hard at such things.
Title: Re: Questions about hacking Castlevania Dracula X.
Post by: Vanya on October 12, 2020, 07:45:03 PM
If you were to accomplish this would that not leave a door that goes nowhere?
I'm curious what you might do with said door instead.
Secret room? Alternate rout within the same level?
Or maybe even add another one of the characters to rescue that was cut?
Title: Re: Questions about hacking Castlevania Dracula X.
Post by: Demos1085 on October 16, 2020, 11:03:56 PM
Well I guess this is way more complicated than I expected,

Thanks for your answers, about the door, my idea was to remove both "alternative exits", so change the pits in stage 3 to normal pits that just kill you, and change the door in stage 4 for a wall, so the "key" only use would be to rescue Maria, so make the key disappear from your sub weapon slot after you open Marisa's cell.
Title: Re: Questions about hacking Castlevania Dracula X.
Post by: bogaabogaa on October 24, 2020, 11:04:32 PM
I did not really find much so far. It is fun to play around with RAM offset 0x90.
Value 0x03 seems to be play mode. Changing it to 0x02 will reset the screen. 0x01 Will bring you back to the map. 0x05 seems to spawn a orb.. but could not find any value that holds the current progress. Have not figured out how this works. Following offsets seem to be active in transitions but no clue how it works yet.

Here a table that holds some level properties that is loaded in transitions. They contain position data. Preplacing the values of a other entrance will kinda bring you to a other room. They seem to do that within the current Stage.

0xa9bde (CPU Mirrior 0x959bde)

LevelProperty Stage1 Offset
00000003000000003c00c0000000 a9bec
00050005000000023c05a0020000 a9c18
00000003000100013c0080010000 a9c44
00070008000000003c07c0000000 a9c70
000a000f00010001240ac0010000 a9c9c
0000000400020002240090020000 a9cc8

LevelProperty Stage2
00000007000000003c0080000000 a9e80
00000003000100013c00c0010000 a9eac

Not really what you are looking for but may be it helps to dig deeper. I did run out of time but may be will look into it a bit more when I find time.

Here some info about my workflow so far.
First I did find what keeps track of Richters Ypos and Xpos. And put a breakpoint to write and see what writes to it in transitions.
Then the value was pushed to stack and I had to make a trace log. I started the trace till I hit the break point. So I found this at the end of the tracelog.

To find ROM offsets you need to understand the current memory mapping and calculate it. Or use a tool like Lunar Address. Or just search for the values in the table in the ROM file..

Today I did see that Ram $7a Does keep track of the current section. You can manipulate it to go to different sections even from map screen.
This value will get updated form $d2 and $d0 is probably a other trigger for transitions. It is hard for me to track this number as I don't understand how to read mvn opcode.. But the transition value for the first door is stored at RAM 7f611e. The lower end indicates the room so when you change 0x12 to 0x16 you will go straight to the boss room.

Later I did look up how byte block moving works.
It turns out the value is stored at ROM $A8052. This is the exit in the first room and it can be used to go to other rooms within the stage. From here you can put a breakpoint on it and figure out the format of this data table. This table is loaded in the beginning of a stage (after map screen) and how a stage transition work will still need to be figured out.

Stage indicator can be found at Ram 0x78. So I let you have at it. Tell me how useful the given information seems for you.

Yeha the stages will not be read from a table. Here is a routine that will increase stage counter after PW screen. You see branches for 7 and 8 what are the swamp and water stages. A easy approach would be to hijack here and write a routine that will skip stage 6 (Dracula till you completed 8) .. The question is if you feel comfortable to write this small routine.


I got some stuff wrong in the spoiler tab. I did think you might need a example. I did document some stuff a bit better in the src code. In the folder I have code and asar (injection patcher) This is great as you can type out the offsets as you see them on the SNES. I did remove the first branch path in stage 3. So when you fall down you will start at the beginning of the room. Still a bunch of things to add.. the patch will be compatible with DarkSamus remove Dracula pits patch when you use the free space as I put it there.
(Deleted Link)

Worst case I can write it for you. But this would be a good project for starters.

I take it back that this is a beginners task. You need to have a good understanding what is going on to do this changes.
Something easy would be to make a cheat hack. Since you found some memory location where you know what you need to change for something to happen. When you understand the button mapping you can do cool things.

I made a cheat hack here and it is also available as IPS this time.

While game mode and Pause:
- D-Pad right gives hearts.
- D-Pad Down Next Sub-Weapon.
- Select and exit pause will bring you to the Map Screen

While MapScreen
- D-Pad right Next Stage
- D-Pad down Next Substage. (I made it Visual but when it is not a valid stage it will crash. Only 7 Substages available what covers almost everything)

The Source is available. I started with chaining stages together. But for you it might be better to practice with some cheats improvement. Or adding some new once. Not even sure what your level of hack currently is. Maybe this project is more then you are willing to take. (If you look at the code sry that my documentation sucks.. I hurried through and I am not a good coder.. If you are willing to learn I could improve it for you!)

(Deleted Link)


Since I was not potion enough to wait for a respond and I am guessing you been looking to hack this without knowledge how to code for the SNES.. I did this patch now. A lot of the work is research. Here in this case it was very tricky to stich the stages together. In some other games this may be a very easy task you could do.

I made following patches.

1. No branching path.
2. Run Patch. Run when holding R
3. Cheats:
  When Paused:
  While MapScreen:

Patches and Source.

I have some more ideas but might submit soon. Thanks for testing and feedback  ;)


Unfortunately, your file removal for 'No Branch Path Plus' was not approved.

Cheat Hacks: While hacks that rebalance difficulty or modify game mechanics may be considered Improvement hacks, those with a primary purpose of cheating, or those that only apply simple cheats (infinite lives, invincibility, game genie or pro action relay codes) are considered out of scope for RHDN.

Sure he missed the code that was needed to implement this. Well I will not bother since this are small patches. If anyone feels this is worth sharing have at it.
Title: Re: Questions about hacking Castlevania Dracula X.
Post by: bogaabogaa on October 28, 2021, 05:28:43 AM
I updated the patch for no branching Patch since it got pointed out to me that it might be frustrating to carry the key through one more stage. I removed the key from the original location and made it drop from the big skelly what got moved to stage 4 too.

The password screen at the end of the stage will show the wrong password sometimes. This remines broken.

The new and old "noBranchingPath" Patch can be found in my dropbox. I repost the link here: