Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*************************************
*
* USED IN:
* Walküre no Densetsu Gaiden: Rosa no Bōken (ワルキューレの伝説 ローザの冒険)
*
*************************************/
/* -- Valkyrie External Factory. 16Feb93 PTM
* Valkyrie
* I mNew --Creates a new instance of the XObject
* X mDispose --Disposes of XObject instance
* S mName --Returns the XObject name (Valkyrie)
* I mStatus --Returns an integer status code
* SI mError, code --Returns an error string
* S mLastError --Returns last error string
* IS mSave, str --Saving SaveData to namco.ini.
* S mLoad --Loading SaveData from namco.ini.
*/
#include "common/formats/ini-file.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/valkyrie.h"
namespace Director {
const char *const ValkyrieXObj::xlibName = "Valkyrie";
const XlibFileDesc ValkyrieXObj::fileNames[] = {
{ "VALKYRIE", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "New", ValkyrieXObj::m_new, 0, 0, 400 }, // D4
{ "Dispose", ValkyrieXObj::m_dispose, 0, 0, 400 }, // D4
{ "Name", ValkyrieXObj::m_name, 0, 0, 400 }, // D4
{ "Status", ValkyrieXObj::m_status, 0, 0, 400 }, // D4
{ "Error", ValkyrieXObj::m_error, 1, 1, 400 }, // D4
{ "LastError", ValkyrieXObj::m_lastError, 0, 0, 400 }, // D4
{ "Save", ValkyrieXObj::m_save, 0, 0, 400 }, // D4
{ "Load", ValkyrieXObj::m_load, 0, 0, 400 }, // D4
{ nullptr, nullptr, 0, 0, 0 }
};
void ValkyrieXObj::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
ValkyrieXObject::initMethods(xlibMethods);
ValkyrieXObject *xobj = new ValkyrieXObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void ValkyrieXObj::close(ObjectType type) {
if (type == kXObj) {
ValkyrieXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
ValkyrieXObject::ValkyrieXObject(ObjectType ObjectType) :Object<ValkyrieXObject>("Valkyrie") {
_objType = ObjectType;
}
void ValkyrieXObj::m_new(int nargs) {
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBNR(ValkyrieXObj::m_dispose)
void ValkyrieXObj::m_name(int nargs) {
g_lingo->push(Datum("Valkyrie"));
}
XOBJSTUB(ValkyrieXObj::m_status, 0)
void ValkyrieXObj::m_error(int nargs) {
// TODO: Save error code for m_lastError?
int errorCode = g_lingo->pop().asInt();
warning("ValkyrieXObj::m_error: Got error %d", errorCode);
}
XOBJSTUB(ValkyrieXObj::m_lastError, "")
void ValkyrieXObj::m_save(int nargs) {
// should write to namco.ini > Valkyrie > Data
// TODO: Should report errors if we fail to save
Common::String saveName = savePrefix() + "namco.ini.txt";
Common::String saveString = g_lingo->pop().asString();
Common::INIFile *saveFile = new Common::INIFile();
saveFile->loadFromSaveFile(saveName);
saveFile->setKey("Data", "Valkyrie", saveString);
saveFile->saveToSaveFile(saveName);
delete saveFile;
g_lingo->push(Datum(1));
}
void ValkyrieXObj::m_load(int nargs) {
// should load save from namco.ini > Valkyrie > Data
// TODO: Report errors if we fail to load?
Common::String saveString;
Common::INIFile *saveFile = new Common::INIFile();
saveFile->loadFromSaveFile(savePrefix() + "namco.ini.txt");
if (!(saveFile->hasKey("Data", "Valkyrie"))) {
saveString = "0NAX";
} else {
saveFile->getKey("Data", "Valkyrie", saveString);
}
delete saveFile;
g_lingo->push(Datum(saveString));
}
} // End of namespace Director

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VALKYRIEXOBJ_H
#define DIRECTOR_LINGO_XLIBS_VALKYRIEXOBJ_H
namespace Director {
class ValkyrieXObject : public Object<ValkyrieXObject> {
public:
ValkyrieXObject(ObjectType objType);
};
namespace ValkyrieXObj {
extern const char *const xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_new(int nargs);
void m_dispose(int nargs);
void m_name(int nargs);
void m_status(int nargs);
void m_error(int nargs);
void m_lastError(int nargs);
void m_save(int nargs);
void m_load(int nargs);
} // End of namespace ValkyrieXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,256 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/system.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/versions.h"
/**************************************************
*
* USED IN:
* [insert game here]
*
**************************************************/
/*
-- Versions XObject, version 1.1, 8/9/96
--Versions
-- Copyright © 1996 Glenn M. Picher, Dirigo Multimedia
-- Email: gpicher@maine.com
-- Web: http://www.maine.com/shops/gpicher
-- Phone: (207)767-8015 (South Portland, Maine, USA)
--
-- Distributors: g/matter, inc.
-- Email: support@gmatter.com
-- Web: http://www.gmatter.com
-- Phone: (415)243-0394 (San Francisco, California USA)
--
-- License granted to use and redistribute for any purpose,
-- as long as copyright and contact information remains intact.
-- Each instance of the XObject will present a copyright alert
-- box once if you use any methods other than the QuickTime version
-- checking functions. The registered version does not present any
-- alert boxes.
--
I mNew -- Standard creation method
X mDispose -- Standard dispose method
S mQuickTimeVersion
-- Get string of QuickTime version ('000000.000000.000000.000000' if QTW
-- is not installed). Suitable for string comparisons (<, =, >). Example:
-- Your title includes the QTW v2.1.1.57 installer, and you're running on
-- a machine with QTW v2.0.1.41 already installed. QTW v. 2.1.1.57 becomes
-- '000002.000001.000001.000057' . Alphabetically, this comes after QTW
-- v. 2.0.1.41 ('000002.000000.000001.000041'). Thus you can conclude
-- that QuickTime needs to be updated to the version supplied with your
-- title. This is a workaround for a bug in MCI 'info qtwvideo version'
-- reporting, which does not always produce valid numeric comparisons. Only
-- reports the 16-bit QuickTime version. Works by initializing QuickTime,
-- so the first use may take much longer than subsequent uses.
-- Number is formatted to be compatible with file version numbers.
-- Note: requires ASK16.EXE and VERS16.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if ASK16.EXE can't load; Returns string with word 1 'Error:'
-- if ASK16.EXE fails. ***Note: version 1.0 of this XObject did not use
-- ASK16.EXE and VERS16.DLL . To avoid occasional crashes when 16-bit Director
-- got confused about the state of QuickTime, this new version keeps
-- Director's QuickTime code isolated from this XObject's QuickTime
-- code. Be sure to add ASK16.EXE and VERS16.DLL to your
-- distributed projects when upgrading to this version of this XObject.
S mWin32QuickTimeVersion
-- Reports the 32-bit QuickTime version. Requires ASK32.EXE and VERS32.DLL
-- in the same directory as this XObject .DLL . These files are
-- distributed with this XObject .DLL file. Returns EMPTY if 32-bit
-- environment is unavailable, or ASK32.EXE can't load; Returns
-- string with word 1 'Error:' if ASK32.EXE fails.
SS mFileVersion, fileName
-- Get string of file version number. Allows checking versions of
-- QuickTime compressor files, even 32-bit versions. Suitable for string
-- comparisons. Example: QTIM32.DLL in the System folder, v. 2.1.1.57 becomes
-- '000002.000001.000001.000057' . The extra digits are the minimum required to
-- represent the maximum 64-bit version number. Can be used with any file that
-- contains a version resource, not just QuickTime files. If file is missing
-- or does not contain version info, result is '000000.000000.000000.000000' .
-- Works whether 32-bit environment is available or not; however,
-- ASK32.EXE and VERS32.DLL are required in the same directory as this
-- XObject .DLL to get Win32 version numbers under Windows NT or 95. These
-- files are distributed with this XObject .DLL file. Further note: Windows
-- NT uses a different system directory for 32-bit .DLLs. See below.
S mWindowsDirectory
-- Returns full path to Windows directory (including trailing '\').
-- Useful for building full path names for use with mFileVersion.
-- Word 1 of the returned string will be 'Error:' in the unlikely
-- event of an error, followed by a description of the error.
-- Note: returns the Win16 answer (see below).
S mWin32WindowsDirectory
-- Returns full path to Windows directory (including trailing '\').
-- Should be the same answer as mWindowsDirectory for all current
-- Windows versions, but this may change in future Win versions.
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
S mSystemDirectory
-- Returns full path to System directory (including trailing '\').
-- Useful for building full path names for use with mFileVersion.
-- Word 1 of the returned string will be 'Error:' in the unlikely
-- event of an error, followed by a description of the error.
-- Note: returns the Win16 answer (see below).
S mWin32SystemDirectory
-- Returns full path to System directory (including trailing '\').
-- Under Windows NT, this is a different answer than mSystemDirectory.
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
S mDOSVersion
-- Returns the DOS version reported to 16-bit apps. No Win32 equivalent.
S mWindowsVersion
-- Returns the Windows version reported to 16-bit apps. This is
-- not the same answer as mWin32Version under Windows 95.
S mWin32Version
-- Returns the Win32 version (a different answer than mWindowsVersion)
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
-- Note the lack of ability to check for Win32-specific DOS version.
S mWin32Platform
-- Returns the Win32 platform ('Win32s on Windows 3.1',
-- 'Win32 on Windows 95', or 'Windows NT').
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
S mWin32Build
-- Returns the Win32 build. This is useful because Director requires
-- at least Windows NT v3.51 with Service Pack 4 applied (build 1057).
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
S mWinNTVersion
-- Tells you what verison of Windows NT you're running under-- 'Workstation',
-- 'Server', 'Advanced Server', 'Unknown', or 'Error' is there's a problem.
-- Note: requires ASK32.EXE and VERS32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
SS mGetShortFileName, theFile
-- Returns the MS-DOS style filename of a Windows 95 or Windows NT long
-- file name which might contain spaces or other DOS-illegal characters.
-- This method can also accept file names that are already DOS-legal.
-- This method is helpful when an XObject only works with DOS filenames.
-- Note: requires ASK32.EXE and FNAME32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
SS mGetLongFileName, theFile
-- Returns the Windows 95 or Windows NT long file name, which might contain
-- spaces or other DOS-illegal characters, given a DOS short file name.
-- This method can also accept file names that are already long.
-- Note: requires ASK32.EXE and FNAME32.DLL in the same directory as this
-- XObject .DLL (these files are distributed with this XObject).
-- Returns EMPTY if 32-bit environment is unavailable, or ASK32.EXE
-- can't load; Returns string with word 1 'Error:' if ASK32.EXE fails.
--
*/
namespace Director {
const char *VersionsXObj::xlibName = "Versions";
const XlibFileDesc VersionsXObj::fileNames[] = {
{ "VERSIONS", nullptr },
{ nullptr, nullptr },
};
static MethodProto xlibMethods[] = {
{ "new", VersionsXObj::m_new, 0, 0, 400 },
{ "dispose", VersionsXObj::m_dispose, 0, 0, 400 },
{ "quickTimeVersion", VersionsXObj::m_quickTimeVersion, 0, 0, 400 },
{ "win32QuickTimeVersion", VersionsXObj::m_win32QuickTimeVersion, 0, 0, 400 },
{ "fileVersion", VersionsXObj::m_fileVersion, 1, 1, 400 },
{ "windowsDirectory", VersionsXObj::m_windowsDirectory, 0, 0, 400 },
{ "win32WindowsDirectory", VersionsXObj::m_win32WindowsDirectory, 0, 0, 400 },
{ "systemDirectory", VersionsXObj::m_systemDirectory, 0, 0, 400 },
{ "win32SystemDirectory", VersionsXObj::m_win32SystemDirectory, 0, 0, 400 },
{ "dOSVersion", VersionsXObj::m_dOSVersion, 0, 0, 400 },
{ "windowsVersion", VersionsXObj::m_windowsVersion, 0, 0, 400 },
{ "win32Version", VersionsXObj::m_win32Version, 0, 0, 400 },
{ "win32Platform", VersionsXObj::m_win32Platform, 0, 0, 400 },
{ "win32Build", VersionsXObj::m_win32Build, 0, 0, 400 },
{ "winNTVersion", VersionsXObj::m_winNTVersion, 0, 0, 400 },
{ "getShortFileName", VersionsXObj::m_getShortFileName, 1, 1, 400 },
{ "getLongFileName", VersionsXObj::m_getLongFileName, 1, 1, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
VersionsXObject::VersionsXObject(ObjectType ObjectType) :Object<VersionsXObject>("Versions") {
_objType = ObjectType;
}
void VersionsXObj::open(ObjectType type, const Common::Path &path) {
VersionsXObject::initMethods(xlibMethods);
VersionsXObject *xobj = new VersionsXObject(type);
if (type == kXtraObj)
g_lingo->_openXtras.push_back(xlibName);
g_lingo->exposeXObject(xlibName, xobj);
g_lingo->initBuiltIns(xlibBuiltins);
}
void VersionsXObj::close(ObjectType type) {
VersionsXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void VersionsXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("VersionsXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBNR(VersionsXObj::m_dispose)
XOBJSTUB(VersionsXObj::m_quickTimeVersion, "000003.000000.000000.000000")
XOBJSTUB(VersionsXObj::m_win32QuickTimeVersion, "000003.000000.000000.000000")
XOBJSTUB(VersionsXObj::m_fileVersion, "000003.000000.000000.000000")
XOBJSTUB(VersionsXObj::m_windowsDirectory, "")
XOBJSTUB(VersionsXObj::m_win32WindowsDirectory, "")
XOBJSTUB(VersionsXObj::m_systemDirectory, "")
XOBJSTUB(VersionsXObj::m_win32SystemDirectory, "")
XOBJSTUB(VersionsXObj::m_dOSVersion, "")
XOBJSTUB(VersionsXObj::m_windowsVersion, "")
XOBJSTUB(VersionsXObj::m_win32Version, "")
XOBJSTUB(VersionsXObj::m_win32Platform, "")
XOBJSTUB(VersionsXObj::m_win32Build, "")
XOBJSTUB(VersionsXObj::m_winNTVersion, "")
XOBJSTUB(VersionsXObj::m_getShortFileName, "")
XOBJSTUB(VersionsXObj::m_getLongFileName, "")
}

View File

@@ -0,0 +1,62 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VERSIONS_H
#define DIRECTOR_LINGO_XLIBS_VERSIONS_H
namespace Director {
class VersionsXObject : public Object<VersionsXObject> {
public:
VersionsXObject(ObjectType objType);
};
namespace VersionsXObj {
extern const char *xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_new(int nargs);
void m_dispose(int nargs);
void m_quickTimeVersion(int nargs);
void m_win32QuickTimeVersion(int nargs);
void m_fileVersion(int nargs);
void m_windowsDirectory(int nargs);
void m_win32WindowsDirectory(int nargs);
void m_systemDirectory(int nargs);
void m_win32SystemDirectory(int nargs);
void m_dOSVersion(int nargs);
void m_windowsVersion(int nargs);
void m_win32Version(int nargs);
void m_win32Platform(int nargs);
void m_win32Build(int nargs);
void m_winNTVersion(int nargs);
void m_getShortFileName(int nargs);
void m_getLongFileName(int nargs);
} // End of namespace VersionsXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,205 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*************************************
*
* USED IN:
* Standard Macromedia Director XObject
*
*************************************/
/*
* mNew, portObject, baudRate, playerType creates a
* new instance and returns error code
* portObject is an instance from SerialPort XObject.
* baudRate should be the same as machine setting.
* 9600(default for Pioneer 8000),
* 4800(preferred for Pioneer 2200, 4200),
* 2400, and 1200.
* playerType:
* 0 for Pioneer 2200, 4200 and 8000
* 1 for Sony Laser Max 1200, 1500, and 2000
* Error codes:
* -1 : incorrect BaudRate.
* -2 : memory error.
* -3 : SerialPort Drivers would not open.
*
* mDispose frees this instance from memory.
* mName returns my name.
* mPlayer returns the player.
*
* Note: all of the following methods will return either "OK" or an error message. Possible error messages include:
* "No Response" -- bad connection or wrong baud rate.
* "Not Ready" -- disc ejected or motor stopped.
*
* mPlay normal playback mode in the forward direction.
* mPlayRev playback mode in the reverse direction.
*
* mFastFwd fast forward playback mode.
* 3 times normal speed.
* mFastRev fast reverse playback mode.
* 3 times normal speed.
*
* mSlowFwd slow forward playback mode.
* 1/5 times normal speed.
* mSlowRev slow reverse playback mode
* 1/5 times normal speed.
*
* mStepFwd step forward a single frame.
* mStepRev step reverse a single frame.
*
* mPlayJog, nFrame step multiple frames either forward
* or reverse
*
* mPlaySpeed, rate play at slower than normal speed.
* rate can be any of the following:
* 30 is 1x; 15 is 1/2x; 10 is 1/3x; 5 is 1/6x
* Example: -10 is one third normal speed, backwards.
*
* mPlaySegment, start, end play a segment of video disc.
* Start and end are frame numbers.
*
* mPause set player to display freeze picture (STILL)
* When this method is called a second time, this will
* continue the mode prior to first call.
* mStop halts playback of videodisc.
* mEject opens disc compartment and ejects disc.
*
* mStopAtFrame, frameNum set to stop at frameNum
*
* mSearchWait, frameNum search for frameNum and
* returns "OK" when search is completed.
*
* mReadPos return the current frame position
* mShowDisplay, flag enable/disable frame display
*
* mClear clear all modes of player. Remove Stop markers
*
* mVideoControl, videoState control squelch condition
* of video image.
*
* mAudioControl, audioState
* audioState is one of the following
* 0 : Turn off both audio channels.
* 1 : Turn on channel 1 only.
* 2 : Turn on channel 2 only.
* 3 : Turn on both audio channels.
*
* mStatus return either "OK" or error message
* See the mDescribe for a full list of errors.
*/
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/videodiscxobj.h"
namespace Director {
const char *const VideodiscXObj::xlibName = "LaserDisc";
const XlibFileDesc VideodiscXObj::fileNames[] = {
{ "Videodisc XObj", nullptr },
{ "LaserDisc", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "new", VideodiscXObj::m_new, 3, 3, 200 }, // D2
{ "Name", VideodiscXObj::m_name, 0, 0, 200 }, // D2
{ "Player", VideodiscXObj::m_player, 0, 0, 200 }, // D2
{ "Play", VideodiscXObj::m_play, 0, 0, 200 }, // D2
{ "PlayRev", VideodiscXObj::m_playRev, 0, 0, 200 }, // D2
{ "FastFwd", VideodiscXObj::m_fastFwd, 0, 0, 200 }, // D2
{ "FastRev", VideodiscXObj::m_fastRev, 0, 0, 200 }, // D2
{ "SlowFwd", VideodiscXObj::m_slowFwd, 0, 0, 200 }, // D2
{ "SlowRev", VideodiscXObj::m_slowRev, 0, 0, 200 }, // D2
{ "StepFwd", VideodiscXObj::m_stepFwd, 0, 0, 200 }, // D2
{ "StepRev", VideodiscXObj::m_stepRev, 0, 0, 200 }, // D2
{ "PlayJog", VideodiscXObj::m_playJog, 1, 1, 200 }, // D2
{ "PlaySpeed", VideodiscXObj::m_playSpeed, 1, 1, 200 }, // D2
{ "PlaySegment", VideodiscXObj::m_playSegment, 2, 2, 200 }, // D2
{ "Pause", VideodiscXObj::m_pause, 0, 0, 200 }, // D2
{ "Stop", VideodiscXObj::m_stop, 0, 0, 200 }, // D2
{ "Eject", VideodiscXObj::m_eject, 0, 0, 200 }, // D2
{ "StopAtFrame", VideodiscXObj::m_stopAtFrame, 1, 1, 200 }, // D2
{ "SearchWait", VideodiscXObj::m_searchWait, 1, 1, 200 }, // D2
{ "ReadPos", VideodiscXObj::m_readPos, 0, 0, 200 }, // D2
{ "ShowDisplay", VideodiscXObj::m_showDisplay, 0, 0, 200 }, // D2
{ "Clear", VideodiscXObj::m_clear, 0, 0, 200 }, // D2
{ "VideoControl", VideodiscXObj::m_videoControl, 1, 1, 200 }, // D2
{ "AudioControl", VideodiscXObj::m_audioControl, 1, 1, 200 }, // D2
{ "Status", VideodiscXObj::m_status, 0, 0, 200 }, // D2
{ nullptr, nullptr, 0, 0, 0 }
};
void VideodiscXObj::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
VideodiscXObject::initMethods(xlibMethods);
VideodiscXObject *xobj = new VideodiscXObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void VideodiscXObj::close(ObjectType type) {
if (type == kXObj) {
VideodiscXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
VideodiscXObject::VideodiscXObject(ObjectType ObjectType) :Object<VideodiscXObject>("LaserDisc") {
_objType = ObjectType;
}
void VideodiscXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("VideodiscXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBV(VideodiscXObj::m_name)
XOBJSTUBV(VideodiscXObj::m_player)
XOBJSTUBV(VideodiscXObj::m_play)
XOBJSTUBV(VideodiscXObj::m_playRev)
XOBJSTUBV(VideodiscXObj::m_fastFwd)
XOBJSTUBV(VideodiscXObj::m_fastRev)
XOBJSTUBV(VideodiscXObj::m_slowFwd)
XOBJSTUBV(VideodiscXObj::m_slowRev)
XOBJSTUBV(VideodiscXObj::m_stepFwd)
XOBJSTUBV(VideodiscXObj::m_stepRev)
XOBJSTUBV(VideodiscXObj::m_playJog)
XOBJSTUBV(VideodiscXObj::m_playSpeed)
XOBJSTUBV(VideodiscXObj::m_playSegment)
XOBJSTUBV(VideodiscXObj::m_pause)
XOBJSTUBV(VideodiscXObj::m_stop)
XOBJSTUBV(VideodiscXObj::m_eject)
XOBJSTUBV(VideodiscXObj::m_stopAtFrame)
XOBJSTUBV(VideodiscXObj::m_searchWait)
XOBJSTUBV(VideodiscXObj::m_readPos)
XOBJSTUBV(VideodiscXObj::m_showDisplay)
XOBJSTUBV(VideodiscXObj::m_clear)
XOBJSTUBV(VideodiscXObj::m_videoControl)
XOBJSTUBV(VideodiscXObj::m_audioControl)
XOBJSTUBV(VideodiscXObj::m_status)
} // End of namespace Director

View File

@@ -0,0 +1,70 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VIDEODISCXOBJ_H
#define DIRECTOR_LINGO_XLIBS_VIDEODISCXOBJ_H
namespace Director {
class VideodiscXObject : public Object<VideodiscXObject> {
public:
VideodiscXObject(ObjectType objType);
};
namespace VideodiscXObj {
extern const char *const xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_new(int nargs);
void m_name(int nargs);
void m_player(int nargs);
void m_play(int nargs);
void m_playRev(int nargs);
void m_fastFwd(int nargs);
void m_fastRev(int nargs);
void m_slowFwd(int nargs);
void m_slowRev(int nargs);
void m_stepFwd(int nargs);
void m_stepRev(int nargs);
void m_playJog(int nargs);
void m_playSpeed(int nargs);
void m_playSegment(int nargs);
void m_pause(int nargs);
void m_stop(int nargs);
void m_eject(int nargs);
void m_stopAtFrame(int nargs);
void m_searchWait(int nargs);
void m_readPos(int nargs);
void m_showDisplay(int nargs);
void m_clear(int nargs);
void m_videoControl(int nargs);
void m_audioControl(int nargs);
void m_status(int nargs);
} // End of namespace VideodiscXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/system.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/vmisonxfcn.h"
/**************************************************
*
* USED IN:
* puppetmotel
*
**************************************************/
namespace Director {
const char *const VMisOnXFCN::xlibName = "VMisOn";
const XlibFileDesc VMisOnXFCN::fileNames[] = {
{ "VMisOn", nullptr },
{ nullptr, nullptr },
};
static const BuiltinProto builtins[] = {
{ "VMisOn", VMisOnXFCN::m_VMisOn, -1, 0, 400, HBLTIN },
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
void VMisOnXFCN::open(ObjectType type, const Common::Path &path) {
g_lingo->initBuiltIns(builtins);
}
void VMisOnXFCN::close(ObjectType type) {
g_lingo->cleanupBuiltIns(builtins);
}
XOBJSTUB(VMisOnXFCN::m_VMisOn, 0)
}

View File

@@ -0,0 +1,41 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VMISONXFCN_H
#define DIRECTOR_LINGO_XLIBS_VMISONXFCN_H
namespace Director {
namespace VMisOnXFCN {
extern const char *const xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_VMisOn(int nargs);
} // End of namespace VMisOnXFCN
} // End of namespace Director
#endif

View File

@@ -0,0 +1,91 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/system.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/vmpresent.h"
/**************************************************
*
* USED IN:
* dazzeloids
*
**************************************************/
/*
-- VMPresentObj v1.0
I mNew --Instantiate the XObject
I mVMPresent --Returns true (1) if VM is turned on, otherwise 0 (false)
*/
namespace Director {
const char *VMPresentXObj::xlibName = "VMPresent";
const XlibFileDesc VMPresentXObj::fileNames[] = {
{ "VMPresent", nullptr },
{ nullptr, nullptr },
};
static MethodProto xlibMethods[] = {
{ "new", VMPresentXObj::m_new, 0, 0, 400 },
{ "vMPresent", VMPresentXObj::m_vMPresent, 0, 0, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
VMPresentXObject::VMPresentXObject(ObjectType ObjectType) :Object<VMPresentXObject>("VMPresent") {
_objType = ObjectType;
}
void VMPresentXObj::open(ObjectType type, const Common::Path &path) {
VMPresentXObject::initMethods(xlibMethods);
VMPresentXObject *xobj = new VMPresentXObject(type);
if (type == kXtraObj)
g_lingo->_openXtras.push_back(xlibName);
g_lingo->exposeXObject(xlibName, xobj);
g_lingo->initBuiltIns(xlibBuiltins);
}
void VMPresentXObj::close(ObjectType type) {
VMPresentXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void VMPresentXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("VMPresentXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
// Dazzeloids won't start unless virtual memory is disabled.
// If another game uses this XObj, we might need to expand this into a title check.
XOBJSTUB(VMPresentXObj::m_vMPresent, 0)
}

View File

@@ -0,0 +1,47 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VMPRESENT_H
#define DIRECTOR_LINGO_XLIBS_VMPRESENT_H
namespace Director {
class VMPresentXObject : public Object<VMPresentXObject> {
public:
VMPresentXObject(ObjectType objType);
};
namespace VMPresentXObj {
extern const char *xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_new(int nargs);
void m_vMPresent(int nargs);
} // End of namespace VMPresentXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*************************************
*
* USED IN:
* Yearn2Learn: The Flintstones Coloring Book
*
*************************************/
/*
* v1.0, ©1989, 1990 Eric Carlson, Apple Computer, Inc.
* VolumeList(«“nodialog:ErrMsg”»)
*/
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/xlibs/v/volumelist.h"
namespace Director {
const char *const VolumeList::xlibName = "VolumeList";
const XlibFileDesc VolumeList::fileNames[] = {
{ "VolumeList", nullptr },
{ nullptr, nullptr },
};
static const BuiltinProto builtins[] = {
{ "VolumeList", VolumeList::m_volumelist, 0, 0, 300, HBLTIN },
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
void VolumeList::open(ObjectType type, const Common::Path &path) {
g_lingo->initBuiltIns(builtins);
}
void VolumeList::close(ObjectType type) {
g_lingo->cleanupBuiltIns(builtins);
}
void VolumeList::m_volumelist(int nargs) {
// Would presumably give a list of volumes attached,
// with the first being the boot disk
g_lingo->push(Datum(""));
}
} // End of namespace Director

View File

@@ -0,0 +1,41 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VOLUMELIST_H
#define DIRECTOR_LINGO_XLIBS_VOLUMELIST_H
namespace Director {
namespace VolumeList {
extern const char *const xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_volumelist(int nargs);
} // End of namespace VolumeList
} // End of namespace Director
#endif

View File

@@ -0,0 +1,388 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/system.h"
#include "director/director.h"
#include "director/movie.h"
#include "director/score.h"
#include "director/window.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/v/voyagerxsound.h"
/**************************************************
*
* USED IN:
* Puppet Motel
*
**************************************************/
/*
-- Voyager Company XSound External Factory. 27October1995
--XSound
I mNew --Creates a new instance of XSound
X mDispose --Disposes of XSound instance
X init --Initializes the XSound library
III open, numchan, monostereo --Opens the specified sound channel
X close --Stops playback and closes all channels
XI bufsize, kbytes --Sets buffer size to kbytes
IS exists, name --Determines if AIFF file exists on disk
II status, chan --Determines if the specified channel is busy
XS path, pathname --Sets path used when opening sound files
SS duration, name --Returns duration in secs for specified file
SI curtime, chan --Returns current file location in seconds
V playfile, chan, name, tstart, tend --Plays specified AIFF file
IIS loadfile, chan, name -- preloads the specified AIFF file
XI unloadfile, chan -- unloads a previously loaded file
V playsnd, chan, name, tstart, tend --Plays specified WAVE file
V extplayfile, chan, name, lstart, lend --Plays specified looped AIFF
XI stop, chan --Stops playback on specified channel
XII volume, chan, vol --Sets volume for specified channel
XIII leftrightvol, chan, lvol, rvol --Sets volume of left and right
V fade, chan, endvol, duration, autostop --Fades channel over duration
XII frequency, chan, percent --Transposes pitch by percent
XII pan, chan, panvalue --Sets the panning of a channel
ISS startrecord, name, duration --Records new sound file
X stoprecord --Stops any recording in process
XS recordpath, path --Sets default record path
*/
namespace Director {
const char *VoyagerXSoundXObj::xlibName = "XSound";
const XlibFileDesc VoyagerXSoundXObj::fileNames[] = {
{ "XSound", "puppetmotel" },
{ "XSound32", "puppetmotel" },
{ nullptr, nullptr },
};
static MethodProto xlibMethods[] = {
{ "new", VoyagerXSoundXObj::m_new, 0, 0, 400 },
{ "dispose", VoyagerXSoundXObj::m_dispose, 0, 0, 400 },
{ "init", VoyagerXSoundXObj::m_init, 0, 0, 400 },
{ "open", VoyagerXSoundXObj::m_open, 2, 2, 400 },
{ "close", VoyagerXSoundXObj::m_close, 0, 0, 400 },
{ "bufsize", VoyagerXSoundXObj::m_bufsize, 1, 1, 400 },
{ "exists", VoyagerXSoundXObj::m_exists, 1, 1, 400 },
{ "status", VoyagerXSoundXObj::m_status, 1, 1, 400 },
{ "path", VoyagerXSoundXObj::m_path, 1, 1, 400 },
{ "duration", VoyagerXSoundXObj::m_duration, 1, 1, 400 },
{ "curtime", VoyagerXSoundXObj::m_curtime, 1, 1, 400 },
{ "playfile", VoyagerXSoundXObj::m_playfile, 0, 0, 400 },
{ "loadfile", VoyagerXSoundXObj::m_loadfile, 2, 2, 400 },
{ "unloadfile", VoyagerXSoundXObj::m_unloadfile, 1, 1, 400 },
{ "playsnd", VoyagerXSoundXObj::m_playsnd, 0, 0, 400 },
{ "extplayfile", VoyagerXSoundXObj::m_extplayfile, 0, 0, 400 },
{ "stop", VoyagerXSoundXObj::m_stop, 1, 1, 400 },
{ "volume", VoyagerXSoundXObj::m_volume, 2, 2, 400 },
{ "leftrightvol", VoyagerXSoundXObj::m_leftrightvol, 3, 3, 400 },
{ "fade", VoyagerXSoundXObj::m_fade, 0, 0, 400 },
{ "frequency", VoyagerXSoundXObj::m_frequency, 2, 2, 400 },
{ "pan", VoyagerXSoundXObj::m_pan, 2, 2, 400 },
{ "startrecord", VoyagerXSoundXObj::m_startrecord, 2, 2, 400 },
{ "stoprecord", VoyagerXSoundXObj::m_stoprecord, 0, 0, 400 },
{ "recordpath", VoyagerXSoundXObj::m_recordpath, 1, 1, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
VoyagerXSoundXObject::VoyagerXSoundXObject(ObjectType ObjectType) :Object<VoyagerXSoundXObject>("XSound") {
_objType = ObjectType;
_soundManager = g_director->getCurrentWindow()->getSoundManager();
}
VoyagerXSoundXObject::~VoyagerXSoundXObject() {
close();
}
int VoyagerXSoundXObject::open(int numChan, int monoStereo) {
if (!_channels.contains(numChan)) {
_channels[numChan] = new VoyagerChannel();
_channels[numChan]->channelID = numChan + 1000;
}
return 1;
}
void VoyagerXSoundXObject::close() {
for (auto &it : _channels)
delete it._value;
_channels.clear();
}
int VoyagerXSoundXObject::status(int chan) {
if (_channels.contains(chan)) {
return _soundManager->isChannelActive(_channels[chan]->channelID) ? 1 : 0;
}
return 0;
}
int VoyagerXSoundXObject::playfile(int chan, Common::String &path, int tstart, int tend) {
if (!_channels.contains(chan)) {
open(chan, 2);
}
_soundManager->playFile(path, _channels[chan]->channelID);
return 1;
}
int VoyagerXSoundXObject::fade(int chan, int endvol, int duration, bool autostop) {
if (!_channels.contains(chan)) {
return 0;
}
int channelID = _channels[chan]->channelID;
_soundManager->registerFade(channelID, _soundManager->getChannelVolume(channelID), endvol, duration*60, autostop);
Window *window = g_director->getCurrentWindow();
Score *score = window->getCurrentMovie()->getScore();
score->_activeFade = true;
return 1;
}
void VoyagerXSoundXObject::stop(int chan) {
if (!_channels.contains(chan)) {
return;
}
int channelID = _channels[chan]->channelID;
_soundManager->stopSound(channelID);
}
void VoyagerXSoundXObject::volume(int chan, int vol) {
if (!_channels.contains(chan)) {
return;
}
int channelID = _channels[chan]->channelID;
_soundManager->setChannelVolume(channelID, vol);
}
void VoyagerXSoundXObject::leftrightvol(int chan, uint8 lvol, uint8 rvol) {
if (!_channels.contains(chan)) {
return;
}
int channelID = _channels[chan]->channelID;
_soundManager->setChannelFaderL(channelID, lvol);
_soundManager->setChannelFaderR(channelID, lvol);
}
void VoyagerXSoundXObject::frequency(int chan, int percent) {
if (!_channels.contains(chan)) {
return;
}
int channelID = _channels[chan]->channelID;
_soundManager->setChannelPitchShift(channelID, percent);
}
void VoyagerXSoundXObject::pan(int chan, int percent) {
if (!_channels.contains(chan)) {
return;
}
percent = MAX(MIN(100, percent), -100);
int channelID = _channels[chan]->channelID;
_soundManager->setChannelBalance(channelID, (int8)percent);
}
void VoyagerXSoundXObj::open(ObjectType type, const Common::Path &path) {
VoyagerXSoundXObject::initMethods(xlibMethods);
VoyagerXSoundXObject *xobj = new VoyagerXSoundXObject(type);
if (type == kXtraObj)
g_lingo->_openXtras.push_back(xlibName);
g_lingo->exposeXObject(xlibName, xobj);
g_lingo->initBuiltIns(xlibBuiltins);
}
void VoyagerXSoundXObj::close(ObjectType type) {
VoyagerXSoundXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void VoyagerXSoundXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
// For some reason the game code calls all of these with ARGC, so always return something
XOBJSTUBNR(VoyagerXSoundXObj::m_dispose)
XOBJSTUBNR(VoyagerXSoundXObj::m_init)
void VoyagerXSoundXObj::m_open(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_open", nargs);
ARGNUMCHECK(2);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
Datum monoStereo = g_lingo->pop();
Datum numChan = g_lingo->pop();
int result = me->open(numChan.asInt(), monoStereo.asInt());
g_lingo->push(result);
}
void VoyagerXSoundXObj::m_close(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_close", nargs);
ARGNUMCHECK(0);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
me->close();
g_lingo->push(0);
}
XOBJSTUB(VoyagerXSoundXObj::m_bufsize, 0)
XOBJSTUB(VoyagerXSoundXObj::m_exists, 0)
void VoyagerXSoundXObj::m_status(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_status", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(1);
Datum chan = g_lingo->pop();
g_lingo->push(me->status(chan.asInt()));
}
XOBJSTUB(VoyagerXSoundXObj::m_path, 0)
XOBJSTUB(VoyagerXSoundXObj::m_duration, "")
XOBJSTUB(VoyagerXSoundXObj::m_curtime, "")
void VoyagerXSoundXObj::m_playfile(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_playfile", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
if (nargs < 2) {
warning("VoyagerXSoundXObj::m_playfile: expected at least 2 args");
g_lingo->dropStack(nargs);
g_lingo->push(0);
return;
} else if (nargs > 4) {
g_lingo->dropStack(nargs - 4);
nargs = 4;
}
Datum tend(-1);
if (nargs == 4) {
tend = g_lingo->pop();
nargs--;
}
Datum tstart(-1);
if (nargs == 3) {
tstart = g_lingo->pop();
nargs--;
}
Common::String path = g_lingo->pop().asString();
Datum chan = g_lingo->pop();
int result = me->playfile(chan.asInt(), path, tstart.asInt(), tend.asInt());
g_lingo->push(result);
}
XOBJSTUB(VoyagerXSoundXObj::m_loadfile, 0)
XOBJSTUB(VoyagerXSoundXObj::m_unloadfile, 0)
void VoyagerXSoundXObj::m_playsnd(int nargs) {
m_playfile(nargs);
}
XOBJSTUB(VoyagerXSoundXObj::m_extplayfile, 0)
void VoyagerXSoundXObj::m_stop(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_stop", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(1);
int chan = g_lingo->pop().asInt();
me->stop(chan);
g_lingo->push(Datum(1));
}
void VoyagerXSoundXObj::m_volume(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_volume", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(2);
int vol = g_lingo->pop().asInt();
int chan = g_lingo->pop().asInt();
me->volume(chan, vol);
g_lingo->push(Datum(1));
}
void VoyagerXSoundXObj::m_leftrightvol(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_pan", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(3);
int rvol = g_lingo->pop().asInt();
int lvol = g_lingo->pop().asInt();
int chan = g_lingo->pop().asInt();
me->leftrightvol(chan, (uint8)lvol, (uint8)rvol);
g_lingo->push(Datum(1));
}
void VoyagerXSoundXObj::m_fade(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_fade", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
if (nargs < 2) {
warning("VoyagerXSoundXObj::m_fade: expected at least 2 args");
g_lingo->dropStack(nargs);
g_lingo->push(Datum());
return;
}
if (nargs > 4) {
warning("VoyagerXSoundXObj: dropping %d extra args", nargs - 4);
g_lingo->dropStack(nargs - 4);
nargs = 4;
}
bool autoStop = false;
int duration = 0;
if (nargs == 4) {
autoStop = (bool)g_lingo->pop().asInt();
nargs--;
}
if (nargs == 3) {
duration = g_lingo->pop().asInt();
nargs--;
}
int endVol = g_lingo->pop().asInt();
int chan = g_lingo->pop().asInt();
g_lingo->push(Datum(me->fade(chan, endVol, duration, autoStop)));
}
void VoyagerXSoundXObj::m_frequency(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_frequency", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(2);
int percent = g_lingo->pop().asInt();
int chan = g_lingo->pop().asInt();
me->frequency(chan, percent);
g_lingo->push(Datum(1));
}
void VoyagerXSoundXObj::m_pan(int nargs) {
g_lingo->printSTUBWithArglist("VoyagerXSoundXObj::m_pan", nargs);
VoyagerXSoundXObject *me = static_cast<VoyagerXSoundXObject *>(g_lingo->_state->me.u.obj);
ARGNUMCHECK(2);
int percent = g_lingo->pop().asInt();
int chan = g_lingo->pop().asInt();
me->pan(chan, percent);
g_lingo->push(Datum(1));
}
XOBJSTUB(VoyagerXSoundXObj::m_startrecord, 0)
XOBJSTUB(VoyagerXSoundXObj::m_stoprecord, 0)
XOBJSTUB(VoyagerXSoundXObj::m_recordpath, 0)
}

View File

@@ -0,0 +1,92 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DIRECTOR_LINGO_XLIBS_VOYAGERXSOUND_H
#define DIRECTOR_LINGO_XLIBS_VOYAGERXSOUND_H
#include "director/sound.h"
namespace Director {
struct VoyagerChannel {
int channelID;
};
class VoyagerXSoundXObject : public Object<VoyagerXSoundXObject> {
public:
VoyagerXSoundXObject(ObjectType objType);
~VoyagerXSoundXObject();
int open(int monoStereo, int numChan);
void close();
int status(int chan);
int playfile(int chan, Common::String &path, int tstart, int tend);
int fade(int chan, int endvol, int duration, bool autostop);
void stop(int chan);
void volume(int chan, int vol);
void leftrightvol(int chan, uint8 lvol, uint8 rvol);
void frequency(int chan, int percent);
void pan(int chan, int percent);
DirectorSound *_soundManager;
Common::HashMap<int, VoyagerChannel *> _channels;
};
namespace VoyagerXSoundXObj {
extern const char *xlibName;
extern const XlibFileDesc fileNames[];
void open(ObjectType type, const Common::Path &path);
void close(ObjectType type);
void m_new(int nargs);
void m_dispose(int nargs);
void m_init(int nargs);
void m_open(int nargs);
void m_close(int nargs);
void m_bufsize(int nargs);
void m_exists(int nargs);
void m_status(int nargs);
void m_path(int nargs);
void m_duration(int nargs);
void m_curtime(int nargs);
void m_playfile(int nargs);
void m_loadfile(int nargs);
void m_unloadfile(int nargs);
void m_playsnd(int nargs);
void m_extplayfile(int nargs);
void m_stop(int nargs);
void m_volume(int nargs);
void m_leftrightvol(int nargs);
void m_fade(int nargs);
void m_frequency(int nargs);
void m_pan(int nargs);
void m_startrecord(int nargs);
void m_stoprecord(int nargs);
void m_recordpath(int nargs);
} // End of namespace VoyagerXSoundXObj
} // End of namespace Director
#endif