OutRun2006Tweaks icon indicating copy to clipboard operation
OutRun2006Tweaks copied to clipboard

[Feature Request]: Tools for extracting and repacking

Open Sonic-TV opened this issue 1 year ago • 10 comments

Describe the feature you'd like to see added

as there're no ways to extract SZ files and repack them conveniently for custom graphics.

Sonic-TV avatar Jul 18 '24 17:07 Sonic-TV

Howard (FXT guy) has a tool called OutrunX in the forum that can unpack and repack .sz files.

Tenome avatar Jul 18 '24 20:07 Tenome

Howard (FXT guy) has a tool called OutrunX in the forum that can unpack and repack .sz files.

Tried, I can't open the extracted DDS files, Visual Studio gives me this error. File names are starting with SPR. image-3 Translation: The file format is not supported, or the file has binary characters. Opening using other application.

WTV.exe displays either an empty image or garbled one.

Sonic-TV avatar Jul 18 '24 22:07 Sonic-TV

Just noticed that Lindburgh has a carview exe with it, which actually includes structures for a lot of the model formats inside 😱

Got xmt model files almost 100% parsed into 010 editor structs now:

image

Next step would be somehow exporting this into some kind of model file...

There's also some structs around the sprites too, so hopefully can map out the weird data before the XPR0 (which should be atlas related afaik)

emoose avatar Jul 20 '24 10:07 emoose

Just noticed that Lindburgh has a carview exe with it, which actually includes structures for a lot of the model formats inside 😱

Got xmt model files almost 100% parsed into 010 editor structs now:

image

Next step would be somehow exporting this into some kind of model file...

There's also some structs around the sprites too, so hopefully can map out the weird data before the XPR0 (which should be atlas related afaik)

I managed to rip some models with Ninja Ripper. The car models come in multiple parts (frame, and then the wheels and bottom separately).

Tenome avatar Jul 20 '24 19:07 Tenome

Pushed some templates for xst/xmt to https://github.com/emoose/OutRun2006Tweaks/tree/master/docs/file_formats

Haven't added a XMT template for C2C yet since it seems to have changed quite a bit to Lindbergh (becoming PMT instead?), hopefully most of the structs might end up pretty close though.

E: got most of the XMT stuff mapped over to C2C's PMT, think the P in PMT probably means pre-loaded, instead of game reading in each individual struct from the XMT data like Lindbergh does they pretty much just load in the file as a single chunk into memory, apply memory address fixups to it, then use it as-is.

Also a lot of areas in the PMT which are just zeroed out in the file itself, but the game actually uses at runtime to store memory addresses for stuff like IDirect3DTexture* pointers.
Kinda neat way to do things, probably helps to reduce mem usage & load times, might make converting from XMT -> PMT a bit of a pain though.

E2: OR2 Xbox seems to use another form called SMT, fortunately it's pretty similar to PMT with it being pre-loaded in the file, but also seems that some structs had changed between SMT & PMT which prevent it loading into C2C, too bad :(

emoose avatar Jul 21 '24 00:07 emoose

image it finally works, thanks. now it's time to get a script and do a full dump of the PC and xbox sprites.

Sonic-TV avatar Jul 21 '24 10:07 Sonic-TV

Put together a tool that can extract the textures from XST sprites & convert the atlas rectangles (start x/y, end x/y) to XML, and repack modified XML back into XST / SZ, might be able to help fix some of the texture cutoffs with it.

OR2Tool-0.1.1.zip (old) OutRun2Tool-0.1.zip

Usage:
 OR2Tool.exe [-xml XmlPath] [-o OutputPath] InputPath

If -xml isn't specified, the input file will be unpacked to specified OutputPath
 or to the InputPath without .sz extension

If -xml is specified, the XML will be applied onto the input file
 and the updated file will either be written to OutputPath, or [InputPath]_new.sz

Sample output: spr_sprani_adv_cvt_xst-unpacked.zip

There isn't any support for replacing the actual textures yet, really it's probably better to use tweaks for texture replacement so it can also scale all the atlas coordinates up for you, otherwise you'd have to increase them all manually.

ATM the changed XML has to be applied onto an existing _xst.sz file, can't create a whole new _xst.sz yet, so you'll have to give it the path to the xst that the XML was extracted from.

Here's a small walkthru how it can be used:

  1. Drag & drop a xst.sz onto OR2Tool.exe -> will unpack the xst to a subfolder next to the XST you dropped
  2. Edit the info.xml that was extracted, adjust atlas stuff
  3. Open command-prompt, and let the tool know the xml path & input file: OR2Tool -xml path/to/info.xml -o output/path/xst.sz input/path/xst.sz
  4. Updated file will be saved to the -o path you gave (or if you skip using -o path, it'll be written to input file_new.sz)
  5. Try loading it in game, hopefully it'll load in fine

I did notice a couple XST files used slightly different/older headers than the others, not sure how repacking with this tool might affect them, if you have any issues let me know.

emoose avatar Jul 23 '24 07:07 emoose

For me this gets to the "Reading XST..." and then after some time exits with "Out of memory."

thegreatprophetzarquon avatar Jul 27 '24 03:07 thegreatprophetzarquon

Which file did you try with? Were you using it with the original compressed .sz?

emoose avatar Jul 27 '24 23:07 emoose

Yep. Any of the ones in "Sprani," all with 2006 dates from the original PC C2C. It gets pass the "Decompressing XST..." part just fine and then hangs on "Reading XST..." I checked my process list this time and it does indeed use up near all of my available memory, lol (I have 32 gb).

thegreatprophetzarquon avatar Jul 27 '24 23:07 thegreatprophetzarquon

Moved to #90

emoose avatar Sep 24 '24 10:09 emoose