News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Final Fantasy I (NES) - Sprite Editing  (Read 19251 times)

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Final Fantasy I (NES) - Sprite Editing
« on: September 26, 2015, 03:03:16 am »
Hi guys!

So I'm planning on translating Final Fantasy (NES) into german. I already downloaded FFHackster, which is a really helpful but there's one problem.
I can't type umlauts (ÄÖÜäöü) and eszett (ß) which is why I thought maybe there are some rarely used special characters in the font sprite which I could replace with my needed letters.
But I've got no idea how to get access to the sprites of the game, but then also be able to save them into the rom once edited.
This would be also useful so I could translate the "New Game" stuff and the Intro roll. Maybe you have an idea? Help is highly appreciated since I got zero clue about real rom hacking.

Thank you very much in advance!  :)

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #1 on: September 26, 2015, 04:37:09 am »
You will need a Tile Editor to modify those "sprites".

Letters and other symbols are nothing more than sprites, just like the rest of the graphics of a game.
There are several tile editors out there, for NES I usually use Tile Layer Pro.

http://www.romhacking.net/utilities/108/

It's quite simple to use. Load the game (Make a backup file if you want) and scroll down until you see the letters.

Looking at it myself, it seems that the text starts at the offset 24310. If you want to go directly, click on Edit and Go To and type that number (Although should be named offset).

You should see something like this:


Each square represent one sprite, with a dimension of 8 pixels by 8 pixels.

Maybe you can reuse those japanese characters.
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #2 on: September 26, 2015, 06:16:17 am »
Thank you very much! This is exactly what I was looking for.  :)

At this point i have no idea how to access the japanese characters though. For example If I put in を in the dialogue editor of FFHackster it turns into a '?' because it seems that FFHackster is not made for these kind of characters. So I wonder how I can access these characters... if I could do that, that'd be so awesome...

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #3 on: September 26, 2015, 07:37:32 am »
Uhm... Well, I don't know if you could use FFHackster for those, but a hex editor with a character table could do de trick.

Each sprite has it's own value, and the japanese characters should be the same. By creating a table (You can look it up, shouldn't be too hard) you can write the text through the hex editor.

A table is something that looks like
A=00
B=01
C=02

Etc... But that's an example. The numbers are the values of the letter, and not always start with 00. If you want to know which values the letters have, you can use an emulator like FFCEUX with it's debug options, by using the PPU function.

In case of FF1...



The Japanese characters start with 7B. Then it's just counting in hex,

Second Japanese Character=7C,
Third Japanese Character=7D,
Fourth Japanese Character=7E,
Fifth Japanese Character=7F,
Number 0=80

And so on. By creating a table you can see the text in the Hex editor, and edit it as you wish.

If I were you, and there is not a better way to do this (I'm faaar from being an expert), you could translate the game via FFHackster for easiness and write down all the uses of umlauts and eszett and change then through the Hex Editor.

But maybe someone with more wisdom can help you better.
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #4 on: September 26, 2015, 08:52:43 am »
Thank you very much for your help!

It works now and I'm able to use ß and all umlauts except for Ö because there wasn't enough space for it.
But since Ö is rarely used it doesn't matter. Thank you very much and I hope I'll be able to translate every little thing.  :)


Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #5 on: September 26, 2015, 09:15:04 am »
Happy to help, I hope your project goes well!
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #6 on: September 26, 2015, 11:10:54 am »
Okay, I've got another question!



So in hex editor where it says "NEW GAME" i'd like to have "NEUES SPIEL" but that'd mean 3 additional characters.
I can only replace it by a word with less or the same amount of characters, am I right? Or is there a possibility to extend the hex code?
I could also do "NEU" which is kinda lame but at least it has less characters and then fill the rest with FF (blank space), but this would look pretty sad I guess haha.


« Last Edit: September 26, 2015, 12:06:36 pm by Shokupan »

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #7 on: September 26, 2015, 12:00:42 pm »
All answers are in the disassembly!

http://www.romhacking.net/documents/401/


The routine which draws the title screen is "EnterTitleScreen" in bank_0E.asm, line 3487.

If you make the text longer, you will have to change the box size/position:

0x3A170 = X position of both "new game" and "continue" boxes
0x3A174 = Y position of "continue" box
0x3A178 = height of both "new game" and "continue" boxes
0x3A17C = width of both "new game" and "continue" boxes
0x3A192 = Y position of "new game" box

0x3A1CB = X position (in pixels) to place cursor for both boxes
0x3A282 = Y position (in pixels) to place cursor for "Continue" box
0x3A283 = Y position (in pixels) for cursor for "New Game" box



There isn't a pointer table for the  text -- and instead the pointers are hard coded in the drawing routine, much like how the box sizes are.


As for how to solve your text problem.... the game actually does support DTE here.  So if you take advantage of DTE pairs you might be able to fit more text into a smaller space.
Also, the same space is shared for "Continue" / "New Game" / "Respond Rate" text -- so if you use less space for one of those strings, you free up space for another one.
Of course, doing that means you'll have to adjust pointers.

The problem is there is no pointer table for these strings -- and instead the pointers are hardcoded in the drawing routine:

0x3A183 = low byte of pointer to "Continue" text
0x3A187 = high byte of "Continue" ptr
0x3A199 = low byte of "New Game" ptr
0x3A19D = high byte of "New Game" ptr
0x3A1B3 = low byte of "Respond Rate" ptr
0x3A1B7 = high byte of "Respond Rate" ptr

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #8 on: September 26, 2015, 12:33:52 pm »
No wonder I wasn't seeing pointers for "NEW". I facepalmed so hard that i woke up the dog, lol.

