[Scummvm-git-logs] scummvm master -> b3d026ae4654f30a826e8332b7a6a66a6b129a9e
sev-
noreply at scummvm.org
Wed Jun 15 14:35:47 UTC 2022
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
54091dd50d DIRECTOR: Stub JWXINI XObject
a07723a8df DIRECTOR: Implement GPID XObject
039537bcd8 DIRECTOR: Stub MovUtils XObject
4ddf23d393 DIRECTOR: Implement AIFF Xobject
b3d026ae46 DIRECTOR: Implement AIFF mDuration.
Commit: 54091dd50d6f83efa55262e8a3a372fcd1074133
https://github.com/scummvm/scummvm/commit/54091dd50d6f83efa55262e8a3a372fcd1074133
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-06-15T16:35:41+02:00
Commit Message:
DIRECTOR: Stub JWXINI XObject
Changed paths:
A engines/director/lingo/xlibs/jwxini.cpp
A engines/director/lingo/xlibs/jwxini.h
engines/director/lingo/lingo-object.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 98d9503bc11..050faff4b62 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -40,6 +40,7 @@
#include "director/lingo/xlibs/fileio.h"
#include "director/lingo/xlibs/flushxobj.h"
#include "director/lingo/xlibs/fplayxobj.h"
+#include "director/lingo/xlibs/jwxini.h"
#include "director/lingo/xlibs/labeldrvxobj.h"
#include "director/lingo/xlibs/memoryxobj.h"
#include "director/lingo/xlibs/movemousexobj.h"
@@ -122,24 +123,24 @@ static struct XLibProto {
int type;
int version;
} xlibs[] = {
- { CDROMXObj::fileNames, CDROMXObj::open, CDROMXObj::close, kXObj, 200 }, // D2
- { FileIO::fileNames, FileIO::open, FileIO::close, kXObj | kXtraObj, 200 }, // D2
- { FlushXObj::fileNames, FlushXObj::open, FlushXObj::close, kXObj, 400 }, // D4
- { FPlayXObj::fileNames, FPlayXObj::open, FPlayXObj::close, kXObj, 200 }, // D2
- { LabelDrvXObj::fileNames, LabelDrvXObj::open, LabelDrvXObj::close, kXObj, 400 }, // D4
- { OrthoPlayXObj::fileNames, OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4
- { PalXObj::fileNames, PalXObj::open, PalXObj::close, kXObj, 400 }, // D4
- { MemoryXObj::fileNames, MemoryXObj::open, MemoryXObj::close, kXObj, 400 }, // D4
- { PopUpMenuXObj::fileNames, PopUpMenuXObj::open, PopUpMenuXObj::close, kXObj, 200 }, // D2
- { SerialPortXObj::fileNames, SerialPortXObj::open, SerialPortXObj::close, kXObj, 200 }, // D2
- { SoundJam::fileNames, SoundJam::open, SoundJam::close, kXObj, 400 }, // D4
- { RegisterComponent::fileNames, RegisterComponent::open,RegisterComponent::close, kXObj, 400 }, // D4
- { VideodiscXObj::fileNames, VideodiscXObj::open, VideodiscXObj::close, kXObj, 200 }, // D2
- { RearWindowXObj::fileNames, RearWindowXObj::open, RearWindowXObj::close, kXObj, 400 }, // D4
- { MoveMouseXObj::fileNames, MoveMouseXObj::open, MoveMouseXObj::close, kXObj, 400 }, // D4
- { XPlayAnim::fileNames, XPlayAnim::open, XPlayAnim::close, kXObj, 300 }, // D3
+ { CDROMXObj::fileNames, CDROMXObj::open, CDROMXObj::close, kXObj, 200 }, // D2
+ { FileIO::fileNames, FileIO::open, FileIO::close, kXObj | kXtraObj, 200 }, // D2
+ { FlushXObj::fileNames, FlushXObj::open, FlushXObj::close, kXObj, 400 }, // D4
+ { FPlayXObj::fileNames, FPlayXObj::open, FPlayXObj::close, kXObj, 200 }, // D2
+ { LabelDrvXObj::fileNames, LabelDrvXObj::open, LabelDrvXObj::close, kXObj, 400 }, // D4
+ { OrthoPlayXObj::fileNames, OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4
+ { JourneyWareXINIXObj::fileNames, JourneyWareXINIXObj::open, JourneyWareXINIXObj::close, kXObj, 400 }, // D4
+ { PalXObj::fileNames, PalXObj::open, PalXObj::close, kXObj, 400 }, // D4
+ { MemoryXObj::fileNames, MemoryXObj::open, MemoryXObj::close, kXObj, 400 }, // D4
+ { PopUpMenuXObj::fileNames, PopUpMenuXObj::open, PopUpMenuXObj::close, kXObj, 200 }, // D2
+ { SerialPortXObj::fileNames, SerialPortXObj::open, SerialPortXObj::close, kXObj, 200 }, // D2
+ { SoundJam::fileNames, SoundJam::open, SoundJam::close, kXObj, 400 }, // D4
+ { RegisterComponent::fileNames, RegisterComponent::open, RegisterComponent::close, kXObj, 400 }, // D4
+ { VideodiscXObj::fileNames, VideodiscXObj::open, VideodiscXObj::close, kXObj, 200 }, // D2
+ { RearWindowXObj::fileNames, RearWindowXObj::open, RearWindowXObj::close, kXObj, 400 }, // D4
+ { MoveMouseXObj::fileNames, MoveMouseXObj::open, MoveMouseXObj::close, kXObj, 400 }, // D4
+ { XPlayAnim::fileNames, XPlayAnim::open, XPlayAnim::close, kXObj, 300 }, // D3
{ nullptr, nullptr, nullptr, 0, 0 }
-
};
void Lingo::initXLibs() {
diff --git a/engines/director/lingo/xlibs/jwxini.cpp b/engines/director/lingo/xlibs/jwxini.cpp
new file mode 100644
index 00000000000..4ac56f10343
--- /dev/null
+++ b/engines/director/lingo/xlibs/jwxini.cpp
@@ -0,0 +1,142 @@
+/* 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:
+ * Gahan Wilson's Ultimate Haunted House
+ *
+ *************************************/
+
+/*
+ * +Access INI Files (c) JourneyWare Media 1994
+ * -- Access INI files
+ * X mDispose --Dispose of the XObject
+ * ISSIS mGetPrivateProfileInt, App, Key, Def, File --GetPrivateProfileInt
+ * SSSSIS mGetPrivateProfileString, App, Key, Default, Size, File --GetPrivateProfileString
+ * ISSI mGetProfileInt, App, Key, Default --GetProfileInt
+ * SSSSI mGetProfileString, App, Key, Def, Size --GetProfileString
+ * S mName --Return XObject name
+ * I mNew --Create a new instance
+ * ISSSS mWritePrivateProfileString, App, Key, String, File --WritePrivateProfileString
+ * ISSS mWriteProfileString, App, Key, String --WriteProfileString
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/jwxini.h"
+
+
+namespace Director {
+
+const char *JourneyWareXINIXObj::xlibName = "INI";
+const char *JourneyWareXINIXObj::fileNames[] = {
+ "JWXINI",
+ nullptr
+};
+
+static MethodProto xlibMethods[] = {
+ { "new", JourneyWareXINIXObj::m_new, 0, 0, 400 }, // D4
+ { "GetPrivateProfileInt", JourneyWareXINIXObj::m_GetPrivateProfileInt, 4, 4, 400 }, // D4
+ { "GetPrivateProfileString", JourneyWareXINIXObj::m_GetPrivateProfileString, 5, 5, 400 }, // D4
+ { "GetProfileInt", JourneyWareXINIXObj::m_GetProfileInt, 3, 3, 400 }, // D4
+ { "GetProfileString", JourneyWareXINIXObj::m_GetProfileString, 4, 4, 400 }, // D4
+ { "WritePrivateProfileString", JourneyWareXINIXObj::m_WritePrivateProfileString, 4, 4, 400 }, // D4
+ { "WriteProfileString", JourneyWareXINIXObj::m_WriteProfileString, 3, 3, 400 }, // D4
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void JourneyWareXINIXObj::open(int type) {
+ if (type == kXObj) {
+ JourneyWareXINIXObject::initMethods(xlibMethods);
+ JourneyWareXINIXObject *xobj = new JourneyWareXINIXObject(kXObj);
+ g_lingo->_globalvars[xlibName] = xobj;
+ }
+}
+
+void JourneyWareXINIXObj::close(int type) {
+ if (type == kXObj) {
+ JourneyWareXINIXObject::cleanupMethods();
+ g_lingo->_globalvars[xlibName] = Datum();
+ }
+}
+
+
+JourneyWareXINIXObject::JourneyWareXINIXObject(ObjectType ObjectType) :Object<JourneyWareXINIXObject>("JourneyWareXINIXObj") {
+ _objType = ObjectType;
+}
+
+void JourneyWareXINIXObj::m_new(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::new", nargs);
+ g_lingo->push(g_lingo->_currentMe);
+}
+
+void JourneyWareXINIXObj::m_GetPrivateProfileInt(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::GetPrivateProfileInt", nargs);
+ /*auto file= */g_lingo->pop().asString();
+ auto defaultValue = g_lingo->pop().asInt();
+ /*auto key = */g_lingo->pop().asString();
+ /*auto application = */g_lingo->pop().asString();
+ g_lingo->push(Datum(defaultValue)); // TODO: We only return the default for now
+}
+
+void JourneyWareXINIXObj::m_GetPrivateProfileString(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::GetPrivateProfileString", nargs);
+ /*auto file = */g_lingo->pop().asString();
+ /*auto size = */g_lingo->pop().asInt();
+ auto defaultValue = g_lingo->pop().asString();
+ /*auto key = */g_lingo->pop().asString();
+ /*auto application = */g_lingo->pop().asString();
+ g_lingo->push(Datum(defaultValue)); // TODO: We only return the default for now
+}
+
+void JourneyWareXINIXObj::m_GetProfileInt(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::GetProfileInt", nargs);
+ auto defaultValue = g_lingo->pop().asInt();
+ /*auto key = */g_lingo->pop().asString();
+ /*auto application = */g_lingo->pop().asString();
+ g_lingo->push(Datum(defaultValue)); // TODO: We only return the default for now
+}
+
+void JourneyWareXINIXObj::m_GetProfileString(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::GetProfileString", nargs);
+ /*auto size = */g_lingo->pop().asInt();
+ auto defaultValue = g_lingo->pop().asString();
+ /*auto key = */g_lingo->pop().asString();
+ /*auto application = */g_lingo->pop().asString();
+ g_lingo->push(Datum(defaultValue)); // TODO: We only return the default for now
+}
+
+void JourneyWareXINIXObj::m_WritePrivateProfileString(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::WritePrivateProfileString", nargs);
+ g_lingo->dropStack(nargs);
+ g_lingo->push(Datum(0)); // TODO
+}
+
+void JourneyWareXINIXObj::m_WriteProfileString(int nargs) {
+ g_lingo->printSTUBWithArglist("JWXIni::WriteProfileString", nargs);
+ g_lingo->dropStack(nargs);
+ g_lingo->push(Datum(0)); // TODO
+}
+
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/jwxini.h b/engines/director/lingo/xlibs/jwxini.h
new file mode 100644
index 00000000000..c6397cdd236
--- /dev/null
+++ b/engines/director/lingo/xlibs/jwxini.h
@@ -0,0 +1,55 @@
+/* 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_JWXINI_H
+#define DIRECTOR_LINGO_XLIBS_JWXINI_H
+
+namespace Director {
+
+class JourneyWareXINIXObject : public Object<JourneyWareXINIXObject> {
+public:
+ JourneyWareXINIXObject(ObjectType objType);
+};
+
+namespace JourneyWareXINIXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_clear(int nargs);
+
+void m_GetPrivateProfileInt(int nargs);
+void m_GetPrivateProfileString(int nargs);
+void m_GetProfileInt(int nargs);
+void m_GetProfileString(int nargs);
+void m_WritePrivateProfileString(int nargs);
+void m_WriteProfileString(int nargs);
+
+} // End of namespace JourneyWareXINIXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 1413f2f09b8..a08b9b620a9 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -44,6 +44,7 @@ MODULE_OBJS = \
lingo/xlibs/flushxobj.o \
lingo/xlibs/fplayxobj.o \
lingo/xlibs/labeldrvxobj.o \
+ lingo/xlibs/jwxini.o \
lingo/xlibs/memoryxobj.o \
lingo/xlibs/movemousexobj.o \
lingo/xlibs/orthoplayxobj.o \
Commit: a07723a8df9455f6be46dfa0f50ae2504e417fe9
https://github.com/scummvm/scummvm/commit/a07723a8df9455f6be46dfa0f50ae2504e417fe9
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-06-15T16:35:41+02:00
Commit Message:
DIRECTOR: Implement GPID XObject
Changed paths:
A engines/director/lingo/xlibs/gpid.cpp
A engines/director/lingo/xlibs/gpid.h
engines/director/lingo/lingo-object.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 050faff4b62..58c0a593b93 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -40,6 +40,7 @@
#include "director/lingo/xlibs/fileio.h"
#include "director/lingo/xlibs/flushxobj.h"
#include "director/lingo/xlibs/fplayxobj.h"
+#include "director/lingo/xlibs/gpid.h"
#include "director/lingo/xlibs/jwxini.h"
#include "director/lingo/xlibs/labeldrvxobj.h"
#include "director/lingo/xlibs/memoryxobj.h"
@@ -127,6 +128,7 @@ static struct XLibProto {
{ FileIO::fileNames, FileIO::open, FileIO::close, kXObj | kXtraObj, 200 }, // D2
{ FlushXObj::fileNames, FlushXObj::open, FlushXObj::close, kXObj, 400 }, // D4
{ FPlayXObj::fileNames, FPlayXObj::open, FPlayXObj::close, kXObj, 200 }, // D2
+ { GpidXObj::fileNames, GpidXObj::open, GpidXObj::close, kXObj, 400 }, // D4
{ LabelDrvXObj::fileNames, LabelDrvXObj::open, LabelDrvXObj::close, kXObj, 400 }, // D4
{ OrthoPlayXObj::fileNames, OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4
{ JourneyWareXINIXObj::fileNames, JourneyWareXINIXObj::open, JourneyWareXINIXObj::close, kXObj, 400 }, // D4
diff --git a/engines/director/lingo/xlibs/gpid.cpp b/engines/director/lingo/xlibs/gpid.cpp
new file mode 100644
index 00000000000..7cc3a242315
--- /dev/null
+++ b/engines/director/lingo/xlibs/gpid.cpp
@@ -0,0 +1,90 @@
+/* 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:
+ * Gahan Wilson's Ultimate Haunted House
+ *
+ *************************************/
+
+/*
+ * Product Identification Number
+ * Gahan Wilson's Ultimate Haunted House
+ * Copyright 1994 Byron Preiss Multimedia Company, Inc.
+ * 'Copyright 1994, Byron Preiss Multimedia
+ * -- copyright 1994 by Byron Priess Multimedia, authored by MayoSmith
+ * gpid
+ * I mNew --Read Docs to avoid Hard Drive failure
+ * X mDispose --Disposes of XObject instance
+ * S mName --Returns the XObject name (Widget)
+ * I mStatus --Returns an integer status code
+ * SI mError, code --Returns an error string
+ * S mLastError --Returns last error string
+ * I mGetPid --Retrieves PID
+ *
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/gpid.h"
+
+
+namespace Director {
+
+const char *GpidXObj::xlibName = "gpid";
+const char *GpidXObj::fileNames[] = {
+ "GPID",
+ nullptr
+};
+
+static MethodProto xlibMethods[] = {
+ { "new", GpidXObj::m_new, 0, 0, 400 }, // D4
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void GpidXObj::open(int type) {
+ if (type == kXObj) {
+ ProductIdXObject::initMethods(xlibMethods);
+ ProductIdXObject *xobj = new ProductIdXObject(kXObj);
+ g_lingo->_globalvars[xlibName] = xobj;
+ }
+}
+
+void GpidXObj::close(int type) {
+ if (type == kXObj) {
+ ProductIdXObject::cleanupMethods();
+ g_lingo->_globalvars[xlibName] = Datum();
+ }
+}
+
+
+ProductIdXObject::ProductIdXObject(ObjectType ObjectType) :Object<ProductIdXObject>("GpidXObj") {
+ _objType = ObjectType;
+}
+
+void GpidXObj::m_new(int nargs) {
+ g_lingo->printSTUBWithArglist("gpid::new", nargs);
+ g_lingo->push(g_lingo->_currentMe);
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/gpid.h b/engines/director/lingo/xlibs/gpid.h
new file mode 100644
index 00000000000..077309c709d
--- /dev/null
+++ b/engines/director/lingo/xlibs/gpid.h
@@ -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_GPID_H
+#define DIRECTOR_LINGO_XLIBS_GPID_H
+
+namespace Director {
+
+class ProductIdXObject : public Object<ProductIdXObject> {
+public:
+ ProductIdXObject(ObjectType objType);
+};
+
+namespace GpidXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+
+} // End of namespace GpidXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index a08b9b620a9..04aa1867b99 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -43,6 +43,7 @@ MODULE_OBJS = \
lingo/xlibs/fileio.o \
lingo/xlibs/flushxobj.o \
lingo/xlibs/fplayxobj.o \
+ lingo/xlibs/gpid.o \
lingo/xlibs/labeldrvxobj.o \
lingo/xlibs/jwxini.o \
lingo/xlibs/memoryxobj.o \
Commit: 039537bcd8d2430bbd157f3310ae876b5796cc62
https://github.com/scummvm/scummvm/commit/039537bcd8d2430bbd157f3310ae876b5796cc62
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-06-15T16:35:41+02:00
Commit Message:
DIRECTOR: Stub MovUtils XObject
Changed paths:
A engines/director/lingo/xlibs/movutils.cpp
A engines/director/lingo/xlibs/movutils.h
engines/director/lingo/lingo-object.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 58c0a593b93..d3e209d98ce 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -45,6 +45,7 @@
#include "director/lingo/xlibs/labeldrvxobj.h"
#include "director/lingo/xlibs/memoryxobj.h"
#include "director/lingo/xlibs/movemousexobj.h"
+#include "director/lingo/xlibs/movutils.h"
#include "director/lingo/xlibs/orthoplayxobj.h"
#include "director/lingo/xlibs/palxobj.h"
#include "director/lingo/xlibs/popupmenuxobj.h"
@@ -134,6 +135,7 @@ static struct XLibProto {
{ JourneyWareXINIXObj::fileNames, JourneyWareXINIXObj::open, JourneyWareXINIXObj::close, kXObj, 400 }, // D4
{ PalXObj::fileNames, PalXObj::open, PalXObj::close, kXObj, 400 }, // D4
{ MemoryXObj::fileNames, MemoryXObj::open, MemoryXObj::close, kXObj, 400 }, // D4
+ { MovUtilsXObj::fileNames, MovUtilsXObj::open, MovUtilsXObj::close, kXObj, 400 }, // D4
{ PopUpMenuXObj::fileNames, PopUpMenuXObj::open, PopUpMenuXObj::close, kXObj, 200 }, // D2
{ SerialPortXObj::fileNames, SerialPortXObj::open, SerialPortXObj::close, kXObj, 200 }, // D2
{ SoundJam::fileNames, SoundJam::open, SoundJam::close, kXObj, 400 }, // D4
diff --git a/engines/director/lingo/xlibs/movutils.cpp b/engines/director/lingo/xlibs/movutils.cpp
new file mode 100644
index 00000000000..855db1caf01
--- /dev/null
+++ b/engines/director/lingo/xlibs/movutils.cpp
@@ -0,0 +1,137 @@
+/* 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:
+ * Gahan Wilson's Ultimate Haunted House
+ *
+ *************************************/
+
+/*
+ * -- MovieUtilities External Factory, v. 1.0.7 by David Jackson Shields
+ * MovUtils
+ * I mNew --Create new XObject instance
+ * X mDispose --Dispose of XObject instance
+ * S mName --Return the XObject name (MovUtils)
+ * SS mGetVolName --Return name of disk drive (volume) from path
+ * S mGetSystemPath --Return system directory path as a string
+ * S mGetWindowsPath --Return Windows directory path as a string
+ * IS mSetDefaultPath --Set current drive:irectory path
+ * SS mGetChildWindowNames --Return string of all Child window names,
+ * -- given a Parent window name
+ * IS mGetNamedWindowHdl --Return the ID handle to the named window
+ * -- (needed for MCI commands)
+ * XSLLII mDrawLine --Draw line in the named window from point A
+ * -- to point B, at specified pen width and color
+ * ISLI mDrawOval --Draw filled oval (ellipse) in the named window,
+ * -- the bounds RECT, using specified fill color
+ * ISLI mDrawRect --Draw filled RECT in the named window, within the bounds
+ * -- RECT, using specified fill color
+ * ISLII mDrawRoundRect --Draw filled rounded RECT in the named window, within bounds
+ * -- RECT, with specified curvature and fill color
+ * ISLI mDrawPoly --Draw filled polygon in named window from a linear
+ * -- list of coordinates, using specified fill color
+ * ISLIII mDrawPie --Draw filled arc in named window, within bounds RECT, from
+ * -- start angle to arc angle, using specified fill color
+ * I mPrintLandscape --Print the Stage in Landscape orientation using dithered grays
+ * SS mNoPunct --Remove all punctuation chars from text
+ * SS mToUpperCase --Convert text to all upperCase chars
+ * SS mToLowerCase --Convert text to all lowerCase chars
+ * SS mTrimWhiteChars --Remove leading and trailing 'white space' chars from text
+ * SS mDollarFormat --Convert number string to US currency format
+ * ISI mGetWordStart --Find number of chars to start of specified word
+ * ISI mGetWordEnd --Find number of chars to end of specified word
+ * ISI mGetLineStart --Find number of chars to start of specified line
+ * ISI mGetLineEnd --Find number of chars to end of specified line
+ * IS mIsAlphaNum --Return Boolean whether char is alphaNumeric
+ * IS mIsAlpha --Return Boolean whether char is alphabetic
+ * IS mIsUpper --Return Boolean whether char is upperCase alphabetic
+ * IS mIsLower --Return Boolean whether char is lowerCase alphabetic
+ * IS mIsDigit --Return Boolean whether char is a decimal digit
+ * IS mIsPunctuation --Return Boolean whether char is punctuation
+ * IS mIsWhiteSpace --Return Boolean whether char is a 'white space' char
+ * IS mIsPrintable --Return Boolean whether char is printable
+ * IS mIsGraphic --Return Boolean whether char is graphic
+ * IS mIsControl --Return Boolean whether char is a control char
+ * IS mIsHex --Return Boolean whether char is a hexadecimal digit
+ * III mBitSet --Set specified bit within a long integer
+ * III mBitTest --Test specified bit within a long integer
+ * III mBitClear --Clear specified bit within a long integer
+ * II mBitShiftL --Shift specified bit left within a long integer
+ * II mBitShiftR --Shift specified bit right within a long integer
+ * III mBitAnd --Perform logical AND operation of two long integers
+ * III mBitOr --Perform logical OR operation of two long integers
+ * III mBitXOr --Perform logical XOR operation of two long integers
+ * II mBitNot --Perform logical NOT operation on a long integer
+ * IS mBitStringToNumber --Translate string of '1's and '0's to a long integer
+ * PL mStageToCast --Returns a picture handle to the image in the Rect on Stage
+ * ISL mStageToDIB --Save, to a named bitmap file, the image in the Rect on Stage
+ * ISL mStageToPICT --Save, to a Mac PICT file, the image in the Rect on Stage
+ * SS mCRtoCRLF --Add a LineFeed to each Return char within Macintosh text
+ * SS mCRLFtoCR --Remove LineFeed from each end of line within Windows text
+ * III mGetMessage --Get mouse/key messages from the application message queue
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/movutils.h"
+
+
+namespace Director {
+
+const char *MovUtilsXObj::xlibName = "movutils";
+const char *MovUtilsXObj::fileNames[] = {
+ "MOVUTILS",
+ nullptr
+};
+
+static MethodProto xlibMethods[] = {
+ { "new", MovUtilsXObj::m_new, 0, 0, 400 }, // D4
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void MovUtilsXObj::open(int type) {
+ if (type == kXObj) {
+ MovieUtilsXObject::initMethods(xlibMethods);
+ MovieUtilsXObject *xobj = new MovieUtilsXObject(kXObj);
+ g_lingo->_globalvars[xlibName] = xobj;
+ }
+}
+
+void MovUtilsXObj::close(int type) {
+ if (type == kXObj) {
+ MovieUtilsXObject::cleanupMethods();
+ g_lingo->_globalvars[xlibName] = Datum();
+ }
+}
+
+MovieUtilsXObject::MovieUtilsXObject(ObjectType ObjectType) :Object<MovieUtilsXObject>("MovUtilsXObj") {
+ _objType = ObjectType;
+}
+
+void MovUtilsXObj::m_new(int nargs) {
+ g_lingo->printSTUBWithArglist("MovUtilsXObj::new", nargs);
+ g_lingo->push(g_lingo->_currentMe);
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/movutils.h b/engines/director/lingo/xlibs/movutils.h
new file mode 100644
index 00000000000..9ac217ec832
--- /dev/null
+++ b/engines/director/lingo/xlibs/movutils.h
@@ -0,0 +1,48 @@
+/* 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_MOVUTILS_H
+#define DIRECTOR_LINGO_XLIBS_MOVUTILS_H
+
+namespace Director {
+
+class MovieUtilsXObject : public Object<MovieUtilsXObject> {
+public:
+ MovieUtilsXObject(ObjectType objType);
+};
+
+namespace MovUtilsXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_clear(int nargs);
+
+} // End of namespace MovUtilsXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 04aa1867b99..8fbde8a2a16 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -45,6 +45,7 @@ MODULE_OBJS = \
lingo/xlibs/fplayxobj.o \
lingo/xlibs/gpid.o \
lingo/xlibs/labeldrvxobj.o \
+ lingo/xlibs/movutils.o \
lingo/xlibs/jwxini.o \
lingo/xlibs/memoryxobj.o \
lingo/xlibs/movemousexobj.o \
Commit: 4ddf23d3935e43ddb29aa58a6b9143ff64c770d5
https://github.com/scummvm/scummvm/commit/4ddf23d3935e43ddb29aa58a6b9143ff64c770d5
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-06-15T16:35:41+02:00
Commit Message:
DIRECTOR: Implement AIFF Xobject
Changed paths:
A engines/director/lingo/xlibs/aiff.cpp
A engines/director/lingo/xlibs/aiff.h
engines/director/lingo/lingo-object.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index d3e209d98ce..55ed4398c35 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -36,6 +36,7 @@
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-the.h"
+#include "director/lingo/xlibs/aiff.h"
#include "director/lingo/xlibs/cdromxobj.h"
#include "director/lingo/xlibs/fileio.h"
#include "director/lingo/xlibs/flushxobj.h"
@@ -125,6 +126,7 @@ static struct XLibProto {
int type;
int version;
} xlibs[] = {
+ { AiffXObj::fileNames, AiffXObj::open, AiffXObj::close, kXObj, 400 }, // D4
{ CDROMXObj::fileNames, CDROMXObj::open, CDROMXObj::close, kXObj, 200 }, // D2
{ FileIO::fileNames, FileIO::open, FileIO::close, kXObj | kXtraObj, 200 }, // D2
{ FlushXObj::fileNames, FlushXObj::open, FlushXObj::close, kXObj, 400 }, // D4
diff --git a/engines/director/lingo/xlibs/aiff.cpp b/engines/director/lingo/xlibs/aiff.cpp
new file mode 100644
index 00000000000..2e574616ec5
--- /dev/null
+++ b/engines/director/lingo/xlibs/aiff.cpp
@@ -0,0 +1,99 @@
+/* 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:
+ * Gahan Wilson's Ultimate Haunted House
+ *
+ *************************************/
+
+/*
+ * -- copyright 1994 by Byron Priess Multimedia, authored by MayoSmith and Lee
+ * aiff
+ * I mNew --Read Docs to avoid Hard Drive failure
+ * X mDispose --Disposes of XObject instance
+ * S mName --Returns the XObject name (Widget)
+ * I mStatus --Returns an integer status code
+ * SI mError, code --Returns an error string
+ * S mLastError --Returns last error string
+ * III mAdd, arg1, arg2 --Returns arg1+arg2
+ * SSI mFirst, str, nchars --Return the first nchars of string str
+ * V mMul, f1, f2 --Returns f1*f2 as floating point
+ * X mGlobals --Sample code to Read & Modify globals
+ * X mSymbols --Sample code to work with Symbols
+ * X mSendPerform --Sample code to show SendPerform call
+ * X mFactory --Sample code to find Factory objects
+ * IS mDuration, str --Read Docs to avoid Hard Drive failure
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/aiff.h"
+
+
+namespace Director {
+
+const char *AiffXObj::xlibName = "aiff";
+const char *AiffXObj::fileNames[] = {
+ "AIFF",
+ nullptr
+};
+
+static MethodProto xlibMethods[] = {
+ { "new", AiffXObj::m_new, 0, 0, 400 }, // D4
+ { "Duration", AiffXObj::m_duration, 1, 1, 400 }, // D4
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void AiffXObj::open(int type) {
+ if (type == kXObj) {
+ AiffXObject::initMethods(xlibMethods);
+ AiffXObject *xobj = new AiffXObject(kXObj);
+ g_lingo->_globalvars[xlibName] = xobj;
+ }
+}
+
+void AiffXObj::close(int type) {
+ if (type == kXObj) {
+ AiffXObject::cleanupMethods();
+ g_lingo->_globalvars[xlibName] = Datum();
+ }
+}
+
+
+AiffXObject::AiffXObject(ObjectType ObjectType) :Object<AiffXObject>("AiffXObj") {
+ _objType = ObjectType;
+}
+
+void AiffXObj::m_new(int nargs) {
+ g_lingo->printSTUBWithArglist("AiffXObj::new", nargs);
+ g_lingo->push(g_lingo->_currentMe);
+}
+
+void AiffXObj::m_duration(int nargs) {
+ g_lingo->printSTUBWithArglist("AiffXObj::m_duration", nargs);
+ g_lingo->dropStack(nargs);
+ g_lingo->push(Datum(0)); // TODO: Implement
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/aiff.h b/engines/director/lingo/xlibs/aiff.h
new file mode 100644
index 00000000000..6dec423fd61
--- /dev/null
+++ b/engines/director/lingo/xlibs/aiff.h
@@ -0,0 +1,49 @@
+/* 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_AIFF_H
+#define DIRECTOR_LINGO_XLIBS_AIFF_H
+
+namespace Director {
+
+class AiffXObject : public Object<AiffXObject> {
+public:
+ AiffXObject(ObjectType objType);
+};
+
+namespace AiffXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+
+void m_duration(int nargs);
+
+} // End of namespace AiffXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 8fbde8a2a16..885ec1c7a23 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -39,6 +39,7 @@ MODULE_OBJS = \
lingo/lingo-preprocessor.o \
lingo/lingo-the.o \
lingo/lingo-utils.o \
+ lingo/xlibs/aiff.o \
lingo/xlibs/cdromxobj.o \
lingo/xlibs/fileio.o \
lingo/xlibs/flushxobj.o \
Commit: b3d026ae4654f30a826e8332b7a6a66a6b129a9e
https://github.com/scummvm/scummvm/commit/b3d026ae4654f30a826e8332b7a6a66a6b129a9e
Author: Einar Johan Trøan SømaÌen (einarjohants at gmail.com)
Date: 2022-06-15T16:35:41+02:00
Commit Message:
DIRECTOR: Implement AIFF mDuration.
This also means a refactor of the AIFF Audio-decoder, to expose
the two header fields we need to calculate the length.
Changed paths:
audio/decoders/aiff.cpp
audio/decoders/aiff.h
engines/director/lingo/xlibs/aiff.cpp
diff --git a/audio/decoders/aiff.cpp b/audio/decoders/aiff.cpp
index 5e255feb763..1092180a0c6 100644
--- a/audio/decoders/aiff.cpp
+++ b/audio/decoders/aiff.cpp
@@ -71,7 +71,7 @@ static const uint32 kVersionAIFC = MKTAG('A', 'I', 'F', 'C');
// Codecs
static const uint32 kCodecPCM = MKTAG('N', 'O', 'N', 'E'); // very original
-RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
+AIFFHeader *AIFFHeader::readAIFFHeader(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
if (stream->readUint32BE() != MKTAG('F', 'O', 'R', 'M')) {
warning("makeAIFFStream: No 'FORM' header");
@@ -100,10 +100,8 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
bool foundCOMM = false;
bool foundSSND = false;
- uint16 channels = 0, bitsPerSample = 0;
- uint32 rate = 0;
- uint32 codec = kCodecPCM; // AIFF default
- Common::SeekableReadStream *dataStream = nullptr;
+ AIFFHeader *aiffHeader = new AIFFHeader;
+ aiffHeader->_codec = kCodecPCM; // AIFF Default;
while (!(foundCOMM && foundSSND) && !stream->err() && !stream->eos()) {
uint32 tag = stream->readUint32BE();
@@ -116,21 +114,20 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
switch (tag) {
case MKTAG('C', 'O', 'M', 'M'):
foundCOMM = true;
- channels = stream->readUint16BE();
- /* frameCount = */ stream->readUint32BE();
- bitsPerSample = stream->readUint16BE();
- rate = readExtended(*stream);
+ aiffHeader->_channels = stream->readUint16BE();
+ aiffHeader->_frameCount = stream->readUint32BE();
+ aiffHeader->_bitsPerSample = stream->readUint16BE();
+ aiffHeader->_rate = readExtended(*stream);
if (version == kVersionAIFC)
- codec = stream->readUint32BE();
+ aiffHeader->_codec = stream->readUint32BE();
break;
case MKTAG('S', 'S', 'N', 'D'):
foundSSND = true;
/* uint32 offset = */ stream->readUint32BE();
/* uint32 blockAlign = */ stream->readUint32BE();
- if (dataStream)
- delete dataStream;
- dataStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + length - 8, disposeAfterUse);
+ delete aiffHeader->_dataStream;
+ aiffHeader->_dataStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + length - 8, disposeAfterUse);
break;
case MKTAG('F', 'V', 'E', 'R'):
switch (stream->readUint32BE()) {
@@ -148,10 +145,10 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
case MKTAG('w', 'a', 'v', 'e'):
warning("Found unhandled AIFF-C extra data chunk");
- if (!dataStream && disposeAfterUse == DisposeAfterUse::YES)
+ if (!aiffHeader->_dataStream && disposeAfterUse == DisposeAfterUse::YES)
delete stream;
- delete dataStream;
+ delete aiffHeader->_dataStream;
return nullptr;
default:
debug(1, "Skipping AIFF '%s' chunk", tag2str(tag));
@@ -168,10 +165,10 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
if (!foundCOMM) {
warning("makeAIFFStream: Could not find 'COMM' chunk");
- if (!dataStream && disposeAfterUse == DisposeAfterUse::YES)
+ if (!aiffHeader->_dataStream && disposeAfterUse == DisposeAfterUse::YES)
delete stream;
- delete dataStream;
+ delete aiffHeader;
return nullptr;
}
@@ -181,34 +178,39 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
+ delete aiffHeader;
return nullptr;
}
+ return aiffHeader;
+}
+
+RewindableAudioStream *AIFFHeader::makeAIFFStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
// We only implement a subset of the AIFF standard.
- if (channels < 1 || channels > 2) {
- warning("makeAIFFStream: Only 1 or 2 channels are supported, not %d", channels);
- delete dataStream;
+ if (_channels < 1 || _channels > 2) {
+ warning("makeAIFFStream: Only 1 or 2 channels are supported, not %d", _channels);
+ delete _dataStream;
return nullptr;
}
- // Seek to the start of dataStream, required for at least FileStream
- dataStream->seek(0);
+ // Seek to the start of _dataStream, required for at least FileStream
+ _dataStream->seek(0);
- switch (codec) {
+ switch (_codec) {
case kCodecPCM:
case MKTAG('t', 'w', 'o', 's'):
case MKTAG('s', 'o', 'w', 't'): {
// PCM samples are always signed.
byte rawFlags = 0;
- if (bitsPerSample == 16)
+ if (_bitsPerSample == 16)
rawFlags |= Audio::FLAG_16BITS;
- if (channels == 2)
+ if (_channels == 2)
rawFlags |= Audio::FLAG_STEREO;
- if (codec == MKTAG('s', 'o', 'w', 't'))
+ if (_codec == MKTAG('s', 'o', 'w', 't'))
rawFlags |= Audio::FLAG_LITTLE_ENDIAN;
- return makeRawStream(dataStream, rate, rawFlags);
+ return makeRawStream(_dataStream, _rate, rawFlags);
}
case MKTAG('i', 'm', 'a', '4'):
// TODO: Use QT IMA ADPCM
@@ -221,16 +223,28 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos
break;
case MKTAG('A', 'D', 'P', '4'):
// ADP4 on 3DO
- return make3DO_ADP4AudioStream(dataStream, rate, channels == 2);
+ return make3DO_ADP4AudioStream(_dataStream, _rate, _channels == 2);
case MKTAG('S', 'D', 'X', '2'):
// SDX2 on 3DO
- return make3DO_SDX2AudioStream(dataStream, rate, channels == 2);
+ return make3DO_SDX2AudioStream(_dataStream, _rate, _channels == 2);
default:
- warning("Unhandled AIFF-C compression tag '%s'", tag2str(codec));
+ warning("Unhandled AIFF-C compression tag '%s'", tag2str(_codec));
}
- delete dataStream;
+ delete _dataStream;
return nullptr;
}
+AIFFHeader::~AIFFHeader() {
+ delete _dataStream;
+}
+
+RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
+ AIFFHeader *aiffHeader = AIFFHeader::readAIFFHeader(stream, disposeAfterUse);
+ if (aiffHeader == nullptr) {
+ return nullptr;
+ }
+ return aiffHeader->makeAIFFStream(stream, disposeAfterUse);
+}
+
} // End of namespace Audio
diff --git a/audio/decoders/aiff.h b/audio/decoders/aiff.h
index ab5b3f77cfd..f16b6bdc061 100644
--- a/audio/decoders/aiff.h
+++ b/audio/decoders/aiff.h
@@ -43,6 +43,24 @@ namespace Audio {
class RewindableAudioStream;
+class AIFFHeader {
+public:
+ ~AIFFHeader();
+ static AIFFHeader *readAIFFHeader(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
+ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
+
+ uint32 getFrameCount() const { return _frameCount; }
+ uint32 getFrameRate() const { return _rate; }
+
+private:
+ uint16 _channels = 0;
+ uint32 _frameCount = 0;
+ uint16 _bitsPerSample = 0;
+ uint32 _rate = 0;
+ uint32 _codec = 0;
+ Common::SeekableReadStream *_dataStream = nullptr;
+};
+
/**
* Try to load an AIFF from the given seekable stream and create an AudioStream
* from that data.
diff --git a/engines/director/lingo/xlibs/aiff.cpp b/engines/director/lingo/xlibs/aiff.cpp
index 2e574616ec5..85db50e111b 100644
--- a/engines/director/lingo/xlibs/aiff.cpp
+++ b/engines/director/lingo/xlibs/aiff.cpp
@@ -45,6 +45,8 @@
* IS mDuration, str --Read Docs to avoid Hard Drive failure
*/
+#include "common/macresman.h"
+#include "audio/decoders/aiff.h"
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
@@ -92,8 +94,21 @@ void AiffXObj::m_new(int nargs) {
void AiffXObj::m_duration(int nargs) {
g_lingo->printSTUBWithArglist("AiffXObj::m_duration", nargs);
- g_lingo->dropStack(nargs);
- g_lingo->push(Datum(0)); // TODO: Implement
+ auto filePath = g_lingo->pop().asString();
+
+ // Mac-ify any mac-paths to make them at least consistent:
+ Common::replace(filePath, "\\", ":");
+
+ Common::MacResManager macresman;
+ macresman.open(Common::Path(pathMakeRelative(filePath), g_director->_dirSeparator));
+ auto aiffStream = macresman.getDataFork();
+
+ auto aiffHeader = Audio::AIFFHeader::readAIFFHeader(aiffStream, DisposeAfterUse::YES);
+
+ int duration = (aiffHeader->getFrameCount() / (float)aiffHeader->getFrameRate()) * 60;
+
+ delete aiffHeader;
+ g_lingo->push(Datum(duration));
}
} // End of namespace Director
More information about the Scummvm-git-logs
mailing list