Author Topic: [FF9]2016 release  (Read 23136 times)

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
[FF9]2016 release
« on: 2016-04-15 17:56:50 »
So... They used Unity3D (LOL, sic!).

FFIX\StreamingAssets\ma\:
FMVXYZ.bytes files are pure OGG
mbgXYZ.bytes files are also pure OGG

FFIX\StreamingAssets\:
P0dataXYZ.bin are "Unity Web Player Scene (non compressed)":
Open with UnityEx 1.5

FFIX\x64\FF9_Data\
sharedassets files, open with UnityEx 1.5

Source notes:
By the way> This can help in reversing FF8 (and FF7 if there's something missing). The engine is similar, so...
So far the most interesting source files are (for related FF):
PSX_LIBGPU.cs (Contains many polygon infos, vertex etc.) [Names like TPage and etc.]
PSX_LIBGTE_EMU.cs - I've seen this huge array in FF8 pseudocode...
PSX.cs - Many definitions about colour, TIM width etc.
PsxCamera.cs - Contains debug dumper for Camera info (reverse engineering?) and ready camera class (Matrix translation etc.)
PSXTexture.cs - Generating texture from TIM? (Yeah, setting new bitmap, copying pixels according to data. Looks like TIM to Bitmap generator)
« Last Edit: 2016-04-15 22:04:50 by MaKiPL »

Aali

  • No life
  • *
  • Posts: 1194
  • Karma: 109
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #1 on: 2016-04-15 18:35:19 »
Huh. That is an actual, working? full decompile of FF9. Its something we talked about doing for FF7 but someone actually did it. I'm not sure what this will do for us exactly but it sure is pretty impressive.

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #2 on: 2016-04-15 18:39:37 »
Yep. Unity3D uses CSharp as primary coding language. Mono C# is compiled to CIL assembly. This type of assembly can be produced into working C# code (not pseudocode like C/C++). Their decision of making it powered by Unity made an open gate to gain full source code in C#.
For streamingassets, this can open it: (Link removed, see my next post)
There are mostly unknown RAW data, sorted. Some materials...
That soft is capable of exporting image data to PNG and mesh data to OBJ
« Last Edit: 2016-04-15 19:14:01 by MaKiPL »

Shard

  • Insane poster
  • *
  • Posts: 331
  • Karma: 33
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #3 on: 2016-04-15 18:44:18 »
I noticed the Unity stuff as I was looking at the disassembly in Cheat Engine. Kinda made me go "huh?"

Good work on the source. I'll make sure to keep a copy with me at all times.

Tirlititi

  • Insane poster
  • *
  • Posts: 402
  • Karma: 49
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #4 on: 2016-04-15 18:46:36 »
Wow, where was that hidden? That's awesome !
Flags are given names here... I will never have to guess anything blindly anymore :D

I've seen those datas in the assets so far :
Code: [Select]
p0data2.bin :
  Enemy Stats Data "dbfile0000.raw16"
  Enemy Battle Data "[nb].raw17"

p0data3.bin :
  World 0x00 Chunk part "disc.img" "discmr.img" "map.bin"
  IMG DIR 13 "model_hm.nwp" "model_vm.nwp"

p0data4.bin :
  ??? "[NAME].tab"

p0data5.bin :
  Seems to be 3D models

p0data7.bin :
  FMV stuff? "FMV[nb].mbgdata" "MBG[nb].mbgdata"
  Field Scripts "[NAME].eb"
  Battle Scripts "[NAME].eb"
  World Scripts "EVT_WORLD_WORLD[nb].eb" "EVT_WORLD_WORLDSV.eb" "EVT_WORLD_WORLDTS.eb"

p0data11.bin & 12 to 18 :
  Field Walkmesh "[NAME].bgi"
  Field 0x16 Chunk "[nb].sps"
  Field 0x17 Chunk "spt.tcb"
  Field Tiles "[NAME].bgs"

p0data61.bin :
  Music "music[nb].akb"

p0data62.bin :
  Songs "song[nb]_[nb].akb"

p0data63.bin :
  SE Sound "se[nb][nb].akb"

resources.assets :
  File List "file.list"
  Texts
    Battles "[nb].mes"
    Text Blocks "[nb].mes"
    Items "itm_name.mes" "itm_help.mes" "itm_btl.mes"
    Key Items "imp_name.mes" "imp_skin.mes" "imp_help.mes"
    Fields "loc_name.mes"
    Worlds "[nb].mes"
    World Places "worldloc.mes"
    Spells "aa_name.mes" "aa_help.mes"
    Supports "sa_name.mes" "sa_help.mes"
    Commands "com_name.mes" "com_help.mes"
    Battle Infos "follow.mes"
    Battle Scan "libra.mes"
    Battle Spell Naming "cmdtitle.mes"
    Choco Menu "ff9choco.mes"
    Card Menu "card.mes"
    Cards "minista.mes"
    Tetra Master "minigame.mes"
    Menus "Localization.txt"
  World 0x00 Chunk part "fx[nb].sps"
  Cards
    Stats "MINIGAME_CARD_DATA_ADDRESS"
    Decks "MINIGAME_CARD_LEVEL_ADDRESS"
    Games "MINIGAME_STAGE_ADDRESS"

Assembly-CSharp.dll :
  Shops 0x201DC0
  Status Sets 0x1EF144
  Spell Naming Rules 0x202BE0
  Max Stats 0x1F14BC
  Character UI 0x1F14C4
  Initial Equips 0x1F14D0

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #5 on: 2016-04-15 19:02:33 »
Okay. Thanks for this Tirlititi. :)
The music files are also OGG. To get working music file just:

