Buffy The Vampire Slayer (XBOX) pak file

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

not sure this is ever gonna work.. seems the "Script" for the game engine is embeded (Gscript_indy.dll on PC and packed into the xbox default.xbe) without it, I dunno the game can be made to run.. I mean levels sure, textures Eventually all of them can be worked out EXCEPT, the main playable character.. I can find no where that it lists the character. Missionlist.txt one of the cmd arguments is the player model ( like indy in a tux, indy in his university suit, etc..).. If the xbe can be unpacked (doubt) possibly an equivalent is there that can be worked with (it is , after all, x86 code)... shame too cause it really is starting to look like something
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

well finally figured the character texture thing out... all the textures in the level are present...missing audio, items, game logic (can't solve the puzzle to continue on cause the item isn't there...I have to look further into the level file and see whats up)
Last edited by medievil on Fri May 11, 2018 7:43 am, edited 1 time in total.
PRP1986
Posts: 20
Joined: Tue Mar 27, 2018 6:41 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by PRP1986 »

medievil wrote:well finally figured the character texture thing out... all the textures in the level are present...missing audio, items, game logic (can't solve the puzzle to continue on cause the item isn't there...I have to look further into the level vile and see whats up)


Wow nice one how did you get the character textures to work in the end?
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

You have to rename the buffy msh file (I used buffyslayer.msh ) to indianajones.msh and place buffyslayer.mtx .ban and .gin all in the main meshes/char folder, only rename the msh file though.. after that delete res.dat and they loaded when it got created back....all the textures are like that, once you place them in the layout (the map textures have to be in the same folders they would be in for buffy.. like textures/props/xxxx... you can load the map in a hex editor and see all the textures used....mine even has all the trees and bushes on it now...and yes hat is REQUIRED in the game script...I really wish I knew how to get the scripting out of the xbox xbe or could replace all the info in the indy one so that it read the buffy file names and followed he buffy script... I've still not found the control for EITHER game, the one that says play this animation and this audio file> we have the missions list placing one of the buffy missions at the top doesn't always work though
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

not giving up, but progress is gonna go to a crawl...I gotta learn debugging , ida, etc... so I can figure out how to transfer/translate the scripting and my time is fairly limited so it will take a while...
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

https://www.dropbox.com/s/s7ipokral0c8jz2/mtx.zip?dl=0

working tool to create the multitex files from individual buffy pak extracted mtx files
slayerbot_
Posts: 5
Joined: Mon May 14, 2018 7:08 am

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by slayerbot_ »

So amazing to see someone working on this, I had to join just to say Thank You :D. I wish you luck with this and hopefully one day it will all be done and we will have a PC port, my dream haha
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

hmmmm gonna have to investigate the rpe files.. they are definitely in xbox adpcm format (0x69) the rpe format itself is pretty easy... 01 is first byte, 4th is number of audio files... then, like the mtx, you have specific headers with name, offset location and size of file.. I'd hate to have to write a script to extract them all for conversion to regular adpcm (0x11).... one rpe has over 1000 audio files most have about 100.. thats a lot of hand converting since I don't know of a tool that can batch convert xbox adpcm to regular wav. Also been looking more into the level files, seems maybe the scripting MIGHT be there after all... their are references to dialog, characters, etc....not seeing why , for instance, on the opening level giles is not there talking to her (even if there was no audio) though...
slayerbot_
Posts: 5
Joined: Mon May 14, 2018 7:08 am

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by slayerbot_ »

**EDIT**
never mind, you had already done what i was suggesting :)
slayerbot_
Posts: 5
Joined: Mon May 14, 2018 7:08 am

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by slayerbot_ »

This post http://the-scholars.com/viewtopic.php?f=38&t=22730# might be helpful, the person has written a script that might do what you need in replacing the hex code. There are other programs but they are paid and dont really let you test them first. The othet thing i wanted to ask, I was looking through the hex code for the wav files and was wondering if all of the 0x69 need to be changed or just the first one. I could help you to change the values or do it for you if the script wont work i just need to know what to change haha and how to get all of the rpe files or if you can give me access to them.
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

