Jump to content

Hacking Tools


Dr.Sholes
 Share

Recommended Posts

You... well, the way I (and Hextator, and Nintenlord judging from the source they released) do it is to write an external application in a high-leveled language like C or Java that opens your ROM and edits it in that way.

For example:

[spoiler=Code]

package gba2mar;

import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFileChooser;
import javax.swing.BoxLayout;
import javax.swing.border.EtchedBorder;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import java.io.File;
import javax.swing.JFileChooser;

import camtech.misc.WindowTool;
import camtech.util.HexSpinner;
import camtech.util.SpinnerPanel;
import camtech.util.HexSpinner;

public class Program extends WindowTool {

private static File ROM,output;
private static JTextField ROMpathText, outputPathText;

@Override
protected void construct() {

	JPanel panelA = new JPanel();

	panelA.add(new JLabel("ROM          "));
	ROMpathText = new JTextField(20);
	panelA.add(ROMpathText);
	addActionButton(
		panelA,
		"Browse...",
		new ActionListener() {
			public void actionPerformed(ActionEvent e) { showOpenFileDialog(ROM); }
		});
	panelA.setMaximumSize(panelA.getPreferredSize());
	add(panelA);

	JPanel panelB = new JPanel();

	panelB.add(new JLabel("Output      "));
	outputPathText = new JTextField(20);
	panelB.add(this.outputPathText);
	addActionButton(
		panelB,
		"Browse...",
		new ActionListener() {
			public void actionPerformed(ActionEvent e) { showOpenFileDialog(output); }
		});
	panelB.setMaximumSize(panelB.getPreferredSize());
	add(panelB);

	JPanel panelC = new JPanel();
	panelC.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

	SpinnerPanel offsetPanel = new SpinnerPanel(6);
	offsetPanel.add(new JLabel("Offset to rip from? "));
	offsetPanel.addSpinner(6);
	offsetPanel.setMaximumSize(offsetPanel.getPreferredSize());

	panelC.add(offsetPanel);
	panelC.setLayout(new BoxLayout(panelC,BoxLayout.X_AXIS));
	panelC.setMaximumSize(offsetPanel.getPreferredSize());

	add(panelC);

	JPanel panelD = new JPanel();

	addActionButton(
		panelD,
		"Go!",
		new ActionListener() {
			public void actionPerformed(ActionEvent e)
			{ /*TODO*/ }
		}
	);

	add(panelD);

	super.construct();

	pack();
	setVisible(true);

	setDefaultCloseOperation(EXIT_ON_CLOSE);
}

private static void showOpenFileDialog(File f) {

	final JFileChooser fc = new JFileChooser();
	try
	{
		int returnVal = fc.showOpenDialog(null);

		if (returnVal == JFileChooser.APPROVE_OPTION)
		{
			File file = fc.getSelectedFile();
			System.out.println("Opening file: " + file.getPath());
			adjustTextBox(f,file);
		}
		else { adjustTextBox("",f); }
	}
	catch (Exception e)
	{
		System.out.println("Huh?");
		adjustTextBox("",f);
	}
}

//This clears up some of the clutter in the open file method.
private static void adjustTextBox(File input,File chosen) {

	if (input == ROM) { ROMpathText.setText(chosen.getPath()); }

	else if (input == output) { outputPathText.setText(chosen.getPath()); }
}

private static void adjustTextBox(String s, File f) {

	if (f == ROM) { ROMpathText.setText(s); }

	else if (f == output) { outputPathText.setText(s); }
}

public Program() {

	super("GBA2MAR");
	construct();

}

public static void main(String[] args) {

	new Program();

}

}

Edited by Kam
Link to comment
Share on other sites

What I'm mostly interested in is how they work to do what they do.

You document and understand how things work in the game, and then write code which will manipulate the data (through what you documented) however you might want it to be manipulated. This includes extracting graphics, rearranging structures of data, editing statistics and level data, compressing information--essentially, you're wanting to create programming which is capable of editing information.

Sometimes it gets a bit more complex, like having to code a program that not only interprets the graphics, but then interprets how the game tells which colors to use where, and to pair that with transparencies--you're essentially recreating the game code for your editor, if you want it to display real graphics from the game. Some people have cheated and just include an image of the game graphics--but this doesn't let you see any graphics you may have changed.

You can take a look through here if you'd like to see some finished ones. Or finished-enough ones. Some will include their source, as well as contact information of the authors if you want to get in touch.

