aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMatthew Hoops2011-07-20 09:27:39 -0400
committerMatthew Hoops2011-07-20 09:27:39 -0400
commitad293b249e74dd1cfbdbd721d02145efbdaf9eca (patch)
treee568d96f6d7f64c5e58b4c7cd1c4fda7e649bfc7 /backends/platform
parentd7411acc2b1c7702280dbff1c3e1bafee528184b (diff)
parente25e85fbb047fef895ede97c3c2c73451631052c (diff)
downloadscummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.gz
scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.tar.bz2
scummvm-rg350-ad293b249e74dd1cfbdbd721d02145efbdaf9eca.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/android/android.cpp2
-rw-r--r--backends/platform/android/jni.cpp3
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/dcmain.cpp12
-rw-r--r--backends/platform/dc/plugins.cpp2
-rw-r--r--backends/platform/dc/selector.cpp27
-rw-r--r--backends/platform/dingux/dingux.cpp2
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp4
-rw-r--r--backends/platform/gph/devices/gp2x/mmuhack/README (renamed from backends/platform/gph/devices/gp2x/mmuhack/readme.txt)8
-rw-r--r--backends/platform/iphone/osys_main.cpp12
-rw-r--r--backends/platform/iphone/osys_main.h2
-rw-r--r--backends/platform/n64/osys_n64.h3
-rw-r--r--backends/platform/n64/osys_n64_base.cpp12
-rw-r--r--backends/platform/n64/osys_n64_events.cpp2
-rw-r--r--backends/platform/null/null.cpp14
-rwxr-xr-xbackends/platform/openpandora/build/PXML.xml83
-rw-r--r--backends/platform/openpandora/build/PXML_schema.xsd341
-rwxr-xr-xbackends/platform/openpandora/build/pnd_make.sh340
-rwxr-xr-xbackends/platform/openpandora/build/runscummvm.sh3
-rwxr-xr-xbackends/platform/openpandora/op-bundle.mk3
-rw-r--r--backends/platform/ps2/systemps2.cpp4
-rw-r--r--backends/platform/psp/cursor.cpp10
-rw-r--r--backends/platform/psp/display_client.cpp32
-rw-r--r--backends/platform/psp/display_client.h10
-rw-r--r--backends/platform/psp/display_manager.cpp10
-rw-r--r--backends/platform/psp/display_manager.h6
-rw-r--r--backends/platform/psp/dummy.cpp12
-rw-r--r--backends/platform/psp/image_viewer.cpp90
-rw-r--r--backends/platform/psp/image_viewer.h28
-rw-r--r--backends/platform/psp/input.cpp32
-rw-r--r--backends/platform/psp/input.h20
-rw-r--r--backends/platform/psp/osys_psp.cpp15
-rw-r--r--backends/platform/psp/png_loader.cpp22
-rw-r--r--backends/platform/psp/png_loader.h2
-rw-r--r--backends/platform/psp/powerman.cpp2
-rw-r--r--backends/platform/psp/rtc.cpp2
-rw-r--r--backends/platform/psp/trace.cpp36
-rwxr-xr-xbackends/platform/sdl/macosx/appmenu_osx.h32
-rwxr-xr-xbackends/platform/sdl/macosx/appmenu_osx.mm110
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp14
-rw-r--r--backends/platform/sdl/main.cpp1
-rw-r--r--backends/platform/sdl/module.mk9
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp2
-rw-r--r--backends/platform/sdl/posix/posix.cpp11
-rw-r--r--backends/platform/sdl/ps3/ps3-main.cpp49
-rw-r--r--backends/platform/sdl/ps3/ps3.cpp94
-rw-r--r--backends/platform/sdl/ps3/ps3.h47
-rw-r--r--backends/platform/sdl/sdl-sys.h25
-rw-r--r--backends/platform/sdl/sdl.cpp96
-rw-r--r--backends/platform/sdl/sdl.h8
-rw-r--r--backends/platform/sdl/win32/win32.cpp118
-rw-r--r--backends/platform/sdl/win32/win32.h2
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp4
-rw-r--r--backends/platform/wii/osystem.cpp18
-rw-r--r--backends/platform/wii/osystem.h2
-rw-r--r--backends/platform/wii/osystem_gfx.cpp1
-rw-r--r--backends/platform/wince/CEActionsPocket.cpp14
-rw-r--r--backends/platform/wince/CEActionsSmartphone.cpp14
-rw-r--r--backends/platform/wince/CELauncherDialog.cpp6
-rw-r--r--backends/platform/wince/README-WinCE.txt40
-rw-r--r--backends/platform/wince/wince-sdl.cpp109
-rw-r--r--backends/platform/wince/wince-sdl.h3
62 files changed, 1667 insertions, 372 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 90660cf82c..17c7d4f9cb 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -423,7 +423,7 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
showVirtualKeyboard(enable);
break;
case kFeatureCursorPalette:
- _use_mouse_palette = !enable;
+ _use_mouse_palette = enable;
if (!enable)
disableCursorPalette();
break;
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index c4daf24e16..e3b4ef7401 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -22,8 +22,9 @@
#if defined(__ANDROID__)
-// Allow use of stuff in <time.h>
+// Allow use of stuff in <time.h> and abort()
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_abort
// Disable printf override in common/forbidden.h to avoid
// clashes with log.h from the Android SDK.
diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index ac709f62b9..c46f9df093 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -124,7 +124,7 @@ bool RoninCDDirectoryNode::getChildren(AbstractFSList &myList, ListMode mode, bo
if (mode == Common::FSNode::kListFilesOnly)
continue;
- myList.push_back(new RoninCDDirectoryNode(newPath+"/"));
+ myList.push_back(new RoninCDDirectoryNode(newPath));
} else {
// Honor the chosen mode
if (mode == Common::FSNode::kListDirectoriesOnly)
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 3faf0185ad..06738a687d 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -234,7 +234,7 @@ void OSystem_Dreamcast::logMessage(LogMessageType::Type type, const char *messag
namespace DC_Flash {
static int syscall_info_flash(int sect, int *info)
{
- return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
+ return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
}
static int syscall_read_flash(int offs, void *buf, int cnt)
@@ -255,24 +255,24 @@ namespace DC_Flash {
}
return (unsigned short)~n;
}
-
+
static int flash_read_sector(int partition, int sec, unsigned char *dst)
{
int s, r, n, b, bmb, got=0;
int info[2];
char buf[64];
char bm[64];
-
+
if((r = syscall_info_flash(partition, info))<0)
return r;
-
+
if((r = syscall_read_flash(info[0], buf, 64))<0)
return r;
-
+
if(memcmp(buf, "KATANA_FLASH", 12) ||
buf[16] != partition || buf[17] != 0)
return -2;
-
+
n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15);
bmb = n+1;
for(b = 0; b < n; b++) {
diff --git a/backends/platform/dc/plugins.cpp b/backends/platform/dc/plugins.cpp
index fff3c147ec..2942a4f155 100644
--- a/backends/platform/dc/plugins.cpp
+++ b/backends/platform/dc/plugins.cpp
@@ -51,7 +51,7 @@ static void drawPluginProgress(const Common::String &filename)
ta_begin_frame();
draw_solid_quad(80.0, 270.0, 560.0, 300.0,
0xff808080, 0xff808080, 0xff808080, 0xff808080);
- draw_solid_quad(85.0, 275.0, 555.0, 295.0,
+ draw_solid_quad(85.0, 275.0, 555.0, 295.0,
0xff202020, 0xff202020, 0xff202020, 0xff202020);
draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0,
fcol, fcol, fcol, fcol);
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 859f2a40ed..339e5df62d 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -185,12 +185,24 @@ static void makeDefIcon(Icon &icon)
icon.load(scummvm_icon, sizeof(scummvm_icon));
}
+static bool sameOrSubdir(const char *dir1, const char *dir2)
+{
+ int l1 = strlen(dir1), l2 = strlen(dir2);
+ if (l1<=l2)
+ return !strcmp(dir1, dir2);
+ else
+ return !memcmp(dir1, dir2, l2);
+}
+
static bool uniqueGame(const char *base, const char *dir,
Common::Language lang, Common::Platform plf,
Game *games, int cnt)
{
while (cnt--)
- if (!strcmp(dir, games->dir) &&
+ if (/*Don't detect the same game in a subdir,
+ this is a workaround for the detector bug in toon... */
+ sameOrSubdir(dir, games->dir) &&
+ /*!strcmp(dir, games->dir) &&*/
!stricmp(base, games->filename_base) &&
lang == games->language &&
plf == games->platform)
@@ -237,19 +249,24 @@ static int findGames(Game *games, int max, bool use_ini)
}
while ((curr_game < max || use_ini) && curr_dir < num_dirs) {
- strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252);
- dirs[curr_dir].name[251] = '\0';
+ strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 251);
+ dirs[curr_dir].name[250] = '\0';
+ if (!dirs[curr_dir].name[0] ||
+ dirs[curr_dir].name[strlen(dirs[curr_dir].name)-1] != '/')
+ strcat(dirs[curr_dir].name, "/");
dirs[curr_dir].deficon[0] = '\0';
Common::FSList files, fslist;
dirs[curr_dir++].node.getChildren(fslist, Common::FSNode::kListAll);
for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
++entry) {
if (entry->isDirectory()) {
- if (!use_ini && num_dirs < MAX_DIR &&
- strcasecmp(entry->getDisplayName().c_str(), "install")) {
+ if (!use_ini && num_dirs < MAX_DIR) {
dirs[num_dirs].node = *entry;
num_dirs++;
}
+ /* Toonstruck detector needs directories to be present too */
+ if(!use_ini)
+ files.push_back(*entry);
} else
if (isIcon(*entry))
strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str());
diff --git a/backends/platform/dingux/dingux.cpp b/backends/platform/dingux/dingux.cpp
index 1af53aeae1..674c2ea780 100644
--- a/backends/platform/dingux/dingux.cpp
+++ b/backends/platform/dingux/dingux.cpp
@@ -33,7 +33,7 @@ void OSystem_SDL_Dingux::initBackend() {
// Create the graphics manager
if (_graphicsManager == 0) {
- _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
+ _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
}
// Call parent implementation of this method
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index db9b1c2609..03729c5e6e 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -52,7 +52,7 @@ Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &f
fileSpec += filename;
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
-
+
Common::WriteStream *stream = DS::DSFileStream::makeFromPath(fileSpec, true);
// Use a write buffer
stream = Common::wrapBufferedWriteStream(stream, SAVE_BUFFER_SIZE);
@@ -66,7 +66,7 @@ Common::InSaveFile *GBAMPSaveFileManager::openForLoading(const Common::String &f
fileSpec += filename;
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
-
+
return DS::DSFileStream::makeFromPath(fileSpec, false);
}
diff --git a/backends/platform/gph/devices/gp2x/mmuhack/readme.txt b/backends/platform/gph/devices/gp2x/mmuhack/README
index bea49d7d6d..6db7d81845 100644
--- a/backends/platform/gph/devices/gp2x/mmuhack/readme.txt
+++ b/backends/platform/gph/devices/gp2x/mmuhack/README
@@ -1,3 +1,10 @@
+PLEASE NOTE:
+
+The binary object 'mmuhack.o' is stored in the source tree as it is very awkward to
+build it manually each time and would require the use of 2 toolchains to do so.
+
+Notes on how to rebuild from the included source can be found below.
+
About
-----
@@ -107,4 +114,3 @@ Credits
Original idea/implementation: Squidge (this whole thing is also known as squidgehack)
Kernel module: NK
Documentation: notaz
-
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 9325ed50bf..4bc567c39d 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -242,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
}
+void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
void iphone_main(int argc, char *argv[]) {
//OSystem_IPHONE::migrateApp();
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 14325f8090..37896cceeb 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -180,6 +180,8 @@ public:
virtual Common::String getDefaultConfigFileName();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
protected:
void internUpdateScreen();
void dirtyFullScreen();
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index dfa8f58cce..354f25a1cf 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -107,7 +107,7 @@ protected:
// FIXME: This must be left as "int" for now, to fix the sign-comparison problem
// there is a little more work involved than an int->uint change
int _cursorWidth, _cursorHeight;
-
+
int _cursorKeycolor;
uint16 _overlayHeight, _overlayWidth;
@@ -199,6 +199,7 @@ public:
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const;
virtual void setTimerCallback(TimerProc callback, int interval);
+ virtual void logMessage(LogMessageType::Type type, const char *message);
void rebuildOffscreenGameBuffer(void);
void rebuildOffscreenMouseBuffer(void);
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 69e8da3526..4bc3780fe2 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -870,6 +870,18 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
return;
}
+void OSystem_N64::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
void OSystem_N64::setTimerCallback(TimerProc callback, int interval) {
assert (interval > 0);
diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp
index 2645cfea2a..62f11aef64 100644
--- a/backends/platform/n64/osys_n64_events.cpp
+++ b/backends/platform/n64/osys_n64_events.cpp
@@ -162,7 +162,7 @@ bool OSystem_N64::pollEvent(Common::Event &event) {
uint16 newButtons = 0;
if (_controllerPort >= 0)
newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller
-
+
uint16 newMouseButtons = 0;
if (_mousePort >= 0)
newMouseButtons = _ctrlData.c[_mousePort].buttons;
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 106cde1699..4690a67c55 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -52,6 +52,8 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
};
OSystem_NULL::OSystem_NULL() {
@@ -97,6 +99,18 @@ uint32 OSystem_NULL::getMillis() {
void OSystem_NULL::delayMillis(uint msecs) {
}
+void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
OSystem *OSystem_NULL_create() {
return new OSystem_NULL();
}
diff --git a/backends/platform/openpandora/build/PXML.xml b/backends/platform/openpandora/build/PXML.xml
index f4d2e2a595..a87c49e2b8 100755
--- a/backends/platform/openpandora/build/PXML.xml
+++ b/backends/platform/openpandora/build/PXML.xml
@@ -1,34 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<PXML xmlns="http://openpandora.org/namespaces/PXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PXML_schema.xsd">
-
- <application id="scummvm.djwillis.0001" appdata="scummvm">
-
- <title lang="en_US">ScummVM</title>
-
- <exec command="./runscummvm.sh"/>
- <icon src="icon/scummvm.png"/>
-
- <previewpics>
- <pic src="icon/preview-pic.png"/>
- </previewpics>
-
- <info name="ScummVM Documentation" type="text/html" src="docs/index.html"/>
-
- <description lang="en_US">Point & click game interpreter.</description>
-
- <author name="DJWillis" website="http://www.scummvm.org/"/>
-
- <version major="1" minor="1" release="1" build="1"/><!--This programs version-->
- <osversion major="1" minor="0" release="0" build="0"/><!--The minimum OS version required-->
-
- <categories>
- <category name="Game"><!--category like "Games", "Graphics", "Internet" etc-->
- <subcategory name="Adventure Games"/><!--subcategory, like "Board Games", "Strategy", "First Person Shooters"-->
- </category>
- </categories>
-
- <clockspeed frequency="500"/><!--Frequency in Hz-->
-
- </application>
-
+ <!-- This is the package, in our case ScummVM -->
+ <package id="scummvm.djwillis.0001">
+ <author name="DJWillis" website="http://www.scummvm.org/"/>
+ <!-- version type can be alpha, beta or release, set to release in branch -->
+ <version major="1" minor="4" release="0" build="1" type="alpha"/>
+ <!-- Both title and titles are needed -->
+ <title lang="en_US">ScummVM</title>
+ <titles>
+ <title lang="en_US">ScummVM</title>
+ </titles>
+ <descriptions>
+ <description lang="en_US">
+ ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed!
+
+ ScummVM supports many adventure games, including LucasArts SCUMM games (such as Monkey Island 1-3, Day of the Tentacle, Sam &amp; Max, ...), many of Sierra's AGI and SCI games (such as King's Quest 1-6, Space Quest 1-5, ...), Discworld 1 and 2, Simon the Sorcerer 1 and 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword 1 and 2, Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia 1-3, many of Humongous Entertainment's children's SCUMM games (including Freddi Fish and Putt Putt games) and many more.
+ </description>
+ </descriptions>
+ <icon src="icon/scummvm.png"/>
+ </package>
+
+ <!-- This is the application, the ScummVM binary -->
+ <application id="scummvm.djwillis.0001" appdata="scummvm">
+ <exec command="./runscummvm.sh"/>
+ <author name="DJWillis" website="http://www.scummvm.org/"/>
+ <!-- version type can be alpha, beta or release, set to release in branch -->
+ <version major="1" minor="4" release="0" build="1" type="alpha"/>
+ <!-- Both title and titles are needed -->
+ <title lang="en_US">ScummVM</title>
+ <titles>
+ <title lang="en_US">ScummVM</title>
+ </titles>
+ <descriptions>
+ <description lang="en_US">
+ ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed!
+
+ ScummVM supports many adventure games, including LucasArts SCUMM games (such as Monkey Island 1-3, Day of the Tentacle, Sam &amp; Max, ...), many of Sierra's AGI and SCI games (such as King's Quest 1-6, Space Quest 1-5, ...), Discworld 1 and 2, Simon the Sorcerer 1 and 2, Beneath A Steel Sky, Lure of the Temptress, Broken Sword 1 and 2, Flight of the Amazon Queen, Gobliiins 1-3, The Legend of Kyrandia 1-3, many of Humongous Entertainment's children's SCUMM games (including Freddi Fish and Putt Putt games) and many more.
+ </description>
+ </descriptions>
+ <licenses>
+ <license name="GPLv2" url="http://www.gnu.org/licenses/gpl-2.0.html" sourcecodeurl="http://www.scummvm.org"/>
+ </licenses>
+ <icon src="icon/scummvm.png"/>
+ <previewpics>
+ <pic src="icon/preview-pic.png"/>
+ </previewpics>
+ <info name="ScummVM Documentation" type="text/html" src="docs/index.html"/>
+ <categories>
+ <category name="Game">
+ <subcategory name="AdventureGame"/>
+ </category>
+ </categories>
+ </application>
</PXML>
diff --git a/backends/platform/openpandora/build/PXML_schema.xsd b/backends/platform/openpandora/build/PXML_schema.xsd
new file mode 100644
index 0000000000..335efe5002
--- /dev/null
+++ b/backends/platform/openpandora/build/PXML_schema.xsd
@@ -0,0 +1,341 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema targetNamespace="http://openpandora.org/namespaces/PXML" xmlns="http://openpandora.org/namespaces/PXML" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
+
+
+ <!-- declare some simpleTypes for later usage -->
+
+ <!-- Specify params allows with the 'x11' entry in exec -->
+ <xs:simpleType name="x11Param">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="req" />
+ <xs:enumeration value="stop" />
+ <xs:enumeration value="ignore" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Specify the valid documentation formats in the <info> block -->
+ <xs:simpleType name="docType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="text/html" />
+ <xs:enumeration value="text/plain" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Make sure that version numbers only consist of letters, numbers and + as well as - -->
+ <xs:simpleType name="versionNumber">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ <xs:pattern value="[a-zA-Z0-9+-]*" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Specify what is valid as release type -->
+ <xs:simpleType name="releaseType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="alpha" />
+ <xs:enumeration value="beta" />
+ <xs:enumeration value="release" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Specify what makes an email address "valid" -->
+ <xs:simpleType name="emailAddress">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[^@]+@[^\.]+\..+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- some restrictions regarding file names that are eg not allowed/possible when using sd cards formated as fat32 -->
+ <xs:simpleType name="dumbPath">
+ <xs:restriction base="xs:normalizedString">
+ <xs:pattern value="[^?>:]+" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="dumbFolderName">
+ <xs:restriction base="xs:normalizedString">
+ <xs:pattern value="[^?>:/]+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Specify lang codes -->
+ <xs:simpleType name="isoLangcode">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="2"/>
+ <xs:pattern value="[a-zA-Z]{2,3}(_[a-zA-Z0-9]{2,3})*" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="isoLangcode_en_US">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="en_US" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Definition of all allowed categories following the FDO specs -->
+ <xs:simpleType name="fdoCategory">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="AudioVideo|Audio|Video|Development|Education|Game|Graphics|Network|Office|Settings|System|Utility"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <!-- Definition of all allowed subcategories following the FDO specs (should be based upon the given main categories, but would significantly increase complexity of the schema) -->
+ <xs:simpleType name="fdoSubCategory">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="Building|Debugger|IDE|GUIDesigner|Profiling|RevisionControl|Translation|Calendar|ContactManagement|Database|Dictionary|Chart|Email|Finance|FlowChart|PDA|ProjectManagement|Presentation|Spreadsheet|WordProcessor|2DGraphics|VectorGraphics|RasterGraphics|3DGraphics|Scanning|OCR|Photography|Publishing|Viewer|TextTools|DesktopSettings|HardwareSettings|Printing|PackageManager|Dialup|InstantMessaging|Chat|IRCClient|FileTransfer|HamRadio|News|P2P|RemoteAccess|Telephony|TelephonyTools|VideoConference|WebBrowser|WebDevelopment|Midi|Mixer|Sequencer|Tuner|TV|AudioVideoEditing|Player|Recorder|DiscBurning|ActionGame|AdventureGame|ArcadeGame|BoardGame|BlocksGame|CardGame|KidsGame|LogicGame|RolePlaying|Simulation|SportsGame|StrategyGame|Art|Construction|Music|Languages|Science|ArtificialIntelligence|Astronomy|Biology|Chemistry|ComputerScience|DataVisualization|Economy|Electricity|Geography|Geology|Geoscience|History|ImageProcessing|Literature|Math|NumericalAnalysis|MedicalSoftware|Physics|Robotics|Sports|ParallelComputing|Amusement|Archiving|Compression|Electronics|Emulator|Engineering|FileTools|FileManager|TerminalEmulator|Filesystem|Monitor|Security|Accessibility|Calculator|Clock|TextEditor|Documentation|Core|KDE|GNOME|GTK|Qt|Motif|Java|ConsoleOnly"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <!-- Create some way to enforce entries to be nonempty -->
+ <xs:simpleType name="nonempty_token">
+ <xs:restriction base="xs:token">
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="nonempty_string">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="nonempty_normalizedString">
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+
+
+ <!-- declare some complexTypes for later usage -->
+
+ <!-- type used for file associations -->
+ <xs:complexType name="association_data">
+ <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
+ <xs:attribute name="filetype" use="required" type="nonempty_token" />
+ <xs:attribute name="exec" use="required" type="nonempty_token" />
+ </xs:complexType>
+
+ <!-- type used for author info -->
+ <xs:complexType name="author_data">
+ <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
+ <xs:attribute name="website" use="optional" type="xs:anyURI" />
+ <xs:attribute name="email" use="optional" type="emailAddress" />
+ </xs:complexType>
+
+ <!-- type used for version informations (full entry as well as os version) -->
+ <xs:complexType name="app_version_info">
+ <xs:attribute name="major" use="required" type="versionNumber" />
+ <xs:attribute name="minor" use="required" type="versionNumber" />
+ <xs:attribute name="release" use="required" type="versionNumber" />
+ <xs:attribute name="build" use="required" type="versionNumber" />
+ <xs:attribute name="type" use="optional" type="releaseType" />
+ </xs:complexType>
+ <xs:complexType name="os_version_info">
+ <xs:attribute name="major" use="required" type="versionNumber" />
+ <xs:attribute name="minor" use="required" type="versionNumber" />
+ <xs:attribute name="release" use="required" type="versionNumber" />
+ <xs:attribute name="build" use="required" type="versionNumber" />
+ </xs:complexType>
+
+ <!-- type used for exec entries -->
+ <xs:complexType name="exec_params">
+ <xs:attribute name="command" use="required" type="nonempty_token" />
+ <xs:attribute name="arguments" use="optional" type="nonempty_token" />
+ <xs:attribute name="background" use="optional" type="xs:boolean" />
+ <xs:attribute name="startdir" use="optional" type="dumbPath" />
+ <xs:attribute name="standalone" use="optional" type="xs:boolean" />
+ <xs:attribute name="x11" use="optional" type="x11Param" />
+ </xs:complexType>
+
+ <!-- type used for tiles or descriptions, once in 'normal' version, once enforcing usage of en_US -->
+ <xs:complexType name="title_or_description">
+ <xs:simpleContent>
+ <xs:extension base="nonempty_string">
+ <xs:attribute name="lang" use="required" type="isoLangcode" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="title_or_description_enUS">
+ <xs:simpleContent>
+ <xs:extension base="nonempty_string">
+ <xs:attribute name="lang" use="required" type="isoLangcode_en_US" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- type used for referencing images -->
+ <xs:complexType name="image_entry">
+ <xs:attribute name="src" use="required" type="dumbPath" />
+ </xs:complexType>
+
+ <!-- type for referencing manuals/readme docs -->
+ <xs:complexType name="information_entry">
+ <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
+ <xs:attribute name="type" use="required" type="docType" />
+ <xs:attribute name="src" use="required" type="dumbPath" />
+ </xs:complexType>
+
+ <!-- type used for the license information -->
+ <xs:complexType name="license_info">
+ <xs:attribute name="name" use="required" type="nonempty_normalizedString" />
+ <xs:attribute name="url" use="optional" type="xs:anyURI" />
+ <xs:attribute name="sourcecodeurl" use="optional" type="xs:anyURI" />
+ </xs:complexType>
+
+
+
+ <!-- Combine the symple and complex types into the "real" PXML specification -->
+
+ <xs:element name="PXML">
+ <xs:complexType>
+ <xs:sequence>
+ <!-- specify the <package> tag with info about the complete package, information providable:
+ author
+ version
+ title(s)
+ description(s)
+ icon
+ -->
+ <xs:element name="package" minOccurs="1" maxOccurs="1">
+ <xs:complexType>
+ <xs:all>
+ <!--Author info-->
+ <xs:element name="author" type="author_data" minOccurs="1" />
+ <!--App version info-->
+ <xs:element name="version" type="app_version_info" minOccurs="1" />
+ <!--Title-->
+ <xs:element name="titles" minOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
+ <xs:element name="title" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Description-->
+ <xs:element name="descriptions" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="title_or_description_enUS" minOccurs="0" maxOccurs="1" />
+ <xs:element name="description" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Icon-->
+ <xs:element name="icon" type="image_entry" minOccurs="0" />
+ </xs:all>
+ <!--Package ID-->
+ <xs:attribute name="id" use="required" type="dumbFolderName" />
+ </xs:complexType>
+ </xs:element>
+ <!-- specify the <application> tag with info about a single program
+ executable call
+ author
+ version (of the application)
+ osversion (min OS version supported)
+ title(s) (allowing compatibility to <HF6, too!)
+ description(s) (allowing compatibility to <HF6, too!)
+ icon
+ license
+ preview pictures
+ info/manual/readme entry
+ categories
+ associations to file types
+ clockspeed
+ -->
+ <xs:element name="application" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <!--Execution params -->
+ <xs:element name="exec" type="exec_params" minOccurs="1" />
+ <!--Author info-->
+ <xs:element name="author" type="author_data" minOccurs="1" />
+ <!--App version info-->
+ <xs:element name="version" type="app_version_info" minOccurs="1" />
+ <!--OS Version info-->
+ <xs:element name="osversion" type="os_version_info" minOccurs="0" />
+ <!--Title-->
+ <!-- via <titles> element, used for HF6+ -->
+ <xs:element name="titles" minOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
+ <xs:element name="title" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Title-->
+ <!-- via <title> element, only one for en_US allowed, meant for backwards compatibility with libpnd from <HF6 -->
+ <xs:element name="title" type="title_or_description_enUS" minOccurs="0" />
+ <!--Description-->
+ <!-- via <descriptions> element, used for HF6+ -->
+ <xs:element name="descriptions" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="title_or_description_enUS" minOccurs="1" maxOccurs="1" />
+ <xs:element name="description" type="title_or_description" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Description-->
+ <!-- via <description> element, only one for en_US allowed, meant for backwards compatibility with libpnd from <HF6 -->
+ <xs:element name="description" type="title_or_description_enUS" minOccurs="0" />
+ <!--Icon-->
+ <xs:element name="icon" type="image_entry" minOccurs="0" />
+ <!--License-->
+ <xs:element name="licenses" minOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="license" type="license_info" minOccurs="1" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Preview pics-->
+ <xs:element name="previewpics" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="pic" type="image_entry" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Info (aka manual or readme entry)-->
+ <xs:element name="info" type="information_entry" minOccurs="0" />
+ <!--Categories-->
+ <xs:element name="categories" minOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="category" minOccurs="1" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="subcategory" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="fdoSubCategory" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="fdoCategory" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Associations-->
+ <xs:element name="associations" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="association" type="association_data" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!--Clockspeed-->
+ <xs:element name="clockspeed" minOccurs="0">
+ <xs:complexType>
+ <xs:attribute name="frequency" use="required" type="xs:positiveInteger" />
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <!--AppID-->
+ <xs:attribute name="id" use="required" type="dumbFolderName" />
+ <xs:attribute name="appdata" use="optional" type="dumbFolderName" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/backends/platform/openpandora/build/pnd_make.sh b/backends/platform/openpandora/build/pnd_make.sh
index b19de87bb4..0c03e8154d 100755
--- a/backends/platform/openpandora/build/pnd_make.sh
+++ b/backends/platform/openpandora/build/pnd_make.sh
@@ -1,65 +1,321 @@
-#!/bin/sh
+#!/bin/bash
+#
+# pnd_make.sh
+#
+# This script is meant to ease generation of a pnd file. Please consult the output
+# when running --help for a list of available parameters and an explaination of
+# those.
+#
+# Required tools when running the script:
+# bash
+# echo, cat, mv, rm
+# mkisofs or mksquashfs (the latter when using the -c param!)
+# xmllint (optional, only for validation of the PXML against the schema)
-######adjust path of genpxml.sh if you want to use that "feture"#####
-TEMP=`getopt -o p:d:x:i:c -- "$@"`
+PXML_schema=$(dirname ${0})/PXML_schema.xsd
+GENPXML_PATH=$(dirname ${0})/genpxml.sh
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+# useful functions ...
+black='\E[30m'
+red='\E[31m'
+green='\E[32m'
+yellow='\E[33m'
+blue='\E[34m'
+magenta='\E[35m'
+cyan='\E[36m'
+white='\E[37m'
-eval set -- "$TEMP"
-while true ; do
- case "$1" in
- -p) echo "PNDNAME set to $2" ;PNDNAME=$2;shift 2;;
- -d) echo "FOLDER set to $2" ;FOLDER=$2;shift 2 ;;
- -x) echo "PXML set to $2" ;PXML=$2;shift 2 ;;
- -i) echo "ICON set to $2" ;ICON=$2;shift 2 ;;
- -c) echo "-c set, will create compressed squasfs image instead of iso $2" ;SQUASH=1;shift 1 ;;
- --) shift ; break ;;
- *) echo "Error while parsing arguments! $2" ; exit 1 ;;
- esac
+check_for_tool()
+{
+ which $1 &> /dev/null
+ if [ "$?" -ne "0" ];
+ then
+ cecho "ERROR: Could not find the program '$1'. Please make sure
+that it is available in your PATH since it is required to complete your request." $red
+ exit 1
+ fi
+}
+
+cecho () # Color-echo. Argument $1 = message, Argument $2 = color
+{
+ local default_msg="No message passed." # Doesn't really need to be a local variable.
+ message=${1:-$default_msg} # Defaults to default message.
+ color=${2:-$black} # Defaults to black, if not specified.
+ echo -e "$color$message"
+ tput sgr0 # Reset to normal.
+ return
+}
+
+
+print_help()
+{
+ cat << EOSTREAM
+pnd_make.sh - A script to package "something" into a PND.
+
+Usage:
+ $(basename ${0}) {--directory|-d} <folder> {--pndname|-p} <file> [{--compress-squashfs|-c}]
+ [{--genpxml} <file>] [{--icon|-i} <file>] [{--pxml|-x} <file>]
+ [{--schema|-s} <file>] [{--help|-h}]
+
+
+Switches:
+ --compress-squashfs / -c Define whether or not the pnd should be compressed using
+ squashfs. If this parameter is selected, a compressed pnd
+ will be created.
+
+ --directory / -d Sets the folder that is to be used for the resulting pnd
+ to <folder>. This option is mandatory for the script to
+ function correctly.
+
+ --genpxml Sets the script used for generating a PXML file (if none
+ is available already) to <file>. Please make sure to either
+ provide a full path or prefix a script in the current folder
+ with './' so that the script can actually be executed. If
+ this variable is not specified, $GENPXML_PATH
+ will be used.
+
+ --help / -h Displays this help text.
+
+ --icon / -i Sets the icon that will be appended in the pnd to <file>.
+
+ --pndname / -p Sets the output filename of the resulting pnd to <file>.
+ This option is mandatory for the script to function
+ correctly.
+
+ --pxml / -x Sets the PXML file that is to be used to <file>. If you
+ neither provide a PXML file or set this entry to 'guess',
+ an existing 'PXML.xml' in your selected '--directory'
+ will be used, or the script $GENPXML_PATH
+ will be called to try to generate a basic PXML file for you.
+
+ --schema / -s Sets the schema file, that is to be used for validation,
+ to <file. If this is not defined, the script will try to
+ use the file '$PXML_schema'. If this fails,
+ a warning is issued.
+
+If you select the option to create a compressed squashfs, a version >=4.0 of squashfs
+is required to be available in your PATH.
+EOSTREAM
+}
+
+
+# Parse command line parameters
+while [ "${1}" != "" ]; do
+ if [ "${1}" = "--compress-squashfs" ] || [ "${1}" = "-c" ];
+ then
+ SQUASH=1
+ shift 1
+ elif [ "${1}" = "--directory" ] || [ "${1}" = "-d" ];
+ then
+ FOLDER=$2
+ shift 2
+ elif [ "${1}" = "--genpxml" ];
+ then
+ GENPXML_PATH=$2
+ shift 2
+ elif [ "${1}" = "--help" ] || [ "${1}" = "-h" ];
+ then
+ print_help
+ exit 0
+ elif [ "${1}" = "--icon" ] || [ "${1}" = "-i" ];
+ then
+ ICON=$2
+ shift 2
+ elif [ "${1}" = "--pndname" ] || [ "${1}" = "-p" ];
+ then
+ PNDNAME=$2
+ shift 2
+ elif [ "${1}" = "--pxml" ] || [ "${1}" = "-x" ];
+ then
+ PXML=$2
+ shift 2
+ elif [ "${1}" = "--schema" ] || [ "${1}" = "-f" ]
+ then
+ PXML_schema=$2
+ shift 2
+ else
+ cecho "ERROR: '$1' is not a known argument. Printing --help and aborting." $red
+ print_help
+ exit 1
+ fi
done
-rnd=$RANDOM; # random number for genpxml and index$rnd.xml
-#generate pxml if guess or empty
-if [ ! $PXML ] || [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then
- PXMLtxt=$(/home/user/libpnd/pandora-libraries/testdata/scripts/genpxml.sh $FOLDER $ICON)
- PXML=$FOLDER/PXML.xml
- echo "$PXMLtxt" > $FOLDER/PXML.xml
+# Generate a PXML if the param is set to Guess or it is empty.
+if [ ! $PXML ] || [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ];
+then
+ if [ -f $FOLDER/PXML.xml ]; # use the already existing PXML.xml file if there is one...
+ then
+ PXML=$FOLDER/PXML.xml
+ PXML_ALREADY_EXISTING="true"
+ else
+ if [ -f $GENPXML_PATH ];
+ then
+ $GENPXML_PATH --src $FOLDER --dest $FOLDER --author $USER
+ if [ -f $FOLDER/PXML.xml ];
+ then
+ PXML_GENERATED="true"
+ else
+ cecho "ERROR: Generating a PXML file using '$GENPXML_PATH' failed.
+Please generate a PXML file manually." $red
+ exit 1
+ fi
+ else
+ cecho "ERROR: Could not find '$GENPXML_PATH' for generating a PXML file." $red
+ exit 1
+ fi
+ fi
fi
-#check arguments
-if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then
- echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x
- your.pxml (or \"guess\" to try to generate it from the folder) -i icon.png"
+
+# Probe if required variables were set
+echo -e
+cecho "Checking if all required variables were set." $green
+if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ];
+then
+ echo -e
+ cecho "ERROR: Not all required options were set! Please see the --help information below." $red
+ echo -e
+ print_help
exit 1
+else
+ echo "PNDNAME set to '$PNDNAME'."
+fi
+# Check if the selected folder actually exists
+if [ ! -d $FOLDER ];
+then
+ echo -e
+ cecho "ERROR: '$FOLDER' doesn't exist or is not a folder." $red
+ exit 1
+else
+ echo "FOLDER set to '$FOLDER'."
+fi
+# Check if the selected PXML file actually exists
+if [ ! -f $PXML ];
+then
+ echo -e
+ cecho "ERROR: '$PXML' doesn't exist or is not a file." $red
+ exit 1
+else
+ if [ $PXML_ALREADY_EXISTING ];
+ then
+ echo "You have not explicitly specified a PXML to use, but an existing file was
+found. Will be using this one."
+ elif [ $PXML_GENERATED ];
+ then
+ echo "A PXML file was generated for you using '$GENPXML_PATH'. This file will
+not be removed at the end of this script because you might want to review it, adjust
+single entries and rerun the script to generate a pnd with a PXML file with all the
+information you want to have listed."
+ fi
+ echo "PXML set to '$PXML'."
fi
-if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if folder actually exists
-if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists
-#make iso from folder
-if [ ! $SQUASH ]; then
- mkisofs -o $PNDNAME.iso -R $FOLDER
+# Print the other variables:
+if [ $ICON ];
+then
+ if [ ! -f $ICON ]
+ then
+ cecho "WARNING: '$ICON' doesn't exist, will not append the selected icon to the pnd." $red
+ else
+ echo "ICON set to '$ICON'."
+ USE_ICON="true"
+ fi
+fi
+if [ $SQUASH ];
+then
+ echo "Will use a squashfs for '$PNDNAME'."
+fi
+
+
+# Validate the PXML file (if xmllint is available)
+# Errors and problems in this section will be shown but are not fatal.
+echo -e
+cecho "Trying to validate '$PXML' now. Will be using '$PXML_schema' to do so." $green
+which xmllint &> /dev/null
+if [ "$?" -ne "0" ];
+then
+ VALIDATED=false
+ cecho "WARNING: Could not find 'xmllint'. Validity check of '$PXML' is not possible!" $red
else
- if [ $(mksquashfs -version | awk '{if ($3 >= 4) print 1}') = 1 ]; then
- echo "your squashfs version is older then version 4, please upgrade to 4.0 or later"
+ if [ ! -f "$PXML_schema" ];
+ then
+ VALIDATED=false
+ cecho "WARNING: Could not find '$PXML_schema'. If you want to validate your
+PXML file please make sure to provide a schema using the --schema option." $red
+ else
+ xmllint --noout --schema $PXML_schema $PXML
+ if [ "$?" -ne "0" ]; then VALIDATED=false; else VALIDATED=true; fi
+ fi
+fi
+# Print some message at the end about the validation in case the user missed the output above
+if [ $VALIDATED = "false" ]
+then
+ cecho "WARNING: Could not successfully validate '$PXML'. Please check the output
+above. This does not mean that your pnd will be broken. Either you are not following the strict
+syntax required for validation or you don't have all files/programs required for validating." $red
+else
+ cecho "Your file '$PXML' was validated successfully. The resulting pnd should
+work nicely with libpnd." $green
+fi
+
+
+# Make iso from folder
+echo -e
+cecho "Creating an iso file based on '$FOLDER'." $green
+if [ $SQUASH ];
+then
+ check_for_tool mksquashfs
+ if [ $(mksquashfs -version | awk 'BEGIN{r=0} $3>=4{r=1} END{print r}') -eq 0 ];
+ then
+ cecho "ERROR: Your squashfs version is older then version 4, please upgrade to 4.0 or later" $red
exit 1
fi
- mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso
+ mksquashfs $FOLDER $PNDNAME.iso -nopad -no-recovery
+else
+ check_for_tool mkisofs
+ mkisofs -o $PNDNAME.iso -R $FOLDER
+fi
+
+# Check that the iso file was actually created before continuing
+if [ ! -f $PNDNAME.iso ];
+then
+ cecho "ERROR: The temporary file '$PNDNAME.iso' could not be created.
+Please check the output above for any errors and retry after fixing them. Aborting." $red
+ exit 1
fi
-#append pxml to iso
-cat $PNDNAME.iso $PXML > $PNDNAME
+
+
+# Append pxml to iso
+echo -e
+cecho "Appending '$PXML' to the created iso file." $green
+cat $PNDNAME.iso $PXML > $PNDNAME
rm $PNDNAME.iso #cleanup
-#append icon if specified
-if [ $ICON ]; then # check if we want to add an icon
- if [ ! -f $ICON ]; then #does the icon actually exist?
- echo "$ICON doesnt exist"
- else # yes
+
+# Append icon if specified and available
+if [ $USE_ICON ];
+then
+ echo -e
+ cecho "Appending the icon '$ICON' to the pnd." $green
mv $PNDNAME $PNDNAME.tmp
cat $PNDNAME.tmp $ICON > $PNDNAME # append icon
rm $PNDNAME.tmp #cleanup
- fi
fi
-if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup
+
+# Final message
+echo -e
+if [ -f $PNDNAME ];
+then
+ cecho "Successfully finished creating the pnd '$PNDNAME'." $green
+else
+ cecho "There seems to have been a problem and '$PNDNAME' was not created. Please check
+the output above for any error messages. A possible cause for this is that there was
+not enough space available." $red
+ exit 1
+fi
+
+
+#if [ $PXML = "guess" ];then rm $FOLDER/PXML.xml; fi #cleanup
diff --git a/backends/platform/openpandora/build/runscummvm.sh b/backends/platform/openpandora/build/runscummvm.sh
index 48d24a2b81..c641235219 100755
--- a/backends/platform/openpandora/build/runscummvm.sh
+++ b/backends/platform/openpandora/build/runscummvm.sh
@@ -11,4 +11,5 @@ mkdir saves
mkdir runtime
cd runtime
-../bin/scummvm --fullscreen --gfx-mode=2x --config=../scummvm.config
+../bin/scummvm --fullscreen --gfx-mode=2x --config=../scummvm.config --themepath=../data
+
diff --git a/backends/platform/openpandora/op-bundle.mk b/backends/platform/openpandora/op-bundle.mk
index 163f4711ce..089430f43c 100755
--- a/backends/platform/openpandora/op-bundle.mk
+++ b/backends/platform/openpandora/op-bundle.mk
@@ -75,11 +75,10 @@ endif
$(CP) $(libloc)/../arm-angstrom-linux-gnueabi/usr/lib/libFLAC.so.8.2.0 $(bundle_name)/scummvm/lib/libFLAC.so.8
- $(srcdir)/backends/platform/openpandora/build/pnd_make.sh -p $(bundle_name).pnd -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
+ $(srcdir)/backends/platform/openpandora/build/pnd_make.sh -p $(bundle_name).pnd -c -d $(bundle_name)/scummvm -x $(bundle_name)/scummvm/data/PXML.xml -i $(bundle_name)/scummvm/icon/scummvm.png
$(CP) $(srcdir)/backends/platform/openpandora/build/README-PND.txt $(bundle_name)
tar -cvjf $(bundle_name)-pnd.tar.bz2 $(bundle_name).pnd $(bundle_name)/README-PND.txt
rm -R ./$(bundle_name)
-# rm $(bundle_name).pnd
.PHONY: op-bundle op-pnd
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index d3acd06089..c75d7493a2 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -66,7 +66,7 @@
#include "engines/engine.h"
-#include "graphics/font.h"
+#include "graphics/fonts/bdf.h"
#include "graphics/surface.h"
#include "icon.h"
@@ -96,7 +96,7 @@ OSystem_PS2 *g_systemPs2;
#define FOREVER 2147483647
namespace Graphics {
- extern const NewFont g_sysfont;
+ extern const BdfFont g_sysfont;
};
PS2Device detectBootPath(const char *elfPath, char *bootPath);
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp
index 18a61f3df4..b295507de1 100644
--- a/backends/platform/psp/cursor.cpp
+++ b/backends/platform/psp/cursor.cpp
@@ -324,18 +324,18 @@ inline void Cursor::setRendererModePalettized(bool palettized) {
_renderer.setAlphaReverse(false);
_renderer.setColorTest(false);
} else { // 16 bits, no palette
- // Color test is an easy way for the hardware to make our keycolor
+ // Color test is an easy way for the hardware to make our keycolor
// transparent.
- _renderer.setColorTest(true);
-
+ _renderer.setColorTest(true);
+
// Alpha blending is not strictly required, but makes the cursor look
// much better
_renderer.setAlphaBlending(true);
-
+
// Pixel formats without alpha (5650) are considered to have their alpha set.
// Since pixel formats with alpha don't have their alpha bits set, we reverse
// the alpha format for them so that 0 alpha is 1.
- if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
+ if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
_renderer.setAlphaReverse(true);
else
_renderer.setAlphaReverse(false);
diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp
index 14b96d9cae..bc29166895 100644
--- a/backends/platform/psp/display_client.cpp
+++ b/backends/platform/psp/display_client.cpp
@@ -389,31 +389,31 @@ void Buffer::copyToArray(byte *dst, int pitch) {
void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kSizeByTextureSize*/) {
DEBUG_ENTER_FUNC();
-
+
// We can size the buffer either by texture size (multiple of 2^n) or source size.
// At higher sizes, increasing the texture size to 2^n is a waste of space. At these sizes kSizeBySourceSize should be used.
-
+
_sourceSize.width = width;
_sourceSize.height = height;
_textureSize.width = scaleUpToPowerOfTwo(width); // can only scale up to 512
_textureSize.height = scaleUpToPowerOfTwo(height);
-
+
if (textureOrSource == kSizeByTextureSize) {
_width = _textureSize.width;
_height = _textureSize.height;
} else { // sizeBySourceSize
_width = _sourceSize.width;
_height = _sourceSize.height;
-
- // adjust allocated width to be divisible by 32.
+
+ // adjust allocated width to be divisible by 32.
// The GU can only handle multiples of 16 bytes. A 4 bit image x 32 will give us 16 bytes
// We don't necessarily know the depth of the pixels here. So just make it divisible by 32.
uint32 checkDiv = _width & 31;
if (checkDiv)
_width += 32 - checkDiv;
}
-
+
PSP_DEBUG_PRINT("width[%u], height[%u], texW[%u], texH[%u], sourceW[%d], sourceH[%d] %s\n", _width, _height, _textureSize.width, _textureSize.height, _sourceSize.width, _sourceSize.height, textureOrSource ? "size by source" : "size by texture");
}
@@ -558,10 +558,10 @@ void GuRenderer::render() {
// Loop over patches of 512x512 pixel textures and draw them
for (uint32 j = 0; j < _buffer->getSourceHeight(); j += 512) {
_textureLoadOffset.y = j;
-
+
for (uint32 i = 0; i < _buffer->getSourceWidth(); i += 512) {
_textureLoadOffset.x = i;
-
+
guLoadTexture();
Vertex *vertices = guGetVertices();
fillVertices(vertices);
@@ -573,8 +573,8 @@ void GuRenderer::render() {
inline void GuRenderer::guProgramDrawBehavior() {
DEBUG_ENTER_FUNC();
- PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
- _blending ? "on" : "off", _colorTest ? "on" : "off",
+ PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
+ _blending ? "on" : "off", _colorTest ? "on" : "off",
_alphaReverse ? "on" : "off", _keyColor);
if (_blending) {
@@ -591,7 +591,7 @@ inline void GuRenderer::guProgramDrawBehavior() {
if (_colorTest) {
sceGuEnable(GU_COLOR_TEST);
sceGuColorFunc(GU_NOTEQUAL, // show only colors not equal to this color
- _keyColor,
+ _keyColor,
0x00ffffff); // match everything but alpha
} else
sceGuDisable(GU_COLOR_TEST);
@@ -663,10 +663,10 @@ inline void GuRenderer::guLoadTexture() {
byte *startPoint = _buffer->getPixels();
if (_textureLoadOffset.x)
startPoint += _buffer->_pixelFormat.pixelsToBytes(_textureLoadOffset.x);
- if (_textureLoadOffset.y)
+ if (_textureLoadOffset.y)
startPoint += _buffer->getWidthInBytes() * _textureLoadOffset.y;
-
- sceGuTexImage(0,
+
+ sceGuTexImage(0,
_buffer->getTextureWidth(), // texture width (must be power of 2)
_buffer->getTextureHeight(), // texture height (must be power of 2)
_buffer->getWidth(), // width of a line of the image (to get to the next line)
@@ -698,7 +698,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
// These coordinates describe an area within the texture. ie. we already loaded a square of texture,
// now the coordinates within it are 0 to the edge of the area of the texture we want to draw
float textureStartX = textureFix + _offsetInBuffer.x;
- float textureStartY = textureFix + _offsetInBuffer.y;
+ float textureStartY = textureFix + _offsetInBuffer.y;
int textureLeftX = _drawSize.width - _textureLoadOffset.x;
if (textureLeftX > 512)
@@ -720,7 +720,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
float imageStartY = gapY + scaledOffsetOnScreenY + (scaleSourceToOutput(false, stretch(false, _textureLoadOffset.y)));
float imageEndX, imageEndY;
-
+
imageEndX = imageStartX + scaleSourceToOutput(true, stretch(true, textureLeftX));
imageEndY = imageStartY + scaleSourceToOutput(false, stretch(false, textureLeftY));
diff --git a/backends/platform/psp/display_client.h b/backends/platform/psp/display_client.h
index f190658a26..e384bfb82b 100644
--- a/backends/platform/psp/display_client.h
+++ b/backends/platform/psp/display_client.h
@@ -171,12 +171,12 @@ protected:
class GuRenderer {
public:
// Constructors
- GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
- _blending(false), _alphaReverse(false), _colorTest(false),
+ GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
+ _blending(false), _alphaReverse(false), _colorTest(false),
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
- GuRenderer(Buffer *buffer, Palette *palette) :
- _useGlobalScaler(false), _buffer(buffer), _palette(palette),
- _blending(false), _alphaReverse(false), _colorTest(false),
+ GuRenderer(Buffer *buffer, Palette *palette) :
+ _useGlobalScaler(false), _buffer(buffer), _palette(palette),
+ _blending(false), _alphaReverse(false), _colorTest(false),
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
static void setDisplayManager(DisplayManager *dm) { _displayManager = dm; } // Called by the Display Manager
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 899b79727f..422805714f 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -62,7 +62,9 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
// Class VramAllocator -----------------------------------
+namespace Common {
DECLARE_SINGLETON(VramAllocator);
+}
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
//#define __PSP_DEBUG_PRINT__
@@ -299,7 +301,7 @@ void DisplayManager::init() {
#endif
// Init overlay since we never change the size
- _overlay->deallocate();
+ _overlay->deallocate();
_overlay->setBytesPerPixel(sizeof(OverlayColor));
_overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
_overlay->allocate();
@@ -432,13 +434,13 @@ bool DisplayManager::renderAll() {
_screen->render();
_screen->setClean(); // clean out dirty bit
-
+
if (_imageViewer->isVisible())
_imageViewer->render();
_imageViewer->setClean();
if (_overlay->isVisible())
- _overlay->render();
+ _overlay->render();
_overlay->setClean();
if (_cursor->isVisible())
@@ -448,7 +450,7 @@ bool DisplayManager::renderAll() {
if (_keyboard->isVisible())
_keyboard->render();
_keyboard->setClean();
-
+
_masterGuRenderer.guPostRender();
return true; // rendered successfully
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index 5176bee3fe..38c43d60a3 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -72,7 +72,7 @@ private:
*/
class MasterGuRenderer : public PspThreadable {
public:
- MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
+ MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
_renderSema(1, 1), _callbackId(-1) {}
void guInit();
void guPreRender();
@@ -108,7 +108,7 @@ public:
KEEP_ASPECT_RATIO,
STRETCHED_FULL_SCREEN
};
- DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
+ DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
~DisplayManager();
@@ -127,7 +127,7 @@ public:
void setOverlay(Overlay *overlay) { _overlay = overlay; }
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }
-
+
void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format);
// Getters
diff --git a/backends/platform/psp/dummy.cpp b/backends/platform/psp/dummy.cpp
index 86ab30b3e2..748ac8cbf3 100644
--- a/backends/platform/psp/dummy.cpp
+++ b/backends/platform/psp/dummy.cpp
@@ -26,31 +26,31 @@
#include <stdio.h>
#include <png.h>
#include <sys/socket.h>
-
+
//void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) {
//}
//void userFlushFn(png_structp png_ptr) {
//}
-
+
// Dummy functions are pulled in so that we don't need to build the plugins with certain libs
-
+
int dummyFunc() {
// For Broken Sword 2.5
volatile int i;
i = clock();
rename("dummyA", "dummyB");
-
+
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_set_write_fn(png_ptr, NULL, NULL, NULL);
png_infop info_ptr;
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
-
+
// For lua's usage of libc: very heavy usage so it pulls in sockets?
setsockopt(0, 0, 0, NULL, 0);
getsockopt(0, 0, 0, NULL, NULL);
-
+
return i;
} \ No newline at end of file
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp
index 97d582b63a..1ed7698bc8 100644
--- a/backends/platform/psp/image_viewer.cpp
+++ b/backends/platform/psp/image_viewer.cpp
@@ -34,45 +34,45 @@
#include "backends/platform/psp/input.h"
#include "backends/platform/psp/display_manager.h"
#include "backends/platform/psp/display_client.h"
-#include "backends/platform/psp/image_viewer.h"
-#include "backends/platform/psp/png_loader.h"
+#include "backends/platform/psp/image_viewer.h"
+#include "backends/platform/psp/png_loader.h"
#include "backends/platform/psp/thread.h"
static const char *imageName = "psp_image";
#define PSP_SCREEN_HEIGHT 272
#define PSP_SCREEN_WIDTH 480
-
+
bool ImageViewer::load(int imageNum) {
if (_init)
unload();
-
+
// build string
char number[8];
sprintf(number, "%d", imageNum);
- Common::String imageNameStr(imageName);
+ Common::String imageNameStr(imageName);
Common::String specificImageName = imageNameStr + Common::String(number) + Common::String(".png");
-
+
// search for image file
if (!SearchMan.hasFile(specificImageName)) {
PSP_ERROR("file %s not found\n", specificImageName.c_str());
return false;
}
-
+
Common::ScopedPtr<Common::SeekableReadStream> file(SearchMan.createReadStreamForMember(specificImageName));
-
+
_buffer = new Buffer();
_palette = new Palette();
_renderer = new GuRenderer();
-
+
assert(_buffer);
assert(_palette);
assert(_renderer);
-
+
// Load a PNG into our buffer and palette. Size it by the actual size of the image
PngLoader image(file, *_buffer, *_palette, Buffer::kSizeBySourceSize);
-
+
PngLoader::Status status = image.allocate(); // allocate the buffers for the file
-
+
char error[100];
if (status == PngLoader::BAD_FILE) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
@@ -89,29 +89,29 @@ bool ImageViewer::load(int imageNum) {
if (!image.load()) {
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
GUI::TimedMessageDialog dialog(error, 4000);
- dialog.runModal();
+ dialog.runModal();
return false;
}
-
+
setConstantRendererOptions();
setFullScreenImageParams(); // prepare renderer for full screen view
-
+
_imageNum = imageNum; // now we can say we displayed this image
_init = true;
-
+
return true;
}
void ImageViewer::setConstantRendererOptions() {
_renderer->setBuffer(_buffer);
_renderer->setPalette(_palette);
-
+
_renderer->setAlphaBlending(false);
_renderer->setColorTest(false);
_renderer->setUseGlobalScaler(false);
_renderer->setStretch(true);
_renderer->setOffsetInBuffer(0, 0);
- _renderer->setDrawWholeBuffer();
+ _renderer->setDrawWholeBuffer();
}
void ImageViewer::unload() {
@@ -130,32 +130,32 @@ void ImageViewer::resetOnEngineDone() {
void ImageViewer::setVisible(bool visible) {
DEBUG_ENTER_FUNC();
-
+
if (_visible == visible)
return;
-
+
// from here on, we're making the loader visible
if (visible && g_engine) { // we can only run the image viewer when there's an engine
g_engine->pauseEngine(true);
-
+
load(_imageNum ? _imageNum : 1); // load the 1st image or the current
}
if (visible && _init) { // we managed to load
_visible = true;
setViewerButtons(true);
-
+
{ // so dialog goes out of scope, destroying all allocations
GUI::TimedMessageDialog dialog("Image Viewer", 1000);
dialog.runModal();
}
-
+
runLoop(); // only listen to viewer events
} else { // we were asked to make invisible or failed to load
_visible = false;
unload();
setViewerButtons(false);
-
+
if (g_engine && g_engine->isPaused())
g_engine->pauseEngine(false);
}
@@ -175,7 +175,7 @@ void ImageViewer::runLoop() {
void ImageViewer::setViewerButtons(bool active) {
_inputHandler->setImageViewerMode(active);
-}
+}
void ImageViewer::loadNextImage() {
if (!load(_imageNum+1)) { // try to load the next image
@@ -190,21 +190,21 @@ void ImageViewer::loadLastImage() {
if (!load(_imageNum-1))
if (!load(_imageNum))
setVisible(false); // we can't even show the old image so hide
- }
+ }
setDirty();
}
void ImageViewer::setFullScreenImageParams() {
// we try to fit the image fullscreen at least in one dimension
uint32 width = _buffer->getSourceWidth();
- uint32 height = _buffer->getSourceHeight();
+ uint32 height = _buffer->getSourceHeight();
_centerX = PSP_SCREEN_WIDTH / 2.0f;
_centerY = PSP_SCREEN_HEIGHT / 2.0f;
-
+
// see if we fit width wise
if (PSP_SCREEN_HEIGHT >= (int)((height * PSP_SCREEN_WIDTH) / (float)width)) {
- setZoom(PSP_SCREEN_WIDTH / (float)width);
+ setZoom(PSP_SCREEN_WIDTH / (float)width);
} else {
setZoom(PSP_SCREEN_HEIGHT / (float)height);
}
@@ -233,32 +233,32 @@ void ImageViewer::render() {
break;
}
_renderer->render();
- }
+ }
}
void ImageViewer::modifyZoom(bool up) {
float factor = _zoomFactor;
- if (up)
+ if (up)
factor += 0.1f;
else // down
factor -= 0.1f;
-
- setZoom(factor);
+
+ setZoom(factor);
}
-void ImageViewer::setZoom(float value) {
+void ImageViewer::setZoom(float value) {
if (value <= 0.0f) // don't want 0 or negative zoom
return;
_zoomFactor = value;
- _renderer->setStretchXY(value, value);
+ _renderer->setStretchXY(value, value);
setOffsetParams();
}
void ImageViewer::moveImageX(float val) {
float newVal = _centerX + val;
-
- if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
+
+ if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
return;
_centerX = newVal;
setOffsetParams();
@@ -266,22 +266,22 @@ void ImageViewer::moveImageX(float val) {
void ImageViewer::moveImageY(float val) {
float newVal = _centerY + val;
-
- if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
+
+ if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
return;
_centerY = newVal;
setOffsetParams();
}
-// Set the renderer with the proper offset on the screen
+// Set the renderer with the proper offset on the screen
//
void ImageViewer::setOffsetParams() {
_visibleWidth = _zoomFactor * _buffer->getSourceWidth();
- _visibleHeight = _zoomFactor * _buffer->getSourceHeight();
-
+ _visibleHeight = _zoomFactor * _buffer->getSourceHeight();
+
int offsetX = _centerX - (int)(_visibleWidth * 0.5f);
int offsetY = _centerY - (int)(_visibleHeight * 0.5f);
-
+
_renderer->setOffsetOnScreen(offsetX, offsetY);
setDirty();
}
@@ -290,8 +290,8 @@ void ImageViewer::setOffsetParams() {
//
void ImageViewer::handleEvent(uint32 event) {
DEBUG_ENTER_FUNC();
-
- switch (event) {
+
+ switch (event) {
case EVENT_HIDE:
setVisible(false);
break;
diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h
index 4c3eaf7b4a..ad188536a3 100644
--- a/backends/platform/psp/image_viewer.h
+++ b/backends/platform/psp/image_viewer.h
@@ -54,10 +54,10 @@ private:
float _visibleHeight, _visibleWidth;
float _centerX, _centerY;
Event _movement;
-
+
InputHandler *_inputHandler;
DisplayManager *_displayManager;
-
+
void setFullScreenImageParams();
void loadNextImage();
void loadLastImage();
@@ -66,19 +66,19 @@ private:
void moveImageX(float val);
void moveImageY(float val);
bool load(int imageNum);
- void unload();
+ void unload();
void runLoop(); // to get total pausing we have to do our own loop
-
+
void setZoom(float value);
void setOffsetParams();
void modifyZoom(bool up); // up or down
void setVisible(bool visible);
-
+
public:
- ImageViewer() : _buffer(0), _palette(0), _visible(false),
- _dirty(false), _init(false), _imageNum(0),
- _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
+ ImageViewer() : _buffer(0), _palette(0), _visible(false),
+ _dirty(false), _init(false), _imageNum(0),
+ _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
_centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP),
_inputHandler(0), _displayManager(0) {}
~ImageViewer() { unload(); } // deallocate images
@@ -88,15 +88,15 @@ public:
bool isDirty() { return _dirty; }
void setDirty() { _dirty = true; }
void setClean() { if (!_visible) // otherwise we want to keep rendering
- _dirty = false;
- }
+ _dirty = false;
+ }
void resetOnEngineDone();
-
+
void handleEvent(uint32 event);
-
+
// pointer setters
- void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
+ void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; }
};
-#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file
+#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 17f8954e3b..a9ad441b4d 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -198,7 +198,7 @@ bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &
uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
if (_combosEnabled)
- modifyButtonsForCombos(pad); // change buttons for combos
+ modifyButtonsForCombos(pad); // change buttons for combos
return getEventFromButtonState(event, pspEvent, curButtonState);
}
@@ -460,7 +460,7 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
/*case PSP_EVENT_CHANGE_SPEED:
handleSpeedChange(pspEvent.data);
break;*/
- case PSP_EVENT_IMAGE_VIEWER:
+ case PSP_EVENT_IMAGE_VIEWER:
_imageViewer->handleEvent(pspEvent.data);
break;
case PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS:
@@ -530,7 +530,7 @@ void InputHandler::setImageViewerMode(bool active) {
_nub.init();
_buttonPad.enableCombos(true); // re-enable combos
_buttonPad.initButtons();
- }
+ }
}
void InputHandler::setButtonsForImageViewer() {
@@ -538,32 +538,32 @@ void InputHandler::setButtonsForImageViewer() {
// Dpad
_buttonPad.clearButtons();
- _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
+ _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
+ PSP_EVENT_NONE, false);
+ _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
+ _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
+ _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
- PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
- _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
+ _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
PSP_EVENT_NONE, false);
//Nub
_nub.getPad().clearButtons();
- _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
+ _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
+ _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
+ _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
- _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
+ _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
}
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index 8315a3766c..ef2e1b84a4 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -122,16 +122,16 @@ public:
ButtonPad();
void initButtons(); // set the buttons to the mode that's selected
void clearButtons(); // empty the buttons of all events
-
+
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState);
-
+
void setShifted(ShiftMode shifted) { _shifted = shifted; }
void setPadMode(PspPadMode mode) { _padMode = mode; }
bool isButtonDown() { return _prevButtonState; }
-
+
void enableCombos(bool value) { _combosEnabled = value; }
- Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
+ Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
};
class Nub {
@@ -140,17 +140,17 @@ private:
ShiftMode _shifted;
bool _dpadMode;
-
+
ButtonPad _buttonPad; // private buttonpad for dpad mode
-
+
int32 modifyNubAxisMotion(int32 input);
void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
public:
Nub() : _shifted(UNSHIFTED), _dpadMode(false) { }
- void init() { _buttonPad.initButtons(); }
+ void init() { _buttonPad.initButtons(); }
void setCursor(Cursor *cursor) { _cursor = cursor; }
-
+
// setters
void setDpadMode(bool active) { _dpadMode = active; }
void setShifted(ShiftMode shifted) { _shifted = shifted; }
@@ -163,7 +163,7 @@ public:
class InputHandler {
public:
- InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
+ InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
_lastPadCheckTime(0) {}
// pointer setters
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
@@ -175,7 +175,7 @@ public:
void setImageViewerMode(bool active);
private:
- Nub _nub;
+ Nub _nub;
ButtonPad _buttonPad;
// Pointers to relevant other classes
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 01124b420e..5fa5110684 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -20,8 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <pspuser.h>
#include <pspgu.h>
@@ -84,7 +83,7 @@ void OSystem_PSP::initBackend() {
_inputHandler.setKeyboard(&_keyboard);
_inputHandler.setImageViewer(&_imageViewer);
_inputHandler.init();
-
+
// Set pointers for image viewer
_imageViewer.setInputHandler(&_inputHandler);
_imageViewer.setDisplayManager(&_displayManager);
@@ -422,7 +421,15 @@ void OSystem_PSP::quit() {
}
void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) {
- EventsBaseBackend::logMessage(type, message);
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
if (type == LogMessageType::kError)
PspDebugTrace(false, "%s", message); // write to file
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 2f4857569e..16377539c8 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -36,7 +36,7 @@
PngLoader::Status PngLoader::allocate() {
DEBUG_ENTER_FUNC();
-
+
if (!findImageDimensions()) {
PSP_ERROR("failed to get image dimensions\n");
return BAD_FILE;
@@ -45,7 +45,7 @@ PngLoader::Status PngLoader::allocate() {
_buffer->setSize(_width, _height, _sizeBy);
uint32 bitsPerPixel = _bitDepth * _channels;
-
+
if (_paletteSize) { // 8 or 4-bit image
if (bitsPerPixel == 4) {
_buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
@@ -130,7 +130,7 @@ bool PngLoader::basicImageLoad() {
png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
&_colorType, &interlaceType, int_p_NULL, int_p_NULL);
_channels = png_get_channels(_pngPtr, _infoPtr);
-
+
if (_colorType & PNG_COLOR_MASK_PALETTE)
_paletteSize = _infoPtr->num_palette;
@@ -141,7 +141,7 @@ bool PngLoader::basicImageLoad() {
bool PngLoader::findImageDimensions() {
DEBUG_ENTER_FUNC();
- bool status = basicImageLoad();
+ bool status = basicImageLoad();
PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
@@ -157,7 +157,7 @@ bool PngLoader::loadImageIntoBuffer() {
if (!basicImageLoad()) {
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
return false;
- }
+ }
png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur
if (_paletteSize) {
@@ -178,16 +178,16 @@ bool PngLoader::loadImageIntoBuffer() {
}
uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr);
-
- // there seems to be a bug in libpng where it doesn't increase the rowbytes or the
+
+ // there seems to be a bug in libpng where it doesn't increase the rowbytes or the
// channel even after we add the alpha channel
if (_channels == 3 && (rowBytes / _width) == 3) {
_channels = 4;
- rowBytes = _width * _channels;
- }
-
+ rowBytes = _width * _channels;
+ }
+
PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, _channels);
-
+
unsigned char *line = (unsigned char*) malloc(rowBytes);
if (!line) {
png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h
index 616a79405e..0ff9d8a65d 100644
--- a/backends/platform/psp/png_loader.h
+++ b/backends/platform/psp/png_loader.h
@@ -61,7 +61,7 @@ public:
Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
_file(file), _buffer(&buffer), _palette(&palette),
_width(0), _height(0), _paletteSize(0),
- _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
+ _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
_infoPtr(0), _colorType(0), _channels(0) {}
PngLoader::Status allocate();
diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp
index fe9dcfa673..b72d05809d 100644
--- a/backends/platform/psp/powerman.cpp
+++ b/backends/platform/psp/powerman.cpp
@@ -30,7 +30,9 @@
//#define __PSP_DEBUG_PRINT__
#include "backends/platform/psp/trace.h"
+namespace Common {
DECLARE_SINGLETON(PowerManager);
+}
// Function to debug the Power Manager (we have no output to screen)
inline void PowerManager::debugPM() {
diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp
index 3d6d4295a6..6c8e919986 100644
--- a/backends/platform/psp/rtc.cpp
+++ b/backends/platform/psp/rtc.cpp
@@ -34,7 +34,9 @@
// Class PspRtc ---------------------------------------------------------------
+namespace Common {
DECLARE_SINGLETON(PspRtc);
+}
void PspRtc::init() { // init our starting ticks
uint32 ticks[2];
diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp
index 373e00415b..b799b4e870 100644
--- a/backends/platform/psp/trace.cpp
+++ b/backends/platform/psp/trace.cpp
@@ -75,38 +75,38 @@ void PspDebugTrace(bool alsoToScreen, const char *format, ...) {
#define GET_RET(retAddr) \
asm volatile ("move %0,$ra\n\t" \
: "=&r" (retAddr) : )
-
+
#define GET_SP(stackPtr) \
asm volatile ("move %0,$sp\n\t" \
: "=&r" (stackPtr) : )
// Function to retrieve a backtrace for the MIPS processor
-// This is not trivial since the MIPS doesn't use a frame pointer.
+// This is not trivial since the MIPS doesn't use a frame pointer.
// Takes the number of levels wanted above the calling function (included) and an array of void *
-//
+//
void mipsBacktrace(uint32 levels, void **addresses) {
- // get the current return address
+ // get the current return address
register byte *retAddr;
register byte *stackPointer;
- GET_RET(retAddr);
+ GET_RET(retAddr);
GET_SP(stackPointer);
char string[100];
-
+
if (!levels)
return;
-
+
memset(addresses, 0, sizeof(void *) * levels);
-
+
uint32 curLevel = 0;
-
+
const uint32 SP_SUBTRACT = 0x27bd8000; // The instruction to subtract from the SP looks like this
const uint32 SP_SUB_HIGH_MASK = 0xffff8000; // The mask to check for the subtract SP instruction
const uint32 SP_SUB_LOW_MASK = 0x0000ffff; // The mask that gives us how much was subtracted
-
+
// make sure we go out of the stack of this current level
// we already have the return address for this level from the register
if (curLevel < levels) {
- void *thisFunc = (void *)mipsBacktrace;
+ void *thisFunc = (void *)mipsBacktrace;
for (uint32 *seekPtr = (uint32 *)thisFunc; ; seekPtr++) {
if ((*seekPtr & SP_SUB_HIGH_MASK) == SP_SUBTRACT) {
// we found the $sp subtraction at the beginning of the function
@@ -120,10 +120,10 @@ void mipsBacktrace(uint32 levels, void **addresses) {
fputs(string, stderr);
}
break;
- }
- }
+ }
+ }
}
-
+
// keep scanning while more levels are requested
while (curLevel < levels) {
// now scan backwards from the return address to find the size of the stack
@@ -139,13 +139,13 @@ void mipsBacktrace(uint32 levels, void **addresses) {
sprintf(string, "invalid retAddr %p\n", retAddr);
fputs(string, stderr);
return;
- }
+ }
//sprintf(string, "retAddr[%p]\n", retAddr);
//fputs(string, stderr);
addresses[curLevel++] = retAddr;
break;
- }
- }
+ }
+ }
}
-}
+}
diff --git a/backends/platform/sdl/macosx/appmenu_osx.h b/backends/platform/sdl/macosx/appmenu_osx.h
new file mode 100755
index 0000000000..005414b789
--- /dev/null
+++ b/backends/platform/sdl/macosx/appmenu_osx.h
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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 APPMENU_OSX_H
+#define APPMENU_OSX_H
+
+#if defined(MACOSX)
+
+void replaceApplicationMenuItems();
+
+#endif // MACOSX
+
+#endif
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
new file mode 100755
index 0000000000..bb089a6b61
--- /dev/null
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "backends/platform/sdl/macosx/appmenu_osx.h"
+#include "common/translation.h"
+
+#include <Cocoa/Cocoa.h>
+
+// Apple removed setAppleMenu from the header files in 10.4,
+// but as the method still exists we declare it ourselves here.
+// Yes, this works :)
+@interface NSApplication(MissingFunction)
+- (void)setAppleMenu:(NSMenu *)menu;
+@end
+
+void replaceApplicationMenuItems() {
+
+ // Code mainly copied and adapted from SDLmain.m
+ NSMenu *appleMenu;
+ NSMenu *windowMenu;
+ NSMenuItem *menuItem;
+
+ // For some reason [[NSApp mainMenu] removeAllItems] doesn't work and crashes, so we need
+ // to remove the SDL generated menus one by one
+ [[NSApp mainMenu] removeItemAtIndex:0]; // Remove application menu
+ [[NSApp mainMenu] removeItemAtIndex:0]; // Remove "Windows" menu
+
+ // Create new application menu
+ appleMenu = [[NSMenu alloc] initWithTitle:@""];
+
+ // Get current encoding
+#ifdef USE_TRANSLATION
+ NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)[NSString stringWithCString:(TransMan.getCurrentCharset()).c_str() encoding:NSASCIIStringEncoding]));
+#else
+ NSStringEncoding stringEncoding = NSASCIIStringEncoding;
+#endif
+
+ // Add "About ScummVM" menu item
+ [appleMenu addItemWithTitle:[NSString stringWithCString:_("About ScummVM") encoding:stringEncoding] action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+
+ // Add separator
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ // Add "Hide ScummVM" menu item
+ [appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide ScummVM") encoding:stringEncoding] action:@selector(hide:) keyEquivalent:@"h"];
+
+ // Add "Hide Others" menu item
+ menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide Others") encoding:stringEncoding] action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+ [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
+
+ // Add "Show All" menu item
+ [appleMenu addItemWithTitle:[NSString stringWithCString:_("Show All") encoding:stringEncoding] action:@selector(unhideAllApplications:) keyEquivalent:@""];
+
+ // Add separator
+ [appleMenu addItem:[NSMenuItem separatorItem]];
+
+ // Add "Quit ScummVM" menu item
+ [appleMenu addItemWithTitle:[NSString stringWithCString:_("Quit ScummVM") encoding:stringEncoding] action:@selector(terminate:) keyEquivalent:@"q"];
+
+ // Put application menu into the menubar
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:appleMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+
+ // Tell the application object that this is now the application menu
+ [NSApp setAppleMenu:appleMenu];
+
+
+ // Create new "Window" menu
+ windowMenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding]];
+
+ // Add "Minimize" menu item
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Minimize") encoding:stringEncoding] action:@selector(performMiniaturize:) keyEquivalent:@"m"];
+ [windowMenu addItem:menuItem];
+
+ // Put menu into the menubar
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding] action:nil keyEquivalent:@""];
+ [menuItem setSubmenu:windowMenu];
+ [[NSApp mainMenu] addItem:menuItem];
+
+ // Tell the application object that this is now the window menu.
+ [NSApp setWindowsMenu:windowMenu];
+
+ // Finally give up our references to the objects
+ [appleMenu release];
+ [windowMenu release];
+ [menuItem release];
+}
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 9b11eb2c09..ddfc99570a 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -29,9 +29,12 @@
#include "backends/platform/sdl/macosx/macosx.h"
#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h"
+#include "backends/platform/sdl/macosx/appmenu_osx.h"
#include "common/archive.h"
+#include "common/config-manager.h"
#include "common/fs.h"
+#include "common/translation.h"
#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
@@ -51,6 +54,15 @@ void OSystem_MacOSX::initBackend() {
_mixerManager->init();
}
+#ifdef USE_TRANSLATION
+ // We need to initialize the translataion manager here for the following
+ // call to replaceApplicationMenuItems() work correctly
+ TransMan.setLanguage(ConfMan.get("gui_language").c_str());
+#endif // USE_TRANSLATION
+
+ // Replace the SDL generated menu items with our own translated ones on Mac OS X
+ replaceApplicationMenuItems();
+
// Invoke parent implementation of this method
OSystem_POSIX::initBackend();
}
@@ -74,7 +86,7 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
void OSystem_MacOSX::setupIcon() {
- // Don't set icon on OS X, as we use a nicer external icon there.
+ // Don't set icon on OS X, as we use a nicer external icon there.
}
bool OSystem_MacOSX::hasFeature(Feature f) {
diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp
index 1992bdd3f2..3947d010c4 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -34,6 +34,7 @@
!defined(CAANOO) && \
!defined(LINUXMOTO) && \
!defined(SAMSUNGTV) && \
+ !defined(PLAYSTATION3) && \
!defined(OPENPANDORA)
#include "backends/platform/sdl/sdl.h"
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index efc5168d5b..f1afe37349 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -14,7 +14,8 @@ endif
ifdef MACOSX
MODULE_OBJS += \
macosx/macosx-main.o \
- macosx/macosx.o
+ macosx/macosx.o \
+ macosx/appmenu_osx.o
endif
ifdef WIN32
@@ -29,6 +30,12 @@ MODULE_OBJS += \
amigaos/amigaos.o
endif
+ifdef PLAYSTATION3
+MODULE_OBJS += \
+ ps3/ps3-main.o \
+ ps3/ps3.o
+endif
+
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
OBJS := $(MODULE_OBJS) $(OBJS)
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index f78e001398..3bf7a5138a 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3)
#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index d757186134..05c779a4e0 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -33,6 +33,7 @@
#include "backends/platform/sdl/posix/posix.h"
#include "backends/saves/posix/posix-saves.h"
#include "backends/fs/posix/posix-fs-factory.h"
+#include "backends/taskbar/unity/unity-taskbar.h"
#include <errno.h>
#include <sys/stat.h>
@@ -49,6 +50,11 @@ void OSystem_POSIX::init() {
// Initialze File System Factory
_fsFactory = new POSIXFilesystemFactory();
+#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
+ // Initialize taskbar manager
+ _taskbarManager = new UnityTaskbarManager();
+#endif
+
// Invoke parent implementation of this method
OSystem_SDL::init();
}
@@ -60,6 +66,11 @@ void OSystem_POSIX::initBackend() {
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
+
+#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
+ // Register the taskbar manager as an event source (this is necessary for the glib event loop to be run)
+ _eventManager->getEventDispatcher()->registerSource((UnityTaskbarManager *)_taskbarManager, false);
+#endif
}
bool OSystem_POSIX::hasFeature(Feature f) {
diff --git a/backends/platform/sdl/ps3/ps3-main.cpp b/backends/platform/sdl/ps3/ps3-main.cpp
new file mode 100644
index 0000000000..ba548a3749
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3-main.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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 "common/scummsys.h"
+
+#include "backends/platform/sdl/ps3/ps3.h"
+#include "backends/plugins/sdl/sdl-provider.h"
+#include "base/main.h"
+
+int main(int argc, char *argv[]) {
+
+ // Create our OSystem instance
+ g_system = new OSystem_PS3();
+ assert(g_system);
+
+ // Pre initialize the backend
+ ((OSystem_PS3 *)g_system)->init();
+
+#ifdef DYNAMIC_MODULES
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+#endif
+
+ // Invoke the actual ScummVM main entry point:
+ int res = scummvm_main(argc, argv);
+
+ // Free OSystem
+ delete (OSystem_PS3 *)g_system;
+
+ return res;
+}
diff --git a/backends/platform/sdl/ps3/ps3.cpp b/backends/platform/sdl/ps3/ps3.cpp
new file mode 100644
index 0000000000..33586ce693
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ */
+
+#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_time_h // sys/stat.h includes sys/time.h
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "backends/platform/sdl/ps3/ps3.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/fs/ps3/ps3-fs-factory.h"
+#include "backends/events/ps3sdl/ps3sdl-events.h"
+#include "backends/mixer/sdl13/sdl13-mixer.h"
+
+#include <dirent.h>
+#include <sys/stat.h>
+
+int access(const char *pathname, int mode) {
+ struct stat sb;
+
+ if (stat(pathname, &sb) == -1) {
+ return -1;
+ }
+
+ return 0;
+}
+
+OSystem_PS3::OSystem_PS3(Common::String baseConfigName)
+ : _baseConfigName(baseConfigName) {
+}
+
+void OSystem_PS3::init() {
+ // Initialze File System Factory
+ _fsFactory = new PS3FilesystemFactory();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
+}
+
+void OSystem_PS3::initBackend() {
+ ConfMan.set("joystick_num", 0);
+ ConfMan.set("vkeybdpath", PREFIX "/data");
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+
+ // Create the savefile manager
+ if (_savefileManager == 0)
+ _savefileManager = new DefaultSaveFileManager(PREFIX "/saves");
+
+ // Create the mixer manager
+ if (_mixer == 0) {
+ _mixerManager = new Sdl13MixerManager();
+
+ // Setup and start mixer
+ _mixerManager->init();
+ }
+
+ // Event source
+ if (_eventSource == 0)
+ _eventSource = new PS3SdlEventSource();
+
+ // Invoke parent implementation of this method
+ OSystem_SDL::initBackend();
+}
+
+Common::String OSystem_PS3::getDefaultConfigFileName() {
+ return PREFIX "/" + _baseConfigName;
+}
+
+Common::WriteStream *OSystem_PS3::createLogFile() {
+ Common::FSNode file(PREFIX "/scummvm.log");
+ return file.createWriteStream();
+}
diff --git a/backends/platform/sdl/ps3/ps3.h b/backends/platform/sdl/ps3/ps3.h
new file mode 100644
index 0000000000..daed7599a9
--- /dev/null
+++ b/backends/platform/sdl/ps3/ps3.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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 PLATFORM_SDL_PS3_H
+#define PLATFORM_SDL_PS3_H
+
+#include "backends/platform/sdl/sdl.h"
+
+class OSystem_PS3 : public OSystem_SDL {
+public:
+ // Let the subclasses be able to change _baseConfigName in the constructor
+ OSystem_PS3(Common::String baseConfigName = "scummvm.ini");
+ virtual ~OSystem_PS3() {}
+
+ virtual void init();
+ virtual void initBackend();
+
+protected:
+ // Base string for creating the default path and filename
+ // for the configuration file
+ Common::String _baseConfigName;
+
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual Common::WriteStream *createLogFile();
+};
+
+#endif
diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h
index 77515ff4e5..ca3c586e03 100644
--- a/backends/platform/sdl/sdl-sys.h
+++ b/backends/platform/sdl/sdl-sys.h
@@ -27,7 +27,7 @@
// fashion, even on the Symbian port.
// Moreover, it contains a workaround for the fact that SDL_rwops.h uses
// a FILE pointer in one place, which conflicts with common/forbidden.h.
-
+// The SDL 1.3 headers also include strings.h
#include "common/scummsys.h"
@@ -39,6 +39,16 @@ typedef struct { int FAKE; } FAKE_FILE;
#define FILE FAKE_FILE
#endif
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
+#undef strcasecmp
+#define strcasecmp FAKE_strcasecmp
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
+#undef strncasecmp
+#define strncasecmp FAKE_strncasecmp
+#endif
+
#if defined(__SYMBIAN32__)
#include <esdl\SDL.h>
#else
@@ -47,8 +57,19 @@ typedef struct { int FAKE; } FAKE_FILE;
// Finally forbid FILE again (if it was forbidden to start with)
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
-#undef FILE
+#undef FILE
#define FILE FORBIDDEN_SYMBOL_REPLACEMENT
#endif
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
+#undef strcasecmp
+#define strcasecmp FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
+#undef strncasecmp
+#define strncasecmp FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
#endif
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index afc6c850d9..d05cca4d1f 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -31,14 +31,22 @@
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
#include "common/EventRecorder.h"
+#include "common/taskbar.h"
#include "common/textconsole.h"
#include "backends/saves/default/default-saves.h"
+
+// Audio CD support was removed with SDL 1.3
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+#include "backends/audiocd/default/default-audiocd.h"
+#else
#include "backends/audiocd/sdl/sdl-audiocd.h"
+#endif
+
#include "backends/events/sdl/sdl-events.h"
#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/timer/sdl/sdl-timer.h"
-#include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
#ifdef USE_OPENGL
#include "backends/graphics/openglsdl/openglsdl-graphics.h"
#endif
@@ -125,6 +133,11 @@ void OSystem_SDL::init() {
if (_timerManager == 0)
_timerManager = new SdlTimerManager();
+#if defined(USE_TASKBAR)
+ if (_taskbarManager == 0)
+ _taskbarManager = new Common::TaskbarManager();
+#endif
+
#ifdef USE_OPENGL
// Setup a list with both SDL and OpenGL graphics modes
setupGraphicsModes();
@@ -167,27 +180,11 @@ void OSystem_SDL::initBackend() {
}
#endif
if (_graphicsManager == 0) {
- _graphicsManager = new SdlGraphicsManager(_eventSource);
+ _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
graphicsManagerType = 0;
}
}
- // Creates the backend managers, if they don't exist yet (we check
- // for this to allow subclasses to provide their own).
- if (_eventManager == 0)
- _eventManager = new DefaultEventManager(_eventSource);
-
- // We have to initialize the graphics manager before the event manager
- // so the virtual keyboard can be initialized, but we have to add the
- // graphics manager as an event observer after initializing the event
- // manager.
- if (graphicsManagerType == 0)
- ((SdlGraphicsManager *)_graphicsManager)->initEventObserver();
-#ifdef USE_OPENGL
- else if (graphicsManagerType == 1)
- ((OpenGLSdlGraphicsManager *)_graphicsManager)->initEventObserver();
-#endif
-
if (_savefileManager == 0)
_savefileManager = new DefaultSaveFileManager();
@@ -198,8 +195,15 @@ void OSystem_SDL::initBackend() {
_mixerManager->init();
}
- if (_audiocdManager == 0)
+ if (_audiocdManager == 0) {
+ // Audio CD support was removed with SDL 1.3
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+ _audiocdManager = new DefaultAudioCDManager();
+#else
_audiocdManager = new SdlAudioCDManager();
+#endif
+
+ }
// Setup a custom program icon.
setupIcon();
@@ -207,7 +211,34 @@ void OSystem_SDL::initBackend() {
_inited = true;
ModularBackend::initBackend();
+
+ // We have to initialize the graphics manager before the event manager
+ // so the virtual keyboard can be initialized, but we have to add the
+ // graphics manager as an event observer after initializing the event
+ // manager.
+ if (graphicsManagerType == 0)
+ ((SurfaceSdlGraphicsManager *)_graphicsManager)->initEventObserver();
+#ifdef USE_OPENGL
+ else if (graphicsManagerType == 1)
+ ((OpenGLSdlGraphicsManager *)_graphicsManager)->initEventObserver();
+#endif
+
+}
+
+#if defined(USE_TASKBAR)
+void OSystem_SDL::engineInit() {
+ // Add the started engine to the list of recent tasks
+ _taskbarManager->addRecent(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+
+ // Set the overlay icon the current running engine
+ _taskbarManager->setOverlayIcon(ConfMan.getActiveDomainName(), ConfMan.get("description"));
+}
+
+void OSystem_SDL::engineDone() {
+ // Remove overlay icon
+ _taskbarManager->setOverlayIcon("", "");
}
+#endif
void OSystem_SDL::initSDL() {
// Check if SDL has not been initialized
@@ -275,10 +306,22 @@ void OSystem_SDL::fatalError() {
void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
- ModularBackend::logMessage(type, message);
+ // First log to stdout/stderr
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+
+ // Then log into file (via the logger)
if (_logger)
_logger->print(message);
+ // Finally, some Windows / WinCE specific logging code.
#if defined( USE_WINDBG )
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
@@ -301,7 +344,7 @@ void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
}
Common::String OSystem_SDL::getSystemLanguage() const {
-#ifdef USE_DETECTLANG
+#if defined(USE_DETECTLANG) && !defined(_WIN32_WCE)
#ifdef WIN32
// We can not use "setlocale" (at least not for MSVC builds), since it
// will return locales like: "English_USA.1252", thus we need a special
@@ -368,7 +411,7 @@ void OSystem_SDL::setupIcon() {
if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) {
warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]);
-
+
return;
}
if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) {
@@ -384,6 +427,7 @@ void OSystem_SDL::setupIcon() {
for (i = 0; i < ncols; i++) {
unsigned char code;
char color[32];
+ memset(color, 0, sizeof(color));
unsigned int col;
if (sscanf(scummvm_icon[1 + i], "%c c %s", &code, color) != 2) {
warning("Wrong format of scummvm_icon[%d] (%s)", 1 + i, scummvm_icon[1 + i]);
@@ -472,7 +516,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
// Check if mode is from SDL or OpenGL
if (mode < _sdlModesCount) {
- srcMode = SdlGraphicsManager::supportedGraphicsModes();
+ srcMode = SurfaceSdlGraphicsManager::supportedGraphicsModes();
i = 0;
} else {
srcMode = OpenGLSdlGraphicsManager::supportedGraphicsModes();
@@ -487,8 +531,8 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
if (_graphicsMode >= _sdlModesCount && mode < _sdlModesCount) {
debug(1, "switching to plain SDL graphics");
delete _graphicsManager;
- _graphicsManager = new SdlGraphicsManager(_eventSource);
- ((SdlGraphicsManager *)_graphicsManager)->initEventObserver();
+ _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
+ ((SurfaceSdlGraphicsManager *)_graphicsManager)->initEventObserver();
_graphicsManager->beginGFXTransaction();
} else if (_graphicsMode < _sdlModesCount && mode >= _sdlModesCount) {
debug(1, "switching to OpenGL graphics");
@@ -514,7 +558,7 @@ int OSystem_SDL::getGraphicsMode() const {
}
void OSystem_SDL::setupGraphicsModes() {
- const OSystem::GraphicsMode *sdlGraphicsModes = SdlGraphicsManager::supportedGraphicsModes();
+ const OSystem::GraphicsMode *sdlGraphicsModes = SurfaceSdlGraphicsManager::supportedGraphicsModes();
const OSystem::GraphicsMode *openglGraphicsModes = OpenGLSdlGraphicsManager::supportedGraphicsModes();
_sdlModesCount = 0;
_glModesCount = 0;
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 9c08752054..395b2b3aac 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -30,7 +30,7 @@
#include "backends/events/sdl/sdl-events.h"
#include "backends/log/log.h"
-/**
+/**
* Base OSystem class for all SDL ports.
*/
class OSystem_SDL : public ModularBackend {
@@ -38,7 +38,7 @@ public:
OSystem_SDL();
virtual ~OSystem_SDL();
- /**
+ /**
* Pre-initialize backend. It should be called after
* instantiating the backend. Early needed managers are
* created here.
@@ -54,6 +54,10 @@ public:
// Override functions from ModularBackend and OSystem
virtual void initBackend();
+#if defined(USE_TASKBAR)
+ virtual void engineInit();
+ virtual void engineDone();
+#endif
virtual Common::HardwareKeySet *getHardwareKeySet();
virtual void quit();
virtual void fatalError();
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 5b14be4417..a2c8e43424 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -23,10 +23,6 @@
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "common/scummsys.h"
-#include "common/error.h"
-#include "common/textconsole.h"
-
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
@@ -34,58 +30,52 @@
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
#include <shellapi.h>
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/textconsole.h"
+
+#include <SDL_syswm.h> // For setting the icon
+
#include "backends/platform/sdl/win32/win32.h"
#include "backends/fs/windows/windows-fs-factory.h"
+#include "backends/taskbar/win32/win32-taskbar.h"
#include "common/memstream.h"
#define DEFAULT_CONFIG_FILE "scummvm.ini"
-//#define HIDE_CONSOLE
+void OSystem_Win32::init() {
+ // Initialize File System Factory
+ _fsFactory = new WindowsFilesystemFactory();
-#ifdef HIDE_CONSOLE
-struct SdlConsoleHidingWin32 {
- DWORD myPid;
- DWORD myTid;
- HWND consoleHandle;
-};
+#if defined(USE_TASKBAR)
+ // Initialize taskbar manager
+ _taskbarManager = new Win32TaskbarManager();
+#endif
-// console hiding for win32
-static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) {
- DWORD pid, tid;
- SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam;
- tid = GetWindowThreadProcessId(hWnd, &pid);
- if ((tid == variables->myTid) && (pid == variables->myPid)) {
- variables->consoleHandle = hWnd;
- return FALSE;
- }
- return TRUE;
+ // Invoke parent implementation of this method
+ OSystem_SDL::init();
}
-#endif
+void OSystem_Win32::initBackend() {
+ // Console window is enabled by default on Windows
+ ConfMan.registerDefault("console", true);
-void OSystem_Win32::init() {
-#ifdef HIDE_CONSOLE
- // console hiding for win32
- SdlConsoleHidingWin32 consoleHidingWin32;
- consoleHidingWin32.consoleHandle = 0;
- consoleHidingWin32.myPid = GetCurrentProcessId();
- consoleHidingWin32.myTid = GetCurrentThreadId();
- EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32);
-
- if (!ConfMan.getBool("show_console")) {
- if (consoleHidingWin32.consoleHandle) {
- // We won't find a window with our TID/PID in case we were started from command-line
- ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE);
+ // Enable or disable the window console window
+ if (ConfMan.getBool("console")) {
+ if (AllocConsole()) {
+ freopen("CONIN$","r",stdin);
+ freopen("CONOUT$","w",stdout);
+ freopen("CONOUT$","w",stderr);
}
+ SetConsoleTitle("ScummVM Status Window");
+ } else {
+ FreeConsole();
}
-#endif
-
- // Initialze File System Factory
- _fsFactory = new WindowsFilesystemFactory();
// Invoke parent implementation of this method
- OSystem_SDL::init();
+ OSystem_SDL::initBackend();
}
@@ -131,6 +121,28 @@ bool OSystem_Win32::displayLogFile() {
return false;
}
+void OSystem_Win32::setupIcon() {
+ HMODULE handle = GetModuleHandle(NULL);
+ HICON ico = LoadIcon(handle, MAKEINTRESOURCE(1001 /* IDI_ICON */));
+ if (ico) {
+ SDL_SysWMinfo wminfo;
+ SDL_VERSION(&wminfo.version);
+ if (SDL_GetWMInfo(&wminfo)) {
+ // Replace the handle to the icon associated with the window class by our custom icon
+ SetClassLongPtr(wminfo.window, GCLP_HICON, (ULONG_PTR)ico);
+
+ // Since there wasn't any default icon, we can't use the return value from SetClassLong
+ // to check for errors (it would be 0 in both cases: error or no previous value for the
+ // icon handle). Instead we check for the last-error code value.
+ if (GetLastError() == ERROR_SUCCESS)
+ return;
+ }
+ }
+
+ // If no icon has been set, fallback to default path
+ OSystem_SDL::setupIcon();
+}
+
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
@@ -149,18 +161,31 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
error("Unable to access user profile directory");
strcat(configFile, "\\Application Data");
- CreateDirectory(configFile, NULL);
+
+ // If the directory already exists (as it should in most cases),
+ // we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
+ if (!CreateDirectory(configFile, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create Application data folder");
+ }
}
strcat(configFile, "\\ScummVM");
- CreateDirectory(configFile, NULL);
+ if (!CreateDirectory(configFile, NULL)) {
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
+ error("Cannot create ScummVM application data folder");
+ }
+
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
FILE *tmp = NULL;
if ((tmp = fopen(configFile, "r")) == NULL) {
// Check windows directory
char oldConfigFile[MAXPATHLEN];
- GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
+ uint ret = GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
+ if (ret == 0 || ret > MAXPATHLEN)
+ error("Cannot retrieve the path of the Windows directory");
+
strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE);
if ((tmp = fopen(oldConfigFile, "r"))) {
strcpy(configFile, oldConfigFile);
@@ -172,7 +197,10 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
}
} else {
// Check windows directory
- GetWindowsDirectory(configFile, MAXPATHLEN);
+ uint ret = GetWindowsDirectory(configFile, MAXPATHLEN);
+ if (ret == 0 || ret > MAXPATHLEN)
+ error("Cannot retrieve the path of the Windows directory");
+
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
}
@@ -300,7 +328,7 @@ Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(cons
} // End of anonymous namespace
void OSystem_Win32::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- s.add("Win32Res", new Win32ResourceArchive());
+ s.add("Win32Res", new Win32ResourceArchive(), priority);
OSystem_SDL::addSysArchivesToSearchSet(s, priority);
}
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index ef7b6af3f1..b56997a63b 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -28,6 +28,7 @@
class OSystem_Win32 : public OSystem_SDL {
public:
virtual void init();
+ virtual void initBackend();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
@@ -46,6 +47,7 @@ protected:
*/
Common::String _logFilePath;
+ virtual void setupIcon();
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
};
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 9cccc81d19..b1bd976f9e 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -57,7 +57,7 @@ char *GetExecutablePath() {
OSystem_SDL_Symbian::OSystem_SDL_Symbian()
:
_RFs(0) {
-
+
}
void OSystem_SDL_Symbian::init() {
@@ -171,7 +171,7 @@ Common::String OSystem_SDL_Symbian::getDefaultConfigFileName() {
}
void OSystem_SDL_Symbian::setupIcon() {
- // Don't for Symbian: it uses the EScummVM.aif file for the icon.
+ // Don't for Symbian: it uses the EScummVM.aif file for the icon.
}
RFs& OSystem_SDL_Symbian::FsSession() {
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index c6b23783b8..258a782cc4 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -19,11 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <unistd.h>
@@ -291,6 +287,18 @@ void OSystem_Wii::showOptionsDialog() {
_padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration");
}
+void OSystem_Wii::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
#ifndef GAMECUBE
Common::String OSystem_Wii::getSystemLanguage() const {
const char *wiiCountries[] = {
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 6863a6840e..64197f913a 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -211,6 +211,8 @@ public:
virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(TimeDate &t) const;
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
#ifndef GAMECUBE
virtual Common::String getSystemLanguage() const;
#endif // GAMECUBE
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 859e3a1395..443e738a4a 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -20,6 +20,7 @@
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_abort
#include <malloc.h>
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index a4786d330d..5980a41caa 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -137,6 +137,7 @@ void CEActionsPocket::initInstanceGame() {
bool is_tinsel = (gameid == "tinsel");
bool is_cruise = (gameid == "cruise");
bool is_made = (gameid == "made");
+ bool is_sci = (gameid == "sci");
GUI_Actions::initInstanceGame();
@@ -214,12 +215,14 @@ void CEActionsPocket::initInstanceGame() {
_key_action[POCKET_ACTION_MULTI].setKey(Common::ASCII_F1, SDLK_F1); // bargon : F1 to start
else if (gameid == "atlantis")
_key_action[POCKET_ACTION_MULTI].setKey(0, SDLK_KP0); // fate of atlantis : Ins to sucker-punch
+ else if (is_simon)
+ _key_action[POCKET_ACTION_MULTI].setKey(Common::ASCII_F10, SDLK_F10); // F10
else
_key_action[POCKET_ACTION_MULTI].setKey('V', SDLK_v, KMOD_SHIFT); // FT cheat : shift-V
// Key bind method
_action_enabled[POCKET_ACTION_BINDKEYS] = true;
// Disable double-tap right-click for convenience
- if (is_tinsel || is_cruise)
+ if (is_tinsel || is_cruise || is_sci)
if (!ConfMan.hasKey("no_doubletap_rightclick")) {
ConfMan.setBool("no_doubletap_rightclick", true);
ConfMan.flushToDisk();
@@ -267,6 +270,15 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
else
_key_action[action].setKey(SDLK_s);
}
+ if (action == POCKET_ACTION_SKIP && ConfMan.get("gameid") == "agi") {
+ // In several AGI games (for example SQ2) it is needed to press F10 to exit from
+ // a screen. But we still want be able to skip normally with the skip button.
+ // Because of this, we inject a F10 keystroke here (this works and doesn't seem
+ // to have side-effects)
+ _key_action[action].setKey(Common::ASCII_F10, SDLK_F10); // F10
+ EventsBuffer::simulateKey(&_key_action[action], true);
+ _key_action[action].setKey(KEY_ALL_SKIP);
+ }
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case POCKET_ACTION_KEYBOARD:
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp
index b12dadabb6..2cce288323 100644
--- a/backends/platform/wince/CEActionsSmartphone.cpp
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -128,6 +128,7 @@ void CEActionsSmartphone::initInstanceGame() {
bool is_tinsel = (gameid == "tinsel");
bool is_cruise = (gameid == "cruise");
bool is_made = (gameid == "made");
+ bool is_sci = (gameid == "sci");
GUI_Actions::initInstanceGame();
@@ -180,12 +181,14 @@ void CEActionsSmartphone::initInstanceGame() {
_key_action[SMARTPHONE_ACTION_MULTI].setKey(Common::ASCII_F1, SDLK_F1); // bargon : F1 to start
else if (gameid == "atlantis")
_key_action[SMARTPHONE_ACTION_MULTI].setKey(0, SDLK_KP0); // fate of atlantis : Ins to sucker-punch
+ else if (is_simon)
+ _key_action[SMARTPHONE_ACTION_MULTI].setKey(Common::ASCII_F10, SDLK_F10); // F10
else
_key_action[SMARTPHONE_ACTION_MULTI].setKey('V', SDLK_v, KMOD_SHIFT); // FT cheat : shift-V
// Bind keys
_action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true;
// Disable double-tap right-click for convenience
- if (is_tinsel || is_cruise)
+ if (is_tinsel || is_cruise || is_sci)
if (!ConfMan.hasKey("no_doubletap_rightclick")) {
ConfMan.setBool("no_doubletap_rightclick", true);
ConfMan.flushToDisk();
@@ -231,6 +234,15 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
else
_key_action[action].setKey(SDLK_s);
}
+ if (action == SMARTPHONE_ACTION_SKIP && ConfMan.get("gameid") == "agi") {
+ // In several AGI games (for example SQ2) it is needed to press F10 to exit from
+ // a screen. But we still want be able to skip normally with the skip button.
+ // Because of this, we inject a F10 keystroke here (this works and doesn't seem
+ // to have side-effects)
+ _key_action[action].setKey(Common::ASCII_F10, SDLK_F10); // F10
+ EventsBuffer::simulateKey(&_key_action[action], true);
+ _key_action[action].setKey(KEY_ALL_SKIP);
+ }
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case SMARTPHONE_ACTION_RIGHTCLICK:
diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp
index 9c832dd585..dd6076e0af 100644
--- a/backends/platform/wince/CELauncherDialog.cpp
+++ b/backends/platform/wince/CELauncherDialog.cpp
@@ -24,6 +24,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/platform/wince/wince-sdl.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#include "CELauncherDialog.h"
@@ -34,6 +35,7 @@
#include "gui/browser.h"
#include "gui/message.h"
#include "gui/ThemeEval.h"
+#include "gui/widgets/list.h"
#include "common/config-manager.h"
@@ -63,9 +65,13 @@ public:
};
CELauncherDialog::CELauncherDialog() : GUI::LauncherDialog() {
+ ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->reset_panel();
}
void CELauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ if ((cmd == 'STRT') || (cmd == kListItemActivatedCmd) || (cmd == kListItemDoubleClickedCmd)) {
+ ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->init_panel();
+ }
LauncherDialog::handleCommand(sender, cmd, data);
if (cmd == 'ABOU') {
CEAboutDialog about;
diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt
index c48d9ca998..60bcf710bb 100644
--- a/backends/platform/wince/README-WinCE.txt
+++ b/backends/platform/wince/README-WinCE.txt
@@ -1,10 +1,35 @@
ScummVM Windows CE FAQ
-Last updated: 2011-05-27
-Release version: 1.3.0
+Last updated: 2011-07-20
+Release version: x.x.x
------------------------------------------------------------------------
New in this version
-------------------
+x.x.x:
+- Changed default values for "high_sample_rate" & "FM_high_quality" to "true" as
+ most devices today are fast enough to handle this. It's still possible to set
+ this to "false" if you have a slower device.
+- Fix for TeenAgent & Hugo engines (both weren't running at all, crashed right
+ at the beginning)
+- Replaced the game mass-adding functionality with the functionality used on all
+ other platforms. It now shows progress while searching for games.
+
+1.3.1:
+- Fix for Normal2xAspect scaler which was causing screen update issues in some
+ games.
+- Fix for Normal1xAspect scaler which caused problems in the bottom part of the
+ screen when toolbar was hidden.
+- Fix for freelook mode.
+- Fix for timer manager, caused timing issues in some games.
+- Activated runtime language detection for ScummVM gui.
+- Toolbar is now hidden when returning to the game list.
+- Double-tap right-click emulation is now turned off for SCI games by default.
+- Added a new option "no_doubletap_paneltoggle" for scummvm.ini to disable
+ toolbar toggling when double-tapping on the top part of the screen.
+- SDL library related fixes:
+ * Fix for screen/mouse-cursor rotation issues (fixes erratic touchscreen
+ behaviour)
+ * Fix for hardware keyboard on some devices (HTC Touch Pro, etc.)
1.3.0:
This is the first official Windows CE release since 1.1.1.
@@ -345,14 +370,13 @@ Some parameters are specific to this port :
Game specific sections (f.e. [monkey2]) - performance options
* high_sample_rate bool Desktop quality (22 kHz) sound output if
- set. The default is 11 kHz.
- If you have a fast device, you can set this
- to true to enjoy better sound effects and
- music.
+ set. This is the default.
+ If you have a slow device, you can set this
+ to false to prevent lags/delays in the game.
* FM_high_quality bool Desktop quality FM synthesis if set. Lower
- quality otherwise. The default is low
+ quality otherwise. The default is high
quality. You can change this if you have a
- fast device.
+ slow device.
* sound_thread_priority int Set the priority of the sound thread (0, 1,
2). Depending on the release, this is set
to 1 internally (above normal).
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 3ab9dc8aa4..1abc3cb350 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -42,6 +42,7 @@
#include "audio/mixer_intern.h"
#include "audio/fmopl.h"
+#include "backends/mutex/sdl/sdl-mutex.h"
#include "backends/timer/sdl/sdl-timer.h"
#include "gui/Actions.h"
@@ -353,9 +354,9 @@ void drawError(char *error) {
}
// ********************************************************************************************
-static DefaultTimerManager *_int_timer = NULL;
static Uint32 timer_handler_wrapper(Uint32 interval) {
- _int_timer->handler();
+ DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
+ tm->handler();
return interval;
}
@@ -379,21 +380,7 @@ void OSystem_WINCE3::initBackend() {
((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager);
-
- // FIXME: This timer manager is *not accesible* from the outside.
- // Instead the timer manager setup by OSystem_SDL is visible on the outside.
- // Since the WinCE backend actually seems to work, my guess is that
- // SDL_AddTimer works after all and the following code is redundant.
- // However it may be, this must be resolved one way or another.
-
- // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
- // We work around this by using the SetTimer function, since we only use
- // one timer in scummvm (for the time being)
- _int_timer = new DefaultTimerManager();
- //_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
- SDL_SetTimer(10, &timer_handler_wrapper);
-
- // Chain init
+ // Call parent implementation of this method
OSystem_SDL::initBackend();
// Initialize global key mapping
@@ -404,9 +391,6 @@ void OSystem_WINCE3::initBackend() {
GUI_Actions::Instance()->saveMapping(); // write defaults
}
- // Call parent implementation of this method
- //OSystem_SDL::initBackend();
-
_inited = true;
}
@@ -555,6 +539,24 @@ void OSystem_WINCE3::initSDL() {
}
}
+void OSystem_WINCE3::init() {
+ // Create SdlMutexManager instance as the TimerManager relies on the
+ // MutexManager being already initialized
+ if (_mutexManager == 0)
+ _mutexManager = new SdlMutexManager();
+
+ // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
+ // We work around this by using the SetTimer function, since we only use
+ // one timer in scummvm (for the time being)
+ if (_timerManager == 0) {
+ _timerManager = new DefaultTimerManager();
+ SDL_SetTimer(10, &timer_handler_wrapper);
+ }
+
+ // Call parent implementation of this method
+ OSystem_SDL::init();
+}
+
void OSystem_WINCE3::quit() {
fclose(stdout_file);
fclose(stderr_file);
@@ -578,6 +580,73 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
t.tm_sec = systime.wSecond;
}
+Common::String OSystem_WINCE3::getSystemLanguage() const {
+#ifdef USE_DETECTLANG
+ // We can not use "setlocale" (at least not for MSVC builds), since it
+ // will return locales like: "English_USA.1252", thus we need a special
+ // way to determine the locale string for Win32.
+ char langName[9];
+ char ctryName[9];
+ TCHAR langNameW[32];
+ TCHAR ctryNameW[32];
+ int i = 0;
+ bool localeFound = false;
+ Common::String localeName;
+
+ // Really not nice, but the only way to map Windows CE language/country codes to posix NLS names,
+ // because Windows CE doesn't support LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME,
+ // according to this: http://msdn.microsoft.com/en-us/library/aa912934.aspx
+ //
+ // See http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx for a translation table
+ // This table has to be updated manually when new translations are added
+ const char *posixMappingTable[][3] = {
+ {"CAT", "ESP", "ca_ES"},
+ {"CSY", "CZE", "cs_CZ"},
+ {"DAN", "DNK", "da_DA"},
+ {"DEU", "DEU", "de_DE"},
+ {"ESN", "ESP", "es_ES"},
+ {"ESP", "ESP", "es_ES"},
+ {"FRA", "FRA", "fr_FR"},
+ {"HUN", "HUN", "hu_HU"},
+ {"ITA", "ITA", "it_IT"},
+ {"NOR", "NOR", "nb_NO"},
+ {"NON", "NOR", "nn_NO"},
+ {"PLK", "POL", "pl_PL"},
+ {"PTB", "BRA", "pt_BR"},
+ {"RUS", "RUS", "ru_RU"},
+ {"SVE", "SWE", "se_SE"},
+ {"UKR", "UKR", "uk_UA"},
+ {NULL, NULL, NULL}
+ };
+
+ if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, langNameW, sizeof(langNameW)) != 0 &&
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) {
+ WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL);
+
+ debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName);
+ while (posixMappingTable[i][0] && !localeFound) {
+ if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) &&
+ (!strcmp(posixMappingTable[i][1], ctryName) || !strcmp(posixMappingTable[i][0], "*")) ) {
+ localeFound = true;
+ localeName = posixMappingTable[i][2];
+ }
+ i++;
+ }
+ if (!localeFound) warning("No posix locale name found for %s_%s", langName, ctryName);
+ }
+
+ if (localeFound) {
+ debug(1, "Found posix locale name: %s", localeName.c_str());
+ return localeName;
+ } else {
+ return ModularBackend::getSystemLanguage();
+ }
+#else // USE_DETECTLANG
+ return ModularBackend::getSystemLanguage();
+#endif // USE_DETECTLANG
+}
+
int OSystem_WINCE3::_platformScreenWidth;
int OSystem_WINCE3::_platformScreenHeight;
bool OSystem_WINCE3::_isOzone;
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index adb63eb936..b4f323c9e2 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -52,7 +52,10 @@ public:
void initBackend();
// Overloaded from SDL backend
+ void init();
void quit();
+ virtual Common::String getSystemLanguage() const;
+
// Overloaded from OSystem
void engineInit();
void getTimeAndDate(TimeDate &t) const;