Author Topic: Sephiroth patch KERNEL.BIN  (Read 15437 times)

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Sephiroth patch KERNEL.BIN
« on: 2008-08-17 16:16:44 »
I want to make a small upgrade to Sephiroth patch. I want to have the original Sephiroth the same as Squaresoft created him with that difference that he would be controllable (and still immortal) and to have his stats and Masamune and his stat growth not Cloud's stats, Cloud's weapons and Cloud's stat growth. So I want to swap character data between Cloud and Sephiroth. I know that this data is stored in KERNEL.BIN. So I unpacked KERNEL.BIN using ff7dec.exe and I got 27 files (KERNEL.BIN0 - KERNEL.BIN26). I know that the initialization data and character data is located in section 4 (KERNEL.BIN3) and the character growing information are stored in section 3 (KERNEL.BIN2). I need to swap data between Cloud and Sephiroth in that two sections to have Ulitimate Sephiroth patch. As I wrote before I need to swap all the data between Cloud and Sephiroth in that two sections and change one thing (make Sephiroth controllable and still immortal). I know that this two sections must be opened and edited using hex editor. I have Hex Editor Neo. I opened this two sections using it and I saw a lot of numbers and letters which I don't understand at all. I don't have an idea what to do next. I don't know what to change inside these two sections. So my question is: CAN SOMEONE HELP ME? PLEASE!

RED X

  • *
  • Posts: 27
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #1 on: 2008-08-17 23:49:35 »
Yes, you can have an immortal but controlable Sephiroth. I did it already and it works. All you have to do is altering Cloud's Ai at 0x61C by changing hexdecimal from 1800 to 1400 (If you change to B204, then Cloud will be uncontrolable). After that, change Sephiroth's Ai (unfortunately I don't remember, so I have to recheck) by changing hexdecimal from B204 to C204. That's it, now you will have an immortal controlable Cloud. If you want to swap Cloud to Sephiroth, you can change it by changing some hexdecimal in ff7.exe.

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #2 on: 2008-08-18 18:32:22 »
What association does have ff7.exe with all this?

RED X

  • *
  • Posts: 27
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #3 on: 2008-08-19 06:09:19 »
There're two ways of how the characters can be swapped. First is by replacing character files in Char.lgp with the character files that you want to swap. Meaning that you have to extract Char.lgp file with LGP.tools first and you need to identify each of character files in Char.lgp. The other way is by changing some hexdecimal in ff7.exe with any hex tools. I personally prefer the second alternative as it's so very easy and quick.

Destiny

  • *
  • Posts: 149
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #4 on: 2008-08-20 13:59:10 »
There're two ways of how the characters can be swapped. First is by replacing character files in Char.lgp with the character files that you want to swap. Meaning that you have to extract Char.lgp file with LGP.tools first and you need to identify each of character files in Char.lgp. The other way is by changing some hexdecimal in ff7.exe with any hex tools. I personally prefer the second alternative as it's so very easy and quick.

That is for battle.lgp not char.lgp ^^

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #5 on: 2008-08-20 16:45:54 »
Well, I think that this is a kind of misunderstand. I'm not talking about swaping Cloud's and Sephiroth's battle model or field model which is in battle.lgp or in character.lgp. I don't care about that. I'm talking about swaping their stats, growth, equipment and all other base things that all are in KERNEL.BIN. So I don't see a point in editing ff7.exe or battle.lgp or char.lgp. I think that the only one that have to be edited is KERNEL.BIN. Am I right or am I wrong? Or maybe I don't understand something then please tell me.

RED X

  • *
  • Posts: 27
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #6 on: 2008-08-20 23:19:50 »
Sorry, Destiny was right :-P. But I did manage to have an Immortal Cloud by changing some hexdecimal in Kernel.bin2. Thanks to Destiny for his advice. :-D

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #7 on: 2009-02-05 21:51:06 »
It's been a few months but I tried again and I almost did that what I wanted to be done but still have some problems. I managed to swap them (Cloud and Sephiroth) by editing only KERNEL.BIN and I have the immortality but I have problem with leveling up. Expierience and levels gets the old Sephiroth now Cloud instead of my new main character. At the screen with EXP and AP there is shown his level, his EXP and his EXP to next and he gains EXP and levels. My main character stays with the same EXP after each fight. I'm not sure what I have to edit to normalize it. I edited mostly section 4 of KERNEL.BIN. I swapped their stats and IDs. In section 3 of KERNEL.BIN I've set the immortality to my new Sephiroth. Maybe I need to change something more of character AI data? But I'm not sure where it begins and which parts belongs to Sephiroth and which to Cloud? Or maybe I need to edit something other? And where is stored Sephiroth stat curve? I swaped Cloud's and Vincent's stat curves because I thought Vincent has Sephiroth's stat curve but I'm not sure of that cause Sephiroth must have lower values (which as I know equals better stat growth) cause he has much better stat growth. Well I'm not sure if I'm doing everything OK so if some could help I would appricite that. Thanks guys :-).

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #8 on: 2009-02-06 02:40:07 »
Ah HA! A KERNEL.BIN question. I'd be only too happy to help.

