diff options
Diffstat (limited to 'backends/epoc/src')
-rw-r--r-- | backends/epoc/src/ScummApp.cpp | 23 | ||||
-rw-r--r-- | backends/epoc/src/ScummApp.h | 7 | ||||
-rw-r--r-- | backends/epoc/src/ScummVMApp.cpp | 170 | ||||
-rw-r--r-- | backends/epoc/src/ScummVMApp.h | 82 | ||||
-rw-r--r-- | backends/epoc/src/ScummVm.hrh | 9 | ||||
-rw-r--r-- | backends/epoc/src/SymbianOS.cpp | 30 | ||||
-rw-r--r-- | backends/epoc/src/main_features.inl | 56 | ||||
-rw-r--r-- | backends/epoc/src/portdefs.h | 11 |
8 files changed, 364 insertions, 24 deletions
diff --git a/backends/epoc/src/ScummApp.cpp b/backends/epoc/src/ScummApp.cpp index 55cd274962..09edfb3215 100644 --- a/backends/epoc/src/ScummApp.cpp +++ b/backends/epoc/src/ScummApp.cpp @@ -27,7 +27,7 @@ #include "backends/epoc/src/ScummVM.hrh" #define _PAGESIZE_ 0x1000 -#if defined (__WINS__) +#if defined (__WINS__) && !defined (__SERIES60_30__) extern "C" int _chkstk(int /*a*/) { _asm { push ecx @@ -63,16 +63,31 @@ _asm { #endif #ifdef EPOC_AS_APP -// this function is called by Symbian to deliver the new CApaApplication object -EXPORT_C CApaApplication *NewApplication() { + +// 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); + 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() { } diff --git a/backends/epoc/src/ScummApp.h b/backends/epoc/src/ScummApp.h index 1bcf92522c..56ca8b68c3 100644 --- a/backends/epoc/src/ScummApp.h +++ b/backends/epoc/src/ScummApp.h @@ -28,7 +28,8 @@ #include <eikapp.h> #include <e32base.h> #include <sdlapp.h> -#ifdef EPOC_AS_APP + +#if defined (EPOC_AS_APP) && !defined (UIQ3) && !(__SERIES60_30__) #include "ECompXL.h" #endif @@ -38,8 +39,10 @@ public: ~CScummApp(); TUid AppDllUid() const; -#ifdef EPOC_AS_APP +#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 new file mode 100644 index 0000000000..e30cb62e87 --- /dev/null +++ b/backends/epoc/src/ScummVMApp.cpp @@ -0,0 +1,170 @@ +/* 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 new file mode 100644 index 0000000000..0c422ad178 --- /dev/null +++ b/backends/epoc/src/ScummVMApp.h @@ -0,0 +1,82 @@ +/* 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 index f62ef1b789..3f7bfc19d6 100644 --- a/backends/epoc/src/ScummVm.hrh +++ b/backends/epoc/src/ScummVm.hrh @@ -2,7 +2,7 @@ * 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 The ScummVM project + * 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 @@ -18,12 +18,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $Header$ */ #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/SymbianOS.cpp b/backends/epoc/src/SymbianOS.cpp index 07199c5cfa..dc8a79fe47 100644 --- a/backends/epoc/src/SymbianOS.cpp +++ b/backends/epoc/src/SymbianOS.cpp @@ -24,27 +24,26 @@ #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() @ SymbianFatalError() +#include <eikenv.h> // for CEikonEnv::Static() @ Symbian::FatalError() +#include "ESDL/sdlapp.h" // for CSDLApp::GetExecutablePathCStr() @ Symbian::GetExecutablePath() -#include "common/config-manager.h" +////////// extern "C" /////////////////////////////////////////////////// extern Common::ConfigManager *g_config; -static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { - {"1x", "Fullscreen", GFX_NORMAL}, - {0, 0, 0} -}; - OSystem *OSystem_SymbianOS_create() { return new OSystem_SDL_Symbian(); } +namespace Symbian { + // Show a simple Symbian Info win with Msg & exit -void SymbianFatalError(const char *msg) { +void FatalError(const char *msg) { TPtrC8 msgPtr((const TUint8 *)msg); TBuf<512> msg16Bit; msg16Bit.Copy(msgPtr); @@ -54,6 +53,21 @@ void SymbianFatalError(const char *msg) { 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: diff --git a/backends/epoc/src/main_features.inl b/backends/epoc/src/main_features.inl new file mode 100644 index 0000000000..b17b0b4feb --- /dev/null +++ b/backends/epoc/src/main_features.inl @@ -0,0 +1,56 @@ +/* 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 index a97d971d60..d84db8cdd9 100644 --- a/backends/epoc/src/portdefs.h +++ b/backends/epoc/src/portdefs.h @@ -34,8 +34,6 @@ #include <e32std.h> #include <math.h> -// the place in Symbian FS where scummvm.ini & std***.txt are saved -#define SYMBIAN32_DOC_DIR "C:\\documents\\ScummVM\\" // includes final \\! #define DISABLE_SCALERS // we only need 1x #if defined(USE_TREMOR) && !defined(USE_VORBIS) @@ -136,7 +134,8 @@ void inline *scumm_bsearch(const void *key, const void *base, size_t nmemb, size } #define bsearch scumm_bsearch -// make sure SymbianFatalError() @ SymbianOS.cpp is known in error() @ engine.cpp -extern void SymbianFatalError(const char *msg) ; - - +// 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(); +} |