+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  I've created some extra space, but how do I go about using it?
Pages: [1]
Author Topic: I've created some extra space, but how do I go about using it?  (Read 585 times)
DarknessSavior
Guest
« on: September 29, 2007, 11:25:44 am »

Having hacked around the nigori (dakuten/handakuten) code in Demon's Blazon, I now have some extra space to work with (the space that was previously available for the nigori).

I talked to Gemini about it, and he said I would want to move the tilemap to take advantage of the new space. DaMarsMan says otherwise. Does anyone actually KNOW what I'd want to try to do?

Here's a picture for an example:



See all that empty space above each line of text? I want to use that for extra text (effectively giving me about 2+ extra lines per dialogue box).

~DS
Gideon Zhi
Guest
« Reply #1 on: September 29, 2007, 11:29:57 am »

Depends on how the game builds its tilemap. *most* games keep a carbon-copy of it in WRAM and just DMA that to VRAM when the screen needs to be updated; if this is the case, then you don't need to "move" anything.

Trace the text routine using geiger's snes9x or something similar, and look for an ADC #$40; try changing it to ADC #$20. This doesn't always work, but it's a good place to start.
DarknessSavior
Guest
« Reply #2 on: September 29, 2007, 12:24:33 pm »

Thanks, I'll give that a shot when I get home. Definitely need to read more about SNES hardware, though. ^_^

~DS
DaMarsMan
Guest
« Reply #3 on: September 29, 2007, 12:38:32 pm »

If that's 8x8 that all you would be doing is basically what everyone does for a double line item hack. You just need to change the location of the write in RAM. I'm still not clear on what you want...You say 2 lines extra but if you did below every line of text there you would get 3.
Gideon Zhi
Guest
« Reply #4 on: September 29, 2007, 09:33:36 pm »

Might as well use this as an excuse to explain a little about tilemaps.

Basically, the screen is built with tiles. You knew that. The tilemap is what says which tile to display in which particular location, whether it needs to be flipped or rotated, and what palette gets assigned to it. If you think of the SNES's screen as a grid containing 16x16 tiles (although that's not *strictly* correct it'll work for our example) the tilemap is the grid itself, with each 2-byte entry representing a single tile. Thus since each row is 16 tiles, it contains 32 bytes. When your game ADC #$40 or ADC #$0040 it's moving the write cursor past the current #$20 byte line, then leaving the *next* #$20 byte line blank.

What DaMarsMan says about the dualline hack is mostly correct, except in this case doing something like this is a whole lot simpler. Dualline hacks (at least the way I do them) require that you write your own linebreak routine specifically for an item list that doesn't normally *have* a linebreak command, then making sure that it doesn't muck up where the next item afterwards goes. For your game, you're just modifying existing code, not rolling your own from scratch. It's a whole lot easier Smiley

Once you've successfully located the tilemap, either in wram or in vram, try playing around with the values and seeing what happens to the stuff on-screen. Best way to learn!

I try to stay away from the kind of hack you're proposing, though. It tends to make the screen a little busier than it ought to be, and it's something I'd like to keep a definite leash on from here out.
DarknessSavior
Guest
« Reply #5 on: October 01, 2007, 07:12:31 am »

Thanks for all the info Gid! I pretty much had a handle on what a tilemap is (RedComet and I talked about it a while back), but the refresher was nice.

Yeah, I'm kinda worried about the screen being too crowded myself. But I'd imagine doing this would be easier than say, expanding the text boxes. Or is it?

Also, I'm experiencing a WEIRD error. For some reason my version of the rom with the nigori ASM hack I did won't breakpoint for the first line of dialogue. It'll breakpoint for the 16x16 stuff I haven't hacked yet, but not the 8x8 stuff. Is there any reason it wouldn't?

I mean, I didn't change the location of the text or anything, so it should still snap when it did before. I checked the version I have with the nigori intact and it worked just fine. Granted, the code is still exactly the same, so I could look at that to get an idea of where the code I want is and edit it in the new rom, but I'd like to use breakpoints on the new rom. >.<

Edit: Heh, I found the ADC. It's "ADC #07". Is there any significance to it HAVING to be #$40? I'd imagine I'd just want to take the #$07 and half it, right? I could be wrong, though. XD

~DS
« Last Edit: October 01, 2007, 08:10:55 am by DarknessSavior »
Nightcrawler
Guest
« Reply #6 on: October 01, 2007, 09:29:54 am »

Yes.. there is GREAT significance to the number. Did you not read the information? Re-read it again and tell us why he suggested 40. Tongue

In all seriousness, if you can answer that question, you'll understand why 7 is most likely not going to be correct.

Gideon provided an example of horizontal logic. Another alternative the game may have with it's tilemap is vertical logic with the tilemap. It may have a y coordinate for the line it draws one which gets incremented by 2 to skip a blank line. Or it may get incremented by one. That 'virtual' coordinate will then be run through a few lines of code to turn into the actual tilemap address to start writing on.

We're also assuming here the font is just a straight tile mapped font (full font is permanently stored in VRAM) Did you verify that to be correct? I don't like to make assumptions in ROMhacking. I've been tricked before assuming a game did something a certain way, pounding my head not finding the answer because I wasn't open minded enough that it was doing something different. It's easy to fall into the assumption trap. Wink

Instead, I approach things with an idea of what I may find, however I still keep the mentality that I have no clue until something concrete in the code or ROM/RAM/VRAM tells me otherwise. Facts only basis. Grin

DarknessSavior
Guest
« Reply #7 on: October 01, 2007, 10:52:52 am »

Quote from: Gid
When your game ADC #$40 or ADC #$0040 it's moving the write cursor past the current #$20 byte line, then leaving the *next* #$20 byte line blank.

Doh. I forgot that part. So obviously I didn't find the right ADC.

Any reason why my ASMified copy of DB won't breakpoint? O.o

~DS
Ryusui
Guest
« Reply #8 on: October 01, 2007, 12:58:19 pm »

Because you're putting the breakpoint in the wrong place, perhaps?

Set a read breakpoint for the first line of text in the ROM (use a tool like Lunar Address to convert the PC address to the SNES address) and step through the code. See if it actually goes through your print routine.
DarknessSavior
Guest
« Reply #9 on: October 02, 2007, 10:51:20 am »

I know how to set breakpoints. It just doesn't work on this particular rom. When I use it on the copy before I made the ASM modifications, it breakpoints fine. The one afterwards does not. >.<

Edit: Would it be possible that it could do an ADC #$0050, moving the write cursor past the #$20 byte line and leaving the next #$30 bytes blank? It does one like that in a subroutine that repeats a ton. I haven't analyzed the code yet, but I haven't found #$0040 yet either.
 
~DS
« Last Edit: October 08, 2007, 09:26:56 am by DarknessSavior »
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC