Be Nice to Items

17 years ago by Mato

Really busy with real-life stuff, so I haven’t had time to work on anything much. People might be wondering why a translator is hacking the game now, but I have *some* limited knowledge of ROM hacking, so I decided to toss my hat into the ring to help push the project along faster. Because of that, for a while this blog might turn more into a “watch the hacking process inch along” sort of theme or something. I guess if you’re not too interested in the actual hacking aspect, then you might be bored quickly.

Anyway, the last week or more I’ve been hacking away at the main menu stuff, starting with the main item screen, which is pretty important, since that’s where most of a player’s time will be spent when he/she’s in the menu. Because the menus were programmed so unhappily, it makes hacking it a real pain. Compare it to the battle menus and messages and stuff, which are much nicer and share lots of the same code. And they’re programmed to be flexible. These main menus, sadly, are very inflexible.

So anyway, rather than try to explain with words all the work that’s been put into the menus so far, I thought I’d sort of show the progress. It’s not a real progression or anything, I didn’t take pics as each thing was hacked, but I sort of recreated it by turning off hacks individually. But it shows the general progression of things.

The focus here is the item names. Don’t mind the item descriptions, that’s a whole different hellhole 😛

First, we got the original Japanese item menu. It’s full of bizarro letters. Nobody can read that stuff, we want it in English!

Using the original encoding, we’d only be able to use about 8 letters per item name. That is unacceptable for a professional-quality translation. So we must fix that. The items are encoded in 16-bit format, but the English alphabet only has about 52 different letters (upper and lowercase) and then there’s only a few punctuation marks. We don’t need 16-bits for that, 16 bits means an alphabet with 65536 letters in it. So we can ditch 16-bit. If we hack the programming to read the item names in 8-bit as opposed to 16-bit, we’ll suddenly have twice as much space for item names! sblur did this a while back. Using this hack makes the nice Japanese screen barf. Oh yeah, and we definitely want to make it display using a variable width font, that makes it look all the more professional. And using the EarthBound font would add a nice touch to it 🙂 It’s also necessary to hack the font-printing routine to draw all 16 rows of the new font. And some other font-related address hacks are needed.

The above is to be expected, since we just purposely broke how the game reads item text. But why is the text all crazy looking? Wait, we forgot the most important thing!

Gotta translate the items and insert them!

Cool. But why are the names all cut in half? Because the game still counts the names’ lengths thinking the names are in 16-bit format. We gotta fix that. It’s a pain, but we eventually figure it out.

Aww, crap. All that work, and things didn’t work out for us. Looks like what happened was the name on the left was so long that the name on the right overwrote it in memory, and the lack of a string terminator combined the two names and made general unhappiness 🙁 Fixing this requires watching the program memory as the names get written, then trying to figure out a fix for it.

Here are the names in memory. Yep, the first name got partially overwritten by the second name. The programmers assumed there would never be more than 9 characters (string terminator included) per name. This sucks, it’s gonna take some big-time magic to fix all this.

After maybe 6-10 hours of staring at code, writing notes, praying to the gods, a hack (which winds up only being 7 lines of code) is devised that rearranges the names in memory, allows for TWENTY letters per name, and even uses memory more efficiently than the original game. That should just about do it!

WTF happened?! After tracing code for another couple hours, it turns out that the problem is because the VWF routine is getting really big intial start values, which pushes everything way to the right. But why is it suddenly doing this? After even more tracing and insanity, it turns out that the programming did some weird math involving the addresses of the names in memory to determine where on screen the text should begin. Pretty weird stuff, and we broke it by rearranging memory. Time to follow some more code.

Whatever we did, it didn’t work.

After a few more hours and many more notes and tests, things are starting to look a LITTLE better. It’s cool to see that the first item name is being displayed in full, at least!

After even more work, it seems almost certain that it should all work now!

ARGH, so close! Why are the names on the right side all shifted down one row???

I’m not sure yet, and won’t have time for a few days to mess with it. But just think… this was all just to have longer item names 😯

Anyway, that’s all for now, I need sleep badly 😛

Posted on Wednesday, November 28th, 2007 at 1:48 am by Mato, filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. Comments and pings are currently closed.

