+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Utilizing free space in an expanded rom...
Pages: [1] 2
Author Topic: Utilizing free space in an expanded rom...  (Read 2 times)
strings805
Guest
« on: November 05, 2009, 08:07:47 pm »

Hey all, I'm about 75% of the way done in my hack of Final Fantasy VI, but I've stumbled across a rather daunting speed bump. I expanded my rom, leaving me with tons of blank space, and I've gotten the hang of the rom editing syntax to a decent degree where I can safely experiment with it, but here's my issue. I spoke to Lenophis and he said he moved the dialogue portion of the rom, since it's right underneath the events to make room for more dialogue and events. However, I'm not a hundred percent sure how to do this. Where would I move the dialogue too? Do I have to move everything beneath the events down into the all free space in order to create a gap between the two sections so I can add in my own events? If I sound dumb, I understand, but any help at all would be much appreciated.

P.S. this topic is also up at a few other rom hacking sites. Not trying to spam just looking for all the help I can get, and until I was referred here by another hacker no one was responding lol
« Last Edit: November 05, 2009, 08:39:04 pm by strings805 »
Ryusui
Guest
« Reply #1 on: November 05, 2009, 09:32:23 pm »

You know about ROM banks, right? If you've expanded the ROM, then it ought to be safe to give the dialogue a bank all its own.

Note, however, that if the pointers are two-byte instead of three-byte, then you're going to need to do some hacking to make sure the game is looking for its dialogue in the right place.
strings805
Guest
« Reply #2 on: November 05, 2009, 11:21:28 pm »

How do I go about moving the dialogue to it's own bank? I tried doing a cut and paste experiment one time...it ended pretty terribly lol
Ryusui
Guest
« Reply #3 on: November 06, 2009, 01:17:24 am »

Change the address that the script insertion begins at. You'll need a basic grasp of the SNES memory map to pull it off. IIRC, FFVI is a HiROM game, so basically you take the PC address and add $C0:0000 to it to get the full pointer. (Conversely, you take the SNES address and subtract $C0:0000 to get the PC address.)

But again, if the pointers are only two bytes long (i.e. missing the bank byte), then you're going to need to engage in some ASM trickery to get it to look for the script in the right place.
strings805
Guest
« Reply #4 on: November 06, 2009, 08:49:32 pm »

Ok, the game's script begins at D0200. I lack knowledge on SNES memory map, so how would I go about adding $C0:0000 to D0200. Would I do it in the literal sense in that I just add them together, leaving me with CD:0200? As far as this form of hacking, I am very inexperienced, so please bare with me =/
Tauwasser
Guest
« Reply #5 on: November 06, 2009, 09:01:38 pm »

Quote from: strings805 on November 06, 2009, 08:49:32 pm
Ok, the game's script begins at D0200.

Kewl, now tell us where? In ROM? In RAM? In DUCKBURG?

Quote from: strings805 on November 06, 2009, 08:49:32 pm
I lack knowledge on SNES memory map

Good. Now look through the document section to your upper left and see if there is anything pertaining to the SNES memory map at all. Hint: There is. Lots.

Quote from: strings805 on November 06, 2009, 08:49:32 pm
Would I do it in the literal sense in that I just add them together, leaving me with CD:0200?

No. You would read up on the SNES memory mapping, make conclusions about your problem at hand and compute the right mapped address that will work for your SNES rom.

Quote from: strings805 on November 06, 2009, 08:49:32 pm
so please bare with me =/

No.

cYa,

Tauwasser
strings805
Guest
« Reply #6 on: November 06, 2009, 11:07:46 pm »

