[Scummvm-git-logs] scummvm master -> c89cc0bc4c7357ad5261f70ed10c1c1aa9f51085

sev- noreply at scummvm.org
Fri Feb 3 21:56:18 UTC 2023


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

Summary:
c89cc0bc4c DIRECTOR: Implement FindSys Xlib.


Commit: c89cc0bc4c7357ad5261f70ed10c1c1aa9f51085
    https://github.com/scummvm/scummvm/commit/c89cc0bc4c7357ad5261f70ed10c1c1aa9f51085
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-03T22:55:53+01:00

Commit Message:
DIRECTOR: Implement FindSys Xlib.

Used in teamxtreme2-win. Now the title goes in-game

Changed paths:
  A engines/director/lingo/xlibs/findsys.cpp
  A engines/director/lingo/xlibs/findsys.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 1f7711b8aa8..155fdd0c137 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -47,6 +47,7 @@
 #include "director/lingo/xlibs/fileexists.h"
 #include "director/lingo/xlibs/fileio.h"
 #include "director/lingo/xlibs/findfolder.h"
+#include "director/lingo/xlibs/findsys.h"
 #include "director/lingo/xlibs/flushxobj.h"
 #include "director/lingo/xlibs/fplayxobj.h"
 #include "director/lingo/xlibs/gpid.h"
@@ -156,6 +157,7 @@ static struct XLibProto {
 	{ FileExists::fileNames,			FileExists::open,			FileExists::close,			kXObj,					300 },	// D3
 	{ FileIO::fileNames,				FileIO::open,				FileIO::close,				kXObj | kXtraObj,		200 },	// D2
 	{ FindFolder::fileNames,			FindFolder::open,			FindFolder::close,			kXObj,					300 },	// D3
+	{ FindSys::fileNames,				FindSys::open,				FindSys::close,				kXObj,					400 },	// D4
 	{ FlushXObj::fileNames,				FlushXObj::open,			FlushXObj::close,			kXObj,					300 },	// D3
 	{ FPlayXObj::fileNames,				FPlayXObj::open,			FPlayXObj::close,			kXObj,					200 },	// D2
 	{ GpidXObj::fileNames,				GpidXObj::open,				GpidXObj::close,			kXObj,					400 },	// D4
diff --git a/engines/director/lingo/xlibs/findsys.cpp b/engines/director/lingo/xlibs/findsys.cpp
new file mode 100644
index 00000000000..1deeb51588a
--- /dev/null
+++ b/engines/director/lingo/xlibs/findsys.cpp
@@ -0,0 +1,85 @@
+/* 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/>.
+ *
+ */
+
+/**
+ * Findsys
+ * I      mNew                --Creates a new instance of the XObject
+ * X      mDispose            --Disposes of XObject instance
+ * S      mDo                 --Return the System directory path as a string
+ * -- Returns pathname OR:
+ * --     <empty string> couldn't allocate memory
+ * --     string beginning with the word 'Error:<description>'
+ * -- The Windows directory is where you should write Preferences files etc.
+ * -- Mark_Carolan at aapda.com.au Compuserve 100242,1154
+ *
+ * USED IN: teamxtreme2-win
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/findsys.h"
+
+
+namespace Director {
+
+// The name is different from the obj filename.
+const char *FindSys::xlibName = "FindSys";
+const char *FindSys::fileNames[] = {
+	"FindSys",
+	nullptr
+};
+
+static MethodProto xlibMethods[] = {
+	{ "new",		FindSys::m_new,			 0, 0,	400 },	// D4
+	{ "do",			FindSys::m_do,			 0, 0,  400 },	// D4
+	{ nullptr, nullptr, 0, 0, 0 }
+};
+
+void FindSys::open(int type) {
+	if (type == kXObj) {
+		FindSysXObject::initMethods(xlibMethods);
+		FindSysXObject *xobj = new FindSysXObject(kXObj);
+		g_lingo->exposeXObject(xlibName, xobj);
+	}
+}
+
+void FindSys::close(int type) {
+	if (type == kXObj) {
+		FindSysXObject::cleanupMethods();
+		g_lingo->_globalvars[xlibName] = Datum();
+	}
+}
+
+
+FindSysXObject::FindSysXObject(ObjectType ObjectType) : Object<FindSysXObject>("FindSys") {
+	_objType = ObjectType;
+}
+
+void FindSys::m_new(int nargs) {
+	g_lingo->push(g_lingo->_state->me);
+}
+
+void FindSys::m_do(int nargs) {
+	g_lingo->push(Common::String("C:\\WINDOWS"));
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/findsys.h b/engines/director/lingo/xlibs/findsys.h
new file mode 100644
index 00000000000..821fc019bb8
--- /dev/null
+++ b/engines/director/lingo/xlibs/findsys.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_FINDSYS_H
+#define DIRECTOR_LINGO_XLIBS_FINDSYS_H
+
+namespace Director {
+
+class FindSysXObject : public Object<FindSysXObject> {
+public:
+	FindSysXObject(ObjectType objType);
+};
+
+namespace FindSys {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_do(int nargs);
+
+} // End of namespace FindSys
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 6578bfc5663..f5b1e5db176 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -50,6 +50,7 @@ MODULE_OBJS = \
 	lingo/xlibs/fileexists.o \
 	lingo/xlibs/fileio.o \
 	lingo/xlibs/findfolder.o \
+	lingo/xlibs/findsys.o \
 	lingo/xlibs/flushxobj.o \
 	lingo/xlibs/fplayxobj.o \
 	lingo/xlibs/gpid.o \




More information about the Scummvm-git-logs mailing list