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

Author Topic: Hacking DBZ2 for Famicom  (Read 7178 times)

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Hacking DBZ2 for Famicom
« on: July 11, 2011, 06:14:50 am »
I'm brand new and I've been conflicted with this idea and I figured it'd be best to ask in the newbie board.
I've been learning to rom-hack so I can make translations with the eventual hope of having a quality similar to RedComet's (wishful thinking =P)

Well, I first tried to hack DBZ II for the NES all on my own and I realized that pointers were an issue because I had a lack of space. I've been trying hard to learn how to use pointers, but I've had little luck so far.  Then I saw the abandoned 70% complete project by Omniverse, Vincent, etc. and decided to use that as a springboard and now, using their pointers, I've made some names better localized/more DBZ fan-based, I've translated some cavespeak they missed, etc.

Now, here's my two questions of morality.

1) Is it okay for me to hijack someone's abandoned project like that, as long as I credit them? (I mainly ask because I can't do pointers yet, but using theirs, I can improve the quality of their hack in both terms of localization and stuff they never finished).

2) Am I stepping on RedComet's toes by also translating the same project at the same time?

Thanks for answering, I really appreciate it  :)
« Last Edit: July 12, 2011, 10:50:01 pm by KingMike »

meunierd

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 74
    • View Profile
Re: Morality of Rom-Hacking
« Reply #1 on: July 11, 2011, 06:58:00 am »
It's as moral as Red Comet putting out an unlicensed translation in the first place unless you really want to split hairs over it.

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #2 on: July 11, 2011, 07:03:33 am »
Ah, okay. I was just wondering if the community would care more about a completed translation regardless, or if they'd care more that it was all my own work.
I'm sure when RedComet finishes his translation, it'll be as great as his 1st, 3rd, and Gaiden DBZ translations. I just think I might be able to springboard from this translation and get it out fairly shortly, as opposed to a few months.

Thanks  :)
« Last Edit: July 11, 2011, 07:19:23 am by Kirby115 »

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5787
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Morality of Rom-Hacking
« Reply #3 on: July 11, 2011, 08:40:15 am »
It is generally accepted by the community these days to work off somebody's else's work if you give proper credit. This is especially true if you completed an otherwise abandoned project. If the original author can still be contacted, it's best practice to contact them about it if possible for their blessings, and possible additional aid/help.

As far as 'competing' projects on the same game, some people do still get worked up over that sort of thing, but I believe the majority will not take issue. Before starting a project for a game somebody else is doing, it's best practice to explore possibilities of collaboration. However, it's understandable if collaboration may not be possible, or desirable, with the individuals involved due to direction, commitment level, or any number of issues.

Morality of the hobby is up to the individual, but you'll get along and be accepted much better with your peers if you take a few minutes for best practices above, as an act of friendliness and respect toward your peers. :)
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #4 on: July 11, 2011, 09:06:43 am »
Thank you. Because of this, I've sent RedComet an email asking if he'd like my help or if not, if I could go on and make a translation side-by-side.

I just didn't want to commit any taboos lol.  :P

MathOnNapkins

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Who ya gonna call
    • View Profile
    • Arc-Nova - Rohmackin' and Chiptunin'
Re: Morality of Rom-Hacking
« Reply #5 on: July 11, 2011, 09:48:30 am »
Thank you. Because of this, I've sent RedComet an email asking if he'd like my help or if not, if I could go on and make a translation side-by-side.

I just didn't want to commit any taboos lol.  :P

I like the cut of your jib. :D

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Morality of Rom-Hacking
« Reply #6 on: July 11, 2011, 09:54:20 pm »
...and for the pointers, look at it like an index in a book.
The only difference is the format of the indicated page (example page 24):
some time it will be normal (24), reversed (42), with too man numbers (0024), a calculation (55 > 55-31=24) or a combination of any of them.
Like in a book, sometime you have 2 index entries that point to the same page.
What will be the same is the distance between "chapters" (the pointed pages).

Pointers is very important for romhacking...without them, you will not really get far.

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #7 on: July 12, 2011, 06:39:43 am »
...and for the pointers, look at it like an index in a book.
The only difference is the format of the indicated page (example page 24):
some time it will be normal (24), reversed (42), with too man numbers (0024), a calculation (55 > 55-31=24) or a combination of any of them.
Like in a book, sometime you have 2 index entries that point to the same page.
What will be the same is the distance between "chapters" (the pointed pages).

Pointers is very important for romhacking...without them, you will not really get far.

Right, I know that. I tried hacking and I was left with terrible limitations (for English speakers, anyway).
Trying to make complete thoughts out of like 50 characters doesn't turn out very well.
So I realize I have to find blank space and point the game to those spots for things like names, commonly spoken words (Dragon Balls, for instance), etc.

I read Mad Hacker's Guide to Pointers two times fully and I went over the searching for pointers part many times, using the FFI example. I followed his instructions pretty well and I kept finding the wrong offset to change the pointer. It took me like 8 tries of searching for the hex value to finally find the right one (when he said it'd take 1-2) and I finally was able to talk to the air and see "The princess always worries about you" as opposed to "Nothing here."
So I get the general idea, but I'm clearly not applying the principals the right way.

I tried seeing how Omniverse and Vincent used their pointers/how they arrived there/where the pointers point to or visa versa and I couldn't figure out how they did it. I think I understand that you have to go where there's space, subtract 10 in Hex, reverse the values and then go to that hex offset, but it's just not making sense to me.
I also don't understand how to find a pointer table at all, really. I read that section a lot and am lost.

EDIT: I tried the FF1 test again and got it on the first try this time, so I think I needed to walk away from it and come back to it, but I still don't understand the concept in general.
« Last Edit: July 12, 2011, 07:26:54 am by Kirby115 »

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Morality of Rom-Hacking
« Reply #8 on: July 12, 2011, 07:32:34 am »
One thing you're not getting is banks. The NES can't address an entire ROM, so it breaks up the ROM into chunks. These slot into predetermined positions in the system's memory. The short version is, the addresses you find in a hex editor aren't the ones the NES is looking for.

I'd tell you how to calculate the NES addresses, but that depends on the particular mapper the game uses. And in Japan, boy howdy there are a lot of mappers. (In America, there are only five. Go figure.)

As for the 10h value, that's not arbitrary. All NES ROMs require a tiny little piece of metadata appended to the start of the file: sixteen bytes (10h) which tell the emulator which mapper and whatnot the game uses. This data isn't part of the original ROM, so hacks have to work around this offset.

"Reversing the values," as you term it, also has a perfectly logical impetus behind it. Addresses are stored in what's called "little-endian" format - the least significant byte is stored first; the most significant byte is stored last. That is, the value $BEEF will be stored as the byte values EF BE. It may seem confusing, but remember that these numbers were never meant to be human-readable: the format makes perfect sense from a programming standpoint.

So. The thing you're missing is how to convert file addresses into NES addresses. It sounds like you've made quite a lot of progress already, even if you don't quite understand how it all works. Hopefully my explanations will help that problem a bit, though.
In the event of a firestorm, the salad bar will remain open.

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #9 on: July 12, 2011, 07:44:20 am »
As far as the mapper goes, I'm nearly positive it's 16. I saw it with one of the debugging tools I was using, and I just recently looked it up and it's the Bandai mapper for DBZ/Gundam games, apparently.

The "little-endian" format explanation helped me understand a bit more, thank you  :)

Does $ just stand for the offset, by the way?

Thanks again, I'm just trying to genuinely learn because I want to translate something and release it. Especially if it's a game I know I, my friends, and others will like  :P

EDIT: It's odd, but Omniverse and Vincent use 1 byte pointers somehow. Because my text is always like this (I made a table based off of their tile-set): "Are there .s on Earth too?" and when I go to the period's byte, the hex value is F2 and stands for Dragon Ball. When I look through the entire file and find Dragon Ball, I can't relate the F2 to any part of it.
I found Dragon Ball @ &H03F0A4 and the 1 byte pointer used is F2. - Like stated above.
I found Z Warriors @ &H03EFD1 and the 1 byte pointer used is F4.
All of these words that are frequently pointed to are in a large list separated by the byte 00.
« Last Edit: July 12, 2011, 08:12:01 am by Kirby115 »

Gil Galad

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • Homepage of Gil Galad
Re: Morality of Rom-Hacking
« Reply #10 on: July 12, 2011, 10:35:34 am »
What makes NES games confusing is a the massive amount of mapper controllers. iNES format has a header that's 16 bytes, 0h - 0Fh and then the ROM data starts at 10h. You have two types of ROMs, one with CHR-ROM or one without CHR-ROM. CHR-ROM is the graphic tiles. The header is there for emulators of course, it's not actually used on a real NES.

For example; Super Mario Bros. 1 iNES mapper 0.

0-0F - Header

PRG-ROM (Program ROM) - 10 - 800F

CHR-ROM (Character ROM) - 8010 - A00F.

That's the basic layout of the file if you viewed it in a hex editor. Your pointers would be found anywhere in the PRG-ROM area. I know it's kind of confusing but there are two concepts to understand. That's file offsets and memory addresses. File offset is the location in a file. Memory address is active memory when a bank of a file is loaded into memory.

Most NES games have a ROM memory map of $8000 - $FFFF (these are active memory addresses). So, Super Mario Bros. 1 is loaded into $8000 - $FFFF. So, if you wanted to know what file offset is what memory address you'd have to convert. For example 10h is $8000. Offset 7E30 converts to $FE20 address. This is the basic formula for mapper 0 games. Offset + $8000 - 10h = memory address. To convert to file offset; memory address - $8000 +10h = file offset.

Why is this important for pointers? Because everything has a location. For example if the text "The princess is in another castle." is located at 4010h (file offset). You want to find the pointer to that. So, do the formula. 4010 + $8000 = $C010 - 10h(header) = $C000.  So, the text is located at $C000. So, you'd want to find the pointer to the text. You flip the bytes around like so 00C0 and search in the ROM. (this is just an example and not the true location of the text in this ROM).

It gets confusing for other mappers because they use banks. These banks are loaded into the ROM space somewhere in $8000 - $FFFF. Standard bank sizes are;

2000h - that's 8KB  Common for games that use MMC3 mapper controller.

4000h - 16KB Common for games that use MMC1 mapper controller.

8000h - 32KB Common for games that have no mapper. Or mapper 3, 7, etc.

Mapper 16 has various configurations that you need to look up if you want to know the bank size that's loaded.

When you get to other games that have a mapper controller. You need to find out the bank size select and which bank is loaded into what address space. For example for a game that loads 8KB sized banks. BTW, banks are not always stored in this order. This is just a general example.

0-0F header

    10 - 200F - bank 0 $8000 - $9FFF

2010 - 400F - bank 1 $A000 - $BFFF

4010 - 600F - bank 2 $C000 - $DFFF

ETC.


This is how I do it and it's based on NES development information to some extent. There is also some documents on this site to explain NES pointers that is slightly different than my method.


Homepage of Gil Galad || New Forum

“I don’t know half of you half as well as I should like; and I like less than half of you half as well as you deserve. ”

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #11 on: July 12, 2011, 11:12:30 am »
Thank you very much. I found a lot of info on mapper 16.

It stores things in 16K banks. - http://tuxnes.sourceforge.net/mappers-0.80.txt

"CPU $8000 - $BFFF    16KB PRG ROM, Bankable
CPU $C000 - $FFFF    16KB PRG ROM, Fixed to the last page of PRG ROM"
- https://sites.google.com/site/qbradq/hardware/ines-mapper-16-subset-in-discreet-logic

I'll use this information to try to better understand the pointers, thanks so much again =)

July 12, 2011, 12:26:03 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I read through the Mad Hacker's Guide to Pointers again, and I think this might be a sequential text game, which apparently doesn't use pointers. But that still doesn't explain how they used 1 byte to point to something @ 0x03EFD1. The byte they use for that is F4. I'm very confused. (It points to "Z Warriors", if you're wondering.

The pointer attempts I tried didn't work, so I'd assume that this might really be sequential text. I can choose the line breaks and save space on one line to add characters to the next or the one before.
« Last Edit: July 12, 2011, 09:00:55 pm by Kirby115 »

RedComet

  • Hero Member
  • *****
  • Posts: 3168
    • View Profile
    • Twilight Translations
Re: Morality of Rom-Hacking
« Reply #12 on: July 12, 2011, 12:57:59 pm »
I can assure you this game does have pointers. The text isn't stored in order and it uses a batshit crazy way of determining which string to get that was abandoned for DBZ3. That said, F2 and F4 aren't pointers, per se. They're part of the dictionary compression scheme that the developers added to the game. Those values are transformed into indexes into a pointer table for the strings you found at and around $3EFD1 in the ROM.

I got your email, so I'll reply to that with more.
Twilight Translations - More than just Dragonball Z. :P

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7067
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Morality of Rom-Hacking
« Reply #13 on: July 12, 2011, 06:56:52 pm »
I'm thinking the topic title should be changed, since it appears to be specifically talking about hacking DBZ2. :)
"My watch says 30 chickens" Google, 2018

Pennywise

  • Hero Member
  • *****
  • Posts: 2354
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: Morality of Rom-Hacking
« Reply #14 on: July 12, 2011, 07:07:23 pm »
From the sounds of it, it seems this is a game that will more often than not break the will of a new hacker instead of the other way around.

Gyroballer

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 46
    • View Profile
Re: Morality of Rom-Hacking
« Reply #15 on: July 12, 2011, 08:58:50 pm »
@KingMike I never knew the conversation would take off, so yeah, that'd be acceptable/reasonable.

@Pennywise It hasn't broken my spirit, but RedComet and I agree that I should leave this particular one to him. I might be able to help a little bit down the road on it or other things, though. For now, I'd like to just up my skills on something slightly easier while slowly getting accustomed to ASM on the side.