Opened 3 months ago
Closed 2 months ago
#15514 closed defect (fixed)
SCI: KQ5CD Issue with the audio when adding text dialogues multilingual
Reported by: | LaZar00 | Owned by: | sluicebox |
---|---|---|---|
Priority: | normal | Component: | Engine: SCI |
Version: | Keywords: | ||
Cc: | LaZar00 | Game: | King's Quest 5 |
Description
ScummVM Version: any (tested with 2.0.0 (GOG version of KQ5 CD), 2.1.0, 2.8.1)
Game/Language: KQ5 CD Talkie English (GOG version)
OS: PC Windows 11
Bug:
I decided open this ticket to report a strange behaviour in King's Quest V CD Talkie english version under ScummVM.
This version has NOT dialogue boxes for spoken dialogue in game. I decided to do add them modifying the code with SCI Companion 3.0.1.7. I had success adding them and show the dialogues with the audio and it works well in ScummVM and DosBox (for one unique language).
Ok, now here comes the issue and the reason I decided to open the ticket.
I added the feature to show multilingual text (in my case English/Spanish). This feature works for example when we have a string like "{Hello#SHola}", and when selecting the language (lang=en or lang=es) scummvm should show "Hello" for english and "Hola" for spanish.
Ok, what I have done for make this possible? I have added into Main.sc the properties for parseLang and printLang to 34. I have also a switch in "about" window for change among language 1 (english) and language 34 (spanish).
Using this method, this DOES NOT work in ScummVM, BUT, surprisingly, it WORKS in DosBox. I can change the language and I can see the texts with the language specified in printLang y parseLang when set in Main.sc.
So, this is a big difference between how sci engine works in DosBox and how it works ScummVM (at least for this specific game).
I think that somehow, in this game specifically [KQ5 CD Talkie english], the language is set by DoAudio kernel function (in scummvm). So, if we use another language, it looks for that audio, and as it does not exists, does not makes the change. But what scummvm should do is use the default language (english) as it does commonly with the texts.
Do you think you could apply this to ScummVM? To make the sci engine work as in DosBox?
If you have any further questions don't hesitate to ask. And sorry for my english, I'm not native english speaker.
Attachments (1)
Change History (22)
by , 3 months ago
Attachment: | kq5cd-DoAudioSetLanguage.jpg added |
---|
kq5 cd kDoAudio / Language disassembly
comment:2 by , 3 months ago
Summary: | [KQ5 CD] Issue with the audio when adding text dialogues multilingual → SCI: KQ5CD Issue with the audio when adding text dialogues multilingual |
---|
comment:3 by , 3 months ago
¡Hola, LaZar00!
That's impressive that you're making a KQ5CD mod with text and speech *and* in Spanish. Can it display text while playing speech at the same time?
I agree that you should be able to toggle between English and Spanish text with KQ5:printLang
while separately controlling which audio files to use with kDoAudio \ kSciAudioLanguage
. You've figured out a lot!
While the KQ5CD interpreter code for this is straightforward (Thanks, Martin!), our code is trickier because of all the versions it supports. I am cautious about making changes there, so I think we need a test case so that we can make sure we're fixing this for you while not breaking anything else.
I will try to manually recreate the scripts you've described (decompile, alter, recompile), but if that doesn't work, I may ask you to privately share your mod so I can make the right adjustment.
comment:4 by , 3 months ago
Hi sluicebox,
It is a pleasure to meet you. I looked a LOT of your KQ5 CD source code in github to understand Sci (amazing work btw). I'm very beginner in it. I have even downloaded scummvm source code to understand some things (which helped me to found how to use audio files for localized language) and registered in sciprogramming doing some questioning to kawa or the people there. xD
This is a sample of the intro with dialogue boxes:
Youtube KQ5 CD Intro with speech+text
I have even rm001 stage done and part of the menu. I programmed two or three functions that help me to show message boxes similar to DLetter.sc and Printf (in new scripts). Only with procedures, I have not defined new classes. I try to left it all centralized in 2-3 scripts, but I have to do some minor changes in specific strings. For example, when the kDoAudio function is present, I need to modify that script.
Ok, about our issue in question.
I have finally made possible the change of the language in game, but in scummVM does not work the lang property in the .ini file by default. This is my Main.sc source code:
(instance KQ5 of Game (properties parseLang 34 printLang 34 ) (method (init &tmp [temp0 270] temp270 [temp271 19] temp290) (= global394 1) ;(DoAudio audLANGUAGE 1) ; for English (DoAudio audLANGUAGE 34) ; for Spanish (DoAudio audRATE 11025) (if (and (>= (= global105 (Graph grGET_COLOURS)) 2) (<= global105 16)) (= global159 0) else (= global159 1) )
And I needed to copy AUDIO001.MAP to AUDIO034.MAP and the file AUDIO001.002 to AUDIO034.002. This has helped and has made the subtitles with printLang 34 available. But the thing is that in DosBox I DON'T NEED to do this. It seems Scumm does not defaults to the english audio when it has not the files with the voices. I checked the code in github and seen that this is the issue, that's why I have copied the files of the audio with the number/code of the language.
In DosBox it works directly, without the files for the language (it gets by default the English one XXXXX001) and I don't need either to use the "DoAudio audLANGUAGE 34". It seems only needs the printLang and parseLang code of the spanish language. I don't even know if this flag of DoAudio audLANGUAGE is useful. I mean, at the end, the game uses printLang anyway, right? But it could be interesting for localized voices (if anytime somebody a bit crazy decides to do them).
PD: In any case, I want to use a solution that works with ScummVM 2.0.0 (the one supplied with GOG version), and I have this alternative (although this is not accurate with the SCI Engine).
PD2: If you need any code I will supply, but I think you need only Main.sc with the code I pasted. Then use the own SIERRA intro where it shows "Present", and after, the KQV shot asking if you have played the game previously (using multilingual texts, of course). With that, you should have enough.
PD3: Oh, I forget. For change language in game I have in about.sc:
(instance about of Code (properties) (method (doit &tmp temp0 [temp1 255]) (= global394 (DoAudio 9 -1)) (switch (= temp0 (Print 756 0 33 1 81 {About KQV#SSobre KQV} 1 81 {Help#SAyuda} 2 81 {Cancel#SCancelar} 0 81 {Spanish\nMessages#SMensajes\nen ingl‚s} 3 ) ) (1 (Format @temp1 756 1 gVersion) (Print @temp1 #mode 1) (Print 756 2 70 210) (Print 756 3 70 210) (Print 756 4 70 210) (Print 756 5 70 210) (Print 756 6 70 210) (Print 756 7) (Print 756 8 70 210) (Print 756 9 70 210) ((File new:) name: {HELP.TXT} read: @local0 100 close: dispose: ) (Printf 756 10 @local0) (DisposeScript 993) ) (2 ((ScriptID 753) doit:)) (3 (if (== (gGame printLang?) 34) (gGame printLang: 1) (DoAudio audLANGUAGE 1) else (gGame printLang: 34) (DoAudio audLANGUAGE 34) ) ) ) ) )
This helps me to change language in game directly. In DosBox, I don't need the "DoAudio audLANGUAGE". With ScummVM I need it to work. With the audio files for the localized language, of course.
comment:5 by , 3 months ago
I think I have this working. I want to make sure that these changes are what you are looking for, because our language code is complex.
Changes to separate the text and audio languages, as in the original:
kDoAudio 9
will only change the language used forAUDIO###
filesprintLang
will no longer be affected by thekDoAudio 9
language- The
kDoAudio 9
language will default to the scummvmgetLanguage()
function, and if there is noAUDIO###.MAP
for this, fall back to English. This probably doesn't affect you, because you will probably be callingkDoAudio 9
to set your own default language.
Would that solve it?
I am thrilled that the sci-scripts repository helped you and your project. That was the dream!!
Note to SCI devs: This is not a scary change, because it only affect games that use AUDIO###
files. That's just KQ5, GOOSE, and JONES -- and only CD versions.
comment:6 by , 3 months ago
If you want I can test the build. I've seen some different builds and not sure what download. I have the choices of "Latest Branch Master" and "ScummVM stable Future 2.9.x". I tested the first one without any success. The game runs, but I have not audio (I only have the English audio files for this test). See picture.
BTW: In the original game, I have not any need to use kDoAudio for setting language. I added it for use with scummvm (v2.0.0), then this release works. But the original sci compiler don't think use it really.
BTW, here es a sample of English/Spanish subtitles in game:
https://youtu.be/_8V5YVW38mo
comment:7 by , 3 months ago
Is your plan to keep the kAudio language as 1 and distribute your own AUDIO001 files to overwrite the existing ones? I just want to make sure I fully understand what you're doing before making changes.
comment:8 by , 3 months ago
Ok sluicebox. I don't pretend you modify scummvm for my mod to work. My intention is (and I think it is the best for everybody) that scummvm works (interprets) the original code of SCI Compiler.
In DosBox, if I don't use the (DoAudio audLANGUAGE 34), which would set the audio pack to that language, it defaults anyway to audLANGUAGE 1 (English). This is how it works I think. And as I said, I had to put this flag 'audLANGUAGE 34' (and duplicate the audio file/map to 34) because of scummvm 2.0.0, which is provided with GOG version of the game.
At the end, in DosBox, it works well only setting in Main.sc as properties printLang and parseLang as 34. That's why I said that maybe the audLANGUAGE is not useful. If we had the audio for localized languages, it would have some more sense, but AFAIK, this KQ5 CD Talkie version, is only existant in English. But, in any case, is possible to use localized language if someone makes the voices and creates the audio packs. So, it is not so easy what to do with this feature. You could even set a language for the texts, and a language for the audios, but I think this is out of our scope right now.
Apart of all this, if ScummVM does the things as in DoxBox, I will have not the need to supply the localized audio files (again about 100Mb more of data), only the resource files with the translation.
comment:9 by , 3 months ago
only the resource files with the translation
Hello LaZar00,
PLEASE do not do that. If you offer the whole resource files, that's a big copyright violation and we don't add such games to ScummVM, because it's like a stolen/pirated copy.
We handled the original Space Quest 4 "fan-patch", which combined SQ4 Floppy and SQ4 CD, that way as well, because the "fan-patch" was literally the whole game as a download. I think that one even got blocked by us, which caused angry people, who didn't understand that ScummVM does not support piracy in any way shape or form. This got changed to patch files, which is fine, because you need a copy of the game to use them.
So please use patch files instead.
And best: try to not recompile scripts, because that will change offsets, which right now will break saved game compatibility. I worked on a change for the saved games, so that these wouldn't matter anymore, but it's not completed. If you have to, try to keep the amount of script patches very low, if you can.
follow-up: 12 comment:10 by , 3 months ago
Owner: | set to |
---|---|
Resolution: | → invalid |
Status: | new → closed |
@m-kiewitz:
Then I ask you to close this issue and revert back all the changes about this ticket (done by sluicebox) in scummvm because it will be totally useless. I will do my patch anyway and supply it as I want. I understand your point of view as ScummVM tough.
a.) I could use patch files, but then I will have nearly 60% of scripts in files .scr/.tex (but this is doable). Maybe more.
b.) I NEED to recompile each of that scripts. I don't understand how I will add dialogue boxes that will be shown correctly if I don't do this. Some of the rmXXX has positions x/y for the portraits and I need to change them for position correctly the dialogue boxes. I try to limit them, but it is not very doable here. I don't know how SQ4 is done, but KQ5 is a pain in the ass. I had to check near every script for the flags/codes that play any audio.
c.) There WILL BE offsets changed, it is IMPOSSIBLE to add dialogue boxes if I don't recompile the scripts. Basically Main.sc has the main code for calling external (new scripts) procedures that show the texts. So, you can be sure that the saves will not be compatible with text version.
d.) Although very difficult, I was thinking to make this compatible with DosBox. Right now I'm putting all the links of audio<->texts in one file, but can be put in different files (I would have to see how this could be done yet). But I'm not sure that individual files will work in DosBox.
Well, that's my position. I assume you will modify ScummVM to make it work as SCI Interpreter. But I'm not sure that it will ever be used. Maybe I should have not opened this ticket. :(
BTW, if you want to contact with me in some way, don't hesitate to do it. I assume you can contact privately somehow.
PD: In any case, think this:
- If I only supply the resource files with the translation (recompiled scripts, bla bla bla...), the game will not work unless you have the full game. This means that YOU WILL NEED THE AUDIO FILES for make it work correctly. Without the audio files (which I have not intention to supply) the game will not work (at least with the Scumm of the GOG version).
comment:11 by , 3 months ago
Hello LaZar00,
ScummVM as well as the original SCI interpreter have no problem with hundreds of patch files, if not even thousands.
If you think there is no other way than to recompile 60% of the scripts, go ahead.
I was simply saying that this will break saved game compatibility, not just in ScummVM, but also in original SCI. It was just a warning, nothing more.
You SHOULD use patch files regardless.
Please know that Sierra games are now owned by Activision and they are actively selling them.
You are opening yourself up to legal problems releasing the whole game like that including all of the copyrighted images and views. I advise that you don't do that, but of course you can do whatever you want.
comment:12 by , 3 months ago
Resolution: | invalid → pending |
---|
Replying to LaZar00:
@m-kiewitz:
....
PD: In any case, think this:
- If I only supply the resource files with the translation (recompiled scripts, bla bla bla...), the game will not work unless you have the full game. This means that YOU WILL NEED THE AUDIO FILES for make it work correctly. Without the audio files (which I have not intention to supply) the game will not work (at least with the Scumm of the GOG version freezes in Sierra intro). I can confirm it. Even it will not work correctly in DosBox (dialogue boxes runs too fast).
comment:13 by , 3 months ago
Resolution: | pending |
---|---|
Status: | closed → new |
Hey guys, I spent quite a while yesterday developing and testing the fix for this, so why don't I decide the status and resolution of this ticket.
I'm not sure what all has been typed on this ticket in the past few hours, but it doesn't have anything to do with the legitimate inaccuracies I'm seeing in our code. Just chill everybody =)
comment:14 by , 3 months ago
Yes, I'm very sorry. I closed it because the last talk, but I decided open it because this solution is not closed (maybe we talked about other things not relevant for this issue), and I even didn't know how to assign it again as new.
I'm very sorry, really.
comment:15 by , 3 months ago
Hello LaZar00,
Games don't require the audioxxx files to start.
I even just tried it, KQ5 CD works fine without the audioxxx files.
But you will have added text support, which means the rest of the game will totally work and you can fully play it, because of the added text.
And regardless, you would be uploading tons of copyrighted material, that you don't have to upload for your translation to work.
Please really think about what you are doing. There is no reason not to use patch files.
This is nothing against you, you have good intentions, I want to protect you from legal trouble.
And the bug here needs to get fixed regardless, because it's an inconsistency.
comment:16 by , 3 months ago
"Games don't require the audioxxx files to start"
You're right with DosBox, but the game is unplayable.
With the ScummVM release of the GOG version freezes in Sierra intro. So, it is NOT playable.
I would say that in latest ScummVM release, if it works as DosBox, the game is unplayable also because you don't have speech or text.
If we add the text (at least as I am doing it), some things depend on timers. In the text version you must click for close the dialoguebox. The version I'm doing closes directly de dialogue box after a timer (normally you need the audio). And in the cinematics, you can even read the text of the dialogue boxes if there is no audio, but very FAST.
So, in any case, I consider the game unplayable.
You are right about the copyrighted material like views, pics, sync, etc... tough. So, I will try to make a version with external/patched files (.scr/.tex/.fon). But I don't know what happens when you use a script (like 303.scr) and it does not exists in RESOURCE.MAP/RESOURCE.000/RESOURCE.001. Will it work? I have created 4 scripts inexistant in the original RESOURCE files, because I need some procedures to show the text in specific way, link the speech<->text... I have a good amount of lines for this and I am at rm057.scr script yet. So, I'm not totally sure it will work with patch files.
I totally agree with you about the bug/issue we have in question in this ticket.
BTW, I appreciate your consideration. But I think the best right now is to focus in our bug.
comment:17 by , 3 months ago
But I don't know what happens when you use a script (like 303.scr) and it does not exists in RESOURCE.MAP/RESOURCE.000/RESOURCE.001. Will it work?
Yes, that will work.
ScummVM supports the various different patch file naming schemes, while the original interpreter only supports one format. I'm not sure, which file naming scheme SCI1 uses. You will have to figure that out, so that the patch files are read by the original interpreter too.
EDIT: It's xxxx.scr, instead of script.xxx. The latter was used by SCI0. The former is used by SCI1 and 1.1. I think it was changed again for SCI32. As I said ScummVM supports them all regardless of interpreter version (as far as I remember), but the original interpreter won't.
btw. in fact you can even load EGA SCI0 views for VGA SCI1 games in ScummVM. The original interpreter won't like that.
Please also keep in mind that some people want dual mode, which means speech as well as text at the same time.
So if you can, maybe support that as well. In fact that's a feature that tons of people would love in KQ5 CD, but we can't patch that in, because the text itself is missing in KQ5 CD.
comment:18 by , 3 months ago
I don't understand the "dual mode". My intention is use speech+text in the game, I will have not any checkbox for only have speech or only have text. The first is the own game by default, the second, well, sorry, but I will not do that. Maybe deleting audio files? Who knows...
You can see the latest video I posted in comment #6 (gameplay), it has speech and text (multilingual).
comment:19 by , 3 months ago
"dual mode" is audio + subtitles at the same time, exactly what you are doing.
Sierra games had 3 options: SPEECH (audio only), TEXT (subtitles only) and DUAL (audio + subtitles), a few times DUAL was missing, but we managed to patch that into games, for example King's Quest 6.
comment:20 by , 3 months ago
The KQ5 CD version is all digital. This means that the music is encoded in AUDIO resource files. I think that there is not any possibility to use MIDI or analog audio. Not sure 100% about this though. So the "subtitles only" option would be a bit "empty". I mean, you will have subtitles, but no Music.
But I think the most expected version of KQ5 CD is one with both things.
PD: I've been following ScummVM since its younger stages, when FM-Towns was not supported yet and everybody wanted to play Loom or Zak McKracken in VGA256 and english. Now it has advanced a lot. It even plays games like Ultima VIII, which I can assure that some of the intrinsics are difficult to reproduce unless you know how the opcodes work. And some functions (files) call another functions (other files) jumping like crazy. IT IS IMPRESSIVE.
comment:21 by , 2 months ago
Owner: | changed from | to
---|---|
Resolution: | → fixed |
Status: | new → closed |
I just checked disassembly of the KQ5-CD SCI interpreter version.
It tries to load the audio-resource-map (AUDIOxxx.MAP). If it fails, it reverts TO THE PREVIOUS language and loads that (again).
It also defaults to language 1 (US English) on startup.
It also returns the audio language that was successfully set in acc.