11 March 2016 - Forum Rules

Main Menu

SC4ED - Super Castlevania 4 Editor

Started by RedGuy, May 07, 2016, 09:25:50 PM

Previous topic - Next topic


Thanks, I recently got a new PC so I guess I'm a bit paranoid about this sort of thing.
Mini-reviews, retro sound chip tribute, romhacks and general listage at my site: Mini-Revver.


So, I don't suppose you'd consider a decompressor/editor for castlevania bloodlines would you? There's a simple Hack I wanna make but the graphics I wanna change don't seem to be decompressed.


I don't have the patience or time to make an editor for another game, but I did put the latest source on github with basic contra3 and gradius3 support.  I know very little about the genesis/m68k instruction set and graphics processing.  The editor has a lot of snes assumptions in it.  The compression is probably just some variant of lzss, but who knows if they used the same control word encoding as the snes engine.  Maybe someone who has worked on genesis games can help out.


Hows the progress with this editor, and the Contra 3 one??


I need a break from the editor.  Contra 3 is heavily scripted making it more painful to make an editor for than CV4 or Gradius 3.  No real progress on Contra in this version.

Here's the latest version:

- Added some basic Gradius 3 editing.
- Fixed bugs related to entrances and exits in CV4.

Gradius 3 has the typical level editing stuff supported in the expanded version including events.  Tile collisions aren't editable as that was a lot of work in CV4 that I'm not ready to redo in Gradius or Contra.  One unique thing about Gradius is you have to manage WRAM for enemies yourself instead of having the game engine do it.  The SubId of type == 0 and type == 1 corresponds to the slot in WRAM.  Type == 0 will conditionally check the slot to see if it's in use, type == 1 will just overwrite it.  Some events require multiple slots (3 enemies, 5 enemies, multi-part enemies like the sand dragons, etc).  Some events look like they require specific slots like 0 for the sand dragon.  I attempted to write an automatic slot assignment code, but there are a lot of rules I don't know about so I commented it out the code for now.  Type == 3 are what I'd call sequence events which change music, level, speed, palettes, tiles, etc.  The editor tries to display the resulting change if you select these events with the event editor open.  It's nowhere near done, but with an expanded ROM it's possible to do basic hacks with some trial and error.

In CV4, even numbered entrances are considered "forward" when the game loads up events.  Odd numbered are considered "reverse".  This makes a difference for which direction you are traveling in for an entrance.


I hope you come back to this, it looked like a great tool. CV has been getting so many hacks and tools lately. Good time to be a CV fan.


Quote from: MathUser2929 on February 28, 2017, 09:55:44 AM
I hope you come back to this, it looked like a great tool. CV has been getting so many hacks and tools lately. Good time to be a CV fan.

Especially with the Castlevania Netflix series coming out.



Summing up/Tutorial on SC4ed so far
A document I had like to have when I started workig on my Othercastle SC4 hack

About me: When I started with SC4ed I had no Rom-hacking experience at all. I understand English a bit and can type words as you see. As I discovered that there is a Editor of my favorite game I was looking like this  :crazy:
DD did inspire me with his hardmode hack and I wanted to make a similar but easier and better looking hack. I did post some of my early work "SC4 Revisite" on youtube. At the Comments on youtube DD posted a invite to the Castlevania Speedrun Discord. Redguy was there too and did help me a lot to get going at his editor. [glow=green,2,300]Big thanks to all the people who helped and keep me motivated

If you have questions or needs for your SC4 project use this forum:

Setup and Hotkeys:

You are able to view the Rom without expanding it. But you can't make changes to it within the editor. Expanding the Rom will not only make more space! It does decompress most of the original 1MB Rom and allocate the data somewhere in the 4MB Expandet ROM. The Rom code pints mostly to the decompressed data. (You will not have to worry about decompression within the editor at all)

-You can decompress in the editor at the File drop-down menu

It is very easy to set up the internal and external Emulator to test your hacking. Keep in mind that you can test changes in the internal emulator and this changes are not saved to the rom till you save the project. This can act as a undo button when you save often. I recommend to backup your Rom and make version numbers just in case something went wrong. Sure you can fix a lot if you know how. But rolling back did save me a view times!

-GreenPlayButton Starts the external Emulator when you set the path in the setting
-The open and save buttons open save to ROM

