aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-09 04:21:48 +0200
committerEinar Johan Trøan Sømåen2012-07-09 04:21:48 +0200
commit99ed2b2ae1c57419fd22f766fec5784c9a01ea19 (patch)
tree4697752b4fec8176e21ee1cb5b01addc79104a8b
parent01d6ff21212a2d323717a3a1dc9e7b72cdd6adb7 (diff)
downloadscummvm-rg350-99ed2b2ae1c57419fd22f766fec5784c9a01ea19.tar.gz
scummvm-rg350-99ed2b2ae1c57419fd22f766fec5784c9a01ea19.tar.bz2
scummvm-rg350-99ed2b2ae1c57419fd22f766fec5784c9a01ea19.zip
WINTERMUTE: Remove the rest of the WIN32-specifics
-rw-r--r--engines/wintermute/Base/BGame.cpp8
-rw-r--r--engines/wintermute/Base/BRegistry.cpp14
-rw-r--r--engines/wintermute/Base/scriptables/ScScript.cpp189
-rw-r--r--engines/wintermute/Base/scriptables/ScScript.h7
-rw-r--r--engines/wintermute/PlatformSDL.cpp6
-rw-r--r--engines/wintermute/UI/UIEdit.cpp5
-rw-r--r--engines/wintermute/utils/PathUtil.cpp6
7 files changed, 9 insertions, 226 deletions
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index b227a56dc8..26afb8a7d9 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -3736,15 +3736,11 @@ bool CBGame::handleKeypress(Common::Event *event, bool printable) {
stopVideo();
return true;
}
-#ifdef __WIN32__
- // TODO: Do we really need to handle this in-engine?
- // handle Alt+F4 on windows
- if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_F4 && (event->kbd.flags == Common::KBD_ALT)) {
+
+ if (event->type == Common::EVENT_QUIT) {
onWindowClose();
return true;
- //TODO
}
-#endif
if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_RETURN && (event->kbd.flags == Common::KBD_ALT)) {
// TODO: Handle alt-enter as well as alt-return.
diff --git a/engines/wintermute/Base/BRegistry.cpp b/engines/wintermute/Base/BRegistry.cpp
index fe1baee9e6..6d73ac73ac 100644
--- a/engines/wintermute/Base/BRegistry.cpp
+++ b/engines/wintermute/Base/BRegistry.cpp
@@ -59,15 +59,6 @@ CBRegistry::~CBRegistry() {
AnsiString CBRegistry::readString(const AnsiString &subKey, const AnsiString &key, const AnsiString &init) {
AnsiString ret = "";
-#ifdef __WIN32__
- // check ini file first (so what we can use project files on windows)
- char buffer[32768];
- GetPrivateProfileString(subKey.c_str(), key.c_str(), init.c_str(), buffer, 32768, _iniName);
- ret = AnsiString(buffer);
-
- if (buffer != init) return ret;
-#endif
-
bool found = false;
ret = getValue(_localValues, subKey, key, found);
if (!found) ret = getValue(_values, subKey, key, found);
@@ -86,11 +77,6 @@ bool CBRegistry::writeString(const AnsiString &subKey, const AnsiString &key, co
//////////////////////////////////////////////////////////////////////////
int CBRegistry::readInt(const AnsiString &subKey, const AnsiString &key, int init) {
-#ifdef __WIN32__
- int ret = GetPrivateProfileInt(subKey.c_str(), key.c_str(), init, _iniName);
- if (ret != init) return ret;
-#endif
-
AnsiString val = readString(subKey, key, "");
if (val.empty()) return init;
else return atoi(val.c_str());
diff --git a/engines/wintermute/Base/scriptables/ScScript.cpp b/engines/wintermute/Base/scriptables/ScScript.cpp
index 0abd9a1ff9..ebb68654fd 100644
--- a/engines/wintermute/Base/scriptables/ScScript.cpp
+++ b/engines/wintermute/Base/scriptables/ScScript.cpp
@@ -1339,203 +1339,14 @@ CScScript::TExternalFunction *CScScript::getExternal(char *name) {
//////////////////////////////////////////////////////////////////////////
ERRORCODE CScScript::externalCall(CScStack *stack, CScStack *thisStack, CScScript::TExternalFunction *function) {
-#ifndef __WIN32__
-
Game->LOG(0, "External functions are not supported on this platform.");
stack->correctParams(0);
stack->pushNULL();
return STATUS_FAILED;
-
-#else
-
- bool Success = false;
- HMODULE hDll = LoadLibrary(Function->dll_name);
-
- if (hDll) {
- FARPROC pFunc = GetProcAddress(hDll, Function->name);
- if (pFunc) {
- int i;
- Success = true;
- stack->correctParams(Function->nu_params);
- CBDynBuffer *Buffer = new CBDynBuffer(Game, 20 * sizeof(uint32));
-
- for (i = 0; i < Function->nu_params; i++) {
- CScValue *Val = stack->pop();
- switch (Function->params[i]) {
- case TYPE_BOOL:
- buffer->PutDWORD((uint32)Val->getBool());
- break;
- case TYPE_LONG:
- buffer->PutDWORD(Val->getInt());
- break;
- case TYPE_BYTE:
- buffer->PutDWORD((byte)Val->getInt());
- break;
- case TYPE_STRING:
- if (Val->isNULL()) buffer->PutDWORD(0);
- else buffer->PutDWORD((uint32)Val->getString());
- break;
- case TYPE_MEMBUFFER:
- if (Val->isNULL()) buffer->PutDWORD(0);
- else buffer->PutDWORD((uint32)Val->getMemBuffer());
- break;
- case TYPE_FLOAT: {
- float f = Val->getFloat();
- buffer->PutDWORD(*((uint32 *)&f));
- break;
- }
- case TYPE_DOUBLE: {
- double d = Val->getFloat();
- uint32 *pd = (uint32 *)&d;
-
- buffer->PutDWORD(pd[0]);
- buffer->PutDWORD(pd[1]);
- break;
- }
- }
- }
-
- // call
- uint32 ret;
- bool StackCorrupted = false;
- switch (Function->call_type) {
- case CALL_CDECL:
- ret = Call_cdecl(buffer->_buffer, buffer->GetSize(), (uint32)pFunc, &StackCorrupted);
- break;
- default:
- ret = Call_stdcall(buffer->_buffer, buffer->GetSize(), (uint32)pFunc, &StackCorrupted);
- }
- delete Buffer;
-
- // return
- switch (Function->returns) {
- case TYPE_BOOL:
- stack->pushBool((byte)ret != 0);
- break;
- case TYPE_LONG:
- stack->pushInt(ret);
- break;
- case TYPE_BYTE:
- stack->pushInt((byte)ret);
- break;
- break;
- case TYPE_STRING:
- stack->pushString((char *)ret);
- break;
- case TYPE_MEMBUFFER: {
- CSXMemBuffer *Buf = new CSXMemBuffer(Game, (void *)ret);
- stack->pushNative(Buf, false);
- }
- break;
- case TYPE_FLOAT: {
- uint32 dw = GetST0();
- stack->pushFloat(*((float *)&dw));
- break;
- }
- case TYPE_DOUBLE:
- stack->pushFloat(GetST0Double());
- break;
-
- default:
- stack->pushNULL();
- }
-
- if (StackCorrupted) RuntimeError("Warning: Stack corrupted after calling '%s' in '%s'\n Check parameters and/or calling convention.", Function->name, Function->dll_name);
- } else RuntimeError("Exported function '%s' not found in '%s'", Function->name, Function->dll_name);
- } else RuntimeError("Error loading DLL '%s'", Function->dll_name);
-
- if (!Success) {
- stack->correctParams(0);
- stack->pushNULL();
- }
-
- if (hDll) FreeLibrary(hDll);
-
- return Success ? STATUS_OK : STATUS_FAILED;
-#endif
-}
-
-#ifdef __WIN32__
-//////////////////////////////////////////////////////////////////////////
-uint32 CScScript::Call_cdecl(const void *args, size_t sz, uint32 func, bool *StackCorrupt) {
- uint32 rc; // here's our return value...
- uint32 OrigESP;
- bool StkCorrupt = false;
- __asm {
- mov OrigESP, esp
- mov ecx, sz // get size of buffer
- mov esi, args // get buffer
- sub esp, ecx // allocate stack space
- mov edi, esp // start of destination stack frame
- shr ecx, 2 // make it dwords
- rep movsd // copy params to real stack
- call [func] // call the function
- mov rc, eax // save the return value
- add esp, sz // restore the stack pointer
- cmp esp, OrigESP
- jz finish
- mov esp, OrigESP
- mov StkCorrupt, 1
- finish:
- }
-
- if (StackCorrupt) *StackCorrupt = StkCorrupt;
- return rc;
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////
-uint32 CScScript::Call_stdcall(const void *args, size_t sz, uint32 func, bool *StackCorrupt) {
- uint32 rc; // here's our return value...
- uint32 OrigESP;
- bool StkCorrupt = false;
-
- __asm {
- mov OrigESP, esp
- mov ecx, sz // get size of buffer
- mov esi, args // get buffer
- sub esp, ecx // allocate stack space
- mov edi, esp // start of destination stack frame
- shr ecx, 2 // make it dwords
- rep movsd // copy it
- call [func] // call the function
- mov rc, eax // save the return value
- cmp esp, OrigESP
- jz finish
- mov esp, OrigESP
- mov StkCorrupt, 1
- finish:
- }
-
- if (StackCorrupt) *StackCorrupt = StkCorrupt;
- return rc;
}
//////////////////////////////////////////////////////////////////////////
-__declspec(naked) uint32 CScScript::GetST0(void) {
- uint32 f; // temp var
- __asm {
- fstp uint32 ptr [f] // pop ST0 into f
- mov eax, uint32 ptr [f] // copy into eax
- ret // done
- }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-double CScScript::GetST0Double(void) {
- double d; // temp var
- __asm {
- fstp qword ptr [d] // get ST0 into d
- }
- return d;
-}
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
ERRORCODE CScScript::copyParameters(CScStack *stack) {
int i;
int NumParams = stack->pop()->getInt();
diff --git a/engines/wintermute/Base/scriptables/ScScript.h b/engines/wintermute/Base/scriptables/ScScript.h
index 6635970dc5..666edb8309 100644
--- a/engines/wintermute/Base/scriptables/ScScript.h
+++ b/engines/wintermute/Base/scriptables/ScScript.h
@@ -56,13 +56,6 @@ public:
void afterLoad();
-#ifdef __WIN32__
- static uint32 Call_cdecl(const void *args, size_t sz, uint32 func, bool *StackCorrupt);
- static uint32 Call_stdcall(const void *args, size_t sz, uint32 func, bool *StackCorrupt);
- static uint32 GetST0(void);
- static double GetST0Double(void);
-#endif
-
CScValue *_operand;
CScValue *_reg1;
bool _freezable;
diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp
index 9803ffb928..175cb1d68a 100644
--- a/engines/wintermute/PlatformSDL.cpp
+++ b/engines/wintermute/PlatformSDL.cpp
@@ -337,17 +337,17 @@ bool CBPlatform::equalRect(Common::Rect *rect1, Common::Rect *rect2) {
//////////////////////////////////////////////////////////////////////////
AnsiString CBPlatform::getSystemFontPath() {
-#ifdef __WIN32__
+/*#ifdef __WIN32__
// we're looking for something like "c:\windows\fonts\";
char winDir[MAX_PATH_LENGTH + 1];
winDir[MAX_PATH_LENGTH] = '\0';
::GetWindowsDirectory(winDir, MAX_PATH_LENGTH);
return PathUtil::Combine(AnsiString(winDir), "fonts");
-#else
+#else*/
// !PORTME
//return "/Library/Fonts/";
return "";
-#endif
+//#endif
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/UI/UIEdit.cpp b/engines/wintermute/UI/UIEdit.cpp
index ca6f3416bc..09ca50699e 100644
--- a/engines/wintermute/UI/UIEdit.cpp
+++ b/engines/wintermute/UI/UIEdit.cpp
@@ -64,11 +64,8 @@ CUIEdit::CUIEdit(CBGame *inGame): CUIObject(inGame) {
_cursorChar = NULL;
setCursorChar("|");
-#ifdef __WIN32__
- _cursorBlinkRate = GetCaretBlinkTime();
-#else
_cursorBlinkRate = 600;
-#endif
+
_frameWidth = 0;
setText("");
diff --git a/engines/wintermute/utils/PathUtil.cpp b/engines/wintermute/utils/PathUtil.cpp
index b148c80300..7fa06cf682 100644
--- a/engines/wintermute/utils/PathUtil.cpp
+++ b/engines/wintermute/utils/PathUtil.cpp
@@ -115,7 +115,7 @@ AnsiString PathUtil::getExtension(const AnsiString &path) {
AnsiString PathUtil::getSafeLogFileName() {
AnsiString logFileName = getUserDirectory();
-#ifdef __WIN32__
+/*#ifdef __WIN32__
char moduleName[MAX_PATH_LENGTH];
::GetModuleFileName(NULL, moduleName, MAX_PATH_LENGTH);
@@ -123,10 +123,10 @@ AnsiString PathUtil::getSafeLogFileName() {
fileName = Combine("/Wintermute Engine/Logs/", fileName);
logFileName = Combine(logFileName, fileName);
-#else
+#else*/
// !PORTME
logFileName = combine(logFileName, "/Wintermute Engine/wme.log");
-#endif
+//#endif
createDirectory(getDirectoryName(logFileName));
return logFileName;