Author Topic: Kernel.bin: With a Vengence!  (Read 3886 times)

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Kernel.bin: With a Vengence!
« on: 2005-01-01 20:41:02 »
Hi guys.
I updated gears with muchly updated Kernel.bin info. I have the whole thing mapped except for section 1 (Command data) which I will provide a dump for.

There are still unknown holes, and I can't verify everything. I might be way off on some stuff too. Feel free to fill in the blanks.

It turns out I was right, Section 4 (Character data) is actually the initial character records for the savemap, along with the data right under it, all the way to the clock varible. It gets copied directly to the savemap.

Section 3 suprised me. It's almost an entire save image. I think this is the inital savemap state that gets copied into RAM when the game is initalized. Pretty cool.

As for section 1, here's the command data records all layed out and pretty

Code: [Select]

FF00 FFFF FFFF FFFF FF07 FFFF FFFF FFFF ;Command 1
FF01 FFFF FFFF FFFF FF02 FFFF FFFF FFFF ;Command 2
FF03 FFFF FFFF FFFF FF07 FFFF 00B8 00B9 ;Command 3
1F00 FFFF 00BC 00BD 170B FFFF 00C5 00C5 ;Command 4
0B05 FFFF 00C4 00C4 1F00 FFFF 00BE 00BF ;Command 5
1F00 FFFF 00C0 00C1 1F00 FFFF 00C2 00C3 ;Command 6
0000 FFFF FFFF FFFF FF04 FFFF FFFF FFFF ;Command 7
FF00 FFFF FFFF FFFF FF00 FFFF FFFF FFFF ;Command 8
FF00 FFFF FFFF FFFF FF07 FFFF FFFF 00B4 ;Command 9
0000 FFFF FFFF FFFF 0000 FFFF FFFF FFFF ;Command 10
FF06 FFFF FFFF FFFF FF08 FFFF FFFF FFFF ;Command 11
FF09 FFFF FFFF FFFF FF0A FFFF FFFF FFFF ;Command 12
1700 FFFF 00B4 00B4 FF07 FFFF 00B5 00B5 ;Command 13
1700 FFFF 00B7 00B7 9700 FFFF 00B6 00B6 ;Command 14
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF ;Command 15


It's pretty tiny, but I'm burnt out again.

Gears has passed 200 pages. Doing a quick overview of what is contained in there. I think we have enough information to re-create the bare bones of an engine, minus the world map. I'm not saying it's complete, but I'm pretty sure we could at least load startmap and place some inital values. Mind you we can't execute fieldscript yet, only parse it, but wow! This is really cool.

Anyway have fun. Happy Late Christmas present!

EDIT
Oops, I forgot to finish up the materia section, now it's exported with the correct version.

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Kernel.bin: With a Vengence!
« Reply #1 on: 2005-01-01 21:35:53 »
Having mapped out some of the more game-oriented field script commands and their implementations, I think I have enough basis to summarize the success of FF7 in two words: "pure luck". The scripting system consists of equal parts ingenious design and poor construction. It's like several different people wrote differents parts of the script and rarely talked to each other.

Still quite a ways to go on that, btw. I can reasonably quickly map out the syntax and semantics of the simpler commands without having to fully understand their implementation, but man oh man the more low-level commands... they're going to take a while to get done.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Kernel.bin: With a Vengence!
« Reply #2 on: 2005-01-01 21:45:27 »
I think I got the formatting wrong on the command section. Does this make more sense?

Code: [Select]

FF00 FFFF FFFF FFFF ;Command 1
FF07 FFFF FFFF FFFF ;Command 2
FF01 FFFF FFFF FFFF ;Command 3
FF02 FFFF FFFF FFFF ;Command 4
FF03 FFFF FFFF FFFF ;Command 5
FF07 FFFF 00B8 00B9 ;Command 6
1F00 FFFF 00BC 00BD ;Command 7
170B FFFF 00C5 00C5 ;Command 8
0B05 FFFF 00C4 00C4 ;Command 9
1F00 FFFF 00BE 00BF ;Command 10
1F00 FFFF 00C0 00C1 ;Command 11
1F00 FFFF 00C2 00C3 ;Command 12
0000 FFFF FFFF FFFF ;Command 13
FF04 FFFF FFFF FFFF ;Command 14
FF00 FFFF FFFF FFFF ;Command 15
FF00 FFFF FFFF FFFF ;Command 16
FF00 FFFF FFFF FFFF ;Command 17
FF07 FFFF FFFF 00B4 ;Command 18
0000 FFFF FFFF FFFF ;Command 19
0000 FFFF FFFF FFFF ;Command 20
FF06 FFFF FFFF FFFF ;Command 21
FF08 FFFF FFFF FFFF ;Command 22
FF09 FFFF FFFF FFFF ;Command 23
FF0A FFFF FFFF FFFF ;Command 24
1700 FFFF 00B4 00B4 ;Command 25
FF07 FFFF 00B5 00B5 ;Command 26
1700 FFFF 00B7 00B7 ;Command 27
9700 FFFF 00B6 00B6 ;Command 28
FFFF FFFF FFFF FFFF ;Command 29
FFFF FFFF FFFF FFFF ;Command 30