Within the KERNEL.BIN, the only data for Sephiroth in the third section are his two scripts. The Init and Main. The Init basically just tells the Main to take control of him. Control can be regained by either NULLing out his INIT pointer (at 0xACE - 0xACF) or NULLing his script pointer (0x630 - 0x631) all together. Sephiroth's stat/HP/MP/Exp curves are probably shared with Cloud. TFergusson believes that Sephiroth's Exp curve is shared by Cloud. Whether or not this is true can only be determined if Sephiroth can level up. Since they can't even get exp during the flashback, then their curves aren't important.

Quote
I edited mostly section 4 of KERNEL.BIN. I swapped their stats and IDs.
Swapping IDs (the first byte of character data) doesn't seem to do a whole lot. Instead, try swapping their AI pointers in the third KERNEL.BIN section.

Sephiroth's Init Script (0x0AEE) does this:

BattleVar(Self).CharVar(Flag(0:4)) <- 1 (Activate Main Script)
BattleVar(Self).CharVar(Flag(1:1)) <- 1 (Not sure)
BattleVar(Self).CharVar(Flag(1:0)) <- 1 (Not sure)
BattleVar(Self).CharVar(Flag(1:2)) <- 1 (Not sure)

Not all these flags are known. I'm basing a lot of my info on Akari's findings of battle addresses, but I'm going to guess that one of those Flag(1.x)s sets the invulnerability and one cancels the victory rewards. Try deactivating one at a time to see what happens.
The three bytes in the third KERNEL.BIN section you'll want to try changing are:
0x0AFC, 0x0B06, 0x0B10 to 28h, 29h, or 2Ah. Have one repeat and leave one out and see which one gives you a victory screen.
You can also probably safely point two characters to the same script if you'd like. So changing 0x61E and 0x61F to B2h and 04h respectively will point both Sephiroth and Cloud to the same scripts. You could also use the 75h code in Cloud's INIT script to link his with Sephiroth's scripts (60 0A 75 73; probably safer) then just re-point the INIT script to after the point where it says "Activate Main Script" (change 0xACE from 20h to 2Ah).

