Oddworld Forums

Oddworld Forums (http://www.oddworldforums.net/index.php)
-   Oddworld Mods & Hacks (http://www.oddworldforums.net/forumdisplay.php?f=24)
-   -   .lvl files (http://www.oddworldforums.net/showthread.php?t=15680)

Paul 09-30-2009 04:04 PM

'Course its scripted, ever notice how some Sligs have MASSIVE delay before the shoot? Yet some are instant..

Problem is tons of stuff is hard coded into the EXE, which is why I've come up with the plan of re-writing the game and converting the PC content to run on the newer engine which means people could do whatever they wanted. Of course I haven't even started that and its a log way off.. but its do-able!

AlexFili 10-01-2009 12:34 AM

The Sligs in AO are much more 'gung-ho' compared to AE (that's what I think anyway).

DJ9000DEVIL 10-01-2009 03:50 AM

OMG!!! paul is back! yay! paul can u plz help me with using the cantool it's so fucking hard!!!
BTW thanx for posting this topic! it's my favorite one on OWF!
,DJ9000DEVIL

RoryF 10-26-2009 05:11 AM

:compmad:My Windows Vista is being really sucky at the moment. Every time I use CamTool it stops Abe's Oddysee from working. I know I'm doing the right command on CMD and it comes up that the BMP file was patched successfully however I start the game and begin and it crashes. I've tried to contiune the proccess but it just closes.

Crashpunk 11-01-2009 03:45 AM

:

OMG!!! paul is back! yay! paul can u plz help me with using the cantool it's so fucking hard!!!
BTW thanx for posting this topic! it's my favorite one on OWF!
,DJ9000DEVIL
Its not a Text Message dude.

:

'Course its scripted, ever notice how some Sligs have MASSIVE delay before the shoot? Yet some are instant..
I like that. It make it easier to get away. (Only in the first levels bearing in mind)

RoryF 01-01-2010 06:00 AM

Abe's Oddysee for some reason keeps crashing when I start it up. Maybe I edited the wrong part on PSPad. If only they could make hex editing easier. I found 51 0H 17 UKEY = Q, maybe this is the controls.

Paul 01-04-2010 07:30 AM

Just so everyone knows I am making a GUI version of cam tool so its easy to use!

abe is now! 01-04-2010 09:00 AM

Oh you're still alive :)

Chubfish 01-04-2010 09:05 AM

:

()
Just so everyone knows I am making a GUI version of cam tool so its easy to use!

PAUL GUESS WHAT

I LOVE YOU

FOREVER

NOW NO ONE WILL PM MEEEE

Xavier 01-06-2010 01:38 AM

:

()
Just so everyone knows I am making a GUI version of cam tool so its easy to use!

Great to hear so, keep up the good work :D

mlg man 01-07-2010 05:41 AM

holy jesus paul your back! oh yer... and im pretty sure someone said if paul came back they will forever give me there rep... Paul, i cant wait to see what you do for this game. Also, remember that error you forced where it told you to find a replacement file. I was thinking, why does the game crash and not just do that. Did they have a developer version of the executable. Or is there some way to enable it. And didn't Digital Dialect recode the entire game???

ThibG 01-08-2010 12:44 AM

Hi!
I've started to document oddworld's file formats, and then, I've found this thread.
It seems that Paul did some work already! But did he document it somewhere?
Anyway, if somewhone is interested in it, what I've done so far is available at http://hg.sitedethib.com/oddworld-formats/
So far, it provides full documentation of Indx and Palt formats, partial documentation for Demo, Bits, and NxtP, and a python3 module to handle that.
I'm quite interested in the missing bits of the Bits format, which would make me able to convert background files, and in the Path format, which seems to handle CAM's position, collision masks and object/character description.

Crashpunk 01-08-2010 12:04 PM

If it helps Paul, Good job :p

EDIT: Welcome to the Oddworld Forums!

mlg man 01-08-2010 07:12 PM

Nice Job ThibG, looks like you did a good job. Maybe you and paul can team up. And i tried downloading those python files but couldn't download. Can you upload them here on the oddworld forums in a zip folder. That would be great. To paul: why haven't you given out the source code for the cam tool and level editor. Why do all the work when others can help you out?

ThibG 01-09-2010 12:29 AM

It's a mercurial repo, you can get it, update it, and other funny things using mercurial.
About the zip thing, I've just enabled bz2 and zip snapshots for oddworld-formats:
zip, bz2.

mlg man 01-09-2010 01:23 AM

Big thanks! To help you out. VH and VB files are Pretty much the index for sounds.dat. and BSQ files are playstation midi files which use the vb and vh files as samples for music.

ThibG 01-09-2010 02:41 AM

mlg man, thanks! That's interesting!
Have you any information regarding their formats?
Edit: Nevermind, it's nothing but common playstation files. At least for the VH format.

mlg man 01-09-2010 02:52 AM

Kinda, i researched the bsq file a bit more. it is actualy a SEQ file renamed to RSQ. Using a program SEQ2MID you get a midi file, look back a couple pages and youl see a link to download the converted midis. As for the vb and vh, they use a simple format... i guess. Using a program called PSOUND i was able to open the playstation vb and vh files. So lookup that program and debug or something to see how it opens it. Or maybe there is a source code for it. Havn't looked it up.

Paul 01-09-2010 07:43 PM

:

()
Hi!
I've started to document oddworld's file formats, and then, I've found this thread.
It seems that Paul did some work already! But did he document it somewhere?
Anyway, if somewhone is interested in it, what I've done so far is available at http://hg.sitedethib.com/oddworld-formats/
So far, it provides full documentation of Indx and Palt formats, partial documentation for Demo, Bits, and NxtP, and a python3 module to handle that.
I'm quite interested in the missing bits of the Bits format, which would make me able to convert background files, and in the Path format, which seems to handle CAM's position, collision masks and object/character description.

Awesome :D How did you go about figuring out the DEMO stuff? I've been using IDA to reverse engineer the game exe to figure out how stuff is working. I know how "Bits" and "Anim" work. Both of these formats are different for odyssey and exodus though!

One thing I would really like to understand is how "Path" works, it uses some weird script type thing which I think could be similar to "Demo"? Only problem is that the offsets to things in these files is hard coded into the exe :(

ThibG 01-09-2010 11:37 PM

@mlg man, thanks. Those file formats looks like the most common files formats used for PS1 midi. However, I haven't found any documentation yet.

@Paul, mainly intuition. Before looking at the file format itself, I thought it was a sequence of events/actions, and that it would be likely to have a simple structure, fixed in size.
After some tests, I've dismissed the first bytes (which causes the game to crash if not set properly), extracted all the commands from the game's demos, and started working on it.
There are unknown fields yet. Maybe it has no use, or serves to other characters than abe, and that's why I tried to make a custom NxtP file for the demos... But it hasn't been successful yet.

I think the Path format is one of the most useful. There is one for each sublevel, and it seems to deal with "sublevel layout" (the position of the different CAM files), initial state and scripting.
You're saying it's using hardcoded offsets in the exe... That's what I feard... So, it's the same with the map's width and height, isn't it? My first goal being to reimplement the game engine, having all those values hardcoded is quite annoying...

PS: I would be interested in Bits and Anim formats :P

Paul 01-10-2010 02:21 AM

:

()
@mlg man, thanks. Those file formats looks like the most common files formats used for PS1 midi. However, I haven't found any documentation yet.

@Paul, mainly intuition. Before looking at the file format itself, I thought it was a sequence of events/actions, and that it would be likely to have a simple structure, fixed in size.
After some tests, I've dismissed the first bytes (which causes the game to crash if not set properly), extracted all the commands from the game's demos, and started working on it.
There are unknown fields yet. Maybe it has no use, or serves to other characters than abe, and that's why I tried to make a custom NxtP file for the demos... But it hasn't been successful yet.

I think the Path format is one of the most useful. There is one for each sublevel, and it seems to deal with "sublevel layout" (the position of the different CAM files), initial state and scripting.
You're saying it's using hardcoded offsets in the exe... That's what I feard... So, it's the same with the map's width and height, isn't it? My first goal being to reimplement the game engine, having all those values hardcoded is quite annoying...

PS: I would be interested in Bits and Anim formats :P

Reimplement the game engine? Check out my "open source ALIVE engine thread" ;) we have the same goal it would seem.

Based on what you've said I could use IDA to see if its easy to find out the demo command bytes. Is it the same format for oddysee? If you can give me a command thats way out of range in the first demo file or something that makes it crash I can back trace it to the switch/case on the commands to try to figure each one out ;)

ThibG 01-10-2010 04:18 AM

Oh, just saw the thread about a recreation of the A.L.I.V.E. engine :)

On the demo format:
I don't have Abe's Oddyssee, so, I can only guess, but I think it's the same format.
Demo commands can't crash the game. An invalid command would simply do nothing. I think it's merely an abstraction of keyboard/joypad's state.
However, before the commands, there are some bytes that I don't understand. The first 4-bytes word is always "1", maybe a file-wide identifier, as seen with other formats. Modifying it will lead to a crash. I don't know anything about the 12 bytes following it. I first thought those were commands, but changing them doesn't do anything, it seems.

I think another interesting format is the NxtP format. Tweaking them may show some internals of A.L.I.V.E.

Paul 01-10-2010 04:42 AM

Hmm what is NxtP used for? Save state? I've never seen NxtP in AO

ThibG 01-10-2010 04:50 AM

Yeah, that's for saves. Well, there are high chances that the format changed between AO and AE...
If you can't find one in AO .lvl files, maybe there isn't one.
In AE .lvl, they are only used for initial demo's state.
You can try to tweak a saved game, that's the same format (without the header, though).

Paul 01-10-2010 06:44 AM

Where is the save file format documented ;)?

ThibG 01-10-2010 06:50 AM

It's far from fully documented (especially for characters: I don't know where they are put (this changes over saves). I know that abe's ID is 0x45, at least in AE's first level. So, searching 0x4500 in the SAV file will lead you to Abe's data). It is in doc/formats/nxtp.h

Paul 01-10-2010 07:06 AM

Hmm I think these structures just map onto the games internal structures for the game objects? I will take a look at AO demo files when I get a chance and compare it with what you have found :)

mlg man 01-10-2010 04:10 PM

Hey paul how the GUI camtool going?

Paul 01-11-2010 02:57 AM

Steady, I would not expect anything for another couple of weeks at least due to my limited free time these days.

Software Bug 01-11-2010 03:57 AM

Just wanted to drop in and say that you sir are doing great work :) Keep it up!
So whats the actual status on things? Working on the AO ripping tools etc and planning/dreaming/thinking about recreating the A.L.I.V.E. engine?