Hmmm......

Micky

  • *
  • Posts: 300
    • View Profile
Kernel.bin: With a Vengence!
« Reply #3 on: 2005-01-01 23:02:10 »
Quote from: Qhimm
Having mapped out some of the more game-oriented field script commands and their implementations, I think I have enough basis to summarize the success of FF7 in two words: "pure luck". The scripting system consists of equal parts ingenious design and poor construction. It's like several different people wrote differents parts of the script and rarely talked to each other.

Umm. Have you worked in software engineering? Have you worked in videogame software engineering? I'm not surprised.
First of all, FF7 was made when the industry made the transition from SNES to PSX, a lot of programmers probably just started moving from Assembler to C at that point. And you don't believe what a difference in skill you have even in professional teams.

L. Spiro

  • *
  • Posts: 797
    • View Profile
    • http://www.memoryhacking.com/index.php
Kernel.bin: With a Vengence!
« Reply #4 on: 2005-01-02 08:11:29 »
As I have posted before, the second byte of each command data set is the attack target which works in exactly the same way as the item target and spell target.

The names for the commands are:

Code: [Select]
01: Left
02: Attack
03: Magic
04: Summon
05: Item
06: Steal
07: Sense
08: Coin
09: Throw
10: Morph
11: D.blow
12: Manip.
13: Mime
14: E.Skill
15: All:
16: 4x:
17:
18: Mug
19: Change
20: Defend
21: Limit
22: W-Magic
23: W-Sum.
24: W-Item
25: Slash-All
26: 2x-Cut
27: Flash
28: 4x-Cut
29:
30:




In RAM, the data for each command is exactly as shown in the files, so editing the data is very simple.
No need to change the file and then reboot the game; just change the data in RAM directly.

However, the only change in game play I have ever been able to muster is by setting the entire set of data to 0.
By doing this, my team could only attack themselves, even with limits and summons.
Even attacks that normally attack all of a team would only attack the single character who cast the attack.

I have tried to make every command the as every other command (I changed them all to Steal) and nothing happened.
So I don’t know the significance to the other bytes.


L. Spiro

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Kernel.bin: With a Vengence!
« Reply #5 on: 2005-01-02 12:12:36 »
That's why editing PSX save states rocks so much. I can so a rearch for this memory block on my hard drive, change, load, and execute. If it smashes, edit back, reload and execute ALL WITHOUT RESETTING THE GAME. ^_^

Emulation rocks

Code: [Select]

FF 00 FF FF FF FF FF FF ;Left
FF 07 FF FF FF FF FF FF ;Attack
FF 01 FF FF FF FF FF FF ;Magic
FF 02 FF FF FF FF FF FF ;Summon
FF 03 FF FF FF FF FF FF ;Item
FF 07 FF FF 00 B8 00 B9 ;Steal
1F 00 FF FF 00 BC 00 BD ;Sense
17 0B FF FF 00 C5 00 C5 ;Coin
0B 05 FF FF 00 C4 00 C4 ;Throw
1F 00 FF FF 00 BE 00 BF ;Morph
1F 00 FF FF 00 C0 00 C1 ;D.Blow
1F 00 FF FF 00 C2 00 C3 ;Manip
00 00 FF FF FF FF FF FF ;Mime
FF 04 FF FF FF FF FF FF ;E.Skill
FF 00 FF FF FF FF FF FF ;All
FF 00 FF FF FF FF FF FF ;4x
FF 00 FF FF FF FF FF FF ;
FF 07 FF FF FF FF 00 B4 ;Mug
00 00 FF FF FF FF FF FF ;Change
00 00 FF FF FF FF FF FF ;Defend
FF 06 FF FF FF FF FF FF ;Limit
FF 08 FF FF FF FF FF FF ;W-Magic
FF 09 FF FF FF FF FF FF ;W-Summ.
FF 0A FF FF FF FF FF FF ;W-Item
17 00 FF FF 00 B4 00 B4 ;Slash-All
FF 07 FF FF 00 B5 00 B5 ;2x-Cut
17 00 FF FF 00 B7 00 B7 ;Flash
97 00 FF FF 00 B6 00 B6 ;4x-Cut
FF FF FF FF FF FF FF FF ;
FF FF FF FF FF FF FF FF ;


That looks a little better

Goku7

  • *
  • Posts: 1301
    • View Profile
Kernel.bin: With a Vengence!
« Reply #6 on: 2005-01-05 00:38:08 »
It looks like the 17th, 29th, and 30th memory addresses have no commands associated with them, based on the list shown in Halkan's post.  I can sort of understand why the 29th and 30th dont' have anything, but why is the 17th blank? -_-

That doesn't make any sense, at least to me.....