entropia / tip-toi-reveng

Trying to understand the file format of Tip Toi
http://tttool.entropia.de/
MIT License
637 stars 121 forks source link

Replace audio files in GME files #142

Open nomeata opened 7 years ago

nomeata commented 7 years ago

Many users want to replace audio files in existing GME files without destroying it. Although such functionality would have to be implemented mostly separately from the existing code, it would probably be worth it.

We should see if things break if the audio files are larger than the ones they replace.

CyBot commented 4 years ago

I just tried doing that manually, and it seems to work - modified audio and existing games. All the offsets of the following files/tables have to be adapted of course. IMO this would be a great addition.

nomeata commented 4 years ago

If we assume that all the GME code that we do not understand address audio through the table index (and not direct offsets), and if we add new or large files at the end of the file, so that we do not break any existing offsets, then this could indeed work quite flawless.

uli42 commented 4 years ago

On Fri, Dec 27, 2019 at 12:00 PM Joachim Breitner notifications@github.com wrote:

If we assume that all the GME code that we do not understand address audio through the table index (and not direct offsets), and if we add new or large files at the end of the file, so that we do not break any existing offsets, then this could indeed work quite flawless.

As we are using indices everywhere else and my game structure analysis from years ago revealed indices as well there's no reason to assume otherwise. As some games are stored in the firmware the offsets would be visible in the gme file. And there's no indication so far. From a practical point of view using offset would mean rewriting all binary game blobs on every change. And it would also mean the creator would have to handle offsets and indices for the same sound which is error-prone.

So IMHO offsets are highly improbable

Uli

CyBot commented 4 years ago

If we assume that all the GME code that we do not understand address audio through the table index (and not direct offsets), and if we add new or large files at the end of the file, so that we do not break any existing offsets, then this could indeed work quite flawless.

I just replaced an audio file in the middle (by a longer file) and fixed all the addresses (in fact there seem to be no offsets, all addresses are absolute), and the book still works flawlessly

nomeata commented 4 years ago

But that can only work if there is nothing behind the audio files that gets moved, right? It seems more reliable to me to place new audio files always at the end.

CyBot commented 4 years ago

Other audio files and game binaries came after the modified audio file. Changing the addresses in the header and file tables was sufficient, at least for the book I tried it on.