News:

11 March 2016 - Forum Rules

Main Menu

Need help finding a routine in Doom for the 32X

Started by 4lorn, December 18, 2019, 08:20:14 AM

Previous topic - Next topic

4lorn

Hi everyone,

I've been working on Doom for the 32X, originally as a simple translation project but after looking at the game's development I've been trying to fix some of its issues. I've succesfully fixed a number of bugs relating to enemies, maps and textures, and deleted multiplayer entities where applicable to reduce map memory (every kb counts) but I really could use some help figuring out how and where the game does the following:

1) If you don't know, the Doomguy will often look around - left, center and right - but unlike other versions of the game, the first series of animations will flip his hair around. Here's a comparison shot between the PC and 32X animations:



The 32X port is so far the only one to have this error displaying the Doomguy's portrait, and this flipping only occurs for the first set of animations (high health percentage). I've done what I could, from trying to do traces with Gens and comparing the final build with prototypes but I can't find how this is done. 0F @offset 20660 will display the 16 sprites in a 4x4 composite, and nearby offsets determine horizontal and vertical positioning but that's as far as I've managed to dig through.

While the *.wads (maps) can be extracted, edited and reinserted into the ROM through third-party programs, data such as fonts and the HUD are not extracted at all.

2) I'd also like to know if the item pickup text is actually programmed into the port but is simply forced to not be displayed, or if it's leftover code that isn't used at all. The text is easy to find, and I believe I have found the offsets as well, but any editing there will freeze the game on pickups so it's hard to tell. It would be nice to restore one of the main features of the game, though as far as fixing things the portrait is more important.

Thanks in advance! :)

I.C.H.I.

I never hacked 32x games but from my experience I can tell that flipped sprite is the usual way to save memory, developers just ditched original frame. As to how to find routine which handles animation, first search for variable which holds id of the shown sprite it is very easy, you just need to advance debugger until particular sprite changes and look which values where changed from the previous search, eventually you will find the variable. To check whether it is the right variable you can freeze it or write another value into its place. Then to find routine which switches frames just put break point on write to the address of this variable.

As to why you can't find hud graphics, it's probably handled by genesis itself and 3d world is drawn by 32x addon. So you need to look for sprites in the rest of binary and they will be in formats which genesis's hardware could chew properly. There is also high chance that those files will be compressed, so you need to find unpacking routine to edit them and without knowing how to pack them back you won't be able to change them. That's is the harsh reality of romhacking unfortunately.

4lorn

Quote from: I.C.H.I. on December 20, 2019, 01:28:04 PM
I never hacked 32x games but from my experience I can tell that flipped sprite is the usual way to save memory, developers just ditched original frame.

That seems reasonable but doesn't make much sense in this case. It's the only sequence that mirrors or flips that particular set of sprites that way. They wouldn't save memory by having an unnecessary animation require memory.

QuoteAs to how to find routine which handles animation, first search for variable which holds id of the shown sprite it is very easy, you just need to advance debugger until particular sprite changes and look which values where changed from the previous search, eventually you will find the variable. To check whether it is the right variable you can freeze it or write another value into its place. Then to find routine which switches frames just put break point on write to the address of this variable.

I've found them in RAM and VRAM. It's actually the SH2 doing it, apparently: toggling off the 32X display, the HUD seems to be the Genesis' work, not the 32X. Thing is I can't properly find the ROM values. Every time I think I'm close, I'm not. I also think it's handling more than one register for this. Truth be told, I'm not smart enough for that.

QuoteAs to why you can't find hud graphics, it's probably handled by genesis itself and 3d world is drawn by 32x addon. So you need to look for sprites in the rest of binary and they will be in formats which genesis's hardware could chew properly. There is also high chance that those files will be compressed, so you need to find unpacking routine to edit them and without knowing how to pack them back you won't be able to change them. That's is the harsh reality of romhacking unfortunately.

Oh, I know that. I know where those particular graphics and textures are stored, and I've been successful at editing those with Tile Molester (editing) and Slade 3 (reinserting if I choose to extract some of them). I just mentioned this to make it clear the HUD is in no way editable in other ways :)