From 7a3a6160be42412c6dd0e298d88ce0f0280c2103 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 3 Aug 2021 00:27:16 +0200 Subject: [PATCH] DIRECTOR: Added stub for Videodisc XObj --- engines/director/lingo/lingo-object.cpp | 6 +- .../director/lingo/xlibs/videodiscxobj.cpp | 313 ++++++++++++++++++ engines/director/lingo/xlibs/videodiscxobj.h | 68 ++++ engines/director/module.mk | 1 + 4 files changed, 386 insertions(+), 2 deletions(-) create mode 100644 engines/director/lingo/xlibs/videodiscxobj.cpp create mode 100644 engines/director/lingo/xlibs/videodiscxobj.h diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp index 6731fe5e7c3..e2d9b7eeb11 100644 --- a/engines/director/lingo/lingo-object.cpp +++ b/engines/director/lingo/lingo-object.cpp @@ -39,10 +39,11 @@ #include "director/lingo/xlibs/flushxobj.h" #include "director/lingo/xlibs/fplayxobj.h" #include "director/lingo/xlibs/labeldrvxobj.h" -#include "director/lingo/xlibs/palxobj.h" #include "director/lingo/xlibs/orthoplayxobj.h" +#include "director/lingo/xlibs/palxobj.h" #include "director/lingo/xlibs/popupmenuxobj.h" #include "director/lingo/xlibs/soundjam.h" +#include "director/lingo/xlibs/videodiscxobj.h" #include "director/lingo/xlibs/winxobj.h" namespace Director { @@ -117,11 +118,12 @@ static struct XLibProto { { "FileIO", FileIO::open, FileIO::close, kXObj | kXtraObj, 200 }, // D2 { "FlushXObj", FlushXObj::open, FlushXObj::close, kXObj, 400 }, // D4 { "FPlayXObj", FPlayXObj::open, FPlayXObj::close, kXObj, 200 }, // D2 + { "OrthoPlay XObj", OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4 { "PalXObj", PalXObj::open, PalXObj::close, kXObj, 400 }, // D4 { "PopUp Menu XObj", PopUpMenuXObj::open, PopUpMenuXObj::close, kXObj | kXtraObj, 200 }, // D2 { "LabelDrv", LabelDrvXObj::open, LabelDrvXObj::close, kXObj, 400 }, // D4 { "SoundJam", SoundJam::open, SoundJam::close, kXObj, 400 }, // D4 - { "OrthoPlay XObj", OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4 + { "Videodisc XObj", VideodiscXObj::open, VideodiscXObj::close, kXObj | kXtraObj, 200 }, // D2 { "winXObj", RearWindowXObj::open, RearWindowXObj::close, kXObj, 400 }, // D4 { 0, 0, 0, 0, 0 } diff --git a/engines/director/lingo/xlibs/videodiscxobj.cpp b/engines/director/lingo/xlibs/videodiscxobj.cpp new file mode 100644 index 00000000000..99adafb2cac --- /dev/null +++ b/engines/director/lingo/xlibs/videodiscxobj.cpp @@ -0,0 +1,313 @@ +/* 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * 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/xlibs/videodiscxobj.h" + +namespace Director { + +static const char *xlibName = "Videodisc"; + +static 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 + { 0, 0, 0, 0, 0 } +}; + +void VideodiscXObj::open(int type) { + if (type == kXObj) { + VideodiscXObject::initMethods(xlibMethods); + VideodiscXObject *xobj = new VideodiscXObject(kXObj); + g_lingo->_globalvars[xlibName] = xobj; + } +} + +void VideodiscXObj::close(int type) { + if (type == kXObj) { + VideodiscXObject::cleanupMethods(); + g_lingo->_globalvars[xlibName] = Datum(); + } +} + + +VideodiscXObject::VideodiscXObject(ObjectType ObjectType) :Object("Videodisc") { + _objType = ObjectType; +} + +void VideodiscXObj::m_new(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_new", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(g_lingo->_currentMe); +} + +void VideodiscXObj::m_name(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_name", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_player(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_player", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_play(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_play", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_playRev(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_playRev", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_fastFwd(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_fastFwd", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_fastRev(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_fastRev", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_slowFwd(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_slowFwd", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_slowRev(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_slowRev", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_stepFwd(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_stepFwd", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_stepRev(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_stepRev", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_playJog(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_playJog", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_playSpeed(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_playSpeed", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_playSegment(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_playSegment", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_pause(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_pause", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_stop(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_stop", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_eject(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_eject", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_stopAtFrame(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_stopAtFrame", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_searchWait(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_searchWait", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_readPos(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_readPos", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_showDisplay(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_showDisplay", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_clear(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_clear", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_videoControl(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_videoControl", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_audioControl(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_audioControl", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + +void VideodiscXObj::m_status(int nargs) { + g_lingo->printSTUBWithArglist("VideodiscXObj::m_status", nargs); + g_lingo->dropStack(nargs); + g_lingo->push(Datum()); +} + + +} // End of namespace Director diff --git a/engines/director/lingo/xlibs/videodiscxobj.h b/engines/director/lingo/xlibs/videodiscxobj.h new file mode 100644 index 00000000000..26be1d105a9 --- /dev/null +++ b/engines/director/lingo/xlibs/videodiscxobj.h @@ -0,0 +1,68 @@ +/* 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef DIRECTOR_LINGO_XLIBS_VIDEODISCXOBJ_H +#define DIRECTOR_LINGO_XLIBS_VIDEODISCXOBJ_H + +namespace Director { + +class VideodiscXObject : public Object { +public: + VideodiscXObject(ObjectType objType); +}; + +namespace VideodiscXObj { + +void open(int type); +void close(int 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 diff --git a/engines/director/module.mk b/engines/director/module.mk index 76f7da559cd..49c12e9dd08 100644 --- a/engines/director/module.mk +++ b/engines/director/module.mk @@ -45,6 +45,7 @@ MODULE_OBJS = \ lingo/xlibs/orthoplayxobj.o \ lingo/xlibs/popupmenuxobj.o \ lingo/xlibs/soundjam.o \ + lingo/xlibs/videodiscxobj.o \ lingo/xlibs/winxobj.o # HACK: Skip this when including the file for detection objects.