Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - luksy

Pages: [1]
Tools / [FF7] bin-gzip extractor / creator
« on: 2017-02-23 16:28:04 »
NERV Agent apparently had issues with another bin-gzip tool, so I made a new one.

Usage is pretty straightforward: give the tool one argument and it will unpack the named file, give it more than one argument and it will create a new archive with the first argument, and add the remaining arguments as archive members.

The filename extensions must be kept as-is as they contain the id used in the archive headers.

Download contains source.

Many mods at the moment distribute entire files instead of patching, I'm sure that those who have tried to distribute multiple mods will agree that this is not the best way to go about things.

I'd like to focus on flevel.lgp as it's directly related to most of what I've worked on in the past, although I'm sure the following ideas can be applied to most of the other game files if necessary.

Most of you will already know this, but the field files inside flevel.lgp can be simply split into logical sections, and each section can be split again depending on the data inside. Splitting the files down into manageable chunks will allow modders to include only the data they need to change, instead of overwriting everything wholesale. This won't eliminate conflicts entirely, but it's a start and at worst it would make mods smaller and easier to distribute.

As an example, the first section of a field file can be broken down into individual scripts, text, and akao blocks. I'm mostly concerned with the first two so as a test I made a small app that does precisely this, for example gldelev is split up as follows:

Code: [Select]
│       0

│       0
│       1
│       2

│       0
│       1
│       2

│       0
│       1
│       2

│       0


The scripts for each entity are added to their own folder, and the text to a separate folder. Note that the app automatically removes unused scripts and text to reduce clutter.

Making changes to the scripts and text for a mod could be performed in a number of different ways, but the most obvious would be to use Makou Reactor to make the necessary changes, dump only the relevant parts, and distribute the files along with the app that will reinject them into the target flevel during installation of the mod. Even the script and text from the entire game could be included if necessary, they only occupy about 2 megs uncompressed.

So far the tool only splits the first section (minus akao blocks), but it could be easily extended for the other sections too.

If you'd like to see what the structure looks like, download this, and run it specifying the location of the flevel (e.g. "flevel_dump.exe foo/bar/flevel.lgp"), it creates a root flevel directory in the dir where it is run. There is zero error checking right now, but as long as you specify a valid flevel and the current directory has write permissions you should be good to go. Note that it dumps a lot of files (about 60,000) so depending on your hardware it might take some time.

This probably ties in with kaldarasha's community flevel project somewhat, and perhaps other projects besides, and I'm open to any feedback at all.

* I may have overthought this, the field files themselves could work fine as a patching format, unused parts can be marked with zeroed out offsets. This means far less file clutter compared to above.


Considering how the PC re-release is just the old code in a new shell, I can't see how a mobile version wouldn't be a total clusterfuck to port without a rewrite.


Plus - you could have the chance to work with some of the older Eidos IP from our back-catalogue. More information on submission parameters and IP selection will be made available at GDC Next, November 5-7 at the LA Convention Center. If you have any questions or feedback, let us know.

Stop the presses...we can remake Daikatana!

I've been poking around in the world map events, has anyone else had a look at the opcodes?

So far I have:

   !(bool) stack top (resulting value pushed as if 0x110 was used)
   Reset stack pointer to base (0xE3A7F0)
   Push value to stack as word
   Push value to stack as single bit from memory starting at offset *0xE3A7E0:
              addr           bit
   if (!pop) jump to value as offset
   End script
   0xDE6B5C = stack top // Enable / disable controls
   0xDFC4A8 = 3
0x32b // No idea
   e3a890 = stack top