Link to comment
Share on other sites

@Kam

Alright but, as helpful as this is to someone who writes Java, I have no idea how to use this advice. What I'm saying is, is there any way to do the same thing with VB and if so how.

@Celice

That should help to an extent.

Edited by Dr.Sholes
Link to comment
Share on other sites

Well, that's just the same. You'd have to basically recreate the kind of structure I have in Visual Basic, then actually write the editing code (which I have yet to do in that specific example).

The fact that you're using an object-oriented language helps, since you can define a class "ROM" that has all the info you'd need, instead of having to store it somewhere in one thread.

Edited by Kam
Link to comment
Share on other sites

Well, that's just the same. You'd have to basically recreate the kind of structure I have in Visual Basic, then actually write the editing code (which I have yet to do in that specific example).

The fact that you're using an object-oriented language helps, since you can define a class "ROM" that has all the info you'd need, instead of having to store it somewhere in one thread.

I get what you're saying but I have no way of "translating" between the two languages so I don't understand what's going on in your example.sad.gif Any suggestions?

Link to comment
Share on other sites

If you are using Visual Studio, you'll learn plenty of useful things from my apps source codes. Both Visual Basic and C# can use .NET and they also are quite similar languages (semantically, not syntactically). The sources of my apps can be found in here: http://dl.dropbox.com/u/341300/Projects.7z (huge download and requires 7-zip to unzip).

Link to comment
Share on other sites

If you are using Visual Studio, you'll learn plenty of useful things from my apps source codes. Both Visual Basic and C# can use .NET and they also are quite similar languages (semantically, not syntactically). The sources of my apps can be found in here: http://dl.dropbox.co...300/Projects.7z (huge download and requires 7-zip to unzip).

That's really useful. Thanks.smile.gif

Link to comment
Share on other sites

I get what you're saying but I have no way of "translating" between the two languages so I don't understand what's going on in your example.sad.gif Any suggestions?

No offense, but if you're having trouble reading someone's source just because it's in a different language, that's probably a sign that you need some more experience before you start trying something like this. I learned that the hard way (and promptly got shouted down by Hex). Like, I can understand that you don't get my source (since a lot of the actual stuff that I did in that example is done for me by the java API or another class) because my coding sucks. But at some point, OOP languages all start looking somewhat similar (to an extent), since they follow (mostly) the same kind of logic. The big barrier (IMO) is in differing syntax, but a lot of syntax is self-explanatory anyway. For example, I base a lot of my code off of the source Nintenlord just posted, despite the fact that I know very little C#. Really, if you know what an app does, and you understand the logic behind it, you should be able to figure *most* of it out by process of deduction.

Oh yeah, and if it turns out I'm full of BS, feel free to correct me (Hextator, Zahllers, NL).

Edited by Kam
Link to comment
Share on other sites

No that sounded pretty accurate. OO languages are like game consoles; there's a whole bunch of them but they all do the same damn thing.

If you're doing visual ANYTHING I suggest stuff like C# over VB for sure.

Java is super tame but it also is missing some nice features and it (apparently) is still in the process of stuff being deprecated due to poor design choices finally being recognized as such by the JDK developers. Kinda sad

You could also try learning Python!! but that would prabably *fwoosh* go right over your head if you can't even read Java. ;/

Link to comment
Share on other sites