As jammy2001 in FF9 Audio replacement mod topic suggested to use "UnityEx 1.5". I also recommend this instead of "Unity Assets Bundle Extractor" (Unity Assets Bundle Extractor wants to hook up your svchost and dwapi and something other. Looks like spyware or just I'm paranoid). So use this: http://forums.qhimm.com/index.php?topic=16569.msg239876#msg239876
1. Rip your desired music file
2. Use HEX editor, find first occurance of "Ogg" string.
3. Delete all bytes up to this Magic word.
4. That's kinda all. Open with your favourite music player (that is capable of playing vorbis OGG files)

The MSIL assembly is in "Assembly-Csharp.dll" inside "Managed" folder.
« Last Edit: 2016-04-15 19:18:33 by MaKiPL »

gjoerulv

  • No life
  • *
  • Posts: 1074
  • Karma: 29
  • me
    • View Profile
    • My Youtube
Re: [FF9][Full Source code] 2016 release
« Reply #6 on: 2016-04-15 19:55:28 »
Yep. Unity3D uses CSharp as primary coding language. Mono C# is compiled to CIL assembly. This type of assembly can be produced into working C# code (not pseudocode like C/C++). Their decision of making it powered by Unity made an open gate to gain full source code in C#.
...

Haha, I had no idea C# was primary language for unity. Pretty much any purely "simple" C# project/solution is opensource... Not legally speaking of course.

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #7 on: 2016-04-15 20:25:05 »
...and JavaScript. :D
« Last Edit: 2016-04-15 21:36:50 by MaKiPL »

NFITC1

  • No life
  • *
  • Posts: 2739
  • Karma: 61
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: [FF9][Full Source code] 2016 release
« Reply #8 on: 2016-04-15 20:50:35 »
So....we can make our own frontends and overrides for GUI and window properties with this?

Covarr

  • Covarr-Let
  • Administrator
  • No life
  • *
  • Posts: 3896
  • Karma: 116
  • The Great Redarr.
    • View Profile
Re: [FF9][Full Source code] 2016 release
« Reply #9 on: 2016-04-15 21:27:17 »
In the interests of avoiding a C&D or other negative attention from Square Enix, I have removed all links to the source code. Discussion is fine (probably), but we can't be linking directly to copyrighted material like that.

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9]2016 release
« Reply #10 on: 2016-04-15 21:48:27 »
https://www.youtube.com/watch?v=Kd71zO6XAC8
Ayay Captain! You are right. I understand what might happen so I edited my posts.

Back to topic:
Does anyone know a good software for 'level' files analysis? HEX'ing them reveals some entities names/types, but that's all.
« Last Edit: 2016-04-15 21:58:02 by MaKiPL »

DragRopes

  • Freak
  • *
  • Posts: 894
  • Karma: -18
    • View Profile
Re: [FF9]2016 release
« Reply #11 on: 2016-04-15 21:52:18 »
Well this is certainly interesting

resinate

  • Cool newbie
  • *
  • Posts: 72
  • Karma: 1
    • View Profile
Re: [FF9]2016 release
« Reply #12 on: 2016-04-16 14:33:29 »
man i cant wait til ppl are able to mod the game

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9]2016 release
« Reply #13 on: 2016-04-16 14:37:54 »
FAST RELEASE!
Final Fantasy IX Steam 2016 - Savedata extract+decode
EXE:          https://www.dropbox.com/s/cx5ch3b6pdhv5gj/FFIX_Steam_SaveExtractor.zip?dl=0
Virustotal: https://www.virustotal.com/pl/file/99741661805f8b72215e8dcd4d72b211e183524de1e081203de6c03e120433de/analysis/
Source:     http://pastebin.com/r6sepYxZ
PS> Require .NET Framework 4.5
Yes. Reinserting is possible, just not now. I'm tired.