0x321 // Again no idea

   *0xE2BB94 (ptr to 1 of 16 structs) = 0xE28CE0 + arg1 * 0x24
   val1 = *(*E2BB94 + 8) - *(*E39AD8 + C + 8)
   val2 = **E2BB94 - *(*E39AD8 + C)

   *(*0xE39AD8 + 4C) = *(*0xE39AD8 + 40) = *(*0xE39AD8 + 3C) =
   (((val1 << 8) / val2) *2) + 0xE37120

   *0xE39AD8 + 3E = 0
   Creates window using the top 4 values on stack, from bottom to top values are x, y, width, height
   Places text using index on top of stack, text is read from mes.
   Displays a question and saves user input (presumably to address on top of stack, haven't looked yet)

Stack base is always 0xE3A7F0, top of stack is stored at 0xE39ADC.
0x765E09 is a table of function pointers for 3xx opcodes.
0xE3A810 is a pointer to the current script op

The *.ev files have the following structure:

struct {

  struct {
    uint16_t id; // No idea yet
    uint16_t offset;
  } Header[0x100];

  uint16_t data[0x3600];

I rewrote aalis lgp tools to support repacking, useful for mods etc. so all files don't need to be dumped to disk just to overwrite a few.

The main archive contains the source, feel free to use the lgp interface in any projects.

ulgp v1.2
ulgp v1.2.1 (forces lowercase files internally)
ulgp v1.3.2 (no memory mapping, use if you get memory errors)

App tl;dr:

Extract magic.lgp to a folder named "magic"
ulgp -x magic.lgp

Create magic.lgp from a folder named "magic"
ulgp -c magic.lgp

Overwrite files in magic.lgp from those in a folder named "magic"
ulgp -r magic.lgp

GUI should be self-explanatory, the two versions are to match the xp and vista/7/8 visual styles

Run install.bat to associate .lgp files with ulgp, once installed simply double click on an .lgp file to extract to the default folder. Hold shift and right click on any folder to create / add to an .lgp file using the files inside.

Read the readme for advanced usage!, e.g. if you need to distribute mods etc.

Major thanks to Aali for the original lgp code.

Tools / [FF7] Sound Effects dumper/encoder - sfxEdit (0.3)
« on: 2012-01-20 14:28:30 »
Fiddling about with cosmo to change some of the new sound effects was a little tedious after a while, so I made this to dump and process an entire folder into audio.fmt + audio.dat

Check the readme for details, the looping details are a guess on my part, if anybody has more info I'd be grateful!


If all goes to plan the next version of touphScript will (optionally) strip unused field scripts from flevel.lgp (this is mostly to remove unused text entries), I have it working and have briefly tested it with no issues, but I just need to check with those who have a better understanding of the script in case I'm doing something silly.

As I understand it thus far, the only way a script can be implicitly called is as follows:

script 0 of all entities is called by engine
scripts 1 - 2 of models can be called by pressing ok or entering field of contact
scripts 1 - 6 of lines can be called by interacting with the line in various ways
a script can be implicitly called by calling another script that points to it (i.e. empty scripts).

All other scripts can only be explicitly called from another script via the 7 script call opcodes.

Is this correct? Have I missed anything?

Tools / [FF7] Text editor - touphScript (v1.3.0)
« on: 2011-06-07 13:40:05 »

touphScript allows you to edit FFVII text using simple text files, hopefully this allows for faster editing and should be great for versioning / distribution if you like that kind of thing (and who doesn't).

Assuming nothing is missing it now supports every single line of text in the game:

  • ff7.exe (Various menu text and Characters' Lv4 Limit dialogue)
  • data\field\flevel.lgp (Field and tutorial dialogue)
  • data\kernel\KERNEL.BIN (Sephiroth, Ex-SOLDIER text and scene lookup table)
  • data\kernel\kernel2.bin (Most of game items and their descriptions)
  • data\battle\scene.bin (Battle dialogue, enemy names, enemy attack names)
  • data\wm\world_us.lgp (World map dialogue)

  • Dumps and reencodes FFVII text using simple UTF-8 text files.
  • All text in the game is fully supported (see files supported).
  • Automatically resizes field and world map windows to fit text.
  • Optionally inserts missing windows in field script.
  • Unused text & scripts optionally removed.
  • Options for controlling resizing, such as character name width.
  • Window values, numeric displays and question paramters can be specified manually if necessary.
  • Tutorial script can be edited.
  • Entries can be ignored in order to selectively overwrite different parts of the text.
  • Supports DLPB's Menu Overhaul.
  • Patches field scripts for bugfixes + other functionality.

Field and world windows are autosized as follows:

Window width is determined by the longest line (character names have a fixed width so some boxes are overpadded, name width can be forced with ini), window height is determined by the largest line count in between individual {NEW} tags, i.e.:
   “Good luck {CLOUD}!
      If you make it, we'll follow you!”{NEW}
   “Whoa, I'll hold the PHS for you.
      It'll break if it gets wet.”
has 3 lines until the {NEW} tag, and then another 2, so the box height will be 3 lines.

Complete instructions in the readme!

For those of you who don't RTFM here's a quickstart:

extract files
BACKUP flevel.lgp, world_us.lgp, scene.bin, kernel.bin, kernel2.bin and ff7.exe
double click exe and press d [enter] to dump
edit text files
double click exe and press e [enter] to encode

  • Added missing snowboard text entry
  • Added support for 2012 flevel
  • Disabled log popup
  • Numeric window fixes
  • Added window centering option

Known Issues:
  • 3 field names are set to dialogue, actually this is a FFVII bug and really doesn't matter, it's in the readme anyway

touphScript v1.3.1

touphScript v1.3.0


Pages: [1]