56 Responses to “Be Nice to Items”

  1. Py said 17 years ago:

    First!

    Aww, so close! I really appreciate your dedication and work on this project. I can’t wait to see the final product.

    Nice try on getting the item names working too, looks pretty slick (when it’s not scrambled)

  2. Nin10dude said 17 years ago:

    Probably the most confusing post yet, but it’s nice to see how the process works. 😛 Keep up the good work.

  3. viz said 17 years ago:

    sounds pretty hard

    but keep at it

  4. KaizerSigma said 17 years ago:

    Keep it up my friends. As for you Mato, just a question, did you ever have a part of the Rolling Bomber translation? Just wondering because of the name of the team was Sexy BEAM! If not, believe me I still love you for the work you and the team have been doing, just curious is all. 😀

  5. kimba28 said 17 years ago:

    WHOA, that’s some crazy stuff but if anyone can figure it out it’s you guys. Thank you for doing this and good luck!!!

  6. yarmahar said 17 years ago:

    Mato, thanks for walking us through this stuff… it almost makes me feel like someday I’ll be able to do something as cool. I’ve tried staring at stuff in hex editors and this one dissembler… and to be able to understand that stuff, now that takes skill. To be able to understand it on your level, on the other hand, takes skill and some sort of ancient energy well that you all somehow tapped into 😛

  7. EBF said 17 years ago:

    Thanks for the update tomato. I’ve been a follower for many years on sm.net and even eb.net, but I’ve never been more excited since the day I found out about mother 3. Anyways I’ll skip my crappy fan-based reply and say I am truly grateful for everything you everyone else has done. I expect nothing less than the best translation ever, and if you fail I will totally blow up the planet. Yea, that’s how happy I am. 😀

    -Love, EBF

  8. Zero said 17 years ago:

    This way people can see that it`s not easy to make a translation for a game. You are doing a great Job.
    Good luck with the rest and thanks.

    pd: sorry for my english.

  9. FennecusKitsune said 17 years ago:

    After learning how to program some assembly this semester in college, I can totally appreciate what you’re going through. Machine code is not pretty stuff, especially when the original code was probably equally not pretty. I’ve never hacked any roms, but I can see that it’s some crazy code that you’ve got your hands on. Good luck to you and the rest of the hackers!

  10. Keller said 17 years ago:

    Excellent work – very exciting! Your time is well spent.

  11. Shadoshi said 17 years ago:

    First off, let me just say: GET SOME SLEEP! Stay healthy! We appreciate all of the works you guys are doing, but if you don’t stay in good condition, you’ll end up killing yourselves over this thing. Hehehe.
    No, but really, I loved this blog entry. I’ve been interested for a while now what kind of heck you guys have to put up with and how much effort it takes to fix it all. This post has shown me a lot. You guys deserve way more than just fan’s praise for this thing. We all wish we could do more to help, I’m sure.

  12. kernelPANIC said 17 years ago:

    You guys are both the letters ‘A’ and ‘W’ in the ‘AWESOME’ word.
    I love your updates and I love reading every single detail that this amazing translation project entails.
    Thank you!

  13. Nathaniel said 17 years ago:

    I don’t care WHAT the updates are about, but I for one appreciate them no matter how boring or insignificant they seem. It’s encouraging even if one little obstacle’s getting taken down at a time.

  14. Moulinoski said 17 years ago:

    I like just knowing that M3 is being worked on! Go, go, go Tomato! (Although, don’t over do it… A sleepy hacker/translator is of no use to the world D:)

  15. LucretiusJulius said 17 years ago:

    Fantastic job, guys.
    I really loved the post today, and even though this is my first time commenting, I’ve been checking and reading this site just about every day for the last 3 months. ^_^
    Thanks for breaking down the process, that was enlightening. Makes me want to check out both the ROM translation website you linked someone to a couple weeks ago and a good book on machine code. 😀
    Mato, thanks to you and the whole team for putting so much effort into this project, I’ve never seen a ROM translation taken so very seriously, and that’s a monument to how much you guys care for both the Mother series and for Mother fans everywhere.

    May your pickles be forever fuzzy,
    -Lucretius

  16. Sparks said 17 years ago:

    Thanks for your hard work!!

  17. Sparks said 17 years ago:

    Thanks for your hard work!!!

  18. juice said 17 years ago:

    hey keep up the good work. just some food for thought. i had to take a programing class as a university requirement. besides teh fact that i despised teh class and couldnt stand these 3 people talking about d&d, when ever i had troble getting a program to work or i broke it, i just looked for the simplest explanation. one time instead of fixing the code i just added more code to fix the old code. it would be the same for u just try to devise a hack to fix a hack.

  19. A Fan said 17 years ago:

    > Using the original encoding, we’d only be able to use about 8 letters per item name. That is unacceptable for a professional-quality translation.

    You can tell that we’re a long way from CURE, CUR2, FIRE, FIR2, AFIR, etc. when Mato is part of the translation effort 🙂

    I mean, just imagine a less professional item menu filled with things like LSTICK, LMBER, STICK2, NBREAD, OHAT, XCALBR, [heart symbol], N-BOMB, FLOATER, … 🙂

  20. Mato said 17 years ago:

    KaizerSigma: Yeah. http://sexybeam.net for really old smelly site that never gets updated 😛

    A Fan: Actually, just check the menu patch for a bunch of crappy smooshed names. HlthyChkn, SltWtrGun, GoodPickl, SvnrDress, BakdYamnstr, the list goes on 😀

  21. ParodyKnaveBob said 17 years ago:

    [much text, five game screen shots, and two hex screen shots, all explaining progressively the process up to the point where everything is going up up up, followed by: ]

    “. . . a hack (which winds up only being 7 lines of code) is devised that rearranges the names in memory, allows for TWENTY letters per name, and even uses memory more efficiently than the original game. That should just about do it!”

    [picture of horribly fouled up gobbledygook mangled output]

    I L.O.L.’ed hard!
    I laugh again just remembering that!
    Excellent narrative. That’s -exactly- how programming/debugging feels! And thanks for all the information you give, let alone all the hard hard work all you folks are putting into this — explicitly denying any monetary compensation for any of it. Rock on. Rock on.

  22. A Fan said 17 years ago:

    BTW, any advice on how to get started ROM hacking?

    I don’t even have those Little Pink Books they handed out for the 86HC11 for the GBA’s processor. And I still have my original LPB from that class we both took from Lance 🙂 I mean, it occurs to me that as a programmer, there’s no reason I couldn’t learn this stuff, I just don’t know where to find any good tools or references…

    Although, I think I DO see the memory address for the item table in there now…

    P.S. Where can I get a GoodPckl? 🙂

  23. Mato said 17 years ago:

    A Fan: Just a few things that I use:

    VBA http://vba.ngemu.com/downloads.shtml
    VBA-SDLH http://www.romhacking.net/utils/297/
    GBA tech doc http://www.work.de/nocash/gbatek.htm
    GoldRoad ARM/THUMB assembler http://www.gbadev.org/tools.php?showinfo=192
    THUMB reference http://www.gbadev.org/docs.php?showinfo=19
    ARM/THUMB tech reference (very good) http://www.gbadev.org/docs.php?showinfo=16

    BTW, did you take any processor design classes? I remember taking one before I took Lance’s class, then I took like a 300-level class taught by some cool lady later on, which was a real shock, given that it’s an engineering course 😛

  24. Keenbean said 17 years ago:

    Being nice has gotten you nowhere! Punch it where it counts! Teach those items who is boss. >:|

  25. Dex said 17 years ago:

    Great Post!!! thanks for the great narrative.

  26. Maiku said 17 years ago:

    XDXD that’s actually really funny.
    I really hope you’ll continue to share the hacking process with us. it feels like we all translate the game together that way.
    I really enjoyed reading it. ^^

  27. A Fan said 17 years ago:

    Processor design? No, but we did design a CPU from individual logic gates back in… ECE 100? I was an EEE major for three years, then went over to CMS because I wanted to do more programming. Of course, I mostly ended up with lots more math and a little more programming, but I did take the 300-level algorithms class. I still hate red-black tree balancing to this day 🙂

    Was ECE 100 the processor design class you’re thinking of? They DID have you use some program I don’t recall to build every gate out of NANDs, then to build a 2-bit adder, combine those into an 8-bit adder, learn 1s and 2s compliment, then teach your adder to subtract and combine both buggers into an ALU. Then in the final stage, you added a whole bunch of crap to that and turned it into a simple CPU.

    I took that one under Armando A Rodriguez, who was a great guy. I remember visiting him at his office for years after I took his course and learning a lot in the process. He is (was?) on the top floor of that engineering building on the northeast corner of campus, clear at the back of the hall opposite the elevator. I remember because I also used the computer lab on the first floor a lot, and I think the MUDBUG lab with the Vaxen that Lance made us use was on the 2nd or 3rd floor. Can’t remember the building name, but at one point, I DID have a keycard to get into the lab there at any time thanks to AAR. Damn useful!

  28. Coconut of Enlightenment said 17 years ago:

    Stupid Brownie Brown progammers not maintaining quality levels of programming abstraction. From your description, it sounds like each function in the program is based on assumptions about the last. Instead of writing an algorithm to handle any size of text thrown at it, it assumes that it will always receive 16-bits. Instead of calculating memory addresses normally, it bases its memory storage on the length of the entries. It’s almost like the game designers went out of their way to make the game more buggy. I’m surprised it even works in Japanese.

    I hope you don’t have to reconstruct the entire menu system from scratch. I would do it for you if I knew how. Just please don’t beat yourself to death over it.

  29. Steve said 17 years ago:

    I was hoping this wasn’t how you did ROM hacking. When I did a little, I would trace code then check the results and figure out what went wrong. Then, I thought to myself, “There must be an easier way that I don’t know about.” Apparently there isn’t. Keep up the good work!

  30. A Fan said 17 years ago:

    The fun part, of course, would be figuring out what means what… You know, where all the tables are, what values mean what, what registers are being used for what, what status flags need to be preserved (or altered…).

    And not being confused by all the other random stuff going on that you don’t care about. If you Google the name ‘fravia’ you might find a very old page about reverse engineering programs. It’s specific to x86 assembly (GBA uses ARM/THUMB processors, which are significantly different) and it’s mostly about bypassing copy protection on software, but it’s still useful information about good ways to make sense of piles of meaningless hex numbers that you can use for more legitimate purposes.

  31. G.Wicks said 17 years ago:

    When I was little I used to be one of those kids who threw NES controllers when frustrated by megamanz. This is why I’m not a hacker. Laptops would fly out windows. You are such a patient man, mato. The game boy advance haxxor gods will smile upon thee soon.

    I knew hacking was complicated but I never knew the specifics. This is a really informative update. Very interesting!

  32. Alato said 17 years ago:

    Once again, this is easily going to be the best fan translation ever. Not because of an awesome game, but also because of the amount of work and of course the quality. I hope you figure everything out, and sleep well.

  33. butt said 17 years ago:

    I feel implored to Thank the intire team on there hard work once more. I cannot wait for the translation to be compleate so I can play the sequal to my favorate game in a language witch is not so forgen it is to hard too lern on your own.

    Keep up the good work keep on crankin away.Perhaps get yourself a couple of cases of red bull or something stronger witch is not too bad for you

  34. David said 17 years ago:

    this is like hardcore stuff
    and it looks so good and professional
    keep up the good work

  35. redfeatherraven said 17 years ago:

    jebus. i get the feeling i’m going to be seeing a lot of this down the road when i get into game design. and i don’t like them shivers i’m gettin, gentlemen.

    regardless, marvelous work you’re getting done here. efforts appreciated heavily. waiting anxiously for the final result, and enjoying the insight the process provides perhaps a bit more than is healthy. keep me posted. :3

  36. solidshake said 17 years ago:

    I’m a C# programmer and have waded through my share of bad code. It’s bad enough to deal with crappy pre-compiled code, so I can only imagine what hell you guys are going through!

    I’ve been silently watching the translation(s) progress since the ROM first surfaced, and like everyone else, I’ve been waiting for this opportunity for over 10 years. You guys deserve all the credit in the world for rendering such an incredible service to the thousands of eager fans out there.

  37. SoreThumb said 17 years ago:

    I’m proud of you, Mato. And everybodyelsewhoIforgot 8) (sblur? Harmony? Ghideon? Jeff? 8)

  38. TheReaper said 17 years ago:

    Mato get some needed rest all the earthbound fans should be very proud of you working in your free time with translating and even now hacking mother 3,ever since you started the mother 3 english translation patch project you have been working super hard to keep us fans really updated with info,pics,videos,menu patches and at the same time trying to release a professional quality english translation of mother 3,even with all the real life work.

  39. Ubuntu said 17 years ago:

    i heart computers and am interested in rom hacking BUT PLZ GET THIS PROJECT FINISHED

  40. EliotAndrews said 17 years ago:

    I truly admire your dedication. Staring at code, coming up with theories, and testing each idea “trial-and-error”-style is never fun. (Unless it works, of course.)

    This blog always has more in-depth information than any other project I’ve watched, and we all appreciate you writing this while dealing with everything else, project-related or otherwise, at the same time.

    Keep up the good work, and remember to always get that sleep.

  41. Nack said 17 years ago:

    Hey thanks for working so hard on this hack. I LOVED earthbound and can’t wait to play mother 3. Thanks again, you win the rad award.

  42. tibbs said 17 years ago:

    Maybe it’s because of the super crappy Brownie Brown code that Nintendo decided not to translate the game: they were too lazy and afraid of losing their mind on reprogramming the game… But there ARE courageous people! 🙂

  43. justbob said 17 years ago:

    This has been the best post yet.

    I know NOTHING about programming. I always thought this would be a quick “do the translation and plug it in” process (too much time at M3.org, I guess).

    This has really shown us a view of WHAT you are doing and WHY it is so difficult/time-consuming.

    Thank you M3-translation-team! You guys are awesome!

  44. sirdannykins said 17 years ago:

    its starting to look like opening a school to teach people japanese would be easier than translating this game , and take less time , but its come so far for that plan , goodluck , your gunna need it

  45. dtotheon said 17 years ago:

    I love reading the posts.

    Keep up the good work.

  46. A Fan said 17 years ago:

    Who says it’s not a good idea to learn Japanese anyway? Sure, you’re not going to learn anything in time for Mother 3, but what if there’s a Mother 4 someday? 🙂

    The more we all learn, the more people there will be to take on projects like this in the future. Because our great translator team here can’t translate *everything* … I mean, there’s still a backlog of old but good games from the SNES era (see http://agtp.romhack.net/ …)

  47. Augustus said 17 years ago:

    If you find yourself in Cork Ireland at some point, send me an email and I’ll buy you a beer.

    Just wanted to thank you for the work you guys are doing here!

  48. Steve said 17 years ago:

    If you find yourself in Seattle, WA, USA, I too would buy you and/or your teammates a beer. In fact, it’s a pretty safe bet that in many cities around the world there are people following this project who would gladly provide you with alcohol and friendly conversation. So, keep that in mind!

  49. PSI Supernova said 17 years ago:

    Holy CRAP! That looks pretty ugly to have to hack. But since it all (nearly) worked out in the end, I guess it was worth it. Nearly because the item names on the right got shifted down, but fixing that will probably be easy-peasy compared to what you did before. 🙂

  50. A Fan said 17 years ago:

    Aye, if Mato’s ever in the area, I’m sure that I’m not the only fellow alumnus of his that’d buy him lunch or whatever 🙂

    Still can’t believe that I never knew I was on the same campus and even had at least one of the same teachers as the guy translating all my favorite games. But maybe that’s because I was too busy playing them…

  51. 7ucky said 17 years ago:

    Wow, very cool, Mato! This was a particularly pleasing update to read. I can’t help but sometimes wonder if ROM hacking would be a fun hobby, but these kinds of posts show just how much you guys are putting into each aspect to make this a job well done!

    Keep it up!

  52. Ryan said 17 years ago:

    Great work so far. Just keep playing around and testing and I’m sure it will start working out in the near future!

  53. Moulinoski said 17 years ago:

    I’d offer lemonade. Alcohol is not healthy, but lemonade is… Plus, if you grow your own lemons, they’re free. 😛

    Moonside dimensedi.

  54. manimani said 17 years ago:

    Thank you for all of the work, I’m sure the final product will be amazing. Huge EB fan very glad that this is happening. Still dont know why nintendo doesnt just do it themselves and make profit :\ Their loss.

  55. Psychic Boy Genius said 17 years ago:

    Really great, Mato, if you master this you could rank up there with Itoi. XD

  56. Midna said 16 years ago:

    LIGHTER’S ORDINARY HAT