| Author |
Message |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/06/2008 06:06:08
|
mathboobs
Greenhouse Member
![[Avatar]](/jforum/images/avatar/3c1e4bd67169b8153e0047536c9f541e.png)
Joined: 05/21/2008 10:58:43
Messages: 48
Offline
|
I probably could replace any file (compressed or uncompressed) in the HHA, I would just need to write an HHA packing tool, which I suspect will be more complicated than reading the file. Fun . I'd prefer to figure out the compression first, otherwise I'd have to keep track of which files were compressed in the old archive so I could repack them with the same compression number.
I won't be able to get around to finding the compression algorithms or writing an HHA packer until I get back from vacation, so you'll have to wait a while. Sorry.
I've definitely found uncompressed files that I've seen in the game, mainly the swf files.
They all live in parpg/data/swf/Cutscenes in the HHA
3.swf - apartment room w/ rat
5.swf - apartment room w/ blood on walls
6.swf - hobos making robots
8.swf - mimes worshiping silent mime god
11.swf - unknown, probably contains main character (won't play in flash player)
12.swf - same
15.swf - same
InitiativeDieRoll.swf - die roll animation from start of battle
Loading.swf - load screen when loading a saved game
Splashscreen.swf - HotHead logo at start of game
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/06/2008 08:33:52
|
WarpZone
Greenhouse Member
Joined: 05/26/2008 11:20:24
Messages: 24
Offline
|
Tantalizing.
But it sounds like all of the non-compressed stuff is static animations that don't affect gameplay (I.E. by reading or altering the larger game's variables) in any way. Is it possible that the thing thwarting your efforts to read those files is not compression after all, but some non-standard mechanism they hacked into the SWF format to cause it to talk to the game? For instance, maybe the reason you can't access the carnival game is because there's some bytecode (not ActionScript) in there that alters your number of tokens when you win? Likewise, maybe you can't access the dialogue SWFs because there's non-AS bytecode hacked into 'em to read the player's clothing variables from the larger game and use them? This is the most rampant and silly speculation; I have no idea if it's desirable or even possible to mutilate SWFs in this manner, but given how non-standard everything else in Precipice seems to be, I wouldn't put anything past 'em at this point.
(11.swf being incompatible with the standard Flash Player seems to add weight to this theory... and by the way, how did you manage to take a screenshot of it, without Flash Player?)
This message was edited 3 times. Last update was at 06/06/2008 08:36:40
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/07/2008 03:35:26
|
Soultaker
Greenhouse Member
![[Avatar]](/jforum/images/avatar/00a03ec6533ca7f5c644d198d815329c.png)
Joined: 05/22/2008 00:40:35
Messages: 28
Offline
|
I did some research of my own and it appears that there are three types of compression used, numbered from 0 to 1. Only a small fraction of the files are uncompressed. See this table:
Type 0 is uncompressed, so that means a maximum of 52 files. Type 1 is "deflate" compression, I believe, so it should be relatively easy to extract those as well, which brings the number of extractable files up to 227.
Also, I believe that it's possible to replace any file with a file using a different form of compression. So if you happen to know that, for example, file foo/bar.swf contains a cutscene even though it has compression type 2, you can still replace it with an uncompressed file you created.
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/07/2008 07:06:37
|
Sol
Greenhouse Member
![[Avatar]](/jforum/images/avatar/cfecdb276f634854f3ef915e2e980c31.png)
Joined: 04/02/2008 15:41:45
Messages: 4
Offline
|
You don't really need bytecode alteration for Flash to communicate with other software. I seriously doubt they manage to alter SWF file format that much and still managed to get it work. I am quite sure it tries to communicate with external software and fails to receieve the required info and that is why it doesn't work.
If you need help, I can reverse engineer the non-working flash files and get them to work, I guess. Wonder if it requires anything much bigger than decompiling and editing.
But then, I could be totaly wrong
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/08/2008 09:51:52
|
WarpZone
Greenhouse Member
Joined: 05/26/2008 11:20:24
Messages: 24
Offline
|
Soultaker, thanks for the heads-up about the different kinds of compression. That'll save mathboobs some time later, probably. If you learn anything else, or if you get bored and crack Type 1 or Type 2 compression on your own, please do post your findings here. Maybe write a recompiler app if you really want to kill some time.
Sol, yep, Plan A is still to decompile the SWFs. The hard part is finding a SWF that's uncompressed that communicates with the game, OR figuring out how to decompress Type 2 Compression.
Keep an eye on this thread. As soon as we have access to any of the SWFs of the mini-games, we'll let you know so you can work your magic. Probably it won't happen until mathboobs gets back from vacation.
Thanks to both of you for posting. Every precious scrap of information is helpful. (Even if it's just publicly announcing stuff that's obvious to everyone but me. )
This message was edited 1 time. Last update was at 06/08/2008 09:52:23
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/08/2008 15:34:45
|
Soultaker
Greenhouse Member
![[Avatar]](/jforum/images/avatar/00a03ec6533ca7f5c644d198d815329c.png)
Joined: 05/22/2008 00:40:35
Messages: 28
Offline
|
Actually, I already figured out type 1 compression (which is just a Deflate stream) so only type 2 remains. Unfortunately, most files are compressed with type 2. Also, I noticed that you don't need to repack the files into an .hha-file in order for the game to use them. They only need to be removed from the archive, and then the unpacked files (in the file system) are used.
So I wrote a tool to extract files from the archive. Get 'em here:
hha-0.1-linux32.gz (For 32-bit Linux)
hha-0.1-win32.zip (For 32-bit Windows)
To test, I replaced the texture for Anne's lamp with the texture on the floor:
It isn't much, but is shows that editing the files does work in-game.
Important note:
Extracting files removes them from the archive! (This is because if you keep the files in the archive, then the game will use those instead of the uncompressed files that you want to edit, and you can't throw the archives away, because they still contain unextractable files.) Therefore, before you do anything, make a copy of your "common.hha" and"parpg.hha" files. (Alternatively you can restore these files by reinstalling the game, but that's annoying.)
For Linux users:
File names are case insenstive in the archive, but case senstive in the Linux filesystem! The game does not refer to files using the same capitalization that is used in the archive, so on Linux files may need to be renamed after extracting them, or the game cannot find them and crashes. To detect when this happens, try running the game as follows:
And look for misspelled filenames. I noticed only two or three filenames that have this problem, but there may be more. (Maybe we can compile a list.)
This message was edited 1 time. Last update was at 06/08/2008 15:35:00
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 11:40:59
|
WarpZone
Greenhouse Member
Joined: 05/26/2008 11:20:24
Messages: 24
Offline
|
Sweet.
That's awesome work, Soultaker! I'm gonna have to go through the files exposed in this manner and see if there's enough exposed content here to make an interesting mod.
I guess this means that, once someone cracks Type 3 compression, the ideal situation will be for everyone to extract and delete their HHA files first thing, then overwrite the extracted files with the mod content. Maybe someone could even create a mod tool that backs up and extracts the HHAs when you first run it, and thereafter lets you "activate" your various mods one by one, by choosing which mod archives to extract, and in which order...
Once again, excellent work.
Is there a mac-user in the house who's willing to collaborate with Soultaker to make a mac version of the app?
This message was edited 1 time. Last update was at 06/09/2008 11:45:15
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 14:00:03
|
Soultaker
Greenhouse Member
![[Avatar]](/jforum/images/avatar/00a03ec6533ca7f5c644d198d815329c.png)
Joined: 05/22/2008 00:40:35
Messages: 28
Offline
|
Yeah, someone should buy me a MacBook so I can build a Mac version.
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 15:23:02
|
Joshua.Maust
Greenhouse Member
![[Avatar]](/jforum/images/avatar/7827d1ec626c891d4b61a15c9dff296e.jpg)
Joined: 05/22/2008 20:27:22
Messages: 94
Offline
|
Soultaker wrote:Yeah, someone should buy me a MacBook so I can build a Mac version.
OH so very tempting. =p
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 21:24:33
|
PaladinOfKaos
Greenhouse Member
Joined: 05/29/2008 18:30:48
Messages: 6
Offline
|
Nifty tool.
Soultaker, are you going to release the source code? I've been doing a little work on the HHA format, but it would be easier if I was on the same page as you and Mathboobs...
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 22:45:31
|
Soultaker
Greenhouse Member
![[Avatar]](/jforum/images/avatar/00a03ec6533ca7f5c644d198d815329c.png)
Joined: 05/22/2008 00:40:35
Messages: 28
Offline
|
Oh, sure. I've set up a Git repository at git://hell.student.utwente.nl/pub/repos/hha
Accessible by web as well (but slow): http://hell.student.utwente.nl/gitweb.cgi?p=hha
A snapshot of the current version: hha-0.1.tar.gz (Also contains a file format definition as far as I figured it out.)
(NOTE: these files are of interest to programmers only; if you just want to use the tool, use the link I posted earlier.)
By the way, I think that type 2 compression is actually LZMA, although I can't decompress them yet.
This message was edited 3 times. Last update was at 06/09/2008 22:52:47
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/09/2008 23:21:03
|
WarpZone
Greenhouse Member
Joined: 05/26/2008 11:20:24
Messages: 24
Offline
|
Sweet! Thanks for making it Open-Source, SoulTaker.
Your tool needs a proper name... how about the Hardcore Hothead Archive Hack? It's a little brazen, but the acronym amuses me...
HAHAHA.
Whatever you decide to call it, this is a tremendous step. You've each done great things, these past few days. But working together? Shit, Type 2 Compression doesn't stand a chance!
This message was edited 2 times. Last update was at 06/09/2008 23:23:32
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/10/2008 01:04:44
|
Bhelyer
Greenhouse Member
Joined: 05/22/2008 06:44:54
Messages: 12
Offline
|
Soultaker, your code seems well written and is nicely laid out. Especially with C, it's easy to write code that becomes hard to read or follow, but I had no such problem with yours. Also, you use Git, which is awesome, making you awesome by proxy.
This message was edited 1 time. Last update was at 06/10/2008 01:09:16
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/10/2008 04:59:02
|
Soultaker
Greenhouse Member
![[Avatar]](/jforum/images/avatar/00a03ec6533ca7f5c644d198d815329c.png)
Joined: 05/22/2008 00:40:35
Messages: 28
Offline
|
Thanks Bhelyer
In the mean time, I figured out how to decompress the LZMA (type 2 compression) correctly, so I updated the tool to version 0.2! Grab it for Linux (hha-0.2-linux32.gz) or Windows (hha-0.2-win32.zip).
Since the tool can now extract all files, it no longer modifies the original archive (that would be pointless). If you want to use modded files, make sure you rename the archive files, so the extracted files are used instead. Happy modding!
|
|
|
 |
![[Post New]](/jforum/templates/pgh/images/icon_minipost_new.gif) 06/10/2008 07:08:33
|
Sol
Greenhouse Member
![[Avatar]](/jforum/images/avatar/cfecdb276f634854f3ef915e2e980c31.png)
Joined: 04/02/2008 15:41:45
Messages: 4
Offline
|
Very very nice work Soultaker, it worked perfectly.
I have my hands full right now but I'll work on the SWF files tomorrow and return with more info. What baffles me is the CSH files..
Nevermind that, I guess I found what they are. They seem to be vector shape files for Photoshop. I don't have it installed here, so I will need to double check on that tomorrow, too. My first idea was that the SWF loads the shapes from the CSH file for player character model and uses it in the cutscenes. But then, as far as I know there is no possible way to load the CSH into compiled (published) SWF, so I wonder if are they really used or just left for editing/junk? Because the bonus.swf works flawless without its CSH file as far as I can see.
Questions... question... More will be answered when I decompile them and check their actionscript.
|
|
|
 |
|
|