News:

The forum has been updated to SMF (2.1.3)!
Please be patient as we work to polish up the place and update features as we can.

Main Menu

Problem with the 5% stats patch

Started by Baransu, 01, June, 2017, 05:53:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Baransu

I mentioned this before in the cbox but I figured that a topic would be better for it.

I applied the 5% stat patch to a fresh Golden Sun TLA (U) rom, however as shown in the pictures below it did not work out like it was supposed to.

Salanewt

Out of curiosity, have you had any luck with other patches? I figure that would be a good, quick way to figure out whether the patch messed things up or if there is something off with your ROM.

Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#2
Squire looks fine.... (Since the percents in Atrius's editor do not take the code modification into consideration when determining what to display.)
Knight and Gallant??? Look off...


Might have also been useful to post screenshots of VBA>Tools>Memory viewer ... at address locations of:
0x080000A0 (To verify file version.)
0x080C15F4 (To verify if class data was here - Atrius's editor is compatible with more ROM versions than the 5% Patcher, since I only did the 5% Patcher with one version in mind.)

And to possibly go to VBA>Tools>Disassemble... with a screenshot at address 0x080AD768 (To verify if the percentage code stuff is here properly in your ROM.)



I would test it again to make sure... but I'm getting an error at the moment/little lazy...
QuoteImportError: No module named tkinter
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Baransu

This is what it looks like at the offsets. Also, I've used a copy of this rom before to patch stuff like the Reloaded patch and the Intellect patch and they've worked just fine so I don't think anything's wrong with my rom.

Also, I did have to change the first line to Tkinter import * #GUI stuff and comment out this one f = open(filedialog.askopenfilename(), 'r+b') in order to get it to patch.

Salanewt

#4
I haven't checked through the patch/code yet, but wouldn't it be easier to just divide by 20 rather than 10? It almost looks like there is either an error in that patch or some weird workaround.

Edit: If you replace all six "325B" intructions with "2114" then you might be able to fix it. Assuming nothing else has really been changed!
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#5
EDIT:(Putting this at the top since it could maybe be the answer/not sure, though... so proceed with caution.)

OH!!!
QuoteTkinter has been renamed to tkinter in Python 3.
Maybe I look into seeing if Python 3 works... Since my last test was with Python 2.7... xP
There are a bunch of differences between both, that it is probably better to use the Python that the code was made for before adapting it to a different version of Python... probably.

If this is it(?), then the rest of the post can be ignored.


How is it putting in 0x325B everywhere? o.O
So all 0x0A's become 0x5B's? ... when they're supposed to become 0x14's...
... Hmmm.... And the next instruction afterwards for each is messed up? - Attached image compares yours against an unmodified ROM.
It's possible the numbers could be stored in some 32-bit format when I intended an 8-bit format.... / Maybe some type of float or fixed point, I dunno... ??

@Salanewt: Dividing by 20 is exactly what the patch is supposed to put in.  The code originally looks like this (So you can see it is pretty simple.):

Unmodified/uncorrected version....
from tkinter import * #GUI stuff.

#Window
root = Tk()
root.title("Class Stats 5% Patcher")
root.geometry("300x200")
app = Frame(root)
app.grid()
lbl1 = Label(app, text = "Waiting for file...")
lbl1.grid()

#Open file.
f = open(filedialog.askopenfilename(), 'r+b')
#f = open('C:/Users/name/Desktop/gs2.gba', 'r+b')
fileOk = 1
#f.seek(0xA0)
#if f.read(16) != b'GOLDEN_SUN_BAGFE': fileOk = 0

#Check if values have not been altered.
for i in range(6):
    f.seek(0xAD768 + (i * 0x10))
    if ord(f.read(1)) != 10:
        fileOk = 0
       
if fileOk == 1:

    #Update the denominators to *2.  0x14 (20)
    for i in range(6):
        f.seek(0xAD768 + (i * 0x10))
        f.write(bytes([20]))
       
    #Update all class stats to *2.
    for i in range(0xF4): #Number of classes.
        for j in range(6): #Number of stats per class.
            f.seek(0xC15F4 + (i * 0x54) + (8 + j))
            val = ord(f.read(1))
            f.seek(0xC15F4 + (i * 0x54) + (8 + j))
            f.write(bytes([val * 2]))
           
    message = "Changes have been successfully saved."
else:
    message = "No changes have been made."

f.close()
lbl1['text'] = message
root.mainloop()


f.write(bytes([20]))

^You would think that'd put the 0x14's in for the denominators.... There is no fancy equations here... so... erm....
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

Okay, yeah I figured that was the case!

What's going on with python stuff?
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Baransu

Okay, so I ran it in python 3 and it works just fine. I don't really get the difference between the two since I don't know python but thanks alots.

Now if only there was a faster way to copy paste class data so I could input the various classes that I added.

Daddy Poi's Oily Gorillas

#8
That's easy with a small amount of hex editor experience.

All you need is VBA's Memory viewer...
Go to the address of the class data (0x080C15F4 in TLA (U)), select the first byte. Click the Save button at the bottom. The size should be in hexadecimal, I believe. You can do it in a calculator: 0x54 times the number of classes there are.
Once you have a dump saved, you can open up the ROM you want to put those into. This time, hit Load (while at the appropriate address), and load the dump you saved.


After that's done, make sure you don't forget to save the whole ROM section, otherwise you may lose the changes....: Go to 0x08000000, save a dump for 0x1000000 (For TLA), and change that to .gba.



Alternately, you could do it with Python... ; Even though there are some things I do like about Python...  I feel that it's a bit messed up, so I try to use something else most of the time. (Currently C#) Especially since C# can easily load a whole ROM into an array in minimum time. (<1 second....) compared to Python which takes some time. :(


Given my analysis of some programming languages. (Not a detailed one at that.) I have came to the conclusion that the best programming languages for me were of the C ones...  (Currently C#)  At least if it isn't an obscure language, more people would be more likely to read source code from it.... Etc.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Baransu

I'm a bit confused at the memory dump size part.

So let me get this straight, at the memory dump part, I'm supposed to go to 80C15F4 and select the byte in the attached picture? Then when I'm saving the dump, its supposed to be a size of BE50 (0x54 multiplied by the 244 classes (NPC + 243) in the game data?

Daddy Poi's Oily Gorillas

Yes.

Except the 244 is a decimal number, and treating it as a hex number will mess up the calculation.

0x5010 should be the correct size for GS2.

080C15F4 = Classes
080C6604 = Class Type chart
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Baransu

Thanks, I managed to stumble on another problem or maybe a weird quirk would be a better way to put it, but for some reason the text at locations 3346 and 3347 in the editor are backwards. Most locations would list the stats in the order Attack/Defense/Agility/Luck but for some weird reason this
section lists it as Attack/Defense/Luck/Agility. Then if you correct the order it mucks up a couple text areas.

Daddy Poi's Oily Gorillas

#12
Interesting...

Looking at how specific this topic's name is, I am assuming this is a "Wrong topic?" As in, I think this is related to the Intellect patch?


It is going to be my guess that Salanewt forgot to fully update it for everything else, since there's likely an index needed for every time the text should appear.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

Oops, yeah I guess I either wrote the words in the wrong slots or forgot to switch those two labels around.

Thanks for pointing that out! Is this something you can fix yourself in the text editor or do I need to make a quick fix for that? I ask because I'm planning to revisit this patch and touch up a couple things when the AI overhaul patch is done, since that will have a second version that includes the Intellect patch when I finish the main one.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#14
...
Huh. Oh yeah. I guess I must have read something wrong at first... but it was only a minor tidbit, anyway...

I think this line should be enough, though:  If you do want them to be in the right order (and don't want to wait for an update), it could help to search the text indexes (Probably 32-bit) in a hex editor and switch them. (Preferably check each one to make sure it changed properly, as you would likely be changing quite a few. - But quite a few doesn't mean a lot, so it shouldn't be that difficult.)
^ And yeah, for some things, it can be that easy.... I say to check (Field Menus and Battle menus individually.) to make sure of any false positives when switching them.
For other things, it can be a little more complicated (e.g. base index + offset index , or coded via mov/lsl/add... but I think TLA usually has text indexes as a 32-bit loaded by an ldr-relative.)


---
To find indexes of 3346, I can search 120D0000 in a hex editor... and only pay attention to the ones at addresses divisible by 4 (32-bit), as if it is not, it's likely a false positive. But if it is aligned as such, then it depends.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Baransu

I already corrected most of the locations with the inbuilt text editor so its okay for now. I can wait for the new Intellect/AI overhaul patch since I kind of already have my hands full trying to prevent spells from being too strong relative to physical damage instead of too weak.

Salanewt

Haha, sounds good! I don't know if I have any great suggestions for balancing Intellect since I just went to a couple points in the game and tested it with the base values already used by certain abilities, but a slightly power reduction might work for the earlier stages.
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?