Author Topic: [FF7PSX NTSC-U] Disc Extension Patch (v1.0)  (Read 41540 times)

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
[FF7PSX NTSC-U] Disc Extension Patch (v1.0)
« on: 2011-03-18 00:40:23 »
FF7 Disc Extension Patch (NTSC)
Version 1.0

Expands the SCENE.BIN and KERNEL.BIN files for heavier modding

Tired of working within the filesize constraints of FF7 PSX? This Disc Extension Patch expands the KERNEL.BIN to 64kb and the SCENE.BIN to a whopping 2mb. Just apply the PPF patch to an NTSC Disc One ISO and you'll never need worry about filesizes again! Whether you need a bigger KERNEL for a translation patch, or you want to extend the SCENE's AI, the Disc Extension Patch should be part of every modder's arsenal.

This mod currently supports only the NTSC version

Download link: http://www.mediafire.com/?r4h6vfwjw10nmq4

Installing and Using the Patch

The patch is a simple PPF file, with instructions bundled in the download. The patch moves the files in question to the MOVIE directory, right at the end of the disc. You can then use something like CDMage or cdprog to import your modified files into the ISO.

Please be aware that this patch is mostly untested. Whilst I can confirm success playing ISOs with KERNELs and SCENEs larger than allowed in vanilla FF7, I cannot guarantee the exact max sizes of either file.
« Last Edit: 2014-07-18 18:36:39 by Covarr »

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #1 on: 2011-03-18 00:48:01 »
May be useful for LostWingx with his new mod and me too with AVgr :D

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #2 on: 2011-03-18 00:57:46 »
Well, the tools to do this have been about for some time. But they're a bit fiddly to use, and I think most new modders have enough to worry about getting to grips with Wallmarket etc., never mind messing about injecting sectors and what have you. So it seemed a good idea to just create an easy-to-use PPF that anyone can apply to their discs, and carry on without worry.

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #3 on: 2011-03-18 01:57:05 »
My God...this is incredible.  The capability to do so has been around?  Well thanks for this, you don't have to explain, but is there a simple explanation as to how this is possible? (Lack of Technical Knowledge really shows here, I don't even know the reason why they had to be limited in the first place.)  I will download this immediately and make my way over to the forries.

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #4 on: 2011-03-18 02:18:47 »
My God...this is incredible.  The capability to do so has been around?  Well thanks for this, you don't have to explain, but is there a simple explanation as to how this is possible?

Sure. I used a tool to edit the filesystem and assign specified sectors to two new files called 'KERNEL.BIN' and 'SCENE.BIN', placed at the end of the disc, in the MOVIES folder. I de-allocated the sectors used by the original files (the data still exists on those sectors, it's just there's no 'files' there). Then I imported the sectors from the original files and updated the YAMADA.BIN, a file lookup table that tells FF7 where certain files are and how large they are, using just a simple hex editor.

All I had to do then was use a PPF patcher.

Honestly, this is no technical feat. I didn't do this to impress anyone - I just knew the process was quite fiddly for new timers, and wanted to hand over a simple PPF patch so that no-one needn't bother with the messy details unless they were really interested.

Armorvil

  • *
  • Posts: 621
  • Working on : FFVII Total Grudge
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #5 on: 2011-03-18 09:22:29 »
This is grand. I was worried I'd have to create three different scene.bin for each disc, for my mod... ...Not anymore :)

Thanks a lot for this great patch, Bosola  :D

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #6 on: 2011-03-18 15:01:37 »
The best thing about an extended SCENE and KERNEL is that you can use long AI scripts to introduce new mechanics without breaking either file.

Let's say you wanted a 'Disease status', a poison status that prevents healing. Disease would involve an AI script on each character that sets NullRestorative on or off according to the Poison status, but can make exceptions for healing spells that remove poison. Implementing this would mean applying bulky AI scripts on each character that would exceed the KERNEL's file limits. But with an extended file, that's no longer an issue.

Likewise, you might want to use an autolevel script to make enemies mirror party levels, a la FF8 (I think ff7rules had a similar patch). These scripts are long, and you normally need compromise by cutting certain enemies. With a bigger SCENE.BIN, however...

Finally, if you need to add extra assets to the disc for whatever reason, this patch actually gives you MORE space than you would have in vanilla FF7. This is because I remove some chunky padding files that are actually larger than the new KERNEL and SCENE combined.
« Last Edit: 2011-03-18 15:04:26 by Bosola »

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #7 on: 2011-03-19 15:58:49 »
I think I get it, but just for some further clarification...