I did test the save future extensive to backup my project. It is not suited for that. A level save contains; Tile, Palettes, Tilemap, Event and most of the properties of the current scene.
It is perfect to share levels or update tiles and blocks. It can be used for undo your last actions.. and sure it does backup a lot. 

-Keep in mind that new added exit events will not be saved in this format.
-When you load a level save the tiles and blocks are updated. And they are shared over multiple levels. Be careful with what saves you are loading

Hotkeys and Scene Editor:

right/left mouse button:    Copy/paste blocks in scene editor. Right and hold will let you move the main window.
Middle Mouse Button:          Moving selected events around
ESC:                          Will exit the internal Emulator
Page up/Page down: Forward of backward level select (don't work while in Internal Emulator)
B:                              go to background layer in the scene (Toggle BG0, BG1)
D:                              Toggle info bar in the main/Event editor
E:                              Brings up a beautiful screen with Hex-numbers (now clue what it is so far)
T:                              Toggle Events Viewing
Space bar:                      Repeat last(selected) actions in block editor
Arrow Key:                      Moving the scene/changing selected values

Palette Editor: I did not have a good understanding of Palettes till after my release of Othercastle 0.6.1 (I did not touch it at all)

You will find most palettes and there offset to edit with other tools. Great tool works well but there are a view bugs. See bug list!

Tileset Editor:

This is a very use-full tool I discovered very late. I did draw this Dracula-Wolf-Head within the editor. You have a drop-down menu to the right to change the tile property; ground,mod,step,slope,spike.. D2??? and D6??? work as background stairs. Did not find anything special on them.

The drop-down on the bottom does sort the tiles by there property

You can import tiles with a external tool and reassign everything and make the proper palettes. Here I started a CV3 example. Not nearly finished and it would be a lot of work.

Block Editor

I did draw a lot of new blocks by just using tiles that are already there. Like finding some wood or whatever and start drawing a new block with it.

- You can Copy/paste a block. This is very helpful in many ways. Sometimes you need just a view tiles changed in a existing block. It allows a fast workflow.
You can rearrange the whole block-layout this helps a lot when drawing a huge scene and looking for your blocks you need is not fun. I did sort some of the levels. Feel free to check my hack save a level with sorted blocks. Use them and save time

- Change tiles to your liking here! Apply the right palette for each tile. No NES restriction here! Love it
- Flip/Mirror tiles to your liking the only thing that stops you are mode 7 sections.
- set Layer Priority for each tile!! You decide what is in the foreground by checking this box. Make hidden stairs. Hide Candles. Make a awesome scene with depth!! All possible here!!
- A drop-down menu to keep track of your costume tiles. You can sort them here but you don't need to.

Event Editor:

Events will get loaded in Order of the Event number (First entry in Event Editor) Use sort event button to bring your events in Order to load properly. (Keep in mind that hard-coded events may correspond to Event ID and may fail if they have a different number. There is only level 1 where it is a issue as far as i know)

The love and hate of events and properties. This will consume the most time to learn but it pays off since you can make really awesome things with it.

Tip I use candle to find x y position I need to edit properties

Some things I noticed about events assuming a (type, id, subid) format.  All number in hex:
- (1,m,n) are mostly (all?) candles.
- (1,m,n) m will be all iteams. OLD//(1,6,n) drop subweapons where the subid determines the type.  E.g. n=1A -> dagger.
- (2,15,n) are level ending points.  Some levels use custom boss code or other events to trigger the end.
- (2,41,n) are in-levelcamera locks.  The level has an initial set of bounds looked up by the level ID and then these events can change the bounds.               
- (0,m,n) Enemies
Enemies (type==0) seem to use the match as a bit field: 0x8=set to enable foreground, 0x4=set to only see in new game

I did learn a lot of the events by just selecting/reading them and the events may be a bit different depending in what level/level-type you are in (If you change enemy mask form 0 to 8 he might only appear in hard-mode)
I am sorry I am not ready to back this down yet.

Property Editor

The Player/Level section explains it self a lot. Be aware that some changes to the player section may mess up your internal emulator or Rom. There is also a bug that could reset the player and level section with 0's. It does almost never happens and I could not track it down. For example when you set the timer to 0 in the level section. The player spawns in the background and you will be soft-looked. I did not a lot of testing here.

Tip I used other level-type to get bigger scene to draw on. Be aware that the level-type brings hard-coded stuff to the scene and background. You will have to experiment here! Levels also keep some hard-coded stuff that was in the level. (like disappearing treasure pile in stage 9 remaining on there x y position)

Camera lock section

The properties editor has the starting camera lock for a particular entrance. (Camara left,right,top and bottom)  Events 2,41,SubID X use X to choose the camera lock (also in properties editor) to change one of the lock directions.

Direction =1(Right or Down),2(Left or Up)                        "Trigger when Simon moves in this direction"
DirAddr=55a(X direction),55e(Y direction)                          "Direction off the trigger"
CmpAddr=54a(X position), 54e (Y direction)                      "Set Compering to X or Y"
CmpValue=x or y value to check current values against        "Triggers when Simon moves over coordinate X Y "
StValue=new value to change lock to                                    "Set new Value to where you want the camera lock to go"
StAddr=A0 (left), A2 (right), A4 (top), A6 (bottom)            "Set witch Camera lock you want to move"

All of those are work ram address so you can do crazy stuff by comparing and writing anything under $2000 if you are feeling lucky.
Locks usually come in pairs.  One to set the new value and one to reset the old value (reverse direction)

Exit Section

EventID 15, type 2, Are Exit events. Make subID to the same value you want to edit in the property editor. Make compare to X Y
you want the exit. Choose the right exit trigger.

Even entrances expect you to go from low coordinates to high coordinates and odd entrances expect you to go from high to low.
The game engine has very strange event loading.
It assumes everything should be loaded in order in one direction and if you start looping around it gets confused.

To be exact!! What happens is each level has a hardcoded event direction type in the ROM.  You can't edit that with the editor right now, but it's stored a 80:D8A3 and indexed by the level (byte per level).  0,2 are values in the positive direction.  1,3 are backwards.  Then the entrance has to come in and flip that value around if it's backwards (odd entrance) so it XORs in 1 so 0->1, 1->0, 2->3, 3->2.  So if you want to go backwards with how the original level was designed you need to first understand which the direction stored at 80:D8A3 is and then decided if you need an even (same direction as original level) or odd (reverse of original level).
I forgot what the difference is between 0 and 2 (same with 1 and 3).

Outside of the editor:

I did use BSNES Plus and the debugger tools to view VRAM I could change the tile map there but how to change it in the rom!?

Going from memory VRAM to ROM is not simple.  You need to know how the game engine decompresses (or copies in the case of an expanded ROM).  It's a multistep process.  The game references some tables using a pointer.  That table encodes a src pointer and dst pointer among other things.  A chunk ($400 B?) of the src pointer data is decompressed (copied) to a temporary location in WRAM.  And then that is DMA'ed to the destination which may be VRAM.(edited)
Some things like menus and one-time things are hardcoded pointers to their table.  Level data (tiles, blocks, scene data, etc) use an indexed array to find the table.

$82:80EA - Address of table decompression routine.  X contains offset into bank $81 of table.
$81:8B5D - Address of VRAM data for title screen (konami logo).  Format is generally the following for VRAM destinations: AA[BBCCC]...FFFF.  AA = type, BB=dstAddr, CCC=srcAddr in ROM.  If you look at $81:8B5D you can see that $F4:A3FD is stored in that table.  BBCCC repeats until it sees FFFF
$F4:A3FD - Address of table that has decompressed tile map data @ VRAM word address $1000 ($2000 VRAM byte address) for title sreen.  The first 3 bytes are information (AAC, A=size, C=header byte which says this is uncompressed data) and everything after is data which is aligned to $F4:A400.  Offset in the file is $3A2400.

So you should be able to modify the tile map @ $3A2400.  The konami text starts appearing around $3A298E in the ROM(edited)

That is how I was able to edit the Konami Logo  8)