Just to say, it is an interesting question, because to be fair you can use anything to make an APP; You just code something in any language which manipulates data for you. I have worked on both Excel macros and Raw ASM to create stuff to manipulate the data in the way I need, for basic "APPs" for my hacking needs. (Yep, the source for a Assembly-based APP wasn't pretty, but it worked perfectly. :3)

Just, what else can I say other than it is pretty something you want to work on making APPs! :D The more APPs the easier it is for us to achieve better quality hacks with the same amount of effort and drive, thus I say I really enjoy that more and more people seem interested in making those. :3 If you need help in getting notes to make a specific tool in a field no one else has for FE hacking, specially FE8, or even some ideas for simple tools you could make for practice, feel free to hit me up, I might have a few notes lying around which could help your hack-aiding tool. :3

Link to comment
Share on other sites

Iggy (who's disappeared completely) and Squashe Monster also have data on FE8, if you need some. Squash actually made a map editor for Iggy years back (long, long before mappy was introduced).

Squash is the dude who's made several editors, including a level editor for Yoshi's Island. You might be able to contact him for any info Iggy gave him for the map editor. Though it probably pales to info members have now, as there's been more delving into the game since then by more (and more proficient) peeps.

Edited by Celice
Link to comment
Share on other sites

No offense, but if you're having trouble reading someone's source just because it's in a different language, that's probably a sign that you need some more experience before you start trying something like this.

Yes. Very much so.

But that's okay; it often takes people a long time to get through this stage even if they're smart. Many, many new programmers have unrealistic expectations. Programming is not some menial task; it's a kind of crafting, a professional skill. And like all professional skills, it takes a long time to get really up to speed with them. It's the kind of thing that you can legitimately be an expert at. Being an expert at things is often estimated to take about 10,000 hours of practice spread over a good ten years or so.

But at some point, OOP languages all start looking somewhat similar (to an extent), since they follow (mostly) the same kind of logic.

Until you start looking at real OOP languages instead of toys like the ones that are currently popular. :3:

That's kinda trolling, but OOP means many different things to many different people. The ideas can be taken much further than languages like Java take them. Python, for example, doesn't have integer primitives (so there is also no auto-boxing as there is no need for it), so you always have reference semantics instead of value semantics. Also, functions are objects and you can pass them around as parameters to other functions with no extra work. (You can sort of do that in C++ with function pointers, but the type annotations get very annoying, and they don't really behave like objects because you pretty much literally just have a pointer to code within your executable.) But that's child's play compared to some other languages. In Smalltalk, often cited as the original OOP language, there is actually no construct in the grammar of the language for if statements. Instead, booleans are objects that have an ifTrue and an ifFalse method, each taking one parameter which is a function that gets called if the internal state of the boolean is true or false respectively. (For hopefully obvious reasons, this is implemented at the language level rather than the library level.)

Oh yeah, and if it turns out I'm full of BS, feel free to correct me (Hextator, Zahllers, NL).

You're not at all full of BS, but I thought I'd blow expand your mind further.

You could also try learning Python!! but that would prabably *fwoosh* go right over your head if you can't even read Java. ;/

Python is not hard. It was designed to be easy - but in the good way, where it grows with you instead of eventually just getting in your way. It just looks a little unfamiliar to people who have already learned some other popular languages. In many ways, it makes more sense. For example, iterating directly over containers (instead of working with an index) is default; you have to go a bit out of your way to get indices (which is good, because you generally don't really need the index, and shouldn't confuse the reader of the code by pretending you do). FWIW, Guido van Rossum actually counts contemporary versions of BASIC among the inspirations for early versions of Python. Also, Python is older than Java, even though it took longer to get anyone's attention.

Edited by zahlman
Link to comment
Share on other sites

Expounding on the C# VS Visual Basic, I found this, which also helps with translating:

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

And naturally Wikipedia has something, too:

http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET#Language_features

But yeah, when starting, you should choose a language and stick to it, bouncing back and forth between languages only hampers your learning. Once you've got the idea, you can then start learning other languages and it will be much easier then.

Link to comment
Share on other sites

No offense, but if you're having trouble reading someone's source just because it's in a different language, that's probably a sign that you need some more experience before you start trying something like this.

That's understandable I'm intending on just messing around with stuff to get better at first and then actually creating APPs.

Just to say, it is an interesting question, because to be fair you can use anything to make an APP; You just code something in any language which manipulates data for you. I have worked on both Excel macros and Raw ASM to create stuff to manipulate the data in the way I need, for basic "APPs" for my hacking needs. (Yep, the source for a Assembly-based APP wasn't pretty, but it worked perfectly. :3)

Just, what else can I say other than it is pretty something you want to work on making APPs! :D The more APPs the easier it is for us to achieve better quality hacks with the same amount of effort and drive, thus I say I really enjoy that more and more people seem interested in making those. :3 If you need help in getting notes to make a specific tool in a field no one else has for FE hacking, specially FE8, or even some ideas for simple tools you could make for practice, feel free to hit me up, I might have a few notes lying around which could help your hack-aiding tool. :3

Thank you. smile.gif

Expounding on the C# VS Visual Basic, I found this, which also helps with translating:

http://www.harding.e...comparison.html

And naturally Wikipedia has something, too:

http://en.wikipedia....nguage_features

But yeah, when starting, you should choose a language and stick to it, bouncing back and forth between languages only hampers your learning. Once you've got the idea, you can then start learning other languages and it will be much easier then.

That is really helpful. Again, thanks. smile.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...