There's a lot of info here, so if you want some clear-er directions on my suggestions we'll try again. :)

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #9 on: 2009-02-06 08:48:27 »
I'm getting victory screen but the EXP gains the old Sephiroth.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #10 on: 2009-02-06 12:14:48 »
I'm getting victory screen but the EXP gains the old Sephiroth.
That might be because you swapped the Character IDs. The game uses that value for some things and not others, but I'm pretty sure it's all battle-related. Maybe since you switched Cloud's/Sephiroth's Character IDs and the old Sephiroth's ID is now active and the old Cloud is inactive, the Exp is going to character ID 0Ah (Sephiroth's old ID) and not to 00h (your Sephiroth's ID, I suppose). Restore the original Character IDs (just the IDs) and try that.

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #11 on: 2009-02-14 19:00:49 »
OK. I restored the original IDs and edited some other things in KERNEL.BIN. My new main character is getting really close to be the same like the original Sephiroth except that he is controllable (like I wanted and immortal of course) but... But he is still missing two things:
1. Battle growth, stat, HP and MP gaining, EXP seems OK. He is still getting lower stats, lower HP and MP at level up than original Sephiroth. Maybe stat curves for Sephiroth are other (higher) than Cloud's. EXP curve seems OK. I'm curious what value at offset 0x000A in section 3 of KERNEL.BIN stands for? In wiki is written that this is starting level as far as as know starting stats and levels are in section 4. Can someone explain it to me? :?
2. Sources! Sources can be used on original Sephiroth but they don't raise his stats. I want the same effect at my new main hero.
Can someone help me with that? Thanks guys :-)

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #12 on: 2009-02-14 20:08:43 »
OK. I restored the original IDs and edited some other things in KERNEL.BIN. My new main character is getting really close to be the same like the original Sephiroth except that he is controllable (like I wanted and immortal of course) but... But he is still missing two things:
1. Battle growth, stat, HP and MP gaining, EXP seems OK. He is still getting lower stats, lower HP and MP at level up than original Sephiroth. Maybe stat curves for Sephiroth are other (higher) than Cloud's. EXP curve seems OK. I'm curious what value at offset 0x000A in section 3 of KERNEL.BIN stands for? In wiki is written that this is starting level as far as as know starting stats and levels are in section 4. Can someone explain it to me? :?

Sephiroth is not meant to gain levels at all. The Sephiroth in the flashback doesn't even gain exp. Oh well.
What's marked as "Starting Level" is really what increase they get when the join the party. They get enough experience to raise their level to the active parties' average level plus this number/2.

2. Sources! Sources can be used on original Sephiroth but they don't raise his stats. I want the same effect at my new main hero.
Can someone help me with that? Thanks guys :-)

This, I believe, still goes back to the Character IDs. I'm not sure you can do anything about this.

The Great Sephiroth

  • *
  • Posts: 42
  • I have been chosen to be the leader of this Planet
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #13 on: 2009-02-14 21:49:59 »
Sephiroth is not meant to gain levels at all. The Sephiroth in the flashback doesn't even gain exp. Oh well.
I disagree. Sephiroth is meant to gaining levels. The Sephiroth and Young Cloud doesn't gain EXP in flashback but only in the flashback because as all we know flashback is some sort of "special". In Flashback the victory screen is disabled so none of the characters can get EXP. To prove that Sephiroth is meant to gaining levels just put him in your party outside of flashback (using for example Jenova) and try leveling up. Fight your way up to level 99 and you'll see that I was right. Try this a few times and you will see that his stat growth isn't random. He will have high stat growth but there won't be any big diffrences. He always gets up to the same HP. He must have his own stat curves. Please help me find them. Do you know where are they stored? What value he should have at offset 0x000A in section 3 of KERNEL.BIN? Can you tell me anything of these?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #14 on: 2009-02-15 20:43:08 »
Sephiroth is not meant to gain levels at all. The Sephiroth in the flashback doesn't even gain exp. Oh well.
I disagree. Sephiroth is meant to gaining levels. The Sephiroth and Young Cloud doesn't gain EXP in flashback but only in the flashback because as all we know flashback is some sort of "special". In Flashback the victory screen is disabled so none of the characters can get EXP. To prove that Sephiroth is meant to gaining levels just put him in your party outside of flashback (using for example Jenova) and try leveling up. Fight your way up to level 99 and you'll see that I was right. Try this a few times and you will see that his stat growth isn't random. He will have high stat growth but there won't be any big diffrences. He always gets up to the same HP. He must have his own stat curves. Please help me find them. Do you know where are they stored? What value he should have at offset 0x000A in section 3 of KERNEL.BIN? Can you tell me anything of these?