Known Bugs:

- Entrance does not work as expected? You may have a missing instruction in you expandet rom. (not sure why it happen to me)
- Level 20 tiles to build level are out of range
- Scene editor sometimes draws when scrolling scene (fix reopen scene editor)(fix restart)
- Level saves do not have all the property values
- Recording a entrance has more values the you could edit (in other words record and then change position)
- You can force issues by using hard-coded events in a different level with the same level-type. (Sometime it works surprisingly well)

Most bugs I had been not understanding how it works..

Great tool 5/5 Stars

CV ROM DiscordServer


Here a link to the newst SC4ed build =>

I will make a bug list here in case they may get fixed once. The bugs will be in this version of the editor. I will test bugs and provide a video.

- The HUD in the swamp messes up if you use tile number 150-180 in level 2-4.
- Palette of Simons sprite is changing to original palette after the medusa fight till you leaf the screen.
- If you change a level-type that loads events in the x direction to one that loads them in the y direction or vice versa the event-loading does brake when traversing into the level

Things that are good to know when working with SC4ed
Changing the Level Type in the very first scene (0) and hex 43(Dracula) does not work right. When bg3 is used you can't edit it because the level size need to be the same in the editor as far as I know.(For the benefit of level types) This is also the reason why some tiles are excluded (See Picture). Animation tiles can't be edited but placed where ever you want them. The palettes for the water animation(palette animation) in stage 2 (water slide) will only edit the first frame.. so it is useless and you need to stick to the blue color. Also koranot and zapf bat do palette swapping to the original and keep in mind that the credits can softlock. They are not editable in the editor

