Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

[iOS] Cause of Death episode file (.exp) LZMA decompression

Featured Replies

I'm trying to figure out how this old 32-bit iOS interactive novel game (Cause of Death) loads its episode files (.exp format), especially the dialogue strings. Currently I'm able to extract the pictures out of the file (using scalpel and https://www.toolsley.com/inspect.html), but I had no luck doing strings analysis to get any actual text. I loaded the main game binary in IDA, and found out that the game loads the exp file by reading the CSPUD header (12 bytes) and builds a resource table. Each entry maps a resource ID to a file offset. When the game needs a specific resource (like image 0xA9), it looks up the offset, reads the data, checks if it's LZMA compressed (13-byte header), and decompresses if needed. Attached below are some of the episode files, I checked some using a hex editor and seems to use a similar magic header as LZMA in various locations of the file (5D 00 10 00 00). Would really appreciate guidance on this! 

episodes.zip

Solved by ikskoks

  • Supporter
  • Solution

Hi. I've created a script which allows to extract and import data from/to those archives
https://github.com/bartlomiejduda/Tools/blob/master/NEW Tools/Cause of Death/Cause_of_Death_EXP_script.bms

In case you'll have some issues with using the script, please follow this tutorial
https://ikskoks.pl/tutorial-what-is-quickbms-how-to-export-and-import-with-quickbms/

Also if you're interested in technical details, please read this wiki article
https://rewiki.miraheze.org/wiki/Cause_of_Death_EXP

  • Author
18 hours ago, ikskoks said:

Hi. I've created a script which allows to extract and import data from/to those archives
https://github.com/bartlomiejduda/Tools/blob/master/NEW Tools/Cause of Death/Cause_of_Death_EXP_script.bms

In case you'll have some issues with using the script, please follow this tutorial
https://ikskoks.pl/tutorial-what-is-quickbms-how-to-export-and-import-with-quickbms/

Also if you're interested in technical details, please read this wiki article
https://rewiki.miraheze.org/wiki/Cause_of_Death_EXP

thank you so much! i've tested the script on another similar game Surviving High School (they both use .exp episode files) and can confirm it works there too

  • 2 months later...

@ikskoks Thank you for this script, I also was able to use it successfully. I had a question about the outputted `.kiw` files, there is bytecode in each file that corresponds to in game instructions like character dialogue expressions, choices, background images and music cues. What is the best way to reverse engineer the bytecode in these files? I am not sure of the game engine that made this but are there any existing parsers or scripts for `.kiw` or similar you know of?

  • Supporter
14 hours ago, RachelO said:

are there any existing parsers or scripts for `.kiw` or similar you know of?


Hm, not any that I know.

14 hours ago, RachelO said:

What is the best way to reverse engineer the bytecode in these files?


Probably by loading game executable in IDA/Ghidra and searching for function responsible for parsing text data
or by trial and error method with manipulating content of each KIW file and checking changes in the game.

You can also create a new topic on the forum. Maybe someone else will have some better ideas.

  • 4 weeks later...

I believe the .dat format in the .exp file is as follows:

pack_id: uint16 # season/dlc id?
episode_num: uint16 # id of episode within pack
title_len: uint16 # length of episode title string
title: char[title_len] # episode title string
desc_len: uint16 # length of title in other places? calling it description
description: char[desc_len] # description string


 

Edited by ricktrager9228

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.