Author Topic: Xenogears Battle Background  (Read 7772 times)

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« on: 2005-05-05 08:53:58 »
This are the first results on Xenogears battle background.

First of all they are at 246419 - 253729 sectors of the disk. There are pairs of two files. First one are the battle background itself. The purpose of second one are still unknown.

Here are description of .bb (battle background) files

0x0000 u32 - number of sectors (always 05 00 00 00)
0x0004 u32 - 6 offsets to the blocks (last one offset to the end of file)
0x001C - till the next offset - tim textures and background (16 bit per piexl without CLUT)

# textures header
all offsets start from beginning of this block
0x0000 u32 - number of tim
next are for bytes offsets to tim
i still need more time to look at the header of each tim, but 0xC offsets from the beginning of each tim are height and width (2 bytes each)

# mech header
all offsets start from beginning of this block
0x0000 u32 - number of blocks
00 00 00 00 00 00 00 00 00 00 00 00 - unknown (as I see it always filled with zero)

#header to mech block
00 00 - unknown (zero)
84 00 - number of vertex
73 00 - number of mech (probably) (in this case each mech are always 12 bytes)
02 00 - unknown
28 01 00 00 - offset to vertex block
28 01 00 00 - offset to vertex block (again?)
48 05 00 00 - offset to next block (or end of vertex block)
(there something between start of next vertex block and beginning of vertex itself)
80 3B 00 00 - offset to mech block (probably)
00 00 00 00 - unknown (zero)
00 00 00 00 - unknown (zero)
95 01 74 FF 4F 00 53 01 B2 05 F2 FF 1D 03 00 00 00 00 00 00 B8 11 00 00 - unknown (perhaps some flags)

next are the second block and so, till the vertex data.
vertex format are the same as in FFVII
8 byte per vertex:
3 u16 x,y,z
1 u16 (unknown, probably textures coordinate or something)


Micky

  • *
  • Posts: 300
    • View Profile
Xenogears Battle Background
« Reply #1 on: 2005-05-05 17:29:23 »
Hey, nice work! Did you find how the game locates the files or did you trace the disk-access?
(Do you mean "mesh"?)

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #2 on: 2005-05-06 06:59:03 »
Mesh of course ^^'' my mistake

Quote
Did you find how the game locates the files or did you trace the disk-access?


No I didn't found any utilites that can trace sector-access. All they work with files  :z
I, simply, went to the first battle in the game and then create dump of memory that my VGS used. Then simply searched correspondence between them. And so I found this data. Then I check my files table (http://server.titansoft.ru/akari/xeno-gears.txt) go to first file and start work.

ps: previous experience with FFVII background helps a lot.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Xenogears Battle Background
« Reply #3 on: 2005-05-10 23:39:39 »
** MOD DELETE **

Just cleaning up the forum cruft a bit, don't mind me wiping off this smudge on the window. Continue like I'm not even here... ^_^

-Halkun

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #4 on: 2005-05-11 06:57:13 »
Quote from: halkun
Just cleaning up the forum cruft a bit, don't mind me wiping off this smudge on the window. Continue like I'm not even here... ^_^


Okey. There are some fixes in mesh header

# mesh header
all offsets start from beginning of this block
0x0000 u32 - number of blocks
00 00 00 00 00 00 00 00 00 00 00 00 - unknown (as I see it always filled with zero)

#header to mech block
00 00 - unknown (zero)
84 00 - number of vertex
73 00 - number of mesh
02 00 - number of mesh block
28 01 00 00 - offset to vertex block
28 01 00 00 - offset to vertex block (again?)
48 05 00 00 - offset to first mesh block
80 3B 00 00 - offset to unknown block
00 00 00 00 - unknown (zero)
00 00 00 00 - unknown (zero)
95 01 74 FF 4F 00 53 01 B2 05 F2 FF 1D 03 00 00 00 00 00 00 B8 11 00 00 - unknown (perhaps some flags)

First mesh block starts with 4 bytes header. First two bytes are still unknown. The second one are the number of mesh in this block. This header folowed by mesh data. Each mesh takes 8 bytes. The only difference between quad and triangle is last two bytes (triangle has only 3 vertex indexes so last two bytes are zero (vertex index start from 1)).




ps: I need to sort and name properly all I know already, three different mesh blocks are too much ^_^

Cyberman

  • *
  • Posts: 1572
    • View Profile
Xenogears Battle Background
« Reply #5 on: 2005-05-11 18:36:18 »
I presume these are seperate meshes within the same battle scene? Doesn't look like it really.  So you are looking for how to name the mesh blocks? It may have a mesh for each possible combat location you can have in a given area.

Cyb

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #6 on: 2005-05-19 05:33:04 »
Here is the next step in progress: textures

0x001C offset from the beginning of the file are always textures block. It

# textures block header
all offsets start from beginning of this block
0x0000 u32 - number of textures and palettes
next are four bytes offsets to textures and palettes

each texture or palette start from header
01 11 00 00 00 00 E0 01 - are palette ID
00 11 00 00 40 01 00 00 - are texture ID
ps: I met only two of them and they are always the same so I think its just identificator and dont have special meaning.

next four bytes are probably VRAM position

and the last four bytes are width and height (2 bytes each)
ps: in texture case - width must be multiply by 2

Palette - (Each pixel - 2bytes);
Texture - (Each pixel - 1byte offset to palette);

Which palette to be used must be set somewhere else.






Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #7 on: 2005-08-04 10:23:25 »
I released source and compiled version of xenogears bg viewer. i don't made any progress since last time, just get code into something readable.
I continue work on this format after two month of rest =)

