Author Topic: Converting sciAudio to Sierra Script  (Read 538 times)

0 Members and 1 Guest are viewing this topic.

Offline EricOakford

Converting sciAudio to Sierra Script
« on: June 22, 2020, 06:55:11 PM »
I have taken the liberty of converting the sciAudio script to Sierra Script. Here is a basic game that serves one purpose only: test a sound then quit.

It's in both SCI0 and SCI01 form.

And no changes to the actual sciAudio program were needed.

6/24/2020 EDIT: Both AudTests work correctly now! I changed msgBuf from a local variable into a temp variable. Also, sciAudio is now an instance of Object (if no superclass is given, it's an instance of RootObj)
« Last Edit: June 24, 2020, 12:09:00 PM by EricOakford »


My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline lskovlun

Re: Converting sciAudio to Sierra Script
« Reply #1 on: June 22, 2020, 08:29:09 PM »
Well, the globals are being overwritten because the compiler is somehow mistaking a local variable (array - msgBuf) for a global one. It happens to be caught early, because userFont gets blown away too and Print needs this.

PART 2:

That was SCI0. Now in SCI01, this problem doesn't occur. Instead, the conductor filename is somehow bugged. The default name contains a backslash, and I've never had to use one before in SCI code. The backslash causes SCI to create a file named MMAND.CON instead of COMMAND.CON. You could sidestep this problem entirely by running SciAudio and SCI from the same directory, or you could try to figure out how backslashes work in Companion's string handling code. Or do it on the ScIAudio daemon side of things (command line?).
« Last Edit: June 22, 2020, 10:36:26 PM by lskovlun »

Offline Kawa

Re: Converting sciAudio to Sierra Script
« Reply #2 on: June 23, 2020, 01:21:12 PM »
It's not SCI I don't think that's confused by the backslash. If I decompile this test script with "sciAudio\\command.con" in it, I get "sciAudio\mmand.con" in the disassembly and syntax tree alike. I'll look into the string parser and report back.

Okay I think I found it. In ParserCommon.h:
Code: [Select]
default:
    if (isxdigit((uint8_t)ch))
    {
        chHex = charToI(ch);
        lookingForSecondHex = true;
    }
    else
    {
        str += "\\"; // Add it, the following char was not an escape char
        processCharNormally = true; // Add the current char too
    }
That last line is what mucks it up. Commenting that out seems to help the co part survive without apparently being mistaken for an invalid hex sequence and eaten. A new build will be is available from the stash in my signature shortly now.
« Last Edit: June 23, 2020, 01:44:00 PM by Kawa »

Offline gumby

Re: Converting sciAudio to Sierra Script
« Reply #3 on: June 23, 2020, 08:29:04 PM »
Thanks for picking this project up EricOakford.  I intended to do this years ago when Sierra script was implemented in Companion, but life got in the way.  Let me know if I can provide any context if questions arise. 
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline EricOakford

Re: Converting sciAudio to Sierra Script
« Reply #4 on: June 24, 2020, 11:34:27 AM »
Both versions now work correctly. The problem was related to msgBuf being a local variable. By changing it to a temp variable, this is no longer an issue.
Basically, from what I can tell, the script just writes out a file, and the sciAudio daemon then reads that file and plays the sound given. So it seems only the script needed modification.
« Last Edit: June 24, 2020, 12:09:40 PM by EricOakford »
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline lskovlun

Re: Converting sciAudio to Sierra Script
« Reply #5 on: June 24, 2020, 02:26:07 PM »
@Eric: My main concern with that would be not finding the root cause (in the compiler) and therefore still risking problems with local variables elsewhere. The manifestation of such problems would be highly variable (hah) and difficult to diagnose. Also, if everything is in temporary vars (on the stack), there's the risk of stack overflows.

@Kawa: Thanks for looking into this and fixing it!

Offline EricOakford

Re: Converting sciAudio to Sierra Script
« Reply #6 on: June 24, 2020, 06:26:13 PM »
@Eric: My main concern with that would be not finding the root cause (in the compiler) and therefore still risking problems with local variables elsewhere. The manifestation of such problems would be highly variable (hah) and difficult to diagnose. Also, if everything is in temporary vars (on the stack), there's the risk of stack overflows.

Okay, I admit it's not a perfect fix, but it's only temporary, since this is a compiler issue. I could also reduce the ,msgBuf array to 100. There's no need for it to be any higher.

I've been working on a new version of LockerGnome Quest Redux in Sierra Script, with the music and sound intact, and replacing MouseLookObj with Sierra's original RFeature and a mouseDown event handler, as was done in QFG1EGA. It seems to be going along well.

6/25/2020 UPDATE: Here it is. The game plays to completion (with voice and music!), but the game crashes with an opcode error at the very end.
« Last Edit: June 25, 2020, 06:31:18 PM by EricOakford »
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.089 seconds with 24 queries.