Jump to content

Recommended Posts

Stick of Truth file formats, so far:

.OAF - main archive format. Similar to Dungeon Siege 3. Can be extracted by Raptor's SoT oaf extractor http://raptor.cestiny.cz/download/south-park-the-stick-of-truth-oaf-files-extractor.html

.GFX - Autodesk GFX/SWF format. Used for most part of ingame graphics. Possibly can be edited by Autodesk tools. Or you can change file header from CFX to CWS and file extension to .swf and edit it by any swf editor.

.STD - Strings format. Ingame text stored in here. Can be extracted by Raptor's SoT translator http://raptor.cestiny.cz/download/south-park-the-stick-of-truth-translator.html

.DDS - Texture file format. Edit it with your favourite graphics editor.

.TGA - Another texture file format.

.XML - markup language file format. Easy to edit.

.ACTOR - renamed XMLs.

.OGD - converted/compressed XMLs. Uneditable at the moment.

.WEM - AudioKinetic Wwise RIFF (or RIFX) Vorbis files. Possibly can be converted with ww2ogg and patched with revorb.

.BNK - Soundbank that contains multiple sound files. Possibly can be converted with http://ctpax-cheater.narod.ru/personal/bnkextr.zip

 

Tips:

You don't have to compress oaf archives back. Let's say, you edited gui/se_hazard_bacteria_gas.gfx from unpacked data_archive.oaf and want to test it ingame. Copy new file into ./data/gui/ in game folder and start the game.

 

Items Data:

Categories:

 

CAT_CONSUMABLE = 0
CAT_MELEE_WEAPON = 1
CAT_RANGED_WEAPON = 2
CAT_HEAD = 3
CAT_BODY = 4
CAT_HANDS = 5
CAT_HAIR = 6
CAT_EYEWEAR = 7
CAT_MAKEUP = 8
CAT_FACIAL_HAIR = 9
CAT_JUNK = 10
CAT_PARTY_WEAPON = 11
CAT_PARTY_ARMOR = 12

 

 

Item Types:

 

TYPE_NONE = 0
TYPE_TREASURE = 1 - CAT_JUNK
TYPE_MONEY = 2
TYPE_WEAPON_ONE_HANDED = 3 - CAT_MELEE_WEAPON/CAT_PARTY_WEAPON
TYPE_WEAPON_ONE_HANDED_ALT = 4 - CAT_RANGED_WEAPON/CAT_PARTY_WEAPON
TYPE_WEAPON_TWO_HANDED = 5 - CAT_MELEE_WEAPON/CAT_PARTY_WEAPON
TYPE_SHOULDERS = 6
TYPE_ARMS = 7 - CAT_HANDS
TYPE_ARMOR = 8 - CAT_BODY
TYPE_LEGS = 9 - CAT_BODY
TYPE_CONSUMABLE = 10 - CAT_CONSUMABLE
TYPE_HEALTH = 11
TYPE_SHIELD = 12
TYPE_CAPE = 13
TYPE_HELMET = 14 - CAT_HEAD
TYPE_BELT = 15
TYPE_BOOTS = 16 - CAT_HANDS
TYPE_RESOURCE_PRIMARY = 17
TYPE_RESOURCE_SECONDARY = 18
TYPE_ACCESSORY_1 = 19
TYPE_ACCESSORY_2 = 20
TYPE_ACCESSORY_3 = 21
TYPE_CRAFTING_ITEM = 22
TYPE_CRAFTING_ITEM_2 = 23
TYPE_PLOT_ITEM = 24
TYPE_GLASSES = 25 - CAT_EYEWEAR
TYPE_HAIR = 26 - CAT_HAIR
TYPE_FACE_HAIR = 27 - CAT_FACIAL_HAIR
TYPE_FACE_ACCESSORY_1 = 28 - CAT_MAKEUP
TYPE_FACE_ACCESSORY_2 = 29
TYPE_TOOL_1 = 30
TYPE_TOOL_2 = 31
TYPE_COSTUME = 32 - CAT_PARTY_ARMOR
TYPE_THROWN = 33 - CAT_CONSUMABLE
TYPE_UNIDENTIFIED = 34 - CAT_CONSUMABLE

 

 

 