Lein

  • Cool newbie
  • *
  • Posts: 74
  • Karma: -17
    • View Profile
Re: [FF9]2016 release
« Reply #14 on: 2016-04-16 18:45:18 »
Quote
So... They used Unity3D
What does this mean, does it mean that maybe it would be possible to open up the game with the unity engine? :-o

Maki

  • Lana Del Rey
  • Insane poster
  • *
  • Posts: 423
  • Karma: 76
  • Final Fantasy VIII reverse team
    • View Profile
Re: [FF9]2016 release
« Reply #15 on: 2016-04-16 19:40:24 »
I'm UnrealEngine fanboy. I have no much knowledge about Unity, so... probably no, it is not possible to open it up in Unity Editor.

patternjake

  • Fast newbie
  • *
  • Posts: 13
  • Karma: 6
  • .NET Programmer with over 10 years experience
    • View Profile
Re: [FF9]2016 release
« Reply #16 on: 2016-04-16 21:34:55 »
However we can already decompile the code into CSharp (done already, but won't share)
and we can rip the assets from the unity raw datas using UnityEX v1.1.5 (that version only)

But no, that will not allow us to open it with Unity, that would be all too easy :/

Lein

  • Cool newbie
  • *
  • Posts: 74
  • Karma: -17
    • View Profile
Re: [FF9]2016 release
« Reply #17 on: 2016-04-16 22:48:41 »
It would allow you to create some really amazing mods though, replace models, redo backgrounds, import better music, script new scenes?

Zervox

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 5
    • View Profile
Re: [FF9]2016 release
« Reply #18 on: 2016-04-17 02:32:42 »
Had a chance to check WMWorld/WMBlock/WMCell/WMReadFile?
I also note that WMPsXCamera could be of use if one wants to figure perfect camera angle themselves ; )
« Last Edit: 2016-04-17 02:35:31 by Zervox »

Tsunamix

  • Freak
  • *
  • Posts: 602
  • Karma: 13
  • Check out my work - https://goo.gl/m4NFlm
    • View Profile
    • The home of Tsunamods
Re: [FF9]2016 release
« Reply #19 on: 2016-04-17 12:04:06 »
Just a thought. Instead of trying to reverse the PC version into unity we could do it to the android one ? Then use the same scripts to get the controls and other things back from the PC version

Zervox

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 5
    • View Profile
Re: [FF9]2016 release
« Reply #20 on: 2016-04-17 13:53:43 »
No one is reversing anything into Unity to my knowledge, FF9 for PC uses Unity,besides I believe Android version uses Unity anyways.
« Last Edit: 2016-04-17 13:55:47 by Zervox »

jammy2001

  • Fast newbie
  • *
  • Posts: 6
  • Karma: 2
    • View Profile
Re: [FF9]2016 release
« Reply #21 on: 2016-04-17 22:03:31 »
Just a thought. Instead of trying to reverse the PC version into unity we could do it to the android one ? Then use the same scripts to get the controls and other things back from the PC version

From what I've seen in the source it's the same unity project for both Android and PC as remnants of android scripts have still been left in the PC version such as google play store stuff. Some modifications of course but nothing huge.

Tsunamix

  • Freak
  • *
  • Posts: 602
  • Karma: 13
  • Check out my work - https://goo.gl/m4NFlm
    • View Profile
    • The home of Tsunamods
Re: [FF9]2016 release
« Reply #22 on: 2016-04-18 08:17:19 »
Okay I have a lot of experience working with unity but reversing a game or any asset files back in is one thing I could never do. If we can get it in I could all sorts of things with it.

patternjake

  • Fast newbie
  • *
  • Posts: 13
  • Karma: 6
  • .NET Programmer with over 10 years experience
    • View Profile
Re: [FF9]2016 release
« Reply #23 on: 2016-04-18 21:53:53 »
Progress Update:
Work completed on the launcher update, that will integrate the mod patch files I'm working on.
Managed to extract every single file in the game, it's just down to me analyzing the file types and converting them into content that we can mod. Thanks so much for the UnityEx tool for this.

Tirlititi

  • Insane poster
  • *
  • Posts: 402
  • Karma: 49
    • View Profile
Re: [FF9]2016 release
« Reply #24 on: 2016-04-18 22:16:04 »
My biggest issue is with the Assembly-CSharp.dll file. It contains a lot of useful datas to mod but it's extremely unconvenient to modify it directly.
The best would be to recompile it to have a modded version... but I don't like that solution either (you'd always need to have the source code).

Seriously, who said PC modding was easier than PSX? I feel the contrary here ^^"