Paul 01-11-2010 04:02 AM

I'd say ThibG is reversing PC versions of AE formats and I am reversing PC versions of AO formats :)

I have reversed:
-Cam images
-Type 3 anim files
-Palts
-Paths to some degree..

And currently I'm making a GUI tool to view/edit lvl's and view/replace cam images and view anim files.

I would like to reverse path files to the point where I can figure out how the scripting stuff works, then I would likely create a small proof of concept/demo that allows you to scroll through various cam files with all the scene props in place :)

But all this stuff is likely a long way a way..

mlg man 01-11-2010 03:47 PM

isn't there some kind of website with a team of hackers that could help?

MAGICAL MOD-MERGE!

Paul, i am pretty advanced in computers. What do you use to reverse everything. Im only young and have a lot of free time on my hands. i could get a lot of work done.
If you can post links to downloads and stuff for what i need. Thanks!

Oops, thats right, i posted 10 mins ago. sorry about double post!

ThibG 01-12-2010 04:30 AM

I've updated DDV and NxtP infos a few days ago, if you are interested in it.
@Paul, I'm interested in Anim files. By the way, did you find out how pixels are compressed in AE version of Bits files?
@mlg man, I'm using hte (package ht in debian and alike, http://hte.sourceforge.net/), and some python scripting.

