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

Pages: [1]
1
FILE STRUCTURE

Here is what I figured out about 0x12  file. This file contains information about models and structure is as follow:

Code: [Select]
It always starts with following header:

struct {
    uint8 tag;       // always 'DC'
    uint8 model_count;  // models count
    int16 padd;         // align to 32 bits - irrelevant data
} header;

After header there is an array of models infos. Lenght of this array == header.model_count

struct {
    uint16 mesh_id;                 // 0x02 file id - mesh
    uint16 default_animation_id;    // 0x03 file id - animation ( this value can be -1, it means that there is no default animation )
    uint8  materials_count;         // materials count
    uint24 materials_pointer;       // pointer to materials array ( calculated from begining of stucture )
    uint16 id_0x19;                 // 0x19 file id - ??? ( can be -1 )
    uint8  unknown1;                // possibly id of some file
    uint8  unknown2;                // unknown ( align to 32 bits? )
} model_info;

Materials:
First there is an array of tpage/clut values. Length == model_info.materials_count

struct {
    uint16 tpage;
    uint16 clut;
} tpage_clut;


Then array of textures windows (actually just x,y), this values should be added to tpage.x and tpage.y to obtain top-left corner of material texture.  Length == model_info.materials_count

struct {
    int16 x;    // This value can be negative!
    int16 y;    // This value can be negative!
} tw;


Next there is an array that probably is face/eye position in VRAM. For fields models this values are quite ok but not for playable charachters.
For weapons it's always [0, 0, 0, 0] and for playable characters it's [2, 2, 0, 0] or [1, 1, 0, 0]. Length == model_info.materials_count

struct {
    int16 x1;   // x of face/eye ???
    int16 y1;   // y of face/eye ???
    int16 x2;   // very often this value is equal x1
    int16 y2;   // very often this value is equal y1
} eye_anim;



HOW TO READ MONSTERS

In all cases meshes (0x02) animations (0x03) and textures (0x04) are in the same cluster with 0x12 file. The only exception are monsters that are separated into two directories:
Directory 5 - Contains 0x12 file
Directory 7 - Contains 0x02, 0x03 and 0x04
To read monster first you need to read information from 0x12, when you got meshes id you can load corresponding clusters from directory 7. Id of cluster from directory 7 always match id of mesh that is inside this cluster. Some times there is more than one mesh in 0x12 file for monsters!



HOW TO DECODE TPAGE AND CLUT

Information about how to decode tpage/clut value can be found in Psy-Q SDK. In file: psx/include/LIBGPU.H we can find following macros:

Code: [Select]
#define getTPage(tp, abr, x, y) \
((((tp)&0x3)<<7)|(((abr)&0x3)<<5)|(((y)&0x100)>>4)|(((x)&0x3ff)>>6)| \
(((y)&0x200)<<2))

#define getClut(x, y) \
(((y)<<6)|(((x)>>4)&0x3f))

#define dumpTPage(tpage) \
GPU_printf("tpage: (%d,%d,%d,%d)\n", \
   ((tpage)>>7)&0x003,((tpage)>>5)&0x003, \
   ((tpage)<<6)&0x7c0, \
   (((tpage)<<4)&0x100)+(((tpage)>>2)&0x200))

#define dumpClut(clut) \
GPU_printf("clut: (%d,%d)\n", (clut&0x3f)<<4, (clut>>6))

and from documentation:

Code: [Select]
u_short GetTPage(
int tp, // Texture mode
// 0: 4bitCLUT
// 1: 8bitCLUT
// 2: 16bitDirect
int abr, // Semitransparency rate
// 0: 0.5 x Back + 0.5 x Forward
// 1: 1.0 x Back + 1.0 x Forward
// 2: 1.0 x Back - 1.0 x Forward
// 3: 1.0 x Back + 0.25 x Forward
int x, int y) // Texture page address



That's all:) I hope that it will be useful for somebody.

2
Hi all,

I finally got some time to create a FF9 online viewer. It's beta version so don't worry about bugs or if your browser will hang:)
It works in browsers that supports WebGL (Tested in: FireFox 27.0.1, Chrome 40.0.2214.111 m).

Features (so far):
  • View/export* files
  • Export 3D models to Collada format(DAE)**
  • View weapons
  • View playable characters w/ animations
  • View fields models w/ animations
  • View monsters w/ animations (bug with textures)
  • View map models w/ animations
  • View world map w/o textures
  • View spell models
* Currently only files in directories can be saved. Just double click on file.
** World map not supported yet

To do:
  • Fix texture bug on monsters
  • Add possibility to export files from cluster (0xDB)
  • Add dialog viewer
  • Add battle fields viewer
  • Add map viewer
  • Add fields backgrounds viewer
  • Add animation controls
  • Add sprite viewer
  • Add textures to world map

Viewer URL:

http://beta-reverseff9.rhcloud.com/

Offline version:
http://beta-reverseff9.rhcloud.com/reverse_ff9_offline.zip

Changelog:
Code: [Select]
beta 0.0.5.1:
 - added textures to spells models
beta 0.0.5:
 - added directory 13 to file browser
 - added spells models viewer
beta 0.0.4:
 - added exporter - collada (DAE) w/ animation
 - fixed render options state after model change

beta 0.0.3:
 - added switch to reverse textures for monster models
 - added world map viewer w/o textures

beta 0.0.2:
 - fixed texture mapping problem on map models

beta 0.0.1:
  - added possibility to view file structure
  - added possibility to view 3D models w/ animations ( weapons/playable characters/monsters/field models/map models )

Screenshots:

File browser:

Weapons:

Playable characters:

Map models:


Enjoy!

Let me know what you think about it and if you spot any bugs please report:)

Pages: [1]