not that easy.. to be done proper, the files need to be reencoded and new rpe's created... I can do it(I can create a python script to extract them and then to recreate the rpe.. the time consuming part is reencoding... aluigi created a reencoder on the bms site as far as I know it doesn't do multiple files at once though
slayerbot_
Posts: 5
Joined: Mon May 14, 2018 7:08 am

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by slayerbot_ »

It can do batch files with this code, i don't know how to make it do sub folders though.. tried but i just don't know enough.
for %%G in ("%~dp0"\*.wav) do xbadpdec.exe "%%G" "Done\%%~nxG"

When using the program for testing on the .wav files the newly created files are much larger and I'm not sure if that's an issue as well the codec is changed to PCM not ADPCM. If you use the -a option there is no change to the codec and remains the same size, its still unplayable on a system without the xbox codec installed. If you manually hex edit the file to change all the 69 to 11 MediaInfo will report it as being ADPCM and will also play on a system without the xbox codec installed on it, but I'm not sure if that's will work out as you said that wouldn't be the right way to do it.

I went back and learnt how to extract the .pak files with Luigi's QuickBMS but its just straight to .wav no .rpe so that's what I'm working with. I also noticed that the sound files extracted in the music folder are .wma matching the ones outside of the .pak files but tiny file size and no codec info when checked.

Hope I'm being of some help and not just holding you up

**EDIT**

Also have you seen this XBE Explorer http://dxbx-emu.com/downloads/ might help you find some more stuff in the XBE file
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

ok, if that will do them in a batch I will write a python script(2 of them) one to extract the files and one to put them back together... size isn't an issue it will just make the rpe files larger.. the rpe's are in the dialogue folder BUT that might not get extracted, it might be part of the install.dat... I know I got them running the game in cxbx..it creates the HD structure/partitions in users/your profile/appdata/roaming/cxbx reloaded... partition 4(the folder, not the bin)is where buffy stores everything.... it will take me a few days to get the scripts working (Work and all, limited time, unfortunately) and yup, saw xbe explorer... moved on from it... ida pro, this actually might be dooable, will take a while though (months most likely at the earliest)... the whole engine main body is pretty much made of structs if it is movable, useable, a person or even some rocks, it will have a struct that gets called. Advantage for me, I have the pc and xbox version of indy to do my comparisons and plot out how best to make changes.. another advantage (I think).. the PC indy uses rtti.. which means instead of having a blue million structs, you feed it info and it creates the struct on the fly...if I figure the format out, it will be easier to translate buffy engine data cause I'd just need to make the correct data string... Thats of course, if I understood Rtti when I looked it up.
slayerbot_
Posts: 5
Joined: Mon May 14, 2018 7:08 am

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by slayerbot_ »

ok cool, i will keep an eye on your progress and if i see anything i might be able to help with i will try. Good luck :D
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

ok looks like this is gonna be REAL fun...lol..comparing XB indy and pc indy, you'd be really, really surprised how similar the code is, at least things like the loading tables for mesh names and such for example
PC:

Code: Select all

.text:10001C80 sub_10001C80    proc near               ; CODE XREF: sub_10001060+127↑p
.text:10001C80                 push    ebx
.text:10001C81                 push    ebp
.text:10001C82                 push    esi
.text:10001C83                 push    edi
.text:10001C84                 mov     esi, ecx
.text:10001C86                 call    sub_1019A5B0
.text:10001C8B                 mov     eax, [esi+1510h]
.text:10001C91                 mov     dword ptr [esi], offset aBHuman ; "b_human"
.text:10001C97                 mov     dword ptr [esi+8], offset aRHuman ; "r_human"
.text:10001C9E                 mov     dword ptr [esi+0Ch], offset aAIndy ; "a_indy"
.text:10001CA5                 mov     dword ptr [esi+10h], offset aAWeapon ; "a_weapon"
.text:10001CAC                 mov     dword ptr [esi+24h], offset aHuman ; "Human"
.text:10001CB3                 mov     dword ptr [esi+28h], offset aIndy ; "Indy"
.text:10001CBA                 mov     dword ptr [esi+1Ch], offset aIndy_0 ; "indy"
.text:10001CC1                 mov     dword ptr [esi+20h], offset aNazi ; "nazi"
.text:10001CC8                 mov     dword ptr [esi+eax*4+1450h], offset aIndianaJones ; "Indiana Jones"

