Author Topic: Looking for coder to help with FFVI for PC  (Read 828 times)

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Looking for coder to help with FFVI for PC
« on: 2018-08-01 13:45:17 »
Hey, I'm working on a mod called Final Fantasy VI - A World Reborn which can be found on the community modding index on Steam.

Video: https://www.youtube.com/watch?v=cnVVyqb14qs&t=53s

The mod is on the cusp of release but we've run into an issue that is preventing us from releasing the mod. With Nyxo's tools, we were able to edit all of the assets outside of the spell animations. However, we are unable to edit 3 of the espers because their graphics are in the spell animations folder titled FLB. From what I can gather, it wouldn't be hard to extract the FLB files, the difficulty arises when trying to put those files back into the game. Nyxo does not have time available to finish his tools, but has given us access to a partial guide that may be able to help someone construct a tool needed to access the FLB files.

If anyone is interested or can point us in the right direction, you can comment here or message/add me on Steam (kvg88). Any help at this point would be greatly appreciated. Thank you for your time!

Maki

  • Software hacker
  • Freak
  • *
  • Posts: 532
  • Karma: 101
  • Paranoid
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #1 on: 2018-08-01 15:36:24 »
Please provide any information you have and a sample file.

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #2 on: 2018-08-01 18:09:36 »
Please provide any information you have and a sample file.

Here's the sample file from the FLB folder. The .gz files in this folder contain FLB files, which I think stands for Format Library, which I think means that it is proprietary software from SE that would need to be reverse engineered. But I know very little about this, so I'll leave it to someone who knows how to do these kind of things :P

https://mega.nz/#!Zp5T2QRS!VLBlG__XEEdDAFeSyS1FGdkx9TKFR2QSVLY24Mmvtcs

I've also got a partial script template from Nyxo, but he doesn't want it left on the net, so I can send that to you in a PM if you'd like.

Maki

  • Software hacker
  • Freak
  • *
  • Posts: 532
  • Karma: 101
  • Paranoid
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #3 on: 2018-08-02 08:23:34 »
That's unusual, but if that's the author intention then ok, send it over PM.
File format so far:
Code: [Select]
char[8] FLBD0101;
uint IMCHpointer;
uint unk;
padding[8]; //?
uint UnknownSHCHpointer; //0x28 + this
uint UnknownSPCHpointer; //0x28 + this
uint UnknownBTCHpointer; //0x28 + this
uint UnknownANCH0pointer; //0x28 + this
IMCH imch;

IMCH:
Code: [Select]
char[4] IMCH
uint IMCHsize; //including this + IMCH header
uint CountOfFrames; //This is global count of pointers to graphics;sprites;frames in file. It means one FLB can contain many graphics
uint SpritePointer[CountOfFrames]; //first one usually points to 0x00, so just: IMCHpointer+IMCHsize+pointer;

SpriteData:
Code: [Select]
byte[20] unknown_maybeChecksum?;
uint Unknown;
ushort width;
ushort height;
TEXTUREdata;

UPDATE:
Oh, ok. I got it! Updated the structure

Example summon_00f_bg1_full.flb is 256x512 and raw texture data is 524288 bytes;
256x512 is 131072; 393216 is dividable by:
Code: [Select]
Size:   1
Size:   2
Size:   3
Size:   4 <--
Size:   6
Size:   8
Size:   12
Size:   16
Size:   24
Size:   32
Size:   48
Size:   64
Size:   96
Size:   128
Size:   192

131072 * 4 = 524288;
So this is for sure 32 BPP data, therefore:

Are these colors ok?


Reimporting:
As far as I see:
1. Inject upgraded/upscaled texture data
2. Change width/height
3. Tweak SHCH; SPCH; BTCH and ANCH0 pointers
4. Tweak IMCH pointers to texture data that got changed due to different imageSize after the pointer to changed textureData
5. Well, looks like that's all. :-)

UPDATE2:
Diablos looks great! (ARGB -> BGRA/ABGR)
« Last Edit: 2018-08-02 08:52:19 by Maki »

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #4 on: 2018-08-02 13:06:29 »
That's unusual, but if that's the author intention then ok, send it over PM.
File format so far:
Code: [Select]
char[8] FLBD0101;
uint IMCHpointer;
uint unk;
padding[8]; //?
uint UnknownSHCHpointer; //0x28 + this
uint UnknownSPCHpointer; //0x28 + this
uint UnknownBTCHpointer; //0x28 + this
uint UnknownANCH0pointer; //0x28 + this
IMCH imch;

IMCH:
Code: [Select]
char[4] IMCH
uint IMCHsize; //including this + IMCH header
uint CountOfFrames; //This is global count of pointers to graphics;sprites;frames in file. It means one FLB can contain many graphics
uint SpritePointer[CountOfFrames]; //first one usually points to 0x00, so just: IMCHpointer+IMCHsize+pointer;

SpriteData:
Code: [Select]
byte[20] unknown_maybeChecksum?;
uint Unknown;
ushort width;
ushort height;
TEXTUREdata;

UPDATE:
Oh, ok. I got it! Updated the structure

Example summon_00f_bg1_full.flb is 256x512 and raw texture data is 524288 bytes;
256x512 is 131072; 393216 is dividable by:
Code: [Select]
Size:   1
Size:   2
Size:   3
Size:   4 <--
Size:   6
Size:   8
Size:   12
Size:   16
Size:   24
Size:   32
Size:   48
Size:   64
Size:   96
Size:   128
Size:   192

131072 * 4 = 524288;
So this is for sure 32 BPP data, therefore:

Are these colors ok?