Like here:

I did give a wrong information.. you can change palettes on mode 7:
If you find mistakes I made other then spelling please point it out. I can't help the wrong spelling sry  :P
CV ROM DiscordServer


Glad to see the editor is still in the works.


Hi Math glad to see you.

I think the SC4ed is not something Redguy is interested to dump much more time into. The good thing is the editor is in a good state and you can do a lot with it. And with a lot I mean you can make a complete different game if you want. (Change all graphics and play with the physics of the character for example)
I will try to push the number of exits to the limit on my current project among other things. The problem is not the editor it is a other one..

The community around making a level or a SCV4 project is almost dead. It is like with the CV3 people. There are some but they could need someone who is experienced to work on revamp a bit.. since it is out of date and they do lots of the stuff by hand on a hex editor as far as I know.

A other problem is sc4ed modifies the ROM in a really, really bad way. Redguy manually edited each byte for code and data changes based on address.  He was too lazy to learn one of the assembler languages at the time.  All those changes in the randomizer and when expanding the ROM should be an assembly file that gets patched with an assembler.  He manually calculated direct branch offsets and other things.... which is unfortunet.

(I am very bad at all of this things.. when I see $00:8000 I ask myself does the ":" mean it is in one of the tow banks or is it a register that does something. Sry can't talk snes!.. Though I wont be any help any time soon)

I still hope that we will see bug fixes in the future. But mostly I hope to see some new people starting a project.
CV ROM DiscordServer


When someone would show up that is motivated to work on SC4ed expanding the level load pointer-table and make it editable would be a cool thing to do. Like it is with the level type. Also a global event editor to pick events and may be modding some of them so I don't need this stupid list I wrote. If only coding would be a easy thing to pick up I might dump some time into it. ^^

Also if you are a artistic person. It is possible to make custom tile set and arrange them. Sharing patches like this would may be get some people out of there bushes. There is no graphic hack but it would be possible to do.

CV ROM DiscordServer


More or less a year ago Redguy decided to delete the source for the editor since he lost interest in the project I post a link to the source code here.

CV ROM DiscordServer


Bummer. We never got the candle mod option. Sad.


Quote from: MathUser2929 on February 16, 2021, 09:04:24 AM
Bummer. We never got the candle mod option. Sad.

What option do you mean. You can edit and add as many candles you like. I made even patches so they do different stuff like bring you to the second quest and back.
The gui is not that nice as you need to fill the right values instead of choosing from some menu box with labels. But you see a perfect preview for the drop, position and everything else needed to make it appear properly.
CV ROM DiscordServer


Yeah, he said something like it was hard written.


He did probably say it is hard coded. There is a jump table for the drops. If you like to change a item just make a long jump to the last bank that is unused. There you can write the code for the new item. This kind of things don't belong in a editor there are ASM patches for this sort of thing. If the items are what you are after. You said candles what is very unclear what you like to do.. may be you just like to change gfx?
CV ROM DiscordServer


Yeah, I only made a couple small hacks. Still tho. Would be nice to have full on hack capabilities.


Quote from: MathUser2929 on February 16, 2021, 03:24:10 PM
Yeah, I only made a couple small hacks. Still tho. Would be nice to have full on hack capabilities.

The program needs to be refined more in my opinion.  It's not too bad on where it's at but could be updated a bit with more functionality and features compared to what it is now.
ROM Hacker, Reviewer and Critic.

Don't Know What Else To Say So... <3 You!