Kuribo64
Views: 19,857,050 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
03-29-24 03:09 PM
Guest:

0 users reading How to debug crashes. | 1 bot

Main - Trash - How to debug crashes. Hide post layouts | Thread closed


shibboleet
Posted on 07-22-14 01:53 AM (rev. 3 of 07-22-14 01:59 AM) Link | #44650
uh, I have no idea if this should go in ASM hacking or just general SMG.

If you are very new to SMG hacking, I do not recommend you trying this. You still can, I cannot stop you. But do not ask questions on stuff that is clearly answered in this post.

First thing you have to do is get an assembler. Although, most are pricey, but the best one is IDA. I am not supplying a download link for a crack, because this board does not support piracy.
Second thing is the main.dol. We can't supply this, either. Find one yourself or ask on the irc and we'll PM it to you on there.

These next 3 are for if you run into Shift-JIS in your debug.
Third thing, is a text editor. You probably already have one in your computer, though.
Fourth, is a hex editor. (Hex Editor Neo, HxD, it doesn't matter.)
Fifth, is NotePad++.

Now, let's get started.
Once the game crashes, you need to look at the debug screen
If you do not have the debug screen on your XML, please add these 3 lines inside of your patches.
<memory offset="0x804B7D90" value="60000000" />
<memory offset="0x804B7E54" value="60000000" />
<memory offset="0x805B66B4" value="60000000" />

Once your game crashes, it should print a "Exception." Scroll down to the bottom and find a header called "LR Save."
If you do not want to debug it, give me, NWPlayer123, Marionumber1, StapleButter the screenshot of the LR save and one of us will help you. (Don't ask all of us. Just one.)
If there is no debug, this is called an "infinite loop" where it just keeps going and going and doesn't stop, so it doesn't give a dump. If this happens, it means you've corrupted a scenario or a custom model is too big.

Now if you want to continue to learn how to do it, keep following the tutorial.

The contents of LR Save are the addresses in the game's code. (AKA, the main.dol file.)
Now, Download this plugin.
Put that in the /loaders folder inside of the IDA program folder. This is what will help read the DOL file once you load it.

Now, open IDA. Find your dol file, and open it. Make sure it highlights the dol loader, and not binary or anything else listed. Then, on the top bar, wait for most of the black to disappear. It will take it a while to load a entire game, y'know.

Remember that LR save from earlier? Hit the "G" key and type in the first line that you see on the LR save you saw on the crash dump earlier. It should bring you somewhere in the dol where the crash occurred.

If you get a .byte 0xXX (X being the 2 outputted numbers), highlight it and hit "C" to make it display code. This is where it gets kinda weird.


[image]

In the code that you're looking at (Mine is seen in the image above), you should see something like sub_804D2D90. Right click it, and hit "Jump to Operand."
[image]
If you don't' see anything, just keep trying to find a sub_ in the next section of code until you find a comment.

And there you go. It should show you what the problem was, but it doesn't exactly say "Blah blah crashed." It lists in where the code it occurred at. Like, MarioStart or something. If you know some objects and properties, you should be able to figure out what it means. (See image below.)


[image]

But if you get something like # "âXâ^ü[120î-âGâôâfâBâôâOÄ+ìs", you need to get a little fancy. This is Japanese. We need to find it's section in hex and copy it to a hex editor, save it as a text file, open it in Notepad++, and turn it into Shift-JIS to make it readable Japanese. And then convert it using google translate for some other translator.

Sounds confusing? Well don't worry, this is KINDA simple.
First, find where the comment is. Mine is # "âXâ^ü[120î-âGâôâfâBâôâOÄ+ìs".

Near it should be something like
((aGxgB120mGggugf+0x10000)@h)
right-click on the "aGxGb120" part, and click on "Jump to Operand." You should come up onto a string.
It looks a bit like this:
.data6:806FF3A0 aGxgBGsbGxgjgeg:.string "âXâ^ü[âsü[âXâJâEâôâ^ü[âXâgâbâv"
Or if you like images:

[image]
see the data inbetween the .data6:806FF3A0 and the :.string? That's what we want. For me, I want "aGxgBGsbGxgjgeg".

Once you've found it, highlight it and click on the "Hex View-A" tab. You should see Hex values highlighted.
Mine are here:

[image]

Now, you want to copy those, and paste them into your HEX EDITOR. You don't need the null 00 value, (the last value), though. Now after you've pasted it in, you want to save it as a text file.

Now, open up Notepad++. Go to File > Open (Or CTRL+O) and find the txt file you just saved earlier. You should have it loaded in Notepad++. Now up on the menubar, go to Encoding > Character Sets > Japanese > Shift-JIS.

You might run into some "NUL" stuff, but ignore that. You should see some Japanese now. Copy it, and paste it in a translator and it should show you what went wrong. (Also, if you're interested, mine was "120 pieces ending run star".)

Tada, you just debugged a crash. Questions? Ask below.
~MrRean




____________________
a


Main - Trash - How to debug crashes. Hide post layouts | Thread closed

Page rendered in 0.025 seconds. (2048KB of memory used)
MySQL - queries: 28, rows: 194/194, time: 0.008 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.