Paul 01-12-2010 08:04 AM

Type 3 is some basic RLE encoding, type 4 is uncompressed, dunno about the others

edit: I use IDA Pro in windows, I doubt you'll have enough money to buy the full version of that (around $2k)

edit again: But you can grab OllyDbg or the free version of IDA

yet another edit: Looking at the VB/VH stuff did anyone try loading them into that psf lab app to see if they play? :D

mlg man 01-12-2010 04:05 PM

2k! Ill go to my friend named pirate.:D Oh yer, the VB and VH files in the pc version are NOT openable by any playstation sound viewer but you can open the VB an VH files in the Playstation version of the game. i really wanna replace sounds in the game. Badly! And go here: http://www.oddworldforums.net/showthread.php?p=364796
i posted some sounds i ripped from ao ps version.

Edit: Ok i have the freeware version. All i want to know is how do you force actions. Example: Force ddcheat menu to pop up.

Paul 01-13-2010 09:37 PM

:

()
2k! Ill go to my friend named pirate.:D Oh yer, the VB and VH files in the pc version are NOT openable by any playstation sound viewer but you can open the VB an VH files in the Playstation version of the game. i really wanna replace sounds in the game. Badly! And go here: http://www.oddworldforums.net/showthread.php?p=364796
i posted some sounds i ripped from ao ps version.