So this is as simple as using the ppf patch and pretending that the kernel and scene have always been in the MOVIES folder?  Do I just ignore the kernel in INIT and the scene in BATTLE? Thanks Bosola.

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #8 on: 2011-03-19 17:33:00 »
Apply the PPF patch, and there will *only* be a KERNEL and SCENE in the MOVIES folder, right at the end of the disc. Use CDMage beta to import into these files, choosing to pad your imports with zeroes if they're too short (they almost always will be). Then just play as you would otherwise.

You won't find the old files in INIT or BATTLE, although technically their data is still present in the sectors they occupied.

lasyan3

  • *
  • Posts: 76
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #9 on: 2011-03-22 07:50:25 »
So, if my understanding is right, you basically moved the 2 files in the end of the iso, nothing more ?
I think this will not work for big kernel.bin files, because there is still the problem of the size in the RAM !
I had the problem : the kernel.bin is loaded in memory, in a "place" that has a fixed size (approximately 24400 bytes). So, if the kernel.bin is bigger than this space, it will erase some other content of the game, which will crash.
One way to bypass that would be to find where the information about the position and/or size of the place in RAM is located, and try to move it. But I think it is more difficult than moving a file on the disk, because, for example, if there is an empty space in the RAM while you're in a field screen, it doesn't mean this space is not used while playing a FMV, or during a fight.
« Last Edit: 2011-03-22 08:54:05 by lasyan3 »

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #10 on: 2011-03-22 20:02:05 »
Ah. After doing a little research, I think I understand now. FF7 doesn't extract data from the KERNEL.BIN on the fly; it loads the whole thing into a buffer, then sets up pointers to it.

I don't know about the PSX, but a little research indicates that the PC version uses a 27,647 byte buffer.

I can't verify if this is the case with PSX; I don't have a PSX memory map to hand. I tried booting a PSX copy with a KERNEL dummied out with 0x80 characters and looking at a save state taken at the point of crashing. I hoped to see a whole KERNEL. I did see long strings of 0x80s, but split across the memory map into little chunks. I guess it must be more involved than just copying the file then processing it.

As an interesting piece of trivia, I was able to load and start playing a game with a KERNEL full of 0xFFs. Crashed whenever I fought / opened any submenus, but hey. What surprised me is that on PSP, custom kernels break the whole of the main menu, but that little test suggests no kernel data is actually used until one of the submenus are opened. I don't know if that tidbit gives anyone working on PSP any clues, but I thought I'd share it.

I don't see much space in the savestate for a larger kernel.

Another aside. I'm guessing that even on the PC version, where altering memory management is at least possible, KERNELs will still be limited at 65,535 bytes because the pointers are probably 2-byte words (and can't go over 0xFFFF).
« Last Edit: 2011-03-22 20:04:33 by Bosola »

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #11 on: 2011-03-23 00:05:57 »
So if we are working with the PSX then this is exceed max file size at own risk?  I haven't converted Revisited to the extension yet, and I won't if there is a chance it will produce complications.  I'm not changing AI for enemies so I don't need extended scene.bin space, and the amount my kernel.bin would exceed the size limit is minimal.  Thanks for all your work on this though

lasyan3

  • *
  • Posts: 76
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #12 on: 2011-03-23 15:17:09 »
FF7 doesn't extract data from the KERNEL.BIN on the fly; it loads the whole thing into a buffer, then sets up pointers to it.
I don't know about the PSX, but a little research indicates that the PC version uses a 27,647 byte buffer.
I'm almost sure it's the same for PSX.
So if we are working with the PSX then this is exceed max file size at own risk?
For what we know, as long as your kernel.bin is less than 27647 bytes, it will work. But if it is bigger, then you will have "complications".

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #13 on: 2011-03-23 15:42:40 »
Ah. After doing a little research, I think I understand now. FF7 doesn't extract data from the KERNEL.BIN on the fly; it loads the whole thing into a buffer, then sets up pointers to it.

I don't know about the PSX, but a little research indicates that the PC version uses a 27,647 byte buffer.

You're thinking about the kernel2.bin, which isn't important to this project.
The lengths of the first 9 sections of the KERNEL.BIN (the actual data) is fixed (or should be anyway). It's the text inside the KERNEL.BIN that is important to the PSX and can grow/shrink with editing. It does seem like all the sections would be uncompressed in the RAM at any given time, however.

Dark_Ansem

  • *
  • Posts: 320
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #14 on: 2011-03-31 08:22:37 »
this means we should be able to add, say, new player attacks without the need to actually delete older ones?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #15 on: 2011-03-31 12:19:08 »
The only way you could "add" an attack is to put data into one of the blank spots. That would change the compression of the section a little and possibly make it larger.

