7

I'm looking at the Japanese releases of Infocom games, curious to understand how the engine works. Four games were released for the PC98, one of which added graphics for the rooms (Moonmist). Later, Zork I - The Great Underground Empire was released for the PlayStation and Saturn and used the same technique for room graphics (no room graphics in the PC98 version, it seems).

So, being curious about what Zork room graphics might look like, I opened up the PlayStation disk image and found... strange file extensions. There is a .cda file format for sounds, and initial investigations seem like these may be easy to convert and listen to.

But the graphics seem to be in a .tpg format. I think.

I cannot seem to open these, nor do I have any understanding of what exactly it is. Was this format used in other PlayStation games? Maybe it was a format unique to Japan's development ecosystem? Maybe it is just proprietary to the studio, Shoeisha.

If anyone has information about this format and how to make sense of it, I'd love to learn more!

13
  • 4
    There is a Tiny Portable Graphics format but it's recent. It could be as simple as .jpg with a different extension maybe? Try having a look in a hex editor and seeing if it matches anything in garykessler.net/library/file_sigs.html
    – Alan B
    Jan 17 at 8:37
  • Have you tried using the Linux/Unix file command (file FILENAME.tpg)? My hunch is that it's a proprietary format though. Jan 17 at 15:16
  • @AlanB Good advice. I'm new to this kind of investigation and was unclear what steps to take. I'll definitely try that (yes, I saw that recent TPG format; this one predates that by quite a long time) Jan 17 at 22:58
  • @AlexHajnal No, I haven't tried that. I'll give it a shot, just in case I get lucky. Thank you. Jan 17 at 22:58
  • 1
    Here's my two cents, i'd say TPG stands for TIM packed graphics, TIM being the format for bitmaps uploadable to PSX VRAM, it's probably packed with some LZ variant as it's pretty common in PSX. You may be able to spot a few things by running the game in no$psx, open the TTY Debug Messages and see if the game outputs any. Also, to further confirm it's graphics, you could swap two files and watch VRAM debugger (F5 key); to swap them, swap file names in ISO9660 header at sector 16 (see PDF of ECMA-119 specs). Alternatively, try github.com/cebix/psximager to rebuild a modified ISO.
    – aybe
    Jan 19 at 0:34

1 Answer 1

3

NOTE: this is rather a long and formatted comment than a definitive answer, moderators may decide to move it to Reverse Engineering as that's the subject we're slowly drifting into.

A quick and dirty introduction to PlayStation VRAM:

enter image description here

References:

Programmers Tool CD 2.2:

TIM Tool, to understand the VRAM @ \PSXGRAPH\BIN\TIMTOOL.EXE:

enter image description here

Technical Reference CD 2.3:

File Formats PDF, describing the TIM format @ \Devrefs\Filefrmt.pdf

You can grab an archive of both of these CDs at psxdev.net.

Try identify TPG format by editing the ISO file directly:

You may want to pinpoint what TPG files really are, as the format looks like no well-known format, you can try the following approach and tools to assert that indeed TPG is a format containing graphics and if it's the case, further proceed in trying to decipher it.

There are 26 .TPG files in the disc, 13 pairs of identical names:

G:\BBRO\HUS_BAR.TPG
G:\BCEL\CEL_HUS.TPG
G:\BCEL\CEL_MAZ.TPG
G:\BCEL\CEL_TMP.TPG
G:\BCEL\CEL_WOD.TPG
G:\BCEL\DAM_CEL.TPG
G:\BCEL\MIN_CEL.TPG
G:\BCEL\MIR_CEL.TPG
G:\BDAM\DAM_CEL.TPG
G:\BDAM\DAM_RIV.TPG
G:\BHDS\MIR_DED.TPG
G:\BHUS\CEL_HUS.TPG
G:\BHUS\HUS_BAR.TPG
G:\BHUS\HUS_WOD.TPG
G:\BMAZ\CEL_MAZ.TPG
G:\BMIN\MIN_CEL.TPG
G:\BMIR\MIR_CEL.TPG
G:\BMIR\MIR_DED.TPG
G:\BMIR\MIR_TMP.TPG
G:\BRIV\DAM_RIV.TPG
G:\BRIV\RIV_WOD.TPG
G:\BTMP\CEL_TMP.TPG
G:\BTMP\MIR_TMP.TPG
G:\BWOD\CEL_WOD.TPG
G:\BWOD\HUS_WOD.TPG
G:\BWOD\RIV_WOD.TPG

The list of occurrences in TOC in byte order:

HUS_BAR.TP00000 54,419  
CEL_HUS.TP00000 663,587 
CEL_MAZ.TP00000 663,647 
CEL_TMP.TP00000 663,707 
CEL_WOD.TP00000 663,767 
DAM_CEL.TP00000 663,827 
MIN_CEL.TP00000 663,887 
MIR_CEL.TP00000 663,947 
DAM_CEL.TP00001 3,700,019   
DAM_RIV.TP00000 3,700,079   
MIR_DED.TP00000 4,890,131   
CEL_HUS.TP00001 5,515,651   
HUS_BAR.TP00001 5,515,711   
HUS_WOD.TP00000 5,515,771   
CEL_MAZ.TP00001 6,609,331   
MIN_CEL.TP00001 7,209,315   
MIR_CEL.TP00001 8,265,251   
MIR_DED.TP00001 8,265,311   
MIR_TMP.TP00000 8,265,371   
DAM_RIV.TP00001 9,622,243   
RIV_WOD.TP00000 9,622,415   
CEL_TMP.TP00001 10,967,587  
MIR_TMP.TP00001 10,967,647  
CEL_WOD.TP00001 11,915,443  
HUS_WOD.TP00001 11,915,503  
RIV_WOD.TP00001 11,915,563  

The list of occurrences in TOC in name order:

CEL_HUS.TP00000 663,587 
CEL_HUS.TP00001 5,515,651   
CEL_MAZ.TP00000 663,647 
CEL_MAZ.TP00001 6,609,331   
CEL_TMP.TP00000 663,707 
CEL_TMP.TP00001 10,967,587  
CEL_WOD.TP00000 663,767 
CEL_WOD.TP00001 11,915,443  
DAM_CEL.TP00000 663,827 
DAM_CEL.TP00001 3,700,019   
DAM_RIV.TP00000 3,700,079   
DAM_RIV.TP00001 9,622,243   
HUS_BAR.TP00000 54,419  
HUS_BAR.TP00001 5,515,711   
HUS_WOD.TP00000 5,515,771   
HUS_WOD.TP00001 11,915,503  
MIN_CEL.TP00000 663,887 
MIN_CEL.TP00001 7,209,315   
MIR_CEL.TP00000 663,947 
MIR_CEL.TP00001 8,265,251   
MIR_DED.TP00000 4,890,131   
MIR_DED.TP00001 8,265,311   
MIR_TMP.TP00000 8,265,371   
MIR_TMP.TP00001 10,967,647  
RIV_WOD.TP00000 9,622,415   
RIV_WOD.TP00001 11,915,563  

Now what you'd want to try is, with an hex-editor to swap the names to try identify which are which while you watch the VRAM loading in no$psx.

As there are dupes, you could try the following to further identify them:

  • give a file a wrong name such as ABC_DEF.TPG
  • save the ISO file
  • open no$psx
  • open TTY debug console
  • launch the game
  • watch the TTY console
  • the game should crash
  • check TTY for something like CdSearchFile ... not found

At this point you should be able to make the distinction between dupes, take some notes.

Once you know what file really is, you can finally watch the VRAM debugger when the game loads and try visually identify what's the content of the file.

Here's the VRAM debugger in action in no$psx:

enter image description here

Now you may want to use PSX VRAM Viewer to inspect the VRAM in detail:

Grab PSX VRAM Viewer, your A/V may say it's a threat but it really isn't, alternatively, you can build it from the sources by yourself.

I've ran it for the introduction screen, luckily, this was an easy one:

enter image description here

Check the keyboard shortcuts in README.md on how to use the viewer.

Getting started with no$psx and PSX VRAM Viewer:

no$psx only works with consolidated .BIN/CUE, an image with separate audio tracks is not supported by it.

Create a proper image with IsoBuster, for instance:

  • right-click CD
  • Extract CD
  • Raw (*.bin)

Configure no$psx to write snapshots readable by PSX VRAM Viewer:

  • Options
  • Files
  • SAV/SNA File Format
  • Uncompressed

Save a snapshot to browse with PSX VRAM Viewer:

  • File
  • Write snapshot

Load the snapshot in PSX VRAM Viewer:

  • in Windows Explorer, drag and drop the .SNA on the executable

About the TPG format itself:

It's most certainly an LZ-compressed format as commonly seen on PSX, but as there isn't any official compressor in the SDK, everyone went out with their own implementation, which of course differs.

That said, reverse-engineering in general is a very time-consuming task, hence my suggestion of first trying to figure if these are really what you're looking before spending a lot of time in trying to decipher.

Last, you may get some precious advice from the folks at ROMhacking.net forum.

Also, if you have programming skills, you can always try Ghidra along the PSX plugin, it'll generate pseudo-C much easier to study than MIPS assembly.

4
  • 3
    Great answer. I think it's fine to answer it here - the content is more important than the method. :)
    – knol
    Jan 20 at 12:29
  • Thank you, I appreciate it :)
    – aybe
    Jan 20 at 15:21
  • 1
    This goes above and beyond and acts as a good introduction into a world I have no experience in. I appreciate you taking the time to prepare such a thorough, and even content-specific!, look into this. Really appreciated. I started looking at no$psx a couple of days ago and felt a little lost, so thanks also for the resources on where to turn to next. Jan 20 at 22:09
  • 1
    Glad it helped out, if somehow you figure out the TPG format, do not hesitate to post your own answer to your question, we'll be eager to know how you did it :) PS I just added one last thing, about Ghidra and the PSX plugin, at the end of the answer.
    – aybe
    Jan 21 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.