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 - G

Pages: [1]
Hi everyone.

I wrote extractor for FF7CC game data. Hope it'll be useful to many of you.

1. Place game data files to "data" directory (files from PSP_GAME/USRDIR on game disc);
2. Run ff7cc_extractor for Linux, or ff7cc_extractor.exe for windows (there is two binaries in archive as well as source code);
3. Wait :), there is 1.6 Gb of files.

If anyone finds something about data formats used in this files, post here or PM me.

Scripting and Reverse Engineering / AKAO Wiki
« on: 2007-09-21 19:32:06 »
Check this out, I began to fill this today:
For AKAO support in Q-Gears it's needed to understand two field opcodes: AKAO and AKAO2, for sequence there is a lot of unknown AKAO opcodes, I'll try to reverse-engeneer unknown AKAO opcodes one-by-one and fill info on Wiki and add support for them to my AKAO player, unreleased yet :).
We still need help!  :-P

(from Akari)
When looking through memory dump I found opcode names.
Among them was opcode names for special opcode.
Synergy Blade, I think you will be interested:

F4 ????? - it was this way.
F5 arrow - pointer
F6 pname - don't know
F7 gmspd - get message speed
F8 smspd - set message speed
F9 flmat - fill materia
FA flitm - fill item
FB btlck - battle lock
FC mvlck - movie lock
FD spcnm - special name
FE rsglb - reset (don't remember what reset)
FF clitm - clear item

FF8 Tools / [PSX] File Extractor (Missing Download)
« on: 2007-07-22 16:18:46 »
As I couldn't find any extractors for this on the net, I wrote this utility to extract data from PSX FF8 image file.
For now it extracts only near 22Mb of files from image. Extracting seems to be correct, although I don't know format of most extracted files (I know some AKAO frame files :) )...

download link: [source + windows binary]
Usage: ff8extractor.exe <path_to_your_ff8discX.img> <output_directory_path>

WARNING: output directory must exist.
After extraction, file with name 025.ff8 (checked it only from ff8disc1.img) at offset 0x000499b4 contain more offsets for the rest files (I think, that "rest files" contain movie and field files) in ff8discX.img. I don't fully understand format of this file yet, but later I'll extract that too.
Happy hacking!  :-D

Scripting and Reverse Engineering / Sound / AKAO
« on: 2007-06-24 19:25:48 »
Me and Zidane_2 were reverse-engeneering AKAO sequence format for ff7.

AKAO sequence format consists of following sections:
1. Header:
   struct AkaoHeader
      uint8_t magic[4];   // string "AKAO"
      uint16_t id;            // AKAO frame ID
      uint16_t length;     // frame length - sizeof(header)
      uint16_t unused1; // unused data in AKAO parser code
      uint32_t unused2; // unused data in AKAO parser code
      uint8_t unused3;   // unused data in AKAO parser code
      uint8_t unused4;   // unused data in AKAO parser code

2. Channels info:
uint32_t with used only 24-bit - mask for used SPU channels (example: 0x00000003 - 11b, 11b means that there is only channel 1 & channel 2)

3. Array of N uint16_t offsets to channel sequence data, where N is channel count. Every channel offset counts from position of this offset number in AKAO frame.

4. Sequence data:
After array of pointers there is sequence data for every enabled channel.
For any channel there is only one sample that are playing using 14 different tones and configuration.
Sequence data consists of SPU "configuration" section and "stream" section.
Configuration section consists of random 1-byte control bytes with parameters (we can say, that "control byte" is "sound opcode"). Every opcode has it's own number of parameters. Every opcode constant is > then A0. Processing of opcodes is finished, when AKAO parser finds byte < A0. This byte and following bytes to the end of channel data is "stream" section. Stream section format isn't fully understood for now, but we are working on it ;). There is timing, tone and length information for playing a sample. As we see later, all sample has 14 "tones" for playing. If any byte of the stream section is < 14 * 0x0b it selects length and tone for loaded sample, maybe something else.

