aboutsummaryrefslogtreecommitdiff
path: root/backends/epoc/src
diff options
context:
space:
mode:
authorLars Persson2006-02-12 13:40:20 +0000
committerLars Persson2006-02-12 13:40:20 +0000
commit25460eb0fa44b4991b6b50d89ec1492defa4eadf (patch)
treed8c91ba2c1ad10cc7fc878f38476d43b9ce59bef /backends/epoc/src
parent609d185739b27a69fe29247f3e272515fd147f08 (diff)
downloadscummvm-rg350-25460eb0fa44b4991b6b50d89ec1492defa4eadf.tar.gz
scummvm-rg350-25460eb0fa44b4991b6b50d89ec1492defa4eadf.tar.bz2
scummvm-rg350-25460eb0fa44b4991b6b50d89ec1492defa4eadf.zip
Renaming the folder "epoc"->"symbian"
svn-id: r20612
Diffstat (limited to 'backends/epoc/src')
-rw-r--r--backends/epoc/src/ScummApp.cpp108
-rw-r--r--backends/epoc/src/ScummApp.h48
-rw-r--r--backends/epoc/src/ScummVMApp.cpp170
-rw-r--r--backends/epoc/src/ScummVMApp.h82
-rw-r--r--backends/epoc/src/ScummVm.hrh30
-rw-r--r--backends/epoc/src/SymbianActions.cpp188
-rw-r--r--backends/epoc/src/SymbianActions.h78
-rw-r--r--backends/epoc/src/SymbianOS.cpp415
-rw-r--r--backends/epoc/src/SymbianOS.h131
-rw-r--r--backends/epoc/src/main_features.inl56
-rw-r--r--backends/epoc/src/portdefs.h141
11 files changed, 0 insertions, 1447 deletions
diff --git a/backends/epoc/src/ScummApp.cpp b/backends/epoc/src/ScummApp.cpp
deleted file mode 100644
index 09edfb3215..0000000000
--- a/backends/epoc/src/ScummApp.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include "backends/epoc/src/ScummApp.h"
-
-#include "backends/epoc/src/ScummVM.hrh"
-#define _PAGESIZE_ 0x1000
-
-#if defined (__WINS__) && !defined (__SERIES60_30__)
-extern "C" int _chkstk(int /*a*/) {
-_asm {
- push ecx
- cmp eax,_PAGESIZE_
- lea ecx,[esp] + 8
- jb short lastpage
-
- probepages:
- sub ecx,_PAGESIZE_
- sub eax,_PAGESIZE_
-
- test dword ptr [ecx],eax
-
- cmp eax,_PAGESIZE_
- jae short probepages
-
- lastpage:
- sub ecx,eax
- mov eax,esp
-
- test dword ptr [ecx],eax
-
- mov esp,ecx
-
- mov ecx,dword ptr [eax]
- mov eax,dword ptr [eax + 4]
-
- push eax
- ret
- }
- return 1;
-}
-#endif
-
-#ifdef EPOC_AS_APP
-
-// this function is called automatically by the SymbianOS to deliver the new CApaApplication object
-#if !defined (UIQ3)
-EXPORT_C
-#endif
-CApaApplication* NewApplication() {
- // Return pointer to newly created CQMApp
- return new CScummApp;
-}
-
-#if defined (UIQ3) || defined (__SERIES60_30__)
-#include <eikstart.h>
-// E32Main() contains the program's start up code, the entry point for an EXE.
-GLDEF_C TInt E32Main() {
- return EikStart::RunApplication(NewApplication);
-}
-#endif
-
-#endif // EPOC_AS_APP
-
-#if !defined (UIQ3) && !defined (__SERIES60_30__)
-GLDEF_C TInt E32Dll(TDllReason) {
- return KErrNone;
-}
-#endif
-
-CScummApp::CScummApp() {
-}
-
-CScummApp::~CScummApp() {
-}
-
-/**
- * Responsible for returning the unique UID of this application
- * @return unique UID for this application in a TUid
- **/
-TUid CScummApp::AppDllUid() const {
- return TUid::Uid(ScummUid);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-
diff --git a/backends/epoc/src/ScummApp.h b/backends/epoc/src/ScummApp.h
deleted file mode 100644
index 56ca8b68c3..0000000000
--- a/backends/epoc/src/ScummApp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#ifndef ScummAPPH
-#define ScummAPPH
-
-#include <eikapp.h>
-#include <e32base.h>
-#include <sdlapp.h>
-
-#if defined (EPOC_AS_APP) && !defined (UIQ3) && !(__SERIES60_30__)
-#include "ECompXL.h"
-#endif
-
-class CScummApp : public CSDLApp {
-public:
- CScummApp();
- ~CScummApp();
-
- TUid AppDllUid() const;
-#if defined (EPOC_AS_APP) && !defined (UIQ3) && !(__SERIES60_30__)
- TECompXL iECompXL;
-#endif
-};
-#endif
-
-
diff --git a/backends/epoc/src/ScummVMApp.cpp b/backends/epoc/src/ScummVMApp.cpp
deleted file mode 100644
index e30cb62e87..0000000000
--- a/backends/epoc/src/ScummVMApp.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ScummVMapp.h"
-#include <scummvm.rsg>
-#include <apgcli.h>
-#include <eikdll.h>
-#include <apgtask.h>
-
-EXPORT_C CApaApplication *NewApplication() {
- return (new CScummVM);
-}
-
-CScummVM::CScummVM() {
-}
-
-CScummVM::~CScummVM() {
-}
-
-CApaDocument *CScummVM::CreateDocumentL() {
- return new (ELeave)CScummVMDoc(*this);
-}
-
-TUid CScummVM::AppDllUid() const {
- return TUid::Uid(0x101f9b57);
-}
-
-CScummVMDoc::CScummVMDoc(CEikApplication &aApp) : CEikDocument(aApp) {
-}
-
-CScummVMDoc::~CScummVMDoc() {
-}
-
-CEikAppUi *CScummVMDoc::CreateAppUiL() {
- return new (ELeave)CScummVMUi;
-}
-
-void CScummVMUi::HandleForegroundEventL(TBool aForeground) {
- if(aForeground) {
- BringUpEmulatorL();
- }
-}
-
-CScummVMUi::CScummVMUi() {
-}
-
-CScummVMUi::~CScummVMUi() {
- if(iWatcher) {
- iThreadWatch.LogonCancel(iWatcher->iStatus);
- iWatcher->Cancel();
- }
-
- delete iWatcher;
-
- iThreadWatch.Close();
-}
-
-void CScummVMUi::ConstructL() {
- BaseConstructL();
- TBuf<128> startFile;
- startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
- TParse parser;
- parser.Set(startFile,NULL,NULL);
-
- startFile = parser.DriveAndPath();
-#ifndef __WINS__
- startFile.Append( _L("ScummVM.exe"));
-#else
- startFile.Append( _L("ScummVM.dll"));
-#endif
- CApaCommandLine *cmdLine = CApaCommandLine::NewLC(startFile);
- RApaLsSession lsSession;
-
- lsSession.Connect();
- CleanupClosePushL(lsSession);
- lsSession.StartApp(*cmdLine, iThreadId);
-
- CleanupStack::PopAndDestroy();//close lsSession
- CleanupStack::PopAndDestroy(cmdLine);
-
- User::After(500000);// Let the application start
-
- TApaTaskList taskList(iEikonEnv->WsSession());
-
- TApaTask myTask = taskList.FindApp(TUid::Uid(0x101f9b57));
- myTask.SendToBackground();
-
- TApaTask exeTask = taskList.FindByPos(0);
-
- iExeWgId=exeTask.WgId();
- exeTask.BringToForeground();
-
- if(iExeWgId == myTask.WgId()) { // Should n't be the same
- Exit();
- }
- if(iThreadWatch.Open(iThreadId) == KErrNone) {
- iWatcher = new (ELeave)CScummWatcher;
- iWatcher->iAppUi = this;
- iThreadWatch.Logon(iWatcher->iStatus);
- }
-}
-
-CScummWatcher::CScummWatcher() : CActive(EPriorityStandard) {
- CActiveScheduler::Add(this);
-
- iStatus = KRequestPending;
- SetActive();
-}
-
-CScummWatcher::~CScummWatcher() {
-}
-
-void CScummWatcher::DoCancel() {
-}
-
-void CScummWatcher::RunL() {
- iAppUi->HandleCommandL(EEikCmdExit);
-}
-
-void CScummVMUi::BringUpEmulatorL() {
- RThread thread;
-
- if(thread.Open(iThreadId) == KErrNone) {
- thread.Close();
- TApaTask apaTask(iEikonEnv->WsSession());
- apaTask.SetWgId(iExeWgId);
- apaTask.BringToForeground();
- } else {
- iExeWgId = -1;
- Exit();
- }
-}
-
-void CScummVMUi::HandleCommandL(TInt aCommand) {
- switch(aCommand) {
- case EEikCmdExit:
- {
- RThread thread;
- if(thread.Open(iThreadId) == KErrNone) {
- thread.Terminate(0);
- thread.Close();
- }
- Exit();
- }
- break;
- }
-}
-
-GLDEF_C TInt E32Dll(TDllReason) {
- return KErrNone;
-}
diff --git a/backends/epoc/src/ScummVMApp.h b/backends/epoc/src/ScummVMApp.h
deleted file mode 100644
index 0c422ad178..0000000000
--- a/backends/epoc/src/ScummVMApp.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ScummVMapph
-#define ScummVMapph
-
-#include <eikapp.h>
-#include <e32base.h>
-#include <coecntrl.h>
-#include <eikenv.h>
-#include <coeview.h>
-#include <eikappui.h>
-
-class CScummVM : public CEikApplication {
-public:
- CScummVM();
- ~CScummVM();
-
- CApaDocument *CreateDocumentL();
- TUid AppDllUid() const;
-};
-
-
-#include <eikdoc.h>
-
-class CScummVMDoc : public CEikDocument {
-public:
- CScummVMDoc(CEikApplication &aApplicaiton);
- ~CScummVMDoc();
-
- CEikAppUi *CreateAppUiL();
- void ConstructL();
-};
-
-#include <eikappui.h>
-class CScummVMUi;
-class CScummWatcher : public CActive {
-public:
- CScummWatcher();
- ~CScummWatcher();
-
- void DoCancel();
- void RunL();
- CScummVMUi *iAppUi;
-};
-
-class CScummVMUi : public CEikAppUi {
-public:
- CScummVMUi();
- ~CScummVMUi();
-
- void ConstructL();
- void HandleCommandL(TInt aCommand);
- void HandleForegroundEventL(TBool aForeground);
- void BringUpEmulatorL();
-
-private:
- TThreadId iThreadId;
- TInt iExeWgId;
- RThread iThreadWatch;
- CScummWatcher *iWatcher;
-};
-#endif
diff --git a/backends/epoc/src/ScummVm.hrh b/backends/epoc/src/ScummVm.hrh
deleted file mode 100644
index 3f7bfc19d6..0000000000
--- a/backends/epoc/src/ScummVm.hrh
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ScummHRH
-#define ScummHRH
-#if defined (UIQ3) || defined (__SERIES60_30__)
-#define ScummUid 0xA0000657
-#else
-#define ScummUid 0x101f9b57
-#endif
-#endif
diff --git a/backends/epoc/src/SymbianActions.cpp b/backends/epoc/src/SymbianActions.cpp
deleted file mode 100644
index 1b8abc6661..0000000000
--- a/backends/epoc/src/SymbianActions.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-#include "backends/epoc/src/SymbianActions.h"
-
-#include "gui/message.h"
-#include "scumm/scumm.h"
-#include "common/config-manager.h"
-
-#include <sdl.h>
-
-namespace GUI {
-
-// SumthinWicked says: we either split our Actions like WinCE did with Pocket/Smartphone
-// or we put them in this file separated by #ifdefs, this one is up to you, AnotherGuest :)
-
-const Common::String actionNames[] = {
- "Up",
- "Down",
- "Left",
- "Right",
- "Left Click",
- "Right Click",
- "Save",
- "Skip",
- "Zone",
- "FT Cheat",
- "Swap character",
- "Skip text",
- "Pause",
- "Quit"
-};
-
-#ifdef UIQ
-static const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0x11a, 0x11b, SDLK_MENU, SDLK_PAGEDOWN, 0, 0,SDLK_PAGEUP,0,0};
-#elif defined (S60)
-const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0, 0, '*', '#', '9',0,0,0,0,0};
-#elif defined (S90)
-const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0, 0, SDLK_MENU, SDLK_ESCAPE, 0, 0,0,0,0,0};
-#else
-const int ACTIONS_DEFAULT[ACTION_LAST] = { 0, 0, 0, 0, 0x11a, 0x11b, SDLK_MENU, SDLK_ESCAPE, 0, 0,0,0,0,0};
-#endif
-
-// creator function according to Factory Pattern
-void SymbianActions::init(GameDetector &detector) {
- _instance = new SymbianActions(detector);
-}
-
-
-Common::String SymbianActions::actionName(ActionType action) {
- return actionNames[action];
-}
-
-int SymbianActions::size() {
- return ACTION_LAST;
-}
-
-Common::String SymbianActions::domain() {
- return "symbian";
-}
-
-int SymbianActions::version() {
- return ACTION_VERSION;
-}
-
-SymbianActions::SymbianActions(GameDetector &detector) :
- Actions(detector) {
- int i;
-
- for (i = 0; i < ACTION_LAST; i++) {
- _action_mapping[i] = ACTIONS_DEFAULT[i];
- _action_enabled[i] = false;
- }
-
-}
-
-void SymbianActions::initInstanceMain(OSystem *mainSystem) {
- Actions::initInstanceMain(mainSystem);
-
- // Mouse Up
- _action_enabled[ACTION_UP] = true;
-
- // Mouse Down
- _action_enabled[ACTION_DOWN] = true;
-
- // Mouse Left
- _action_enabled[ACTION_LEFT] = true;
-
- // Mouse Right
- _action_enabled[ACTION_RIGHT] = true;
-
- // Left Click
- _action_enabled[ACTION_LEFTCLICK] = true;
-
- // Right Click
- _action_enabled[ACTION_RIGHTCLICK] = true;
-
- // Skip
- _action_enabled[ACTION_SKIP] = true;
- _key_action[ACTION_SKIP].setAscii(SDLK_ESCAPE);
-}
-
-void SymbianActions::initInstanceGame() {
- bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
- bool is_sky = (_detector->_targetName == "sky");
- bool is_queen = (_detector->_targetName == "queen");
- bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0);
- bool is_ite = ((strncmp(_detector->_targetName.c_str(), "ite", 3) == 0) ||
- (strncmp(_detector->_targetName.c_str(), "ihnm", 4) == 0));
-
- Actions::initInstanceGame();
-
- // See if a right click mapping could be needed
- if (is_sky || _detector->_targetName == "samnmax" || is_gob)
- _right_click_needed = true;
-
- // Initialize keys for different actions
- // Save
- if (is_simon || is_gob)
- _action_enabled[ACTION_SAVE] = false;
- else if (is_queen) {
- _action_enabled[ACTION_SAVE] = true;
- _key_action[ACTION_SAVE].setAscii(SDLK_F1); // F1 key for FOTAQ or F5??!?
- } else if (is_sky) {
- _action_enabled[ACTION_SAVE] = true;
- _key_action[ACTION_SAVE].setAscii(63);
- } else {
- _action_enabled[ACTION_SAVE] = true;
- _key_action[ACTION_SAVE].setAscii(SDLK_F5); // F5 key
- }
-
- // Swap character
- _action_enabled[ACTION_SWAPCHAR] = true;
- _key_action[ACTION_SWAPCHAR].setAscii('b'); // b
-
- // Zone
- _action_enabled[ACTION_ZONE] = true;
-
- // FT Cheat
- _action_enabled[ACTION_FT_CHEAT] = true;
- _key_action[ACTION_FT_CHEAT].setAscii(86); // shift-V
-
- // Skip text
- _action_enabled[ACTION_SKIP_TEXT] = true;
- if (is_queen) {
- _key_action[ACTION_SKIP_TEXT].setAscii(SDLK_SPACE);
- } else {
- _key_action[ACTION_SKIP_TEXT].setAscii(SDLK_PERIOD);
- }
-
- // Pause
- _key_action[ACTION_PAUSE].setAscii(' ');
- _action_enabled[ACTION_PAUSE] = true;
-
- // Quit
- _action_enabled[ACTION_QUIT] = true;
-}
-
-
-SymbianActions::~SymbianActions() {
-}
-
-bool SymbianActions::perform(ActionType /*action*/, bool /*pushed*/) {
-
- return false;
-}
-
-} // namespace GUI
diff --git a/backends/epoc/src/SymbianActions.h b/backends/epoc/src/SymbianActions.h
deleted file mode 100644
index 50a3ed6bac..0000000000
--- a/backends/epoc/src/SymbianActions.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SYMBIANACTIONS_H
-#define SYMBIANACTIONS_H
-
-#include "common/stdafx.h"
-#include "common/scummsys.h"
-#include "common/system.h"
-#include "base/gameDetector.h"
-#include "gui/Key.h"
-#include "gui/Actions.h"
-
-namespace GUI {
-
-#define ACTION_VERSION 6
-
-enum actionType {
- ACTION_UP = 0,
- ACTION_DOWN,
- ACTION_LEFT,
- ACTION_RIGHT,
- ACTION_LEFTCLICK,
- ACTION_RIGHTCLICK,
- ACTION_SAVE,
- ACTION_SKIP,
- ACTION_ZONE,
- ACTION_FT_CHEAT,
- ACTION_SWAPCHAR,
- ACTION_SKIP_TEXT,
- ACTION_PAUSE,
- ACTION_QUIT,
- ACTION_LAST
-};
-
-class SymbianActions : public Actions {
-public:
- // Actions
- bool perform(ActionType action, bool pushed = true);
- Common::String actionName(ActionType action);
- int size();
- static void init(GameDetector &detector);
- void initInstanceMain(OSystem *mainSystem);
- void initInstanceGame();
-
- // Action domain
- Common::String domain();
- int version();
-
- ~SymbianActions();
-
-private:
- SymbianActions(GameDetector &detector);
- bool _right_click_needed;
-};
-
-} // namespace GUI
-
-#endif
diff --git a/backends/epoc/src/SymbianOS.cpp b/backends/epoc/src/SymbianOS.cpp
deleted file mode 100644
index dc8a79fe47..0000000000
--- a/backends/epoc/src/SymbianOS.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include "backends/epoc/src/SymbianOS.h"
-#include "backends/epoc/src/SymbianActions.h"
-#include "common/config-manager.h"
-#include "gui/Actions.h"
-#include "gui/Key.h"
-#include "gui/message.h"
-
-#include <eikenv.h> // for CEikonEnv::Static() @ Symbian::FatalError()
-#include "ESDL/sdlapp.h" // for CSDLApp::GetExecutablePathCStr() @ Symbian::GetExecutablePath()
-
-////////// extern "C" ///////////////////////////////////////////////////
-
-extern Common::ConfigManager *g_config;
-
-OSystem *OSystem_SymbianOS_create() {
- return new OSystem_SDL_Symbian();
-}
-
-namespace Symbian {
-
-// Show a simple Symbian Info win with Msg & exit
-void FatalError(const char *msg) {
- TPtrC8 msgPtr((const TUint8 *)msg);
- TBuf<512> msg16Bit;
- msg16Bit.Copy(msgPtr);
- CEikonEnv::Static()->InfoWinL(_L("ScummVM Fatal Error"), msg16Bit);
-
- if (g_system)
- g_system->quit();
-}
-
-// make this easily available everywhere
-char* GetExecutablePath()
-{
- return CSDLApp::GetExecutablePathCStr();
-}
-
-} // namespace Symbian {
-
-////////// OSystem_SDL_Symbian //////////////////////////////////////////
-
-static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
- {"1x", "Fullscreen", GFX_NORMAL},
- {0, 0, 0}
-};
-
-bool OSystem_SDL_Symbian::hasFeature(Feature f) {
- switch(f) {
- case kFeatureFullscreenMode:
- case kFeatureAspectRatioCorrection:
- case kFeatureAutoComputeDirtyRects:
- case kFeatureCursorHasPalette:
-#ifdef USE_VIBRA_SE_PXXX
- case kFeatureVibration:
-#endif
- return true;
-
- default:
- return false;
- }
-}
-
-OSystem_SDL_Symbian::zoneDesc OSystem_SDL_Symbian::_zones[TOTAL_ZONES] = {
- { 0, 0, 320, 145 },
- { 0, 145, 150, 55 },
- { 150, 145, 170, 55 }
-};
-OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0)
-{
- ConfMan.set("FM_high_quality", false);
-#ifndef S60 // S60 has low quality as default
- ConfMan.set("FM_medium_quality", true);
-#else
- ConfMan.set("FM_medium_quality", false);
-#endif
- ConfMan.set("joystick_num", 0); // Symbian OS should have joystick_num set to 0 in the ini file , but uiq devices might refuse opening the joystick
- ConfMan.flushToDisk();
- // Initialize global key mapping for Smartphones
- GUI::Actions* actions = GUI::Actions::Instance();
- actions->initInstanceMain(this);
- actions->loadMapping();
- initZones();
-}
-
-OSystem_SDL_Symbian::~OSystem_SDL_Symbian() {
- delete []_stereo_mix_buffer;
-}
-
-int OSystem_SDL_Symbian::getDefaultGraphicsMode() const {
- return GFX_NORMAL;
-}
-
-const OSystem::GraphicsMode *OSystem_SDL_Symbian::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
-}
-
-// make sure we always go to normal, even if the string might be set wrong!
-bool OSystem_SDL_Symbian::setGraphicsMode(const char * /*name*/) {
- // let parent OSystem_SDL handle it
- return OSystem_SDL::setGraphicsMode(getDefaultGraphicsMode());
-}
-
-void OSystem_SDL_Symbian::quitWithErrorMsg(const char *msg) {
-
- CEikonEnv::Static()->AlertWin(_L("quitWithErrorMsg()")) ;
-
- if (g_system)
- g_system->quit();
-}
-
-/*
- * SumthinWicked says: the stuff below is copied from common/scaler.cpp,
- * so we can skip compiling the scalers. ESDL still needs 1x and the scaler
- * architecture because we inherit from OSystem_SDL.
- */
-int gBitFormat = 565;
-void InitScalers(uint32 /*BitFormat*/) {} // called by OSystem_SDL functions, not relevant for ESDL
-
-/**
- * Trivial 'scaler' - in fact it doesn't do any scaling but just copies the
- * source to the destination.
- */
-void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
- int width, int height) {
- while (height--) {
- memcpy(dstPtr, srcPtr, 2 * width);
- srcPtr += srcPitch;
- dstPtr += dstPitch;
- }
-}
-
-bool OSystem_SDL_Symbian::setSoundCallback(SoundProc proc, void *param) {
-
- // First save the proc and param
- _sound_proc_param = param;
- _sound_proc = proc;
- SDL_AudioSpec desired;
- SDL_AudioSpec obtained;
-
- memset(&desired, 0, sizeof(desired));
-
- _samplesPerSec = 0;
-
- if (ConfMan.hasKey("output_rate"))
- _samplesPerSec = ConfMan.getInt("output_rate");
-
- if (_samplesPerSec <= 0)
- _samplesPerSec = SAMPLES_PER_SEC;
-
- // Originally, we always used 2048 samples. This loop will produce the
- // same result at 22050 Hz, and should hopefully produce something
- // sensible for other frequencies. Note that it must be a power of two.
-
- uint32 samples = 0x8000;
-
- for (;;) {
- if ((1000 * samples) / _samplesPerSec < 100)
- break;
- samples >>= 1;
- }
-
- desired.freq = _samplesPerSec;
- desired.format = AUDIO_S16SYS;
- desired.channels = 2;
- desired.samples = (uint16)samples;
-#ifdef S60
- desired.callback = symbianMixCallback;
- desired.userdata = this;
-#else
- desired.callback = proc;
- desired.userdata = param;
-#endif
- if (SDL_OpenAudio(&desired, &obtained) != 0) {
- warning("Could not open audio device: %s", SDL_GetError());
- return false;
- }
- // Note: This should be the obtained output rate, but it seems that at
- // least on some platforms SDL will lie and claim it did get the rate
- // even if it didn't. Probably only happens for "weird" rates, though.
- _samplesPerSec = obtained.freq;
- _channels = obtained.channels;
-
- // Need to create mixbuffer for stereo mix to downmix
- if(_channels != 2) {
- _stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
- }
-
- SDL_PauseAudio(0);
- return true;
-}
-
-/**
- * The mixer callback function, passed on to OSystem::setSoundCallback().
- * This simply calls the mix() method.
- */
-void OSystem_SDL_Symbian::symbianMixCallback(void *s, byte *samples, int len) {
- static_cast <OSystem_SDL_Symbian*>(s)->symbianMix(samples,len);
-}
-
-
-/**
- * Actual mixing implementation
- */
-void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) {
- // If not stereo then we need to downmix
- if (_channels != 2) {
- _sound_proc(_sound_proc_param, _stereo_mix_buffer, len * 2);
- int16 *bitmixDst = (int16 *)samples;
- int16 *bitmixSrc = (int16 *)_stereo_mix_buffer;
-
- for (int loop = len / 2; loop >= 0; loop --) {
- *bitmixDst = (*bitmixSrc + *(bitmixSrc + 1)) >> 1;
- bitmixDst++;
- bitmixSrc += 2;
- }
- } else
- _sound_proc(_sound_proc_param, samples, len);
-}
-
-/**
- * This is an implementation by the remapKey function
- * @param SDL_Event to remap
- * @param ScumVM event to modify if special result is requested
- * @return true if Event has a valid return status
- */
-bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Event &event) {
- if (GUI::Actions::Instance()->mappingActive() || ev.key.keysym.sym <= SDLK_UNKNOWN)
- return false;
-
- for (TInt loop = 0; loop < GUI::ACTION_LAST; loop++) {
- if (GUI::Actions::Instance()->getMapping(loop) == ev.key.keysym.sym &&
- GUI::Actions::Instance()->isEnabled(loop)) {
- // Create proper event instead
- switch(loop) {
- case GUI::ACTION_UP:
- if (ev.type == SDL_KEYDOWN) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
- event.type = EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_DOWN:
- if(ev.type == SDL_KEYDOWN) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
- event.type = EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_LEFT:
- if(ev.type == SDL_KEYDOWN) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
- event.type = EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_RIGHT:
- if(ev.type == SDL_KEYDOWN) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
- event.type = EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_LEFTCLICK:
- event.type = (ev.type == SDL_KEYDOWN ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP);
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_RIGHTCLICK:
- event.type = (ev.type == SDL_KEYDOWN ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP);
- fillMouseEvent(event, _km.x, _km.y);
-
- return true;
-
- case GUI::ACTION_ZONE:
- if(ev.type == SDL_KEYDOWN) {
- int i;
-
- for (i=0; i < TOTAL_ZONES; i++)
- if (_km.x >= _zones[i].x && _km.y >= _zones[i].y &&
- _km.x <= _zones[i].x + _zones[i].width && _km.y <= _zones[i].y + _zones[i].height
- ) {
- _mouseXZone[i] = _km.x;
- _mouseYZone[i] = _km.y;
- break;
- }
- _currentZone++;
- if (_currentZone >= TOTAL_ZONES)
- _currentZone = 0;
- event.type = EVENT_MOUSEMOVE;
- fillMouseEvent(event, _mouseXZone[_currentZone], _mouseYZone[_currentZone]);
- SDL_WarpMouse(event.mouse.x, event.mouse.y);
- }
-
- return true;
-
- case GUI::ACTION_SAVE:
- case GUI::ACTION_SKIP:
- case GUI::ACTION_FT_CHEAT:
- case GUI::ACTION_SKIP_TEXT:
- case GUI::ACTION_PAUSE:
- {
- GUI::Key &key = GUI::Actions::Instance()->getKeyAction(loop);
- ev.key.keysym.sym = (SDLKey)key.ascii();
- ev.key.keysym.scancode= key.keycode();
- ev.key.keysym.mod = (SDLMod)key.flags();
-
- return false;
- }
-
- case GUI::ACTION_QUIT:
- {
- GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
- if (alert.runModal() == GUI::kMessageOK)
- quit();
-
- return true;
- }
- }
- }
- }
-
- return false;
-}
-
-void OSystem_SDL_Symbian::setWindowCaption(const char *caption) {
- OSystem_SDL::setWindowCaption(caption);
- check_mappings();
-}
-
-void OSystem_SDL_Symbian::check_mappings() {
- if (!GUI::Actions::Instance()->gameDetector()._targetName.size() || GUI::Actions::Instance()->initialized())
- return;
-
- GUI::Actions::Instance()->initInstanceGame();
-}
-
-void OSystem_SDL_Symbian::initZones() {
- int i;
-
- _currentZone = 0;
-
- for (i = 0; i < TOTAL_ZONES; i++) {
- _mouseXZone[i] = (_zones[i].x + (_zones[i].width / 2));
- _mouseYZone[i] = (_zones[i].y + (_zones[i].height / 2));
- }
-}
-
-
-/** Vibration support */
-#ifdef USE_VIBRA_SE_PXXX
-void OSystem_SDL_Symbian::initializeVibration() {
- _vibrationApi = SonyEricsson::CVibration::NewL();
-}
-
-void OSystem_SDL_Symbian::vibrationOn(int vibraLength) {
- // initialize?
- if (!_vibrationApi) _vibrationApi = SonyEricsson::CVibration::NewL();
- // do it!
- _vibrationApi->VibrationOn(1, 1, vibraLength);
-}
-
-void OSystem_SDL_Symbian::vibrationOff() {
- _vibrationApi->VibrationOff();
-}
-#endif // USE_SE_PXX_VIBRA
-
diff --git a/backends/epoc/src/SymbianOS.h b/backends/epoc/src/SymbianOS.h
deleted file mode 100644
index 3d16bece34..0000000000
--- a/backends/epoc/src/SymbianOS.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#ifndef SDLSYMBIANH
-#define SDLSYMBIANH
-
-#include "backends/sdl/sdl-common.h"
-
-/** Vibration support */
-#ifdef USE_VIBRA_SE_PXXX
-#include <vibration.h>
-#endif
-
-#define TOTAL_ZONES 3
-
-class OSystem_SDL_Symbian : public OSystem_SDL {
-public:
- OSystem_SDL_Symbian();
- ~OSystem_SDL_Symbian();
- int getDefaultGraphicsMode() const;
- const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- bool setGraphicsMode(const char *name);
- void quitWithErrorMsg(const char *msg);
- virtual bool hasFeature(Feature f);
-
- // Set function that generates samples
- //
- // This function is overridden by the symbian port in order to provide MONO audio
- // downmix is done by supplying our own audiocallback
- //
- virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
-
-protected:
- //
- // The mixer callback function, passed on to OSystem::setSoundCallback().
- // This simply calls the mix() method.
- // and then does downmixing for symbian if needed
- //
- static void symbianMixCallback(void *s, byte *samples, int len);
-
- //
- // Actual mixing implementation
- //
- void symbianMix(byte *samples, int len);
-
-public:
- // vibration support
-#ifdef USE_VIBRA_SE_PXXX
- //
- // Intialize the vibration api used if present and supported
- //
- void initializeVibration();
-
- //
- // Turn vibration on, repeat no time
- // @param vibraLength number of repetitions
- //
- void vibrationOn(int vibraLength);
-
- //
- // Turns the vibration off
- //
- void vibrationOff();
-
-protected:
- SonyEricsson::CVibration* _vibrationApi;
-#endif // USE_VIBRA_SE_PXXX
-
-protected:
-
- //
- // This is an implementation by the remapKey function
- // @param SDL_Event to remap
- // @param ScumVM event to modify if special result is requested
- // @return true if Event has a valid return status
- //
- bool remapKey(SDL_Event &ev, Event &event);
-
- void setWindowCaption(const char *caption);
-
- //
- // Used to intialized special game mappings
- //
- void check_mappings();
-
- void initZones();
-
- // Audio
- int _channels;
-
- SoundProc _sound_proc;
- void *_sound_proc_param;
- byte *_stereo_mix_buffer;
-
- // Used to handle joystick navi zones
- int _mouseXZone[TOTAL_ZONES];
- int _mouseYZone[TOTAL_ZONES];
- int _currentZone;
-
- typedef struct zoneDesc {
- int x;
- int y;
- int width;
- int height;
- } zoneDesc;
-
- static zoneDesc _zones[TOTAL_ZONES];
-};
-
-#endif
diff --git a/backends/epoc/src/main_features.inl b/backends/epoc/src/main_features.inl
deleted file mode 100644
index b17b0b4feb..0000000000
--- a/backends/epoc/src/main_features.inl
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifdef USE_VIBRA_SE_PXXX
- "Vibra "
-#endif
- "\n"
-
-// we want a list of supported engines visible in the program,
-// because we also release special builds with only one engine
-#ifndef DISABLE_SCUMM
- "SCUMM "
-#endif
-#ifndef DISABLE_SIMON
- "Simon "
-#endif
-#ifndef DISABLE_SKY
- "Sky "
-#endif
-#ifndef DISABLE_QUEEN
- "Queen "
-#endif
-#ifndef DISABLE_GOB
- "Gob "
-#endif
-#ifndef DISABLE_SAGA
- "Saga "
-#endif
-#ifndef DISABLE_KYRA
- "Kyra "
-#endif
-#ifndef DISABLE_SWORD1
- "Sword1 "
-#endif
-#ifndef DISABLE_SWORD2
- "Sword2 "
-#endif
diff --git a/backends/epoc/src/portdefs.h b/backends/epoc/src/portdefs.h
deleted file mode 100644
index d84db8cdd9..0000000000
--- a/backends/epoc/src/portdefs.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL
- * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System
- * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer
- * Copyright (C) 2005-2006 The ScummVM project
- *
- * 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include <assert.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <e32def.h>
-
-#include <e32std.h>
-#include <math.h>
-
-#define DISABLE_SCALERS // we only need 1x
-
-#if defined(USE_TREMOR) && !defined(USE_VORBIS)
-#define USE_VORBIS // make sure this one is defined together with USE_TREMOR!
-#endif
-
-// hack in some tricks to work around not having these fcns for Symbian
-// and we _really_ don't wanna link with any other windows LIBC library!
-#ifdef __GCC32__
-
- #define snprintf(buf,len,args...) sprintf(buf,args)
- #define vsnprintf snprintf
-
- // taken from public domain http://www.opensource.apple.com/darwinsource/WWDC2004/gcc_legacy-939/gcc/floatlib.c
- #define SIGNBIT 0x80000000
- #define HIDDEN (1 << 23)
- #define EXCESSD 1022
- #define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
- #define SIGND(fp) ((fp.l.upper) & SIGNBIT)
- #define HIDDEND_LL ((long long)1 << 52)
- #define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
-
- union double_long {
- double d;
- struct {
- long upper;
- unsigned long lower;
- } l;
- long long ll;
- };
-
- /* convert double float to double int (dfdi) */
- long long inline
- scumm_fixdfdi (double a1) { // __fixdfdi (double a1)
- register union double_long dl1;
- register int exp;
- register long long l;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return (0);
-
- exp = EXPD (dl1) - EXCESSD - 64;
- l = MANTD_LL(dl1);
-
- if (exp > 0) {
- l = (long long)1<<63;
- if (!SIGND(dl1))
- l--;
- return l;
- }
-
- /* shift down until exp = 0 or l = 0 */
- if (exp < 0 && exp > -64 && l)
- l >>= -exp;
- else
- return (0);
-
- return (SIGND (dl1) ? -l : l);
- }
-
- /* okay, okay: I admit it: I absolutely have _NO_ idea why __fixdfdi does not get linked in by gcc from libgcc.a
- because I know it's in there: I checked with `ar x _fixdfdi.o libgcc.a` and the symbol is in there, so I'm lost
- and had to fix it this way. I tried all gcc and ld options I could find: no hope :( If someone can enlighten me:
- feel free to let me know at sumthinwicked@users.sf.net! Much obliged.
- PS1. I think for __fixunsdfdi they have made a circumvention by having to add STATICLIBRARY EGCC.LIB
- PS2. http://gcc.gnu.org/ml/gcc-bugs/2004-01/msg01596.html might have found out the same problem there
- */
-
-#else // WINS
-
- // let's just blatantly ignore this for now and just get it to work :P but does n't work from the debug function
- int inline scumm_snprintf (char *str, unsigned long /*n*/, char const *fmt, ...) {
- va_list args;
- va_start(args, fmt);
- vsprintf(str, fmt, args);
- va_end(args);
- return strlen(str);
- }
-
- #define snprintf scumm_snprintf
- #define vsnprintf scumm_snprintf
-
-#endif
-
-// somehow nobody has this function...
-#define hypot(a, b) sqrt((a)*(a) + (b)*(b))
-
-// Symbian bsearch implementation is flawed
-void inline *scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- size_t i;
-
- for (i=0; i < nmemb; i++)
- if (compar(key, (void *)((size_t)base + size * i)) == 0)
- return (void *)((size_t)base + size * i);
- return NULL;
-}
-#define bsearch scumm_bsearch
-
-// we cannot include SymbianOS.h everywhere, but this works too (functions code is in SymbianOS.cpp)
-namespace Symbian {
-extern void FatalError(const char *msg);
-extern char* GetExecutablePath();
-}