Reimporting:
As far as I see:
1. Inject upgraded/upscaled texture data
2. Change width/height
3. Tweak SHCH; SPCH; BTCH and ANCH0 pointers
4. Tweak IMCH pointers to texture data that got changed due to different imageSize after the pointer to changed textureData
5. Well, looks like that's all. :-)

UPDATE2:
Diablos looks great! (ARGB -> BGRA/ABGR)


Those colors look perfect; its actually great, we never had a chance to test Diablos, so apparently his graphics are also tied to the FLB (at least in regards to his summon). The FLB folder has held up another mod as well, the Original sprite mod by Saftle. Other than animations, the game's UI is also tied to this folder as well. Whoever can crack the FLB problem, can make FFVI 100% moddable. Do you think you can write the program? If you need a commission and/or a copy of the game to work with, I'd definitely be willing to work something out! :)
« Last Edit: 2018-08-02 14:16:20 by kvg88 »

Maki

  • Software hacker
  • Freak
  • *
  • Posts: 532
  • Karma: 101
  • Paranoid
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #5 on: 2018-08-04 13:22:03 »
copy of game? Only for testing as I'm not sure the pointers are enough for modifying the file. Anyway, here's the entry version of the tool that does unpacking transparent .PNG graphics from .FLB, do not click on replace, it does nothing atm. I'm sharing this in this non-completed state as you may start working on the graphics now while I'll be working out the repacking:

Compiled binary + source code so far:
https://www.dropbox.com/s/iyi5nuheqth52kb/FLB_tool.7z?dl=0
Just go to bin>release and you'll find exe there

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #6 on: 2018-08-04 14:55:27 »
copy of game? Only for testing as I'm not sure the pointers are enough for modifying the file. Anyway, here's the entry version of the tool that does unpacking transparent .PNG graphics from .FLB, do not click on replace, it does nothing atm. I'm sharing this in this non-completed state as you may start working on the graphics now while I'll be working out the repacking:

Compiled binary + source code so far:
https://www.dropbox.com/s/iyi5nuheqth52kb/FLB_tool.7z?dl=0
Just go to bin>release and you'll find exe there


That looks awesome! We'll get to work on the assets - if you add me on Steam (kvg88) I'll gift you the game so you can get access to the whole FLB folder. You still have to use Nyxo's tool to extract the main.obb contents, but it takes like 5 minutes. Thank you for your help, it's very much appreciated.

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #7 on: 2018-08-05 17:25:33 »
I've been spelunking through the files and theres a lot here to work with - I'm 100% certain we will be able to remove the mobile UI and change the text boxes back to classic as opposed to that rpg maker vx style that was included. We should also be able to add the name of our mod to the intro screen. This is awesome lol

Maki

  • Software hacker
  • Freak
  • *
  • Posts: 532
  • Karma: 101
  • Paranoid
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #8 on: 2018-08-07 09:32:51 »
Great news!
I managed to code fully working replace with sizing (you can import high resolution images, I tested replacing 512x512>1024x1024 and 512x256> 128x64 and it works really great! Although the game engine doesn't sctretch the assets (at least the ones I tested). Anyway, here's current github page:
https://github.com/MaKiPL/ffvi_flb
it's still WIP, there are some color issues with dynamic replace (dynamic is when you change .PNG resolution) and I still haven't tested it on one sprite only FLB files.

I have a load of work at job so I'll try to do it asap
« Last Edit: 2018-08-07 10:30:23 by Maki »

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #9 on: 2018-08-07 20:28:15 »
That's great news. The colors may be wrong if they've been indexed in photoshop. Had trouble editing sprites until I figured out to recolor properly the first color in the index had to be the spritesheet background and the second had to be the sprites outline. This was true for character sprites and monsters. Could be the same for Spell graphics. I'll check!

Maki

  • Software hacker
  • Freak
  • *
  • Posts: 532
  • Karma: 101
  • Paranoid
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #10 on: 2018-08-09 09:11:54 »
It's live!
https://github.com/MaKiPL/ffvi_flb/releases/latest

Colours are correct now with dynamic replace. Tested with one-sprite package, first replace, last replace, n replace and in-game replace. Everything looks great. Have fun!

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #11 on: 2018-08-10 22:08:11 »
It's live!
https://github.com/MaKiPL/ffvi_flb/releases/latest

Colours are correct now with dynamic replace. Tested with one-sprite package, first replace, last replace, n replace and in-game replace. Everything looks great. Have fun!

Thank you so much! :D

kvg88

  • Fast newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: Looking for coder to help with FFVI for PC
« Reply #12 on: 2018-08-16 15:05:59 »
It's live!
https://github.com/MaKiPL/ffvi_flb/releases/latest

Colours are correct now with dynamic replace. Tested with one-sprite package, first replace, last replace, n replace and in-game replace. Everything looks great. Have fun!

Hey Maki,
Your tool has been essential for our mod, thank you! Going through the flb files I noticed that every flb contains a png of a small colored square. I believe that those parts of the flb are not graphics but the code that makes those features work which if we were to access for modification could further be used to change the UI but more interestingly, the translation! In the common folder of the flb are three files, campaign 1, campaign 2 and campaign 3. I believe these files contain the dialogue to game and if accessible with something like notepad++ could be used to restore the woosley script. The reason I believe these squares are actually code is because before you developed this tool, I experimented with deleting flb files I thought were relevant to the ui I was trying to remove; it would remove the ui but also the functionality associated with that flb file. Do you think theres any chance you could take a look at this for me?

If not I understand and I thank you again because what you've developed so far has been immensely helpful! Thank you!