From 7f6002caba3f0a6749820c2772161caf55b8d267 Mon Sep 17 00:00:00 2001 From: neonloop Date: Fri, 7 May 2021 20:00:12 +0000 Subject: Initial commit (uqm-0.8.0) --- src/symbian/bld.inf | 9 ++ src/symbian/config.h | 57 ++++++++ src/symbian/icons_scalable_dc.mk | 37 +++++ src/symbian/uqm-armv5.pkg | 26 ++++ src/symbian/uqm-gcce.pkg | 26 ++++ src/symbian/uqm.cfg | 26 ++++ src/symbian/uqm.mmp | 45 ++++++ src/symbian/uqm.rss | 26 ++++ src/symbian/uqm.svg | 70 +++++++++ src/symbian/uqm_reg.rss | 12 ++ src/symbian/uqmapp.cpp | 308 +++++++++++++++++++++++++++++++++++++++ 11 files changed, 642 insertions(+) create mode 100644 src/symbian/bld.inf create mode 100644 src/symbian/config.h create mode 100644 src/symbian/icons_scalable_dc.mk create mode 100644 src/symbian/uqm-armv5.pkg create mode 100644 src/symbian/uqm-gcce.pkg create mode 100644 src/symbian/uqm.cfg create mode 100644 src/symbian/uqm.mmp create mode 100644 src/symbian/uqm.rss create mode 100644 src/symbian/uqm.svg create mode 100644 src/symbian/uqm_reg.rss create mode 100644 src/symbian/uqmapp.cpp (limited to 'src/symbian') diff --git a/src/symbian/bld.inf b/src/symbian/bld.inf new file mode 100644 index 0000000..f9f1ad4 --- /dev/null +++ b/src/symbian/bld.inf @@ -0,0 +1,9 @@ +PRJ_PLATFORMS + + +PRJ_EXPORTS + + +PRJ_MMPFILES +gnumakefile icons_scalable_dc.mk +uqm.mmp diff --git a/src/symbian/config.h b/src/symbian/config.h new file mode 100644 index 0000000..c97b49e --- /dev/null +++ b/src/symbian/config.h @@ -0,0 +1,57 @@ +/* This file contains some compile-time configuration options for Symbian + */ + +#ifndef SYMBIAN_CONFIG_H_ +#define SYMBIAN_CONFIG_H_ + +/* Directory where the UQM game data is located */ +#define CONTENTDIR "content" + +/* Directory where game data will be stored */ +#define USERDIR "userdata" + +/* Directory where config files will be stored */ +#define CONFIGDIR USERDIR + +/* Directory where supermelee teams will be stored */ +#define MELEEDIR "userdata\\teams\\" + +/* Directory where save games will be stored */ +#define SAVEDIR "userdata\\save\\" + +/* Define if words are stored with the most significant byte first */ +#undef WORDS_BIGENDIAN + +/* Defined if your system has readdir_r of its own */ +#undef HAVE_READDIR_R + +/* Defined if your system has setenv of its own */ +#define HAVE_SETENV + +/* Defined if your system has strupr of its own */ +#undef HAVE_STRUPR + +/* Defined if your system has strcasecmp of its own */ +#define HAVE_STRCASECMP_UQM + // Not using "HAVE_STRCASECMP" as that conflicts with SDL. + +/* Defined if your system has stricmp of its own */ +#undef HAVE_STRICMP + +/* Defined if your system has getopt_long */ +#undef HAVE_GETOPT_LONG + +/* Defined if your system has iswgraph of its own*/ +#define HAVE_ISWGRAPH + +/* Defined if your system has wchar_t of its own */ +#define HAVE_WCHAR_T + +/* Defined if your system has wint_t of its own */ +#define HAVE_WINT_T + +#define HAVE__BOOL + +#define PATH_MAX _POSIX_PATH_MAX + +#endif /* SYMBIAN_CONFIG_H_ */ diff --git a/src/symbian/icons_scalable_dc.mk b/src/symbian/icons_scalable_dc.mk new file mode 100644 index 0000000..99ac591 --- /dev/null +++ b/src/symbian/icons_scalable_dc.mk @@ -0,0 +1,37 @@ +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\uqm_icon.mif + +ICONDIR= + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c32 uqm.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff --git a/src/symbian/uqm-armv5.pkg b/src/symbian/uqm-armv5.pkg new file mode 100644 index 0000000..3549fd7 --- /dev/null +++ b/src/symbian/uqm-armv5.pkg @@ -0,0 +1,26 @@ +;Language - standard language definitions +&EN + +; standard SIS file header +#{"Ur-Quan Masters"},(0xA000A0C3),1,0,0 + +;Localised Vendor name +%{"Interstellar Frungy League"} + +;Unique Vendor name +:"Interstellar Frungy League" + +;Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +*"uqm.key", "uqm.cer" + +;Files to install +; +"\Epoc32\release\Armv5\urel\uqm.exe" - "!:\sys\bin\uqm.exe" +"\Epoc32\data\z\resource\apps\uqm.rsc" - "!:\resource\apps\uqm.rsc" +"\Epoc32\data\z\resource\apps\uqm_icon.mif" - "!:\resource\apps\uqm_icon.mif" +"\Epoc32\data\z\private\10003a3f\import\apps\uqm_reg.rsc" - "!:\private\10003a3f\import\apps\uqm_reg.rsc" +"uqm.cfg" - "!:\private\A000A0C3\userdata\uqm.cfg" +"..\..\content\version" - "!:\private\A000A0C3\content\version" +"..\..\content.uqm" - "!:\private\A000A0C3\content\packages\content.uqm" diff --git a/src/symbian/uqm-gcce.pkg b/src/symbian/uqm-gcce.pkg new file mode 100644 index 0000000..afc6e57 --- /dev/null +++ b/src/symbian/uqm-gcce.pkg @@ -0,0 +1,26 @@ +;Language - standard language definitions +&EN + +; standard SIS file header +#{"Ur-Quan Masters"},(0xA000A0C3),1,0,0 + +;Localised Vendor name +%{"Interstellar Frungy League"} + +;Unique Vendor name +:"Interstellar Frungy League" + +;Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +*"uqm.key", "uqm.cer" + +;Files to install +; +"\Epoc32\release\gcce\urel\uqm.exe" - "!:\sys\bin\uqm.exe" +"\Epoc32\data\z\resource\apps\uqm.rsc" - "!:\resource\apps\uqm.rsc" +"\Epoc32\data\z\resource\apps\uqm_icon.mif" - "!:\resource\apps\uqm_icon.mif" +"\Epoc32\data\z\private\10003a3f\import\apps\uqm_reg.rsc" - "!:\private\10003a3f\import\apps\uqm_reg.rsc" +"uqm.cfg" - "!:\private\A000A0C3\userdata\uqm.cfg" +"..\..\content\version" - "!:\private\A000A0C3\content\version" +"..\..\content.uqm" - "!:\private\A000A0C3\content\packages\content.uqm" diff --git a/src/symbian/uqm.cfg b/src/symbian/uqm.cfg new file mode 100644 index 0000000..4dbde82 --- /dev/null +++ b/src/symbian/uqm.cfg @@ -0,0 +1,26 @@ +alwaysgl = BOOLEAN:false +sfxvol = INT32:20 +reswidth = INT32:320 +usegl = BOOLEAN:false +3domusic = BOOLEAN:true +textmenu = BOOLEAN:true +musicvol = INT32:20 +textgradients = BOOLEAN:true +subtitles = BOOLEAN:true +iconicscan = BOOLEAN:false +resheight = INT32:240 +scaler = STRING:no +3domovies = BOOLEAN:false +speechvol = INT32:20 +audioquality = STRING:low +positionalsfx = BOOLEAN:false +player1control = INT32:0 +showfps = BOOLEAN:false +pulseshield = BOOLEAN:false +smoothmelee = BOOLEAN:false +fullscreen = BOOLEAN:false +smoothscroll = BOOLEAN:false +audiodriver = STRING:mixsdl +player2control = INT32:3 +scanlines = BOOLEAN:false +remixmusic = BOOLEAN:false diff --git a/src/symbian/uqm.mmp b/src/symbian/uqm.mmp new file mode 100644 index 0000000..5c7a85c --- /dev/null +++ b/src/symbian/uqm.mmp @@ -0,0 +1,45 @@ +TARGET uqm.exe +TARGETTYPE exe +UID 0 0xA000A0C3 +EPOCHEAPSIZE 1000000 50000000 +EPOCSTACKSIZE 81920 + +SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis + +SOURCEPATH . +SOURCE uqmapp.cpp + +START RESOURCE uqm.rss +HEADER +TARGETPATH resource\apps +LANG SC +END // RESOURCE + +START RESOURCE uqm_reg.rss +#ifdef WINSCW +TARGETPATH \private\10003a3f\apps +#else +TARGETPATH \private\10003a3f\import\apps +#endif +END + +OPTION_REPLACE ARMCC --cpu ARM926EJ-S -O3 -Otime +ALWAYS_BUILD_AS_ARM + +LIBRARY avkon.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY ws32.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY sdl.lib +LIBRARY libc.lib +LIBRARY libm.lib +LIBRARY libz.lib +LIBRARY libpthread.lib + +STATICLIBRARY uqm.lib +STATICLIBRARY SDL_image.lib +STATICLIBRARY tremor.lib diff --git a/src/symbian/uqm.rss b/src/symbian/uqm.rss new file mode 100644 index 0000000..8f9ea8c --- /dev/null +++ b/src/symbian/uqm.rss @@ -0,0 +1,26 @@ +NAME UQM + +#include +#include +#include +#include +#include + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="UQM"; } + +RESOURCE EIK_APP_INFO + { + } + +RESOURCE LOCALISABLE_APP_INFO r_uqm_localisable_app_info + { + short_caption = "UQM"; + caption_and_icon = CAPTION_AND_ICON_INFO + { + caption = "UrQuanMasters"; + number_of_icons = 1; + icon_file = "\\resource\\apps\\uqm_icon.mif"; + }; + } diff --git a/src/symbian/uqm.svg b/src/symbian/uqm.svg new file mode 100644 index 0000000..b95264b --- /dev/null +++ b/src/symbian/uqm.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/symbian/uqm_reg.rss b/src/symbian/uqm_reg.rss new file mode 100644 index 0000000..a57e670 --- /dev/null +++ b/src/symbian/uqm_reg.rss @@ -0,0 +1,12 @@ +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0xA000A0C3 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "uqm"; + localisable_resource_file = "\\resource\\apps\\uqm"; + localisable_resource_id = R_UQM_LOCALISABLE_APP_INFO; + } diff --git a/src/symbian/uqmapp.cpp b/src/symbian/uqmapp.cpp new file mode 100644 index 0000000..86ac5dd --- /dev/null +++ b/src/symbian/uqmapp.cpp @@ -0,0 +1,308 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TUid KUidSdlApp={ 0xA000A0C3 }; + +class CSDL; + +class CSDLObserver : public CBase, public MSDLObserver +{ +public: + CSDLObserver(CSDL* aSdl); + + TInt SdlEvent(TInt aEvent, TInt aParam); + TInt SdlThreadEvent(TInt aEvent, TInt aParam); + +private: + CSDL* iSdl; +}; + +class MExitWait + { + public: + virtual void DoExit(TInt aErr) = 0; + }; + +class CExitWait : public CActive + { + public: + CExitWait(MExitWait& aWait); + void Start(); + ~CExitWait(); + private: + void RunL(); + void DoCancel(); + private: + MExitWait& iWait; + TRequestStatus* iStatusPtr; + }; + +class CSDLWin : public CCoeControl + { + public: + void ConstructL(const TRect& aRect); + RWindow& GetWindow() const; + void SetNoDraw(); + private: + void Draw(const TRect& aRect) const; + }; + +class CSdlApplication : public CAknApplication + { +private: + // from CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; + + +class CSdlAppDocument : public CAknDocument + { +public: + CSdlAppDocument(CEikApplication& aApp): CAknDocument(aApp) { } +private: + CEikAppUi* CreateAppUiL(); + }; + + +class CSdlAppUi : public CAknAppUi, public MExitWait + { +public: + void ConstructL(); + ~CSdlAppUi(); +private: + void HandleCommandL(TInt aCommand); + void DoExit(TInt aErr); + void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); + void HandleResourceChangeL(TInt aType); + void AddCmdLineParamsL(CDesC8Array& aArgs); +private: + CExitWait* iWait; + CSDLWin* iSDLWin; + CSDL* iSdl; + CSDLObserver* iSdlObserver; + TBool iExit; + }; + + +CExitWait::CExitWait(MExitWait& aWait) : CActive(CActive::EPriorityStandard), iWait(aWait) + { + CActiveScheduler::Add(this); + } + +CExitWait::~CExitWait() + { + Cancel(); + } + +void CExitWait::RunL() + { + if(iStatusPtr != NULL ) + iWait.DoExit(iStatus.Int()); + } + +void CExitWait::DoCancel() + { + if(iStatusPtr != NULL ) + User::RequestComplete(iStatusPtr , KErrCancel); + } + +void CExitWait::Start() + { + SetActive(); + iStatusPtr = &iStatus; + } + +void CSDLWin:: ConstructL(const TRect& aRect) + { + CreateWindowL(); + SetRect(aRect); + ActivateL(); + } + + +RWindow& CSDLWin::GetWindow() const + { + return Window(); + } + + +void CSDLWin::Draw(const TRect& /*aRect*/) const + { + CWindowGc& gc = SystemGc(); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetPenColor(KRgbBlack); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.SetBrushColor(0x000000); + gc.DrawRect(Rect()); + } + +void CSdlAppUi::ConstructL() + { + BaseConstructL(ENoScreenFurniture | EAppOrientationLandscape); + + iSDLWin = new (ELeave) CSDLWin; + iSDLWin->ConstructL(ApplicationRect()); + + iSdl = CSDL::NewL(CSDL::EEnableFocusStop); + iSdlObserver = new (ELeave) CSDLObserver(iSdl); + + iSdl->SetContainerWindowL( + iSDLWin->GetWindow(), + iEikonEnv->WsSession(), + *iEikonEnv->ScreenDevice()); + iSdl->SetObserver(iSdlObserver); + iSdl->DisableKeyBlocking(*this); + + iWait = new (ELeave) CExitWait(*this); + CDesC8ArrayFlat* args = new (ELeave)CDesC8ArrayFlat(10); + AddCmdLineParamsL(*args); + + iSdl->CallMainL(iWait->iStatus, *args, CSDL::ENoFlags, 81920); + delete args; + + iWait->Start(); + } + +void CSdlAppUi::HandleCommandL(TInt aCommand) + { + switch(aCommand) + { + case EAknCmdExit: + case EAknSoftkeyExit: + case EEikCmdExit: + exit(0); + break; + + default: + break; + } + } + +void CSdlAppUi::DoExit(TInt aErr) + { + delete iSdl; + iSdl = NULL; + + if(iExit) + Exit(); + } + +void CSdlAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination) + { + if(iSdl != NULL) + iSdl->AppendWsEvent(aEvent); + CAknAppUi::HandleWsEventL(aEvent, aDestination); + } + +void CSdlAppUi::HandleResourceChangeL(TInt aType) + { + CAknAppUi::HandleResourceChangeL(aType); + + if(aType == KEikDynamicLayoutVariantSwitch) + { + iSDLWin->SetRect(ApplicationRect()); + if (iSdl) + { + iSdl->SetContainerWindowL( + iSDLWin->GetWindow(), + iEikonEnv->WsSession(), + *iEikonEnv->ScreenDevice()); + } + } + } + +void CSdlAppUi::AddCmdLineParamsL(CDesC8Array& aArgs) + { + _LIT8(KAddonParam, "--addondir=?:\\uqm-addons"); + _LIT16(KTestFolder, "?:\\uqm-addons"); + RFs fs; + + fs.Connect(); + for (TInt8 c = 'e'; c < 'z'; ++c) + { + TBuf16<32> buf(KTestFolder); + buf[0] = c; + if (BaflUtils::FolderExists(fs, buf)) + { + TBuf8<32> arg(KAddonParam); + arg[11] = c; + aArgs.AppendL(arg); + break; + } + } + fs.Close(); + } + +CSdlAppUi::~CSdlAppUi() + { + if(iWait != NULL) + iWait->Cancel(); + delete iSdl; + delete iWait; + delete iSDLWin; + delete iSdlObserver; + } + +CEikAppUi* CSdlAppDocument::CreateAppUiL() + { + return new(ELeave) CSdlAppUi(); + } + +TUid CSdlApplication::AppDllUid() const + { + return KUidSdlApp; + } + + +CApaDocument* CSdlApplication::CreateDocumentL() + { + CSdlAppDocument* document = new (ELeave) CSdlAppDocument(*this); + return document; + } + +LOCAL_C CApaApplication* NewApplication() + { + return new CSdlApplication; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +CSDLObserver::CSDLObserver(CSDL* aSdl) : iSdl(aSdl) +{ +} + +TInt CSDLObserver::SdlEvent(TInt aEvent, TInt aParam) +{ + if (aEvent == EEventKeyMapInit) + { + // starmap zoom + iSdl->SetSDLCode('3', SDLK_KP_PLUS); + iSdl->SetSDLCode('2', SDLK_KP_MINUS); + + iSdl->SetSDLCode('A', SDLK_KP_PLUS); + iSdl->SetSDLCode('Z', SDLK_KP_MINUS); + + iSdl->SetSDLCode('a', SDLK_KP_PLUS); + iSdl->SetSDLCode('z', SDLK_KP_MINUS); + } + return 0; +} + +TInt CSDLObserver::SdlThreadEvent(TInt aEvent, TInt aParam) +{ + return 0; +} -- cgit v1.2.3