btw, the KERNEL.BIN originally can be 22K in size, not 27.

Dark_Ansem

  • *
  • Posts: 320
    • View Profile
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #16 on: 2011-04-03 11:39:37 »
yes, I mean, in a blank spot that this kernel extension would free up.

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (W.I.P) - v0.1
« Reply #17 on: 2011-04-03 12:32:57 »
No, one of the free attack slots that already exists in the KERNEL.

The extension will only really offer longer text strings and AI scripts. New attacks will sit in currently existing but unused attack records, such as the slots between spells and enemy skills. Unless this data is normally compressed (ask NFITC1), these new attacks won't actually take up any more space.

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (NTSC) - v1.0
« Reply #18 on: 2011-07-02 22:23:16 »
I have released a full version of the mod, with support for discs two and three. I've updated the link in the first post accordingly.

Raziel80

  • *
  • Posts: 119
    • View Profile
Re: FF7 Disc Extension Patch (NTSC) - v1.0
« Reply #19 on: 2012-06-26 17:40:57 »
is it possible that this patch can be made ​​for english(UK) pal version?

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
Re: FF7 Disc Extension Patch (NTSC) - v1.0
« Reply #20 on: 2012-07-08 12:14:36 »
Yeah, if enough people would find it useful. Would you?

Raziel80

  • *
  • Posts: 119
    • View Profile
Re: FF7 Disc Extension Patch (NTSC) - v1.0
« Reply #21 on: 2012-07-22 18:31:50 »
thanks for answer. Think, I could do without pal version. But, anyway it's a great patch. Thank you for ntsc patch. Sorry for my english.

Roden

  • *
  • Posts: 125
    • View Profile
Re: [FF7PSX NTSC-U] Disc Extension Patch (v1.0)
« Reply #22 on: 2014-10-29 16:57:37 »
After looking at Bosola's great notes and some trial and error, I've replicated the patch for other PSX versions (I wanted to patch the Japanese versions, I only patched the kernel myself, but don't see why it wouldn't work for scene.bin as well) I wrote this quite quickly but should be a good guideline..

1. Open Bosola's US patched ISO in CDprog and check the movie dir's LBA and size for KERNEL.BIN and SCENE.BIN (this saves some work doing it yourself)
2. Note that null1min.dat has been deleted in the US Patched ISO (this file is for making the game run on really old PlayStations).
3. Open Japanese ISO (or another version, I'll just call it the JP ISO from now on) and delete null1min.dat from the movie directory with CDProg. Using CDProg again create new file called KERNEL.BIN in the movie directory with the same LBA and size values as the US patch's KERNEL.BIN in the movie dir (if your also applying SCENE.BIN, do the same for that file).
4. Extract yamada.bin from US patched ISO and open in hex editor (you will want to check the values).
5. Extract yamada.bin from JP ISO and copy down the values for the KERNEL.BIN and SCENE.BIN according to the directions in this thread (you will be copying them from the values of the US's yamada.bin - don't copy all of them, obviously - just the scene.bin and/or Kernel.bin):  http://forums.qhimm.com/index.php?topic=9737.0
6. Using CDMage import your modified yamada.bin into JP ISO, followed by your OWN (or JP original) kernel.bin into the new kernel space on your movie directory (if its smaller than 64kb, it will just be padded and still work).
7. And your done.. at least for disc 1.
8. For discs 2 and 3, you will probably want to check the values from the US patched versions 2 and 3 (those versions may even have two NULL files, see if they are deleted in US patch, I haven't checked it myself).

For testing I used modified kernel.bin to see if it was successful (battle message), but if you don't have one - just opening your equip menu and getting into a few battles should be enough to test it. If CDmage says you can't import over the kernel.bin in the movie dir you have done something wrong and need to start again. If the game doesn't boot but works absolutely fine via save states you've also done something wrong but getting close :P

One thing I'm not sure about is my original KERNEL.BIN still exists in the Init directory. Whether you delete that or not is up to you I think, I don't think it can harm anything?

Have you added much data to your KERNEL Bosola, how does it hold up?

I took a look at applying the magic defense bug also, but seems a lot a more work with armor pointers and stuff..
« Last Edit: 2014-10-29 16:59:11 by Roden »

resinate

  • *
  • Posts: 96
    • View Profile
Re: [FF7PSX NTSC-U] Disc Extension Patch (v1.0)
« Reply #23 on: 2017-11-26 21:09:49 »
dont wanna sound like a dick but, whats point of this. when i use the editors and save they revert back to default sizes.