OK, this is what I can tell you. I know that Sephiroth CAN gain levels outside the flashback, I never said he couldn't. BUT since he's not MEANT to then his information isn't coded into the third KERNEL.BIN section. According to T Fergusson, he shares stat curves with Cloud (non-flashback). Something about Sephiroth's script ends the Flashback battles without rewards unless there's some over-arching script that does that (possible).
Basically, Sephiroth's and Young Cloud's Growth information are not in KERNEL.BIN3 (Young Cloud's curves themselves aren't even there). Since they don't gain levels normally it'll be hard to trace where they actually are stored.
So in a smaller nut-shell, I don't know the answer to your question except I can tell you that the solution is NOT in the KERNEL.BIN.

RED X

  • *
  • Posts: 27
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #15 on: 2009-02-18 23:03:55 »
Hi there The Great Sephiroth

Can u please tell me what are the offset of Sephiroth and Cloud Ai because i don't understand the explaination from NTITC1? :?

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Sephiroth patch KERNEL.BIN
« Reply #16 on: 2009-02-20 12:33:29 »
Actually Sephiroth use Vincent's initial stats and curves. He'll turn into Vincent sometime after the flashback. Same thing with young Cloud. He'll turn into Cait Sith. Well I'm not sure about the curves, but initial for initial stats this is true. And since that is true they may share the curves as well.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #17 on: 2009-02-20 13:28:32 »
Actually Sephiroth use Vincent's initial stats and curves. He'll turn into Vincent sometime after the flashback. Same thing with young Cloud. He'll turn into Cait Sith. Well I'm not sure about the curves, but initial for initial stats this is true. And since that is true they may share the curves as well.

I can understand why you think this, but unfortunately this is not exactly true. The starting stats of Vincent and Cait Sith are not the same as Sephiroth's and Young Cloud's. At some point after the flashback and before Vincent/Cait Sith join the party, their stats are written in to the same memory location that Sephiroth's/Young Cloud's were.
I'm still not convinced that there ARE curves for Sephiroth and Young Cloud because they never gain exp during the flashback. (This is probably to prevent nit-pickers from leveling Young Cloud up to, for example, level 15 and then asking "Why did he start the game at level 7?!")


PS:
BattleVar(Self).CharVar(Flag(0:4)) <- 1 (Activate Main Script)

I'm not so sure that this is what this flag does anymore. It might also be a "force turn" flag since Sephiroth always strikes first in the flashback.

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Sephiroth patch KERNEL.BIN
« Reply #18 on: 2009-02-21 03:52:56 »
I thought the field script changed the battle models from YCloud -> Cait Sith; Seph -> Vincent (+ stat, level, etc) after the flashback. You're saying Vincent and Cait's initialization isn't stored in the 3rd kernel? I was under the impression that all init data was directly loaded from this section in new game just as a savemap. Perhaps I'm wrong. Or perhaps I misunderstood? :P

Field script could prevent any gain of experience during the flashback by battle opcodes. It's quite easy to normalize these battles to make 'em gain experience. The flashback battles has an additional battle upcode to adjust it to Sephiroth. Why? I don't know. I had to change these upcodes to fully enjoy the Seph battles in the flashback (in my mod it's still is buggy in this part, I know). It seems to have something to do with the battle model's animation, in other words, not something specifically to do with Sephiroth.

However, NFITC1, you seem to have the upper hand here since you've been researching stuff more that I have. Concerning the kernel etc.

EDIT: oh and Seph doesn't always strike 1st in the flashback. Many times I've gotten Cloud to do a command before Seph. If this is what you meant?
« Last Edit: 2009-02-21 03:56:16 by gjoerulv »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #19 on: 2009-02-21 17:17:37 »
I thought the field script changed the battle models from YCloud -> Cait Sith; Seph -> Vincent (+ stat, level, etc) after the flashback. You're saying Vincent and Cait's initialization isn't stored in the 3rd kernel? I was under the impression that all init data was directly loaded from this section in new game just as a savemap. Perhaps I'm wrong. Or perhaps I misunderstood? :P

You did, but you didn't. Cait Sith's and Vincent's starting stats are missing from the KERNEL.BIN. The only thing in the kernel.3 is the initial save game data, which has Young Cloud's and Sephiroth's data where Cait Sith's and Vincent's will later be placed. Somewhere CS's and V's starting stats must exist, but I don't know where.

