News:

As a consequence of the forum being updated and repaired, the chatbox has been lost.
However, you can still come say hi on our Discord server!

Main Menu

Class Type code patch (Idea stage/no patch yet)

Started by Daddy Poi's Oily Gorillas, 07, May, 2017, 09:11:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Daddy Poi's Oily Gorillas

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.)
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! :)

Rolina

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

Daddy Poi's Oily Gorillas

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.
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! :)

Rolina

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?

Daddy Poi's Oily Gorillas

Hm?
Quote
It goes like this:  Primary Secondary

1 -  :VenusStar: :VenusStar:
2 -  :MarsStar: :MarsStar:
3 -  :VenusStar: :MercuryStar: , :MarsStar: :MercuryStar:
4 -  :VenusStar: :MarsStar: , :MarsStar: :VenusStar:
5 -  :VenusStar: :JupiterStar: , :MarsStar: :JupiterStar:
6 -  :MercuryStar: :MercuryStar:
7 -  :JupiterStar: :JupiterStar:
8 -  :JupiterStar: :VenusStar: , :MercuryStar: :VenusStar:
9 -  :JupiterStar: :MarsStar: , :MercuryStar: :MarsStar:
10 -  :JupiterStar: :MercuryStar: , :MercuryStar: :JupiterStar:
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.)
QuoteMy 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....
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! :)

Rolina

#5
???

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?

Salanewt

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

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.)
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! :)

Rolina

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"?

Daddy Poi's Oily Gorillas

Hmm... 320 and 640 are greater than 255 (8-bit)....
After thinking about it some... I wonder...
QuoteThat 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
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

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

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

Quote02000B78 = 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.
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! :)

Caledor

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.

Daddy Poi's Oily Gorillas

#13
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:
Quoteif 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.)
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! :)

Caledor

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.

Daddy Poi's Oily Gorillas

#15
QuoteI haven't seen the code cause i don't know where it is
To find the location, there are several ways...
- You could look at the data in the patch itself through a hex editor.
- You could open the patch in a program that shows the patch's data. (e.g. IPSelect)
- You could read the Download description for addresses. (He has them posted = Nice!) Listed this one last, because it's not always a guarantee to find address info in descriptions. Where-as the above will show you what is modified/where things are repointed to./etc.

Quotebut shouldn't the original be longer?
Yes... the original/written out one is longer... but is also easier to modify. (I think.) ...
More or less saying that the shorter version still looks complex... where-as sometimes shorter versions often are suppose to be simpler. (Or whatever it is I'm trying to say.)

.... and class-id is only set directly like that in GS1 prologue, but then GS1 is the only one with an event flag check as well.

Quote= 10 instructions
Hmm... mine was about 9 instructions... actually, you could reduce it even further if the item classes were early in the table...
But anyway, I will say it is a tie.... in the end, the game's not about taking the least amount of space, but rather, to get something working efficiently. :)
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! :)

Caledor

Quote from: Fox on 11, May, 2017, 06:32:47 PM
QuoteI haven't seen the code cause i don't know where it is
To find the location, there are several ways...
- You could look at the data in the patch itself through a hex editor.
- You could open the patch in a program that shows the patch's data. (e.g. IPSelect)
- You could read the Download description for addresses. (He has them posted = Nice!) Listed this one last, because it's not always a guarantee to find address info in descriptions. Where-as the above will show you what is modified/where things are repointed to./etc.

I know them all, i completely missed the old patch. Sorry :P

Misery

Just so I'm understanding the idea in the OP (which I'm not sure I do), is the purpose basically to give more options for how to determine final class type by checking for more things? I get the impression it would be used to modify the class type value, or maybe even override/set it to something specific if certain conditions are met. Am I on the right track?

Anyway, for something else that has been brought up in this thread: getting more class slots to use. What complications would there be in reading the class data from different locations based on character number? For example, if PC number >= 4, use a second class data table, which could potentially double the amount of class slots available without having to rework the code to address numbers over 8 bits. Text string (class name) assignments have already been mentioned, but is that all?

(using this method, item classes should probably have a separate table as well, unless you want characters to get different classes from items)

Another idea to address the available slots issue that would be done on the editor (user) side rather than in code is to simply cut down on the amount of classes for each type. Instead of giving each class 5-6 stages with the same skill list just to have slightly different modifiers, they could have 1 or 2 stages and compensate for the lacking modifiers by making djinn give higher stat boosts.

I also think class data in GS could be stored much more efficiently. However, the work it would take to both change the code to read a different data format and to give it editor support... doesn't seem like it would be worth it, since I'm assuming there's more than enough free space scattered throughout the ROM to use the current format even for a large amount of classes (500+).