Is "x" possible with just a Hex Editor?

Any information you would like to share or ask in regards to the hacking of Legend of Legaia
Post Reply
ImmortalMage
Level 2
Posts: 2
Joined: Mon Dec 14, 2015 1:08 am

Is "x" possible with just a Hex Editor?

Post by ImmortalMage » Wed Nov 09, 2016 2:41 am

Hello, I have been working on editing some aspects of the game to make it a bit more challenging/balanced.

So far I am able to edit any enemy stat to any value I want with just a Hex Editor without any major glitches. What I want to know is if any of the following are able to be edited with just a Hex Editor, and if not how would I go about doing so:

For starters Treasure Chest, or Cupboard, or basically any item on the ground's contents. For instance, the Door of Light in the Treasure Chest at the beginning of Drake Castle, would I be able to just edit a byte in the Hex Editor to switch the chest's content to a different one? Or are they more complicated than that and how would I go about doing it?

Another thing is shop content's and/or prices. I would like to edit a lot of these and possibly remove some items from shops altogether. I kind of found where to do this in save state editing but I don't know how to change it in the actual game file.

While I know where the enemy stats are in the game it doesn't feel like their exp and gold drops are stored in the same location, if they are I'm just missing them somewhere. I would think that these should be changeable with just a hex editor since they're just numbers but I might be wrong? I'm also wondering if changing character's stat's and/or stat growths are changed in there. I've seen Meth's (I think it was his) thread on the complications of the stats/levelling tables but I couldn't find anywhere in there where I could edit them.

If possible I'd like to alter some Seru capture rates as well, I would think it shouldn't be too hard but again, I might be wrong.

Finally, and this is probably the most unlikely but if possible I would like to edit Arts. Whether it be their damage, or being able to change their combinations completely to give the player the sense of having to learn them all on their own again, which has been lost for a while now with how many guides there are with them.

I appreciate any help or replies given, so far in modding enemy stats it's up to about Berserker in gameplay and I really think it's a lot more challenging! If I could get into editing any more than that I believe I could make something great.
Thank you all again!

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Is "x" possible with just a Hex Editor?

Post by meth962 » Wed Nov 09, 2016 11:28 pm

It is possible to change the game files with a hex editor but there are a number of nuisances that the prokion team did to make the data real ugly and unprofessional.

For instance, out of the 180 enemies in the game files, they stored the data in about 50 different ways. Why couldn't they be consistant? No idea, maybe 50 different developers worked on it :) But they're all stored with flags everywhere and calculated values. For example, if you see flag F7, take the next number and multiply it by 1.25 to get the enemy's attack stat. Stupid stuff like that.

Also there seems to be some global changes they made across the board to all enemies. For instance, you see every gold value for enemy defeat stored at 80% less than the real value. Seems they did some global tweaking and possibly only to the NA version of the game.

But a lot of what you're talking about is possible if you can spend the time debugging how the game loads from disc. I've found easier ones to manipulate like the attack damage trees for arts; It's just a big table of damage modifiers for each hit in an art combo.
まさかつあがつ

ImmortalMage
Level 2
Posts: 2
Joined: Mon Dec 14, 2015 1:08 am

Re: Is "x" possible with just a Hex Editor?

Post by ImmortalMage » Thu Nov 10, 2016 5:25 am

Thank you for the reply! That's a relief for the most part. Now to just do my best to find where they're stored. Do you happen to have any shareable notes or known documentation of the game that's not already on this website? If not that's fine, it would just be a lot easier since there's almost nothing on this game's documentation online lol.

For the gold thing you mentioned that it's just 80% lower, so that helps a lot, does the same apply for exp? And if the Arts damage is just one big table do you happen to have the offset for that? It would save me a lot of time.

Thank you so much for the reply and help, it's very much appreciated!

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Is "x" possible with just a Hex Editor?

Post by meth962 » Thu Nov 10, 2016 12:39 pm

Once I go back home, I could look up the address of the monster stats for you but I doubt I have the art table one anymore. I seemed to have just dumped it out of the file and not write down where it came from, only where it is stored in memory.
まさかつあがつ

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Is "x" possible with just a Hex Editor?

Post by meth962 » Fri Nov 11, 2016 7:19 pm

So the data pointer is 0x38AF000 for the first enemy inside the PROT.DAT file. From there, 24 bytes in are two bytes that refer to it's type. F7 in the case of the first enemy and from that I figure out how to read all the stats. Next two bytes are 0x52 which is the HP value of 82. Yada yada yada :)
まさかつあがつ

zkshd
Level 5
Posts: 10
Joined: Sun Nov 20, 2016 2:22 pm

Re: Is "x" possible with just a Hex Editor?

Post by zkshd » Sun Nov 20, 2016 2:31 pm

So the data pointer is 0x38AF000 for the first enemy inside the PROT.DAT file. From there, 24 bytes in are two bytes that refer to it's type. F7 in the case of the first enemy and from that I figure out how to read all the stats. Next two bytes are 0x52 which is the HP value of 82. Yada yada yada
First thanks for what you have done meth962. I am trying to mod the game with the steal and drop percentage for some monsters. So I decided to search and I found this post, however my quick analysis of the enemy data format is not logical, I post it:

Code: Select all

Drake G host (44 72 61 6B 65 20 47 FF 68 6F 73 74) dunno why the FF in the middle.

98 F9 00 00 F5 78 EB F0 84 EB F0 B8 B7 00 00 FF 82 00 5A 00 28 00 27 00 DF 14 00 1A 00 18 05 00 00 06 9F 02 14 00 34 01 DC FF DF FC 50 FF 00 56 00 88 06 0B 00 7C FD 30 F4 F0 43 00 00 20 47 00 FF 00 2C 51 00 00 38 5B 00 FF 00 98 6B 00 00 24 7F 00 FF 00 5C 8C 00 00 68 96 00 FF 00 A0 A3 00 00 AC AD 00 FF 00 44 72 61 6B 65 20 47 FF 68 6F 73 74

type FF
HP 130 (82 00)
AGL 90 (5A 00)
MP? 40 (28 00)

--------------------------------------------------------------------------------------
Dead Bo ne (44 65 61 64 20 42 6F BF 6E 65) dunno why the BF in the middle.

38 2D 01 00 F5 80 EB F0 8C EB F0 58 EB 00 00 EF E7 03 82 00 FC F9 07 06 00 F9 16 DC FF 1F 0F 34 05 6A 06 7D FF 0D 0C 01 38 59 00 00 7C FF 6C 00 00 F0 73 00 00 5C DF 7D 00 00 C8 86 30 00 90 00 F7 00 98 9B 40 00 A9 00 00 D0 DF B5 00 00 B0 C1 F0 F0 CE 00 FF 00 E0 DD 00 00 C0 E9 00 FF 00 44 65 61 64 20 42 6F BF 6E 65

type EF
HP  999 (E7 03)
AGL 130 (82 00)
MP? 130 (FC F9 ??? = 63996)

--------------------------------------------------------------------------------------
Skull  Knight (53 6B 75 6C 6C 7F 20 4B 6E 69 67 68 74) dunno why the 7F in the middle.

3C 2D 01 00 F5 80 EB F0 90 EB F0 5C EB 00 00 7F 9A 02 63 00 63 00 82 FD F0 9E FE F3 07 06 01 16 DC FF 1F 0F 6D FF 04 59 05 7C 0D 0C 01 3C FD 59 EC F0 6C 00 00 F4 73 00 FF 00 60 7D 00 00 CC 86 00 DB 00 38 F2 F0 9C 9B 40 00 A9 00 7F 00 D4 B5 00 00 B4 C1 F0 F0 FF CE 00 00 E4 DD 00 00 C4 FF E9 00 00 53 6B 75 6C 6C 7F 20 4B 6E 69 67 68 74

type 7F
HP 666 (9A 02)
AGL 99 (63 00)
MP? 99 (63 00)

--------------------------------------------------------------------------------------
Skeleton (53 6B 65 6C 65 74 6F 6E)

38 2D 01 00 F5 80 EB F0 8C EB F0 58 EB 00 00 5D 63 F9 F0 0D 00 18 FF F0 14 FD F0 3F 26 00 07 06 00 16 DC FF 1F 0F FF 48 00 4E 00 7C 05 0C 01 FF 38 59 00 00 7C 6C 00 00 FF F0 73 00 00 5C 7D 00 00 FF C8 86 00 00 34 90 00 00 FB 98 9B 40 00 A9 00 00 D0 B5 EF 00 00 B0 C1 F0 F0 CE 00 00 FF E0 DD 00 00 C0 E9 00 00 FF 53 6B 65 6C 65 74 6F 6E

