Users browsing this thread: 2 Guest(s)
Ripping 2D-Adventure Game - 150$ Reward
#1
Star 
Hi! My dream is to create a remastered version of the old windows/DOS point-and-click adventure game "Hansel & Gretel and the Enchtanted Castle" from 1995 made by TerraGlyph Interactive. Therefore I need all the resource data of the game - that means all sounds, all background images and all animations images!

All the resource data is stored in a so called .TGR file (it is a TerraGlyph Interactive custom file used in all of their games). I had contact to some of the developers of the game and they said the data of the .TGR file was multiply compressed with different compression algorithms.

I uploaded the messages relating the compression from the developer and the HAG.TGR containing the recources. There are no copyright related material like ISOs or stuff like tat behind that link. If you need other data please message me.

LINK TO THE FILES: FILES

The game is able to run from DOS up to Windows 2000 without problems. If you want to run it on modern systems let me know - there are some tricks to do this.

Here is a video of the game so you can see which images and sounds I'm talking about I need:
Gameplay Video

Because this means a lot to me a will pay a reward of 150$ for the one who can extract alle the mentioned data out of the game for me! I don't know how to do it. Smile

Thank you very much for your help!

Daniel W.


Attached Files
.txt   Message from Developer.txt (Size: 2.19 KB / Downloads: 87)
Reply
Thanked by:
#2
If anyone could give hints would be cool too! If anyone can rip all the sprites and sounds I will give a reward over 150$ via PayPal Smile
Reply
Thanked by:
#3
Hi! If the decompression is BIT level, and it has a switch case for multiple algorithm, it would be near impossible to do it by hand. Not to mention I don't have the decompressed data to verify against with.

But I can use a debugger to directly get the whole decompression function from the executable. Being a DOS game, the IDA Freeware Version 5.0 at ScummVM can be used for this.

Let me know if you need my help to find the decompression code.
- Rufas
Reply
Thanked by:
#4
Hi! I defenitly need help for this Smile Do you can access the files via dropbox or need any more information? Did you read the developer information about the compression methods?
Reply
Thanked by:
#5
Hi! I never expect you are still here! Welcome back!

Being trying to use that IDA from ScummVM, and now I can see why nobody can help you. IDA can analyze only the DOS-extender stub on the beginning, and not the engine part of game (the part I need).

Tried DOS box debugger, but the thing just keep crashing.

Looking at TerraGlyph wiki page, I noticed "Tiny Toon Adventures: Buster and the Beanstalk" also uses .TGR file, and it is a windows game, so it has a 32-bit .EXE. IDA can analyze this.

Found the decompression code at sub_40ff70, and I got something:

Naturally, it also works for Hansel and Gretel

The decompression is just like Final Fantasy 7. Read a byte (8-bits). If bit is 0, copy next byte, if not refer to dictionary. Good old LZ77.

Unfortunately, it only work for backgrounds. The sprites uses different function. I already located the function is at sub_408e60 and in middle of translating it. It has a messy 20 switch cases.

I'll update you when I'm done.
- Rufas
Reply
Thanked by: Hansel
#6
Thank you very much! Sounds great Smile If you need any information let me know.
Reply
Thanked by:
#7
Managed to translate all 20 switch cases, so all images are now decoded!

[Image: 82Vt1Kb.png]

Like Discworld, there are some sprites reuses pixels from previous frame, so it only has the difference. It is like animated GIF uses cumulative layers (combine) instead of one frame per layer (replace).

https://www.spriters-resource.com/playst...et/159053/

[Image: zQhs39E.png]

Here are all the extracted images, for both Hansel and Gretel, and also Tiny Toon:
https://www.mediafire.com/file/wov7e2r6d...59.7z/file
https://www.mediafire.com/file/djtw6brze...29.7z/file
(LARGE FILE WARNING : Each archive has over 30,000 PNGs!)

What is left now is the audio/sound data. The compression is just as the developers said - it is in BIT level, so it end up even more complicated than the 20 switch cases. Might need a few weeks to do it.

Until then, have fun with the images!
- Rufas
Reply
Thanked by: Barack Obama, Hansel
#8
Thank you very much! Looks great! Incredible to see even unused sprites! Great job! If you also can export the soundfiles you can have the reward Smile

How exactly you extracted the sprites? What was the process? Thank You!
Reply
Thanked by:
#9
(05-31-2023, 04:23 AM)Hansel Wrote: How exactly you extracted the sprites? What was the process? Thank You!

I already uploaded the source code to my github repo. You can get it here:
https://github.com/rufaswan/Web2D_Games/

You'll only need "psxtools" folder under "tools/psxtools"