Source code can be get here http://server.titansoft.ru/akari/xeno_engine_src.rar

Compiled code can be get here http://server.titansoft.ru/akari/xeno_engine.rar

You'll need extracted background data (i still couldn't read CD by sector (anyone knows any cross-platform library for this?))
It's not legal but you can get it at the same place where all other files (xeno_data.rar)

Cyberman

  • *
  • Posts: 1572
    • View Profile
Xenogears Battle Background
« Reply #8 on: 2005-08-04 15:56:26 »
Quote from: Akari
I released source and compiled version of xenogears bg viewer. i don't made any progress since last time, just get code into something readable.
I continue work on this format after two month of rest =)

Source code can be get here http://server.titansoft.ru/akari/xeno_engine_src.rar

Compiled code can be get here http://server.titansoft.ru/akari/xeno_engine.rar

You'll need extracted background data (i still couldn't read CD by sector (anyone knows any cross-platform library for this?))
It's not legal but you can get it at the same place where all other files (xeno_data.rar)

There is none, the problem lies in the fact that each OS handles CD reading differently.  Linux for example doesn't support low level reading of the media in Mode 2, this means you can't read Xenogears disks with it (nor FF7 FF8 or FF9).  I suggest as an alternative the support of ISO files, which are sort of RAW images of the CDs.  Whereas this might be questionable (IE it can be downloaded from someplace), it will have 2 major benefits.  One it's cross platform. Two it will work if you have a messed up disk.  There are nice programs to make images of disks and they are persistant in getting the data off the disk.  Instead of your software having to be.
It's just one less hassle you have to deal with in my view.  I'm already working on such support for my own software.

Cyb

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #9 on: 2005-11-06 01:36:31 »
Well this is just to show some progress. I still have much trouble with texture_coords block (alpha, strange "skip" block, texture pages, palettes). Although it seems that I get over through textures itself.

After I sort all that I know about battle background (and xenogears 3d format itself) i put it on public =)

This is some battle backgrounds that are shown without much bugz  8)






Cyberman

  • *
  • Posts: 1572
    • View Profile
Xenogears Battle Background
« Reply #10 on: 2005-11-06 04:52:36 »
Quite impressive brings back memories of playing xenogears :D

Cyb

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #11 on: 2005-11-20 19:44:32 »
Well, the 3d reader class are almost complete. I think it will help if I put it here =)

http://server.titansoft.ru/akari/xenogears/xeno_class.zip

It works with everything exept transparency  :-?

I even found two test battle backgrounds. They are consists only from monochrome polygons =)



This class works even with 3d fields models that are in directory 12. I tested it few minutes ago and all of them are seems to be displayed correctly.





I just move each 3d block with glTranslatef(800.0f, 0.0f, 0.0f); You dont need to do this with battle backgrounds.

halkun

  • Global moderator
  • *
  • Posts: 2097
  • NicoNico :)
    • View Profile
    • Q-Gears Homepage
Xenogears Battle Background
« Reply #12 on: 2005-11-20 22:35:46 »
HEY! you mind linking to that code.... You are kind of flooding.

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears Battle Background
« Reply #13 on: 2005-11-21 02:36:32 »
No prob. I just thought it would be easier to understand them that way.

ps: you could delete two our last posts.