Field script could prevent any gain of experience during the flashback by battle opcodes. It's quite easy to normalize these battles to make 'em gain experience. The flashback battles has an additional battle upcode to adjust it to Sephiroth. Why? I don't know. I had to change these upcodes to fully enjoy the Seph battles in the flashback (in my mod it's still is buggy in this part, I know). It seems to have something to do with the battle model's animation, in other words, not something specifically to do with Sephiroth.

I've never done anything with field scripts so I couldn't say. I've been looking in the scene.bin for them, but I don't think they're there. A reference to them might be there though, since there are so few actual field scripts compared to the number of battles there are.

EDIT: oh and Seph doesn't always strike 1st in the flashback. Many times I've gotten Cloud to do a command before Seph. If this is what you meant?

It was more of a blind guess anyway. :)

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #20 on: 2009-02-21 18:23:57 »
Field script could prevent any gain of experience during the flashback by battle opcodes. It's quite easy to normalize these battles to make 'em gain experience. The flashback battles has an additional battle upcode to adjust it to Sephiroth. Why? I don't know. I had to change these upcodes to fully enjoy the Seph battles in the flashback (in my mod it's still is buggy in this part, I know). It seems to have something to do with the battle model's animation, in other words, not something specifically to do with Sephiroth.

I've never done anything with field scripts so I couldn't say. I've been looking in the scene.bin for them, but I don't think they're there. A reference to them might be there though, since there are so few actual field scripts compared to the number of battles there are.

I've taken a little look at a few of the field files for the flashback and where battles are possible they have the script:

Code: [Select]
IFSW (20,00,00,81,01,03,06)
BTLMD (80,00)
BTLTB (01)

IIRC (from work I've done on getting three fighters into the battle arena fights) the opcode BTLMD does the same thing as the first two bytes of BTMD2, so 80, 00 would mean "no AP/EXP/Gil/items screens and normal victory celebrations at the end of battle". I presume that the IFSW opcode finds out whether Sephiroth is there, so hopefully this might explain things.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Sephiroth patch KERNEL.BIN
« Reply #21 on: 2009-02-21 21:37:23 »
IFSW - IF Sephiroth Wins  :D

I doubt that's it. Anyway, I haven't been looking at those opcodes so I'm not versed in them at all. I understand the battle scripts and that's about it. :) It would be nice to know where general battle scripts are and how the scenes reference them.

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #22 on: 2009-02-22 00:54:17 »
Unfortunately it means if (signed word):cry:

There actually seems to be quite a lot of info for this kind of thing in the wiki. If only I could understand it... :?

gjoerulv

  • *
  • Posts: 1225
  • me
    • View Profile
    • My Youtube
Re: Sephiroth patch KERNEL.BIN
« Reply #23 on: 2009-02-22 03:28:48 »
Damn, should wish I had noted down my findings when experimenting with field scripts.  :x

Well...

The IFSW opcode makes a jump in the script. It's used as a form of flow control. The one you found probably makes a jump if (or if not) Sephiroth is in the party.

But you see that unknown one furthest down in BTMD2. When I checked (or unchecked, don't remember) things happened to Sephiroth's animation or the game crashed. I got this from fighting the 1st dragon and the new boss battle. In the dragon battle the opcode is: BTMD2 (A0,00,01,00). I can't remember if I did anything with this before the boss battle though, but as you can see the parameters in the opcode fits the dragon battle like a charm. For this reason I think the 1st bit in the 3rd byte needs to be checked in the flashback battles, 'cause if not, the game crashes.

Kudistos Megistos

  • Banned
  • *
  • Posts: 3929
    • View Profile
Re: Sephiroth patch KERNEL.BIN
« Reply #24 on: 2009-02-22 10:08:17 »
Let's see...the first bytes of that tells the game not to go to the AP/EXP/Gil/items received screens and not to play the victory music and the third one is unknown. Perhaps that is what stops the flashback battles (or at least this one) from crashing? I wonder if the fight would work with something like 00,00,01,00.