The dialogue starts at offset 0x000D0200 in the rom (I used Hex Workshop v6.0.1.4603). All two of the documents that talked about SNES memory, while helpful in understanding the concept, gave me only vague ideas as how to address my issue. I also went to ROM Hack City (http://romhack.wikia.com/wiki/SNES_ROM_layout) which gave me similar information which helped me conclude this.

The dialogue is in bank $0D. I need to move it somewhere else so I can make room for more events. Since i expanded the rom, I have banks $30 through $40 available to me. My issue now is how to tackle the moving of it.

To Ryusui: The points aren't two bytes long (from what I can tell) so, when you said add C0:0000 to get the full pointer, how exactly did you mean? Am i correct in the conclusions I'm making so far?

To Tauwasser: Thanks for at least recommending some material to read, I went beyond what you recommended but could still use some help.

Thanks all.
KingMike
Guest
« Reply #7 on: November 07, 2009, 12:14:26 am »

Also, check whether there is a header on the ROM.
(the easy I tell is to look at the size in KB (reported by Windows Explorer). Odd value (like 3,073) = header, even (3,072) = no header)
strings805
Guest
« Reply #8 on: November 07, 2009, 12:22:24 am »

Yes, there is a header. The offset address I gave, without a header I think would be 0x000D0000 instead of 0x000D0200, if that's any help as to what I'm working with.
Tauwasser
Guest
« Reply #9 on: November 07, 2009, 04:20:21 am »

Quote from: strings805 on November 06, 2009, 11:07:46 pm
The dialogue starts at offset 0x000D0200 in the rom [...]
The dialogue is in bank $0D.

Now just where did you get that information from if you read and understood the Rom Hack City SNES ROM layout page? For your rom to be able to start with bank 0x00 (and be fully accessible therein), it would need to be LoRom, yet your offset and bank sizes do not match up with the calculated bank number.
I guess now that your rom is either LoRom and you did not use the correct formula, both of which were given at the page, or you used a HiRom layout counting from bank 0x00 instead of 0xC0 or 0x40.

You either have LoRom, which would yield bank 0x1A or 0x9A, or HiRom which would yield bank 0x4D or 0xCD, depending on the code used. If you have other mappings, you will have to look them up and do the conversion yourself. Or use Lunar Address to do it for you. I believe ExLoRom and ExHiRom use the otherwise mirrored banks to access different stuff and have certain speed penalties to different access ranges, but don't quote me on this.

So now please, don't just read over a document and say "got it, doesn't help" and instead go grab a debugger and get some hands on experience with memory mapping for your particular game so you'll get a grip what the flip you're talking about. Because then you'll be able to get what people here tell you much easier.
What you need to do is, as Ryusui said, you will need to locate the pointers. If they have a bank byte attached to them, you are going to be just fine and all set, because you can simply change these. If they do not have a bank byte attached, and let's face it, changes are they won't, you will have to locate all code processing these pointers and move that to the new banks as well, so you can access your newfound space.
Now is the time to read up on SNES ASM, addressing modes and addressing ranges. Right after you got that damn debugger out and tried the mapping you proposed on your rom and see how it's bogus and won't work.

cYa,

Tauwasser
« Last Edit: November 07, 2009, 04:31:26 am by Tauwasser »
Ryusui
Guest
« Reply #10 on: November 07, 2009, 06:17:14 am »

Quote from: strings805 on November 06, 2009, 11:07:46 pm
To Ryusui: The points aren't two bytes long (from what I can tell) so, when you said add C0:0000 to get the full pointer, how exactly did you mean? Am i correct in the conclusions I'm making so far?

Not quite. When I say the PC file address, I mean the address that a hex editor (set to default mode) will give you: in this case, D0200. You add C00000 to that; in this case, the ROM address (as far as the SNES sees it) comes out to CD0200 (i.e. bank CD).

If each and every pointer includes that bank byte, then you're good to go. If not, you're gonna have to find out how the game determines which bank to look in and hack it to point to the bank you're going to use. A good way to start would be to set a read breakpoint to the start of a given string and tracing the execution backwards from there. Figure out where the address comes from; once you do, it should be trivial to change the code to make it look in a different bank.
Tauwasser
Guest
« Reply #11 on: November 07, 2009, 06:24:30 am »

Quote from: Ryusui on November 07, 2009, 06:17:14 am
Quote from: strings805 on November 06, 2009, 11:07:46 pm
To Ryusui: The points aren't two bytes long (from what I can tell) so, when you said add C0:0000 to get the full pointer, how exactly did you mean? Am i correct in the conclusions I'm making so far?

Not quite. When I say the PC file address, I mean the address that a hex editor (set to default mode) will give you: in this case, D0200. You add C00000 to that; in this case, the ROM address (as far as the SNES sees it) comes out to CD0200 (i.e. bank CD).

Only for HiRom (and maybe derivatives of that), which you forgot to stress once again. I cannot be bothered to download the rom and check it out for myself. I assume you're right, because it probably is not LoRom, but I think it's much more important to understand the underlying concept for those additions rather than to make it a default formula in one's head, close one's eyes and hope for the best.

cYa,

Tauwasser
creaothceann
Guest
« Reply #12 on: November 07, 2009, 06:41:49 am »

OP: Remove that header. Roll Eyes

Code:
---------------------Internal ROM Info----------------------
       File: Final Fantasy VI (J).sfc
       Name: FINAL FANTASY 6          Company: Square
     Header: None                        Bank: HiROM
Interleaved: None                        SRAM: 64 Kb
       Type: Normal + Batt                ROM: 24 Mb
    Country: Japan                      Video: NTSC
  ROM Speed: 120ns (FastROM)         Revision: 1.0
   Checksum: Good 0xA172            Game Code:
---------------------------Hashes---------------------------
      CRC32: 45EF5AC8
        MD5: 97BF78E916B80F47CF35EDF502BE34DC
--------------------------Database--------------------------
       Name: Final Fantasy VI
    Country: Japan                   Revision: 1.0
     Port 1: Gamepad                   Port 2: Gamepad
    Genre 1: RPG                      Genre 2: Turn Based
Talbain
Guest
« Reply #13 on: November 07, 2009, 06:44:20 am »

Yeah; header bad.  Ice cream delicious.  Hulk Smash.
strings805
Guest
« Reply #14 on: November 07, 2009, 03:55:20 pm »

I downloaded a special version of Snes9x that had a debugger on it, and it removed the header. Adding C00000 to where the dialogue began, (which is now D0000 without the header), yes, it begins in bank CD, but it doesn't stay in bank CD, it goes into bank CE as well. The debugger has options for setting breakpoints and whatnot, which means, I've got some work ahead of me tonight lol.

Thanks everyone for helping me out with this, if you've anymore recommendations, free free to let me know. I'll keep you all up to date on my progress/when this hack is done I'll definitely submit it to here  Grin
Pages: [1] 2  


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