***** MAIN INFO *****
Filename: sensui.snd
Frame ID: 0x59
Frame Length: 44 bytes
Unknown Data 1:0x04
Unknown Data 2:0x22181296
Unknown Data 3:0x46
Unknown Data 4:0x28
Channels count: 2

***** CHANNELS INFO *****
Channel 0:
Length: 0x13
e8 a8 66 [(?Tempo) Parameter: 0x66a8]

ea 00 50 [Parameter: 0x5000]
SPU Right Reverb depth: 0x5000
SPU Left  Reverb depth: 0x5000

a8 0d [Volume A8 modifier: 0x0d]
aa 40 [Volume AA modifier: 0x40]
SPU Right volume: 0x0339
SPU Left  volume: 0x032c

a1 0c [sample number]
a5 03
stream data:
66 96 ca

Channel 1:
Length: 0x11
aa 40 [Volume AA modifier: 0x40]
a8 11 [Volume A8 modifier: 0x11]
SPU Right volume: 0x0437
SPU Left  volume: 0x0426

a1 15 [sample number]
a5 05
stream data:
66 96 ca 00 00 00

This file contains data for each sample in INSTRx.ALL
   struct SampleIndex
      uint32_t attack_offset;       // offset to begin of "attack" part of sample (actually for INSTR.ALL real offset is: attack_offset - 0xff0)
      uint32_t loop_offset;          // offset to begin of "loop?" part of sample (actually for INSTR.ALL real offset is: loop_offset - 0xff0)
      uint16_t parameters[4];    // unknown for now
      uint32_t tones[12];           // possible "tone" constants for sample

Also I want to welcome a new developer Zidane_2 to Q-Gears! He is a great help in reverse-engeneering of AKAO format. He is a fan of FF9, so maybe FF9 support in the future, hehe ;)

P.S. If anyone has a time - clean up this info and add it to the Wiki.

Scripting and Reverse Engineering / XYZI opcode
« on: 2007-04-26 06:47:06 »
Can't understand how works code from STARTMAP

CHAR (00)
PC (00)
RET ()
XYZI (00,00,00,00,00,00,00,00,01,00)
RET ()

and code from first map MD1STIN

CHAR (08)
XYZI (00,00,70,0E,3D,70,36,01,09,00)
DIR (00,40)
IFSW (20,00,00,01,00,04,12)
DIR (00,28)
XYZI (00,00,50,0F,E8,71,37,01,03,00)
DFANM (06,01)
RET ()
JMPB (00)

In the first part of code with setting character it is playing recursively. But in the second part if we already watch start movie, character set in another place

2SynergyBlades: do you can experiment with this opcode to make things clearer.., when it works and when not?

Scripting and Reverse Engineering / AKAO
« on: 2007-03-27 06:29:06 »
some information related to Akao's music:

Of course all of you know, that there is AKAO in field files...
Also every file with extension *.SND on ffvii cd's is Akao's.
I examined 3 files on ff7cd's

Akao header:
Code: [Select]
|                   |   0x47  |         |   0x03  |                   |0x46|0x05| - ASERI2.SND
|       AKAO        |   0x3b  |         |   0x04  |     0x22181296    |0x45|0x55| -  OVER2.SND
|                   |   0x59  |         |   0x04  |                   |0x46|0x28| - SENSUI.SND
| 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 |
|                   |  seems  |         |         |                   |    |    |
|  magic string :)  |  frame  | frame   |  type?  |      *magic2*?    | ?? | ?? |
|                   |    id   | length  |         |                   |    |    |

after header there is <frame_length> bytes of music data.

All sound samples is in SOUND directory on cd's. For all 3 cd's contents all the same.
INSTR.ALL  - 92 main samples from game
INSTR2.ALL - 6 voice samples from One Winged Angel