Thanks for clearing that up.
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #9 on: September 26, 2015, 12:35:02 pm »
Hello Disch! Thank you very much for your explanation and the disassembly!

So I'm not really much of a programmer but I tried to think logically. I changed the code so the first box would be smaller and the second one bigger.
This is how I did it:



Turns out it didn't work. When I run the build batch it gives me an error at the end. Am I not allowed to write extra code? Or did I just mess up?
Thanks in advance! Btw, what means "0x3A170" etc.?

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #10 on: September 26, 2015, 12:42:15 pm »
The offsets on the Hex editors -- Usually when someone gives offsets it's in that format.

For searching purposses you can ignore the 0x, as it's a prefix used to inform that it's a Hexadecimal number.
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #11 on: September 26, 2015, 12:43:05 pm »
Quote
Am I not allowed to write extra code?

Not without freeing up space.  The disassembly produces every byte in the ROM, so if you are going to add new code (new bytes), you'll have to delete others to make room.

Quote
Btw, what means "0x3A170" etc.?

It's a file offset.  The '0x' prefix just means the number is in hexadecimal.  So that would be offset 3A170

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #12 on: September 26, 2015, 12:53:02 pm »
Quote
Not without freeing up space.  The disassembly produces every byte in the ROM, so if you are going to add new code (new bytes), you'll have to delete others to make room.

Wow, this seems to be really tricky then. I mean, where do I even begin to make room? I can't just go delete some code, can I? haha

Quote
It's a file offset.  The '0x' prefix just means the number is in hexadecimal.  So that would be offset 3A170

I'm kinda confused. Sorry for asking such newbie questions. But isn't hexadecimal supposed to be a set of 2 characters always? So how can 3A170 (5 characters) be hexadecimal? Isn't there are character missing? Well, obviously not, but I don't get it. Also, where do I find this in hexadecimal code? Like when I open the .nes in my hex editor, do I have to search for '3A170'??

Edit: Okay, ignore my last question. I figured it out myself. Jeez, I can't believe how stupid I am sometimes, lol.

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #13 on: September 26, 2015, 01:15:05 pm »
Don't worry, I was worse!
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #14 on: September 26, 2015, 01:36:58 pm »
Wow, this seems to be really tricky then. I mean, where do I even begin to make room? I can't just go delete some code, can I? haha

It is tricky.  You usually can't flat out add new code -- you typically have to refactor code either to optimize it to be smaller, or to find free space somewhere else and jump to it.

It's not easy.

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #15 on: September 26, 2015, 02:17:58 pm »
Thank you very much for your replies and for your help, guys!

To change the title screen the way I want seems pretty complicated to me and I don't know if I'm able to do it right now,
so I guess I'll start translating first and do this at the very end. For now, I obeyed the rules and made it like that:



Looks a bit shitty because of the blank spaces in the first box, but it'll do for now, I guess.

But I discovered a bug. I'm not sure if it's a bug from FFHackster but when I do select the classes at the beginning of the game and I switch the class
it doesn't overwrite the last class name. For example if I switch from KÄMPFER (Fighter) to DIEB (Thief) it becomes DIEBFER...



Does anyone have a clue why it is like that and how to solve that?  :-\

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #16 on: September 26, 2015, 02:23:32 pm »
Quote
Does anyone have a clue why it is like that

The drawing routine is stupid and doesn't wipe the old name.  It just draws the new name on top of the old.

Quote
and how to solve that?

The easiest way is to do what the original game did:  Pad class names with spaces so they're all exactly 7 characters long.

That is... "THIEF" is actually "THIEF[space][space]"



Or you could rewrite the drawing routine.... but ehhhh

Shokupanda

  • Jr. Member
  • **
  • Posts: 36
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #17 on: September 26, 2015, 02:34:51 pm »
Aaaahhhh, riiight. Of course! Damn, I should have been able to figure it out myself. Well, it works now! Thank you very much!!  :)

Maeson

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #18 on: September 26, 2015, 04:49:38 pm »
Yeah, sometimes games work in very weird fashions. I find discovering these things pretty fun,  when they are not annoying to deal with, of course...

One of the most curious cases of "weird programming" I've seen, was one time when I messed up with a Super Nintendo RPG where spells learnt by the characters where stored in a way I never saw before: Each character had the full spell list avaiable, but each character just had a group of spells in the real game.

And that's because the spells they don't get are programmed to be learnt at level 100, while the maximum level is 99. Each spell used a value for the level, and that was big chunks of values with each spell for each character.

I couldn't believe it at first. That's a lot of space (For a SNES game) for something that was going to get unused for the most part (Unless romhacking, of course!), but at the same time I found it very ingenious.


...Ups for the off-topic.
I'm off for some time. If for some weird, strange, and important reason, you need to talk to me, just send me a PM and probably I'll read it whenever I come back.

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2927
  • 2 + 2 = 5
    • View Profile
Re: Final Fantasy I (NES) - Sprite Editing
« Reply #19 on: September 26, 2015, 04:52:33 pm »
Quote
I couldn't believe it at first. That's a lot of space (For a SNES game) for something that was going to get unused for the most part (Unless romhacking, of course!), but at the same time I found it very ingenious.

You're not alone. I love funny little things like that.
Cigarettes, ice-cream, figurines of the Virgin Mary...