After that, get a PHP 7.0+ from its official site. You'll only need 3 files from the archive, "php.exe", "php7ts.dll", and "php.ini" (renamed from "php.ini-development"). My scripts doesn't need any PHP extensions.

https://windows.php.net/download/

NOTE: also opening the php.ini, looking up the word "memory_limit" than deleting 128Mb and writing something like 2048mb

Put all the files to a folder, like this (the .IRLST and .LRARC are from gunvolt, so put .TGR there instead):

[Image: setup.png]

After that, from command line, run

Code:
php.exe  psxtools/pc_tinytoon_tgr.php  HAG.TGR

This will properly extract the files with the correct file type. You will get 4 extensions
- .PAL are the 256 color palette
- .IMG are the compressed background or sprites
- .SND are the sound files
- .HOT are Hotspots (according to game engine)

You only need .PAL and .IMG files. Run this on the content of each folder to get all background and sprites:

Code:
php.exe  psxtools/pc_tinytoon_img2clut.php  *

The result .CLUT and .RGBA are raw image used for debugging. You can convert them into PNG by running:

Code:
php.exe  psxtools/img_clut2png.php  *.clut
php.exe  psxtools/img_clut2png.php  *.rgba

Lastly, you can examine the source code for errors, and use/adapt them if you need them in any other projects.

Good luck with your HD remaster project!
- Rufas
Reply
Thanked by:
#10
Hi! Thanks for the cool tutorial Smile Unfortunetly I get an error trying to extract the .TGR file using your script. I attached the error message.



Don't know whats wrong here. Keep my updated according the decompression of the sound files Smile

Thank you VERY MUCH!


Attached Files Thumbnail(s)
   
Reply
Thanked by:
#11
Hmmm? Your HAG.TGR is 445,224,310 bytes (0x1a899576), but mine is 554,903,882 bytes (0x2113294a). Seems like there are multiple versions of the game. Or in different languages. I know ScummVM tries to keeps track every version and every release of the same game to fully support it.

I don't think my scripts will run with your HAG.TGR, unfortunately.
- Rufas

P.S. Did you get any files or folders after this error? If yes, what is the last file?
Reply
Thanked by:
#12
Oh ok, but it's important it runs with my HAG.TGR because it's the version 2.0 and the german version. Is it possible to update the script? There are no files extracted. Thank you Smile
Reply
Thanked by:
#13
I just got the version you have, and my script generate different error "unknown type 8". It seems they added some new file types. So it is updated to able to extract the newer TGR.

I also tried my .IMG script. The newer .IMG files is now completely different. Will have to figure out the newer format.

Also now I understand how to decompress the .SND files. Basically, except the first byte, everything after it is just the difference. So the data is like 87 -1 -1 -1 -1 -4 +2 -2 +1 0 0 0... , and it become 87 86 85 84 83 7f 81 7f 80 80 80 80... . It is in BIT level because it is suitable to compress audio data.

But luckily the .SND files remain the same. It will work for both version.

Decompressed .SND for Hansel and Gretel, and Tinytoons.
https://www.mediafire.com/file/5p5ucz6lt...20.7z/file
https://www.mediafire.com/file/m7ivt5pck...20.7z/file

But they are in 1 second chunks. If you merge both .IMG and .SND together, you'll noticed they are in [image, image, image, sound], [image, image, image, sound], ... chunks. It is exactly like how a video data structure looks like.

Using number of images between .SND chunks, you can even tell Hansel and Gretel is animated in 12 FPS, while TinyToons is in 6 FPS.

Interesting behind the scene stuff, right? Smile
- Rufas

P.S. if you still have problem extract .TGR file, let me see your folder setup. That 0x169e5d6ba is over 32-bit, but nothing on my code reads more than 4 bytes. Where in the world this value came from? Maybe it is reading something else entirely...
Reply
Thanked by:
#14
Hey Smile  I downloaded the new version of your scripts but I still cannot extract the newer .TGR - I get the same errors as before. I added a screenshot of my folder. Do you have access to the correct .TGR version?

You do a great job man and really let my dream become more and more true. Thank a lot!


Attached Files Thumbnail(s)
   
Reply
Thanked by:
#15
Hansel just PM me the TGR file, and the thing looks nothing I'm working with. No wonder it doesn't work at all.

@Hansel, I replied you with the correct .TGR. Once the files are extracted, run this on the .SND files

Code:
php.exe  psxtools/pc_tinytoon_snd2wav.php  [FOLDER]/*.SND

replace [FOLDER] with the actual folder names.

Let me know if you can a bunch of .WAV files.
- Rufas
Reply
Thanked by:


Forum Jump: