[Scummvm-git-logs] scummvm master -> 938e95a460bb7480bf980b1d8fc00afd17a727a7

mistydemeo noreply at scummvm.org
Sun Sep 8 22:42:00 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8b0178d35e DIRECTOR: stub implementation of two xlibs
1477e59e16 DIRECTOR: real implementation of dates
938e95a460 DIRECTOR: add Daijoubu xlib comments


Commit: 8b0178d35ea962b18fdbece55e58b6cd1a1f3bb3
    https://github.com/scummvm/scummvm/commit/8b0178d35ea962b18fdbece55e58b6cd1a1f3bb3
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2024-09-08T18:29:00-03:00

Commit Message:
DIRECTOR: stub implementation of two xlibs

Changed paths:
  A engines/director/lingo/xlibs/dateutil.cpp
  A engines/director/lingo/xlibs/dateutil.h
  A engines/director/lingo/xlibs/fsutil.cpp
  A engines/director/lingo/xlibs/fsutil.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 b89411f84dd..0495584eec6 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -45,6 +45,7 @@
 #include "director/lingo/xlibs/consumer.h"
 #include "director/lingo/xlibs/cursorxobj.h"
 #include "director/lingo/xlibs/darkenscreen.h"
+#include "director/lingo/xlibs/dateutil.h"
 #include "director/lingo/xlibs/developerStack.h"
 #include "director/lingo/xlibs/dialogsxobj.h"
 #include "director/lingo/xlibs/dirutil.h"
@@ -68,6 +69,7 @@
 #include "director/lingo/xlibs/findwin.h"
 #include "director/lingo/xlibs/flushxobj.h"
 #include "director/lingo/xlibs/fplayxobj.h"
+#include "director/lingo/xlibs/fsutil.h"
 #include "director/lingo/xlibs/genutils.h"
 #include "director/lingo/xlibs/getscreenrectsxfcn.h"
 #include "director/lingo/xlibs/getscreensizexfcn.h"
@@ -228,6 +230,7 @@ static struct XLibProto {
 	XLIBDEF(DPWAVIXObj,			kXObj,			300),	// D3
 	XLIBDEF(DPWQTWXObj,			kXObj,			300),	// D3
 	XLIBDEF(DarkenScreen,		kXObj,			300),	// D3
+	XLIBDEF(DateUtilXObj,			kXObj,					400),	// D4
 	XLIBDEF(DeveloperStack,		kXObj,			300),	// D3
 	XLIBDEF(DialogsXObj,		kXObj,			400),	// D4
 	XLIBDEF(DirUtilXObj,		kXObj,			400),	// D4
@@ -238,6 +241,7 @@ static struct XLibProto {
 	XLIBDEF(FEDraculXObj,		kXObj,			400),	// D4
 	XLIBDEF(FEIMasksXObj,		kXObj,			400),	// D4
 	XLIBDEF(FEIPrefsXObj,		kXObj,			400),	// D4
+	XLIBDEF(FSUtilXObj,			kXObj,					400),	// D4
 	XLIBDEF(FadeGammaDownXCMD,	kXObj,			400),	// D4
 	XLIBDEF(FadeGammaUpXCMD,	kXObj,			400),	// D4
 	XLIBDEF(FadeGammaXCMD,		kXObj,			400),	// D4
diff --git a/engines/director/lingo/xlibs/dateutil.cpp b/engines/director/lingo/xlibs/dateutil.cpp
new file mode 100644
index 00000000000..88085303911
--- /dev/null
+++ b/engines/director/lingo/xlibs/dateutil.cpp
@@ -0,0 +1,98 @@
+/* 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/dateutil.h"
+
+/**************************************************
+ *
+ * USED IN:
+ * Amusement Planet Phantasmagoria
+ *
+ **************************************************/
+
+/*
+-- DateUtil v1.0
+I 	mNew		--Make a new instance
+S 	mGetTime	--Get current Time String
+S	mGetDate	--Get current Date String
+S	mGetDateTime -- Get concatnated Date and Time String
+I	mGetSecond -- Second in number
+ */
+
+namespace Director {
+
+const char *DateUtilXObj::xlibName = "DateUtil";
+const XlibFileDesc DateUtilXObj::fileNames[] = {
+	{ "DateUtil",   nullptr },
+	{ nullptr,        nullptr },
+};
+
+static MethodProto xlibMethods[] = {
+	{ "new",				DateUtilXObj::m_new,		 0, 0,	400 },
+	{ "getTime",				DateUtilXObj::m_getTime,		 0, 0,	400 },
+	{ "getDate",				DateUtilXObj::m_getDate,		 0, 0,	400 },
+	{ "getDateTime",				DateUtilXObj::m_getDateTime,		 0, 0,	400 },
+	{ "getSecond",				DateUtilXObj::m_getSecond,		 0, 0,	400 },
+	{ nullptr, nullptr, 0, 0, 0 }
+};
+
+static BuiltinProto xlibBuiltins[] = {
+
+	{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
+};
+
+DateUtilXObject::DateUtilXObject(ObjectType ObjectType) :Object<DateUtilXObject>("DateUtil") {
+	_objType = ObjectType;
+}
+
+void DateUtilXObj::open(ObjectType type, const Common::Path &path) {
+    DateUtilXObject::initMethods(xlibMethods);
+    DateUtilXObject *xobj = new DateUtilXObject(type);
+    if (type == kXtraObj)
+        g_lingo->_openXtras.push_back(xlibName);
+    g_lingo->exposeXObject(xlibName, xobj);
+    g_lingo->initBuiltIns(xlibBuiltins);
+}
+
+void DateUtilXObj::close(ObjectType type) {
+    DateUtilXObject::cleanupMethods();
+    g_lingo->_globalvars[xlibName] = Datum();
+
+}
+
+void DateUtilXObj::m_new(int nargs) {
+	g_lingo->printSTUBWithArglist("DateUtilXObj::m_new", nargs);
+	g_lingo->dropStack(nargs);
+	g_lingo->push(g_lingo->_state->me);
+}
+
+XOBJSTUB(DateUtilXObj::m_getTime, "")
+XOBJSTUB(DateUtilXObj::m_getDate, "")
+XOBJSTUB(DateUtilXObj::m_getDateTime, "")
+XOBJSTUB(DateUtilXObj::m_getSecond, 0)
+
+}
diff --git a/engines/director/lingo/xlibs/dateutil.h b/engines/director/lingo/xlibs/dateutil.h
new file mode 100644
index 00000000000..1cef585ce3e
--- /dev/null
+++ b/engines/director/lingo/xlibs/dateutil.h
@@ -0,0 +1,50 @@
+/* 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_DATEUTIL_H
+#define DIRECTOR_LINGO_XLIBS_DATEUTIL_H
+
+namespace Director {
+
+class DateUtilXObject : public Object<DateUtilXObject> {
+public:
+	DateUtilXObject(ObjectType objType);
+};
+
+namespace DateUtilXObj {
+
+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_getTime(int nargs);
+void m_getDate(int nargs);
+void m_getDateTime(int nargs);
+void m_getSecond(int nargs);
+
+} // End of namespace DateUtilXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/lingo/xlibs/fsutil.cpp b/engines/director/lingo/xlibs/fsutil.cpp
new file mode 100644
index 00000000000..43b0f40debd
--- /dev/null
+++ b/engines/director/lingo/xlibs/fsutil.cpp
@@ -0,0 +1,96 @@
+/* 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/fsutil.h"
+
+/**************************************************
+ *
+ * USED IN:
+ * Amusement Planet Phantasmagoria
+ * Ursa Minor Blue
+ *
+ **************************************************/
+
+/*
+-- FSUtil XObj v0.1d ©1995 Halfmoon Systems Co. Ltd.
+I mNew
+X mDispose
+S mGetSystemFolder
+IS mMakeFolder, <FolderPath>
+ */
+
+namespace Director {
+
+const char *FSUtilXObj::xlibName = "FSUtil";
+const XlibFileDesc FSUtilXObj::fileNames[] = {
+	{ "FSUtil",   nullptr },
+	{ nullptr,        nullptr },
+};
+
+static MethodProto xlibMethods[] = {
+	{ "new",				FSUtilXObj::m_new,		 0, 0,	400 },
+	{ "dispose",				FSUtilXObj::m_dispose,		 0, 0,	400 },
+	{ "getSystemFolder",				FSUtilXObj::m_getSystemFolder,		 0, 0,	400 },
+	{ "makeFolder",				FSUtilXObj::m_makeFolder,		 1, 1,	400 },
+	{ nullptr, nullptr, 0, 0, 0 }
+};
+
+static BuiltinProto xlibBuiltins[] = {
+
+	{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
+};
+
+FSUtilXObject::FSUtilXObject(ObjectType ObjectType) :Object<FSUtilXObject>("FSUtil") {
+	_objType = ObjectType;
+}
+
+void FSUtilXObj::open(ObjectType type, const Common::Path &path) {
+    FSUtilXObject::initMethods(xlibMethods);
+    FSUtilXObject *xobj = new FSUtilXObject(type);
+    if (type == kXtraObj)
+        g_lingo->_openXtras.push_back(xlibName);
+    g_lingo->exposeXObject(xlibName, xobj);
+    g_lingo->initBuiltIns(xlibBuiltins);
+}
+
+void FSUtilXObj::close(ObjectType type) {
+    FSUtilXObject::cleanupMethods();
+    g_lingo->_globalvars[xlibName] = Datum();
+
+}
+
+void FSUtilXObj::m_new(int nargs) {
+	g_lingo->printSTUBWithArglist("FSUtilXObj::m_new", nargs);
+	g_lingo->dropStack(nargs);
+	g_lingo->push(g_lingo->_state->me);
+}
+
+XOBJSTUBNR(FSUtilXObj::m_dispose)
+XOBJSTUB(FSUtilXObj::m_getSystemFolder, "")
+XOBJSTUB(FSUtilXObj::m_makeFolder, 0)
+
+}
diff --git a/engines/director/lingo/xlibs/fsutil.h b/engines/director/lingo/xlibs/fsutil.h
new file mode 100644
index 00000000000..8fa05d51335
--- /dev/null
+++ b/engines/director/lingo/xlibs/fsutil.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_FSUTIL_H
+#define DIRECTOR_LINGO_XLIBS_FSUTIL_H
+
+namespace Director {
+
+class FSUtilXObject : public Object<FSUtilXObject> {
+public:
+	FSUtilXObject(ObjectType objType);
+};
+
+namespace FSUtilXObj {
+
+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_getSystemFolder(int nargs);
+void m_makeFolder(int nargs);
+
+} // End of namespace FSUtilXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 4c58fdc97de..f4bbab8d0fc 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -74,6 +74,7 @@ MODULE_OBJS = \
 	lingo/xlibs/consumer.o \
 	lingo/xlibs/cursorxobj.o \
 	lingo/xlibs/darkenscreen.o \
+	lingo/xlibs/dateutil.o \
 	lingo/xlibs/developerStack.o \
 	lingo/xlibs/dialogsxobj.o \
 	lingo/xlibs/dirutil.o \
@@ -97,6 +98,7 @@ MODULE_OBJS = \
 	lingo/xlibs/findwin.o \
 	lingo/xlibs/flushxobj.o \
 	lingo/xlibs/fplayxobj.o \
+	lingo/xlibs/fsutil.o \
 	lingo/xlibs/genutils.o \
 	lingo/xlibs/getscreenrectsxfcn.o \
 	lingo/xlibs/getscreensizexfcn.o \


Commit: 1477e59e1689565c11ed5627602767c321bb550f
    https://github.com/scummvm/scummvm/commit/1477e59e1689565c11ed5627602767c321bb550f
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2024-09-08T19:29:13-03:00

Commit Message:
DIRECTOR: real implementation of dates

Changed paths:
    engines/director/lingo/xlibs/dateutil.cpp


diff --git a/engines/director/lingo/xlibs/dateutil.cpp b/engines/director/lingo/xlibs/dateutil.cpp
index 88085303911..0b16fd9dbf3 100644
--- a/engines/director/lingo/xlibs/dateutil.cpp
+++ b/engines/director/lingo/xlibs/dateutil.cpp
@@ -90,8 +90,54 @@ void DateUtilXObj::m_new(int nargs) {
 	g_lingo->push(g_lingo->_state->me);
 }
 
-XOBJSTUB(DateUtilXObj::m_getTime, "")
-XOBJSTUB(DateUtilXObj::m_getDate, "")
+// Amusement Planet Phantasmagoria calls this method, treating its return
+// value as a single string, and reading chars 1-4, 6-7, 9-10, and 12-14
+// as the values we set here.
+void DateUtilXObj::m_getDate(int nargs) {
+	TimeDate time;
+	g_system->getTimeAndDate(time);
+
+	Common::String day;
+	switch (time.tm_wday) {
+	case 0:
+		day = Common::String("SUN");
+		;;
+	case 1:
+		day = Common::String("MON");
+		;;
+	case 2:
+		day = Common::String("TUE");
+		;;
+	case 3:
+		day = Common::String("WED");
+		;;
+	case 4:
+		day = Common::String("THU");
+		;;
+	case 5:
+		day = Common::String("FRI");
+		;;
+	case 6:
+		day = Common::String("SAT");
+		;;
+	}
+
+	// Phantasmagoria's get_season() suggests months start from 1.
+	Common::String out = Common::String::format("%04d:%02d:%02d:%s", time.tm_year + 1900, time.tm_mon + 1, time.tm_mday, day.c_str());
+	g_lingo->push(Datum(out));
+}
+
+// Amusement Planet Phantasmagoria calls this method, treating its return
+// value as a single string, and reading chars 1-2, 4-5 and 7-8 as the
+// values we set here.
+void DateUtilXObj::m_getTime(int nargs) {
+	TimeDate time;
+	g_system->getTimeAndDate(time);
+
+	Common::String out = Common::String::format("%02d:%02d:%02d", time.tm_hour, time.tm_min, time.tm_sec);
+	g_lingo->push(Datum(out));
+}
+
 XOBJSTUB(DateUtilXObj::m_getDateTime, "")
 XOBJSTUB(DateUtilXObj::m_getSecond, 0)
 


Commit: 938e95a460bb7480bf980b1d8fc00afd17a727a7
    https://github.com/scummvm/scummvm/commit/938e95a460bb7480bf980b1d8fc00afd17a727a7
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2024-09-08T19:29:14-03:00

Commit Message:
DIRECTOR: add Daijoubu xlib comments

Changed paths:
    engines/director/lingo/xlibs/dateutil.cpp
    engines/director/lingo/xlibs/fsutil.cpp


diff --git a/engines/director/lingo/xlibs/dateutil.cpp b/engines/director/lingo/xlibs/dateutil.cpp
index 0b16fd9dbf3..82217c46bb2 100644
--- a/engines/director/lingo/xlibs/dateutil.cpp
+++ b/engines/director/lingo/xlibs/dateutil.cpp
@@ -138,6 +138,7 @@ void DateUtilXObj::m_getTime(int nargs) {
 	g_lingo->push(Datum(out));
 }
 
+// These two methods are never called in Phantasmagoria.
 XOBJSTUB(DateUtilXObj::m_getDateTime, "")
 XOBJSTUB(DateUtilXObj::m_getSecond, 0)
 
diff --git a/engines/director/lingo/xlibs/fsutil.cpp b/engines/director/lingo/xlibs/fsutil.cpp
index 43b0f40debd..b7ebcdb217f 100644
--- a/engines/director/lingo/xlibs/fsutil.cpp
+++ b/engines/director/lingo/xlibs/fsutil.cpp
@@ -90,7 +90,12 @@ void FSUtilXObj::m_new(int nargs) {
 }
 
 XOBJSTUBNR(FSUtilXObj::m_dispose)
+// This stub is fine: a system folder of "" roots the files it creates in
+// ScummVM's save directory.
 XOBJSTUB(FSUtilXObj::m_getSystemFolder, "")
+// This stub is also fine; the only folders it creates are within the
+// save directory, and since ScummVM encodes the path inside the filename
+// instead of actually creating directories, we don't have to do anything.
 XOBJSTUB(FSUtilXObj::m_makeFolder, 0)
 
 }




More information about the Scummvm-git-logs mailing list