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

Author Topic: General ROM Hacking/Programming Questions  (Read 2332 times)

StarkNebula

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
General ROM Hacking/Programming Questions
« on: April 16, 2013, 05:36:36 pm »
Hey there! I'm StrakNebula. I have a few questions I'd like to ask to get a good sense of direction as to how to go about ROM hacking and making some useful tools for hacking/editing.

First and foremost, I'd like to know how to get properly educated on ROM hacking. I know that hex and float values will be something used somewhat often if not always, but the tutorial here doesn't quite specify how to use them. I'm sure it's something you learn once you get to the point where you need to use them, but I'm still ignorant on it's use. Also,  I'd like to work on GameCube ROMs more than others, what languages should I pick up? I'm certain C is a  must and C++ goes along with that, but what else? JavaScript? What 3D languages should I learn? WaveFront? Is Python useful for this application? I'd like a general sense of what I should learn before jumping waist-high in hacking. I have access to Lynda.com thanks to my college, but is there any tutorial you'd recommend more than any other?

Secondly, as for writing/modifying tools, anything special I should know? I'd like to modify GameZelda's GXPAND to accommodate AX files, that way I could transfer the 19 unused stages to GX through GCRv1.0 or other. I know that GXPAND uses D and that D is based on C++ and JavaScript and others. Likewise, I'd like to fix GXGMA, the 3D model viewer/exporter to correctly display textures.

Lastly, I know that I can get the GC devkit tools, but I'm sure I'll need proper C skills to even start comprehending it. More things I'd need to know about are the proprietary files formats (especially TPL), and perhaps some info on the LZSS compression type.

Blah, lots of questions. Feel free to answer but a few questions if any, I'm not looking for all the info at once. I'm sure it'll take quite a few months before I learn all of this stuff anyway.

My goal with this is A) figure out what F-Zero AX is hiding in those LZ files. B) Make some tools to create custom GX courses and/or assets. C) Just get programming down for good. It would be great skills to have, especially nowadays. Thanks. ;)

FAST6191

  • Hero Member
  • *****
  • Posts: 3100
    • View Profile
Re: General ROM Hacking/Programming Questions
« Reply #1 on: April 17, 2013, 06:45:56 am »
Hex- context is everything here. Hex itself is a just a numbering system and it depends entirely upon where it is as to whether the game will interpret it as an instruction on the CPU, a value to be loaded in memory, a value to launch input into a longer set of instructions to generate something else or something else entirely. You can made educated guesses and you can narrow it down using various methods mind you and that is what most of hacking is concerned with.
Float - varies between consoles. Quite often we have no float/decimal places at all, BCD (older consoles liked it), fixed point (the DS uses them extensively) or workarounds (3.5/2.5 == 35/25 or more commonly log tables) to contend with. Float did eventually take over though gamecube is an odd one as floating point performance, not to mention issues with quad, double or single precisions, mean it is taken on a game by game or even section by section basis.

Programming languages in ROM hacking are approached from two ways.

1) Programming tools for hacking purposes. As long as you are not using something like R (made for stats), matlab (more made for maths, engineering and science) or SQL (a database language) you are probably good.
2) Understanding what the original developer was doing. As game consoles are typically low powered devices compared to the PC of the day, even today but doubly so on old consoles, this typically means very low level languages though oddities can arise (several commercial DS games of note were made in lua for one, online games can almost do raw SQL, microsoft did XNA which comes from .net and c# which has all sorts of implications and many modern games can be web based). The spectre that looms over it all is assembly programming though- if you are not familiar with the concept it is the thing taken at signals (or with a bit of minor abstraction) as it runs on the hardware.

C - was probably still a dominant language on the gamecube so being able to think in C and translate it back is nice. Whether I would use it for tools is a different matter. Plenty is made in it still and lots was made in it but others might say go a bit higher.
C++ - I like it and it was used in game development. Just for tools you can probably go a bit higher (C# or one of the related languages for instance)
3d languages.... I would rather know about how 3d works from the ground up ( http://www.youtube.com/playlist?list=PL6A7DF3D7866EB076&feature=plpp ) than a language. Beyond that game consoles are not tied to directX or opengl so much either and the 3d hardware not the most advanced so you might find yourself doing things raw. However if you want to make tools then you probably want to be able to speak to opengl or direct3d.
Javascript.... not so useful for tools (though some have been looking at node.js), ROM hacking (for this anyway but many games are built using web tech- http://www.siliconera.com/2013/04/13/nintendo-game-seminar-2013-to-help-educate-aspiring-developers/ and javascript is getting pretty speedy).
Python. Great for tools, used in a handful of PC games both modern and old and maybe some console ones as well. Probably will not teach you anything about low level coding or how programming at such levels works but its usefulness for tools shines through.

Tutorials
http://programming-motherfucker.com/become.html (the learn ? the hard way for python is great and I am told the others are much the same)
http://www.youtube.com/watch?v=hE7l6Adoiiw&feature=BFa&list=EC6B940F08B9773B9F
I quite like some of the Apress "beginning" books as well.

D.... someone made a real program in it.... wonders never cease. When you say AX I assume you mean Fzero AX rather than the AX video stuff.

Compression...
https://ece.uwaterloo.ca/~ece611/LempelZiv.pdf (warning PDF link)
Learn that and maybe an implementation on the DS or something and most things after that are just variations on the theme (different intervals between flags, different flag lengths or splits between read back and length of read bits).

As you seem taken by the gamecube you might as well have the best hardware docs that I know of for it.
http://hitmen.c02.at/files/yagcd/yagcd/frames.html

I should also note the gamecube, being an optical media system, has a filesystem for its games which so you can break an iso up into its constituent files where GBA and 16 bit and older were typically bundled into a single file which you got to pull apart.

Actual devkits..... generally we do not suggest using them wholesale if not for licensing concerns then as they are not really that useful as general purpose tools and most modern ones are not that useful as hardware docs either.

I will stop here for the moment as you have probably had to re-evaluate a few things and may wish to change a few questions.

StarkNebula

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: General ROM Hacking/Programming Questions
« Reply #2 on: April 18, 2013, 01:21:08 pm »
No, actually, this is pretty good! Thanks for going through so thoroughly. You dissected it well and it definitely cleared things up. All I need to do now is buckle up and start learning. Thanks! :)