Edit: Ok i have the freeware version. All i want to know is how do you force actions. Example: Force ddcheat menu to pop up.

You look at the functions and trace through them, eventually you will find one early on in the games start up thats comparing command line argument strings, hence you will see a "its_me_your_father" string some where. Thus the best plan of action is:

1. Find this string in the "strings" view
2. Find all XREFS to it, there is likely only one in the command line argument parsing function
3. Study the code and figure out what its doing with it, you'll find its looking for the string you found the XREF to and then doing a few more things (it will call a function, reverse what this is doing and you'll see its reading the keyboard, you'll see the constant it passes to the keyboard reading function is VK_ENTER or something)

For anything else that cant be found by tracing references to a string requires a lot more work. I found corrupting a file format I'm trying to reverse so that it crashes the game is the best way. When it crashes you can set break points in the call stack and then replace the file with a good version and check what some of the functions are doing, one of the MUST deal with the file that you screwed up.

Can you post a VB and VH file from both the PC and PSX version from the same lvl archive so we can see what is different between them?

Edit: Oh by the way for the "forcing on bit" that can only really be done at run time by editing the register contents with IDA when you hit your breakpoints. For patching an exe OllyDbg is better so you should do this:

1. Find the instruction(s) location using Ida after you've figured everything out
2. Use OllyDbg to patch those instructions and save a patched exe (Or write your own patching Util since you know the hex for the instructions you want to insert, and the offset of where they start in the binary)

Final edit: Unless you know x86 asm, C, and C++ this is going to be very hard or impossible for you to do most things since you won't know whats going on. When looking at some x86 code you need to know if it was a C function or a C++ function. This means you need to know how the compiler implements vtables and how vtables work and a ton of other stuff. You are effectively trying to get c or c++ representation of what the x86 code is doing. So if you can't read the higher level language you will be screwed.

E.g

:

.text:0048EF50 ; int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
.text:0048EF50 _WinMain@16 proc near
.text:0048EF50
.text:0048EF50 hInstance= dword ptr 4
.text:0048EF50 hPrevInstance= dword ptr 8
.text:0048EF50 lpCmdLine= dword ptr 0Ch
.text:0048EF50 nShowCmd= dword ptr 10h
.text:0048EF50
.text:0048EF50 mov eax, [esp+hInstance]
.text:0048EF54 mov ecx, [esp+hPrevInstance]
.text:0048EF58 mov edx, [esp+nShowCmd]
.text:0048EF5C mov gInstance, eax
.text:0048EF61 mov eax, [esp+lpCmdLine]
.text:0048EF65 mov dword ptr gPrevInstance, ecx
.text:0048EF6B mov gShowCmd, edx
.text:0048EF71 mov gcmdLinePtr, eax
.text:0048EF76 call game_init
.text:0048EF7B mov eax, gExitCode
.text:0048EF80 retn 10h
.text:0048EF80 _WinMain@16
You can see I've renamed everything to what it is, such as gInstance which is a global that stores the app instance. I know this because I know that WinMain() is the entry point (you could figure this out from looking at MSDN though)

But you also need to know that when it was C code it would have looked like this:

:

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* lpCmdLine, int nShowCmd)
{
gInstance = hInstance;
gPrevInstance = hPrevInstance;
gShowCmd = lpCmdLine;
gcmdLinePtr = pCmdLine;
game_init();
return gExitCode;
}

mlg man 01-16-2010 02:08 AM

sorry, i lost my abes oddysee psx disc, but i have both pc exoddus and psx exoddus in another language, but pc is english. Is it possible?

Paul 01-16-2010 04:00 PM

It should be, both ps1 games should have the same vb/vh file formats :)

mlg man 01-17-2010 02:27 AM

Heres a zip of the pc and psx vb's and vh's for the mines level.

Good Luck!

Paul 01-17-2010 03:31 AM

Looks like the exodus ones are not the same, I think they have taken all of the sound samples out of the vb and placed them into the sounds.dat!

Edit: the vab headers are almost identical though one appears to have a few extra bits tacked onto the end