INSTR*.ALL format is known to me (32-byte header with offset of first sample, maybe. after this there are 16-byte ADPCM encoded frames 22100Hz, mono, between sample frame groups there are 16 bytes of zero's (but there are exceptions))

EFFECT.ALL - for now totally unknown

INSTR*.DAT - some data for INSTR*.ALL (maybe there are relations between EFFECT.ALL and samples from INSTR*.ALL)
INSTR*.DAT contains <INSTR*.ALL sample count> 64-byte frames with some offsets for every sample and 60 bytes of other data, mostly 16-bit numbers.

I wrote utility to decode samples from INSTR*.ALL and now trying to understand AKAO's music format.

if someone know any info about ffvii sound related - post it here.

Q-Gears / Q-Gears 0.12
« on: 2007-03-20 14:19:59 »
Today released version 0.12!
There is a lot of Akari's improvements, and my final code for playing movies and audio.
Check it out:
Linux binaries I think I'll add today after work (GMT+2 :) ).

Thanks to Akari for finding my stupid bugs, shame on me!


And of course we need more programmers to develop q-gears, if anyone want to help, you are welcome!
For me next task will be to understand AKAO (C) sound format.

Q-Gears / new LOGGER->Log syntax and some progress
« on: 2007-02-24 05:34:35 »
I modified class Logger:
    void Log(MessageType logType,const char* logText, ...);
MessageType is:
Message types are in format X-Window system used:
"(II)" - informational messages
"(WW)" - warning messages
"(EE)" - error messages
"(--)" - other messages

I have added also command line switches:
Usage: ./q-gears-ffvii [options]

Basic options:
     -h, --help
          display this help and exit

     -v, --verbose
          set logging to console

     -d, --debug
          set logging to file

If we want to duplicate log messages in game.log to console - we start q-gears-ffvii -v

Added Akari's FF Tactics code to Linux makefiles.

Found out, that on my 64-bit Linux system there is a white screen in place of q-gears logo (I thought, that it's good, but yesterday I compiled q-gears on my notebook  :|)

Q-Gears / Movie-related code added - update your projects!
« on: 2007-02-21 20:16:11 »
Hi everyone. At last I add code for movie decoding. Updated only Linux makefiles. Please update your project files, added:

Currently I added to MovieTest module only plain STR files from CD1 - it's enough to copy them from PSX CDROM to data/MOVIE directory - don't try to play *.MOV files! - those one is copied incorrectly in Linux, in windows may not be copied at all. I write a dumper utility for them - but it isn't yet supports real *.MOV filenames and works only for CD-images. Later I'll modify it and add to svn.
Now I am working on using SDL_mixer XA-audio for movies (use something other than SDL_mixer? someone can do this better? - tell me... :) - I'll send the code I have [I combined from some sources of the internet console utility to play specified channel of XA file] )
Check out movies - it taked a lot of my time and nerves to figure out how to play them!

Q-Gears / Sound output method
« on: 2007-02-13 19:36:59 »
All that movie stuff brings in my head problem with sound system we wiil use in q-gears.
Definitely q-gears must be crossplatform, so I think the best choice is SDL. SDL have built-in methods for output audio, but in FF7 we can have different sound channels play simultaneously (for those, who don't know what I am talking about, if any ;) - at first watch FF7 opening movie on PSX/Emulator - there is a sound theme beginning, when Aeris coming out from a passage; after this try to watch this movie using any PC PSX video player - you will hear only background noise).
So we need to do some mixing... I understand, that unnecessary project dependencies is a bad idea (right, halkun? :-D). But there is SDL_mixer library...  :evil:. Of course we need only 2 channels of audio (or maybe not?) and we can do mixing manually, but I don't know much about this yet, and I think this will take some time to write good methods for mixing. As we don't have FF7 game sound decoder yet we can skip mixing for now, but later we will have a problem.
What community thinks about it?, can we use SDL_mixer?, can we use something else crossplatform? or don't use any mixing?

Q-Gears / STR, XA, FF7STR??
« on: 2007-02-12 20:47:32 »
Hello all!

So about my progress in the ff7 development... Haven't much time to write here about what I am doing/done.
I decided to write some classes to play PSX FF7 videos & sound. I used various sources of info about PSX videos and now I know something about it.
In FF7 there is 2 types of movies: ordinary files with STR extension (these can be copied without problems directly from cdrom without any crc errors) & files with MOV extension. Files with MOV extension is actually a interleaved stream with video & audio frames. These sectors are written in CDXA Mode2. I wrote simple dumper to dump this sectors to files. Then I write some demuxing code (used ffmpeg sources ;) ). For audio stream I found some sources that analyzes and plays PSX CDXA audio data and write a simple command line utility to play any channel in XA file through oss interface (for now only linux  :evil: ). For video stream I used libbs from psxdev-libs ( Using demuxer I split video to individual frames and try to decode it with libbs. Here I have bad news. I successfully convert many different videos from various games (tested all games I have at the moment) using only my GNU [heheh] tools EXCEPT ff7 videos. Deeper investigating in ff7 video frame shows me, that there is wierd section of data at the beginning of the video frame:
DE 0D F9 07 00 00 25 02
45 FC 96 F0 51 F8 5B 0D
B2 FB B2 FB 11 00 00 00
F8 00 00 00 62 12 00 00
E7 FF 00 00 BB 03 00 00
Of course this data is different for every frame. After this data begins "normal" frame data. Removing this data from file don't help to decode frame.
I think that problem is in "another" VLC coding method used in FF7 movies. This data may be some VLC table in Huffman Coding, or something else... I am totally confused with this...  :|
I tried some windows PSX video players which works perfectly with FF7 (of course this is closed source :( ). Also tried to debug pcsx emulator - it may be very funny, but I cann't find in pcsx source where VLC decoding is taking place (only mdec decoder functions which already included in libbs). Also tried official Sony's program for converting psx videos (MC32.EXE) - it works for anything except FF7 video - when I try to load FF7 bs-frame I got from my demuxer, MC32.EXE fails with message "Invalid MDEC Mode 0x7f90000" - maybe Square interpret this unknown data manual??
My sources currently are not in SVN - code is dirty, I don't want to add something, that not working yet - if anyone want, I will upload it somewhere. I also wrote some documentation about CDXA PSX video frame data.
I heard about some official Sony's PSX video format documentation - maybe someone can get this for me? ;) So if anyone have ideas about decoding FF7 video frames, or can help somehow - post here.

Q-Gears / Hello! I am G ;)
« on: 2006-12-11 20:14:25 »
Hi everybody. I want to introduce myself. Earlier I was thinking about to start project to port Final Fantasy VII to Linux, but week ago I found link to Q-Gears at So I think I can help.
Some info about me: I am Gennadiy Brich. I am 21, live in Lviv, Ukraine (привет Akari! Слышал, что Ñ‚Ñ‹ из России  8-) (сказал halkun). С моим английским хоть кому-то здесь в трудную минуту смогу выплакаться ;) ). Now I am last year student in Lviv's National University of Ivan Franko, faculty of Applied Mathematics & Informatics. I know C/C++ (4 year experience). Now I am working in local company as C/C++ programmer (actually I am programming microcontrollers [embedded systems] ;) - I know - it's faaaar away from PC-programming, but at least I have good money & some free time!). Also I have good knowledge in Linux (using for 5 years), OpenSource and so on. During my studying I used many programming languages, such as Basic, Pascal, Assembler, Java, Smalltalk, Perl, Python, even SQL, PHP... but for me it's not comparable to C/C++. If course I am also a *BIG* fan of Final Fantasy series  :-D.
Today Halkun added me as developer to project (username: super_gb). I already readed gears.pdf, and now I am studying q-gears source. Here at forum I'll be G. Now I have last winter session at university, so I have to pass my last exams, and after new year all my free time will be devoted to this project.
I think that's for now that's all about me.

P.S. My English isn't very good, but I think it's better then nothing (of course we can use C++ for conversations  :mrgreen: ).

Pages: [1]