FSCommands:

You can use FSCommands to call engine functions from within .GFX actionscript.

Example:

getURL("FSCommand:COMMAND", "PARAMS");

Commands list (incomplete):

 

"BUDDY_SHEET", "CLEAR_PARTY");
"BUDDY_SHEET", "SWITCH_PARTY_MEMBER " + .member_id
"BUDDY_SHEET", "PUSH_ABILITIES " + .member_id
"BUDDY_SHEET", "UNLOAD"
"BUDDY_SHEET", "SHEET_LOADED"
"CANCEL_OPTIONS", ""
"CLASS_SELECT", "DISPLAY " + x //x is class index
"CLASS_SELECT", "SELECTION " + .class_id
"CLASS_SELECT", "REQUEST_DATA"
"CLASS_SELECT", "LOAD_CLASS_DOLL " + x //x: 0 - fighter/1 - cleric/2 - wizard/3 - rogue/4 - jew
"COMBAT_ARENA", "ABILITY_CHOICE " + radial_name + " " + .selection_id
"COMBAT_ARENA", "COMBAT_ACTION_HIGHLIGHTED " + x); //x is number
"COMBAT_ARENA", "COMBAT_ACTION_SELECTED " + .m_action_id + " " + x + " " + .m_tag_hash); //x is string
"COMBAT_ARENA", "COMBAT_EXAMINE_SELECTED"
"COMBAT_ARENA", "COMBAT_RADIAL_POP_FROM_SELECTION_STATE"
"COMBAT_ARENA", "PLATFORM_ICONS_LOADED"
"COMBAT_ARENA", "FLOAT_TEXT_ACTIVE 0"
"COMMIT_OPTIONS", ""
"DIALOGUE_NODE_SELECTED", x 
"DIALOGUE_NODE_SKIPPED", "ACCEPT"
"GUI_SCN_CLOSE", ""
"HELP_TOPICS", "CLOSE_HELP_TOPICS"
"HELP_TOPICS", "SEND_HELP_MESSAGE " + .help_topic_tag;
"HELP_TOPICS", "SEND_INITIAL_DATA"
"HUD", "FIELD_TOOL " + slot + " " + .tool_type //slot: 0 - primary / 1 - magic
"HUD", "PUSH_INITIAL_DATA");
"HUD", "LEVEL_UP_ANIM_FINISHED"
"INGAME_SCREEN", "STAGING_AREA_READY"
"INGAME_OPTIONS", "SEND_INITIAL_DATA"
"INGAME_WARNING", "Warning text"
"NAME_SELECT", "SELECTION"
"PAPER_DOLL", "HIDE_UI_DOLL"
"PAPER_DOLL", "REMOVE_UI_DOLL"
"PAPER_DOLL", "SHOW_UI_DOLL"
"PAPER_DOLL", "SET_UI_DOLL "  + .PARTY_MEMBER_PLAYER
"PAPER_DOLL", "SET_UI_ZOOM " + ._x + " " + ._y + " " + ._xscale
"PAPER_DOLL", "SET_BG x"  //x is bg number
"PAPER_DOLL", "SET_PROFILE"
"PLAY_SOUND", "sound_name"
"PLAYER_SHEET", "REQUEST_DATA"
"PLAYER_SHEET", "SHEET_LOADED"
"PLAYER_SHEET", "UNLOAD"
"PLAYER_SHEET", "LOAD_EQUIPMENT " + PARTY_MEMBER_PLAYER
"PLAYER_SHEET", "SAVE_EQUIPMENT"
"PLAYER_SHEET", "SEND_MISSION_DESCRIPTION " + .mission_tag
"PLAYER_SHEET", "SEND_MISSION_OBJECTIVES " + .mission_tag
"PLAYER_SHEET", "SEND_QUEST_DATA"
"PLAYER_SHEET", "EQUIP_ITEM " + x + " " + .PARTY_MEMBER_PLAYER
"PLAYER_SHEET", "UNEQUIP_ITEM " + x + " " + .PARTY_MEMBER_PLAYER
"PLAYER_SHEET", "GET_PROPERTIES " + .item_index
"PLAYER_SHEET", "GET_EQUIPPED_PROPERTIES " + .item_index
"PLAYER_SHEET", "USE_ITEM " + x); //Used for consumables
"PLAYER_SHEET", "COLLECTABLES " + x); //0 - friends, 1 - chinpokomon, 2 - equipment, 3 - quest
"PLAYER_SHEET", "PUSH_AUGMENT_DESC " + .item_index);
"PLAYER_SHEET", "ATTACH_AUGMENT " + .item_index + " " + selected_slot_index + " " + x
"PLAYER_SHEET", "REMOVE_AUGMENT " + .item_index + " " + selected_slot_index
"PLAYER_SHEET", "REMOVE_ALL " + .augment_item.item_index
"PLAYER_SHEET", "GET_AUGMENTS " + .augment_item.item_index
"REFLEX_WIDGETS", "REFLEX_WIDGET_PRELOAD_COMPLETE"
"REFLEX_WIDGETS", "REFLEX_WIDGET_SCENE_LOADED"
"RESET_DEFAULTS", ""
"SET_GAMEPLAY_MINIMAP_AUTO_ORIENT", "x" //x is integer
"SET_GAMEPLAY_INVERT_Y_AXIS", "x" //x is float
"SET_GAMEPLAY_CAMERA_AUTO_ORIENT", "x" //x is float
"SET_GAMEPLAY_DIFFICULTY", x
"SET_GAMEPLAY_DISPLAY_TARGETING_CIRCLES", "x" //x is float
"SET_GAMEPLAY_DISPLAY_POPUP_DIALOG", "x" //x is float
"SET_GAMEPLAY_DISPLAY_COMBAT_TEXT", "x" //x is float
"SET_GAMEPLAY_DISPLAY_SUBTITLES", "x" //x is float
"SET_GAMEPLAY_SHOW_TUTORIALS", "x" //x is float
"SET_LEVEL_FILTER", x
"SET_VIDEO_GAMMA", x
"SET_VIDEO_RESOLUTION", x
"SET_VIDEO_FULLSCREEN", "x"  //x is float
"SET_VIDEO_RECOMMENDED_SETTINGS", ""
"SET_VOLUME_MASTER", x
"SET_VOLUME_MUSIC", x
"SET_VOLUME_VOICE", x
"SET_VOLUME_EFFECT", x
"SHOW", "x.scn" //x is scn name
"SOCIAL", "INIT"
"SOCIAL", "FANFARE_COMPLETE"
"SOCIAL", "ACCEPT_FRIENDS"
"SOCIAL", "DELETE " + .tag_hash
"SOCIAL", "UNFRIEND " + .tag_hash
"START_MENU_BUTTON", .message_box_command
"START_MENU_CANCEL", ""
"STORAGE", "SHOW_ITEM_DETAILS " + .item_index
"STORAGE", "SHOW_TAB " + STORAGE_SETTING
"STORAGE", "CLOSE_UI"
"STORAGE", "STORE_ITEM " + .item_index
"STORAGE", "RETRIEVE_ITEM " + .item_index
"STORAGE", "SHOW_ITEM_DETAILS " + .item_index
"STORAGE", "REQUEST_DATA"
"STORE", "SHOW_ITEM_DETAILS " + .item_index
"STORE", "SHOW_TAB " + s_store_settings[0]
"STORE", "CLOSE_STORE"
"STORE", "BUY " + .item_index
"STORE", "SELL " + .item_index
"STORE", "SELL_STACK " + .item_index
"STORE", "PREVIEW " + .item_index
"STORE", "REQUEST_DATA"

 

 

 

