summaryrefslogtreecommitdiff
path: root/src/symbian
diff options
context:
space:
mode:
Diffstat (limited to 'src/symbian')
-rw-r--r--src/symbian/bld.inf9
-rw-r--r--src/symbian/config.h57
-rw-r--r--src/symbian/icons_scalable_dc.mk37
-rw-r--r--src/symbian/uqm-armv5.pkg26
-rw-r--r--src/symbian/uqm-gcce.pkg26
-rw-r--r--src/symbian/uqm.cfg26
-rw-r--r--src/symbian/uqm.mmp45
-rw-r--r--src/symbian/uqm.rss26
-rw-r--r--src/symbian/uqm.svg70
-rw-r--r--src/symbian/uqm_reg.rss12
-rw-r--r--src/symbian/uqmapp.cpp308
11 files changed, 642 insertions, 0 deletions
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
+;<source> <destination>
+"\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
+;<source> <destination>
+"\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 <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.hrh>
+#include <appinfo.rh>
+
+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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
+<g>
+ <g>
+ <path fill="#5B5F54" d="M15,5c1.44,0.56,2.44,1.56,3,3c-0.81,0.19-0.997,1.003-2,1c-0.333,0-0.667,0-1,0
+ c0.184-0.851-0.39-0.943-1-1C13.718,6.385,14.945,6.278,15,5z"/>
+ <path fill="#5B5F54" d="M13,15c-0.586,3.511,4.727,3.289,2,6c-2.323,2.416-2.677-1.562-5-2c0-0.667,0-1.333,0-2
+ C10.437,15.77,11.28,14.946,13,15z"/>
+ <path fill="#B43905" d="M5,29c0.333,0,0.667,0,1,0c0.19,0.811,1.003,0.997,1,2c1.563,3.771,4.23,6.438,8,8
+ c0.89,0.443,1.789,0.878,2,2c-4.236,0.236-5.083-2.917-8-4c0.184-0.852-0.39-0.943-1-1C7.549,33.118,4.461,32.872,5,29z"/>
+ <path fill="#03D002" d="M9,31c5.35-2.9,9.348,4.807,9,8c-4.555-0.779-5.266-5.4-9-7C9,31.667,9,31.333,9,31z"/>
+ <path fill="#5B5F54" d="M27,30c0.902,1.764,2.236,3.098,4,4c-0.238,1.428-1.646,1.688-2,3c-0.333,0-0.667,0-1,0
+ c-0.902-1.764-2.236-3.098-4-4c0.239-1.428,1.646-1.688,2-3C26.333,30,26.667,30,27,30z"/>
+ <path opacity="0" fill="#EAECE6" d="M4,14c3.582-4.418,7.582-8.418,12-12C12.418,6.418,8.418,10.418,4,14z"/>
+ <path opacity="0" fill="#FFFFFF" d="M48,0c0,16,0,32,0,48c-16,0-32,0-48,0C0,32,0,16,0,0C16,0,32,0,48,0z M4,14
+ c-0.634,3.699-2.713,5.953-2,11c4.654,0.943,6.093-6.516,10-3c-1.412,2.588-3.231,4.77-8,4c-0.664,5.33,0.582,8.751,4,10
+ c0.61,0.057,1.184,0.148,1,1c0,0.333,0,0.667,0,1c2.853,1.813,4.086,5.247,10,4c0.792-3.339,2.546-9.477,7-6
+ c-0.854,3.275-7.298,4.725-5,8c13.313,1.313,15.825-8.175,23-13c0.253-3.586-3.003-3.664-3-7C52.211,11.655,34.152-2.889,21,6
+ c-1.286-1.714-2.068-3.932-5-4C11.582,5.582,7.582,9.582,4,14z"/>
+ <path fill="#21351B" d="M4,14c4.418-3.582,8.418-7.582,12-12c2.932,0.068,3.714,2.286,5,4c13.152-8.889,31.211,5.655,20,18
+ c-0.003,3.336,3.253,3.414,3,7c-7.175,4.825-9.688,14.313-23,13c-2.298-3.275,4.146-4.725,5-8c-4.454-3.477-6.208,2.661-7,6
+ c-5.914,1.247-7.147-2.188-10-4c0-0.333,0-0.667,0-1c2.917,1.083,3.764,4.236,8,4c0.333,0,0.667,0,1,0
+ c2.208-0.125,0.425-4.242,1-6c0.89,0.615,1.789,1.208,2,0c1.313-0.354,1.573-1.762,3-2c1.764,0.902,3.098,2.236,4,4
+ c-0.797,1.072-7.094,4.348-2,5c6.992-0.341,10.803-3.863,13-9c-0.354-1.313-1.762-1.572-2-3c-3.512-0.178-3.289,3.378-6,4
+ c-1.764-0.902-3.098-2.236-4-4c1.241-2.092,2.908-3.759,5-5c-1.436,2.951-5.811,4.049-2,7c2.748-1.131,12.85-8.146,3-7
+ c1.807-3.096,3.063-0.534,7-1c3.793-2.643,2.902-15.629-2-16c-0.529-0.804-1.043-1.624-1-3c-4.564,0.435-11.012-1.011-14,1
+ c3.873,11.531-9.844,12.351-12,21c-2,0-4,0-6,0c0,0.667,0,1.333,0,2c-0.539,3.872,2.549,4.118,3,7c-3.418-1.249-4.664-4.67-4-10
+ c4.769,0.77,6.588-1.412,8-4c-3.907-3.516-5.346,3.943-10,3C1.287,19.953,3.366,17.699,4,14z M18,8c1.278,0.055,1.385,1.282,3,1
+ c1.074-3.808-3.845-6.732-6-4c-0.055,1.278-1.282,1.385-1,3C8.369,11.035,3.757,15.09,3,23c2.951,2.451,4.049-3.356,7-4
+ c2.323,0.438,2.677,4.416,5,2c2.727-2.711-2.586-2.489-2-6c2.039-0.294,1.961-2.706,4-3c0.043-1.376-0.471-2.196-1-3
+ C17.003,9.003,17.19,8.19,18,8z M21,9c-1.546,2.867-8.463,4.297-5,9C19.536,17.498,24.081,12.798,21,9z M37,28
+ c3.384-0.384,1.572,4.428,6,3C42.991,27.918,38.283,23.799,37,28z"/>
+ <path fill="#65C11B" d="M34,6c1.725,3.276,5.275,4.724,7,8c-2.754-1.913-5.088-4.246-7-7c-1.758,0.575-5.875-1.208-6,1
+ C22.684,5.654,30.9,5.834,34,6z"/>
+ <path fill="#65C11B" d="M31,8c4.893,2.441,6.87,7.797,10,12c-4.051,1.688-3.527-9.783-9-10C31.811,9.19,30.997,9.003,31,8z"/>
+ <path fill="#03D002" d="M16,9c0.529,0.804,1.043,1.624,1,3c-2.039,0.294-1.961,2.706-4,3c-1.72-0.054-2.563,0.77-3,2
+ c-2.168,1.499-2.329,5.004-6,5c1.383-6.617,7.15-8.85,11-13C15.333,9,15.667,9,16,9z"/>
+ <path fill="#038C01" d="M15,9c-3.85,4.15-9.617,6.383-11,13c3.671,0.004,3.832-3.501,6-5c0,0.667,0,1.333,0,2
+ c-2.951,0.644-4.049,6.451-7,4c0.757-7.91,5.369-11.965,11-15C14.61,8.057,15.184,8.149,15,9z"/>
+ <path opacity="0" fill="#FFFFFF" d="M16,18c-3.463-4.703,3.454-6.133,5-9C24.081,12.798,19.536,17.498,16,18z"/>
+ <path fill="#03D002" d="M38,8c4.902,0.371,5.793,13.357,2,16c-3.938,0.466-5.193-2.096-7,1c-0.333,0-0.667,0-1,0
+ c-2.092,1.241-3.759,2.908-5,5c-0.333,0-0.667,0-1,0c-0.354,1.313-1.761,1.572-2,3c-1.427,0.238-1.687,1.646-3,2
+ c-0.333,0-0.667,0-1,0c-2.573-1.762-4.318-4.35-7-6c1.167-1.834,2.614-3.387,4-5c3.401,1.891-1.712,3.506-1,6
+ c3.094-1.236,5.508-3.184,8,0c-1.317-2.684,0.114-8.114-5-7c2.849-4.484,8.209-6.458,9-13c1.333,0,2.667,0,4,0
+ c5.473,0.217,4.949,11.688,9,10c0-2,0-4,0-6c-1.725-3.276-5.275-4.724-7-8C35.764,5.714,37.098,10.709,38,8z"/>
+ <path fill="#038C01" d="M17,24c-1.386,1.613-2.833,3.166-4,5c2.682,1.65,4.427,4.238,7,6c0.333,0,0.667,0,1,0
+ c-0.211,1.208-1.11,0.615-2,0c-0.575,1.758,1.208,5.875-1,6c0-0.667,0-1.333,0-2c0.348-3.193-3.65-10.9-9-8
+ c-1.313-0.354-1.573-1.762-3-2c-0.333,0-0.667,0-1,0c0-0.667,0-1.333,0-2c2,0,4,0,6,0c2.156-8.649,15.873-9.469,12-21
+ c2.988-2.011,9.436-0.565,14-1c-0.043,1.376,0.471,2.196,1,3c-0.902,2.709-2.236-2.286-4-2c-3.1-0.166-11.316-0.346-6,2
+ c1,0,2,0,3,0c-0.003,1.003,0.811,1.19,1,2c-1.333,0-2.667,0-4,0c-0.791,6.542-6.151,8.516-9,13c-1.313-0.354-1.573-1.761-3-2
+ C15.718,22.615,16.945,22.722,17,24z"/>
+ <path fill="#E6C626" d="M19,23c5.114-1.114,3.683,4.316,5,7c-2.492-3.184-4.906-1.236-8,0c-0.712-2.494,4.401-4.109,1-6
+ c-0.055-1.278-1.282-1.385-1-3C17.427,21.239,17.687,22.646,19,23z"/>
+ <path opacity="0" fill="#FFFFFF" d="M33,25c9.85-1.146-0.252,5.869-3,7c-3.811-2.951,0.564-4.049,2-7C32.333,25,32.667,25,33,25z"
+ />
+ <path fill="#B43905" d="M43,31c-4.428,1.428-2.616-3.384-6-3C38.283,23.799,42.991,27.918,43,31z"/>
+ <path fill="#E6C626" d="M7,31c3.086,2.247,5.753,4.913,8,8C11.23,37.438,8.563,34.771,7,31z"/>
+ <path fill="#65C11B" d="M15,39c-2.247-3.087-4.914-5.753-8-8c0.003-1.003-0.81-1.189-1-2c1.427,0.238,1.687,1.646,3,2
+ c0,0.333,0,0.667,0,1c3.734,1.6,4.445,6.221,9,7c0,0.667,0,1.333,0,2c-0.333,0-0.667,0-1,0C16.789,39.878,15.89,39.443,15,39z"/>
+ <path fill="#038C01" d="M31,34c2.711-0.622,2.488-4.178,6-4c0.238,1.428,1.646,1.688,2,3c-4.995-1.393-9.604,5.531-13,9
+ c-5.094-0.652,1.203-3.928,2-5c0.333,0,0.667,0,1,0C29.354,35.688,30.762,35.428,31,34z"/>
+ <path fill="#03D002" d="M39,33c-2.197,5.137-6.008,8.659-13,9C29.396,38.531,34.005,31.607,39,33z"/>
+ <path fill="#B43905" d="M15,5c2.155-2.732,7.074,0.192,6,4c-1.615,0.282-1.722-0.945-3-1C17.44,6.56,16.44,5.56,15,5z"/>
+ <path fill="#E6C626" d="M41,14c0,2,0,4,0,6c-3.13-4.203-5.107-9.559-10-12c-1,0-2,0-3,0c0.125-2.208,4.242-0.425,6-1
+ C35.912,9.754,38.246,12.087,41,14z"/>
+ </g>
+</g>
+</svg>
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 <appinfo.rh>
+#include <uqm.rsg>
+
+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 <coecntrl.h>
+#include <aknappui.h>
+#include <aknapp.h>
+#include <akndoc.h>
+#include <sdlepocapi.h>
+#include <aknnotewrappers.h>
+#include <eikstart.h>
+#include <badesca.h>
+#include <bautils.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <SDL/SDL_keysym.h>
+
+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;
+}