Page 1 of 2

Editing captions

Posted: Sun Apr 21, 2019 10:45 pm
by Velociraptor Alfa
Is there any comprehensive tutorial how to edit/change captions (subtitles) in Trespasser? I know how to edit hints and the tutorial via the CE patch, but what about those in TPA files?

Re: Editing captions

Posted: Sun Apr 21, 2019 11:37 pm
by Rebel
A program could be written to do that, but at the moment there isn't one. I think TSord's
Trespasser Sound Editor might have had something like that in mind, but I never could get
that program to load, let alone run.

I imagine either I or machf could do it, but I won't have any free time until next weekend;
I wouldn't know how much free time machf might have. What is your intent anyways? Use
a different language?

Re: Editing captions

Posted: Sun Apr 21, 2019 11:47 pm
by Velociraptor Alfa
Yeah, I would like to translate it into my native language. But there's no need to hurry. I was just wondering if it's even possible to do.

Re: Editing captions

Posted: Mon Apr 22, 2019 6:06 am
by machf
The simplest solution is extracting everything to .CAU files, editing the captions for those .CAU files, and assembling back the .TPA files. We'd need a way to keep track of the original sound IDs, though...

Re: Editing captions

Posted: Tue Apr 23, 2019 11:32 pm
by Rebel
machf wrote:The simplest solution is extracting everything to .CAU files, editing the captions for those .CAU files, and assembling back the .TPA files. We'd need a way to keep track of the original sound IDs, though...
Ya, I'm thinking something along those lines, a little different, but pretty much the same. The program (let's call it 'caption_editor'), would load the tpa, displaying the captions. In another edit cntl, type in the replacement words, export that as a cau file assigned with the ingame Id sample name (not that difficult to do). Once you've exported all the new .cau files, use tpa player's *caus_to_*eel function, then use the *eel to *tpa function to create the new tpa file. Of course, you'd also export those files (like music) that don't have captions attached too, and the few samples that we may not have the Ids to would simply export as unknown_1, unknown_2 etc.

I may screw around with this concept when the weekend comes 'round. Just thinking about it while daydreaming while at work today, I came to the conclusion that it'd be a nightmare attempting to replace and readjust the sample' size inside the tpa, and updating all the offsets for each entry affected. Not to mention you'd be copying and/or rewriting the tpa after every entry; way too slow and problematic -

Re: Editing captions

Posted: Wed Apr 24, 2019 1:35 am
by machf
The ideal way is to make an .eel file but using the sound hashes instead of the sound names, that way it doesn't matter if we don't know the name used for a sound in the .TPA file. And I had asked Lee some time ago if he could make it so that EffectsEditor could process such modified .eel files... maybe listing the sound hash between triangular brackets (< and >) to differentiate it from sound names.

Also, keep in mind that, when you extract the sounds from a .tpa file to .cau files, the name that ought to be used should be a reference to the sound sample number, not the sound ID (name) number (since the same sound sample can be referenced by multiple sound IDs), and the .eel file should be generated at the same time...

Re: Editing captions

Posted: Wed Apr 24, 2019 4:51 am
by Draconisaurus
I thought TPA Reader could already do this?

Re: Editing captions

Posted: Thu Apr 25, 2019 11:39 pm
by Rebel
Also, keep in mind that, when you extract the sounds from a .tpa file to .cau files, the name that ought to be used should be a reference to the sound sample number, not the sound ID (name) number (since the same sound sample can be referenced by multiple sound IDs), and the .eel file should be generated at the same time...
Err? I'm not following you, machf. If your intent is to say replace 'Welcome to the city of Tomorrow' and the Ingame string sample is VA11 (I actually don't recall the correct number that comes after VA**), you'd want the exported .cau file to be named that and then assigned to that sound being added to the *eel file so that when the new tpa is created (we're not editing the tpa being reviewed) the original string samples are still valid within the tscripts. Or, am I misunderstanding what you are laying out?

@Drac: The reader can assign new captions, yes, but to a wav file (convert button). So, you'd have to export the sound you'd want as a wave, then add the captions before you use the convert to export the .wav as a .cau. So, yeah, in a more drawn out process, you could do this with the reader, but it'd take considerably more time since you'd have to make certain that you are typing in the correct caption data. I think, but don't quote me on this since I may be wrong, but if you do save a sound as a wave file and it has attached captions, a companion txt file with said captions are exported along with the wav. Then, of course, after you did produce all the .cau files you needed, you'd have to either use the effects editor (or the player (I no longer recommend using the reader to build tpa files) to add all the .cau files 1 by 1, or as I mentioned above (if you name the .cau files appropriately), use .caus to *eel function to crank out the eel file so it can be used to create a new tpa.

No matter how this is done, it is time consuming. There's something like what, 450+ entries in the retail stream tpa file? That's alot of entries to go through, especially considering that most do indeed have captions attached to them.

Re: Editing captions

Posted: Fri Apr 26, 2019 1:50 am
by machf
Rebel wrote:
Also, keep in mind that, when you extract the sounds from a .tpa file to .cau files, the name that ought to be used should be a reference to the sound sample number, not the sound ID (name) number (since the same sound sample can be referenced by multiple sound IDs), and the .eel file should be generated at the same time...
Err? I'm not following you, machf. If your intent is to say replace 'Welcome to the city of Tomorrow' and the Ingame string sample is VA11 (I actually don't recall the correct number that comes after VA**), you'd want the exported .cau file to be named that and then assigned to that sound being added to the *eel file so that when the new tpa is created (we're not editing the tpa being reviewed) the original string samples are still valid within the tscripts. Or, am I misunderstanding what you are laying out?
It's not quite like that. Look for example at the retail Effects.tpa file: Sound ID #3, "DRY FIRE A", points to the same Sound Sample as Sound ID #178, "GUN - AUTOMATIC DRYFIRE 01". And there are several more examples like that in the .TPA files of the various Trespasser builds. That's the reason why the number of Sound IDs (formerly "WTEs") in a .TPA file doesn't necessarily match the number of Sound Samples (formerly "WBblocks") in the same file. Since more than one Sound ID can point to the same Sound Sample, this inequality follows:

Code: Select all

#SoundIDs >= #SoundSamples
If you extract a .CAU file for each Sound ID and assign it a name based on the Sound ID itself, you'll end up with some .CAU files that are identical, and once you rebuild a .tpa file from them, it will be unnecessarily larger than the original .TPA file. If you instead use the .TPA file name and Sound Sample # for the name of the .CAU file, you don't have that problem, and an .eel file is generated at the same time. Keep in mind that the .eel file can keep track of the .CAU file each Sound ID is pointing to, and so they have no problem whatsoever processing multiple Sound IDs pointing to the same .CAU file when building a .TPA file with Effects Editor...

And if you were able to use the Sound Hash instead of the actual Sound ID when generating the .eel file (and later loading it into Effects Editor), you wouldn't have to worry about any unknown Sound IDs, as the new .TPA file would just directly store the Sound Hash instead of having to recalculate it from the Sound ID... but as I said, that would require a modification of Effects Editor, which I have asked Lee about, but haven't had a reply yet, IIRC...

Re: Editing captions

Posted: Fri Apr 26, 2019 10:52 am
by Rebel
Yeah, but duplicate ids don't exist inside the stream tpa, so that really isn't a concern in as far as that
tpa. In as far as the effects.tpa pointing to the same samples, the only difference would be that you'd
have a few additional caus being added in the rebuild. The tpa would simply have a few duplicate sounds
that have different sample names attached to them. The end result would be that both the number of
entries and number of samples would match, just like the stream or menu tpa. It really isn't a problem
at all.

Re: Editing captions

Posted: Fri Apr 26, 2019 4:44 pm
by machf
It may not be a problem quite, but it's wasted space... and keep in mind that aside from the "standard" voiceovers in the Stream.tpa file, there are other ones in Effects.tpa which have captions too...

Re: Editing captions

Posted: Fri Apr 26, 2019 7:19 pm
by Rebel
Yeah, but the wasted space would be rather small, machf. Just a few kilobytes. Considering the size of
the tpas, it's rather miniscule.

I already have a working prototype, It's just not ready for primetime yet -

Re: Editing captions

Posted: Fri Apr 26, 2019 11:15 pm
by machf
I'll eventually work on a program that dumps the contents of a .TPA file as a set of .CAU files and an .EEL file, anyway. I've had the idea for a long time, now after having handled that TPA udpater it's going to be easier since I can reuse parts of the code. And for the rest I can convert the code of my old QuickBASIC .CAU extractors... and instead of dumping the contents of the TPA file to a .CSV file, now I'll be dumping it to an .EEL file which is also text. Fairly easy.

Re: Editing captions

Posted: Sat Apr 27, 2019 12:26 am
by Rebel
machf wrote:I'll eventually work on a program that dumps the contents of a .TPA file as a set of .CAU files and an .EEL file, anyway. I've had the idea for a long time, now after having handled that TPA udpater it's going to be easier since I can reuse parts of the code. And for the rest I can convert the code of my old QuickBASIC .CAU extractors... and instead of dumping the contents of the TPA file to a .CSV file, now I'll be dumping it to an .EEL file which is also text. Fairly easy.
Well, it's a good think you're getting more involved with programming, machf. Who the hell knows how much longer I'll be alive. :lol:

Anyhoo, V.Alfa, the program in the zip below should be able to do what you want. But, I cannot stress this enough; please review the readme file in full.

I've tested the program on the ruins stream.tpa file, it only has 50 entries, but it seemed to work fine. Work on only 1 tpa at a time, otherwise you'll have cau files inside the caus_out folder that don't belong. Once you've completed the tpa review and added your new captions, then click the 'Done Button'.

You don't have to do this all at once, though you probably should. If you stop at say 100, when you reload the tpa file again, type in 101 and click 'set entry no#' button. That'll allow you to skip to where you stopped before and continue from there.

Everything you need to know should be either in the instructions pasted on the program's window, or inside the readme file. Again, please read it before you use the program -

*consider the program version 'alpha'

Re: Editing captions

Posted: Sat Apr 27, 2019 8:20 am
by Velociraptor Alfa
Thank you, Rebel. I'll try it and let you know.