[PSX/PC] KERNEL.BIN editor - WallMarket (v1.4.5)

  • Thread starter Thread starter nfitc1
  • Start date Start date
Status
Not open for further replies.
Q: Hey there NFITC1! We haven't heard from you about this in a while. Have you got any updates to WallMarket?

A: Not quite yet. I'm re-writing the entire thing in VB9 (or VB2008 if you want to call it that). Among some speed and possibly size issues, this will eliminate the dependency on the comdlg32.ocx ActiveX control (which I never liked about VB6).

Q: Sweet! Will anything be added/changed?

A: Oh, maybe one or two things and a misspelling or two.
 
As awesome as it looks, I've hit a really strange snag.

First off, the LZS compression is really weird. I just spent the last 20 minutes trying to figure it out. It doesn't seem that hard, but it's still not going to be a simple thing. However, I never learned how to compress things. Can anyone teach me how compressing works? Else we're going to end up with an uncompressed kernel2.bin, which would be easier on me at least. :)

Secondly, and most importantly, in the KERNEL.BIN for the PSX there are some weird goings on with the descriptions and names. There seems to be a function, F9h, that takes a single byte argument that somehow references what it has already written. As an example, here's the description (raw and decoded) for Poison Ring (begins at offset 0:94 and is entry index 7):

Code: [Select]
Code:
24 52 41 49 4E 53 00 3B 30 4F 49 53 4F 4E 3D 00 41 54 54 41 43 4B 53 0C 00 50 52 4F 54 45 43 54 53 00 41 47 F9 21 54 F9 A0 3D D  r  a  i  n  s     [  P  o  i  s  o  n  ]     a  t  t  a  c  k  s  ,     p  r  o  t  e  c  t  s     a  g ** ??  t ** ??  ]
There at the end are two "text calls". The first, F9h 21h, references "ains" from the word "Drains" (offset 0:96) to complete the word "against". The second one, F9h A0h, references the "[Poison" (offset 0:9B) at the beginning. It's likely that this "text call" can only return up to eight characters or else it could have retrieved the nine characters that make up the first "[Poison]" instead of leaving the "]" on at the end.

This happens a LOT in all the FFText files of the KERNEL. It doesn't have to reference just its entry. Quite often it will reference an entry several indexes back. Can anyone explain just how it's coming up with this?
 
Last edited:
Just a blind guess:
0x21 -> 00100001b -> 00 | 100001
0xA0 -> 10100000b -> 10 | 100000

First two bits:
00 - copy 4 bytes
01 - copy 6 bytes
10 - copy 8 bytes
11 - copy ?10? bytes
It starts at 4 bytes, because the special command already occupies 2 bytes, so if you'd want to copy only 2 bytes, you could just aswell write them to the output as regular characters.

The remaining 6 bits:
100001b is 0x21 (or 33 decimal) and the 'ains' string is exactly 34 bytes from the 0xF9 character
100000b is 0x20 (or 32 decimal) and the '_[Poison' string is exactly 33 bytes from the 0xF9 character
The deltas are decreased by 1 because it would make no sense to reference text zero bytes from the current offset.

Again, just a blind guess. You're better off asking Akari for help, as he is the master of the PSX version disassembly.
 
Topic about text in kernel

https://www.ff7catalog.com/threads/4274/