OGD Data:

 

/global/achievements/achievements.ogd - Achievements

/global/appearance_rigs/*.ogd - Appearance, costumes, etc. for every ingame character, including player

/global/creature_appearance/appearance_manifest.ogd - List of appearance OGDs allowed for game to load

/global/creature_appearance/player_appearance.ogd - Costumes and Items used in Character Creation menus

Note: item icon is defined in plaintext, dye data taken from item name. Actual item referenced by some id

 

Edited by DarkelUncut
Link to comment
Share on other sites

Yes I was thinking in a possibility of South Park SoT modding, and found dungeon siege oaf extractor (work the same way as the one that you found)

Btw sorry for the stupid question, but how i change file header from cfx to cws?

Edited by he4dless
Link to comment
Share on other sites

SoT engine is very similar to Dungeon Siege 3 engine. Same file structure, same formats. Almost the only difference and difficulty is that XMLs were packed into OGDs.

 

To change file header from CFX to CWS, use hex editor. Tiny Hexer, for example.

Though I was wrong. You won't be able to edit .SWFs, only view them.

 

To edit them you'll have to:

Outdated. Working methods are listed below this spoiler.

 

 

Method A (Edit only Action Script):

1. Download RABCDAsm (Robust ActionScript Bytecode (Dis-) Assembler)

2. Get your GFX and convert it to SWF. Let's say, reflex_widgets.swf.

3. Copy SWF into RABCDAsm folder and decompress by running:

swfdecompress reflex_widgets.swf

4. Extract the ABC bytecode:

abcexport.exe reflex_widgets.swf

5. Disassemble extracted code:

rabcdasm reflex_widgets-0.abc

6. Edit scripts extracted to reflex_widgets-0 folder in any text editor.

7. Compile changed ASM code back into ABC:

rabcasm reflex_widgets-0/reflex_widgets-0.main.asasm

8. Delete decompressed SWF from step 3, and copy original SWF into RABCSAsm folder again.

9. Replace scripts in SWF:

abcreplace reflex_widgets.swf 0 reflex_widgets-0/reflex_widgets-0.main.abc

10. Change SWF back into GFX.

Note: This is a long method and it doesn't always work. I was able to change said reflex_widgets.gfx this way, but not character_select.gfx. If it shows an error at 4th step, then no luck.

 

Method B (Convert to FLA):

1. Get Flash Decompiler Trillix or similar software.

2. Get your GFX and convert it to SWF.

3. Open it in Flash Decompiler and convert to FLA.

4. Edit FLA to your liking and compile it back to SWF.

5. Change SWF back into GFX.

Note: This is a preferable method, however, SoT SWFs seem to be version specific.

 

 

 

 

Method A (Script editing):

 

 

1. Download RABCDAsm, FLASM and hex editor.

2. Get your GFX and convert it to SWF. Let's say, reflex_widgets.swf.

3. Copy/move SWF into RABCDAsm folder and decompress by running:

swfdecompress reflex_widgets.swf

4. Copy/move decompressed SWF into FLASM folder and run:

flasm reflex_widgets.swf

5. Edit script in reflex_widgets.flm

6. When finished, run:

flasm reflex_widgets.flm

Your code will be put into reflex_widgets.swf and original swf will be backed up as reflex_widgets.$wf

7. Open both reflex_widgets.swf and reflex_widgets.$wf in your hex editor and search for

<rdf:RDF xmlns:

8. If there are noticeable differences in data up until that point (it shows), replace everything up to that point in .swf file with data from .$wf file.

This sometimes (rare) happens because of the differences in .GFX and .SWF formats.

If there are no differences - skip this step.

9. Change header, first three bytes to GFX (upcase). Not CFX, because SWF is decompressed now and will stay that way.

10. Change file format to .GFX.

Note: this works every time.

 

 

 

Method B (Overall editing):

 

 

1. Download RABCDAsm, FLASM, hex editor and SWiX.

2. Go through steps 2 to 4 of Method A. Rename .FLM, you will need it later.

3. Open decompressed .SWF in SWiX and export data to xml.

4. Through .XML editing, modify or add everything. Shapes, sprites, frames, etc.

5. When done, open .XML in SWiX and save as .SWF.

6. Feed resulting .SWF to FLASM again. SWiX import/export breaks importAssets tags, so you'll need to put them back in.

7. Compare importAssets tags in original .FLM and edited one. Replace broken ids.

Example:

instead

  importAssets from 'gfxfontlib.swf'
    '$Normal_Sans' as 0
  end // of importAssets

should be

  importAssets from 'gfxfontlib.swf'
    '$Normal_Sans' as 2
  end // of importAssets

or similar, according to original tags.

8. Go through steps 6 to 10 of Method A.

 

 

 

Update:

List of helpful tools:

Adobe Flash, Scaleform Gfx SDK, Flash Decompiler Trillix, SWiX, Sothink Decompiler, FLASM, RABCDAsm, JPEXS Free Flash Decompiler.

 

Update 2.2:

There is a developer console similar to Dungeon Siege 3 one. To call it:

1. Unpack help_topics.scn and game.gui from data_archive.oaf into data/gui.

2. Open help_topics.scn and change text to console.gfx.

3. Open game.gui and swap help_topics and console parserfunctions, so that it reads:

help_topics.scn parserfunction GUI_command_parser_console

console.scn parserfunction GUI_command_parser_help_topics

4. Run game and open help topics.

Console does work, but it doesn't work as it should. Either there are additional debug variables that need to be enabled, or something else.

Edited by DarkelUncut
Link to comment
Share on other sites

I've managed to do conversions and such, but one problem I encounter in every single one is that all colors have been replaced by shades of red for the most part. Nothing is as it is in-game. Is there a way to fix it so it will display the correct coloration of the resulting SWF files?

Link to comment
Share on other sites

This is due to Scaleform GFXs stripping of gradients and textures. I think it's possible to manually add them back.

If we had a tool that compresses everything back, it would be much easier. Surprisingly, there is no such tool.

I'll look into GFX SDK exporter sources.

Link to comment
Share on other sites

So I got the in-game command console to show up. I assume it can be used to insert specific items into inventory or storage, or directly onto the player? If so, how would one go about doing it? I've read over these files and the corresponding commands, but I'm having trouble deciphering how to pull something from storage based on item ID.

Link to comment
Share on other sites

  • 2 weeks later...

The reason the extracted images are showing up red is because the textures they are being painted with are being declared in scaleform tags, so standard flash tools will not understand them.

 

Here are some technical details for anyone who is familiar with the guts of an SWF.

 

The gfx files in stick of truth use 3 nonstandard tag codes outside the normal flash codes. These are:

 

1000 (ExporterInfo)

 

1008 (DefineSubImage)

 

1009 (DefineExternalImage)

 

I haven't looked into the first 2 much yet, but the 3rd is used to reference DDS files to be used as textures. tag 1009 assigns an image to a character_id, and that character_id is then used in fillstyle declarations in order to fill the shape. Because the char_id is being declared in a tag flash doesn't understand, when it is time to render the shape, there is no matching asset under that character_id.

 

As an example, the gfx file se_mark_for_death.gfx (a loop animation of the dog, sparky) will appear as shades of red if you look at the shapes defined. Inside this file, we have a tag 1009 with character id 8 and filename "___backup_texture_palette_i63.dds". We then have a DefineShape2 with char_id 9, which contains a ShapeWithStyle record. The very first ShapeRecord is a stylechange record, and it sets the fillstyle to index 1, which has a bitmap_id value of 8. So this shape is meant to be filled with that image, but because it was declared in a 1009 tag, only a scaleform client will properly load that asset.

 

Flash has no idea what char_id 8 is, so it can't load anything.

 

One solution would be to convert the dds to a bmp, then change the 1009 tag to a DefineBits tag, maintaining the char_id.

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...