Golden Sun Hacking Community
April 20, 2018, 04:18:56 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: Class Type code patch (Idea stage/no patch yet)  (Read 1840 times)
0 Members and 1 Guest are viewing this topic.
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« on: May 08, 2017, 01:11:36 AM »

So you know how you can never assign which PCs and which Items give you which class types?

Well, my initial thought a long time ago, was all about changing what the class type variable had in its contents....
However, recently, it has occurred to me there could be a better way.... (With a possible trade-off of pointing to free space.)
Do a separate table! (I mean, the Class Type Chart is used to calculate a class type, so why not do similar with PC/item?)
Imagine having a series of items that give you all the same classes, it would be a waste to make separate classes for each, wouldn't it?

And such a table may make it easier to expand on.... I imagine? (e.g. Like imagine having a certain class only on certain maps... like the Lighthouses and such, because of their elemental influence.... but that could require expanding on what's in the table in some way.)

Anyway, table formatting ideas: *Adds in some edits*

8-bit = Current class type
8-bit = New assigned class type
16-bit = PC (-1 for null)
16-bit = Equipped item (-1 or 0 for null.)
16-bit = Storybook Flag

Current class = new assigned class = 0 for end of list? BUT will need to see about direct class assignments... This could even end up being some type of byte code that says when to do the class type chart, even? With possible support to add a number (even different from +20) to the class type (aka: So it is not a trade off against Atrius's Class Separation Patch. Except where space is concerned.) A lot of that takes thinking, though...  so I'd like to keep it nice and simple and therefore might not go that far... and if added to the editor... and if it uses free space, it may be in the form of an Experimental feature/Use-at-your-own-risk feature. / As in no guarantee that your ROM will still work, especially depending on what happens in future editor versions.)

First entry that changes the class could also exit the list?  (Or something like that... I am not sure about everything, so ideas could be given from the Community... which is kind of the reasson why I am posting this right now instead of when the patch would be made... er.)


This should cover all the things GS1/GS2/GS3 do... except the wolf transformation. (e.g. Class: Wild Animal... unless there's an easy way to include those types as well. .. how your class is determined in that case, is based on the pc data... with the turn durations stuff. (Whether it is non-zero or not.)... and is not limited to just Sveta.)
« Last Edit: May 08, 2017, 09:52:58 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Rolina
The Fulminous Witch
Jupiter Clan

Template maker turned lurker

Alchemist
*

Coins: 10
Offline Offline

Gender: Female
I am: wondering if we can get our clan position changed...
Clan Position: Grand Overlady of Jupiter
Posts: 6051

« Reply #1 on: May 08, 2017, 11:42:13 AM »

Have we been able to look up how DD handles transformation/overdrive classes yet?  Could help with finding a way to integrate it.
Logged

View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #2 on: May 08, 2017, 06:36:19 PM »

The info I have on Dark Dawn:

02005074 = Function that does the actual class assigning after calling the function that finds the match. (Seems to set r3 to 0 or 1 based on a value in PC data... I tried changing the value in PC data un/equipping an item, and got "Wild Animal" class.
020051B8 = Find Class match function...

(Same Class Type chart stuff as before ... and then....)
if r6>0 , class_type=0x14 (r6 apparently comes from the function's argument r3 , so if "Wild Animal" is a transformation/overdrive class, then that's how it's done!)
else if class_type==7 and pc==5 , class_type=0x12
else if class_type==8 and pc==5 , class_type=0x13
else if class_type==2 and pc==6 , class_type=0xD
else if class_type==6 and pc==4 , class_type=0xE
else if pc==7 {
if class_type==1 , class_type=0x16
else if class_type==4 , class_type=0x17
}

class types 1,2,6,7 should be the pure element ones, so it is mainly class types 4 and 8 that change pattern from GS2, I guess?
I assume there are no item classes (not even unused ones?) ... despite item un/equipping refreshing one's class? - Although, if argument r2 was supposed to be an item for Item Classes, it is called with a constant of 0, and seems unused in the function.

Other than that, I'm not really sure how transformation/overdrive stuff works. (I suppose I can check out some video(s) if necessary, though...)


GS1: 080799B0 = find_matching_class(pc,pc_ram_addr) - (pc_ram_addr might be pcDjinnRamAddr?)
GS2: 080B0144 = find_matching_class(pc,pcDjinnRamAddr,item)
GS3: 020051B8 = find_matching_class(pc,pcDjinnRamAddr,item (unused and also not set / aka:0'd),transformation/overdrive flag)


--
Aahh! I forgot GS1 had a flag check along with Isaac/Garet check to assign class  0xC8 ("?")/0xC9 ("?")... and a Jenna check to assign class 0xCA ("Flame User"). (0xC8-0xCA classes and not class types!)
I assume Class Type 11 (0xB) means null... since those what those three classes use. (As in a way to keep any class type scanners from considering them as options...)
If I am going to want a universal patch for all three games, I mght as well figure out how to squeeze in a flag check.
(Was still thinking Transformation/Overdrive could be the exception... as far as GS1/GS2 is concerned. ...and that's just assuming if item classes can be easily added to GS1...)


Well... Class type may only need to be 8-bit if the class stored into pc ram is 8-bit... (For all three games).... so I can probably switch my table to that. Although, it really just depends on how I do it.
« Last Edit: May 08, 2017, 10:17:29 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Rolina
The Fulminous Witch
Jupiter Clan

Template maker turned lurker

Alchemist
*

Coins: 10
Offline Offline

Gender: Female
I am: wondering if we can get our clan position changed...
Clan Position: Grand Overlady of Jupiter
Posts: 6051

« Reply #3 on: May 10, 2017, 12:14:25 AM »

Well, if it helps in your research, remember the arbitrary nature of its checks - iirc, only two class lines will scale with the class line.

Would you know how to create new flags for item classes?  Or is that limited to just the 3?
Logged

View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #4 on: May 10, 2017, 02:44:08 AM »

Hm?
Quote

It goes like this:  Primary Secondary

 1 -  Venus Venus
 2 -  Mars Mars
 3 -  Venus Mercury , Mars Mercury
 4 -  Venus Mars , Mars Venus
 5 -  Venus Jupiter , Mars Jupiter
 6 -  Mercury Mercury
 7 -  Jupiter Jupiter
 8 -  Jupiter Venus , Mercury Venus
 9 -  Jupiter Mars , Mercury Mars
10 -  Jupiter Mercury , Mercury Jupiter
11 - (And below = Item Classes, etc.)
I think I didn't really pay attention before... but where an element is not listed by a class type, the adept of that element cannot even access it... ? As long as you don't modify starting levels... (Since the djinn are limited to 9 each, and your base level's 5.4. You need at least 12 djinn to make your base element become third place.... Maybe that is another piece of the puzzle to why there were 20 djinn slots per element. Sort of.)

So Venus / Mars each only get one class type they can access on the "Lunar" (Jupiter/Mercury) side... and vice versa... hm...  Secondary elements don't get access until 6 djinn of another element.... Hm.... Which is pretty much like saying "Keep Sol and Lunar separate until near end-game." ... However, even then the djinn reqs still divide the class types in half, sort of. I'm guessing the only time when Venus/Mars being priority matters for the same class type is in tri-classes for types 3 & 5, and everything with type 4... otherwise they could have been completely separated? (And similar with Jupiter/Mercury.))
But of course, such restrictions that would be lifted (e.g. changing the starting levels) would sort of imply a Class System overhaul....? ... Or maybe not. Since the level like tells how strongly elemental-aligned they are. (e.g. A base level of 9 or 10 would ensure that element stays primary.)

Flags for Item Classes? Not sure I understand? What "flags" are we referring to, since I don't remember any being required...
Also, 3? Pretty sure Salanewt created a simple patch for 5 item classes. (Takes up the unused item slots.)
---
Oh yes.... I forgot to mention my table idea here as well (edited): (Though I'm kinda considering it as maybe at least one way to do it/not 100% sure.)
Quote
My table idea is kinda like this:
8-bit = Command (Basically whether "Final class type" is absolute or relative. (aka: Class type = value ... or ... initial class type + value) .. But also here for any future purposes.
8-bit = PC flags
8-bit = Initial class type (Not needed for 'relative')
8-bit = Final class type
16-bit = Item
16-bit = Flag index (e.g. If an event happened or not)

At least in that case, it is 64-bits/entry. (Nice even spread) ... but is it fair enough... hm....
« Last Edit: May 10, 2017, 07:26:44 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Rolina
The Fulminous Witch
Jupiter Clan

Template maker turned lurker

Alchemist
*

Coins: 10
Offline Offline

Gender: Female
I am: wondering if we can get our clan position changed...
Clan Position: Grand Overlady of Jupiter
Posts: 6051

« Reply #5 on: May 10, 2017, 11:42:59 AM »

???

Who are you replying to there in that first bit?

Anywho, as for item classes, how you do you actually assign a class to an item itself?  Saying it's a class changing item in the editor is well and good and all, but what designates what specific class it changes a character to?  If we make a new, fourth item class, how would we be able to designate the new item made for it to that fourth class?  Is there an upper limit on how many classes we can make?
« Last Edit: May 10, 2017, 11:45:50 AM by Rolina » Logged

View Profile WWW
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« Reply #6 on: May 10, 2017, 03:15:38 PM »

Role: It's literally just a bit of code that goes "if item a is equipped, set class type to 15; if b, set to 16, if c, set to 17" where a-c are specific item IDs. This is also set up to overwrite any other class type that a character would use otherwise, and the minimum element counts are 0 in every element so you won't be shunted to the NPC class either.

I would imagine that you are limited to the number of class types that can exist, which depends on the size of the type value and whether it is signed or unsigned. I think it would be safe to say that it's unsigned, but I can't recall if it is read as a byte (limit of 255 types) or if it is larger. That being said, class IDs are read as a byte most of the time so our absolute maximum number of classes would be 255 without some pretty major changes to the game (even going above 243 would require some large changes), so a larger value for class type would be pointless unless you can rig the type chart to work differently.
Logged

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?
View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #7 on: May 10, 2017, 07:38:33 PM »

The first bit = That was just me thinking about class organization stuff.... if it ever helps come up with any other additional ideas..... Probably should have separated it better.

Since Class Type is like 32-bit. (I think).. in the class table... I'd say limits are definitely capped off elsewhere.
The limit is the number of classes  The byte in RAM for your class is 8-bit (The reason I wanted my table to have class type as an 8-bit, and also due to how unlikely you'd need more room.), but I suppose one could remove that and call this class finding function every time you need the class id. Then you would need to deal with the item limit (max 0x200(first=Nothing) with minor code edits/table repointing / and without changing the ram.) ...If one raised the item limit further, then your limits /could/ be based on ROM space available for items and classes.

@Salanewt: Exactly what Salanewt said = A simple "It is equipped check"... No additional ram needed. Although, the item type of the item might still need to be Underwear... I seem to recall something about that, but my memory is a bit hazy. However, it definitely makes sense for knowing what item to pass as an argument to the function. So yes.... - Now that makes me wonder what the Item Types in GS3 are. (If it is the same stuff or not.)
« Last Edit: May 10, 2017, 08:08:07 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Rolina
The Fulminous Witch
Jupiter Clan

Template maker turned lurker

Alchemist
*

Coins: 10
Offline Offline

Gender: Female
I am: wondering if we can get our clan position changed...
Clan Position: Grand Overlady of Jupiter
Posts: 6051

« Reply #8 on: May 11, 2017, 02:12:12 AM »

Hmm... I've always been a large proponent of character separation for classes.  When you do the math, that's 31-32 classes per character, with 8 more dummy slots for organizational purposes.  We'll say 40 slots per character - *8 gives us 320 slots needed for full character separation.  Let's assume an extreme for item classes, and say that someone wants 8 item classes that overwrite a full class allotment - so we'll be generous and say 40 slots per item.  That gives us 640 slots for classes.

I think it's easy to say this would be more than enough for people to work with.  Gives room for more granular class approaches, as well as crazy experimentation with item class expansion, and likely still has a tiny bit of room left over.  Perhaps we could have the editor display up to slot 640 then?  I'd certainly be a fan of some reworked patches for party and character separation to be added to the editor as well...

@Squirtle:  Do we know how to make a 4th or 5th item class then?  How to tell the game "yo, this new item changes class when equipped to this class number"?
Logged

View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #9 on: May 11, 2017, 05:43:14 AM »

Hmm... 320 and 640 are greater than 255 (8-bit)....
After thinking about it some... I wonder...
Quote
That being said, class IDs are read as a byte most of the time so our absolute maximum number of classes would be 255 without some pretty major changes to the game (even going above 243 would require some large changes)
-If we increase from 243+, we'll still need to make room in the text data. (I think all these references can be found by searching the number "00000B63".. since that's the text index for the very first class.... then... a person should be able to easily change everywhere that index appears to the bottom of the table (if they want to).... without need for any types of code changes outside of address/cap changes/moving the class table.... At least as far as I know....)
-If we increase to 256+, then we'd need to deal with the Class Index in the pc ram data. (For one, I assume that a work-around can be made in the function that calculates the class address? If not, then my Function Call locator can find every call to the function... and we must also note that there are only a few things in class tables... Class Type and Level reqs checked by class matching/class id calculation function... and it looks like the rest of them are pretty much... well... at the addresses listed below.)

Regardless of anything above, let's just get to the bulk of relevant data locations.... and where research and/or editing would be done....

(We already know of the class id calculation function... that uses class type and elemental levels, so I can skip that...)

(Reserved for the list of locations calling the function that calculates class address..)
080AD75E = For the stat multipliers
080AF508 = For the abilities
080B0720 = For the vulns
(That's all of them... calling the class address calculation (Aka: base_address + class_id  * entry_length , with min/max caps) function. = Yep, it is not a public function.)

(Reserved for the list of locations for the text indexes to be edited..)
0803B62C = Likely for the text command.
08043CCC = Continue/Erase/Battle/Save file menus.
08046B00 = Battle>Djinn menu
08048068 = Battle>Status menu
080F855C = Party Menus>Psynergy and Items menus
080FF79C = Party Menus>Status menu>Main
080FFCCC = Party Menus>Status menu>Psynergy
081024A0 = Party Menus>Djinn Menu>Main
0810363C = Party Menus>Djinn Menu>Standby/Trade menus

083FF4B3 = False-positive - Doesn't count.
That's all? Or did I miss anything?

(You're probably like... "How can we move the text if compression is too big of a problem to work with... and Teawater, your Editor doesn't exactly support easily moving groups of text around."... in which case I'd be like.... have you tried messing around with gstoolkit/uncompressed text/etc.)

By doing these things.... Atrius's Editor might probably lose /some/ support without changes..?  I think Atrius's Editor tries to grab the table addresses from the ROM's code. ... But I can't remember if Atrius's Editor has the classes text list index hard-coded/static or not.

@Salanewt: So can you kind of detail to me what exactly these large changes may be? (I think I get it some... but with thinking of my bullets above, I'm not sure-sure... I still need to think a little more about it, though. )


----
Quote
@Squirtle:  Do we know how to make a 4th or 5th item class then?  How to tell the game "yo, this new item changes class when equipped to this class number"?
Basically this?:
http://forum.goldensunhacking.net/index.php?action=downloads;sa=view;down=34

All you need to do is insert things like this: (If following his method.)

mov r1, 0xBC  r1 = 0xBC (Here is the item id you want to check for... but in two instructions. Since a mov command only goes from 0-255 (0xFF), you need to add another value to go further.)
add r1, 0xFF  r1 += 0xFF (0xBC + 0xFF = 0x1BB ... That is 443 in decimal, which is the item id for Mysterious Card.)
cmp r8, r1 (r8 is the Underwear item that you equipped, ... that is being compared to a specific item... Mysterious Card in this case. )
bne nextCheck if r8 (equipped item) != r1 (Mysterious Card), jump... Jump to next item check if your equipped underwear item is not a Mysterious Card. (As in this example.)
mov r6, 0xF Because if they are equal, we want to set the class type (r6) to a value of 0xF (15).
b postChecks (Jump to after all class type changing checks.)

nextCheck:

more checks here like the one above....

postChecks:

the class type scanning stuff...



He has all five item class checks done the same way... Not the most optimal in this case... since you can kind of do all five at once. :P even if the class-ids were different, you could still have a look-up table...
But the individually written out way... wel... it gets the job done... and helps others to have something to copy/paste to add more....  I hope that wasn't too confusing. :)


My patch idea... will most likely overwrite the same area his patch overwrites.... at least in the beginning, anyway....  for obvious reasons. (e.g.  You're going to be using one or the other, not both. :P)



----
And now to work on that patch?
r5 = Pointer to elemental levels data...
r6 = Class Type
r7 = Player Character
r8 = Equipped Underwear Item

Sounds like r0-r3 are free... But oh! It's not smart to use those and call functions without saving needed variables...


WIP:

ldr r4, tablePointer

label1:
ldrb r1. [r4, 0x0] //Command
cmp r1, 0xFF
beq exit

//PC check
ldrb r3, [r4, 0x1]
lsr r3, r3, r7
mov r2, 0x1
and r3, r2
cmp r3, 0x0
beq next

//Item check
ldrh r3, [r4, 0x4]
cmp r3, r8
bne next

//Event Check
ldrh r2, [r4, 0x6]
mov r1, 0xFF
lsl r1, r1, 0x8
add r1, 0xFF
cmp r2, r1
beq label2
bl 0x08016CE4 (Checks event flag)
cmp r0, 0x0
beq next

label2: //If all main checks passed...
ldrb r1, [r4, 0x0]
cmp r1, 0x0 //Class Type Check
bne label3
ldrb r2, [r4, 0x2]
cmp r2, r6
bne next
ldrb r6, [r4, 0x3]
b exit

label3:
ldrb r2, [r4, 0x3]
add r6, r6, r2
b exit

next:
add r4, 0x8
b label1
« Last Edit: May 11, 2017, 11:56:56 AM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Salanewt
His Sexiness
Mercury Clan

Oh yeah, baby!

Prodigy
*

Coins: 32
Offline Offline

I am: A part of the organization of Cool Cats, but more of a dog person in reality.
Emblems: Have a nice day.
Posts: 4566

« Reply #10 on: May 11, 2017, 02:15:58 PM »

Role: Pretty much what Fox says; all it really takes is to tell the game to check for more item IDs and assign more classes, which is a very simple thing to do (and the aforementioned patch does just that if you are fine with having a five item limit).

Fox: It would still be a somewhat large overhaul given the number of things that would have to be changed or expanded for more classes to work, relatively speaking of course. Perhaps a number of the individual changes would be fairly small, but you still have to change or at least account for everything related to calculating class address (as you listed), text (which isn't too large), plus character RAM stuff and address calculation there. Which again, there isn't a whole lot there but everything that does need to be changed adds up to a large collection of changes.

I can't think of anything else that would need to be dealt with right now, aside from where to move the new class table and stuff. Plus, almost anything related to assembly is a large change to people who aren't too familiar with it. :p
Logged

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?
View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #11 on: May 11, 2017, 06:49:36 PM »

Mmkay... Was more or less thinking your wording was more implying towards a "it's too large that you're best off not even doing it.".... scenario. (Or at least, somewhere along those lines.) ... but was just wanting to make sure it wasn't....

~15 areas to edit (Those locations, and repointing the two tables.) sounds like a medium sized project to me, if the changes are relatively small in each area.... and can be done in a single day...  (At least for support up to class id 255.) ...

If we are to still to store the value in PC RAM (Instead of calculating directly each time...)
then wouldn't it be a good idea to just simply -1 to all those pc ram references? Since the byte before it does seem to be unused as of current for GS2. (And searching for all those addresses can PROBABLY still be done in a similar way I found the text id locations. (Pattern search?) ... If not, then we already have an idea of how many of them need editing.

Quote
02000B78 = ID in GS1, unused in GS2?
 02000B79 = Class

Oh yes, if there are any enemy areas I missed where class id is grabbed and/or set.... editing them may be optional. It's not like they're ever non-zero anyway. (And will continue to stay 0 even without editing them. I think.) - The only case in which they are not "optional" is if people want to add actual classes to them. (I assume by that time, there may be a bunch of other things the hacker may want to do as well... soo.... kinda expands the territory further than my point.)

^ As an experiment.... Maybe I look into making a "Patcher" for that later... (clean ROM assumed, but anyone can edit addresses.)... could probably be an open-sourced Console application... (Especially since to write python that I don't have prepared would take more time. e.g. I already have text decompression/compression in C#.).... but for now... I don't have any current plans to do so... so may or may not get around to it. But if I do go along with it eventually(Can't say), then I /might/ create a whole batch of these for other tables as well. Depends, though....

Speaking of de/compression... I get the feeling I should have made separate Console applications for them as well... Hmmm.... (So like.... replacing gstoolkit in its entirety... Except for some minor differences. Some which are better, like being faster, and being able to recompress.... I might have it just convert to raw binary, though...  and have other programs that encode/decode in the [ # ] ones for text editor purposes. But that's assuming if I decide to do any of this.
« Last Edit: May 11, 2017, 09:13:09 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

I need saves to test encounters in GS Reloaded!

Great Member
***

Coins: 13
Offline Offline

Gender: Male
Posts: 739

« Reply #12 on: May 11, 2017, 08:58:34 PM »

The code is like squirtle said, but remember that items and classes are one after the another, which makes the code look like this:

if item = x
then class = y
else if item = x+1
then class = y+1
else if...

With this structure is very easy to make a much larger item/class range fit in the same space.

you just set a lowerbound and an upperbound for class changing item ID, and extract the matching class via difference from the lowerbound in a single "if then", without touching anything else.

My 2 cents.
Logged
View Profile
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411

« Reply #13 on: May 11, 2017, 09:26:34 PM »

It's still a bit long, though... Imagine:

mov r0, r8
mov r1, 0xBC
add r1, 0xFF
sub r0, r0, r1
cmp r0, 0x5
bpl nextCheck //greater than or equal, jump.... (Tried to pick an unsigned check, I hope I picked the right instruction.)
mov r6. 0xF
add r6, r0
b postChecks

I probably missed something, and it can be simplied further? But this goes into detail in Caledor's point of a single if-then... (That I did think about as well.)



Edit:
Quote
if item = x
then class_type = y
else if item = x+1
then class_type = y+1
else if...
Fixed! (Class type != class id , but not to worry, I make similar mistakes as well.)
« Last Edit: May 11, 2017, 09:47:19 PM by Fox » Logged

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...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile

I need saves to test encounters in GS Reloaded!

Great Member
***

Coins: 13
Offline Offline

Gender: Male
Posts: 739

« Reply #14 on: May 11, 2017, 09:44:47 PM »

I haven't seen the code cause i don't know where it is, but shouldn't the original be longer?

In each 'if then' cycle you need (hypothetically) to:

set item id (at least 2 instructions cause it's bigger than 255)
cmp (1)
conditional branch (1)
set class id (1)
save class id (1)

that's 6*3= 18 instructions (16 if the other two just add+1 to idem id instead of recalculating from scratch)

while we need to:

set lowerbound (2)
set upperbound (1)
cmp lowerbound (1)
conditional branch (1)
cmp upperbound (1)
conditional branch (1)
subtract lowerbound from item id (1)
add to base class id (1)
save class id (1)

= 10 instructions

Again, this is all speculation, but it's what i expect to find based on what squirtle said.
Logged
View Profile
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Cbox
Today at 02:46:36 PM
KyleRunner: Atrius!!
Yesterday at 11:29:46 PM
Atrius: @Fox, I tried, but for some reason Mario Golf won't boot, and Mario Tennis crashes when you patch out the text compression, and I'm not sure why...  The normal text loading functions in them are basically the same as the ones in the Golden Sun games.
April 16, 2018, 07:44:36 AM
Drake baku: So it took about halve a hour of letting my lap stay off for it to suddenly work again
April 16, 2018, 07:31:28 AM
Drake baku: All of a sudden fox his editor gets errors. When trying to start it, thing worked fine yesterday...
April 14, 2018, 01:04:37 PM
Fox: @Mario Golf/text editing = Nope... And it may be awhile yet. I think I looked into it before... (at least for GS1)... but usually is the case when I come across a particular problem, that it can delay a solution for an extremely long time.
April 12, 2018, 04:27:14 PM
KyleRunner: Gee... never used discord...
April 12, 2018, 06:03:23 AM
Drake baku: I take it back, found it
April 12, 2018, 06:02:01 AM
Drake baku: But there is no discord link to be found
April 12, 2018, 06:01:44 AM
Drake baku: Everyone is on discord
April 11, 2018, 09:44:06 PM
KyleRunner: Fox, what about that tool for editing text in Mario Golf? Didi you finish it? If not, can you make a version of gstoolkit compatible with it?
April 11, 2018, 07:41:25 AM
Drake baku: Mauw
March 30, 2018, 07:26:11 PM
Salanewt: Hi!
March 29, 2018, 07:37:45 PM
ThanatosTheDark: YYEEEOOOOOO
March 12, 2018, 02:21:06 AM
Fox: say*
March 12, 2018, 02:20:53 AM
Fox: I saw we need an event this April Fools/Easter... because two holidays are in one, why would we not want to miss having something special? (Unfortunately, there's no one here to make an event be successful.)
March 12, 2018, 02:18:17 AM
Fox: And since that's the case...  I have thought of another fun experiment idea. - What if we had an auction on who should run this site, and waited for 10 people to bid and also for a bare minimum of 24 hours. Who would bid the highest, and how much would that bid be? - The idea is more for lulz (Maybe for April Fools?), and a theory to get an idea of how much the site might be worth as well.
March 11, 2018, 03:02:31 AM
Fox: Creepy, isn't it?
March 10, 2018, 02:19:04 AM
Fox: It's frog legs now.. It's something that's dead, but somehow still manages to wiggle.
March 09, 2018, 04:12:17 AM
JamietheFlameUser: I think this place is still dead.
March 02, 2018, 09:43:18 AM
Pkmn-Master: Lol I haven't been here in like 6 years. How is everyone?

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.094 seconds with 22 queries.