Compression.
Code: [Select]
Code:
            temp = file->GetU8(offset);            if (temp == 0xF9)            {                // simple string compression, reference an earlier substring                ++offset;                int dist  = (file->GetU8(offset) & 0x3F) + 2;                int count = (file->GetU8(offset) >> 6) * 2 + 4;                for (int k = 0; (k < count) && (file->GetU8(offset - dist + k) != 0xFF); ++k)                {                    name.push_back(file->GetU8(offset - dist + k));                }            }
 
Once again, that was marvelously helpful! Because of it, the accessory descriptions are now displaying correctly. Also, I now have a (more or less) complete mapping of FF7's font.

More than ever I wish I had a wiki account because I'm always seeing small errors all over the place. There's an error on the LZS description page's example that had me scratching my head for several minutes. Almost all the sections to the kernel's contents are wrong or are lacking in information to some degree.


EDIT: I don't remember this ever said in the game. :)
 
Last edited:
those look like 2 letter refferals to bigger words. for instance "At" being attack? who knows :P
It looks more like two character references to elements and statuses:
Code: [Select]
Code:
Fr - FireIc - IceLt - LightningEt - EarthPs - PoisonDm - Gravity? (Dark matter?)Wt - WaterWi - WindHl - Heal/Holy (could be either, I'm betting on Holy)Dt - DeathRe - RegenSp - SleepPo - PoisonedSd - SadnessAn - Fury (Angry?)Cn - ConfuseSi - SilenceFa - HasteSl - SlowSt - StopTd - ToadMn - MiniSn - Slow-NumbDg - ?At - Barrier (Attack Def?)Mg - MBarrier (Magic Def?)Rf - ReflectAb - ?Gd - ?Cn - ?Mn - ManipulateBs - BerserkNo - Peerless (No damage?)Pl - ParalyzeDk - Darkness
Some statuses are missing and they aren't in order nor are they unique. I'm not sure they really serve a purpose...

UPDATE:
Here're some features planned for WallMarket.NET 1.0:

  • Immediate switching from PC to PSX names/descs and saving/compiling of same. (successfully working already, but kernel2.bin gets larger cause I have no idea how to compress it. :) Should still work either way.)
  • Can edit any of the text or battle data sections (still working on battle growth and initial data, that will be versions 1.1 and 1.2)
  • Editing any part of the raw data, even battle data not shown directly in the editor! This includes inserting special characters into names/descs. (Mostly working)
  • All the original features from WallMarket 0.9.29 :D (No longer working on this version. It will become legacy soon enough.)

I'm estimating this will take a week at least. I have to rebuild the interface mostly from scratch, but I have all the code still written (though some will have to go through re-writes since this is in a different language). Donations are still welcome, but not required. ;)

EDIT: I had an epiphany about what is currently labeled as "status chance" (0x11 of the attack data). It is split into three sections:
80h: remove status if inflicted, inflict at (chance/63)% success rate
40h: remove status if inflicted with (chance/63)% success rate
20h - 00h: (0 - 63/63) % chance of inflicting indicated status(es)

I don't think I would have noticed this if Frog Song hadn't been BFh while Toad/Mini is just 92h. Toad will miss, but Frog Song will Inflict and Remove Frog and Sleep from a target without missing (as long as the target CAN be frogged/sleeped of course). Learning this kinda made me want to turn on the "ignore status def" of Frog Song and cast it on Safer Sephiroth. :D

RE-EDIT: Forget what this sentence was before. Someone did something about it and it is no longer valid. Thanks to whomever it was. :D
WallMarket.NET will not enforce materia links like WallMarket 0.9.x does. I didn't like doing that, but I didn't ever test it before. Now that I have I discovered that Materia Slots 01h and 04h are empty single slots. To my knowledge, these do not appear in the game anywhere. Only the Ultimate Weapons are no-growth and they are all 8-linked slots (except Aeris's which is 6-L 1-U and normal growth). I just realized that the Gigas Armlet has 0 growth and a 2-L 1-U slots. So this will the only item in the game with a Materia Slot of 01h. These empty ones are just cosmetic as a materia can still gain triple AP in an empty slot.
I played around with some links and it seems like they only work if the odd-numbered slots are linked to the right and the slot they are linked to links to the left:

O O==O O <--- looks fine, but does not work

=O =O O O <-- looks odd on the left, also does not work

O O O==O <-- works just fine

If I put non-support materia in those link slots they work fine and their effects show up in battle. Any value higher than 7 just seems to create unlinked slots. They work fine too.
 
Last edited:
This is kind of off the topic of materia slots, but it still classifies as kernel.bin editing.

So I used the information of the Mega All materia to make a "Mega Quadra Magic" materia.  I selected "34" as the materia type, "99" as the materia type attribute [1], and "1" to "5" as the materia type attributes [2] to [6] respectively.  When I tried it in battle, however, it worked perfectly, but as a Mega All materia, not a "Mega Quadra Magic" materia.  And I swear, I did everything perfectly.

I'm thinking that materia type 34 is just for Mega All, but so far, I've only tried out "Mega Quadra Magic" (theoretically, it should also work with Final Attack and maybe other things, as "All", "Quadra Magic", and "Final Attack" are all of the materia type "35").  I might come up with something later.

Until then, does anyone have any answers?  (Or is my guess correct?)  Anyone?

Cheers!
 
A lot of things are hard-coded into the game (as I found when trying to play with the amount of summons the player could perform with different materia levels). Perhaps quadra magic is hard-coded the same way. I'll try this today and I'll see what happens.

EDIT: I've just tried this. Didn't work for me either. Looks like materia type 34 can only do "all" (unless I'm doing something wrong as well).
 
Last edited:
thanks dude ive been wanting a kernel bin editor for a while now

thanks
 
Weapon and armor slots parsed by pairs so you cant link 1 and 2 slot, only 0-1 2-3 4-5 6-7
Slot types only checked as is
Code: [Select]
Code:
if ((slot1 == 2 && slot2 == 3) || (slot1 == 6 && slot2 == 7)) // if linked{    [SP + 10] = w(S1);    A0 = materia1_data;    A1 = materia2_data;    A2 = S3;    A3 = S4;    system_add_pair_materia_unordered();}
About megaall. Materia with type 0xX4 ignored during all parse (pairead and single) and only used in special megaall parse function. It doenn't matter if you set type to 0x44 or 0x94. It check lower 4 bits.
And mega all doesn't use any other info in data exept exp needed for materia grouth. It calculate number of activated stars and add this number to all atributes for activated magic, attacks. Many materias work this way.
 
Last edited:
About megaall. Materia with type 0xX4 ignored during all parse (pairead and single) and only used in special megaall parse function. It doenn't matter if you set type to 0x44 or 0x94. It check lower 4 bits.
And mega all doesn't use any other info in data exept exp needed for materia grouth. It calculate number of activated stars and add this number to all atributes for activated magic, attacks. Many materias work this way.
This is, indeed, the most unfortunate setback. It looks like the developers just copied the All materia and changed that type and the AP leveling requirements while making a dedicated function to handle type X4h. Perhaps this saved a few flops during processing, but I doubt it would have been significant. A Master-Steal-As-Well would have been good.
 
About megaall. Materia with type 0xX4 ignored during all parse (pairead and single) and only used in special megaall parse function. It doenn't matter if you set type to 0x44 or 0x94. It check lower 4 bits.
And mega all doesn't use any other info in data exept exp needed for materia grouth. It calculate number of activated stars and add this number to all atributes for activated magic, attacks. Many materias work this way.
This is, indeed, the most unfortunate setback. It looks like the developers just copied the All materia and changed that type and the AP leveling requirements while making a dedicated function to handle type X4h. Perhaps this saved a few flops during processing, but I doubt it would have been significant. A Master-Steal-As-Well would have been good.
Maybe it was in design document but they didn't make it in time, or they deside that this is not need for game. Anyway we may add all this features in Q-Gears as anyone needs them to use ingame. For the editor I think you could make this fields not editable. Just "megaall type", exp and stats boosting.
 
sweet.. i'm gonna modify mah buster sword lol. awesome stuff!
 
Maybe it was in design document but they didn't make it in time, or they deside that this is not need for game. Anyway we may add all this features in Q-Gears as anyone needs them to use ingame. For the editor I think you could make this fields not editable. Just "megaall type", exp and stats boosting.
I don't see any reason to make them not editable (it's annoying to make exceptions like that anyway), but I will have to make a note about materia types X4h in the description saying they have no effect. I'll do the same with the summon materia saying that modifiers 2-6 have no effect. There just are a lot of exceptions to these modifiers. Several effects (through modifier 1) don't take certain parameters either. If Steal As Well has a non-0 modifier it will always modify as many times as it wants regardless of what the materia type is (either 25h and 35h). Materia is one of those things I have little actual data on and I'm just basing it on observation of existing combinations. Changing these often doesn't work. :(
 
Anyway we may add all this features in Q-Gears as anyone needs them to use ingame.
Interesting. How mod-able is Q-Gears likely to be? Will we, for example, be able to change things like what 34h does, as well as which materias have it?
 
Anyway we may add all this features in Q-Gears as anyone needs them to use ingame.
Interesting. How mod-able is Q-Gears likely to be? Will we, for example, be able to change things like what 34h does, as well as which materias have it?
This thing isn't completly understood so I cant tell how it will be done. Most likely there will be hardcoded materia types. Maybe it will be in LUA. In any case there won't be hardcoded materia ID or anything like this.
 
Rejoice with me. I have successfully (and I believe accurately) created a working kernel2.bin file from scratch! Well, scratch in the sense that I extracted it the original and then re-compressed it. I emailed Ficedula for help (rather bluntly) but he hasn't gotten back to me so I tackled it on my own. Fun thing is, it is the exact size of the original kernel2.bin even though the contents are different from the original, I can see this with a Hex editor, but it functions identically. Now all that's really left to do is to is learn how to encode the PSX text (probably not as hard) and get it all saving everything and version 1.0 will be ready to be released.

I wasn't able to show this earlier because imageshack was acting up (That is Bahamut ZERO's attack which WAS named "Tera Flare" that he's about to perform).

EDIT: I would also like to add that the one that the one I can make is actually SMALLER than the delivered one. Why? Because there are objects (especially weapons and armors) that have no description. The way the file is formated, it has a bunch of pointers at the beginning of the file that points to the start of the description. During the original file's creation, if an object's description is blank it adds a terminator to the data and moves on. What I did was reference the previous terminator instead of add a new one. This saved a total of 493 bytes all together (I COULD potentially make my file even smaller and save more space, but it works as it is so I don't want to tempt fate), but that's that many more that you can use to change things around. :)

RE-EDIT: .NET actually has a GZip stream to work with! Unfortunately, it only uses the basest of compression levels (1) where KERNEL.BIN uses the highest (9). Since there's no way to change this (at least not without paying someone) we're still restricted to using an external gzip program to remake KERNEL.BIN. Expect version 1.0 to be released later this month (by the end of the week maybe). All that's left is to recompress the KERNEL.BIN's text the way the PSX has it. This is a modified version of the LZS so it shouldn't pose to great a challenge since I have that tackled.
 
Last edited:
Status
Not open for further replies.
Back
Top