Initial commit
This commit is contained in:
60
engines/director/lingo/xlibs/f/fadegammadownxcmd.cpp
Normal file
60
engines/director/lingo/xlibs/f/fadegammadownxcmd.cpp
Normal 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/f/fadegammadownxcmd.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* puppetmotel
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FadeGammaDownXCMD::xlibName = "FadeGammaDown";
|
||||
const XlibFileDesc FadeGammaDownXCMD::fileNames[] = {
|
||||
{ "FadeGammaDown", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FadeGammaDown", FadeGammaDownXCMD::m_FadeGammaDown, -1, 0, 400, CBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FadeGammaDownXCMD::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FadeGammaDownXCMD::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
XOBJSTUB(FadeGammaDownXCMD::m_FadeGammaDown, 0)
|
||||
|
||||
}
|
||||
41
engines/director/lingo/xlibs/f/fadegammadownxcmd.h
Normal file
41
engines/director/lingo/xlibs/f/fadegammadownxcmd.h
Normal 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_FADEGAMMADOWNXCMD_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FADEGAMMADOWNXCMD_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FadeGammaDownXCMD {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_FadeGammaDown(int nargs);
|
||||
|
||||
} // End of namespace FadeGammaDownXCMD
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
60
engines/director/lingo/xlibs/f/fadegammaupxcmd.cpp
Normal file
60
engines/director/lingo/xlibs/f/fadegammaupxcmd.cpp
Normal 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/f/fadegammaupxcmd.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* puppetmotel
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FadeGammaUpXCMD::xlibName = "FadeGammaUp";
|
||||
const XlibFileDesc FadeGammaUpXCMD::fileNames[] = {
|
||||
{ "FadeGammaUp", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FadeGammaUp", FadeGammaUpXCMD::m_FadeGammaUp, -1, 0, 400, CBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FadeGammaUpXCMD::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FadeGammaUpXCMD::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
XOBJSTUB(FadeGammaUpXCMD::m_FadeGammaUp, 0)
|
||||
|
||||
}
|
||||
41
engines/director/lingo/xlibs/f/fadegammaupxcmd.h
Normal file
41
engines/director/lingo/xlibs/f/fadegammaupxcmd.h
Normal 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_FADEGAMMAUPXCMD_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FADEGAMMAUPXCMD_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FadeGammaUpXCMD {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_FadeGammaUp(int nargs);
|
||||
|
||||
} // End of namespace FadeGammaUpXCMD
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
60
engines/director/lingo/xlibs/f/fadegammaxcmd.cpp
Normal file
60
engines/director/lingo/xlibs/f/fadegammaxcmd.cpp
Normal 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/f/fadegammaxcmd.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* puppetmotel
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FadeGammaXCMD::xlibName = "FadeGamma";
|
||||
const XlibFileDesc FadeGammaXCMD::fileNames[] = {
|
||||
{ "FadeGamma", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FadeGamma", FadeGammaXCMD::m_FadeGamma, -1, 0, 400, CBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FadeGammaXCMD::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FadeGammaXCMD::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
XOBJSTUB(FadeGammaXCMD::m_FadeGamma, 0)
|
||||
|
||||
}
|
||||
41
engines/director/lingo/xlibs/f/fadegammaxcmd.h
Normal file
41
engines/director/lingo/xlibs/f/fadegammaxcmd.h
Normal 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_FADEGAMMAXCMD_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FADEGAMMAXCMD_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FadeGammaXCMD {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_FadeGamma(int nargs);
|
||||
|
||||
} // End of namespace FadeGammaXCMD
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
115
engines/director/lingo/xlibs/f/fedracul.cpp
Normal file
115
engines/director/lingo/xlibs/f/fedracul.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/* 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:
|
||||
* Dracula's Secret
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* -- FEDracul External Factory.
|
||||
* FEDracul
|
||||
* I mNew --Creates a new instance of the XObject
|
||||
* X mDispose --Disposes of XObject instance
|
||||
* S mName --Returns the XObject name (FEIMask)
|
||||
* IP mCreateInventory -- hPictOfBackground
|
||||
* IPII mAddToInventory -- hPictOfItem,row,column
|
||||
* P mGetInventory -- retrieve hPictOfInventory
|
||||
* I mDestroyInventory --
|
||||
* IIPI mSetCharData -- letter,hpicLetter,letterWidth
|
||||
* I mIsWindows95
|
||||
* I mDisableScreenSaver
|
||||
* II mEnableScreenSaver
|
||||
* I mProgramStartup
|
||||
* II mProgramShutdown
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/fedracul.h"
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FEDraculXObj::xlibName = "FEDracul";
|
||||
const XlibFileDesc FEDraculXObj::fileNames[] = {
|
||||
{ "FEDracul", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", FEDraculXObj::m_new, 0, 0, 400 }, // D4
|
||||
{ "AddToInventory", FEDraculXObj::m_AddToInventory, 3, 3, 400 }, // D4
|
||||
{ "CreateInventory", FEDraculXObj::m_CreateInventory, 1, 1, 400 }, // D4
|
||||
{ "DestroyInventory", FEDraculXObj::m_DestroyInventory, 0, 0, 400 }, // D4
|
||||
{ "GetInventory", FEDraculXObj::m_GetInventory, 0, 0, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void FEDraculXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FEDraculXObject::initMethods(xlibMethods);
|
||||
FEDraculXObject *xobj = new FEDraculXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void FEDraculXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
FEDraculXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FEDraculXObject::FEDraculXObject(ObjectType ObjectType) : Object<FEDraculXObject>("FEDracul") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void FEDraculXObj::m_new(int nargs) {
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEDraculXObj::m_AddToInventory(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEDraculXObj::AddToInventory", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEDraculXObj::m_CreateInventory(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEDraculXObj::CreateInventory", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEDraculXObj::m_DestroyInventory(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEDraculXObj:mDestroyInventory", nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEDraculXObj::m_GetInventory(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEDraculXObj::GetInventory", nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
51
engines/director/lingo/xlibs/f/fedracul.h
Normal file
51
engines/director/lingo/xlibs/f/fedracul.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* 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_FEDRACUL_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FEDRACUL_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FEDraculXObject : public Object<FEDraculXObject> {
|
||||
public:
|
||||
FEDraculXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FEDraculXObj {
|
||||
|
||||
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_AddToInventory(int nargs);
|
||||
void m_CreateInventory(int nargs);
|
||||
void m_DestroyInventory(int nargs);
|
||||
void m_GetInventory(int nargs);
|
||||
|
||||
} // End of namespace FEDraculXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
88
engines/director/lingo/xlibs/f/feimasks.cpp
Normal file
88
engines/director/lingo/xlibs/f/feimasks.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* 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:
|
||||
* Dracula's Secret
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* -- FEIMasks External Factory.
|
||||
* FEIMasks
|
||||
* IPIIII mNew --Creates a new instance of the XObject
|
||||
* X mDispose --Disposes of XObject instance
|
||||
* S mName --Returns the XObject name (FEIMask)
|
||||
* III mMaskID -- h,v
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/feimasks.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FEIMasksXObj::xlibName = "FEIMasks";
|
||||
const XlibFileDesc FEIMasksXObj::fileNames[] = {
|
||||
{ "FEIMasks", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", FEIMasksXObj::m_new, 0, 0, 400 }, // D4
|
||||
{ "MaskID", FEIMasksXObj::m_MaskID, 2, 2, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void FEIMasksXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FEIMasksXObject::initMethods(xlibMethods);
|
||||
FEIMasksXObject *xobj = new FEIMasksXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void FEIMasksXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
FEIMasksXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
FEIMasksXObject::FEIMasksXObject(ObjectType ObjectType) : Object<FEIMasksXObject>("FEIMasks") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void FEIMasksXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEIMasksXObj::new", nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEIMasksXObj::m_MaskID(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEIMasksXObj::MaskID", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum());
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
48
engines/director/lingo/xlibs/f/feimasks.h
Normal file
48
engines/director/lingo/xlibs/f/feimasks.h
Normal file
@@ -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_FEIMASKS_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FEIMASKS_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FEIMasksXObject : public Object<FEIMasksXObject> {
|
||||
public:
|
||||
FEIMasksXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FEIMasksXObj {
|
||||
|
||||
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_MaskID(int nargs);
|
||||
|
||||
} // End of namespace IntroMaskXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
101
engines/director/lingo/xlibs/f/feiprefs.cpp
Normal file
101
engines/director/lingo/xlibs/f/feiprefs.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
/* 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:
|
||||
* Dracula's Secret
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* -- FEIPrefs External Factory.
|
||||
* FEIPrefs
|
||||
* I mNew --Creates a new instance of the XObject
|
||||
* X mDispose --Disposes of XObject instance
|
||||
* S mName --Returns the XObject name (FEIPref)
|
||||
* ISS mPrefAppName -- GroupName,AppName
|
||||
* ISSS mPrefWriteString -- Section,Entry,String
|
||||
* ISSI mPrefWriteInteger -- Section,Entry,Integer
|
||||
* ISSI mPrefReadInteger -- Section,Entry,Default
|
||||
* SSSS mPrefReadString -- Section,Entry,Default
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/feiprefs.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FEIPrefsXObj::xlibName = "FEIPrefs";
|
||||
const XlibFileDesc FEIPrefsXObj::fileNames[] = {
|
||||
{ "feiprefs", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", FEIPrefsXObj::m_new, 0, 0, 400 }, // D4
|
||||
{ "PrefAppName", FEIPrefsXObj::m_prefAppName, 2, 2, 400 }, // D4
|
||||
{ "PrefReadString", FEIPrefsXObj::m_prefReadString, 3, 3, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void FEIPrefsXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FEIPrefsXObject::initMethods(xlibMethods);
|
||||
FEIPrefsXObject *xobj = new FEIPrefsXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void FEIPrefsXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
FEIPrefsXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FEIPrefsXObject::FEIPrefsXObject(ObjectType ObjectType) : Object<FEIPrefsXObject>("FEIPrefs") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void FEIPrefsXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEIPrefsXObj::new", nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FEIPrefsXObj::m_prefAppName(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEIPrefsXObj::m_prefAppName", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
|
||||
void FEIPrefsXObj::m_prefReadString(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("FEIPrefsXObj::m_prefReadString", nargs);
|
||||
g_lingo->pop(); // TODO
|
||||
auto key = g_lingo->pop().asString();
|
||||
auto defaultValue = g_lingo->pop();
|
||||
g_lingo->push(defaultValue); // TODO: Just return the default for now.
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
49
engines/director/lingo/xlibs/f/feiprefs.h
Normal file
49
engines/director/lingo/xlibs/f/feiprefs.h
Normal file
@@ -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_FEIPREFS_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FEIPREFS_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FEIPrefsXObject : public Object<FEIPrefsXObject> {
|
||||
public:
|
||||
FEIPrefsXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FEIPrefsXObj {
|
||||
|
||||
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_prefAppName(int nargs);
|
||||
void m_prefReadString(int nargs);
|
||||
|
||||
} // End of namespace IntroMaskXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
85
engines/director/lingo/xlibs/f/fileexists.cpp
Normal file
85
engines/director/lingo/xlibs/f/fileexists.cpp
Normal file
@@ -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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Yearn2Learn: The Flintstones Coloring Book
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* © 1989,1990 Apple Computer, Inc., v.1.1, by Anup Murarka
|
||||
* FileExists(pathname «, “noDialog”:errGlobal»)
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/savefile.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/fileexists.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FileExists::xlibName = "FileExists";
|
||||
const XlibFileDesc FileExists::fileNames[] = {
|
||||
{ "FileExists", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FileExists", FileExists::m_fileexists, 1, 1, 300, HBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FileExists::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FileExists::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FileExists::m_fileexists(int nargs) {
|
||||
// This is mostly copied from FileIO::m_new
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
Common::String path = g_lingo->pop().asString();
|
||||
Common::String origpath = path;
|
||||
|
||||
if (!path.hasSuffixIgnoreCase(".txt")) {
|
||||
path += ".txt";
|
||||
}
|
||||
Common::String filename = lastPathComponent(path, g_director->_dirSeparator);
|
||||
if (!(saves->exists(filename))) {
|
||||
Common::File file;
|
||||
Common::Path location = findPath(origpath);
|
||||
if (location.empty() || !file.open(location)) {
|
||||
g_lingo->push(Datum(false));
|
||||
return;
|
||||
}
|
||||
g_lingo->push(Datum(true));
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
41
engines/director/lingo/xlibs/f/fileexists.h
Normal file
41
engines/director/lingo/xlibs/f/fileexists.h
Normal 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_FILEEXISTS_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FILEEXISTS_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FileExists {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_fileexists(int nargs);
|
||||
|
||||
} // End of namespace FileExists
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
752
engines/director/lingo/xlibs/f/fileio.cpp
Normal file
752
engines/director/lingo/xlibs/f/fileio.cpp
Normal file
@@ -0,0 +1,752 @@
|
||||
/* 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 Director Xtra
|
||||
* Karma: Curse of the 12 Caves
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* -- XObject version
|
||||
*
|
||||
* --FileIO, Tool, 1.5.0 , 31mar92
|
||||
* --© 1989-1992 MacroMind, Inc.
|
||||
* --by John Thompson and Al McNeil
|
||||
* ---------------------------------------------------------------------
|
||||
* ---------------------------------------------------------------------
|
||||
* --=METHODS=--
|
||||
* --
|
||||
* ISS mNew, mode, fileNameOrType --Creates a new instance of the XObject.
|
||||
* -- Mode can be :
|
||||
* -- "read" - Read "fileName"
|
||||
* -- "?read" - Select and Read "fileType"
|
||||
* -- "write" - Write "fileName"
|
||||
* -- "?write" - Select and Write "fileName"
|
||||
* -- "append" - Append "fileName"
|
||||
* -- "?append" - Select and Append "fileName"
|
||||
* -- FileType for ?read can be :
|
||||
* -- "TEXT" - standard file type
|
||||
* -- "trak" - cd track type
|
||||
* -- etc... - Any four character combination.
|
||||
* --
|
||||
* X mDispose --Disposes of XObject instance.
|
||||
* S mName --Returns the name of the XObject.
|
||||
* /IXX mWrite, countPtr, bufferPtr --Writes out a set of chars. Returns error code.
|
||||
* II mWriteChar, charNum --Writes a single character. Returns error code.
|
||||
* IS mWriteString, string --Writes out a string of chars. Returns error code.
|
||||
* /IXX mRead, countPtr, bufferPtr --Reads into buffer. Returns error code.
|
||||
* I mReadChar --Returns a single character.
|
||||
* S mReadWord --Returns the next word of an input file.
|
||||
* S mReadLine --Returns the next line of an input file.
|
||||
* S mReadFile --Returns the remainder of the file.
|
||||
* --
|
||||
* SSS mReadToken, breakString, skipString
|
||||
* -- --breakstring designates character (or token) that signals to stop reading.
|
||||
* -- --skipstring designates what characters (or tokens) not to read.
|
||||
* I mGetPosition --Returns the file position.
|
||||
* II mSetPosition, newPos --Sets the file position. Returns error code.
|
||||
* I mGetLength --Returns the number of chars in the file.
|
||||
* ISS mSetFinderInfo, typeString, creatorString --Sets the finder info. Returns error code.
|
||||
* S mGetFinderInfo --Gets the finder info.
|
||||
* S mFileName --Returns the name of the file.
|
||||
* S mNativeFileName --Returns the name of the file.
|
||||
* I mDelete --Delete the file and dispose of me.
|
||||
* I mStatus --Returns result code of the last file io activity
|
||||
* --
|
||||
* SI +mError, errorCode --Returns error message string.
|
||||
* -- Possible error codes:
|
||||
* -- -33 :: File directory full
|
||||
* -- -34 :: Volume full
|
||||
* -- -35 :: Volume not found
|
||||
* -- -36 :: I/O Error
|
||||
* -- -37 :: Bad file name
|
||||
* -- -38 :: File not open
|
||||
* -- -42 :: Too many files open
|
||||
* -- -43 :: File not found
|
||||
* -- -56 :: No such drive
|
||||
* -- -65 :: No disk in drive
|
||||
* -- -120 :: Directory not found
|
||||
* V mReadPICT
|
||||
* II +mSetOverrideDrive, driveLetter --Set override drive letter ('A' - 'Z') to use when loading linked castmembers. Use 0x00 to clear override.
|
||||
*
|
||||
* -- Xtra version
|
||||
-- xtra fileio -- CH May96
|
||||
new object me -- create a new child instance
|
||||
-- FILEIO --
|
||||
fileName object me -- return fileName string of the open file
|
||||
status object me -- return the error code of the last method called
|
||||
error object me, int error -- return the error string of the error
|
||||
setFilterMask me, string mask -- set the filter mask for dialogs
|
||||
openFile object me, string fileName, int mode -- opens named file. valid modes: 0=r/w 1=r 2=w
|
||||
closeFile object me -- close the file
|
||||
displayOpen object me -- displays an open dialog and returns the selected fileName to lingo
|
||||
displaySave object me, string title, string defaultFileName -- displays save dialog and returns selected fileName to lingo
|
||||
createFile object me, string fileName -- creates a new file called fileName
|
||||
setPosition object me, int position -- set the file position
|
||||
getPosition object me -- get the file position
|
||||
getLength object me -- get the length of the open file
|
||||
writeChar object me, string theChar -- write a single character (by ASCII code) to the file
|
||||
writeString object me, string theString -- write a null-terminated string to the file
|
||||
readChar object me -- read the next character of the file and return it as an ASCII code value
|
||||
readLine object me -- read the next line of the file (including the next RETURN) and return as a string
|
||||
readFile object me -- read from current position to EOF and return as a string
|
||||
readWord object me -- read the next word of the file and return it as a string
|
||||
readToken object me, string skip, string break -- read the next token and return it as a string
|
||||
getFinderInfo object me -- get the finder info for the open file (Mac Only)
|
||||
setFinderInfo object me, string attributes -- set the finder info for the open file (Mac Only)
|
||||
delete object me -- deletes the open file
|
||||
+ version xtraRef -- display fileIO version and build information in the message window
|
||||
* getOSDirectory -- returns the full path to the Mac System Folder or Windows Directory
|
||||
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/macresman.h"
|
||||
#include "common/memstream.h"
|
||||
#include "common/savefile.h"
|
||||
#include "image/pict.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/picture.h"
|
||||
#include "director/types.h"
|
||||
#include "director/util.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/f/fileio.h"
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FileIO::xlibName = "FileIO";
|
||||
const XlibFileDesc FileIO::fileNames[] = {
|
||||
{ "FileIO", nullptr },
|
||||
{ "shFILEIO", nullptr }, // TD loads this up using openXLib("@:shFILEIO.DLL")
|
||||
{ "FILE", nullptr },
|
||||
{ "FILEIO16", nullptr },
|
||||
{ "FileIOXtraFat", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
// XObject
|
||||
{ "delete", FileIO::m_delete, 0, 0, 200 }, // D2
|
||||
{ "error", FileIO::m_error, 1, 1, 200 }, // D2
|
||||
{ "fileName", FileIO::m_fileName, 0, 0, 200 }, // D2
|
||||
{ "getFinderInfo", FileIO::m_getFinderInfo, 0, 0, 200 }, // D2
|
||||
{ "getLength", FileIO::m_getLength, 0, 0, 200 }, // D2
|
||||
{ "getPosition", FileIO::m_getPosition, 0, 0, 200 }, // D2
|
||||
{ "new", FileIO::m_new, 0, 2, 200 }, // D2
|
||||
{ "readChar", FileIO::m_readChar, 0, 0, 200 }, // D2
|
||||
{ "readFile", FileIO::m_readFile, 0, 0, 200 }, // D2
|
||||
{ "readLine", FileIO::m_readLine, 0, 0, 200 }, // D2
|
||||
{ "readToken", FileIO::m_readToken, 2, 2, 200 }, // D2
|
||||
{ "readPict", FileIO::m_readPict, 0, 0, 300 }, // D3
|
||||
{ "readWord", FileIO::m_readWord, 0, 0, 200 }, // D2
|
||||
{ "setFinderInfo", FileIO::m_setFinderInfo, 2, 2, 200 }, // D2
|
||||
{ "setPosition", FileIO::m_setPosition, 1, 1, 200 }, // D2
|
||||
{ "status", FileIO::m_status, 0, 0, 200 }, // D2
|
||||
{ "writeChar", FileIO::m_writeChar, 1, 1, 200 }, // D2
|
||||
{ "writeString", FileIO::m_writeString, 1, 1, 200 }, // D2
|
||||
// Windows only?
|
||||
{ "setOverrideDrive", FileIO::m_setOverrideDrive, 1, 1, 300 }, // D3
|
||||
// Xtra
|
||||
{ "closeFile", FileIO::m_closeFile, 0, 0, 500 }, // D5
|
||||
{ "createFile", FileIO::m_createFile, 1, 1, 500 }, // D5
|
||||
{ "displayOpen", FileIO::m_displayOpen, 0, 0, 500 }, // D5
|
||||
{ "displaySave", FileIO::m_displaySave, 2, 2, 500 }, // D5
|
||||
{ "openFile", FileIO::m_openFile, 2, 2, 500 }, // D5
|
||||
{ "setFilterMask", FileIO::m_setFilterMask, 1, 1, 500 }, // D5
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
{ "getOSDirectory", FileIO::m_getOSDirectory, 0, 0, 500, HBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
|
||||
void FileIO::open(ObjectType type, const Common::Path &path) {
|
||||
FileObject::initMethods(xlibMethods);
|
||||
FileObject *xobj = new FileObject(type);
|
||||
if (type == kXtraObj) {
|
||||
g_lingo->_openXtras.push_back(xlibName);
|
||||
g_lingo->_openXtraObjects.push_back(xobj);
|
||||
}
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void FileIO::close(ObjectType type) {
|
||||
FileObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
|
||||
// Initialization/disposal
|
||||
|
||||
FileObject::FileObject(ObjectType objType) : Object<FileObject>("FileIO") {
|
||||
_objType = objType;
|
||||
_filename = nullptr;
|
||||
_inStream = nullptr;
|
||||
_outFile = nullptr;
|
||||
_outStream = nullptr;
|
||||
_lastError = kErrorNone;
|
||||
}
|
||||
|
||||
FileObject::FileObject(const FileObject &obj) : Object<FileObject>(obj) {
|
||||
_objType = obj.getObjType();
|
||||
_filename = nullptr;
|
||||
_inStream = nullptr;
|
||||
_outFile = nullptr;
|
||||
_outStream = nullptr;
|
||||
_lastError = kErrorNone;
|
||||
}
|
||||
|
||||
FileObject::~FileObject() {
|
||||
clear();
|
||||
}
|
||||
|
||||
bool FileObject::hasProp(const Common::String &propName) {
|
||||
return (propName == "name");
|
||||
}
|
||||
|
||||
Datum FileObject::getProp(const Common::String &propName) {
|
||||
if (propName == "name")
|
||||
return Datum(FileIO::xlibName);
|
||||
warning("FileIO::getProp: unknown property '%s'", propName.c_str());
|
||||
return Datum();
|
||||
}
|
||||
|
||||
FileIOError FileObject::open(const Common::String &origpath, const Common::String &mode) {
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
Common::String path = origpath;
|
||||
Common::String option = mode;
|
||||
char dirSeparator = g_director->_dirSeparator;
|
||||
|
||||
Common::String prefix = savePrefix();
|
||||
|
||||
if (option.hasPrefix("?")) {
|
||||
option = option.substr(1);
|
||||
path = getFileNameFromModal(option.equalsIgnoreCase("write"), origpath, Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
return kErrorFileNotFound;
|
||||
}
|
||||
dirSeparator = '/';
|
||||
} else if (!path.hasSuffixIgnoreCase(".txt")) {
|
||||
path += ".txt";
|
||||
}
|
||||
|
||||
// We pretend that drive E:\ is a read-only CD-ROM
|
||||
// It helps with CD checks in many games
|
||||
if (option.equalsIgnoreCase("write") || option.equalsIgnoreCase("append")) {
|
||||
if (origpath.hasPrefixIgnoreCase("E:\\"))
|
||||
return kErrorIO;
|
||||
}
|
||||
|
||||
// In general, we assume that there are no drives beyond disk E:
|
||||
if (origpath.size() >= 2 && origpath[1] == ':' && (toupper(origpath[0]) > 'E')) {
|
||||
return kErrorIO;
|
||||
}
|
||||
|
||||
// Enforce target to the created files so they do not mix up
|
||||
Common::String filenameOrig = lastPathComponent(path, dirSeparator);
|
||||
|
||||
Common::String filename = filenameOrig;
|
||||
if (!filename.hasPrefixIgnoreCase(prefix))
|
||||
filename = prefix + filenameOrig;
|
||||
|
||||
if (option.equalsIgnoreCase("read")) {
|
||||
_inStream = saves->openForLoading(filename);
|
||||
if (!_inStream) {
|
||||
// Maybe we're trying to read one of the game files
|
||||
Common::Path location = findPath(origpath);
|
||||
Common::SeekableReadStream *file = Common::MacResManager::openFileOrDataFork(location);
|
||||
if (!file) {
|
||||
return saveFileError();
|
||||
}
|
||||
_inStream = file;
|
||||
}
|
||||
} else if (option.equalsIgnoreCase("write")) {
|
||||
// OutSaveFile is not seekable so create a separate seekable stream
|
||||
// which will be written to the _outFile upon disposal
|
||||
_outFile = saves->openForSaving(filename, false);
|
||||
_outStream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
|
||||
if (!_outFile) {
|
||||
return saveFileError();
|
||||
}
|
||||
} else if (option.equalsIgnoreCase("append")) {
|
||||
Common::SeekableReadStream *inFile = saves->openForLoading(filename);
|
||||
if (!inFile) {
|
||||
Common::Path location = findPath(origpath);
|
||||
Common::SeekableReadStream *file = Common::MacResManager::openFileOrDataFork(location);
|
||||
if (!file) {
|
||||
return saveFileError();
|
||||
}
|
||||
inFile = file;
|
||||
}
|
||||
_outStream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
|
||||
byte b = inFile->readByte();
|
||||
while (!inFile->eos() && !inFile->err()) {
|
||||
_outStream->writeByte(b);
|
||||
b = inFile->readByte();
|
||||
}
|
||||
delete inFile;
|
||||
_outFile = saves->openForSaving(filename, false);
|
||||
if (!_outFile) {
|
||||
return saveFileError();
|
||||
}
|
||||
} else {
|
||||
error("Unsupported FileIO option: '%s'", option.c_str());
|
||||
}
|
||||
|
||||
_filename = new Common::String(filename);
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
void FileObject::clear() {
|
||||
if (_filename) {
|
||||
delete _filename;
|
||||
_filename = nullptr;
|
||||
}
|
||||
if (_inStream) {
|
||||
delete _inStream;
|
||||
_inStream = nullptr;
|
||||
}
|
||||
if (_outFile) {
|
||||
_outFile->write(_outStream->getData(), _outStream->size());
|
||||
_outFile->finalize();
|
||||
delete _outFile;
|
||||
delete _outStream;
|
||||
_outFile = nullptr;
|
||||
_outStream = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void FileObject::dispose() {
|
||||
_disposed = true;
|
||||
clear();
|
||||
}
|
||||
|
||||
FileIOError FileObject::saveFileError() {
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
if (saves->getError().getCode()) {
|
||||
warning("SaveFileManager error %d: %s", saves->getError().getCode(), saves->getErrorDesc().c_str());
|
||||
return kErrorIO;
|
||||
} else {
|
||||
return kErrorFileNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
void FileIO::m_new(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum result = g_lingo->_state->me;
|
||||
if (nargs == 2) {
|
||||
if (me->getObjType() != kXObj) {
|
||||
warning("FileIO::m_new: called with XObject API however was expecting object type %d", me->getObjType());
|
||||
}
|
||||
Datum d2 = g_lingo->pop();
|
||||
Datum d1 = g_lingo->pop();
|
||||
|
||||
Common::String option = d1.asString();
|
||||
Common::String path = d2.asString();
|
||||
FileIOError err = me->open(path, option);
|
||||
// if there's an error, return an errorcode int instead of an object
|
||||
if (err != kErrorNone) {
|
||||
me->_lastError = err;
|
||||
warning("FileIO::m_new: couldn't open file at path %s, error %d", path.c_str(), err);
|
||||
g_lingo->push(Datum(err));
|
||||
return;
|
||||
}
|
||||
} else if (nargs == 0) {
|
||||
if (me->getObjType() != kXtraObj) {
|
||||
warning("FileIO::m_new: called with Xtra API however was expecting object type %d", me->getObjType());
|
||||
}
|
||||
} else {
|
||||
warning("FileIO::m_new: expected 0 or 2 args, assuming 0");
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void FileIO::m_openFile(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum d1 = g_lingo->pop();
|
||||
Datum d2 = g_lingo->pop();
|
||||
|
||||
int mode = d1.asInt();
|
||||
Common::String option;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
option = "read";
|
||||
break;
|
||||
case 2:
|
||||
option = "write";
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
warning("FIXME: Mode %d not supported, falling back to read", mode);
|
||||
option = "read";
|
||||
break;
|
||||
}
|
||||
Common::String path = d2.asString();
|
||||
me->_lastError = me->open(path, option);
|
||||
}
|
||||
|
||||
void FileIO::m_closeFile(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
me->clear();
|
||||
}
|
||||
|
||||
// FIXME: split out filename-to-savegame logic from open() so we can implement createFile
|
||||
XOBJSTUB(FileIO::m_createFile, 0)
|
||||
|
||||
void FileIO::m_displayOpen(int nargs) {
|
||||
g_lingo->push(getFileNameFromModal(false, Common::String(), Common::String(), "txt"));
|
||||
}
|
||||
|
||||
void FileIO::m_displaySave(int nargs) {
|
||||
Datum defaultFileName = g_lingo->pop();
|
||||
Datum title = g_lingo->pop();
|
||||
g_lingo->push(getFileNameFromModal(true, Common::String(), title.asString(), "txt"));
|
||||
}
|
||||
|
||||
XOBJSTUB(FileIO::m_setFilterMask, 0)
|
||||
|
||||
// Read
|
||||
|
||||
void FileIO::m_readChar(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (!me->_inStream || me->_inStream->eos() || me->_inStream->err()) {
|
||||
g_lingo->push(Datum(kErrorEOF));
|
||||
return;
|
||||
}
|
||||
|
||||
int ch = me->_inStream->readByte();
|
||||
if (me->_inStream->eos() || me->_inStream->err()) {
|
||||
ch = kErrorEOF;
|
||||
}
|
||||
g_lingo->push(Datum(ch));
|
||||
}
|
||||
|
||||
void FileIO::m_readLine(int nargs) {
|
||||
// file(mReadLine) is equivalent to file(mReadToken, "", RETURN)
|
||||
// See D4 Using Lingo p. 323
|
||||
|
||||
g_lingo->push(Datum(""));
|
||||
g_lingo->push(Datum("\r"));
|
||||
FileIO::m_readToken(2);
|
||||
}
|
||||
|
||||
void FileIO::m_readWord(int nargs) {
|
||||
// file(mReadWord) is equivalent to file(mReadToken, " ", " " & RETURN)
|
||||
// See D4 Using Lingo p. 323
|
||||
|
||||
g_lingo->push(Datum(" "));
|
||||
g_lingo->push(Datum(" \r"));
|
||||
FileIO::m_readToken(2);
|
||||
}
|
||||
|
||||
void FileIO::m_readPict(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
Datum result;
|
||||
|
||||
if (!me->_inStream || me->_inStream->err()) {
|
||||
g_lingo->push(result);
|
||||
return;
|
||||
}
|
||||
|
||||
me->_inStream->seek(0, SEEK_SET);
|
||||
|
||||
Image::PICTDecoder decoder;
|
||||
if (decoder.loadStream(*me->_inStream)) {
|
||||
result.type = PICTUREREF;
|
||||
result.u.picture = new PictureReference;
|
||||
result.u.picture->_picture = new Picture(decoder);
|
||||
}
|
||||
|
||||
g_lingo->push(result);
|
||||
return;
|
||||
}
|
||||
|
||||
bool FileIO::charInMatchString(char ch, const Common::String &matchString) {
|
||||
return matchString.contains(ch);
|
||||
}
|
||||
|
||||
void FileIO::m_readToken(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
Datum d2 = g_lingo->pop();
|
||||
Datum d1 = g_lingo->pop();
|
||||
|
||||
Common::String skipString = d1.asString();
|
||||
Common::String breakString = d2.asString();
|
||||
|
||||
if (!me->_inStream || me->_inStream->eos() || me->_inStream->err()) {
|
||||
g_lingo->push(Datum(""));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String tok = "";
|
||||
char ch;
|
||||
do {
|
||||
ch = me->_inStream->readByte();
|
||||
if (me->_inStream->eos() || me->_inStream->err()) {
|
||||
g_lingo->push(Datum(tok));
|
||||
return;
|
||||
}
|
||||
} while (charInMatchString(ch, skipString));
|
||||
|
||||
while (!charInMatchString(ch, breakString)) {
|
||||
tok += ch;
|
||||
ch = me->_inStream->readByte();
|
||||
|
||||
if (me->_inStream->eos() || me->_inStream->err()) {
|
||||
g_lingo->push(Datum(tok));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Include the break character when the skipString is empty
|
||||
if (skipString.size() == 0) {
|
||||
tok += ch;
|
||||
} else {
|
||||
me->_inStream->seek(-1, SEEK_CUR);
|
||||
}
|
||||
|
||||
g_lingo->push(Datum(tok));
|
||||
}
|
||||
|
||||
void FileIO::m_readFile(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (!me->_inStream || me->_inStream->eos() || me->_inStream->err()) {
|
||||
g_lingo->push(Datum(""));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String res;
|
||||
char ch = me->_inStream->readByte();
|
||||
while (!me->_inStream->eos() && !me->_inStream->err()) {
|
||||
res += ch;
|
||||
ch = me->_inStream->readByte();
|
||||
}
|
||||
|
||||
g_lingo->push(res);
|
||||
}
|
||||
|
||||
// Write
|
||||
|
||||
void FileIO::m_writeChar(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum d = g_lingo->pop();
|
||||
|
||||
if (!me->_outStream) {
|
||||
g_lingo->push(Datum(kErrorReadOnly));
|
||||
return;
|
||||
}
|
||||
|
||||
me->_outStream->writeByte(d.asInt());
|
||||
g_lingo->push(Datum(kErrorNone));
|
||||
}
|
||||
|
||||
void FileIO::m_writeString(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum d = g_lingo->pop();
|
||||
|
||||
if (!me->_outStream) {
|
||||
g_lingo->push(Datum(kErrorReadOnly));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::U32String unicodeString = Common::U32String(d.asString(), Common::kUtf8);
|
||||
Common::String encodedString = unicodeString.encode(g_director->getPlatformEncoding());
|
||||
me->_outStream->writeString(encodedString);
|
||||
|
||||
g_lingo->push(Datum(kErrorNone));
|
||||
}
|
||||
|
||||
// Getters/Setters
|
||||
|
||||
XOBJSTUB(FileIO::m_getFinderInfo, "")
|
||||
XOBJSTUB(FileIO::m_setFinderInfo, 0)
|
||||
|
||||
void FileIO::m_getPosition(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (me->_inStream) {
|
||||
g_lingo->push(Datum((int)me->_inStream->pos()));
|
||||
} else if (me->_outStream) {
|
||||
g_lingo->push(Datum((int)me->_outStream->pos()));
|
||||
} else {
|
||||
warning("FileIO: No file open");
|
||||
g_lingo->push(Datum(kErrorFileNotOpen));
|
||||
}
|
||||
}
|
||||
|
||||
void FileIO::m_setPosition(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum d = g_lingo->pop();
|
||||
int pos = d.asInt();
|
||||
|
||||
if (me->_inStream) {
|
||||
if (pos <= me->_inStream->size()) {
|
||||
me->_inStream->seek(pos, SEEK_SET);
|
||||
g_lingo->push(Datum(kErrorNone));
|
||||
} else {
|
||||
me->_inStream->seek(me->_inStream->size(), SEEK_SET);
|
||||
g_lingo->push(Datum(kErrorInvalidPos));
|
||||
}
|
||||
} else if (me->_outStream) {
|
||||
if (pos <= me->_outStream->size()) {
|
||||
me->_outStream->seek(pos, SEEK_SET);
|
||||
g_lingo->push(Datum(kErrorNone));
|
||||
} else {
|
||||
me->_outStream->seek(me->_outStream->size(), SEEK_SET);
|
||||
g_lingo->push(Datum(kErrorInvalidPos));
|
||||
}
|
||||
} else {
|
||||
warning("FileIO: No file open");
|
||||
g_lingo->push(Datum(kErrorFileNotOpen));
|
||||
}
|
||||
}
|
||||
|
||||
void FileIO::m_getLength(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (me->_inStream) {
|
||||
g_lingo->push(Datum((int)me->_inStream->size()));
|
||||
} else if (me->_outStream) {
|
||||
g_lingo->push(Datum((int)me->_outStream->size()));
|
||||
} else {
|
||||
warning("FileIO: No file open");
|
||||
g_lingo->push(Datum(kErrorFileNotOpen));
|
||||
}
|
||||
}
|
||||
|
||||
void FileIO::m_fileName(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (me->_filename) {
|
||||
Common::String prefix = savePrefix();
|
||||
Common::String res = *me->_filename;
|
||||
if (res.hasPrefix(prefix)) {
|
||||
res = Common::String(&me->_filename->c_str()[prefix.size()]);
|
||||
}
|
||||
|
||||
g_lingo->push(Datum(res));
|
||||
} else {
|
||||
warning("FileIO: No file open");
|
||||
g_lingo->push(Datum(kErrorFileNotOpen));
|
||||
}
|
||||
}
|
||||
|
||||
void FileIO::m_error(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
Datum d = g_lingo->pop();
|
||||
Datum result("");
|
||||
switch (d.asInt()) {
|
||||
case kErrorNone:
|
||||
if (me->getObjType() == kXtraObj) {
|
||||
result = Datum("OK");
|
||||
}
|
||||
break;
|
||||
case kErrorMemAlloc:
|
||||
result = Datum("Memory allocation failure");
|
||||
break;
|
||||
case kErrorDirectoryFull:
|
||||
result = Datum("File directory full");
|
||||
break;
|
||||
case kErrorVolumeFull:
|
||||
result = Datum("Volume full");
|
||||
break;
|
||||
case kErrorVolumeNotFound:
|
||||
result = Datum("Volume not found");
|
||||
break;
|
||||
case kErrorIO:
|
||||
result = Datum("I/O Error");
|
||||
break;
|
||||
case kErrorBadFileName:
|
||||
result = Datum("Bad file name");
|
||||
break;
|
||||
case kErrorFileNotOpen:
|
||||
result = Datum("File not open");
|
||||
break;
|
||||
case kErrorTooManyFilesOpen:
|
||||
result = Datum("Too many files open");
|
||||
break;
|
||||
case kErrorFileNotFound:
|
||||
result = Datum("File not found");
|
||||
break;
|
||||
case kErrorNoSuchDrive:
|
||||
result = Datum("No such drive");
|
||||
break;
|
||||
case kErrorNoDiskInDrive:
|
||||
result = Datum("No disk in drive");
|
||||
break;
|
||||
case kErrorDirectoryNotFound:
|
||||
result = Datum("Directory not found");
|
||||
break;
|
||||
default:
|
||||
result = Datum("Unknown error");
|
||||
break;
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void FileIO::m_status(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
g_lingo->push(Datum(me->_lastError));
|
||||
}
|
||||
|
||||
// Other
|
||||
|
||||
void FileIO::m_delete(int nargs) {
|
||||
FileObject *me = static_cast<FileObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (me->_filename) {
|
||||
Common::String filename = *me->_filename;
|
||||
// Xtra version does not dispose handle on file delete
|
||||
if (me->getObjType() == kXObj) {
|
||||
me->dispose();
|
||||
}
|
||||
if (g_system->getSavefileManager()->removeSavefile(filename)) {
|
||||
g_lingo->push(Datum(kErrorNone));
|
||||
} else {
|
||||
g_lingo->push(Datum(kErrorIO));
|
||||
}
|
||||
} else {
|
||||
warning("FileIO: No file open");
|
||||
g_lingo->push(Datum(kErrorFileNotOpen));
|
||||
}
|
||||
}
|
||||
|
||||
// Non-standard extensions
|
||||
XOBJSTUBNR(FileIO::m_setOverrideDrive)
|
||||
|
||||
XOBJSTUB(FileIO::m_getOSDirectory, "")
|
||||
|
||||
} // End of namespace Director
|
||||
118
engines/director/lingo/xlibs/f/fileio.h
Normal file
118
engines/director/lingo/xlibs/f/fileio.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* 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_FILEIO_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FILEIO_H
|
||||
|
||||
namespace Common {
|
||||
class SeekableReadStream;
|
||||
typedef SeekableReadStream InSaveFile;
|
||||
class OutSaveFile;
|
||||
class MemoryWriteStreamDynamic;
|
||||
class String;
|
||||
}
|
||||
|
||||
namespace Director {
|
||||
|
||||
enum FileIOError {
|
||||
kErrorNone = 0,
|
||||
kErrorMemAlloc = 1,
|
||||
kErrorEOF = -1,
|
||||
kErrorDirectoryFull = -33,
|
||||
kErrorVolumeFull = -34,
|
||||
kErrorVolumeNotFound = -35,
|
||||
kErrorIO = -36,
|
||||
kErrorBadFileName = -37,
|
||||
kErrorFileNotOpen = -38,
|
||||
kErrorInvalidPos = -39, // undocumented
|
||||
kErrorTooManyFilesOpen = -42,
|
||||
kErrorFileNotFound = -43,
|
||||
kErrorNoSuchDrive = -56,
|
||||
kErrorReadOnly = -61, // undocumented
|
||||
kErrorNoDiskInDrive = -65,
|
||||
kErrorDirectoryNotFound = -120
|
||||
};
|
||||
|
||||
class FileObject : public Object<FileObject> {
|
||||
public:
|
||||
Common::String *_filename;
|
||||
Common::SeekableReadStream *_inStream;
|
||||
Common::OutSaveFile *_outFile;
|
||||
Common::MemoryWriteStreamDynamic *_outStream;
|
||||
FileIOError _lastError;
|
||||
|
||||
public:
|
||||
FileObject(ObjectType objType);
|
||||
FileObject(const FileObject &obj);
|
||||
~FileObject() override;
|
||||
|
||||
bool hasProp(const Common::String &propName) override;
|
||||
Datum getProp(const Common::String &propName) override;
|
||||
|
||||
FileIOError open(const Common::String &origpath, const Common::String &mode);
|
||||
void clear();
|
||||
FileIOError saveFileError();
|
||||
void dispose() override;
|
||||
};
|
||||
|
||||
namespace FileIO {
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
bool charInMatchString(char ch, const Common::String &matchString);
|
||||
void m_delete(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_error(int nargs);
|
||||
void m_fileName(int nargs);
|
||||
void m_getFinderInfo(int nargs);
|
||||
void m_getLength(int nargs);
|
||||
void m_getPosition(int nargs);
|
||||
void m_new(int nargs);
|
||||
void m_readChar(int nargs);
|
||||
void m_readFile(int nargs);
|
||||
void m_readLine(int nargs);
|
||||
void m_readPict(int nargs);
|
||||
void m_readToken(int nargs);
|
||||
void m_readWord(int nargs);
|
||||
void m_setFinderInfo(int nargs);
|
||||
void m_setPosition(int nargs);
|
||||
void m_status(int nargs);
|
||||
void m_writeChar(int nargs);
|
||||
void m_writeString(int nards);
|
||||
|
||||
void m_setOverrideDrive(int nargs);
|
||||
|
||||
void m_closeFile(int nargs);
|
||||
void m_createFile(int nargs);
|
||||
void m_displayOpen(int nargs);
|
||||
void m_displaySave(int nargs);
|
||||
void m_openFile(int nargs);
|
||||
void m_setFilterMask(int nargs);
|
||||
void m_getOSDirectory(int nargs);
|
||||
|
||||
} // End of namespace FileIO
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
60
engines/director/lingo/xlibs/f/findereventsxcmd.cpp
Normal file
60
engines/director/lingo/xlibs/f/findereventsxcmd.cpp
Normal 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/f/findereventsxcmd.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* puppetmotel
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FinderEventsXCMD::xlibName = "FinderEvents";
|
||||
const XlibFileDesc FinderEventsXCMD::fileNames[] = {
|
||||
{ "FinderEvents", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FinderEvents", FinderEventsXCMD::m_FinderEvents, -1, 0, 400, CBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FinderEventsXCMD::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FinderEventsXCMD::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
XOBJSTUB(FinderEventsXCMD::m_FinderEvents, 0)
|
||||
|
||||
}
|
||||
41
engines/director/lingo/xlibs/f/findereventsxcmd.h
Normal file
41
engines/director/lingo/xlibs/f/findereventsxcmd.h
Normal 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_FINDEREVENTSXCMD_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FINDEREVENTSXCMD_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FinderEventsXCMD {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_FinderEvents(int nargs);
|
||||
|
||||
} // End of namespace FinderEventsXCMD
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
117
engines/director/lingo/xlibs/f/findfolder.cpp
Normal file
117
engines/director/lingo/xlibs/f/findfolder.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* 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
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* FindFolder 1.1
|
||||
*
|
||||
* by Frédéric RINALDI
|
||||
*
|
||||
*
|
||||
* DESCRIPTION
|
||||
* ------------
|
||||
* FindFolder returns the full pathname of the active System folder or any of its reserved folders (System 7.0).
|
||||
*
|
||||
*
|
||||
* SYNTAX
|
||||
* -------
|
||||
* FindFolder([<folder descriptor>[,<create it>]])
|
||||
*
|
||||
* PARAMETERS
|
||||
* ------------
|
||||
* <folder descriptor> is a string describing the folder. It must be one of these values (only first char is checked) :
|
||||
* A[pple menu]
|
||||
* C[ontrol Panel]
|
||||
* D[esktop]
|
||||
* E[xtensions]
|
||||
* F[onts] (System 7.1 only)
|
||||
* P[references]
|
||||
* M[onitor printing]
|
||||
* N[etwork trash]
|
||||
* T[rash]
|
||||
* I[tems startup]
|
||||
* S[ystem]
|
||||
* Y : TemporarY items
|
||||
*
|
||||
* Default value is "S".
|
||||
*
|
||||
* <create it> is a boolean telling if the XFCN must create the folder if not found (only with System 7.0). Default is FALSE.
|
||||
*
|
||||
* Both parameters are optional. Using "!", "?" or "=" as first parameter will return an online help (resp. copyright, syntax and output).
|
||||
*
|
||||
* USING
|
||||
* -----
|
||||
* The XFCN returns the full pathname of the requested folder, ending with colon.
|
||||
* Under System 6.0, only current System folder can be returned.
|
||||
*
|
||||
* ERRORS
|
||||
* -------
|
||||
* If an error occurs, the XFCN can return :
|
||||
* "Error : Empty parameter"
|
||||
* "Error : Second param must be boolean"
|
||||
* "Error : Folder not found"
|
||||
* "Error : Found file instead of folder"
|
||||
*
|
||||
* HISTORY
|
||||
* -------
|
||||
* 1.1 : 04/21/92
|
||||
* • Added "font" param for System 7.1
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/findfolder.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FindFolder::xlibName = "FindFolder";
|
||||
const XlibFileDesc FindFolder::fileNames[] = {
|
||||
{ "FindFolder", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FindFolder", FindFolder::m_findfolder, 0, 2, 300, HBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FindFolder::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FindFolder::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FindFolder::m_findfolder(int nargs) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(""));
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
41
engines/director/lingo/xlibs/f/findfolder.h
Normal file
41
engines/director/lingo/xlibs/f/findfolder.h
Normal 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_FINDFOLDER_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FINDFOLDER_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FindFolder {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_findfolder(int nargs);
|
||||
|
||||
} // End of namespace FindFolder
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
91
engines/director/lingo/xlibs/f/findsys.cpp
Normal file
91
engines/director/lingo/xlibs/f/findsys.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* teamxtreme1-win
|
||||
* teamxtreme2-win
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* 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@aapda.com.au Compuserve 100242,1154
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/findsys.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
// The name is different from the obj filename.
|
||||
const char *const FindSys::xlibName = "FindSys";
|
||||
const XlibFileDesc FindSys::fileNames[] = {
|
||||
{ "FindSys", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const 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(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FindSysXObject::initMethods(xlibMethods);
|
||||
FindSysXObject *xobj = new FindSysXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void FindSys::close(ObjectType 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
|
||||
47
engines/director/lingo/xlibs/f/findsys.h
Normal file
47
engines/director/lingo/xlibs/f/findsys.h
Normal 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_FINDSYS_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FINDSYS_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FindSysXObject : public Object<FindSysXObject> {
|
||||
public:
|
||||
FindSysXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FindSys {
|
||||
|
||||
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_do(int nargs);
|
||||
|
||||
} // End of namespace FindSys
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
88
engines/director/lingo/xlibs/f/findwin.cpp
Normal file
88
engines/director/lingo/xlibs/f/findwin.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* 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:
|
||||
* tivolafall1998
|
||||
* tivolaspring1999
|
||||
* tivolasummer2000
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
-- FindWin. Returns path to Windows directory. Mark_Carolan@aapda.com.au
|
||||
--FindWin
|
||||
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
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/findwin.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
// The name is different from the obj filename.
|
||||
const char *const FindWin::xlibName = "FindWin";
|
||||
const XlibFileDesc FindWin::fileNames[] = {
|
||||
{ "FindWin", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", FindWin::m_new, 0, 0, 400 }, // D4
|
||||
{ "do", FindWin::m_do, 0, 0, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void FindWin::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FindWinXObject::initMethods(xlibMethods);
|
||||
FindWinXObject *xobj = new FindWinXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void FindWin::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
FindWinXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FindWinXObject::FindWinXObject(ObjectType ObjectType) : Object<FindWinXObject>("FindWin") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void FindWin::m_new(int nargs) {
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FindWin::m_do(int nargs) {
|
||||
g_lingo->push(Common::String("C:\\WINDOWS\\"));
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
47
engines/director/lingo/xlibs/f/findwin.h
Normal file
47
engines/director/lingo/xlibs/f/findwin.h
Normal 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_FINDWIN_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FINDWIN_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FindWinXObject : public Object<FindWinXObject> {
|
||||
public:
|
||||
FindWinXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FindWin {
|
||||
|
||||
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_do(int nargs);
|
||||
|
||||
} // End of namespace FindWin
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
136
engines/director/lingo/xlibs/f/flushxobj.cpp
Normal file
136
engines/director/lingo/xlibs/f/flushxobj.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* FlushXObj is a Mac only XObject to call the underlying FlushEvents function
|
||||
* from the Macintosh Toolbox. Its purpose is to flush, i.e. remove, events
|
||||
* that happened while loading code.
|
||||
*
|
||||
* Implemented as a no-op, there's no need to flush events because:
|
||||
* - ScummVM handles them and
|
||||
* - computers were slower and queued events when the program was loading.
|
||||
*
|
||||
* More information about the Toolbox and the flush events can be found here:
|
||||
* https://en.wikipedia.org/wiki/Macintosh_Toolbox
|
||||
* https://developer.apple.com/legacy/library/documentation/mac/pdf/MacintoshToolboxEssentials.pdf
|
||||
*
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/f/flushxobj.h"
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* majestic-mac
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* 8-- FlushEvents: an XObject to call toolbox FlushEvents().-- By Scott Kelley , sakelley@ucsd.edu, 6/2/93?-- Copyright
|
||||
* 1993 The Regents of the University of California;-- Freely distributable. No warranties. Ask before selling!
|
||||
* --5-- mNew creates a new instance of the Flush XObject.@-- Note that the object contains internal variables which allow>-- a unique masking operation to be built for each object, or:-- mFlushEvents can pass masks to FlushEvents() directly.
|
||||
* I mNew
|
||||
* --?-- mFlushEvents is identical to the toolbox call FlushEvents()%XII mFlushEvents, eventMask, stopMask
|
||||
* --?-- mClearMask clears the object's internal masks. Note that if<-- you never call this, the object starts with a default of9-- flushing everything (i.e. FlushEvent(everyEvent,0) )
|
||||
* X mClearMask
|
||||
* --<-- mAddToMask adds the specified event mask to the object's8-- internal masks (i.e. OR's it with the existing mask)!XII mAddToMask eventMask,stopMask
|
||||
* --6-- mFlush calls FlushEvents() with the internal masks
|
||||
* X mFlush
|
||||
* --"-- mDispose gets rid of an object2X mDispose -- dispose of an instance of u * s
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FlushXObj::xlibNames[] = {
|
||||
"FlushXObj",
|
||||
"Johnny",
|
||||
nullptr,
|
||||
};
|
||||
const XlibFileDesc FlushXObj::fileNames[] = {
|
||||
{ "FlushEvents", nullptr },
|
||||
{ "FlushXObj", nullptr },
|
||||
{ "Johnny", nullptr },
|
||||
{ "Johnny.XObj", nullptr },
|
||||
{ "Toilet", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", FlushXObj::m_new, 0, 0, 300 }, // D3
|
||||
{ "AddToMask", FlushXObj::m_addToMask, 2, 2, 400 }, // D4
|
||||
{ "ClearMask", FlushXObj::m_clearMask, 0, 0, 400 }, // D4
|
||||
{ "Flush", FlushXObj::m_flush, 0, 0, 300 }, // D3
|
||||
{ "FlushEvents", FlushXObj::m_flushEvents, 2, 2, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void FlushXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
FlushXObject::initMethods(xlibMethods);
|
||||
FlushXObject *xobj = new FlushXObject(kXObj);
|
||||
for (uint i = 0; xlibNames[i]; i++) {
|
||||
g_lingo->exposeXObject(xlibNames[i], xobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FlushXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
FlushXObject::cleanupMethods();
|
||||
for (uint i = 0; xlibNames[i]; i++) {
|
||||
g_lingo->_globalvars[xlibNames[i]] = Datum();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FlushXObject::FlushXObject(ObjectType ObjectType) :Object<FlushXObject>("FlushXObj") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void FlushXObj::m_new(int nargs) {
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void FlushXObj::m_clearMask(int nargs) {
|
||||
debug(5, "FlushXobj::m_clearMask: no-op");
|
||||
}
|
||||
|
||||
void FlushXObj::m_addToMask(int nargs) {
|
||||
g_lingo->pop();
|
||||
g_lingo->pop();
|
||||
|
||||
debug(5, "FlushXobj::m_addToMask: no-op");
|
||||
}
|
||||
|
||||
void FlushXObj::m_flush(int nargs) {
|
||||
debug(5, "FlushXobj::m_flush: no-op");
|
||||
}
|
||||
|
||||
void FlushXObj::m_flushEvents(int nargs) {
|
||||
g_lingo->pop();
|
||||
g_lingo->pop();
|
||||
debug(5, "FlushXobj::m_flush: no-op");
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
50
engines/director/lingo/xlibs/f/flushxobj.h
Normal file
50
engines/director/lingo/xlibs/f/flushxobj.h
Normal file
@@ -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_FLUSHXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FLUSHXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class FlushXObject : public Object<FlushXObject> {
|
||||
public:
|
||||
FlushXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace FlushXObj {
|
||||
|
||||
extern const char *const xlibNames[];
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_clearMask(int nargs);
|
||||
void m_addToMask(int nargs);
|
||||
void m_flush(int nargs);
|
||||
void m_flushEvents(int nargs);
|
||||
|
||||
} // End of namespace FlushXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
115
engines/director/lingo/xlibs/f/fplayxobj.cpp
Normal file
115
engines/director/lingo/xlibs/f/fplayxobj.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/* 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:
|
||||
* Spaceship Warlock (Mac)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* Version 2.0.3 Copyright © 1988-90 Farallon Computing, Inc.
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/sound.h"
|
||||
#include "director/window.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/f/fplayxobj.h"
|
||||
|
||||
#include "audio/audiostream.h"
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const FPlayXObj::xlibName = "FPlay";
|
||||
const XlibFileDesc FPlayXObj::fileNames[] = {
|
||||
{ "FPlayXObj", nullptr },
|
||||
{ "FPlay", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const BuiltinProto builtins[] = {
|
||||
{ "FPlay", FPlayXObj::b_fplay, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "CopySnd", FPlayXObj::b_copysnd, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "EraseSnd", FPlayXObj::b_erasesnd, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "PasteSnd", FPlayXObj::b_pastesnd, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "RenameSnd", FPlayXObj::b_renamesnd, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "DuplicateSnd", FPlayXObj::b_duplicatesnd, -1,0, 200, CBLTIN }, // XCMD
|
||||
{ "SndInfo", FPlayXObj::b_sndinfo, -1,0, 200, FBLTIN }, // XFCN
|
||||
{ "SndList", FPlayXObj::b_sndlist, -1,0, 200, FBLTIN }, // XFCN
|
||||
{ "Volume", FPlayXObj::b_volume, -1,0, 200, FBLTIN }, // XFCN
|
||||
{ "FileName", FPlayXObj::b_filename, -1,0, 200, FBLTIN }, // XFCN
|
||||
{ "InputLevel", FPlayXObj::b_inputlevel, -1,0, 200, FBLTIN }, // XFCN
|
||||
{ "FSound", FPlayXObj::b_fsound, 0,0, 200, FBLTIN }, // XFCN
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
void FPlayXObj::open(ObjectType type, const Common::Path &path) {
|
||||
g_lingo->initBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FPlayXObj::close(ObjectType type) {
|
||||
g_lingo->cleanupBuiltIns(builtins);
|
||||
}
|
||||
|
||||
void FPlayXObj::b_fplay(int nargs) {
|
||||
if (nargs == 0) {
|
||||
warning("FPlayXObj::b_fplay: requires at least one argument");
|
||||
return;
|
||||
}
|
||||
|
||||
Common::Array<Common::String> arr(nargs);
|
||||
for (int i = nargs - 1; i >= 0; i--) {
|
||||
arr[i] = g_lingo->pop().asString();
|
||||
}
|
||||
|
||||
DirectorSound *sound = g_director->getCurrentWindow()->getSoundManager();
|
||||
sound->playFPlaySound(arr);
|
||||
}
|
||||
|
||||
XOBJSTUBV(FPlayXObj::b_copysnd)
|
||||
XOBJSTUBV(FPlayXObj::b_erasesnd)
|
||||
XOBJSTUBV(FPlayXObj::b_pastesnd)
|
||||
XOBJSTUBV(FPlayXObj::b_renamesnd)
|
||||
XOBJSTUBV(FPlayXObj::b_duplicatesnd)
|
||||
XOBJSTUBV(FPlayXObj::b_sndinfo)
|
||||
XOBJSTUBV(FPlayXObj::b_sndlist)
|
||||
XOBJSTUBV(FPlayXObj::b_volume)
|
||||
XOBJSTUBV(FPlayXObj::b_filename)
|
||||
XOBJSTUBV(FPlayXObj::b_inputlevel)
|
||||
|
||||
void FPlayXObj::b_fsound(int nargs) {
|
||||
if (nargs != 0) {
|
||||
warning("FPlayXObj::b_fsound: unhandled arguments");
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
|
||||
DirectorSound *sound = g_director->getCurrentWindow()->getSoundManager();
|
||||
if (sound->isChannelActive(1)) {
|
||||
g_lingo->push(Datum(sound->getCurrentSound()));
|
||||
} else {
|
||||
g_lingo->push(Datum("done"));
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
52
engines/director/lingo/xlibs/f/fplayxobj.h
Normal file
52
engines/director/lingo/xlibs/f/fplayxobj.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* 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_FPLAYXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_FPLAYXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
namespace FPlayXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void b_fplay(int nargs);
|
||||
void b_copysnd(int nargs);
|
||||
void b_erasesnd(int nargs);
|
||||
void b_pastesnd(int nargs);
|
||||
void b_renamesnd(int nargs);
|
||||
void b_duplicatesnd(int nargs);
|
||||
void b_sndinfo(int nargs);
|
||||
void b_sndlist(int nargs);
|
||||
void b_volume(int nargs);
|
||||
void b_filename(int nargs);
|
||||
void b_inputlevel(int nargs);
|
||||
void b_fsound(int nargs);
|
||||
|
||||
} // End of namespace FPlayXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
101
engines/director/lingo/xlibs/f/fsutil.cpp
Normal file
101
engines/director/lingo/xlibs/f/fsutil.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
/* 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/f/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 *const FSUtilXObj::xlibName = "FSUtil";
|
||||
const XlibFileDesc FSUtilXObj::fileNames[] = {
|
||||
{ "FSUtil", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const 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 const 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)
|
||||
// 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)
|
||||
|
||||
}
|
||||
49
engines/director/lingo/xlibs/f/fsutil.h
Normal file
49
engines/director/lingo/xlibs/f/fsutil.h
Normal file
@@ -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 *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_getSystemFolder(int nargs);
|
||||
void m_makeFolder(int nargs);
|
||||
|
||||
} // End of namespace FSUtilXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user