and
XB:

Code: Select all

.text:00344F89 sub_344F89      proc near               ; CODE XREF: .text:0034770E↓p
.text:00344F89
.text:00344F89 var_4           = dword ptr -4
.text:00344F89
.text:00344F89                 push    ebp
.text:00344F8A                 mov     ebp, esp
.text:00344F8C                 push    ecx
.text:00344F8D                 push    ebx
.text:00344F8E                 push    esi
.text:00344F8F                 push    edi
.text:00344F90                 mov     edi, ecx
.text:00344F92                 call    sub_3156F0
.text:00344F97                 lea     eax, [ebp+var_4]
.text:00344F9A                 push    eax
.text:00344F9B                 mov     ecx, edi
.text:00344F9D                 mov     dword ptr [edi], offset aBHuman ; "b_human"
.text:00344FA3                 mov     dword ptr [edi+4], offset aRHuman ; "r_human"
.text:00344FAA                 mov     dword ptr [edi+8], offset aAIndy ; "a_indy"
.text:00344FB1                 mov     dword ptr [edi+0Ch], offset aAWeapon ; "a_weapon"
.text:00344FB8                 mov     dword ptr [edi+20h], offset aHuman ; "Human"
.text:00344FBF                 mov     dword ptr [edi+24h], offset aIndy ; "Indy"
.text:00344FC6                 mov     dword ptr [edi+18h], offset aIndy_0 ; "indy"
.text:00344FCD                 mov     dword ptr [edi+1Ch], offset aNazi ; "nazi"
.text:00344FD4                 mov     [ebp+var_4], offset aIndianaJones ; "Indiana Jones"
PRP1986
Posts: 20
Joined: Tue Mar 27, 2018 6:41 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by PRP1986 »

Great work so far - thanks for everything you've done this far :)
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

uuugh, getting more than a little frustrated.. not with the hacking stuff, but with IDA...It doesn't allow direct altering of files, it creates a little image of the file, you make changes and it can adjust offsets, etc...normally you make your changes, create a dif file and patch the binary... BUT, it isn't letting me create a dif file... or more correctly it produces a blank one..had all the menu and manager functions and exports all renamed and ready to go and lost all of it cause it would not directly patch nor create a dif file...if I can't get this lined out, next option (pretty huge undertaking) is recreating 3 dll's....I can copy the assembly code from them on the pc side and just replace all the game functions... thats a lot of work for no reason though.. much of the code is already ready on the pc side...it more a matter of adding functions and altering those that are equivalent... all the sound code, for example, is good to go, the xbox sound stuff is tailored for xbox and would have to be rewritten anyway so it make more sense to use the PC code, same for 3d access... and the XBE, is ONE file, everything is packed into it, so no exports or imports... all that has to be figured out, on PC it is already there, more or less. I can see some benefit to MAYBE creating a new script sgl file, since it is most of the main functions (NPC animations/behaviors ..items/props....etc) while the other 2 main dll's are more engine (handling sound, 3d, movement/controls, etc..) and they just pass info between them via the imports and exports... anyway, still plucking away.....
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

ahhh ran into a pretty significant problem... the boneanim files... the indy engine won't use them (says they are misaligned) and there is no way to redo them since they are built with the engine version...so now I am gonna go a different route, looking at taking the xbe and hacking the crap out of it, change the kernel thunk to actual ntdll calls(table list is already there, just have to change the functions)... take the dsound and d3d sections and change their calls to compatible d3d8 exports(hard part cause it is less well commented/documented in the xbe)...basically rebuild the thing into it's own exe
PRP1986
Posts: 20
Joined: Tue Mar 27, 2018 6:41 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by PRP1986 »

Wow sounds like a huge undertaking, good luck on your progress!

On a side note how viable do you think it would be to extract the models and/or animations?
medievil
Posts: 66
Joined: Tue Apr 17, 2018 4:23 pm

Re: Buffy The Vampire Slayer (XBOX) pak file

Post by medievil »

the models work in the pc engine so I have not looked at them, the animations though are completely code blocks...and I would imagine both are proprietary (unless they used 3d max or something similar back them to create them)