type 5D
HP  99 (63 F9 ???)(but 63h = 99)
AGL 99 (F0 0D ???)(and this F9 F0 could be some sort of instruction)
MP? 13 (00 18 ???)(plus 0D 00 equals 13)
I believe that meth962, may have already seen this but I can't get a logic structure...

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Is "x" possible with just a Hex Editor?

Post by meth962 » Sun Nov 20, 2016 3:21 pm

I have a huge mess of code to read all of the stats right. It's based off type and a ton of flags. Honestly, this was some of the sloppiest work I've seen done in a game.

Skeleton type 0x59
1 byte HP = 99 (0x63)
2 byte flags = [0xF9, 0xF0] which means..
AGL = HP
2 byte MP = 13 (0x000d)
1 byte ATK x 1.25 = 30
2 byte flags 2 = [0xff, 0xff] which means..
UDF = ATK * 2 (before the x1.25 increase) = 48
1 byte LDF * 2 = 40
2 byte flags 3 = [0xfd, 0xf0] which means..
if next bye 0x3f, INT = MP * 1.125 = 14
1 byte SPD = 38

Skull Knight type 0x7f
2 byte HP = 666
2 byte AGL = 99
2 byte MP = 99
1 byte ATK = 130
2 byte flags = [0xfd,0xf0] which means..
UDF = MP * 2
1 byte flag = [0x9e] which means..
LDF = UDF
2 byte flags 2 = [0xf3, 0xf3] which means..
INT = ATK * 1.125 (146)
SPD = AGL
ATK *= 1.25 (162)

Dead Bone type 0xef
2 byte HP = 999
2 byte AGL = 130
MP = AGL
ATK = AGL * 1.25
UDF = AGL * 2
LDF = UDF
INT = MP * 1.125
SPD = AGL
1 byte unknown flag 0xfc

Drake Ghost type 0xff
2 byte HP = 130
2 byte AGL = 90
2 byte MP = 40
2 byte ATK = 39
1 byte flag 0xdf which means..
ATK *= 1.25 (48)
2 byte UDF * 2 = 40
2 byte LDF * 2 = 52
1 byte SPD = 24
1 byte flag 0x5 which means..
INT = SPD * 1.125 (27)

See? It's a lot of fun isn't it? I bruteforced my way into uncovering the flags. That seemed like a quicker way than breakpointing the PSX emulator and watching how it loads enemies from disc, then copies, then transforms the data using the flags.
まさかつあがつ

zkshd
Level 5
Posts: 10
Joined: Sun Nov 20, 2016 2:22 pm

Re: Is "x" possible with just a Hex Editor?

Post by zkshd » Sun Nov 20, 2016 4:01 pm

yeah... a lot of fun... every time i have to read this kind of binary data i have a strong desire to kill.

Anyway thanks for making it more clear, like each enemy has its own data reader. Since it a pain to read simple data, I believe it would be a mess to find the percentages and the item type each enemy drops/steal.

gledson999
Level 2
Posts: 2
Joined: Thu Sep 03, 2015 2:22 pm

Re: Is "x" possible with just a Hex Editor?

Post by gledson999 » Sat Jul 15, 2017 8:17 am

It's possible edit random battle enemy swap by other monster like: 2X Green Slime for 1 Green Slime and 1 Killer Bison?

Changing hex inside PROT.DAT?

User avatar
IronJustice
Level Rusty
Posts: 489
Joined: Sun Nov 04, 2012 9:18 pm
Location: St. Louis

Re: Is "x" possible with just a Hex Editor?

Post by IronJustice » Wed Jul 19, 2017 5:37 pm

The real question is, if "X" is really gonna give it to ya or not.

BTW, if you guys want to share a list of code that can be put into an emulator to make a "challenge mode" or some other mode of Legaia, I think we could be on to something beautiful. On FFT you could edit just about anything with the right Gameshark codes. The site 'Final Fantasy Hacktics' works off of this concept, sharing drastic changes to the vanilla game. I wouldn't be surprised if the same could be true for Legaia. Just paste a list as long as your arm of gameshark codes and you have an alternate game.
Legend of Legaia, a pinnacle of human achievement, will always have a place in my heart
Image

Post Reply