I took a look at Culdcept's decompressing function and found it was too troublesome for me to write a recompressing tool (even if I can, perhaps I need to try hard to keep the recompressed data smaller than original data). So I had an idea in mind that maybe I could let the game read the uncompressed data from CD instead (so I can append the data behind the CD, for example).
But I don't know how to do that.
The decompressing function is like this:
decompress(input_address, output_address, output_length)
Input address is stored in a1, refers to a memory address where the unheadered compressed data begins.
Output address is stored in a2, refers to a memory address where the decompressed data will be stored.
Output length is stored in a3, should be the length of the uncompressed data.
And here's my idea:
Store the sector/LBA info at the beginning of the hacked compressed data and flag it with a special byte. Let the hacked function read one byte, if it is zero (for example), read ahead to fetch the sector info and read from CD.
I've read some document but haven't figured out how to do actual CD reading. All I know is the memory address is stored at 1f8010b0, hmm...