Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #135 on: December 03, 2017, 07:29:49 PM » |
|
Oh cool. That's nice.
One thing, though. It looks a bit unorganized and rushed.
I'd prefer the commands written the 16-bit way (That is the way they are written, right?).... and for them to be in order by their number... So like....
Something like below, but I'll have to work quite a bit on it....
---
General / Control Flow? 0000 0001 0002 = conditional jump, test player's gender 0003 = simple jump 0004 = End of script 0005 0006 0007 = function call
(Not sure if there are categories for 0100+ and 0200+)
??? 0300 0301 0302 0303 0304 0305 0306 0307 = Set variable 0308 = Normal Text box 0309 = for text that spans 3 lines 030A 030B = Text box with large letters 030C = for one line 030D = options 030E = End 030F 0310 0311 = Box with Title (Where will you go?) 0312 = Box without Title (just a text box) 0313 = default option (no option chose) 0314 = option (Deikle Village) 0315 = end of menu 0316 0317 = popup message: This are special text boxes that are really small and appear in the middle of the screen 0318 = wait for key press on pop up text box??
0363 = set actual place in the game's menu
037D = set name sprite 037E = set visible or invisible (portrait) Invisible are for NPC which doesn't have any portraits
??? 0478 = sets portrait. 0479 = sets eye expression and mouth expression. 047A 047B 047C 047D = adds extra sprites if the portrait is wider.
Yeah, it's a bit rushed, sorry >_< they are written by how you'd find them on the script files.
|
|
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #136 on: December 03, 2017, 08:37:01 PM » |
|
Oh no, you're fine. It's no problem.... This'll be very useful during research. Was more or less saying that going forward, I will be trying to use this other way. (I might include the arguments too. though I left those out of my example.)
|
|
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #137 on: December 04, 2017, 12:34:51 PM » |
|
Oh no, you're fine. It's no problem.... This'll be very useful during research. Was more or less saying that going forward, I will be trying to use this other way. (I might include the arguments too. though I left those out of my example.)
I see. Glad it was useful! One question, suppose all the functions have been identified properly, I guess we'll have to code them to make a decent dumper/inserter that, in case of the dumper writes down the XML plus the japanese text, and in the case of the inserter, reads up the xml formatted text and writes down the opcodes + translated text, am I right? of course, we'd need to take into consideration the fact that the sizes of each script will be different, and thus we'll need to modify the script table...I think that's how it was supposed to go down.
|
|
« Last Edit: December 04, 2017, 12:41:29 PM by pablitox »
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #138 on: December 07, 2017, 01:05:44 AM » |
|
Yeah, sounds like a good way to go... Especially if we ever want those tools to be used for more than just translating... As for the script table? I am not sure exactly what that refers to, but I don't imagine it to be a problem? (Re-pointing is easy if you got the space. Right?) (A bit random, but I kind of hate Python when it comes to file management. C# does a pretty good job, though.) I've already started documenting. The document is at https://docs.google.com/document/d/19HGbHkmIUfvd7fc0_gEpcuAjtwagtr7HpLv2dwE5jPg/editIt it is to list most of the functions in the game. (Functions being the code blocks that were intended to be called.) This is just the start, and there's a long way to go. But it's nice seeing the first section (0000+) only has a small number of commands. 0000 = Unused (Pointer is 00000000) 0001 xxxx xxxx EXPR = Set var to EXPR (xxxx=Type (2/3) , xxxx (2nd) =Index) 0002 xxxx EXPR = Conditional jump (in script) if EXPR=0. 0003 xxxx = Simple Jump 0004 = Related to ending script? 0005 EXPR = Loads PSI3 file. (Index being EXPR) Current position is not saved. 0006 EXPR = Loads/calls PSI3 file. (Index being EXPR) Current position is saved. 0007 xxxx = Function call (For same 0x1C byte entry) 0008 = Return from sub-function. (Does nothing if in main function?) 0009 xxxx = Function call? (Another 0x1C byte entry?) 000A EXPR = Sets slot EXPR (0-7) to type 0x9. 000B EXPR = Gets the on flags for the engine block EXPR (0/1) 000C = Nothing (Just returns 0 to continue script.) 000D = Sets PSI3 file id(Not sure?) to 0000, but doesn't load it? (Unknown purpose.) 000E = Unused (Pointer is 00000000) 000F = Unused (Pointer is 00000000) In the code, these ^ are pretty much separated into two groups, interesting enough. 0001,0004-0009 in the first group, 0002,0003,000A-000D in the other group.
|
|
« Last Edit: December 07, 2017, 01:14:17 AM by Fox »
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #139 on: December 07, 2017, 02:19:18 AM » |
|
Yeah, sounds like a good way to go... Especially if we ever want those tools to be used for more than just translating... As for the script table? I am not sure exactly what that refers to, but I don't imagine it to be a problem? (Re-pointing is easy if you got the space. Right?) (A bit random, but I kind of hate Python when it comes to file management. C# does a pretty good job, though.) I've already started documenting. The document is at https://docs.google.com/document/d/19HGbHkmIUfvd7fc0_gEpcuAjtwagtr7HpLv2dwE5jPg/editIt it is to list most of the functions in the game. (Functions being the code blocks that were intended to be called.) This is just the start, and there's a long way to go. But it's nice seeing the first section (0000+) only has a small number of commands. 0000 = Unused (Pointer is 00000000) 0001 xxxx xxxx EXPR = Set var to EXPR (xxxx=Type (2/3) , xxxx (2nd) =Index) 0002 xxxx EXPR = Conditional jump (in script) if EXPR=0. 0003 xxxx = Simple Jump 0004 = Related to ending script? 0005 EXPR = Loads PSI3 file. (Index being EXPR) Current position is not saved. 0006 EXPR = Loads/calls PSI3 file. (Index being EXPR) Current position is saved. 0007 xxxx = Function call (For same 0x1C byte entry) 0008 = Return from sub-function. (Does nothing if in main function?) 0009 xxxx = Function call? (Another 0x1C byte entry?) 000A EXPR = Sets slot EXPR (0-7) to type 0x9. 000B EXPR = Gets the on flags for the engine block EXPR (0/1) 000C = Nothing (Just returns 0 to continue script.) 000D = Sets PSI3 file id(Not sure?) to 0000, but doesn't load it? (Unknown purpose.) 000E = Unused (Pointer is 00000000) 000F = Unused (Pointer is 00000000) In the code, these ^ are pretty much separated into two groups, interesting enough. 0001,0004-0009 in the first group, 0002,0003,000A-000D in the other group. Amazing!! Well the dumper's ready then (i'll send you a link to a drive folder so you can post there all your findings if you want and check what we have done so far). Nice, I'll bookmark the file to check it out throughly. I'll edit this post if I have any questions!
|
|
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #140 on: December 07, 2017, 02:37:27 AM » |
|
You are welcome. Still got to document the other commands, though. = Hopefully I can get at least half of those in this month. (?)
Sounds good. I also have it in my Hacking Docs folder. (Misc. Docs link in my signature.)
|
|
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #141 on: December 10, 2017, 05:04:06 AM » |
|
You are welcome. Still got to document the other commands, though. = Hopefully I can get at least half of those in this month. (?)
Sounds good. I also have it in my Hacking Docs folder. (Misc. Docs link in my signature.)
That'll be most helpful! thanks fox Meanwhile I'll keep working on the graphic task.
|
|
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #142 on: December 11, 2017, 01:35:39 AM » |
|
Alright.. I have a tiny bit of info... "in this case the opcode is: 16 03 01 00 18 01 00 00 83 C1 00 00 The text in this opcode is 83 C1 which is translated to your partner name. Soon after this opcode we have a 0B 03 (big text) with 83 C1 81 49 81 49 that is: (Partner name) + "!!" But when testing I only saw the :(Partner name) + "!!", when the character summons him/her. I didn't see the summon name by it self as the 16 03 opcode is sugesting. That opcode is kinda weird, maybe this opcode will need some brute force search. t's not like there is much text in that opcode format. About all of it is or user created names and or '!' and or '?'. The only thing we need to take a look is that player name + 'Da'(japanese) + '!'. I think its the only of those 16 03 opcodes we might need to change. Do you have any clue to why a japanse would put a 'Da' after a name? (maybe something we need to translate) When I looked at the code on this, it looked like this command (0316) is for getting the number of characters in the text string. 0316 EXPR TEXT EXPR = Refers to where in memory to set the number of characters in text to. TEXT = The text to check (Using CX83 will read from the text variables) Does that make any sense?
|
|
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #143 on: December 11, 2017, 01:47:08 AM » |
|
Alright.. I have a tiny bit of info... "in this case the opcode is: 16 03 01 00 18 01 00 00 83 C1 00 00 The text in this opcode is 83 C1 which is translated to your partner name. Soon after this opcode we have a 0B 03 (big text) with 83 C1 81 49 81 49 that is: (Partner name) + "!!" But when testing I only saw the :(Partner name) + "!!", when the character summons him/her. I didn't see the summon name by it self as the 16 03 opcode is sugesting. That opcode is kinda weird, maybe this opcode will need some brute force search. t's not like there is much text in that opcode format. About all of it is or user created names and or '!' and or '?'. The only thing we need to take a look is that player name + 'Da'(japanese) + '!'. I think its the only of those 16 03 opcodes we might need to change. Do you have any clue to why a japanse would put a 'Da' after a name? (maybe something we need to translate) When I looked at the code on this, it looked like this command (0316) is for getting the number of characters in the text string. 0316 EXPR TEXT EXPR = Refers to where in memory to set the number of characters in text to. TEXT = The text to check (Using CX83 will read from the text variables) Does that make any sense? I think it does make sense for this control code. It's not like there is much text in that opcode format as earth said. I think we can leave it like that. What do you say?
|
|
|
Logged
|
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #144 on: December 13, 2017, 04:13:06 PM » |
|
I'm gonna addsome functions to the drive you made, these ones were identified by normmatt:
ROM:08003BC0 ; unsigned int __fastcall DrawCharacter(int src, int dest, int src_offset, int bg_color) ROM:08003BC0 DrawCharacter ROM:08003EB8 ; unsigned int __fastcall DrawCharacter_0(int src, int dest, int src_offset, int bg_color) ROM:08003EB8 DrawCharacter_0 ROM:08001F14 DrawString ROM:0800348C GetCharacterAddressInFont
One of the drawcharacter is for the normal font, while the other is for the big characters font (no clue which one's which)
|
|
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #145 on: December 14, 2017, 04:14:51 AM » |
|
Are there only like ~two ARM functions in this game (and the rest is THUMB.) or am I missing something? --- @What do you say? Sure, I guess. --- @Next post: Thanks! I've added them, but I need to figure out those others in the area... 08001D0C = Stores table addresses to RAM. 03002970 | 08BDA40C 098C8D9C 09718FFC 094D446C 09E2261C 08001D3C = File look up(table number, index of file) ; Returns address 08001D5C = File look up(table number, index of file) ; Returns size 08001D78 = File look up(table address, index of file) ; Returns address 08001D88 = File look up(table address, index of file) ; Returns size
08001D94 = 08001D98 = 08001DC4 = 08001DE8 = 08001E14 = 08001E38 = 08001E4C = 08001E64 = 08001E70 = 08001EA0 = 08001ED4 = 08001EE4 = 08001EFC = 08001F14 = DrawString(dest, textAddr, , src_offset (16-bit), bg_color) 080020A8 = (Text related) 080022B4 = (Text related) - Alternates between calling 08003B9C and 08003BA8 for each text character. No idea if it was meant to clear character. 08002388 = 080026CC = 08002A64 = 08002CB4 = 080031E8 = 0800348C = GetCharacterAddressInFont(text character id) 0800350C = 08003620 = 08003664 = 080036C4 = 080036F8 = (Text related) Draw string? (dest?,srcText,?) 0800379C = “ 08003840 = 0800393C = 08003A20 = 08003B9C = 08003BA8 = 08003BC0 = DrawCharacter(src, dest, src_offset, bg_color) 08003EB8 = DrawCharacter_0(src, dest, src_offset, bg_color) 080041C8 = 080043E4 =
080044B0 = -- From here on down - I/O stuff (Indirectly)Those two: DrawCharacter and DrawCharacter_0... Seem like each are called alternatingly... (Every other character using one, the other "every other character" using the other? Hmm.... But as with what I have in the quote, there's clearly more stuff to look into... so...
|
|
« Last Edit: December 14, 2017, 04:16:22 AM by Fox »
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #146 on: December 14, 2017, 02:14:35 PM » |
|
Are there only like ~two ARM functions in this game (and the rest is THUMB.) or am I missing something? --- @What do you say? Sure, I guess. --- @Next post: Thanks! I've added them, but I need to figure out those others in the area... 08001D0C = Stores table addresses to RAM. 03002970 | 08BDA40C 098C8D9C 09718FFC 094D446C 09E2261C 08001D3C = File look up(table number, index of file) ; Returns address 08001D5C = File look up(table number, index of file) ; Returns size 08001D78 = File look up(table address, index of file) ; Returns address 08001D88 = File look up(table address, index of file) ; Returns size
08001D94 = 08001D98 = 08001DC4 = 08001DE8 = 08001E14 = 08001E38 = 08001E4C = 08001E64 = 08001E70 = 08001EA0 = 08001ED4 = 08001EE4 = 08001EFC = 08001F14 = DrawString(dest, textAddr, , src_offset (16-bit), bg_color) 080020A8 = (Text related) 080022B4 = (Text related) - Alternates between calling 08003B9C and 08003BA8 for each text character. No idea if it was meant to clear character. 08002388 = 080026CC = 08002A64 = 08002CB4 = 080031E8 = 0800348C = GetCharacterAddressInFont(text character id) 0800350C = 08003620 = 08003664 = 080036C4 = 080036F8 = (Text related) Draw string? (dest?,srcText,?) 0800379C = “ 08003840 = 0800393C = 08003A20 = 08003B9C = 08003BA8 = 08003BC0 = DrawCharacter(src, dest, src_offset, bg_color) 08003EB8 = DrawCharacter_0(src, dest, src_offset, bg_color) 080041C8 = 080043E4 =
080044B0 = -- From here on down - I/O stuff (Indirectly)Those two: DrawCharacter and DrawCharacter_0... Seem like each are called alternatingly... (Every other character using one, the other "every other character" using the other? Hmm.... But as with what I have in the quote, there's clearly more stuff to look into... so... Glad it was useful!! One question about your first statement, how you differentiatie between ARM and THUMB functions? I though THUMB was just a subset of ARM, just with 16bits instructions. So that area is where the functions are stored is that right? As in, each call in the control codes refer to the functions in that place you pointed out. As normmatt explained us, at least one DrawCharacter is called to draw normal text, while the other is called when the text box contains BIG characters (if you play the game, just the first text to show up will have a bigger font and be displayed in the middle of the screen)
|
|
|
Logged
|
|
|
|
|
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan
Prodigy
Coins: 28
Offline
I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2411
|
 |
« Reply #147 on: December 14, 2017, 06:00:30 PM » |
|
Well, yes.... That is basically it. THUMB is cut-down ARM. However, I usually say ARM for 32-bit instructions, and THUMB for 16-bit instructions. (Kind of how it is labeled in VBA's Tools>Disassemble...) So that area is where the functions are stored is that right? As in, each call in the control codes refer to the functions in that place you pointed out. Well, kind of indirectly. I guess you can kind of think of it like a tree, but the root/parent functions for the control codes/commands aren't in this area. (However, they may call some of these functions, may need to check into that.) In what I posted, I was going through the code to list what looked like functions that can be called. (Generally.) Usually they're easy to tell because most functions (not all) are nested in push and pop instructions. As normmatt explained us, at least one DrawCharacter is called to draw normal text, while the other is called when the text box contains BIG characters (if you play the game, just the first text to show up will have a bigger font and be displayed in the middle of the screen) Maybe. What I read from a quick read of the code /seemed/ to contradict your statement (at least at first)... But until I have figured out where everything is. I can't say whether I've misread or not... While Summon Night's code seems easy to read (compared to some games), I do make mistakes.... 08001F14 calls - 08003BC0 - 08003EB8 080020A8 calls - 0800348C then 080041C8 - 080043E4 (at end)
|
|
« Last Edit: December 14, 2017, 06:13:21 PM by Fox »
|
Logged
|
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. DocsRefer 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*
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #148 on: December 18, 2017, 06:04:24 PM » |
|
Well, yes.... That is basically it. THUMB is cut-down ARM. However, I usually say ARM for 32-bit instructions, and THUMB for 16-bit instructions. (Kind of how it is labeled in VBA's Tools>Disassemble...) So that area is where the functions are stored is that right? As in, each call in the control codes refer to the functions in that place you pointed out. Well, kind of indirectly. I guess you can kind of think of it like a tree, but the root/parent functions for the control codes/commands aren't in this area. (However, they may call some of these functions, may need to check into that.) In what I posted, I was going through the code to list what looked like functions that can be called. (Generally.) Usually they're easy to tell because most functions (not all) are nested in push and pop instructions. As normmatt explained us, at least one DrawCharacter is called to draw normal text, while the other is called when the text box contains BIG characters (if you play the game, just the first text to show up will have a bigger font and be displayed in the middle of the screen) Maybe. What I read from a quick read of the code /seemed/ to contradict your statement (at least at first)... But until I have figured out where everything is. I can't say whether I've misread or not... While Summon Night's code seems easy to read (compared to some games), I do make mistakes.... 08001F14 calls - 08003BC0 - 08003EB8 080020A8 calls - 0800348C then 080041C8 - 080043E4 (at end) I see, thanks for the explanation! Glad it's not as hard to read as other functions! That's a slight relief :P
|
|
|
Logged
|
|
|
|
|
Regular Member

Coins: 0
Offline
Posts: 64
|
 |
« Reply #149 on: January 16, 2018, 02:25:51 PM » |
|
Good news!
The person that made the script format (earthdarkness) is back, so I'll share this infor with him, he'll find it really useful:).
Btw, about the big text, which function is the one that draws it on the screen???? How does it work?
I'm asking because we wanted to change it from 2byte reading to 1byte per char reading as it had been done with the normal text.
|
|
|
Logged
|
|
|
|
|
|