aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/dc/Makefile30
-rw-r--r--backends/platform/dc/audio.cpp13
-rw-r--r--backends/platform/dc/dc.h5
-rw-r--r--backends/platform/dc/dcmain.cpp7
-rw-r--r--backends/platform/dc/selector.cpp14
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp13
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h1
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp26
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h12
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.cpp2
-rw-r--r--backends/platform/gp2x/build/README-GP2X2
-rw-r--r--backends/platform/gp2x/build/README-GP2X.html147
-rwxr-xr-x[-rw-r--r--]backends/platform/gp2x/build/build.sh0
-rwxr-xr-x[-rw-r--r--]backends/platform/gp2x/build/bundle.sh0
-rwxr-xr-x[-rw-r--r--]backends/platform/gp2x/build/clean.sh0
-rwxr-xr-x[-rw-r--r--]backends/platform/gp2x/build/config.sh4
-rwxr-xr-x[-rw-r--r--]backends/platform/gp2x/build/scummvm.gpe0
-rw-r--r--backends/platform/gp2x/gp2x-common.h11
-rw-r--r--backends/platform/gp2x/gp2x.cpp65
-rw-r--r--backends/platform/iphone/blit_arm.s156
-rw-r--r--backends/platform/iphone/iphone_keyboard.h6
-rw-r--r--backends/platform/iphone/iphone_keyboard.m16
-rw-r--r--backends/platform/iphone/iphone_main.m18
-rw-r--r--backends/platform/iphone/iphone_video.h5
-rw-r--r--backends/platform/iphone/iphone_video.m99
-rw-r--r--backends/platform/iphone/osys_iphone.cpp98
-rw-r--r--backends/platform/iphone/osys_iphone.h11
-rw-r--r--backends/platform/null/null.cpp68
-rw-r--r--backends/platform/ps2/Makefile.ps25
-rw-r--r--backends/platform/ps2/fileio.cpp67
-rw-r--r--backends/platform/ps2/iop/rpckbd/Makefile30
-rw-r--r--backends/platform/ps2/iop/rpckbd/include/ps2kbd.h90
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/imports.lst58
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/irx_imports.h35
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/ps2kbd.c1199
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/us_keymap.h1579
-rw-r--r--backends/platform/ps2/irxboot.cpp2
-rw-r--r--backends/platform/ps2/systemps2.cpp20
-rw-r--r--backends/platform/ps2/systemps2.h7
-rw-r--r--backends/platform/psp/Makefile28
-rw-r--r--backends/platform/psp/osys_psp.cpp58
-rw-r--r--backends/platform/psp/osys_psp.h9
-rw-r--r--backends/platform/sdl/sdl.cpp176
-rw-r--r--backends/platform/sdl/sdl.h40
-rw-r--r--backends/platform/symbian/AdaptAllMMPs.pl231
-rw-r--r--backends/platform/symbian/BuildPackageUpload_AllVersions.pl267
-rw-r--r--backends/platform/symbian/BuildPackageUpload_LocalSettings.pl544
-rw-r--r--backends/platform/symbian/README7
-rw-r--r--backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in9
-rw-r--r--backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in9
-rw-r--r--backends/platform/symbian/mmp/scummvm_agi.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_agos.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_base.mmp.in55
-rw-r--r--backends/platform/symbian/mmp/scummvm_cine.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_cruise.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_drascula.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_gob.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_kyra.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_lure.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_m4.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_made.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_parallaction.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_queen.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_saga.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_scumm.mmp.in21
-rw-r--r--backends/platform/symbian/mmp/scummvm_sky.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_sword1.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_sword2.mmp.in2
-rw-r--r--backends/platform/symbian/mmp/scummvm_touche.mmp.in2
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp189
-rw-r--r--backends/platform/symbian/src/SymbianOS.h9
-rw-r--r--backends/platform/symbian/src/portdefs.h4
-rw-r--r--backends/platform/wii/osystem.cpp2
-rw-r--r--backends/platform/wii/osystem.h5
-rw-r--r--backends/platform/wii/osystem_sfx.cpp16
-rw-r--r--backends/platform/wince/Makefile5
-rw-r--r--backends/platform/wince/missing/missing.cpp512
-rw-r--r--backends/platform/wince/wince-sdl.cpp51
-rw-r--r--backends/platform/wince/wince-sdl.h5
-rw-r--r--backends/platform/x11/module.mk10
-rw-r--r--backends/platform/x11/x11.cpp1050
-rw-r--r--backends/platform/x11/x11.h197
82 files changed, 4644 insertions, 2820 deletions
diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile
index 0a048c45e9..db5861903b 100644
--- a/backends/platform/dc/Makefile
+++ b/backends/platform/dc/Makefile
@@ -16,6 +16,7 @@ LDFLAGS = -Wl,-Ttext,0x8c010000 -nostartfiles $(ronindir)/lib/crt0.o
INCLUDES= -I./ -I$(srcdir) -I$(ronindir)/include/ -I$(srcdir)/engines
LIBS = -L$(ronindir)/lib -lmad -lronin -lz -lm
EXECUTABLE = scummvm.elf
+DEPDIR = .deps
PLUGIN_PREFIX =
PLUGIN_SUFFIX = .plg
PLUGIN_EXTRA_DEPS = plugin.x plugin.syms scummvm.elf
@@ -32,12 +33,37 @@ ifdef DYNAMIC_MODULES
DEFINES += -DDYNAMIC_MODULES
PRE_OBJS_FLAGS = -Wl,--whole-archive
POST_OBJS_FLAGS = -Wl,--no-whole-archive
+ENABLED=DYNAMIC_PLUGIN
+else
+ENABLED=STATIC_PLUGIN
endif
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = $(ENABLED)
+ENABLE_HE = $(ENABLED)
+ENABLE_AGI = $(ENABLED)
+ENABLE_AGOS = $(ENABLED)
+ENABLE_CINE = $(ENABLED)
+ENABLE_CRUISE = $(ENABLED)
+ENABLE_DRASCULA = $(ENABLED)
+ENABLE_GOB = $(ENABLED)
+ENABLE_IGOR = $(ENABLED)
+ENABLE_KYRA = $(ENABLED)
+ENABLE_LURE = $(ENABLED)
+ENABLE_M4 = $(ENABLED)
+ENABLE_MADE = $(ENABLED)
+ENABLE_PARALLACTION = $(ENABLED)
+ENABLE_QUEEN = $(ENABLED)
+ENABLE_SAGA = $(ENABLED)
+ENABLE_SKY = $(ENABLED)
+ENABLE_SWORD1 = $(ENABLED)
+ENABLE_SWORD2 = $(ENABLED)
+ENABLE_TOUCHE = $(ENABLED)
+
OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
-MODULE_DIRS += .
+MODULE_DIRS += ./
include $(srcdir)/Makefile.common
@@ -49,7 +75,7 @@ SCUMMVM.BIN : scummvm.bin
plugin_dist :
for p in plugins/*.plg; do \
- sh-elf-strip -g -o "`basename \"$$p\" | tr '[:lower:]' '[:upper:]'`" "$$p"; \
+ sh-elf-strip -g -o "`basename \"$$p\" | LC_CTYPE=C tr '[:lower:]' '[:upper:]'`" "$$p"; \
done
dist : SCUMMVM.BIN plugins plugin_dist
diff --git a/backends/platform/dc/audio.cpp b/backends/platform/dc/audio.cpp
index 5f95a836e8..b5667e74b0 100644
--- a/backends/platform/dc/audio.cpp
+++ b/backends/platform/dc/audio.cpp
@@ -25,17 +25,18 @@
#include <common/scummsys.h>
#include "engines/engine.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "dc.h"
EXTERN_C void *memcpy4s(void *s1, const void *s2, unsigned int n);
-void initSound()
+uint OSystem_Dreamcast::initSound()
{
stop_sound();
do_sound_command(CMD_SET_FREQ_EXP(FREQ_22050_EXP));
do_sound_command(CMD_SET_STEREO(1));
do_sound_command(CMD_SET_BUFFER(SOUND_BUFFER_SHIFT));
+ return read_sound_int(&SOUNDSTATUS->freq);
}
void OSystem_Dreamcast::checkSound()
@@ -61,8 +62,8 @@ void OSystem_Dreamcast::checkSound()
if (n<100)
return;
- Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,
- 2*SAMPLES_TO_BYTES(n));
+ _mixer->mixCallback((byte*)temp_sound_buffer,
+ 2*SAMPLES_TO_BYTES(n));
if (fillpos+n > curr_ring_buffer_samples) {
int r = curr_ring_buffer_samples - fillpos;
@@ -77,8 +78,4 @@ void OSystem_Dreamcast::checkSound()
fillpos = 0;
}
-int OSystem_Dreamcast::getOutputSampleRate() const
-{
- return read_sound_int(&SOUNDSTATUS->freq);
-}
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index b7494a77bc..9dfd4c331e 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -28,6 +28,7 @@
#include <ronin/soundcommon.h>
#include "backends/timer/default/default-timer.h"
#include "backends/fs/fs-factory.h"
+#include "sound/mixer_intern.h"
#define NUM_BUFFERS 4
#define SOUND_BUFFER_SHIFT 3
@@ -195,7 +196,7 @@ class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
private:
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
DefaultTimerManager *_timer;
SoftKeyboard _softkbd;
@@ -223,6 +224,7 @@ class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
int temp_sound_buffer[RING_BUFFER_SAMPLES>>SOUND_BUFFER_SHIFT];
+ uint initSound();
void checkSound();
void drawMouse(int xdraw, int ydraw, int w, int h,
@@ -237,6 +239,5 @@ class OSystem_Dreamcast : public OSystem, public FilesystemFactory {
extern int handleInput(struct mapledev *pad,
int &mouse_x, int &mouse_y,
byte &shiftFlags, Interactive *inter = NULL);
-extern void initSound();
extern bool selectGame(char *&, char *&, class Icon &);
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 913bc9948e..0b114bee10 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -33,7 +33,7 @@
#include <common/config-manager.h>
#include "backends/plugins/dc/dc-provider.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
Icon icon;
@@ -54,8 +54,10 @@ OSystem_Dreamcast::OSystem_Dreamcast()
void OSystem_Dreamcast::initBackend()
{
_savefile = createSavefileManager();
- _mixer = new Audio::Mixer();
+ _mixer = new Audio::MixerImpl(this);
_timer = new DefaultTimerManager();
+ _mixer->setOutputRate(initSound());
+ _mixer->setReady(true);
}
@@ -216,7 +218,6 @@ int main()
static int argc = 1;
dc_init_hardware();
- initSound();
g_system = new OSystem_Dreamcast();
assert(g_system);
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 880fbc400f..91c851506f 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -25,7 +25,9 @@
#include <common/scummsys.h>
#include <engines/engine.h>
+#include <engines/metaengine.h>
#include <base/plugins.h>
+#include <base/game.h>
#include <common/fs.h>
#include <common/events.h>
#include "dc.h"
@@ -149,15 +151,6 @@ struct Dir
static Game the_game;
-static void detectGames(FSList &files, GameList &candidates)
-{
- const EnginePluginList &plugins = EngineMan.getPlugins();
- EnginePluginList::const_iterator iter = plugins.begin();
- for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
- candidates.push_back((*iter)->detectGames(files));
- }
-}
-
static bool isIcon(const FilesystemNode &entry)
{
int l = entry.getDisplayName().size();
@@ -227,8 +220,7 @@ static int findGames(Game *games, int max)
files.push_back(*entry);
}
- GameList candidates;
- detectGames(files, candidates);
+ GameList candidates = EngineMan.detectGames(files);
for (GameList::const_iterator ge = candidates.begin();
ge != candidates.end(); ++ge)
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index a130509e36..f4706807f7 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -168,7 +168,7 @@ bool displayModeIs8Bit = false;
u8 gameID;
bool snapToBorder = false;
-bool consoleEnable = false;
+bool consoleEnable = true;
bool gameScreenSwap = false;
bool isCpuScalerEnabled();
//#define HEAVY_LOGGING
@@ -899,12 +899,6 @@ u16* get8BitBackBuffer() {
return BG_GFX + 0x10000; // 16bit qty!
}
-void setSoundProc(OSystem_DS::SoundProc proc, void* param) {
-// consolePrintf("Set sound callback");
- soundCallback = proc;
- soundParam = param;
-}
-
// The sound system in ScummVM seems to always return stereo interleaved samples.
// Here, I'm treating an 11Khz stereo stream as a 22Khz mono stream, which works sorta ok, but is
// a horrible bodge. Any advice on how to change the engine to output mono would be greatly
@@ -914,7 +908,8 @@ void doSoundCallback() {
consolePrintf("doSoundCallback...");
#endif
- if (soundCallback) {
+ if (OSystem_DS::instance())
+ if (OSystem_DS::instance()->getMixerImpl()) {
lastCallbackFrame = frameCount;
for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
@@ -923,7 +918,7 @@ void doSoundCallback() {
if (IPC->fillNeeded[chunk]) {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
- soundCallback(soundParam, (byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
+ OSystem_DS::instance()->getMixerImpl()->mixCallback((byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
}
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index f20442b11e..43258b5c5d 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -88,7 +88,6 @@ int getMillis(); // Return the current runtime in milliseconds
void doTimerCallback(); // Call callback function if required
// Sound
-void setSoundProc(OSystem_DS::SoundProc proc, void* param); // Setup a callback function for sound
void doSoundCallback(); // Call function if sound buffers need more data
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
void stopSound(int channel);
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 6e6b457115..79b0c5390b 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -67,10 +67,12 @@ void OSystem_DS::initBackend() {
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
- _mixer = new DSAudioMixer;
- _timer = new DSTimerManager;
- DS::setSoundProc(Audio::Mixer::mixCallback, _mixer);
- DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+ _mixer = new DSAudioMixer(this);
+ _timer = new DSTimerManager();
+ DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+
+ _mixer->setOutputRate(11025 /*DS::getSoundFrequency()*/);
+ _mixer->setReady(true);
OSystem::initBackend();
}
@@ -139,7 +141,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
green >>= 3;
blue >>= 3;
-// if (r != 255)
+ if (r != 255)
{
BG_PALETTE[r] = red | (green << 5) | (blue << 10);
if (!DS::getKeyboardEnable()) {
@@ -158,13 +160,13 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
- u16* image = (u16 *) DS::get8BitBackBuffer();
+ const u16* image = (const u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
{
DC_FlushRange(image + (y << 8), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++)
{
- *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
+ *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
}
}
@@ -277,7 +279,7 @@ void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
u16* bg = (u16 *) DS::get16BitBackBuffer();
- u16* src = (u16 *) buf;
+ const u16* src = (const u16 *) buf;
// if (x + w > 256) w = 256 - x;
//if (x + h > 256) h = 256 - y;
@@ -433,13 +435,7 @@ void OSystem_DS::unlockMutex(MutexRef mutex) {
void OSystem_DS::deleteMutex(MutexRef mutex) {
}
-void OSystem_DS::clearSoundCallback() {
-// consolePrintf("Clearing sound callback");
-// DS::setSoundProc(NULL, NULL);
-}
-
-int OSystem_DS::getOutputSampleRate() const
-{
+int OSystem_DS::getOutputSampleRate() const {
return DS::getSoundFrequency();
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 246797188f..8c8d661ad8 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -30,10 +30,13 @@
#include "gbampsave.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "graphics/surface.h"
-class DSAudioMixer : public Audio::Mixer {
+class DSAudioMixer : public Audio::MixerImpl {
+
+public:
+ DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { }
};
class DSTimerManager : public DefaultTimerManager {
@@ -62,7 +65,7 @@ protected:
Graphics::Surface* createTempFrameBuffer();
public:
- typedef void (*SoundProc)(void *param, byte *buf, int len);
+ typedef void (*SoundProc)(byte *buf, int len);
typedef int (*TimerProc)(int interval);
OSystem_DS();
@@ -114,7 +117,6 @@ public:
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
- virtual void clearSoundCallback();
virtual int getOutputSampleRate() const;
virtual bool openCD(int drive);
@@ -147,6 +149,8 @@ public:
virtual void unlockScreen();
virtual Audio::Mixer* getMixer() { return _mixer; }
+ Audio::MixerImpl* getMixerImpl() { return _mixer; }
+
virtual Common::TimerManager* getTimerManager() { return _timer; }
static int timerHandler(int t);
diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp
index 9eeeb62410..ff52572a40 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.cpp
+++ b/backends/platform/ds/arm9/source/wordcompletion.cpp
@@ -1,6 +1,6 @@
#include "wordcompletion.h"
-#include "engines/agi/agi.h"
#include "osystem_ds.h"
+#include "engines/agi/agi.h" // Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h
#ifdef ENABLE_AGI
diff --git a/backends/platform/gp2x/build/README-GP2X b/backends/platform/gp2x/build/README-GP2X
index cb1d043500..7e10fc484e 100644
--- a/backends/platform/gp2x/build/README-GP2X
+++ b/backends/platform/gp2x/build/README-GP2X
@@ -1,4 +1,4 @@
-ScummVM - GP2X SPECIFIC README - 0.10.0 SVN
+ScummVM - GP2X SPECIFIC README - HEAD SVN
------------------------------------------------------------------------
Contents:
diff --git a/backends/platform/gp2x/build/README-GP2X.html b/backends/platform/gp2x/build/README-GP2X.html
index 5289d3d36c..1b5f1a4173 100644
--- a/backends/platform/gp2x/build/README-GP2X.html
+++ b/backends/platform/gp2x/build/README-GP2X.html
@@ -2,12 +2,15 @@
<html>
<head>
<title>ScummVM - GP2X SPECIFIC README</title>
+
+
</head>
<body>
-<span style="font-weight: bold;">ScummVM - GP2X&nbsp;SPECIFIC README - 0.10.0 SVN<br>
+<span style="font-weight: bold;">ScummVM -
+GP2X&nbsp;SPECIFIC README - HEAD SVN<br>
</span>
<hr style="width: 100%; height: 2px;"><br>
@@ -16,52 +19,65 @@
<ul>
- <li><a href="#About_the_backendport">About the backend/port</a></li>
+ <li><a href="#About_the_backendport">About the
+backend/port</a></li>
- <li><a href="#Game_compatibility">Game compatability</a></li>
+ <li><a href="#Game_compatibility">Game
+compatability</a></li>
<li><a href="#Included_engines">Included engines</a></li>
- <li><a href="#Supported_audio_options">Supported audio options</a></li>
+ <li><a href="#Supported_audio_options">Supported
+audio options</a></li>
- <li><a href="#Supported_cut-scene_options">Supported cut-scene options</a></li>
+ <li><a href="#Supported_cut-scene_options">Supported
+cut-scene options</a></li>
<li><a href="#Recent_changes">Recent changes</a></li>
<li><a href="#How_to_save">How to save</a></li>
- <li><a href="#Controller_mappings">Controller mappings</a></li>
+ <li><a href="#Controller_mappings">Controller
+mappings</a></li>
<li><a href="#Know_issues">Know issues</a></li>
<li><a href="#Major_TODOs">Major TODO's</a></li>
- <li><a href="#Additional_resourceslinks">Additional resources/links</a></li>
+ <li><a href="#Additional_resourceslinks">Additional
+resources/links</a></li>
<li><a href="#Credits">Credits</a></li>
</ul>
+
<br>
+
<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="About_the_backendport"></a><span style="font-weight: bold;">About the backend/port</span><br>
<br>
-This is the readme for the offficial GP2X ScummVM backend (also known as the GP2X port).<br>
+This is the readme for the offficial GP2X ScummVM backend (also known
+as the GP2X port).<br>
<br>
-This is an SVN test release of ScummVM for the GP2X, it would be appreciated
+This is an SVN test release of ScummVM for the GP2X, it would be
+appreciated
if this SVN test distribution was not mirrored and that people be
-directed to <a href="http://www.distant-earth.com/scummvm">http://www.distant-earth.com/scummvm</a> instead for updated SVN builds.<br>
+directed to <a href="http://www.distant-earth.com/scummvm">http://www.distant-earth.com/scummvm</a>
+instead for updated SVN builds.<br>
<br>
Full supported official releases of the GP2X ScummVM backend are made
-in line with main official releases and are avalalble from the <a href="http://www.scummvm.org/downloads.php">ScummVM downloads page</a>.<br>
+in line with main official releases and are avalalble from the <a href="http://www.scummvm.org/downloads.php">ScummVM
+downloads page</a>.<br>
<br>
-This build is in an active state of development and as such no &lsquo;expected&rsquo; behavior can be guaranteed ;).<br>
+This build is in an active state of development and as such no
+&lsquo;expected&rsquo; behavior can be guaranteed ;).<br>
<br>
@@ -69,47 +85,59 @@ SVN builds are quickly tested with firmware 2.0.0 for reference.<br>
<br>
-Please refer to the <a href="http://forums.scummvm.org/viewforum.php?f=14">GP2X ScummVM forum</a> and <a href="http://wiki.scummvm.org/index.php/GP2X">WiKi</a> for the latest information on the port.<br>
+Please refer to the <a href="http://forums.scummvm.org/viewforum.php?f=14">GP2X
+ScummVM forum</a> and <a href="http://wiki.scummvm.org/index.php/GP2X">WiKi</a>
+for the latest information on the port.<br>
+
<br>
<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Game_compatibility"></a><span style="font-weight: bold;">Game compatibility</span><br>
<br>
-For information on the compatability of a specific game please refer to the <a href="http://wiki.scummvm.org/index.php/GP2X#Compatibility_List">GP2X compatability section of the ScummVM WiKi</a>.<br>
+For information on the compatability of a specific game please refer to
+the <a href="http://wiki.scummvm.org/index.php/GP2X#Compatibility_List">GP2X
+compatability section of the ScummVM WiKi</a>.<br>
<br>
-Please note the version and date of the ScummVM build you are running when reviewing the above list.<br>
+Please note the version and date of the ScummVM build you are running
+when reviewing the above list.<br>
<br>
<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Included_engines"></a><span style="font-weight: bold;">Included engines</span><br>
<br>
+
Just because an engine is included does not mean any/all of its games
are supported. Please check game compatability for more infomation.<br>
+
<ul>
- <li>
-Scumm - (All games supported by ScummVM should work to some extent, using the hardware scalar if needed)</li>
+
+ <li>Scumm - (All games supported by ScummVM should work to some
+extent, using the hardware scalar if needed)</li>
+
<li>AGOS (AKA Simon) - (Simon the Sorcerer one and two).</li>
+
<li>Sky - (Beneath a Steel Sky)</li>
- <li>
-Sword - (Broken Sword 1) - This engine uses the hardware scalar to
+
+ <li>Sword - (Broken Sword 1) - This engine uses the hardware
+scalar to
downsize the graphics to fix on the GP2X. It is NOT very nice to look
at.</li>
- <li>
-Sword2 - (Broken Sword 2) - This engine uses the hardware
+
+ <li>Sword2 - (Broken Sword 2) - This engine uses the hardware
scalar to downsize the graphics to fix on the GP2X. It is NOT very nice
to look at.</li>
- <li>
-Gob - (Goblins one)</li>
- <li>
-Queen - (Flight of the Amazon Queen)</li>
- <li>
-Kyra - (The Legend of Kyrandia)</li>
-</ul>
+ <li>Gob - (Goblins one)</li>
+
+ <li>Queen - (Flight of the Amazon Queen)</li>
+
+ <li>Kyra - (The Legend of Kyrandia)</li>
+
+</ul>
All other game engines are disabled in this release.<br>
@@ -155,13 +183,18 @@ DXA video support will be added as soon as it is stable.<br>
Enabled hardware scalar code.<br>
-Now built using SDL 1.2.9 for the parts of the port that use SDL (some parts now hit the hardware directly).<br>
+Now built using SDL 1.2.9 for the parts of the port that use SDL (some
+parts now hit the hardware directly).<br>
-Enabled new launcher - (Ensure defaulttheme.zip is in the same folder as the executable).<br>
+Enabled new launcher - (Ensure defaulttheme.zip is in the same folder
+as the executable).<br>
-Aspect Ratio Correction can now be disabled &lsquo;per game&rsquo;. When adding a game you can find this option on the GFX tab. <br>
+Aspect Ratio Correction can now be disabled &lsquo;per
+game&rsquo;. When adding a game you can find this option on the GFX
+tab. <br>
-Note: This will cause the game to run with a black border at the bottom as it will be rendered to a 320*200 frame.<br>
+Note: This will cause the game to run with a black border at the bottom
+as it will be rendered to a 320*200 frame.<br>
<br>
@@ -169,7 +202,9 @@ Note: This will cause the game to run with a black border at the bottom as it wi
<br>
-<span style="font-weight: bold;">NOTE:</span> Everything is saved to the SD card, saves are stored in the <span style="font-weight: bold;">saves</span> folder under your main ScummVM executable unless you set another save location.<br>
+<span style="font-weight: bold;">NOTE:</span>
+Everything is saved to the SD card, saves are stored in the <span style="font-weight: bold;">saves</span> folder under
+your main ScummVM executable unless you set another save location.<br>
<br>
@@ -178,7 +213,8 @@ same place as the ScummVM executable.<br>
<br>
-The save process below is&nbsp;for Scumm engine games but the principle is the same for all.<br>
+The save process below is&nbsp;for Scumm engine games but the
+principle is the same for all.<br>
<br>
@@ -198,11 +234,13 @@ In Game.<br>
<br>
-Basically the emulated keys you can use are equivelent to the values buttons are mapped to, <br>
+Basically the emulated keys you can use are equivelent to the values
+buttons are mapped to, <br>
<br>
-I have a virtual keyboard like the GP32 one (left/right on the stick to pick chars) to add in at some point ;-)<br>
+I have a virtual keyboard like the GP32 one (left/right on the stick to
+pick chars) to add in at some point ;-)<br>
<br>
@@ -262,9 +300,11 @@ Select: Exit ScummVM completely (and gracefully)<br>
<br>
-Possible random crash (well SegFault). I have had this happen twice and have not tracked down the cause. <br>
+Possible random crash (well SegFault). I have had this happen twice and
+have not tracked down the cause. <br>
-It happens very infrequently, both times it was in the DOTT CD intro. Saving often is never a bad idea anyhow.<br>
+It happens very infrequently, both times it was in the DOTT CD intro.
+Saving often is never a bad idea anyhow.<br>
<br>
@@ -272,11 +312,14 @@ It happens very infrequently, both times it was in the DOTT CD intro. Saving oft
<br>
-Fix save support when using the Sky engine (Beneath a Steel Sky) - You CAN'T save at the moment but auto save works.<br>
+Fix save support when using the Sky engine (Beneath a Steel Sky) - You
+CAN'T save at the moment but auto save works.<br>
-Look into inconsistencies with AGOS engine and map Y key to a button combination to allow clean quitting (Simon 1/2).<br>
+Look into inconsistencies with AGOS engine and map Y key to a button
+combination to allow clean quitting (Simon 1/2).<br>
-Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings etc.) - Partly done.<br>
+Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings
+etc.) - Partly done.<br>
Fix TV out, maybe make it an option in the pre-ScummVM config menu.<br>
@@ -284,17 +327,29 @@ Any help appreciated :).<br>
<br style="font-weight: bold;">
-<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Additional_resourceslinks"></a><span style="font-weight: bold;">Additional resources/links</span><br>
+<hr style="width: 100%; height: 2px;"><a style="font-weight: bold;" name="Additional_resourceslinks"></a><span style="font-weight: bold;">Additional resources/links<br>
+
+<br>
+
+</span><span style="font-weight: bold;">Note:</span>
+When providing feedback,
+requests, forum posts, bug reports or anything like that always include
+a mention of the version of ScummVM you are using (the build version,
+date and time can be seen in the main game launcher window).<br>
<ul>
- <li><a href="http://wiki.scummvm.org/index.php/GP2X">ScummVM WiKi GP2X page</a></li>
+ <li><a href="http://wiki.scummvm.org/index.php/GP2X">ScummVM
+WiKi GP2X page</a></li>
- <li><a href="http://forums.scummvm.org/viewforum.php?f=14">ScummVM forums GP2X forum</a></li>
+ <li><a href="http://forums.scummvm.org/viewforum.php?f=14">ScummVM
+forums GP2X forum</a></li>
- <li><a href="http://www.distant-earth.com/scummvm">My own ScummVM page</a> (for SVN/test builds)</li>
+ <li><a href="http://www.distant-earth.com/scummvm">My
+own ScummVM page</a> (for SVN/test builds)</li>
- <li><a href="http://www.scummvm.org">Main ScummVM site</a> (for official supported release builds)</li>
+ <li><a href="http://www.scummvm.org">Main ScummVM
+site</a> (for official supported release builds)</li>
</ul>
diff --git a/backends/platform/gp2x/build/build.sh b/backends/platform/gp2x/build/build.sh
index 1ea77f4937..1ea77f4937 100644..100755
--- a/backends/platform/gp2x/build/build.sh
+++ b/backends/platform/gp2x/build/build.sh
diff --git a/backends/platform/gp2x/build/bundle.sh b/backends/platform/gp2x/build/bundle.sh
index 9824c9b451..9824c9b451 100644..100755
--- a/backends/platform/gp2x/build/bundle.sh
+++ b/backends/platform/gp2x/build/bundle.sh
diff --git a/backends/platform/gp2x/build/clean.sh b/backends/platform/gp2x/build/clean.sh
index 0979f6c7d6..0979f6c7d6 100644..100755
--- a/backends/platform/gp2x/build/clean.sh
+++ b/backends/platform/gp2x/build/clean.sh
diff --git a/backends/platform/gp2x/build/config.sh b/backends/platform/gp2x/build/config.sh
index 4a30ed4a31..17083d1ea4 100644..100755
--- a/backends/platform/gp2x/build/config.sh
+++ b/backends/platform/gp2x/build/config.sh
@@ -17,7 +17,7 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6
-#--enable-plugins
+./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-made --enable-m4
+#--enable-plugins --default-dynamic
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gp2x/build/scummvm.gpe b/backends/platform/gp2x/build/scummvm.gpe
index 1e69c149b9..1e69c149b9 100644..100755
--- a/backends/platform/gp2x/build/scummvm.gpe
+++ b/backends/platform/gp2x/build/scummvm.gpe
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
index e8e128a249..92f625bdc4 100644
--- a/backends/platform/gp2x/gp2x-common.h
+++ b/backends/platform/gp2x/gp2x-common.h
@@ -37,7 +37,7 @@
#include <SDL_gp2x.h>
namespace Audio {
- class Mixer;
+ class MixerImpl;
}
namespace Common {
@@ -128,12 +128,10 @@ public:
virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
// Set function that generates samples
- typedef void (*SoundProc)(void *param, byte *buf, int len);
- virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
+ void setupMixer();
+ static void mixCallback(void *s, byte *samples, int len);
virtual Audio::Mixer *getMixer();
- void clearSoundCallback();
-
// Poll CD status
// Returns true if cd audio is playing
bool pollCD();
@@ -181,7 +179,6 @@ public:
int getGraphicsMode() const;
bool openCD(int drive);
- int getOutputSampleRate() const;
bool hasFeature(Feature f);
void setFeatureState(Feature f, bool enable);
@@ -369,7 +366,7 @@ protected:
Common::SaveFileManager *_savefile;
FilesystemFactory *getFilesystemFactory();
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
SDL_TimerID _timerID;
Common::TimerManager *_timer;
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
index 2d2b4b8078..c138f6c54d 100644
--- a/backends/platform/gp2x/gp2x.cpp
+++ b/backends/platform/gp2x/gp2x.cpp
@@ -40,7 +40,7 @@
#include "backends/timer/default/default-timer.h"
#include "backends/plugins/posix/posix-provider.h"
#include "backends/fs/posix/posix-fs-factory.h" // for getFilesystemFactory()
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include <stdio.h>
#include <stdlib.h>
@@ -225,8 +225,7 @@ void OSystem_GP2X::initBackend() {
// Create and hook up the mixer, if none exists yet (we check for this to
// allow subclasses to provide their own).
if (_mixer == 0) {
- _mixer = new Audio::Mixer();
- setSoundCallback(Audio::Mixer::mixCallback, _mixer);
+ setupMixer();
}
// Create and hook up the timer manager, if none exists yet (we check for
@@ -445,45 +444,69 @@ void OSystem_GP2X::deleteMutex(MutexRef mutex) {
#pragma mark --- Audio ---
#pragma mark -
-bool OSystem_GP2X::setSoundCallback(SoundProc proc, void *param) {
+void OSystem_GP2X::mixCallback(void *sys, byte *samples, int len) {
+ OSystem_GP2X *this_ = (OSystem_GP2X *)sys;
+ assert(this_);
+
+ if (this_->_mixer)
+ this_->_mixer->mixCallback(samples, len);
+}
+
+void OSystem_GP2X::setupMixer() {
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
- memset(&desired, 0, sizeof(desired));
+ //memset(&desired, 0, sizeof(desired));
+ // Determine the desired output sampling frequency.
_samplesPerSec = 0;
-
if (ConfMan.hasKey("output_rate"))
_samplesPerSec = ConfMan.getInt("output_rate");
-
if (_samplesPerSec <= 0)
_samplesPerSec = SAMPLES_PER_SEC;
+
//Quick EVIL Hack - DJWillis
_samplesPerSec = 11025;
+ // Determine the sample buffer size. We want it to store enough data for
+ // about 1/16th of a second. Note that it must be a power of two.
+ // So e.g. at 22050 Hz, we request a sample buffer size of 2048.
+ int samples = 8192;
+ while (16 * samples >= _samplesPerSec) {
+ samples >>= 1;
+ }
+
+ memset(&desired, 0, sizeof(desired));
desired.freq = _samplesPerSec;
desired.format = AUDIO_S16SYS;
desired.channels = 2;
//desired.samples = (uint16)samples;
desired.samples = 128; // Samples hack
- desired.callback = proc;
- desired.userdata = param;
+ desired.callback = mixCallback;
+ desired.userdata = this;
+
+ // Create the mixer instance
+ assert(!_mixer);
+ _mixer = new Audio::MixerImpl(this);
+ assert(_mixer);
+
if (SDL_OpenAudio(&desired, &obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
- return false;
+ _samplesPerSec = 0;
+ _mixer->setReady(false);
+ } else {
+ // Note: This should be the obtained output rate, but it seems that at
+ // least on some platforms SDL will lie and claim it did get the rate
+ // even if it didn't. Probably only happens for "weird" rates, though.
+ _samplesPerSec = obtained.freq;
+ debug(1, "Output sample rate: %d Hz", _samplesPerSec);
+
+ // Tell the mixer that we are ready and start the sound processing
+ _mixer->setOutputRate(_samplesPerSec);
+ _mixer->setReady(true);
+ SDL_PauseAudio(0);
}
- _samplesPerSec = obtained.freq;
- SDL_PauseAudio(0);
- return true;
-}
-
-void OSystem_GP2X::clearSoundCallback() {
- SDL_CloseAudio();
-}
-
-int OSystem_GP2X::getOutputSampleRate() const {
- return _samplesPerSec;
}
Audio::Mixer *OSystem_GP2X::getMixer() {
diff --git a/backends/platform/iphone/blit_arm.s b/backends/platform/iphone/blit_arm.s
index ae31fdcce4..417f3741cf 100644
--- a/backends/platform/iphone/blit_arm.s
+++ b/backends/platform/iphone/blit_arm.s
@@ -36,47 +36,47 @@ _blitLandscapeScreenRect16bpp:
@ r3 = h
@ <> = _screenWidth
@ <> = _screenHeight
- MOV r12,r13
- STMFD r13!,{r4-r11,r14}
- LDMFD r12,{r12,r14} @ r12 = _screenWidth
+ mov r12,r13
+ stmfd r13!,{r4-r11,r14}
+ ldmfd r12,{r12,r14} @ r12 = _screenWidth
@ r14 = _screenHeight
- ADD r14,r14,r3 @ r14 = _screenHeight + h
- MVN r11,#0
- MLA r11,r3,r12,r11 @ r11= _screenWidth*h-1
- ADD r12,r12,r12
+ add r14,r14,r3 @ r14 = _screenHeight + h
+ mvn r11,#0
+ mla r11,r3,r12,r11 @ r11= _screenWidth*h-1
+ add r12,r12,r12
xloop:
- SUBS r4,r3,#5 @ r4 = y = h
- BLE thin
+ subs r4,r3,#5 @ r4 = y = h
+ ble thin
yloop:
- LDRH r5, [r1],r12 @ r5 = *src src += _screenWidth
- LDRH r6, [r1],r12 @ r6 = *src src += _screenWidth
- LDRH r7, [r1],r12 @ r7 = *src src += _screenWidth
- LDRH r8, [r1],r12 @ r8 = *src src += _screenWidth
- LDRH r9, [r1],r12 @ r9 = *src src += _screenWidth
- LDRH r10,[r1],r12 @ r10= *src src += _screenWidth
- SUBS r4,r4,#6
- STRH r5, [r0],#2 @ *dst++ = r5
- STRH r6, [r0],#2 @ *dst++ = r6
- STRH r7, [r0],#2 @ *dst++ = r7
- STRH r8, [r0],#2 @ *dst++ = r8
- STRH r9, [r0],#2 @ *dst++ = r9
- STRH r10,[r0],#2 @ *dst++ = r10
- BGT yloop
+ ldrh r5, [r1],r12 @ r5 = *src src += _screenWidth
+ ldrh r6, [r1],r12 @ r6 = *src src += _screenWidth
+ ldrh r7, [r1],r12 @ r7 = *src src += _screenWidth
+ ldrh r8, [r1],r12 @ r8 = *src src += _screenWidth
+ ldrh r9, [r1],r12 @ r9 = *src src += _screenWidth
+ ldrh r10,[r1],r12 @ r10= *src src += _screenWidth
+ subs r4,r4,#6
+ strh r5, [r0],#2 @ *dst++ = r5
+ strh r6, [r0],#2 @ *dst++ = r6
+ strh r7, [r0],#2 @ *dst++ = r7
+ strh r8, [r0],#2 @ *dst++ = r8
+ strh r9, [r0],#2 @ *dst++ = r9
+ strh r10,[r0],#2 @ *dst++ = r10
+ bgt yloop
thin:
- ADDS r4,r4,#5
- BEQ lineend
+ adds r4,r4,#5
+ beq lineend
thin_loop:
- LDRH r5,[r1],r12 @ r5 = *src src += _screenWidth
- SUBS r4,r4,#1
- STRH r5,[r0],#2 @ *dst++ = r5
- BGT thin_loop
+ ldrh r5,[r1],r12 @ r5 = *src src += _screenWidth
+ subs r4,r4,#1
+ strh r5,[r0],#2 @ *dst++ = r5
+ bgt thin_loop
lineend:
- SUB r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
- SUB r1,r1,r11,LSL #1 @ src += 1-_screenWidth*h
- SUBS r2,r2,#1
- BGT xloop
+ sub r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
+ sub r1,r1,r11,LSL #1 @ src += 1-_screenWidth*h
+ subs r2,r2,#1
+ bgt xloop
- LDMFD r13!,{r4-r11,PC}
+ ldmfd r13!,{r4-r11,PC}
_blitLandscapeScreenRect8bpp:
@ r0 = dst
@@ -86,55 +86,55 @@ _blitLandscapeScreenRect8bpp:
@ <> = _palette
@ <> = _screenWidth
@ <> = _screenHeight
- MOV r12,r13
- STMFD r13!,{r4-r11,r14}
- LDMFD r12,{r11,r12,r14} @ r11 = _palette
+ mov r12,r13
+ stmfd r13!,{r4-r11,r14}
+ ldmfd r12,{r11,r12,r14} @ r11 = _palette
@ r12 = _screenWidth
@ r14 = _screenHeight
- ADD r14,r14,r3 @ r14 = _screenHeight + h
- MVN r6,#0
- MLA r6,r3,r12,r6 @ r6 = _screenWidth*h-1
+ add r14,r14,r3 @ r14 = _screenHeight + h
+ mvn r6,#0
+ mla r6,r3,r12,r6 @ r6 = _screenWidth*h-1
xloop8:
- MOV r4,r3 @ r4 = y = h
- SUBS r4,r3,#4 @ r4 = y = h
- BLE thin8
+ mov r4,r3 @ r4 = y = h
+ subs r4,r3,#4 @ r4 = y = h
+ ble thin8
yloop8:
- LDRB r5, [r1],r12 @ r5 = *src src += _screenWidth
- LDRB r7, [r1],r12 @ r7 = *src src += _screenWidth
- LDRB r8, [r1],r12 @ r8 = *src src += _screenWidth
- LDRB r9, [r1],r12 @ r9 = *src src += _screenWidth
- LDRB r10,[r1],r12 @ r10= *src src += _screenWidth
- ADD r5, r5, r5
- ADD r7, r7, r7
- ADD r8, r8, r8
- ADD r9, r9, r9
- ADD r10,r10,r10
- LDRH r5, [r11,r5]
- LDRH r7, [r11,r7]
- LDRH r8, [r11,r8]
- LDRH r9, [r11,r9]
- LDRH r10,[r11,r10]
- SUBS r4,r4,#5
- STRH r5, [r0],#2 @ *dst++ = r5
- STRH r7, [r0],#2 @ *dst++ = r7
- STRH r8, [r0],#2 @ *dst++ = r8
- STRH r9, [r0],#2 @ *dst++ = r9
- STRH r10,[r0],#2 @ *dst++ = r10
- BGT yloop8
+ ldrb r5, [r1],r12 @ r5 = *src src += _screenWidth
+ ldrb r7, [r1],r12 @ r7 = *src src += _screenWidth
+ ldrb r8, [r1],r12 @ r8 = *src src += _screenWidth
+ ldrb r9, [r1],r12 @ r9 = *src src += _screenWidth
+ ldrb r10,[r1],r12 @ r10= *src src += _screenWidth
+ add r5, r5, r5
+ add r7, r7, r7
+ add r8, r8, r8
+ add r9, r9, r9
+ add r10,r10,r10
+ ldrh r5, [r11,r5]
+ ldrh r7, [r11,r7]
+ ldrh r8, [r11,r8]
+ ldrh r9, [r11,r9]
+ ldrh r10,[r11,r10]
+ subs r4,r4,#5
+ strh r5, [r0],#2 @ *dst++ = r5
+ strh r7, [r0],#2 @ *dst++ = r7
+ strh r8, [r0],#2 @ *dst++ = r8
+ strh r9, [r0],#2 @ *dst++ = r9
+ strh r10,[r0],#2 @ *dst++ = r10
+ bgt yloop8
thin8:
- ADDS r4,r4,#4
- BEQ lineend8
+ adds r4,r4,#4
+ beq lineend8
thin_loop8:
- LDRB r5,[r1],r12 @ r5 = *src src += _screenWidth
- ADD r5,r5,r5
- LDRH r5,[r11,r5]
- SUBS r4,r4,#1
- STRH r5,[r0],#2 @ *dst++ = r5
- BGT thin_loop8
+ ldrb r5,[r1],r12 @ r5 = *src src += _screenWidth
+ add r5,r5,r5
+ ldrh r5,[r11,r5]
+ subs r4,r4,#1
+ strh r5,[r0],#2 @ *dst++ = r5
+ bgt thin_loop8
lineend8:
- SUB r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
- SUB r1,r1,r6 @ src += 1-_screenWidth*h
- SUBS r2,r2,#1
- BGT xloop8
+ sub r0,r0,r14,LSL #1 @ dst -= _screenHeight + h
+ sub r1,r1,r6 @ src += 1-_screenWidth*h
+ subs r2,r2,#1
+ bgt xloop8
- LDMFD r13!,{r4-r11,PC}
+ ldmfd r13!,{r4-r11,PC}
diff --git a/backends/platform/iphone/iphone_keyboard.h b/backends/platform/iphone/iphone_keyboard.h
index 17a3836efd..6d381d561d 100644
--- a/backends/platform/iphone/iphone_keyboard.h
+++ b/backends/platform/iphone/iphone_keyboard.h
@@ -26,11 +26,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UITextView.h>
-@protocol KeyboardInputProtocol
-- (void)handleKeyPress:(unichar)c;
-@end
-
-@interface SoftKeyboard : UIKeyboard<KeyboardInputProtocol> {
+@interface SoftKeyboard : UIView {
id inputDelegate;
UITextView* inputView;
}
diff --git a/backends/platform/iphone/iphone_keyboard.m b/backends/platform/iphone/iphone_keyboard.m
index dc2d417746..bd4948e30a 100644
--- a/backends/platform/iphone/iphone_keyboard.m
+++ b/backends/platform/iphone/iphone_keyboard.m
@@ -25,19 +25,6 @@
#import "iphone_keyboard.h"
-// Override settings of the default keyboard implementation
-@implementation UIKeyboardImpl (DisableFeatures)
-
-- (BOOL)autoCapitalizationPreference {
- return false;
-}
-
-- (BOOL)autoCorrectionPreference {
- return false;
-}
-
-@end
-
@implementation TextInputHandler
- (id)initWithKeyboard:(SoftKeyboard*)keyboard; {
@@ -67,7 +54,8 @@
@implementation SoftKeyboard
- (id)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
+ //self = [super initWithFrame:frame];
+ self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
inputDelegate = nil;
inputView = [[TextInputHandler alloc] initWithKeyboard:self];
return self;
diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m
index f7f5667bb5..b01e9f3f34 100644
--- a/backends/platform/iphone/iphone_main.m
+++ b/backends/platform/iphone/iphone_main.m
@@ -46,9 +46,14 @@ int main(int argc, char** argv) {
gArgc = argc;
gArgv = argv;
- [[NSAutoreleasePool alloc] init];
-
- return UIApplicationMain(argc, argv, [iPhoneMain class]);
+ NSAutoreleasePool *autoreleasePool = [
+ [ NSAutoreleasePool alloc ] init
+ ];
+
+ UIApplicationUseLegacyEvents(1);
+ int returnCode = UIApplicationMain(argc, argv, [iPhoneMain class]);
+ [ autoreleasePool release ];
+ return returnCode;
}
@implementation iPhoneMain
@@ -74,7 +79,10 @@ int main(int argc, char** argv) {
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// hide the status bar
[UIHardware _setStatusBarHeight:0.0f];
- [self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0];
+ //[self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0];
+
+ //[self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
+ [self setStatusBarHidden:YES animated:YES];
_window = [[UIWindow alloc] initWithContentRect: [UIHardware fullScreenApplicationContentRect]];
[_window retain];
@@ -96,7 +104,7 @@ int main(int argc, char** argv) {
- (void)applicationResume:(GSEventRef)event {
[self removeApplicationBadge];
[UIHardware _setStatusBarHeight:0.0f];
- [self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0];
+ [self setStatusBarHidden:YES animated:YES];
[_view applicationResume];
}
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 615b2e5345..6e4b446926 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -27,12 +27,11 @@
#define _IPHONE_VIDEO__H
#import <UIKit/UIKit.h>
-#import <UIKit/UIView-Geometry.h>
#import <GraphicsServices/GraphicsServices.h>
#import <Foundation/Foundation.h>
#import <CoreSurface/CoreSurface.h>
-#import <LayerKit/LKLayer.h>
+#import <QuartzCore/QuartzCore.h>
#import "iphone_keyboard.h"
@interface iPhoneView : UIView
@@ -41,7 +40,7 @@
NSMutableArray* _events;
NSLock* _lock;
SoftKeyboard* _keyboardView;
- LKLayer* _screenLayer;
+ CALayer* _screenLayer;
int _fullWidth;
int _fullHeight;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 6c6944045e..89f159c1d9 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -31,8 +31,8 @@
#import <GraphicsServices/GraphicsServices.h>
#import <Foundation/Foundation.h>
#import <CoreSurface/CoreSurface.h>
-#import <LayerKit/LKLayer.h>
#import <UIKit/UIKeyboardLayoutQWERTY.h>
+#import <QuartzCore/QuartzCore.h>
static iPhoneView *sharedInstance = nil;
static int _width = 0;
@@ -53,8 +53,8 @@ void iPhone_updateScreen() {
}
void iPhone_updateScreenRect(int x1, int y1, int x2, int y2) {
- NSRect rect = NSMakeRect(x1, y1, x2, y2);
- [sharedInstance performSelectorOnMainThread:@selector(updateScreenRect:) withObject: [NSValue valueWithRect:rect] waitUntilDone: NO];
+ //CGRect rect = CGRectMake(x1, y1, x2, y2);
+ //[sharedInstance performSelectorOnMainThread:@selector(updateScreenRect:) withObject: [NSValue valueWithRect:rect] waitUntilDone: NO];
}
void iPhone_lockSurface() {
@@ -146,9 +146,9 @@ bool getLocalMouseCoords(CGPoint *point) {
}
- (void)updateScreenRect:(id)rect {
- NSRect nsRect = [rect rectValue];
- CGRect cgRect = CGRectMake(nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height);
- [sharedInstance setNeedsDisplayInRect: cgRect];
+ // NSRect nsRect = [rect rectValue];
+ // CGRect cgRect = CGRectMake(nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height);
+ // [sharedInstance setNeedsDisplayInRect: cgRect];
}
- (void)initSurface {
@@ -178,7 +178,7 @@ bool getLocalMouseCoords(CGPoint *point) {
//printf("Surface created.\n");
CoreSurfaceBufferLock(_screenSurface, 3);
- LKLayer* screenLayer = [[LKLayer layer] retain];
+ CALayer* screenLayer = [[CALayer layer] retain];
if (_keyboardView != nil) {
[_keyboardView removeFromSuperview];
@@ -213,7 +213,7 @@ bool getLocalMouseCoords(CGPoint *point) {
_keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];
[_keyboardView setInputDelegate:self];
}
-
+
[self addSubview:[_keyboardView inputView]];
[self addSubview: _keyboardView];
[[_keyboardView inputView] becomeFirstResponder];
@@ -283,11 +283,13 @@ bool getLocalMouseCoords(CGPoint *point) {
}
- (void)mouseDown:(GSEvent*)event {
- struct CGPoint point = GSEventGetLocationInWindow(event);
-
+ //printf("mouseDown()\n");
+ CGRect rect = GSEventGetLocationInWindow(event);
+ CGPoint point = CGPointMake(rect.origin.x, rect.origin.y);
+
if (!getLocalMouseCoords(&point))
return;
-
+
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseDown], @"type",
@@ -298,12 +300,18 @@ bool getLocalMouseCoords(CGPoint *point) {
];
}
+- (void)touchesBegan {
+ //printf("touchesBegan()\n");
+}
+
- (void)mouseUp:(GSEvent*)event {
- struct CGPoint point = GSEventGetLocationInWindow(event);
-
+ //printf("mouseUp()\n");
+ CGRect rect = GSEventGetLocationInWindow(event);
+ CGPoint point = CGPointMake(rect.origin.x, rect.origin.y);
+
if (!getLocalMouseCoords(&point))
return;
-
+
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseUp], @"type",
@@ -316,11 +324,12 @@ bool getLocalMouseCoords(CGPoint *point) {
- (void)mouseDragged:(GSEvent*)event {
//printf("mouseDragged()\n");
- struct CGPoint point = GSEventGetLocationInWindow(event);
-
+ CGRect rect = GSEventGetLocationInWindow(event);
+ CGPoint point = CGPointMake(rect.origin.x, rect.origin.y);
+
if (!getLocalMouseCoords(&point))
return;
-
+
[self addEvent:
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:kInputMouseDragged], @"type",
@@ -333,19 +342,21 @@ bool getLocalMouseCoords(CGPoint *point) {
- (void)mouseEntered:(GSEvent*)event {
//printf("mouseEntered()\n");
- // struct CGPoint point = GSEventGetLocationInWindow(event);
- //
- // if (!getLocalMouseCoords(&point))
- // return;
- //
- // [self addEvent:
- // [[NSDictionary alloc] initWithObjectsAndKeys:
- // [NSNumber numberWithInt:kInputMouseSecondToggled], @"type",
- // [NSNumber numberWithFloat:point.x], @"x",
- // [NSNumber numberWithFloat:point.y], @"y",
- // nil
- // ]
- // ];
+ CGRect rect = GSEventGetLocationInWindow(event);
+ CGPoint point = CGPointMake(rect.origin.x, rect.origin.y);
+
+
+ if (!getLocalMouseCoords(&point))
+ return;
+
+ [self addEvent:
+ [[NSDictionary alloc] initWithObjectsAndKeys:
+ [NSNumber numberWithInt:kInputMouseSecondToggled], @"type",
+ [NSNumber numberWithFloat:point.x], @"x",
+ [NSNumber numberWithFloat:point.y], @"y",
+ nil
+ ]
+ ];
}
- (void)mouseExited:(GSEvent*)event {
@@ -361,19 +372,19 @@ bool getLocalMouseCoords(CGPoint *point) {
- (void)mouseMoved:(GSEvent*)event
{
//printf("mouseMoved()\n");
- struct CGPoint point = GSEventGetLocationInWindow(event);
-
- if (!getLocalMouseCoords(&point))
- return;
-
- [self addEvent:
- [[NSDictionary alloc] initWithObjectsAndKeys:
- [NSNumber numberWithInt:kInputMouseSecondToggled], @"type",
- [NSNumber numberWithFloat:point.x], @"x",
- [NSNumber numberWithFloat:point.y], @"y",
- nil
- ]
- ];
+ // struct CGPoint point = GSEventGetLocationInWindow(event);
+ //
+ // if (!getLocalMouseCoords(&point))
+ // return;
+ //
+ // [self addEvent:
+ // [[NSDictionary alloc] initWithObjectsAndKeys:
+ // [NSNumber numberWithInt:kInputMouseSecondToggled], @"type",
+ // [NSNumber numberWithFloat:point.x], @"x",
+ // [NSNumber numberWithFloat:point.y], @"y",
+ // nil
+ // ]
+ // ];
}
- (void)handleKeyPress:(unichar)c {
@@ -391,7 +402,7 @@ bool getLocalMouseCoords(CGPoint *point) {
return TRUE;
}
-- (int)swipe:(UIViewSwipeDirection)num withEvent:(GSEvent*)event {
+- (int)swipe:(int)num withEvent:(GSEvent*)event {
//printf("swipe: %i\n", num);
[self addEvent:
diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp
index 3365c2da9d..fdef911d0a 100644
--- a/backends/platform/iphone/osys_iphone.cpp
+++ b/backends/platform/iphone/osys_iphone.cpp
@@ -25,8 +25,6 @@
#if defined(IPHONE_BACKEND)
-#include <CoreGraphics/CGDirectDisplay.h>
-#include <CoreSurface/CoreSurface.h>
#include <unistd.h>
#include <pthread.h>
@@ -41,10 +39,15 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "gui/message.h"
#include "osys_iphone.h"
#include "blit_arm.h"
+#include <sys/time.h>
+
+#include <CoreGraphics/CGDirectDisplay.h>
+#include <CoreSurface/CoreSurface.h>
const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = {
{0, 0, 0}
@@ -86,12 +89,12 @@ int OSystem_IPHONE::timerHandler(int t) {
void OSystem_IPHONE::initBackend() {
_savefile = new DefaultSaveFileManager();
- _mixer = new Audio::Mixer();
_timer = new DefaultTimerManager();
gettimeofday(&_startTime, NULL);
- setSoundCallback(Audio::Mixer::mixCallback, _mixer);
+ setupMixer();
+
setTimerCallback(&OSystem_IPHONE::timerHandler, 10);
OSystem::initBackend();
@@ -871,7 +874,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
suspendLoop();
break;
- case kInputKeyPressed:
+ case kInputKeyPressed: {
int keyPressed = (int)xUnit;
int ascii = keyPressed;
//printf("key: %i\n", keyPressed);
@@ -932,6 +935,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii;
_needEventRestPeriod = true;
break;
+ }
case kInputSwipe: {
Common::KeyCode keycode = Common::KEYCODE_INVALID;
@@ -1088,10 +1092,21 @@ void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBuf
AudioQueueStop(s_AudioQueue.queue, false);
}
-bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {
+void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) {
+ OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys;
+ assert(this_);
+
+ if (this_->_mixer)
+ this_->_mixer->mixCallback(samples, len);
+}
+
+void OSystem_IPHONE::setupMixer() {
//printf("setSoundCallback()\n");
- s_soundCallback = proc;
- s_soundParam = param;
+ _mixer = new Audio::MixerImpl(this);
+
+ s_soundCallback = mixCallback;
+ s_soundParam = this;
+
s_AudioQueue.dataFormat.mSampleRate = AUDIO_SAMPLE_RATE;
s_AudioQueue.dataFormat.mFormatID = kAudioFormatLinearPCM;
@@ -1105,7 +1120,8 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {
if (AudioQueueNewOutput(&s_AudioQueue.dataFormat, AQBufferCallback, &s_AudioQueue, 0, kCFRunLoopCommonModes, 0, &s_AudioQueue.queue)) {
printf("Couldn't set the AudioQueue callback!\n");
- return false;
+ _mixer->setReady(false);
+ return;
}
uint32 bufferBytes = s_AudioQueue.frameCount * s_AudioQueue.dataFormat.mBytesPerFrame;
@@ -1113,7 +1129,8 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {
for (int i = 0; i < AUDIO_BUFFERS; i++) {
if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) {
printf("Error allocating AudioQueue buffer!\n");
- return false;
+ _mixer->setReady(false);
+ return;
}
AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]);
@@ -1122,14 +1139,12 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {
AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0);
if (AudioQueueStart(s_AudioQueue.queue, NULL)) {
printf("Error starting the AudioQueue!\n");
- return false;
+ _mixer->setReady(false);
+ return;
}
-
- return true;
-}
-
-void OSystem_IPHONE::clearSoundCallback() {
- debug("clearSoundCallback()\n");
+
+ _mixer->setOutputRate(AUDIO_SAMPLE_RATE);
+ _mixer->setReady(true);
}
int OSystem_IPHONE::getOutputSampleRate() const {
@@ -1150,6 +1165,11 @@ void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) {
void OSystem_IPHONE::quit() {
}
+void OSystem_IPHONE::getTimeAndDate(struct tm &t) const {
+ time_t curTime = time(0);
+ t = *localtime(&curTime);
+}
+
void OSystem_IPHONE::setWindowCaption(const char *caption) {
}
@@ -1173,17 +1193,11 @@ OSystem *OSystem_IPHONE_create() {
}
const char* OSystem_IPHONE::getConfigPath() {
- if (s_is113OrHigher)
- return SCUMMVM_PREFS_PATH;
- else
- return SCUMMVM_OLD_PREFS_PATH;
+ return SCUMMVM_PREFS_PATH;
}
const char* OSystem_IPHONE::getSavePath() {
- if (s_is113OrHigher)
- return SCUMMVM_SAVE_PATH;
- else
- return SCUMMVM_OLD_SAVE_PATH;
+ return SCUMMVM_SAVE_PATH;
}
void OSystem_IPHONE::migrateApp() {
@@ -1197,7 +1211,7 @@ void OSystem_IPHONE::migrateApp() {
if (!file.exists()) {
system("mkdir " SCUMMVM_ROOT_PATH);
system("mkdir " SCUMMVM_SAVE_PATH);
-
+
// Copy over the prefs file
system("cp " SCUMMVM_OLD_PREFS_PATH " " SCUMMVM_PREFS_PATH);
@@ -1211,24 +1225,24 @@ void OSystem_IPHONE::migrateApp() {
void iphone_main(int argc, char *argv[]) {
- OSystem_IPHONE::migrateApp();
-
- // Redirect stdout and stderr if we're launching from the Springboard.
- if (argc == 2 && strcmp(argv[1], "--launchedFromSB") == 0) {
- FILE *newfp = fopen("/tmp/scummvm.log", "a");
- if (newfp != NULL) {
- fclose(stdout);
- fclose(stderr);
- *stdout = *newfp;
- *stderr = *newfp;
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- //extern int gDebugLevel;
- //gDebugLevel = 10;
- }
+ //OSystem_IPHONE::migrateApp();
+
+ FILE *newfp = fopen("/var/mobile/.scummvm.log", "a");
+ if (newfp != NULL) {
+ fclose(stdout);
+ fclose(stderr);
+ *stdout = *newfp;
+ *stderr = *newfp;
+ setbuf(stdout, NULL);
+ setbuf(stderr, NULL);
+
+ //extern int gDebugLevel;
+ //gDebugLevel = 10;
}
+ system("mkdir " SCUMMVM_ROOT_PATH);
+ system("mkdir " SCUMMVM_SAVE_PATH);
+
g_system = OSystem_IPHONE_create();
assert(g_system);
diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h
index 71272b73fe..af883a62c9 100644
--- a/backends/platform/iphone/osys_iphone.h
+++ b/backends/platform/iphone/osys_iphone.h
@@ -29,6 +29,8 @@
#include "iphone_common.h"
#include "common/system.h"
#include "common/events.h"
+#include "sound/mixer_intern.h"
+#include "backends/fs/posix/posix-fs-factory.h"
#include <AudioToolbox/AudioQueue.h>
@@ -62,7 +64,7 @@ protected:
static bool s_is113OrHigher;
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
Common::TimerManager *_timer;
Graphics::Surface _framebuffer;
@@ -152,13 +154,16 @@ public:
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
- virtual bool setSoundCallback(SoundProc proc, void *param);
- virtual void clearSoundCallback();
+ static void mixCallback(void *sys, byte *samples, int len);
+ virtual void setupMixer(void);
virtual int getOutputSampleRate() const;
virtual void setTimerCallback(TimerProc callback, int interval);
virtual void quit();
+ FilesystemFactory *getFilesystemFactory() { return &POSIXFilesystemFactory::instance(); }
+ virtual void getTimeAndDate(struct tm &t) const;
+
virtual void setWindowCaption(const char *caption);
virtual Common::SaveFileManager *getSavefileManager();
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 194a7b6889..463e9d7b2d 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -28,18 +28,37 @@
#if defined(USE_NULL_DRIVER)
+#ifdef UNIX
+#include <unistd.h>
+#include <sys/time.h>
+#endif
+
#include "common/rect.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
+
+/*
+ * Include header files needed for the getFilesystemFactory() method.
+ */
+#if defined(__amigaos4__)
+ #include "backends/fs/amigaos4/amigaos4-fs-factory.h"
+#elif defined(UNIX)
+ #include "backends/fs/posix/posix-fs-factory.h"
+#elif defined(WIN32)
+ #include "backends/fs/windows/windows-fs-factory.h"
+#endif
+
+
class OSystem_NULL : public OSystem {
protected:
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
Common::TimerManager *_timer;
+ timeval _startTime;
public:
OSystem_NULL();
@@ -93,8 +112,6 @@ public:
typedef void (*SoundProc)(void *param, byte *buf, int len);
virtual bool setSoundCallback(SoundProc proc, void *param);
- virtual void clearSoundCallback();
- virtual int getOutputSampleRate() const;
virtual void quit();
@@ -102,7 +119,10 @@ public:
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
+ virtual void getTimeAndDate(struct tm &t) const;
virtual Common::TimerManager *getTimerManager();
+ FilesystemFactory *getFilesystemFactory();
+
};
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
@@ -123,9 +143,14 @@ OSystem_NULL::~OSystem_NULL() {
void OSystem_NULL::initBackend() {
_savefile = new DefaultSaveFileManager();
- _mixer = new Audio::Mixer();
+ _mixer = new Audio::MixerImpl(this);
_timer = new DefaultTimerManager();
+ _mixer->setOutputRate(22050);
+ _mixer->setReady(false);
+
+ gettimeofday(&_startTime, NULL);
+
// Note that both the mixer and the timer manager are useless
// this way; they need to be hooked into the system somehow to
// be functional. Of course, can't do that in a NULL backend :).
@@ -244,10 +269,20 @@ bool OSystem_NULL::pollEvent(Common::Event &event) {
}
uint32 OSystem_NULL::getMillis() {
+#ifdef UNIX
+ timeval curTime;
+ gettimeofday(&curTime, NULL);
+ return (uint32)(((curTime.tv_sec - _startTime.tv_sec) * 1000) + \
+ ((curTime.tv_usec - _startTime.tv_usec) / 1000));
+#else
return 0;
+#endif
}
void OSystem_NULL::delayMillis(uint msecs) {
+#ifdef UNIX
+ usleep(msecs * 1000);
+#endif
}
OSystem::MutexRef OSystem_NULL::createMutex(void) {
@@ -267,13 +302,6 @@ bool OSystem_NULL::setSoundCallback(SoundProc proc, void *param) {
return true;
}
-void OSystem_NULL::clearSoundCallback() {
-}
-
-int OSystem_NULL::getOutputSampleRate() const {
- return 22050;
-}
-
void OSystem_NULL::quit() {
}
@@ -295,6 +323,22 @@ Common::TimerManager *OSystem_NULL::getTimerManager() {
return _timer;
}
+void OSystem_NULL::getTimeAndDate(struct tm &t) const {
+}
+
+FilesystemFactory *OSystem_NULL::getFilesystemFactory() {
+ #if defined(__amigaos4__)
+ return &AmigaOSFilesystemFactory::instance();
+ #elif defined(UNIX)
+ return &POSIXFilesystemFactory::instance();
+ #elif defined(WIN32)
+ return &WindowsFilesystemFactory::instance();
+ #else
+ #error Unknown and unsupported backend in OSystem_NULL::getFilesystemFactory
+ #endif
+}
+
+
OSystem *OSystem_NULL_create() {
return new OSystem_NULL();
}
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 22cd4eaa1b..204f4f7a16 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -19,16 +19,17 @@ RM = rm -f
srcdir = ../../..
VPATH = $(srcdir)
INCDIR = ../../../
+DEPDIR = .deps
DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_MPEG2 -DUSE_ZLIB -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
# PS2SDK-Ports from ps2dev.org's SVN repository for libmad, zlib and ucl
-PS2SDK_PORTS = /home/robby/libStuffNew/ps2sdk-ports
+PS2SDK_PORTS = /mnt/winxp/scummvm/ports
PS2SDK_PORTS_INCS = /ucl /zlib/include /libmad/ee/include
PS2SDK_PORTS_LIBS = /ucl /zlib/lib /libmad/ee/lib
# we also need SjPcm, Tremor and libmpeg2
-MORE_LIBS_DIR = /home/robby/libStuff
+MORE_LIBS_DIR = /mnt/winxp/scummvm/ports
MORE_LIBS_INCS = /SjPcm/ee/src /mpeg2dec/include /tremor
MORE_LIBS_LIBS = /SjPcm/ee/lib /mpeg2dec/libmpeg2 /tremor/tremor
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index bc310a43f4..b7fa8d03f1 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -340,8 +340,6 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
assert(cacheListSema >= 0);
}
- //printf("ps2_fopen: %s, %s\n", fname, mode);
-
if (((mode[0] != 'r') && (mode[0] != 'w')) || ((mode[1] != '\0') && (mode[1] != 'b'))) {
printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
return NULL;
@@ -363,6 +361,8 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
} else {
// Regular access to one of the devices
+ printf("ps2_fopen = %s\n", fname); // romeo : temp
+
if (!rdOnly)
return NULL; // we only provide readaccess for cd,dvd,hdd,usb
@@ -378,19 +378,22 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
}
int64 cacheId = -1;
- if (rdOnly && tocManager.haveEntries())
+ if (tocManager.haveEntries())
cacheId = tocManager.fileExists(fname);
if (cacheId != 0) {
Ps2File *file = findInCache(cacheId);
- if (file)
+ if (file) {
+ printf(" findInCache(%x)\n", cacheId); // romeo : temp
return (FILE*)file;
+ }
bool isAudioFile = strstr(fname, ".bun") || strstr(fname, ".BUN") || strstr(fname, ".Bun");
file = new Ps2ReadFile(cacheId, isAudioFile);
if (file->open(fname)) {
openFileCount++;
+ printf(" new cacheID = %x\n", cacheId); // romeo : temp
return (FILE*)file;
} else
delete file;
@@ -579,7 +582,7 @@ void TocManager::readEntries(const char *root) {
}
char readPath[256];
sprintf(readPath, "%s/", _root);
- printf("readDir: %s\n", readPath);
+ printf("readDir: %s (root: %s )\n", readPath, root);
readDir(readPath, &_rootNode, 0);
}
@@ -587,28 +590,62 @@ void TocManager::readDir(const char *path, TocNode **node, int level) {
if (level <= 2) { // we don't scan deeper than that
iox_dirent_t dirent;
int fd = fio.dopen(path);
+ TocNode *eNode = NULL; // = *node; // entry node
+ bool first = true;
+
+ printf("path=%s - level=%d fd=%d\n", path, level, fd); // romeo : temp
if (fd >= 0) {
- while (fio.dread(fd, &dirent) > 0)
- if (dirent.name[0] != '.') { // skip '.' and '..'
+ while (fio.dread(fd, &dirent) > 0) {
+ if (dirent.name[0] != '.') { // skip '.' & '..' - romeo : check
+ // --- do we have them on PS2?
*node = new TocNode;
+ if (first) {
+ eNode = *node;
+ first = false;
+ }
(*node)->sub = (*node)->next = NULL;
-
(*node)->nameLen = strlen(dirent.name);
memcpy((*node)->name, dirent.name, (*node)->nameLen + 1);
- if (dirent.stat.mode & FIO_S_IFDIR) { // directory
+ if (dirent.stat.mode & FIO_S_IFDIR) {
(*node)->isDir = true;
- char nextPath[256];
- sprintf(nextPath, "%s%s/", path, dirent.name);
- readDir(nextPath, &((*node)->sub), level + 1);
- } else
+ printf("dirent.name = %s [DIR]\n", dirent.name);
+ }
+ else {
(*node)->isDir = false;
+ printf("dirent.name = %s\n", dirent.name);
+ }
+
node = &((*node)->next);
}
+ }
+
fio.dclose(fd);
- } else
- printf("Can't open path: %s\n", path);
+ }
+
+ TocNode *iNode = eNode;
+ char nextPath[256];
+
+ while (iNode) {
+ if (iNode->isDir == true) {
+ sprintf(nextPath, "%s%s/", path, iNode->name);
+ readDir(nextPath, &(iNode->sub), level + 1);
+ }
+ iNode = iNode->next;
+ }
+
}
+
+ /*
+ ** Wizard of Oz' trick (to get all games running from USB on PS2):
+
+ 1. Make a list of files / dirs in level #0 (dclose before continuing)
+
+ 2. Go through the dirs : dopen / dread them / mark dirs / dclose
+
+ It's a safe recursion, cause it recurses on 'isDir' nodes
+ after dclosing the higher hierarchy
+ */
}
int64 TocManager::fileExists(const char *name) {
diff --git a/backends/platform/ps2/iop/rpckbd/Makefile b/backends/platform/ps2/iop/rpckbd/Makefile
new file mode 100644
index 0000000000..b25efa3660
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/Makefile
@@ -0,0 +1,30 @@
+# _____ ___ ____ ___ ____
+# ____| | ____| | | |____|
+# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+
+
+IOP_OBJS_DIR = obj/
+IOP_BIN_DIR = bin/
+IOP_SRC_DIR = src/
+IOP_INC_DIR = include/
+
+IOP_BIN=bin/rpckbd.irx
+IOP_OBJS=obj/ps2kbd.o obj/imports.o
+
+IOP_CFLAGS=-Wall
+IOP_INCS += -I$(PS2SDKSRC)/iop/usb/usbd/include
+
+all: $(IOP_OBJS_DIR) $(IOP_BIN_DIR) $(IOP_BIN)
+
+clean:
+ rm -f -r $(IOP_OBJS_DIR) $(IOP_BIN_DIR)
+
+include $(PS2SDKSRC)/Defs.make
+include $(PS2SDKSRC)/iop/Rules.make
+include $(PS2SDKSRC)/iop/Rules.release
diff --git a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
new file mode 100644
index 0000000000..f16c7ca12b
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
@@ -0,0 +1,90 @@
+/*
+# _____ ___ ____ ___ ____
+# ____| | ____| | | |____|
+# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#ifndef __PS2KBD_H__
+#define __PS2KBD_H__
+
+#define PS2KBD_RPC_ID 0xb0b0b80
+
+#define PS2KBD_LED_NUMLOCK 1
+#define PS2KBD_LED_CAPSLOCK 2
+#define PS2KBD_LED_SCRLOCK 4
+#define PS2KBD_LED_COMPOSE 8
+#define PS2KBD_LED_KANA 16
+
+#define PS2KBD_LED_MASK 0x1F;
+
+#define PS2KBD_ESCAPE_KEY 0x1B
+
+#define PS2KBD_LEFT_CTRL (1 << 0)
+#define PS2KBD_LEFT_SHIFT (1 << 1)
+#define PS2KBD_LEFT_ALT (1 << 2)
+#define PS2KBD_LEFT_GUI (1 << 3)
+#define PS2KBD_RIGHT_CTRL (1 << 4)
+#define PS2KBD_RIGHT_SHIFT (1 << 5)
+#define PS2KBD_RIGHT_ALT (1 << 6)
+#define PS2KBD_RIGHT_GUI (1 << 7)
+
+#define PS2KBD_CTRL (PS2KBD_LEFT_CTRL | PS2KBD_RIGHT_CTRL)
+#define PS2KBD_SHIFT (PS2KBD_LEFT_SHIFT | PS2KBD_RIGHT_SHIFT)
+#define PS2KBD_ALT (PS2KBD_LEFT_ALT | PS2KBD_RIGHT_ALT)
+#define PS2KBD_GUI (PS2KBD_LEFT_GUI | PS2KBD_RIGHT_GUI)
+
+#define PS2KBD_RAWKEY_UP 0xF0
+#define PS2KBD_RAWKEY_DOWN 0xF1
+
+typedef struct _kbd_rawkey {
+ u8 state;
+ u8 key;
+} kbd_rawkey __attribute__ ((packed));
+
+#define PS2KBD_READMODE_NORMAL 1
+#define PS2KBD_READMODE_RAW 2
+
+/* Notes on read mode */
+/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are
+ processed by the keymaps so that you get back ASCII data */
+/* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down)
+ Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual
+ from usb.org */
+
+#define PS2KBD_KEYMAP_SIZE 256
+
+typedef struct _kbd_keymap
+
+{
+ u8 keymap[PS2KBD_KEYMAP_SIZE];
+ u8 shiftkeymap[PS2KBD_KEYMAP_SIZE];
+ u8 keycap[PS2KBD_KEYMAP_SIZE];
+} kbd_keymap;
+
+
+/* IRPC function numbers */
+#define KBD_RPC_SETREADMODE 1 /* Sets up keymapped or raw mode */
+#define KBD_RPC_SETLEDS 2 /* Sets the LED state for ALL keyboards connected */
+#define KBD_RPC_SETREPEATRATE 3 /* Sets the repeat rate of the keyboard */
+#define KBD_RPC_SETKEYMAP 4 /* Sets the keymap for the standard keys, non shifted and shifted */
+#define KBD_RPC_SETCTRLMAP 5 /* Sets the control key mapping */
+#define KBD_RPC_SETALTMAP 6 /* Sets the alt key mapping */
+#define KBD_RPC_SETSPECIALMAP 7 /* Sets the special key mapping */
+#define KBD_RPC_FLUSHBUFFER 9 /* Flush the internal buffer, probably best after a keymap change */
+#define KBD_RPC_RESETKEYMAP 10 /* Reset keymaps to default states */
+#define KBD_RPC_READKEY 11
+#define KBD_RPC_READRAW 12
+
+/* Note on keymaps. In normal keymap a 0 would indicate no key */
+/* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */
+/* Second table maps USB key to a char when shifted */
+/* Third table contains boolean values. If 1 then the key is shifted/unshifted in capslock, else capslock is ignored */
+
+#endif
diff --git a/backends/platform/ps2/iop/rpckbd/src/imports.lst b/backends/platform/ps2/iop/rpckbd/src/imports.lst
new file mode 100644
index 0000000000..41e13e6e73
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/src/imports.lst
@@ -0,0 +1,58 @@
+
+sysclib_IMPORTS_start
+I_memset
+I_strcmp
+I_memcpy
+sysclib_IMPORTS_end
+
+loadcore_IMPORTS_start
+I_FlushDcache
+loadcore_IMPORTS_end
+
+sifcmd_IMPORTS_start
+I_sceSifInitRpc
+I_sceSifSetRpcQueue
+I_sceSifRegisterRpc
+I_sceSifRpcLoop
+sifcmd_IMPORTS_end
+
+stdio_IMPORTS_start
+I_printf
+stdio_IMPORTS_end
+
+thsemap_IMPORTS_start
+I_CreateSema
+I_SignalSema
+I_WaitSema
+I_PollSema
+I_DeleteSema
+thsemap_IMPORTS_end
+
+thbase_IMPORTS_start
+I_StartThread
+I_CreateThread
+I_USec2SysClock
+I_iSetAlarm
+I_SetAlarm
+I_CancelAlarm
+thbase_IMPORTS_end
+
+thevent_IMPORTS_start
+I_WaitEventFlag
+I_iSetEventFlag
+I_CreateEventFlag
+thevent_IMPORTS_end
+
+sysmem_IMPORTS_start
+I_AllocSysMemory
+I_FreeSysMemory
+sysmem_IMPORTS_end
+
+usbd_IMPORTS_start
+I_UsbGetDeviceStaticDescriptor
+I_UsbOpenEndpoint
+I_UsbSetDevicePrivateData
+I_UsbTransfer
+I_UsbRegisterDriver
+usbd_IMPORTS_end
+
diff --git a/backends/platform/ps2/iop/rpckbd/src/irx_imports.h b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
new file mode 100644
index 0000000000..6ecc8e5864
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
@@ -0,0 +1,35 @@
+/*
+# _____ ___ ____ ___ ____
+# ____| | ____| | | |____|
+# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# Defines all IRX imports.
+*/
+
+#ifndef IOP_IRX_IMPORTS_H
+#define IOP_IRX_IMPORTS_H
+
+#include "irx.h"
+
+/* Please keep these in alphabetical order! */
+#include "dmacman.h"
+#include "intrman.h"
+#include "libsd.h"
+#include "loadcore.h"
+#include "sifcmd.h"
+#include "stdio.h"
+#include "sysclib.h"
+#include "sysmem.h"
+#include "thbase.h"
+#include "thevent.h"
+#include "thmsgbx.h"
+#include "thsemap.h"
+#include "usbd.h"
+#include "vblank.h"
+
+#endif /* IOP_IRX_IMPORTS_H */
diff --git a/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
new file mode 100644
index 0000000000..f87a47f0cb
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
@@ -0,0 +1,1199 @@
+/*
+# _____ ___ ____ ___ ____
+# ____| | ____| | | |____|
+# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2005, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#include "types.h"
+#include "ioman.h"
+#include "loadcore.h"
+#include "stdio.h"
+#include "sifcmd.h"
+#include "sifrpc.h"
+#include "sysclib.h"
+#include "sysmem.h"
+#include "usbd.h"
+#include "usbd_macro.h"
+#include "thbase.h"
+#include "thevent.h"
+#include "thsemap.h"
+
+#include "ps2kbd.h"
+#include "us_keymap.h"
+
+#define PS2KBD_VERSION 0x100
+
+#define USB_SUBCLASS_BOOT 1
+#define USB_HIDPROTO_KEYBOARD 1
+
+#define PS2KBD_MAXDEV 2
+#define PS2KBD_MAXKEYS 6
+
+#define PS2KBD_DEFLINELEN 4096
+#define PS2KBD_DEFREPEATRATE 100
+/* Default repeat rate in milliseconds */
+#define PS2KBD_REPEATWAIT 1000
+/* Number of milliseconds to wait before starting key repeat */
+#define USB_KEYB_NUMLOCK 0x53
+#define USB_KEYB_CAPSLOCK 0x39
+#define USB_KEYB_SCRLOCK 0x47
+
+#define USB_KEYB_NUMPAD_START 0x54
+#define USB_KEYB_NUMPAD_END 0x63
+
+#define SEMA_ZERO -419
+#define SEMA_DELETED -425
+
+int ps2kbd_init();
+void ps2kbd_config_set(int resultCode, int bytes, void *arg);
+void ps2kbd_idlemode_set(int resultCode, int bytes, void *arg);
+void ps2kbd_data_recv(int resultCode, int bytes, void *arg);
+int ps2kbd_probe(int devId);
+int ps2kbd_connect(int devId);
+int ps2kbd_disconnect(int devId);
+void usb_getstring(int endp, int index, char *desc);
+
+typedef struct _kbd_data_recv
+
+{
+ u8 mod_keys;
+ u8 reserved;
+ u8 keycodes[PS2KBD_MAXKEYS];
+} kbd_data_recv;
+
+typedef struct _keyb_dev
+
+{
+ int configEndp;
+ int dataEndp;
+ int packetSize;
+ int devId;
+ int interfaceNo; /* Holds the interface number selected on this device */
+ char repeatkeys[2];
+ u32 eventmask;
+ u8 ledStatus; /* Maintains state on the led status */
+ kbd_data_recv oldData;
+ kbd_data_recv data; /* Holds the data for the transfers */
+} kbd_dev;
+
+/* Global Variables */
+
+int kbd_readmode;
+u32 kbd_repeatrate;
+kbd_dev *devices[PS2KBD_MAXDEV]; /* Holds a list of current devices */
+int dev_count;
+UsbDriver kbd_driver = { NULL, NULL, "PS2Kbd", ps2kbd_probe, ps2kbd_connect, ps2kbd_disconnect };
+u8 *lineBuffer;
+u32 lineStartP, lineEndP;
+int lineSema;
+int bufferSema;
+u32 lineSize;
+u8 keymap[PS2KBD_KEYMAP_SIZE]; /* Normal key map */
+u8 shiftkeymap[PS2KBD_KEYMAP_SIZE]; /* Shifted key map */
+u8 keycap[PS2KBD_KEYMAP_SIZE]; /* Does this key get shifted by capslock ? */
+u8 special_keys[PS2KBD_KEYMAP_SIZE];
+u8 control_map[PS2KBD_KEYMAP_SIZE];
+u8 alt_map[PS2KBD_KEYMAP_SIZE];
+//static struct fileio_driver kbd_fdriver;
+iop_device_t kbd_filedrv;
+u8 keyModValue[8] = { 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7 };
+int repeat_tid;
+int eventid; /* Id of the repeat event */
+
+int _start ()
+{
+ FlushDcache();
+
+ ps2kbd_init();
+
+ printf("PS2KBD - USB Keyboard Library\n");
+
+ return 0;
+
+}
+
+int ps2kbd_probe(int devId)
+
+{
+ UsbDeviceDescriptor *dev;
+ UsbConfigDescriptor *conf;
+ UsbInterfaceDescriptor *intf;
+ UsbEndpointDescriptor *endp;
+ //UsbStringDescriptor *str;
+
+ if(dev_count >= PS2KBD_MAXDEV)
+ {
+ printf("ERROR: Maximum keyboard devices reached\n");
+ return 0;
+ }
+
+ //printf("PS2Kbd_probe devId %d\n", devId);
+
+ dev = UsbGetDeviceStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
+ if(!dev)
+ {
+ printf("ERROR: Couldn't get device descriptor\n");
+ return 0;
+ }
+
+ //printf("Device class %d, Size %d, Man %d, Product %d Cpnfigurations %d\n", dev->bDeviceClass, dev->bMaxPacketSize0, dev->iManufacturer, dev->iProduct, dev->bNumConfigurations);
+ /* Check that the device class is specified in the interfaces and it has at least one configuration */
+ if((dev->bDeviceClass != USB_CLASS_PER_INTERFACE) || (dev->bNumConfigurations < 1))
+ {
+ //printf("This is not the droid you're looking for\n");
+ return 0;
+ }
+
+ conf = UsbGetDeviceStaticDescriptor(devId, dev, USB_DT_CONFIG);
+ if(!conf)
+ {
+ printf("ERROR: Couldn't get configuration descriptor\n");
+ return 0;
+ }
+ //printf("Config Length %d Total %d Interfaces %d\n", conf->bLength, conf->wTotalLength, conf->bNumInterfaces);
+
+ if((conf->bNumInterfaces < 1) || (conf->wTotalLength < (sizeof(UsbConfigDescriptor) + sizeof(UsbInterfaceDescriptor))))
+ {
+ printf("ERROR: No interfaces available\n");
+ return 0;
+ }
+
+ intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
+/* printf("Interface Length %d Endpoints %d Class %d Sub %d Proto %d\n", intf->bLength, */
+/* intf->bNumEndpoints, intf->bInterfaceClass, intf->bInterfaceSubClass, */
+/* intf->bInterfaceProtocol); */
+
+ if((intf->bInterfaceClass != USB_CLASS_HID) || (intf->bInterfaceSubClass != USB_SUBCLASS_BOOT) ||
+ (intf->bInterfaceProtocol != USB_HIDPROTO_KEYBOARD) || (intf->bNumEndpoints < 1))
+
+ {
+ //printf("We came, we saw, we told it to fuck off\n");
+ return 0;
+ }
+
+ endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
+ endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
+
+ //printf("Endpoint 1 Addr %d, Attr %d, MaxPacket %d\n", endp->bEndpointAddress, endp->bmAttributes, endp->wMaxPacketSizeLB);
+
+ if(((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) ||
+ ((endp->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN))
+ {
+ printf("ERROR: Endpoint not interrupt type and/or an input\n");
+ return 0;
+ }
+
+ printf("PS2KBD: Found a keyboard device\n");
+
+ return 1;
+}
+
+int ps2kbd_connect(int devId)
+
+{
+ /* Assume we can only get here if we have already checked the device is kosher */
+
+ UsbDeviceDescriptor *dev;
+ UsbConfigDescriptor *conf;
+ UsbInterfaceDescriptor *intf;
+ UsbEndpointDescriptor *endp;
+ kbd_dev *currDev;
+ int devLoop;
+
+ //printf("PS2Kbd_connect devId %d\n", devId);
+
+ dev = UsbGetDeviceStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
+ if(!dev)
+ {
+ printf("ERROR: Couldn't get device descriptor\n");
+ return 1;
+ }
+
+ conf = UsbGetDeviceStaticDescriptor(devId, dev, USB_DT_CONFIG);
+ if(!conf)
+ {
+ printf("ERROR: Couldn't get configuration descriptor\n");
+ return 1;
+ }
+
+ intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
+ endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
+ endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
+
+ for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+ {
+ if(devices[devLoop] == NULL)
+ {
+ break;
+ }
+ }
+
+ if(devLoop == PS2KBD_MAXDEV)
+ {
+ /* How the f*** did we end up here ??? */
+ printf("ERROR: Device Weirdness!!\n");
+ return 1;
+ }
+
+ currDev = (kbd_dev *) AllocSysMemory(0, sizeof(kbd_dev), NULL);
+ if(!currDev)
+ {
+ printf("ERROR: Couldn't allocate a device point for the kbd\n");
+ return 1;
+ }
+
+ devices[devLoop] = currDev;
+ memset(currDev, 0, sizeof(kbd_dev));
+ currDev->configEndp = UsbOpenEndpoint(devId, NULL);
+ currDev->dataEndp = UsbOpenEndpoint(devId, endp);
+ currDev->packetSize = endp->wMaxPacketSizeLB | ((int) endp->wMaxPacketSizeHB << 8);
+ currDev->eventmask = (1 << devLoop);
+ if(currDev->packetSize > sizeof(kbd_data_recv))
+ {
+ currDev->packetSize = sizeof(kbd_data_recv);
+ }
+
+ if(dev->iManufacturer != 0)
+ {
+ usb_getstring(currDev->configEndp, dev->iManufacturer, "Keyboard Manufacturer");
+ }
+
+ if(dev->iProduct != 0)
+ {
+ usb_getstring(currDev->configEndp, dev->iProduct, "Keyboard Product");
+ }
+
+ currDev->devId = devId;
+ currDev->interfaceNo = intf->bInterfaceNumber;
+ currDev->ledStatus = 0;
+
+ UsbSetDevicePrivateData(devId, currDev); /* Set the index for the device data */
+
+ //printf("Configuration value %d\n", conf->bConfigurationValue);
+ UsbSetDeviceConfiguration(currDev->configEndp, conf->bConfigurationValue, ps2kbd_config_set, currDev);
+
+ dev_count++; /* Increment device count */
+ printf("PS2KBD: Connected device\n");
+
+ return 0;
+}
+
+int ps2kbd_disconnect(int devId)
+
+{
+ int devLoop;
+ printf("PS2Kbd_disconnect devId %d\n", devId);
+
+ for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+ {
+ if((devices[devLoop]) && (devices[devLoop]->devId == devId))
+ {
+ dev_count--;
+ FreeSysMemory(devices[devLoop]);
+ devices[devLoop] = NULL;
+ printf("PS2KBD: Disconnected device\n");
+ break;
+ }
+ }
+
+ return 0;
+}
+
+typedef struct _string_descriptor
+
+{
+ u8 buf[200];
+ char *desc;
+} string_descriptor;
+
+void ps2kbd_getstring_set(int resultCode, int bytes, void *arg)
+
+{
+ UsbStringDescriptor *str = (UsbStringDescriptor *) arg;
+ string_descriptor *strBuf = (string_descriptor *) arg;
+ char string[50];
+ int strLoop;
+
+/* printf("=========getstring=========\n"); */
+
+/* printf("PS2KEYBOARD: GET_DESCRIPTOR res %d, bytes %d, arg %p\n", resultCode, bytes, arg); */
+
+ if(resultCode == USB_RC_OK)
+ {
+ memset(string, 0, 50);
+ for(strLoop = 0; strLoop < ((bytes - 2) / 2); strLoop++)
+ {
+ string[strLoop] = str->wData[strLoop] & 0xFF;
+ }
+ printf("%s: %s\n", strBuf->desc, string);
+ }
+
+ FreeSysMemory(arg);
+}
+
+void usb_getstring(int endp, int index, char *desc)
+
+{
+ u8 *data;
+ string_descriptor *str;
+ int ret;
+
+ data = (u8 *) AllocSysMemory(0, sizeof(string_descriptor), NULL);
+ str = (string_descriptor *) data;
+
+ if(data != NULL)
+ {
+ str->desc = desc;
+ ret = UsbControlTransfer(endp, 0x80, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | index,
+ 0, sizeof(string_descriptor) - 4, data, ps2kbd_getstring_set, data);
+ if(ret != USB_RC_OK)
+ {
+ printf("PS2KBD: Error sending string descriptor request\n");
+ FreeSysMemory(data);
+ }
+ }
+}
+
+void ps2kbd_config_set(int resultCode, int bytes, void *arg)
+ /* Called when we have finished choosing our configuration */
+
+{
+ kbd_dev *dev;
+
+ if(resultCode != USB_RC_OK)
+ {
+ printf("PS2KEYBOARD: Configuration set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+ return;
+ }
+
+ //printf("PS2KEYBOARD: Configuration set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+ /* Do a interrupt data transfer */
+
+ dev = (kbd_dev *) arg;
+ if(dev != NULL)
+ {
+ int ret;
+
+ ret = UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_IDLE, 0, dev->interfaceNo, 0, NULL, ps2kbd_idlemode_set, arg);
+ }
+}
+
+void ps2kbd_idlemode_set(int resultCode, int bytes, void *arg)
+
+{
+ kbd_dev *dev;
+
+
+
+ if(resultCode != USB_RC_OK)
+ {
+ printf("PS2KBD: Idlemode set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+ return;
+ }
+
+ dev = (kbd_dev *) arg;
+ if(dev != NULL)
+ {
+ int ret;
+
+ ret = UsbInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2kbd_data_recv, arg);
+ }
+}
+
+void ps2kbd_led_set(int resultCode, int bytes, void *arg)
+
+{
+ //printf("LED Set\n");
+}
+
+void ps2kbd_build_uniquekeys(u8 *res, const u8 *new, const u8 *old)
+
+ /* Builds a list of unique keys */
+
+{
+ int loopNew, loopOld;
+ int loopRes = 0;
+ int foundKey;
+
+ for(loopNew = 0; loopNew < PS2KBD_MAXKEYS; loopNew++)
+ {
+ if(new[loopNew] != 0)
+ {
+ foundKey = 0;
+ for(loopOld = 0; loopOld < PS2KBD_MAXKEYS; loopOld++)
+ {
+ if(new[loopNew] == old[loopOld])
+ {
+ foundKey = 1;
+ break;
+ }
+ }
+ if(!foundKey)
+ {
+ res[loopRes++] = new[loopNew];
+ }
+ }
+ }
+}
+
+u32 ps2kbd_repeathandler(void *arg)
+
+{
+ kbd_dev *dev = arg;
+ iop_sys_clock_t t;
+ //printf("Repeat handler\n");
+
+ iSetEventFlag(eventid, dev->eventmask);
+
+ USec2SysClock(kbd_repeatrate * 1000, &t);
+ iSetAlarm(&t, ps2kbd_repeathandler, arg);
+
+ return t.hi;
+}
+
+void ps2kbd_getkeys(u8 keyMods, u8 ledStatus, const u8 *keys, kbd_dev *dev)
+
+{
+ int loopKey;
+ int tempPos = 0;
+ int byteCount = 0;
+ u8 currChars[2];
+
+ if(lineStartP < lineEndP)
+ {
+ tempPos = lineStartP + lineSize;
+ }
+ else
+ {
+ tempPos = lineStartP;
+ }
+
+ for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+ {
+ u8 currKey = keys[loopKey];
+
+ currChars[0] = 0;
+ currChars[1] = 0;
+
+ if(lineEndP == (tempPos - 1))
+ {
+ break;
+ }
+
+ if(currKey) /* If this is a valid key */
+ {
+ if((currKey >= USB_KEYB_NUMPAD_START) && (currKey <= USB_KEYB_NUMPAD_END))
+ /* Handle numpad specially */
+ {
+ if(ledStatus & PS2KBD_LED_NUMLOCK)
+ {
+ if(keymap[currKey])
+ {
+ currChars[0] = keymap[currKey];
+ }
+ }
+ else
+ {
+ if(special_keys[currKey])
+ {
+ currChars[0] = PS2KBD_ESCAPE_KEY;
+ currChars[1] = special_keys[currKey];
+ }
+ else if(keymap[currKey] != '5') /* Make sure this isnt a 5 key :) */
+ {
+ currChars[0] = keymap[currKey];
+ }
+ }
+ }
+ else if(special_keys[currKey]) /* This is a special key */
+ {
+ currChars[0] = PS2KBD_ESCAPE_KEY;
+ currChars[1] = special_keys[currKey];
+ }
+ else if(keyMods & PS2KBD_CTRL) /* CTRL */
+ {
+ if(control_map[currKey])
+ {
+ currChars[0] = control_map[currKey];
+ }
+ }
+ else if(keyMods & PS2KBD_ALT) /* ALT */
+ {
+ if(alt_map[currKey])
+ {
+ currChars[0] = alt_map[currKey];
+ }
+ }
+ else if(keyMods & PS2KBD_SHIFT) /* SHIFT */
+ {
+ if((ledStatus & PS2KBD_LED_CAPSLOCK) && (keycap[currKey]))
+ {
+ currChars[0] = keymap[currKey];
+ }
+ else
+ {
+ currChars[0] = shiftkeymap[currKey];
+ }
+ }
+ else /* Normal key */
+ {
+ if(keymap[keys[loopKey]])
+ {
+ if((ledStatus & PS2KBD_LED_CAPSLOCK) && (keycap[currKey]))
+ {
+ currChars[0] = shiftkeymap[currKey];
+ }
+ else
+ {
+ currChars[0] = keymap[currKey];
+ }
+ }
+ }
+ }
+
+ if((currChars[0] == PS2KBD_ESCAPE_KEY) && (currChars[1] != 0))
+ {
+ if(lineEndP != (tempPos - 2))
+ {
+ lineBuffer[lineEndP++] = currChars[0];
+ lineEndP %= lineSize;
+ lineBuffer[lineEndP++] = currChars[1];
+ lineEndP %= lineSize;
+ byteCount += 2;
+ }
+ dev->repeatkeys[0] = currChars[0];
+ dev->repeatkeys[1] = currChars[1];
+ }
+ else if(currChars[0] != 0)
+ {
+ lineBuffer[lineEndP++] = currChars[0];
+ lineEndP %= lineSize;
+ byteCount++;
+ dev->repeatkeys[0] = currChars[0];
+ dev->repeatkeys[1] = 0;
+ }
+ }
+
+ if(byteCount > 0)
+ {
+ iop_sys_clock_t t;
+ /* Set alarm to do repeat rate */
+ //printf("repeatkeys %d %d\n", kbd_repeatkeys[0], kbd_repeatkeys[1]);
+ USec2SysClock(PS2KBD_REPEATWAIT * 1000, &t);
+ SetAlarm(&t, ps2kbd_repeathandler, dev);
+ }
+
+ for(loopKey = 0; loopKey < byteCount; loopKey++) /* Signal the sema to indicate data */
+ {
+ SignalSema(bufferSema);
+ }
+
+/* lineBuffer[PS2KBD_DEFLINELEN - 1] = 0; */
+/* printf(lineBuffer); */
+ //printf("lineStart %d, lineEnd %d\n", lineStartP, lineEndP);
+}
+
+
+void ps2kbd_getkeys_raw(u8 newKeyMods, u8 oldKeyMods, u8 *new, const u8 *old)
+
+{
+ int loopKey;
+ u8 currKey;
+ u8 keyMods = newKeyMods ^ oldKeyMods;
+ u8 keyModsMap = newKeyMods & keyMods;
+ int tempPos = 0;
+ int byteCount = 0;
+
+ if(lineStartP < lineEndP)
+ {
+ tempPos = lineStartP + lineSize;
+ }
+ else
+ {
+ tempPos = lineStartP;
+ }
+
+ for(loopKey = 0; loopKey < 8; loopKey++)
+ {
+ int currMod = (1 << loopKey);
+ if(keyMods & currMod)
+ {
+ if(lineEndP == (tempPos - 2))
+ {
+ return;
+ }
+
+ currKey = keyModValue[loopKey];
+
+ if(keyModsMap & currMod) /* If key pressed */
+ {
+ lineBuffer[lineEndP++] = PS2KBD_RAWKEY_DOWN;
+ //printf("Key down\n");
+ }
+ else
+ {
+ lineBuffer[lineEndP++] = PS2KBD_RAWKEY_UP;
+ //printf("Key up\n");
+ }
+
+ lineEndP %= lineSize;
+ lineBuffer[lineEndP++] = currKey;
+ lineEndP %= lineSize;
+ byteCount += 2;
+ //printf("Key %d\n", currKey);
+ }
+ }
+
+ for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+ {
+ if(lineEndP == (tempPos - 2))
+ {
+ return;
+ }
+
+ if(new[loopKey] != 0)
+ {
+ lineBuffer[lineEndP++] = PS2KBD_RAWKEY_DOWN;
+ lineEndP %= lineSize;
+ lineBuffer[lineEndP++] = new[loopKey];
+ lineEndP %= lineSize;
+ byteCount += 2;
+ //printf("Key down\nKey %d\n", new[loopKey]);
+ }
+
+ }
+
+ for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+ {
+ if(lineEndP == (tempPos - 2))
+ {
+ return;
+ }
+
+ if(old[loopKey] != 0)
+ {
+ lineBuffer[lineEndP++] = PS2KBD_RAWKEY_UP;
+ lineEndP %= lineSize;
+ lineBuffer[lineEndP++] = old[loopKey];
+ lineEndP %= lineSize;
+ byteCount += 2;
+ //printf("Key up\nKey %d\n", old[loopKey]);
+ }
+
+ }
+
+ for(loopKey = 0; loopKey < byteCount; loopKey++) /* Signal the sema for the number of bytes read */
+ {
+ SignalSema(bufferSema);
+ }
+}
+
+void ps2kbd_data_recv(int resultCode, int bytes, void *arg)
+
+{
+ kbd_dev *dev;
+ int ret;
+ int phantom;
+ int loop;
+
+ if(resultCode != USB_RC_OK)
+ {
+ printf("PS2KEYBOARD: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+ return;
+ }
+
+ //printf("PS2KBD: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+
+ dev = (kbd_dev *) arg;
+ if(dev == NULL)
+ {
+ printf("PS2KBD: dev == NULL\n");
+ return;
+ }
+
+/* printf("PS2KBD Modifiers %02X, Keys ", dev->data.mod_keys); */
+/* for(loop = 0; loop < PS2KBD_MAXKEYS; loop++) */
+/* { */
+/* printf("%02X ", dev->data.keycodes[loop]); */
+/* } */
+/* printf("\n"); */
+
+ CancelAlarm(ps2kbd_repeathandler, dev); /* Make sure repeat alarm is cancelled */
+
+ /* Check for phantom states */
+ phantom = 1;
+ for(loop = 0; loop < PS2KBD_MAXKEYS; loop++)
+ {
+ if(dev->data.keycodes[loop] != 1)
+ {
+ phantom = 0;
+ break;
+ }
+ }
+
+ if(!phantom) /* If not in a phantom state */
+ {
+ u8 uniqueKeys[PS2KBD_MAXKEYS];
+ u8 missingKeys[PS2KBD_MAXKEYS];
+ int loopKey;
+
+ memset(uniqueKeys, 0, PS2KBD_MAXKEYS);
+ memset(missingKeys, 0, PS2KBD_MAXKEYS);
+ ps2kbd_build_uniquekeys(uniqueKeys, dev->data.keycodes, dev->oldData.keycodes);
+ ps2kbd_build_uniquekeys(missingKeys, dev->oldData.keycodes, dev->data.keycodes);
+ /* Build new and missing key lists */
+
+/* printf("Unique keys : "); */
+/* for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) */
+/* { */
+/* printf("%02X ", uniqueKeys[loopKey]); */
+/* } */
+/* printf("\n"); */
+
+/* printf("Missing keys : "); */
+/* for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) */
+/* { */
+/* printf("%02X ", missingKeys[loopKey]); */
+/* } */
+/* printf("\n"); */
+
+ if(kbd_readmode == PS2KBD_READMODE_NORMAL)
+ {
+ u8 ledStatus;
+
+ ledStatus = dev->ledStatus;
+ //printf("ledStatus %02X\n", ledStatus);
+
+ for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) /* Process key codes */
+ {
+ switch(uniqueKeys[loopKey])
+ {
+ case USB_KEYB_NUMLOCK :
+ ledStatus ^= PS2KBD_LED_NUMLOCK;
+ uniqueKeys[loopKey] = 0;
+ break;
+ case USB_KEYB_CAPSLOCK :
+ ledStatus ^= PS2KBD_LED_CAPSLOCK;
+ uniqueKeys[loopKey] = 0;
+ break;
+ case USB_KEYB_SCRLOCK :
+ ledStatus ^= PS2KBD_LED_SCRLOCK;
+ uniqueKeys[loopKey] = 0;
+ break;
+ }
+ }
+
+ if(ledStatus != dev->ledStatus)
+ {
+ dev->ledStatus = ledStatus & PS2KBD_LED_MASK;
+ //printf("LEDS %02X\n", dev->ledStatus);
+ /* Call Set LEDS */
+ UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_REPORT, 0x200,
+ dev->interfaceNo, 1, &dev->ledStatus, ps2kbd_led_set, arg);
+ }
+
+ WaitSema(lineSema); /* Make sure no other thread is going to manipulate the buffer */
+ ps2kbd_getkeys(dev->data.mod_keys, dev->ledStatus, uniqueKeys, dev); /* read in remaining keys */
+ SignalSema(lineSema);
+ }
+ else /* RAW Mode */
+ {
+ WaitSema(lineSema);
+ ps2kbd_getkeys_raw(dev->data.mod_keys, dev->oldData.mod_keys, uniqueKeys, missingKeys);
+ SignalSema(lineSema);
+ }
+
+ memcpy(&dev->oldData, &dev->data, sizeof(kbd_data_recv));
+ }
+
+ ret = UsbInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2kbd_data_recv, arg);
+}
+
+void flushbuffer()
+
+{
+ iop_sema_t s;
+
+ lineStartP = 0;
+ lineEndP = 0;
+ memset(lineBuffer, 0, lineSize);
+
+ DeleteSema(bufferSema);
+ s.initial = 0;
+ s.max = lineSize;
+ s.option = 0;
+ s.attr = 0;
+ bufferSema = CreateSema(&s); /* Create a sema to maintain status of readable data */
+
+ if(bufferSema <= 0)
+ {
+ printf("Error creating buffer sema\n");
+ }
+}
+
+void ps2kbd_rpc_setreadmode(u32 readmode)
+
+{
+ int devLoop;
+
+ if(readmode == kbd_readmode) return;
+
+ if((readmode == PS2KBD_READMODE_NORMAL) || (readmode == PS2KBD_READMODE_RAW))
+ {
+ /* Reset line buffer */
+ //printf("ioctl_setreadmode %d\n", readmode);
+ for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+ {
+ CancelAlarm(ps2kbd_repeathandler, devices[devLoop]);
+ }
+
+ WaitSema(lineSema);
+ kbd_readmode = readmode;
+ flushbuffer();
+ SignalSema(lineSema);
+ }
+}
+
+void ps2kbd_rpc_setkeymap(kbd_keymap *keymaps)
+
+{
+ //printf("ioctl_setkeymap %p\n", keymaps);
+ WaitSema(lineSema); /* Lock the input so you dont end up with weird results */
+ memcpy(keymap, keymaps->keymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(shiftkeymap, keymaps->shiftkeymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(keycap, keymaps->keycap, PS2KBD_KEYMAP_SIZE);
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setctrlmap(u8 *ctrlmap)
+
+{
+ //printf("ioctl_setctrlmap %p\n", ctrlmap);
+ WaitSema(lineSema);
+ memcpy(control_map, ctrlmap, PS2KBD_KEYMAP_SIZE);
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setaltmap(u8 *altmap)
+
+{
+ //printf("ioctl_setaltmap %p\n", altmap);
+ WaitSema(lineSema);
+ memcpy(alt_map, altmap, PS2KBD_KEYMAP_SIZE);
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setspecialmap(u8 *special)
+
+{
+ //printf("ioctl_setspecialmap %p\n", special);
+ WaitSema(lineSema);
+ memcpy(special_keys, special, PS2KBD_KEYMAP_SIZE);
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_resetkeymap()
+ /* Reset keymap to default US variety */
+
+{
+ //printf("ioctl_resetkeymap()\n");
+ WaitSema(lineSema);
+ memcpy(keymap, us_keymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(shiftkeymap, us_shiftkeymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(keycap, us_keycap, PS2KBD_KEYMAP_SIZE);
+ memcpy(special_keys, us_special_keys, PS2KBD_KEYMAP_SIZE);
+ memcpy(control_map, us_control_map, PS2KBD_KEYMAP_SIZE);
+ memcpy(alt_map, us_alt_map, PS2KBD_KEYMAP_SIZE);
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_flushbuffer()
+ /* Flush the internal buffer */
+
+{
+ //printf("ioctl_flushbuffer()\n");
+ WaitSema(lineSema);
+ flushbuffer();
+ SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setleds(u8 ledStatus)
+
+{
+ int devLoop;
+ kbd_dev *dev;
+
+ //printf("ioctl_setleds %d\n", ledStatus);
+ ledStatus &= PS2KBD_LED_MASK;
+ for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+ {
+ dev = devices[devLoop];
+ if(dev)
+ {
+ if(ledStatus != dev->ledStatus)
+ {
+ dev->ledStatus = ledStatus & PS2KBD_LED_MASK;
+ UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_REPORT, 0x200,
+ dev->interfaceNo, 1, &dev->ledStatus, ps2kbd_led_set, dev);
+ }
+ }
+ }
+}
+
+void ps2kbd_rpc_setrepeatrate(u32 rate)
+{
+ kbd_repeatrate = rate;
+}
+
+int kbd_read(void *buf, int size)
+{
+ int count = 0;
+ char *data = (char *) buf;
+
+ if(kbd_readmode == PS2KBD_READMODE_RAW)
+ size &= ~1; /* Ensure size of a multiple of 2 */
+
+ if (PollSema(bufferSema) >= 0) {
+ SignalSema(bufferSema);
+ if (WaitSema(lineSema) >= 0) {
+ while((count < size) && (lineStartP != lineEndP)) {
+ data[count] = lineBuffer[lineStartP++];
+ lineStartP %= lineSize;
+ count++;
+ PollSema(bufferSema); /* Take off one count from the sema */
+ }
+ SignalSema(lineSema);
+ }
+ }
+ return count;
+}
+
+void repeat_thread(void *arg)
+
+{
+ u32 eventmask;
+ int devLoop;
+
+ for(;;)
+ {
+ WaitEventFlag(eventid, 0xFFFFFFFF, 0x01 | 0x10, &eventmask);
+ //printf("Recieved event %08X\n", eventmask);
+ for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+ {
+ if((eventmask & (1 << devLoop)) && (devices[devLoop]))
+ {
+ int tempPos = 0;
+
+ WaitSema(lineSema);
+ if(lineStartP < lineEndP)
+ {
+ tempPos = lineStartP + lineSize;
+ }
+ else
+ {
+ tempPos = lineStartP;
+ }
+
+ if((devices[devLoop]->repeatkeys[0]) && (devices[devLoop]->repeatkeys[1]))
+ {
+ if(lineEndP != (tempPos - 2))
+ {
+ lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[0];
+ lineEndP %= lineSize;
+ lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[1];
+ lineEndP %= lineSize;
+ SignalSema(bufferSema);
+ SignalSema(bufferSema);
+ }
+ }
+ else if(devices[devLoop]->repeatkeys[0])
+ {
+ if(lineEndP != (tempPos - 1))
+ {
+ lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[0];
+ lineEndP %= lineSize;
+ SignalSema(bufferSema);
+ }
+ }
+
+ SignalSema(lineSema);
+ }
+ }
+ }
+}
+
+int init_repeatthread()
+ /* Creates a thread to handle key repeats */
+{
+ iop_thread_t param;
+ iop_event_t event;
+
+ event.attr = 0;
+ event.option = 0;
+ event.bits = 0;
+ eventid = CreateEventFlag(&event);
+
+ param.attr = TH_C;
+ param.thread = repeat_thread;
+ param.priority = 40;
+ param.stacksize = 0x800;
+ param.option = 0;
+
+ repeat_tid = CreateThread(&param);
+ if (repeat_tid > 0) {
+ StartThread(repeat_tid, 0);
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+static unsigned long retKey;
+
+void *ps2kbd_rpc_server(int fno, void *data, int size) {
+ retKey = 0;
+ switch (fno) {
+ case KBD_RPC_SETREADMODE:
+ ps2kbd_rpc_setreadmode(*(u32 *)data);
+ break;
+ case KBD_RPC_SETKEYMAP:
+ ps2kbd_rpc_setkeymap((kbd_keymap *) data);
+ break;
+ case KBD_RPC_SETALTMAP:
+ ps2kbd_rpc_setaltmap((u8 *) data);
+ break;
+ case KBD_RPC_SETCTRLMAP:
+ ps2kbd_rpc_setctrlmap((u8 *) data);
+ break;
+ case KBD_RPC_SETSPECIALMAP:
+ ps2kbd_rpc_setspecialmap((u8 *) data);
+ break;
+ case KBD_RPC_FLUSHBUFFER:
+ ps2kbd_rpc_flushbuffer();
+ break;
+ case KBD_RPC_SETLEDS:
+ ps2kbd_rpc_setleds(*(u8*) data);
+ break;
+ case KBD_RPC_RESETKEYMAP:
+ ps2kbd_rpc_resetkeymap();
+ break;
+ case KBD_RPC_SETREPEATRATE:
+ ps2kbd_rpc_setrepeatrate(*(u32 *) data);
+ break;
+ case KBD_RPC_READRAW:
+ kbd_read(&retKey, 2);
+ return &retKey;
+ case KBD_RPC_READKEY:
+ kbd_read(&retKey, 1);
+ return &retKey;
+ default:
+ printf("Ps2Kbd: Unknown RPC command %d\n", fno);
+ break;
+ }
+ return NULL;
+}
+
+struct t_SifRpcDataQueue qd;
+struct t_SifRpcServerData sd0;
+void *rpcRcvBuf;
+
+void ps2kbd_start_rpc(unsigned long tid) {
+ rpcRcvBuf = AllocSysMemory(0, 3 * PS2KBD_KEYMAP_SIZE, NULL);
+ printf("Ps2Kbd: starting RPC server\n");
+ SifInitRpc(0);
+
+ SifSetRpcQueue(&qd, tid);
+ SifRegisterRpc(&sd0, PS2KBD_RPC_ID, ps2kbd_rpc_server, rpcRcvBuf, 0, 0, &qd);
+ SifRpcLoop(&qd);
+}
+
+int ps2kbd_init_rpc(void) {
+ struct _iop_thread param;
+ int th;
+
+ param.attr = 0x02000000;
+ param.thread = (void*)ps2kbd_start_rpc;
+ param.priority = 40;
+ param.stacksize = 0x800;
+ param.option = 0;
+
+ th = CreateThread(&param);
+
+ if (th > 0) {
+ StartThread(th, (void *)th);
+ return 0;
+ } else
+ return -1;
+}
+
+int ps2kbd_init() {
+ int ret;
+ iop_sema_t s;
+
+ s.initial = 1;
+ s.max = 1;
+ s.option = 0;
+ s.attr = 0;
+ lineSema = CreateSema(&s);
+ if(lineSema <= 0)
+ {
+ printf("Error creating sema\n");
+ return 1;
+ }
+
+ s.initial = 0;
+ s.max = PS2KBD_DEFLINELEN;
+ s.option = 0;
+ s.attr = 0;
+ bufferSema = CreateSema(&s); /* Create a sema to maintain status of readable data */
+ if(bufferSema <= 0)
+ {
+ printf("Error creating buffer sema\n");
+ return 1;
+ }
+
+ lineBuffer = (u8 *) AllocSysMemory(0, PS2KBD_DEFLINELEN, NULL);
+ if(lineBuffer == NULL)
+ {
+ printf("Error allocating line buffer\n");
+ return 1;
+ }
+ lineStartP = 0;
+ lineEndP = 0;
+ lineSize = PS2KBD_DEFLINELEN;
+ memset(lineBuffer, 0, PS2KBD_DEFLINELEN);
+
+ memset(devices, 0, sizeof(kbd_dev *) * PS2KBD_MAXDEV);
+ dev_count = 0;
+ kbd_readmode = PS2KBD_READMODE_NORMAL;
+ kbd_repeatrate = PS2KBD_DEFREPEATRATE;
+ memcpy(keymap, us_keymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(shiftkeymap, us_shiftkeymap, PS2KBD_KEYMAP_SIZE);
+ memcpy(keycap, us_keycap, PS2KBD_KEYMAP_SIZE);
+ memcpy(special_keys, us_special_keys, PS2KBD_KEYMAP_SIZE);
+ memcpy(control_map, us_control_map, PS2KBD_KEYMAP_SIZE);
+ memcpy(alt_map, us_alt_map, PS2KBD_KEYMAP_SIZE);
+
+ ps2kbd_init_rpc();
+ init_repeatthread();
+
+ ret = UsbRegisterDriver(&kbd_driver);
+ if(ret != USB_RC_OK)
+ {
+ printf("Error registering USB devices\n");
+ return 1;
+ }
+
+ printf("UsbRegisterDriver %d\n", ret);
+
+ return 0;
+}
diff --git a/backends/platform/ps2/iop/rpckbd/src/us_keymap.h b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
new file mode 100644
index 0000000000..57f0686cd3
--- /dev/null
+++ b/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
@@ -0,0 +1,1579 @@
+/*
+# _____ ___ ____ ___ ____
+# ____| | ____| | | |____|
+# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#ifndef __US_KEYMAP_H__
+#define __US_KEYMAP_H__
+
+/* Default US keymap */
+
+u8 us_keymap[PS2KBD_KEYMAP_SIZE] =
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 'a',
+ 'b',
+ 'c',
+ 'd',
+ 'e',
+ 'f',
+ 'g',
+ 'h',
+ 'i',
+ 'j',
+ 'k',
+ 'l',
+ 'm',
+ 'n',
+ 'o',
+ 'p',
+ 'q',
+ 'r',
+ 's',
+ 't',
+ 'u',
+ 'v',
+ 'w',
+ 'x',
+ 'y',
+ 'z',
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '0',
+ 10, /* line feed */
+ 0, /* Esc */
+ 0x7,/* BS */
+ 0x9, /* TAB */
+ 0x20,
+ '-',
+ '=',
+ '[',
+ ']',
+ '\\',
+ '#',
+ ';',
+ '\'',
+ '`',
+ ',',
+ '.',
+ '/',
+ 0, /* CL */
+ 0, // F1
+ 0, // F2
+ 0, // F3
+ 0, // F4
+ 0, // F5
+ 0, // F6
+ 0, // F7
+ 0, // F8
+ 0, // F9
+ 0, // F10
+ 0, // F11
+ 0, // F12
+ 0, // PrintScr
+ 0, // Scroll Lock
+ 0, // Pause
+ 0, // Insert
+ 0, // Home
+ 0, // Pg Up
+ 0, // Delete
+ 0, // End
+ 0, // Pg Down
+ 0, // Right
+ 0, // Left
+ 0, // Down
+ 0, // Up
+ 0, // Numlock
+ '/', // Keypad
+ '*',
+ '-',
+ '+',
+ 10,
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '0',
+ '.',
+ '\\',
+ 0,
+ 0,
+ '=',
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] =
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 'A',
+ 'B',
+ 'C',
+ 'D',
+ 'E',
+ 'F',
+ 'G',
+ 'H',
+ 'I',
+ 'J',
+ 'K',
+ 'L',
+ 'M',
+ 'N',
+ 'O',
+ 'P',
+ 'Q',
+ 'R',
+ 'S',
+ 'T',
+ 'U',
+ 'V',
+ 'W',
+ 'X',
+ 'Y',
+ 'Z',
+ '!',
+ '@',
+ '#',
+ '$',
+ '%',
+ '^',
+ '&',
+ '*',
+ '(',
+ ')',
+ 10, /* line feed */
+ 0, /* Esc */
+ 0x7,/* BS */
+ 0x9, /* TAB */
+ 0x20,
+ '_',
+ '+',
+ '{',
+ '}',
+ '|',
+ '~',
+ ':',
+ '"',
+ '~',
+ '<',
+ '>',
+ '?',
+ 0, /* CL */
+ 0, // F1
+ 0, // F2
+ 0, // F3
+ 0, // F4
+ 0, // F5
+ 0, // F6
+ 0, // F7
+ 0, // F8
+ 0, // F9
+ 0, // F10
+ 0, // F11
+ 0, // F12
+ 0, // PrintScr
+ 0, // Scroll Lock
+ 0, // Pause
+ 0, // Insert
+ 0, // Home
+ 0, // Pg Up
+ 0, // Delete
+ 0, // End
+ 0, // Pg Down
+ 0, // Right
+ 0, // Left
+ 0, // Down
+ 0, // Up
+ 0, // Numlock
+ '/', // Keypad
+ '*',
+ '-',
+ '+',
+ 10,
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '0',
+ '.',
+ '\\',
+ 0,
+ 0,
+ '=',
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+u8 us_keycap[PS2KBD_KEYMAP_SIZE] =
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 1, //a
+ 1, //b
+ 1, //c
+ 1, //d
+ 1, //e
+ 1, //f
+ 1,//g
+ 1,//h
+ 1,//i
+ 1,//j
+ 1,//k
+ 1,//l
+ 1,//m
+ 1,//n
+ 1,//o
+ 1,//p
+ 1,//q
+ 1,//r
+ 1,//s
+ 1,//t
+ 1,//u
+ 1,//v
+ 1,//w
+ 1,//x
+ 1,//y
+ 1,//z
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* line feed */
+ 0, /* Esc */
+ 0,/* BS */
+ 0, /* TAB */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* CL */
+ 0, // F1
+ 0, // F2
+ 0, // F3
+ 0, // F4
+ 0, // F5
+ 0, // F6
+ 0, // F7
+ 0, // F8
+ 0, // F9
+ 0, // F10
+ 0, // F11
+ 0, // F12
+ 0, // PrintScr
+ 0, // Scroll Lock
+ 0, // Pause
+ 0, // Insert
+ 0, // Home
+ 0, // Pg Up
+ 0, // Delete
+ 0, // End
+ 0, // Pg Down
+ 0, // Right
+ 0, // Left
+ 0, // Down
+ 0, // Up
+ 0, // Numlock
+ 0, // Keypad
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = {
+
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, //a
+ 0, //b
+ 0, //c
+ 0, //d
+ 0, //e
+ 0, //f
+ 0,//g
+ 0,//h
+ 0,//i
+ 0,//j
+ 0,//k
+ 0,//l
+ 0,//m
+ 0,//n
+ 0,//o
+ 0,//p
+ 0,//q
+ 0,//r
+ 0,//s
+ 0,//t
+ 0,//u
+ 0,//v
+ 0,//w
+ 0,//x
+ 0,//y
+ 0,//z
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* line feed */
+ 0x1B, /* Esc */
+ 0,/* BS */
+ 0, /* TAB */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* CL */
+ 1, // F1
+ 2, // F2
+ 3, // F3
+ 4, // F4
+ 5, // F5
+ 6, // F6
+ 7, // F7
+ 8, // F8
+ 9, // F9
+ 10, // F10
+ 11, // F11
+ 12, // F12
+ 32, // PrintScr
+ 33, // Scroll Lock
+ 34, // Pause
+ 35, // Insert
+ 36, // Home
+ 37, // Pg Up
+ 38, // Delete
+ 39, // End
+ 40, // Pg Down
+ 41, // Right
+ 42, // Left
+ 43, // Down
+ 44, // Up
+ 0, // Numlock
+ 0, // Keypad /
+ 0, // Keypad *
+ 0, // Keypad -
+ 0, // Keypad +
+ 0, // Keypad Enter
+ 39, // Keypad 1/End
+ 43, // Keypad 2/Down
+ 40, // Keypad 3/PageDn
+ 42, // Keypad 4/Left
+ 0, // Keypad 5
+ 41, // Keypad 6/Right
+ 36, // Keypad 7/Home
+ 44, // Keypad 8/Up
+ 37, // Keypad 9/PageUp
+ 35, // Keypad 0/Insert
+ 38, // Keypad ./Delete
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+u8 us_control_map[PS2KBD_KEYMAP_SIZE] = {
+
+ 0,
+ 0,
+ 0,
+ 0,
+ 1, //a
+ 2, //b
+ 3, //c
+ 4, //d
+ 5, //e
+ 6, //f
+ 7,//g
+ 8,//h
+ 9,//i
+ 10,//j
+ 11,//k
+ 12,//l
+ 13,//m
+ 14,//n
+ 15,//o
+ 16,//p
+ 17,//q
+ 18,//r
+ 19,//s
+ 20,//t
+ 21,//u
+ 22,//v
+ 23,//w
+ 24,//x
+ 25,//y
+ 26,//z
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* line feed */
+ 0, /* Esc */
+ 0,/* BS */
+ 0, /* TAB */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* CL */
+ 0, // F1
+ 0, // F2
+ 0, // F3
+ 0, // F4
+ 0, // F5
+ 0, // F6
+ 0, // F7
+ 0, // F8
+ 0, // F9
+ 0, // F10
+ 0, // F11
+ 0, // F12
+ 0, // PrintScr
+ 0, // Scroll Lock
+ 0, // Pause
+ 0, // Insert
+ 0, // Home
+ 0, // Pg Up
+ 0, // Delete
+ 0, // End
+ 0, // Pg Down
+ 0, // Right
+ 0, // Left
+ 0, // Down
+ 0, // Up
+ 0, // Numlock
+ 0, // Keypad
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+};
+
+u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = {
+
+ 0,
+ 0,
+ 0,
+ 0,
+ 128, //a
+ 129, //b
+ 130, //c
+ 131, //d
+ 132, //e
+ 133, //f
+ 134,//g
+ 135,//h
+ 136,//i
+ 137,//j
+ 138,//k
+ 139,//l
+ 140,//m
+ 141,//n
+ 142,//o
+ 143,//p
+ 144,//q
+ 145,//r
+ 146,//s
+ 147,//t
+ 148,//u
+ 149,//v
+ 150,//w
+ 151,//x
+ 152,//y
+ 154,//z
+ 155,
+ 156,
+ 157,
+ 158,
+ 159,
+ 160,
+ 161,
+ 162,
+ 163,
+ 164,
+ 165, /* line feed */
+ 0, /* Esc */
+ 0,/* BS */
+ 0, /* TAB */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* CL */
+ 0, // F1
+ 0, // F2
+ 0, // F3
+ 0, // F4
+ 0, // F5
+ 0, // F6
+ 0, // F7
+ 0, // F8
+ 0, // F9
+ 0, // F10
+ 0, // F11
+ 0, // F12
+ 0, // PrintScr
+ 0, // Scroll Lock
+ 0, // Pause
+ 0, // Insert
+ 0, // Home
+ 0, // Pg Up
+ 0, // Delete
+ 0, // End
+ 0, // Pg Down
+ 0, // Right
+ 0, // Left
+ 0, // Down
+ 0, // Up
+ 0, // Numlock
+ 0, // Keypad
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+#endif
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp
index 327e5bdc71..65d1e243eb 100644
--- a/backends/platform/ps2/irxboot.cpp
+++ b/backends/platform/ps2/irxboot.cpp
@@ -43,7 +43,7 @@ IrxFile irxFiles[] = {
{ "PADMAN", BIOS, NOTHING, NULL, 0 },
{ "LIBSD", BIOS, NOTHING, NULL, 0 },
- { "IOMANX.IRX", SYSTEM | NOT_HOST, NOTHING, NULL, 0 }, // already loaded by ps2link
+ { "IOMANX.IRX", SYSTEM /*| NOT_HOST*/, NOTHING, NULL, 0 }, // already loaded by ps2link
{ "FILEXIO.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "CODYVDFS.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "SJPCM.IRX", SYSTEM, NOTHING, NULL, 0 },
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index b2818ebfc0..d4dd9aedcf 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -54,9 +54,11 @@
#include "graphics/surface.h"
#include "graphics/font.h"
#include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "common/events.h"
#include "backends/platform/ps2/ps2debug.h"
+#include "backends/fs/ps2/ps2-fs-factory.h"
+
// asm("mfc0 %0, $9\n" : "=r"(tickStart));
extern void *_gp;
@@ -309,7 +311,9 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
void OSystem_PS2::init(void) {
sioprintf("Timer...\n");
_scummTimerManager = new DefaultTimerManager();
- _scummMixer = new Audio::Mixer();
+ _scummMixer = new Audio::MixerImpl(this);
+ _scummMixer->setOutputRate(44100);
+ _scummMixer->setReady(true);
initTimer();
sioprintf("Starting SavefileManager\n");
@@ -410,7 +414,8 @@ void OSystem_PS2::soundThread(void) {
// we have to produce more samples, call sound mixer
// the scratchpad at 0x70000000 is used as temporary soundbuffer
//_scummSoundProc(_scummSoundParam, (uint8*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
- Audio::Mixer::mixCallback(_scummMixer, (byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+ // Audio::Mixer::mixCallback(_scummMixer, (byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+ _scummMixer->mixCallback((byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
// demux data into 2 buffers, L and R
__asm__ (
@@ -534,10 +539,6 @@ Common::TimerManager *OSystem_PS2::getTimerManager() {
return _scummTimerManager;
}
-int OSystem_PS2::getOutputSampleRate(void) const {
- return 48000;
-}
-
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
@@ -546,6 +547,10 @@ Common::SaveFileManager *OSystem_PS2::getSavefileManager(void) {
return _saveManager;
}
+FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
+ return &Ps2FilesystemFactory::instance();
+}
+
void OSystem_PS2::setShakePos(int shakeOffset) {
_screen->setShakePos(shakeOffset);
}
@@ -727,7 +732,6 @@ void OSystem_PS2::quit(void) {
driveStandby();
fio.umount("pfs0:");
}
- //clearSoundCallback();
//setTimerCallback(NULL, 0);
_screen->wantAnim(false);
_systemQuit = true;
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 9dbe9be553..08975ab2c8 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -33,6 +33,7 @@ class DefaultTimerManager;
class Gs2dScreen;
class Ps2Input;
class Ps2SaveFileManager;
+// class Ps2FilesystemFactory;
struct IrxReference;
#define MAX_MUTEXES 16
@@ -48,7 +49,7 @@ namespace Common {
};
namespace Audio {
- class Mixer;
+ class MixerImpl;
};
class OSystem_PS2 : public OSystem {
@@ -87,7 +88,6 @@ public:
virtual bool pollEvent(Common::Event &event);
virtual Audio::Mixer *getMixer();
- virtual int getOutputSampleRate(void) const;
virtual bool openCD(int drive);
virtual bool pollCD();
@@ -112,6 +112,7 @@ public:
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
virtual Common::SaveFileManager *getSavefileManager();
+ virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(struct tm &t) const;
@@ -133,7 +134,7 @@ private:
void readRtcTime(void);
DefaultTimerManager *_scummTimerManager;
- Audio::Mixer *_scummMixer;
+ Audio::MixerImpl *_scummMixer;
bool _mouseVisible;
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index aa27f388b9..ca09286c4d 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -2,10 +2,36 @@
# $URL$
# $Id$
+ENABLED=STATIC_PLUGIN
+
#control build
DISABLE_SCALERS = true
DISABLE_HQ_SCALERS = true
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = $(ENABLED)
+#ENABLE_HE = $(ENABLED)
+ENABLE_AGI = $(ENABLED)
+ENABLE_AGOS = $(ENABLED)
+#ENABLE_CINE = $(ENABLED)
+#ENABLE_CRUISE = $(ENABLED)
+ENABLE_DRASCULA = $(ENABLED)
+ENABLE_GOB = $(ENABLED)
+#ENABLE_IGOR = $(ENABLED)
+ENABLE_KYRA = $(ENABLED)
+ENABLE_LURE = $(ENABLED)
+#ENABLE_M4 = $(ENABLED)
+#ENABLE_MADE = $(ENABLED)
+#ENABLE_PARALLACTION = $(ENABLED)
+#ENABLE_QUEEN = $(ENABLED)
+#ENABLE_SAGA = $(ENABLED)
+ENABLE_SKY = $(ENABLED)
+ENABLE_SWORD1 = $(ENABLED)
+ENABLE_SWORD2 = $(ENABLED)
+#ENABLE_TINSEL = $(ENABLED)
+#ENABLE_TOUCHE = $(ENABLED)
+
+
srcdir = ../../..
VPATH = $(srcdir)
HAVE_GCC3 = false
@@ -63,6 +89,8 @@ OBJS := psp_main.o \
kbd_l_c.o \
trace.o
+DEPDIR = .deps
+
include $(srcdir)/Makefile.common
PSP_EBOOT_SFO = param.sfo
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index d5d59d4d6e..6e9b5980d4 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -34,7 +34,7 @@
#include "backends/timer/default/default-timer.h"
#include "graphics/surface.h"
#include "graphics/scaler.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include <pspgu.h>
@@ -72,7 +72,7 @@ const OSystem::GraphicsMode OSystem_PSP::s_supportedGraphicsModes[] = {
};
-OSystem_PSP::OSystem_PSP() : _screenWidth(0), _screenHeight(0), _overlayWidth(0), _overlayHeight(0), _offscreen(0), _overlayBuffer(0), _overlayVisible(false), _shakePos(0), _mouseBuf(0), _prevButtons(0), _lastPadCheck(0), _padAccel(0) {
+OSystem_PSP::OSystem_PSP() : _screenWidth(0), _screenHeight(0), _overlayWidth(0), _overlayHeight(0), _offscreen(0), _overlayBuffer(0), _overlayVisible(false), _shakePos(0), _mouseBuf(0), _prevButtons(0), _lastPadCheck(0), _padAccel(0), _mixer(0) {
memset(_palette, 0, sizeof(_palette));
@@ -99,11 +99,11 @@ OSystem_PSP::~OSystem_PSP() {
void OSystem_PSP::initBackend() {
_savefile = new DefaultSaveFileManager();
- _mixer = new Audio::Mixer();
_timer = new DefaultTimerManager();
- setSoundCallback(Audio::Mixer::mixCallback, _mixer);
setTimerCallback(&timer_handler, 10);
+ setupMixer();
+
OSystem::initBackend();
}
@@ -586,7 +586,15 @@ void OSystem_PSP::deleteMutex(MutexRef mutex) {
SDL_DestroyMutex((SDL_mutex *)mutex);
}
-bool OSystem_PSP::setSoundCallback(SoundProc proc, void *param) {
+void OSystem_PSP::mixCallback(void *sys, byte *samples, int len) {
+ OSystem_PSP *this_ = (OSystem_PSP *)sys;
+ assert(this_);
+
+ if (this_->_mixer)
+ this_->_mixer->mixCallback(samples, len);
+}
+
+void OSystem_PSP::setupMixer(void) {
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
@@ -613,29 +621,33 @@ bool OSystem_PSP::setSoundCallback(SoundProc proc, void *param) {
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = samples;
- desired.callback = proc;
- desired.userdata = param;
- if (SDL_OpenAudio(&desired, &obtained) != 0) {
- return false;
- }
- // Note: This should be the obtained output rate, but it seems that at
- // least on some platforms SDL will lie and claim it did get the rate
- // even if it didn't. Probably only happens for "weird" rates, though.
- _samplesPerSec = obtained.freq;
- SDL_PauseAudio(0);
- return true;
-}
+ desired.callback = mixCallback;
+ desired.userdata = this;
-void OSystem_PSP::clearSoundCallback() {
- SDL_CloseAudio();
-}
+ assert(!_mixer);
+ _mixer = new Audio::MixerImpl(this);
+ assert(_mixer);
-int OSystem_PSP::getOutputSampleRate() const {
- return _samplesPerSec;
+ if (SDL_OpenAudio(&desired, &obtained) != 0) {
+ warning("Could not open audio: %s", SDL_GetError());
+ _samplesPerSec = 0;
+ _mixer->setReady(false);
+ } else {
+ // Note: This should be the obtained output rate, but it seems that at
+ // least on some platforms SDL will lie and claim it did get the rate
+ // even if it didn't. Probably only happens for "weird" rates, though.
+ _samplesPerSec = obtained.freq;
+
+ // Tell the mixer that we are ready and start the sound processing
+ _mixer->setOutputRate(_samplesPerSec);
+ _mixer->setReady(true);
+
+ SDL_PauseAudio(0);
+ }
}
void OSystem_PSP::quit() {
- clearSoundCallback();
+ SDL_CloseAudio();
SDL_Quit();
sceGuTerm();
sceKernelExitGame();
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index a59e927b97..dca6ccb036 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/system.h"
#include "graphics/surface.h"
+#include "sound/mixer_intern.h"
#include "backends/fs/psp/psp-fs-factory.h"
@@ -71,7 +72,7 @@ protected:
SceCtrlData pad;
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
Common::TimerManager *_timer;
public:
@@ -129,10 +130,8 @@ public:
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
- typedef void (*SoundProc)(void *param, byte *buf, int len);
- virtual bool setSoundCallback(SoundProc proc, void *param);
- virtual void clearSoundCallback();
- virtual int getOutputSampleRate() const;
+ static void mixCallback(void *sys, byte *samples, int len);
+ virtual void setupMixer(void);
Common::SaveFileManager *getSavefileManager() { return _savefile; }
Audio::Mixer *getMixer() { return _mixer; }
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index be3aaad926..d8394b5c9c 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -30,7 +30,7 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "icons/scummvm.xpm"
@@ -131,9 +131,7 @@ void OSystem_SDL::initBackend() {
// Create and hook up the mixer, if none exists yet (we check for this to
// allow subclasses to provide their own).
if (_mixer == 0) {
- _mixer = new Audio::Mixer();
- bool result = setSoundCallback(Audio::Mixer::mixCallback, _mixer);
- _mixer->setReady(result);
+ setupMixer();
}
// Create and hook up the timer manager, if none exists yet (we check for
@@ -172,6 +170,10 @@ OSystem_SDL::OSystem_SDL()
_joystick(0),
_currentShakePos(0), _newShakePos(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),
+#ifdef MIXER_DOUBLE_BUFFERING
+ _soundMutex(0), _soundCond(0), _soundThread(0),
+ _soundThreadIsRunning(false), _soundThreadShouldQuit(false),
+#endif
_savefile(0),
_mixer(0),
_timer(0),
@@ -193,7 +195,7 @@ OSystem_SDL::OSystem_SDL()
OSystem_SDL::~OSystem_SDL() {
SDL_RemoveTimer(_timerID);
- SDL_CloseAudio();
+ closeMixer();
free(_dirtyChecksums);
free(_currentPalette);
@@ -201,7 +203,6 @@ OSystem_SDL::~OSystem_SDL() {
free(_mouseData);
delete _savefile;
- delete _mixer;
delete _timer;
}
@@ -308,7 +309,7 @@ void OSystem_SDL::quit() {
SDL_ShowCursor(SDL_ENABLE);
SDL_RemoveTimer(_timerID);
- SDL_CloseAudio();
+ closeMixer();
free(_dirtyChecksums);
free(_currentPalette);
@@ -316,7 +317,6 @@ void OSystem_SDL::quit() {
free(_mouseData);
delete _savefile;
- delete _mixer;
delete _timer;
SDL_Quit();
@@ -391,7 +391,111 @@ void OSystem_SDL::deleteMutex(MutexRef mutex) {
#pragma mark --- Audio ---
#pragma mark -
-bool OSystem_SDL::setSoundCallback(SoundProc proc, void *param) {
+#ifdef MIXER_DOUBLE_BUFFERING
+
+void OSystem_SDL::mixerProducerThread() {
+ byte nextSoundBuffer;
+
+ SDL_LockMutex(_soundMutex);
+ while (true) {
+ // Wait till we are allowed to produce data
+ SDL_CondWait(_soundCond, _soundMutex);
+
+ if (_soundThreadShouldQuit)
+ break;
+
+ // Generate samples and put them into the next buffer
+ nextSoundBuffer = _activeSoundBuf ^ 1;
+ _mixer->mixCallback(_soundBuffers[nextSoundBuffer], _soundBufSize);
+
+ // Swap buffers
+ _activeSoundBuf = nextSoundBuffer;
+ }
+ SDL_UnlockMutex(_soundMutex);
+}
+
+int SDLCALL OSystem_SDL::mixerProducerThreadEntry(void *arg) {
+ OSystem_SDL *this_ = (OSystem_SDL *)arg;
+ assert(this_);
+ this_->mixerProducerThread();
+ return 0;
+}
+
+
+void OSystem_SDL::initThreadedMixer(Audio::MixerImpl *mixer, uint bufSize) {
+ _soundThreadIsRunning = false;
+ _soundThreadShouldQuit = false;
+
+ // Create mutex and condition variable
+ _soundMutex = SDL_CreateMutex();
+ _soundCond = SDL_CreateCond();
+
+ // Create two sound buffers
+ _activeSoundBuf = 0;
+ _soundBufSize = bufSize;
+ _soundBuffers[0] = (byte *)calloc(1, bufSize);
+ _soundBuffers[1] = (byte *)calloc(1, bufSize);
+
+ _soundThreadIsRunning = true;
+
+ // Finally start the thread
+ _soundThread = SDL_CreateThread(mixerProducerThreadEntry, this);
+}
+
+void OSystem_SDL::deinitThreadedMixer() {
+ // Kill thread?? _soundThread
+
+ if (_soundThreadIsRunning) {
+ // Signal the producer thread to end, and wait for it to actually finish.
+ _soundThreadShouldQuit = true;
+ SDL_CondBroadcast(_soundCond);
+ SDL_WaitThread(_soundThread, NULL);
+
+ // Kill the mutex & cond variables.
+ // Attention: AT this point, the mixer callback must not be running
+ // anymore, else we will crash!
+ SDL_DestroyMutex(_soundMutex);
+ SDL_DestroyCond(_soundCond);
+
+ _soundThreadIsRunning = false;
+
+ free(_soundBuffers[0]);
+ free(_soundBuffers[1]);
+ }
+}
+
+
+void OSystem_SDL::mixCallback(void *arg, byte *samples, int len) {
+ OSystem_SDL *this_ = (OSystem_SDL *)arg;
+ assert(this_);
+ assert(this_->_mixer);
+
+ assert((int)this_->_soundBufSize == len);
+
+ // Lock mutex, to ensure our data is not overwritten by the producer thread
+ SDL_LockMutex(this_->_soundMutex);
+
+ // Copy data from the current sound buffer
+ memcpy(samples, this_->_soundBuffers[this_->_activeSoundBuf], len);
+
+ // Unlock mutex and wake up the produced thread
+ SDL_UnlockMutex(this_->_soundMutex);
+ SDL_CondSignal(this_->_soundCond);
+}
+
+#else
+
+void OSystem_SDL::mixCallback(void *sys, byte *samples, int len) {
+ OSystem_SDL *this_ = (OSystem_SDL *)sys;
+ assert(this_);
+ assert(this_->_mixer);
+
+ this_->_mixer->mixCallback(samples, len);
+}
+
+#endif
+
+void OSystem_SDL::setupMixer() {
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
@@ -403,7 +507,7 @@ bool OSystem_SDL::setSoundCallback(SoundProc proc, void *param) {
_samplesPerSec = SAMPLES_PER_SEC;
// Determine the sample buffer size. We want it to store enough data for
- // about 1/32th of a second. Note that it must be a power of two.
+ // about 1/16th of a second. Note that it must be a power of two.
// So e.g. at 22050 Hz, we request a sample buffer size of 2048.
int samples = 8192;
while (16 * samples >= _samplesPerSec) {
@@ -415,23 +519,51 @@ bool OSystem_SDL::setSoundCallback(SoundProc proc, void *param) {
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = (uint16)samples;
- desired.callback = proc;
- desired.userdata = param;
+ desired.callback = mixCallback;
+ desired.userdata = this;
+
+ // Create the mixer instance
+ assert(!_mixer);
+ _mixer = new Audio::MixerImpl(this);
+ assert(_mixer);
+
if (SDL_OpenAudio(&desired, &obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
- return false;
+ _samplesPerSec = 0;
+ _mixer->setReady(false);
+ } else {
+ // Note: This should be the obtained output rate, but it seems that at
+ // least on some platforms SDL will lie and claim it did get the rate
+ // even if it didn't. Probably only happens for "weird" rates, though.
+ _samplesPerSec = obtained.freq;
+ debug(1, "Output sample rate: %d Hz", _samplesPerSec);
+
+ // Tell the mixer that we are ready and start the sound processing
+ _mixer->setOutputRate(_samplesPerSec);
+ _mixer->setReady(true);
+
+#ifdef MIXER_DOUBLE_BUFFERING
+ initThreadedMixer(_mixer, obtained.samples * 4);
+#endif
+
+ // start the sound system
+ SDL_PauseAudio(0);
}
- // Note: This should be the obtained output rate, but it seems that at
- // least on some platforms SDL will lie and claim it did get the rate
- // even if it didn't. Probably only happens for "weird" rates, though.
- _samplesPerSec = obtained.freq;
- debug(1, "Output sample rate: %d Hz", _samplesPerSec);
- SDL_PauseAudio(0);
- return true;
}
-int OSystem_SDL::getOutputSampleRate() const {
- return _samplesPerSec;
+void OSystem_SDL::closeMixer() {
+ if (_mixer)
+ _mixer->setReady(false);
+
+ SDL_CloseAudio();
+
+ delete _mixer;
+ _mixer = 0;
+
+#ifdef MIXER_DOUBLE_BUFFERING
+ deinitThreadedMixer();
+#endif
+
}
Audio::Mixer *OSystem_SDL::getMixer() {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 2cbadae2f4..4ad588f5f5 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -38,7 +38,7 @@
namespace Audio {
- class Mixer;
+ class MixerImpl;
}
namespace Common {
@@ -51,6 +51,15 @@ namespace Common {
#define USE_OSD 1
#endif
+#if defined(MACOSX)
+// On Mac OS X, we need to double buffer the audio buffer, else anything
+// which produces sampled data with high latency (like the MT-32 emulator)
+// will sound terribly.
+// This could be enabled for more / most ports in the future, but needs some
+// testing.
+#define MIXER_DOUBLE_BUFFERING 1
+#endif
+
enum {
GFX_NORMAL = 0,
@@ -134,8 +143,11 @@ public:
virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
// Set function that generates samples
- typedef void (*SoundProc)(void *param, byte *buf, int len);
- virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
+ virtual void setupMixer();
+ static void mixCallback(void *s, byte *samples, int len);
+
+ virtual void closeMixer();
+
virtual Audio::Mixer *getMixer();
// Poll CD status
@@ -186,7 +198,6 @@ public:
virtual void setWindowCaption(const char *caption);
virtual bool openCD(int drive);
- virtual int getOutputSampleRate() const;
virtual bool hasFeature(Feature f);
virtual void setFeatureState(Feature f, bool enable);
@@ -369,15 +380,32 @@ protected:
*/
MutexRef _graphicsMutex;
+#ifdef MIXER_DOUBLE_BUFFERING
+ SDL_mutex *_soundMutex;
+ SDL_cond *_soundCond;
+ SDL_Thread *_soundThread;
+ bool _soundThreadIsRunning;
+ bool _soundThreadShouldQuit;
+
+ byte _activeSoundBuf;
+ uint _soundBufSize;
+ byte *_soundBuffers[2];
+
+ void mixerProducerThread();
+ static int SDLCALL mixerProducerThreadEntry(void *arg);
+ void initThreadedMixer(Audio::MixerImpl *mixer, uint bufSize);
+ void deinitThreadedMixer();
+#endif
+
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
SDL_TimerID _timerID;
Common::TimerManager *_timer;
-
+protected:
void addDirtyRgnAuto(const byte *buf);
void makeChecksums(const byte *buf);
diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl
index 99c037379d..b576bb3993 100644
--- a/backends/platform/symbian/AdaptAllMMPs.pl
+++ b/backends/platform/symbian/AdaptAllMMPs.pl
@@ -6,31 +6,37 @@ chdir("../../../");
# list of project files to process
@mmp_files = (
- "mmp/scummvm_scumm.mmp",
- "mmp/scummvm_queen.mmp",
- "mmp/scummvm_agos.mmp",
- "mmp/scummvm_sky.mmp",
- "mmp/scummvm_gob.mmp",
- "mmp/scummvm_saga.mmp",
- "mmp/scummvm_kyra.mmp",
- "mmp/scummvm_sword1.mmp",
- "mmp/scummvm_sword2.mmp",
- "mmp/scummvm_lure.mmp",
- "mmp/scummvm_cine.mmp",
- "mmp/scummvm_agi.mmp",
- "mmp/scummvm_touche.mmp",
- "mmp/scummvm_parallaction.mmp",
- "mmp/scummvm_cruise.mmp",
- "mmp/scummvm_drascula.mmp",
- "mmp/scummvm_igor.mmp",
- "mmp/scummvm_made.mmp",
+
+ # Engine Project files
+ "mmp/scummvm_agi.mmp",
+ "mmp/scummvm_agos.mmp",
+ "mmp/scummvm_cine.mmp",
+ "mmp/scummvm_cruise.mmp",
+ "mmp/scummvm_drascula.mmp",
+ "mmp/scummvm_gob.mmp",
+ "mmp/scummvm_igor.mmp",
+ "mmp/scummvm_kyra.mmp",
+ "mmp/scummvm_lure.mmp",
"mmp/scummvm_m4.mmp",
- "S60/ScummVM_S60.mmp",
- "S60v3/ScummVM_S60v3.mmp",
- "S80/ScummVM_S80.mmp",
+ "mmp/scummvm_made.mmp",
+ "mmp/scummvm_parallaction.mmp",
+ "mmp/scummvm_queen.mmp",
+ "mmp/scummvm_saga.mmp",
+ "mmp/scummvm_scumm.mmp",
+ "mmp/scummvm_sky.mmp",
+ "mmp/scummvm_sword1.mmp",
+ "mmp/scummvm_sword2.mmp",
+ "mmp/scummvm_touche.mmp",
+
+
+ # Target Platform Project Files
+ "S60/ScummVM_S60.mmp",
+ "S60v3/ScummVM_S60v3.mmp",
+ "S80/ScummVM_S80.mmp",
"S90/ScummVM_S90.mmp",
- "UIQ2/ScummVM_UIQ2.mmp",
- "UIQ3/ScummVM_UIQ3.mmp"
+ "UIQ2/ScummVM_UIQ2.mmp",
+ "UIQ3/ScummVM_UIQ3.mmp"
+
);
# do this first to set all *.mmp & *.inf files to *.*.in states
@@ -43,7 +49,7 @@ Updating slave MACRO settings in MMP files from master 'scummvm_base.mmp'
";
-# do this first so we have @DisableDefines for correct inclusion of SOURCE files later
+# do this first so we have @EnabledDefines and @DisabledDefines for correct inclusion of SOURCE files later
UpdateSlaveMacros();
print "
@@ -53,33 +59,40 @@ Preparing to update all the Symbian MMP project files with objects from module.m
";
+
+# some modules.mk files have #ifndef ENABLE_XXXX blocks:
my @section_empty = (""); # section standard: no #ifdef's in module.mk files
-my @sections_scumm = ("", "DISABLE_SCUMM_7_8", "DISABLE_HE"); # special sections for engine SCUMM
+my @sections_scumm = ("", "ENABLE_SCUMM_7_8", "ENABLE_HE"); # special sections for engine SCUMM
+
# files excluded from build, case insensitive, will be matched in filename string only
-my @excludes_snd = (
- "mt32",
- "fluidsynth",
- "i386",
- "part.cpp",
- "partial.cpp",
- "partialmanager.cpp",
+my @excludes_snd = (
+ "mt32.*",
+ "fluidsynth.cpp",
+ "i386.cpp",
+ "part.*",
"synth.cpp",
"tables.cpp",
- "freeverb.cpp"
-);
+ "freeverb.cpp",
+ "rate.*" # not really needed, USE_ARM_SOUND_ASM currently not parsed correctly,
+ # "rate[_arm|_arm_asm].(cpp|s)" will be added later based on WINS/ARM build!
+ # These #defines for compile time are set in portdefs.h
+);
-my @excludes_graphics = (
-"iff.cpp"
-);
+my @excludes_graphics = (
+ "iff.cpp"
+);
+# the USE_ARM_* defines not parsed correctly, exclude manually:
my @excludes_scumm = (
- "codec47ARM.cpp",
- "gfxARM.cpp",
- "proc3arm.cpp"
+ ".*ARM.*", # the *ARM.s files are added in .mpp files based on WINS/ARM build!
+ # USE_ARM_SMUSH_ASM codec47ARM.s
+ # USE_ARM_GFX_ASM gfxARM.s
+ # USE_ARM_COSTUME_ASM proc3ARM.s compiled, linked?, but *not* used :P (portdefs.h)
);
-#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray])
+
+#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray])
ParseModule("_base", "base", \@section_empty); # now in ./TRG/ScummVM_TRG.mmp, these never change anyways...
ParseModule("_base", "common", \@section_empty);
ParseModule("_base", "gui", \@section_empty);
@@ -98,14 +111,14 @@ ParseModule("_sword1", "sword1", \@section_empty);
ParseModule("_sword2", "sword2", \@section_empty);
ParseModule("_lure", "lure", \@section_empty);
ParseModule("_cine", "cine", \@section_empty);
-ParseModule("_agi", "agi", \@section_empty);
+ParseModule("_agi", "agi", \@section_empty);
ParseModule("_touche", "touche", \@section_empty);
ParseModule("_parallaction","parallaction",\@section_empty);
ParseModule("_cruise", "cruise", \@section_empty);
ParseModule("_drascula","drascula", \@section_empty);
ParseModule("_igor", "igor", \@section_empty);
ParseModule("_made", "made", \@section_empty);
-ParseModule("_m4", "m4", \@section_empty);
+ParseModule("_m4", "m4", \@section_empty);
print "
=======================================================================================
Done. Enjoy :P
@@ -115,7 +128,7 @@ Done. Enjoy :P
##################################################################################################################
##################################################################################################################
-# parses multiple sections per mmp/module
+# parses multiple sections per mmp/module
sub ParseModule
{
my ($mmp,$module,$sections,$exclusions) = @_;
@@ -140,7 +153,7 @@ sub CheckForModuleMK
if (-d $item)
{
#print "$item\n";
-
+
opendir DIR, $item;
#my @Files = readdir DIR;
my @Files = grep s/^([^\.].*)$/$1/, readdir DIR;
@@ -156,9 +169,10 @@ sub CheckForModuleMK
if (-f $item and $item =~ /.*\/module.mk$/)
{
my $sec = "";
+ my $isenable;
my $ObjectsSelected = 0;
my $ObjectsTotal = 0;
-
+
print "$item for section '$section' ... ";
open FILE, $item;
@@ -167,14 +181,24 @@ sub CheckForModuleMK
my $count = @lines;
print "$count lines";
-
+
A: foreach $line (@lines)
{
- # found a section? reset
+ # all things we need are inside #ifdef sections,
+ # there is nothing we need in #ifndef sections: so ignore these for now
+
+ # found a section? reset
+ if ($line =~ /^ifdef (.*)/)
+ {
+ $sec = $1;
+ $isenable = 1;
+ }
if ($line =~ /^ifndef (.*)/)
{
$sec = $1;
+ $isenable = 0;
}
+
# found an object? Not uncommented!
if (!($line =~ /^#/) && $line =~ s/\.o/.cpp/)
{
@@ -187,27 +211,47 @@ sub CheckForModuleMK
$line =~ s/ \\//; # remove possible trailing ' \'
$line =~ s/\//\\/g; # replace / with \
chop($line); # remove \n
-
+
# do we need to skip this file? According to our own @exclusions array
foreach $exclusion (@exclusions)
{
if ($line =~ /$exclusion/i)
{
- print "\n ! $line (excluded, \@exclusions[$exclusion])";
+ my $reason = "excluded, \@exclusions[$exclusion]";
+ print "\n ! $line ($reason)";
+ $output .= "//SOURCE $line ($reason)\n";
next A;
}
}
-
- # do we need to skip this file? According to MACROs in .MMPs
- foreach $DisableDefine (@DisableDefines)
+
+ # do we need to do this file? According to MACROs in .MMPs
+ my $found = 0;
+ foreach $EnableDefine (@EnabledDefines)
{
- if ($DisableDefine eq $section && $section ne '')
+ if (($EnableDefine eq $section) && ($section ne ''))
{
- print "\n !$line (excluded, MACRO $DisableDefine)";
- next A;
+ $found = 1;
+ last;
}
}
-
+ foreach $DisableDefine (@DisabledDefines)
+ {
+ if (($DisableDefine eq $section) && ($section ne ''))
+ {
+ $found = 0;
+ last;
+ }
+ }
+ # always allow non-sections
+ $found = 1 if ($section eq '');
+ if (!$found)
+ {
+ my $reason = "excluded, MACRO $section";
+ print "\n !$line ($reason)";
+ $output .= "//SOURCE $line ($reason)\n";
+ next A;
+ }
+
$ObjectsSelected++;
#print "\n $line";
$output .= "SOURCE $line\n";
@@ -230,7 +274,7 @@ sub UpdateProjectFile
my $updated = " Updated @ ".localtime();
my $name;
my @mmp_files_plus_one = @mmp_files;
- unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
+ unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
foreach $name (@mmp_files_plus_one)
{
@@ -239,23 +283,23 @@ sub UpdateProjectFile
open FILE, "$file";
my @lines = <FILE>;
close FILE;
-
+
my $onestr = join("",@lines);
-
+
if ($onestr =~ /$n/)
{
print " - $name @ $n updating ... ";
-
+
$onestr =~ s/$a.*$b/$a$updated\n$output$b/s;
open FILE, ">$file";
print FILE $onestr;
close FILE;
-
+
print "done.\n";
}
}
-
+
$output = "";
}
@@ -265,7 +309,7 @@ sub UpdateSlaveMacros
{
my $updated = " Updated @ ".localtime();
- my $name = "mmp/scummvm_base.mmp";
+ my $name = "mmp/scummvm_base.mmp";
my $file = "$buildDir/$name";
print "Reading master MACROS from backends/symbian/$name ... ";
@@ -279,7 +323,7 @@ sub UpdateSlaveMacros
my $b = "\/\/STOP_$n\/\/";
$onestr =~ /$a(.*)$b/s;
my $macros = $1;
-
+
my $libs_first = "\n// automagically enabled static libs from macros above\n";
my $libs_second = "STATICLIBRARY scummvm_base.lib // must be above USE_* .libs\n";
my $macro_counter = 0;
@@ -292,32 +336,45 @@ sub UpdateSlaveMacros
if ($line =~ /^.*MACRO\s*([0-9A-Z_]*)\s*\/\/\s*LIB\:(.*)$/)
{
my $macro = $1; my $lib = $2;
-
+
# this macro enabled? then also add the .lib
if ($line =~ /^\s*MACRO\s*$macro/m)
{
- # these are the USE_ libs
+ # add an USE_ lib? (these need to be added @ the beginning, before _base)
$libs_second .= "STATICLIBRARY $lib\n" if ($macro =~ /^USE_/);
+
+ # add an ENABLE_ lib? (these need to be added @ the end, after _base)
+ if ($macro =~ /^ENABLE_/)
+ {
+ $libs_first .= "STATICLIBRARY $lib\n";
+
+ # add projects for BLD.INF's
+ my $projectname = substr("$lib",0,-4);
+ $projects .= "..\\mmp\\$projectname.mmp\n";
+ }
}
else
{
- # these are the non DISABLED_ libs
- $libs_first .= "STATICLIBRARY $lib\n" if ($macro =~ /^DISABLE_/);
-
- # add projects for BLD.INF's
- my $projectname = substr("$lib",0,-4);
- $projects .= "..\\mmp\\$projectname.mmp\n" if ($macro =~ /^DISABLE_/);
+ # skip lines not beginning with "MACRO" (like "//MACRO")
}
$macro_counter++;
}
+
# not commented out? then add the macro to output string
if ($line =~ /^\s*MACRO\s*([0-9A-Z_]*)\s*/)
{
my $macro = $1;
$macros2 .= "$line\n";
- push @DisableDefines, $macro; # used in CheckForModuleMK()!!
+ if ($macro =~ /^ENABLE_/)
+ {
+ push @EnabledDefines, $macro; # used in CheckForModuleMK()!!
+ }
+ elsif ($macro =~ /^DISABLE_/)
+ {
+ push @DisabledDefines, $macro; # used in CheckForModuleMK()!!
+ }
}
- }
+ }
print "$macro_counter macro lines.\n";
@@ -328,23 +385,23 @@ sub UpdateSlaveMacros
$m = "AUTO_PROJECTS";
$p = "\/\/START_$m\/\/";
$q = "\/\/STOP_$m\/\/";
-
+
foreach $name (@mmp_files)
{
$file = "$buildDir/$name";
$fileBLDINF = $buildDir .'/'. substr($name, 0, rindex($name, "/")) . "/BLD.INF";
print "Updating macros in $file ... ";
#print "Updating macros in backends/symbian/$name ... ";
-
+
open FILE, "$file"; @lines = <FILE>; close FILE;
$onestr = join("",@lines);
-
+
my $extralibs = ""; # output
# slash in name means it's a phone specific build file: add LIBs
$extralibs .= "$libs_first$libs_second" if (-e $fileBLDINF);
-
+
$onestr =~ s/$a.*$b/$a$updated$macros2$extralibs$b/s;
-
+
open FILE, ">$file"; print FILE $onestr; close FILE;
my $count = @lines;
@@ -358,13 +415,13 @@ sub UpdateSlaveMacros
open FILE, "$fileBLDINF"; @lines = <FILE>; close FILE;
$onestr = join("",@lines);
-
+
$onestr =~ s/$p.*$q/$p$updated$projects$q/s;
-
+
open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE;
}
}
-}
+}
##################################################################################################################
@@ -372,10 +429,10 @@ sub ResetProjectFiles()
{
my $onestr, @lines;
my @mmp_files_plus_one = @mmp_files;
-# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
-
+# unshift @mmp_files_plus_one, "mmp/scummvm_base.mmp";
+
print "Resetting project files: ";
-
+
# we don't need to do mmp/scummvm_base.mmp", it was done in BuildPackageUpload.pl before the call to this script
foreach $name (@mmp_files_plus_one)
{
@@ -395,7 +452,7 @@ sub ResetProjectFiles()
$onestr = join("",@lines);
open FILE, ">$fileBLDINF"; print FILE $onestr; close FILE;
}
- }
+ }
print "... done.\n";
}
diff --git a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
index a40f8b7663..94edbf4fcf 100644
--- a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
+++ b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl
@@ -8,6 +8,7 @@ require "BuildPackageUpload_LocalSettings.pl";
##################################################################################################################
# prep some vars
+# the dir containing the build files: '.\backends\platforms\symbian\$SDK_BuildDir\'
$SDK_BuildDirs{'UIQ2'} = "UIQ2";
$SDK_BuildDirs{'UIQ3'} = "UIQ3";
$SDK_BuildDirs{'S60v1'} = "S60";
@@ -16,6 +17,7 @@ $SDK_BuildDirs{'S60v3'} = "S60v3";
$SDK_BuildDirs{'S80'} = "S80";
$SDK_BuildDirs{'S90'} = "S90";
+# the target name inserted here: 'abld BUILD $SDK_TargetName UREL'
$SDK_TargetName{'UIQ2'} = "armi";
$SDK_TargetName{'UIQ3'} = "gcce";
$SDK_TargetName{'S60v1'}= "armi";
@@ -24,6 +26,7 @@ $SDK_TargetName{'S60v3'}= "gcce";
$SDK_TargetName{'S80'} = "armi";
$SDK_TargetName{'S90'} = "armi";
+# Binaries are installed here: '$SDK_RootDirs\epoc32\release\$SDK_TargetDir\urel\'
$SDK_TargetDir{'UIQ2'} = "armi";
$SDK_TargetDir{'UIQ3'} = "armv5";
$SDK_TargetDir{'S60v1'} = "armi";
@@ -34,11 +37,11 @@ $SDK_TargetDir{'S90'} = "armi";
$build_dir = getcwd();
$output_dir = "$build_dir/Packages";
-chdir("../../");
+chdir("../../../");
$base_dir = getcwd();
chdir($build_dir);
-$build_log_out = "$build_dir/Build.out.log";
-$build_log_err = "$build_dir/Build.err.log";
+$build_log_out = "$build_dir/out.build.out.log"; # don't start these files with "Build"
+$build_log_err = "$build_dir/out.build.err.log"; # so "B"+TAB completion works in 1 go :P
$initial_path = $ENV{'PATH'}; # so we can start with a fresh PATH for each Build
@@ -54,14 +57,27 @@ $PackagesUploaded = 0;
@ErrorMessages = ();
$ftp_url = "FTP://$FTP_User\@$FTP_Host/$FTP_Dir/";
-$ExtraMacros = "MACRO NONSTANDARD_PORT\n";
-$ExtraMacros .= "MACRO DISABLE_FANCY_THEMES\n";
+# these macros are always defined:
+$ExtraMacros = "MACRO NONSTANDARD_PORT\n";
+$ExtraMacros .= "MACRO DISABLE_FANCY_THEMES\n";
+$ExtraMacros .= "MACRO DISABLE_SCALERS\n";
+$ExtraMacros .= "MACRO DISABLE_HQ_SCALERS\n";
# prep nice list of SDKs
#while( ($SDK, $RootDir) = each(%SDK_RootDirs) )
foreach $SDK (sort keys(%SDK_RootDirs))
{
- $SDKs .= "$SDK\t$SDK_RootDirs{$SDK}\n\t\t\t";
+ # see if it exists!
+ if (-d $SDK_RootDirs{$SDK})
+ {
+ $SDKs .= "$SDK\t$SDK_RootDirs{$SDK}\n\t\t\t";
+ }
+ else # missing?
+ {
+ $SDKs .= "$SDK\t$SDK_RootDirs{$SDK}\t[MISSING: Skipping!]\n\t\t\t";
+ # remove it from array, to prevent building!
+ delete $SDK_RootDirs{$SDK};
+ }
}
# prep nice list of Libraries
@@ -69,7 +85,16 @@ while( ($SDK, $Value) = each(%SDK_LibraryDirs) )
{
while( ($Library, $Path) = each(%{$SDK_LibraryDirs{$SDK}}) )
{
- $PresentLibs{$Library} = $Path;
+ # maybe it's already been built?
+ if (-e $SDK_RootDirs{$SDK}."\\epoc32\\release\\$SDK_TargetDir{$SDK}\\urel\\$Library")
+ {
+ $PresentLibs{$Library} = "$Path [EXISTS: Skipping!]";
+ delete $SDK_LibraryDirs{$SDK}{$Library};
+ }
+ else # make it!
+ {
+ $PresentLibs{$Library} = "$Path";
+ }
}
}
foreach $Library (sort keys(%PresentLibs))
@@ -78,10 +103,37 @@ foreach $Library (sort keys(%PresentLibs))
}
# prep nice list of Variations
-while( ($SDK, $Value) = each(%SDK_Variations) )
+#while( ($SDK, $Value) = each(%SDK_Variations) )
+#{
+# while( ($Variation, $Value2) = each(%{$SDK_Variations{$SDK}}) )
+# {
+# $Extra = ($Variation ne '' ? "_$Variation" : "");
+# if ($SDK eq "ALL")
+# {
+# while( ($SDK2, $RootDir) = each(%SDK_RootDirs) )
+# {
+# if ($SDK_RootDirs{$SDK2} ne '') # is this SDK listed as installed? (fails silently)
+# {
+# push @Packages, sprintf($file_tpl_sis, $version_tpl_sis, $SDK2, $Extra);
+# $PackagesQueued++;
+# }
+# }
+# }
+# else
+# {
+# if ($SDK_RootDirs{$SDK} ne '') # is this SDK listed as installed? (fails silently)
+# {
+# push @Packages, sprintf($file_tpl_sis, $version_tpl_sis, $SDK, $Extra);
+# $PackagesQueued++;
+# }
+# }
+# }
+#}
+while( ($SDK, $Value) = each(%VariationSets) )
{
- while( ($Variation, $Value2) = each(%{$SDK_Variations{$SDK}}) )
+ while( ($Variation, $FeaturesBlock) = each(%{$VariationSets{$SDK}}) )
{
+#my $MacroBlock = &MakeMppMacroDefs($FeaturesBlock);
$Extra = ($Variation ne '' ? "_$Variation" : "");
if ($SDK eq "ALL")
{
@@ -92,7 +144,7 @@ while( ($SDK, $Value) = each(%SDK_Variations) )
push @Packages, sprintf($file_tpl_sis, $version_tpl_sis, $SDK2, $Extra);
$PackagesQueued++;
}
- }
+ }
}
else
{
@@ -118,7 +170,7 @@ Preparing to Build, Package & Upload $PackagesQueued SymbianOS ScummVM variation
SDKs inst'd \t$SDKs ".( %SDK_LibraryDirs ? "
LIBs inst'd \t$LIBs " : "" )."
- $PackagesQueued Variations \t$PackagesStr
+ $PackagesQueued Variations \t$PackagesStr
DIR base \t$base_dir
build \t$build_dir
output \t$output_dir
@@ -126,7 +178,7 @@ Preparing to Build, Package & Upload $PackagesQueued SymbianOS ScummVM variation
FTP host \t$FTP_Host
user \t$FTP_User
pass \t"."*" x length($FTP_Pass)."
- dir \t$FTP_Dir
+ dir \t$FTP_Dir
" : "" )."
=======================================================================================
Press Ctrl-C to abort or enter to continue Build, Package & Upload $PackagesQueued Variations...
@@ -142,7 +194,7 @@ unlink($build_log_out);
unlink($build_log_err);
# init _base.mmp now, so we can start changing it without affecting the CVS version _base.mmp.in!
-my $name = "mmp/scummvm_base.mmp";
+my $name = "mmp/scummvm_base.mmp";
my $file = "$build_dir/$name";
open FILE, "$file.in"; @lines = <FILE>; close FILE;
my $onestr = join("",@lines);
@@ -161,15 +213,21 @@ while( ($SDK, $Value) = each(%SDK_LibraryDirs) )
{
if ($SDK_RootDirs{$SDK2} ne '') # is this SDK listed as installed? (fails silently)
{
+ # do we already have this one?
+ next if (-e $SDK_RootDirs{$SDK2}."\\epoc32\\release\\$SDK_TargetDir{$SDK2}\\urel\\$Library");
+
$LibrariesQueued++;
DoLibrary($SDK2, $Library, $Path);
}
- }
+ }
}
else
{
if ($SDK_RootDirs{$SDK} ne '') # is this SDK listed as installed? (fails silently)
{
+ # do we already have this one?
+ next if (-e $SDK_RootDirs{$SDK}."\\epoc32\\release\\$SDK_TargetDir{$SDK}\\urel\\$Library");
+
$LibrariesQueued++;
DoLibrary($SDK, $Library, $Path);
}
@@ -194,8 +252,33 @@ while( ($SDK, $VariationsHash) = each(%SDK_Variations) )
{
DoVariation($SDK2, $Variation, $MacroBlock);
}
+ }
+ }
+ else
+ {
+ if ($SDK_RootDirs{$SDK} ne '')
+ {
+ DoVariation($SDK, $Variation, $MacroBlock);
}
}
+ }
+}
+
+while( ($SDK, $VariationsHash) = each(%VariationSets) )
+{
+ while( ($Variation, $FeaturesBlock) = each(%{$VariationSets{$SDK}}) )
+ {
+ my $MacroBlock = &MakeMppMacroDefs($FeaturesBlock);
+ if ($SDK eq "ALL")
+ {
+ while( ($SDK2, $RootDir) = each(%SDK_RootDirs) )
+ {
+ if ($SDK_RootDirs{$SDK2} ne '')
+ {
+ DoVariation($SDK2, $Variation, $MacroBlock);
+ }
+ }
+ }
else
{
if ($SDK_RootDirs{$SDK} ne '')
@@ -248,7 +331,81 @@ print " SumthinWicked wishes you a ridiculously good and optimally happy d
##################################################################################################################
##################################################################################################################
-# Build, Package & Upload a single Variation
+# create a set of "MACRO xxx" definitions for use in the scummvm_base.mpp file
+sub MakeMppMacroDefs
+{
+ my ($features) = @_;
+
+ my %EnabledFeatures = ();
+ foreach (split(/\W|\r|\n/, $features))
+ {
+ if ($_ ne "")
+ {
+ #print "FEATURE: $_\n";
+ $EnabledFeatures{$_} = 1;
+ }
+ }
+
+ my $MacroDefs = "";
+
+ $MacroDefs .= " // Features //\n";
+ foreach my $e (sort keys %UseableFeatures)
+ {
+ my $E = uc($e);
+ if ($EnabledFeatures{$e})
+ {
+ $MacroDefs .= "MACRO USE_$E // LIB:$UseableFeatures{$e}\n";
+ # this one is used: remove it now
+ delete $EnabledFeatures{$e};
+ # this will leave us with a list of unparsed options!
+ }
+ else
+ {
+ $MacroDefs .= "//MACRO USE_$E\n";
+ }
+ }
+
+ $MacroDefs .= " // Engines //\n";
+ foreach my $e (sort @EnablableEngines)
+ {
+ my $E = uc($e);
+ if ($EnabledFeatures{$e})
+ {
+ $MacroDefs .= "MACRO ENABLE_$E // LIB:scummvm_$e.lib\n";
+ # this one is used: remove it now
+ delete $EnabledFeatures{$e};
+ # this will leave us with a list of unparsed options!
+ }
+ else
+ {
+ $MacroDefs .= "//MACRO ENABLE_$E\n";
+ }
+ }
+
+ $MacroDefs .= " // SubEngines //\n";
+ foreach my $e (sort @EnablableSubEngines)
+ {
+ my $E = uc($e);
+ if ($EnabledFeatures{$e})
+ {
+ $MacroDefs .= "MACRO ENABLE_$E\n";
+ # this one is used: remove it now
+ delete $EnabledFeatures{$e};
+ # this will leave us with a list of unparsed options!
+ }
+ else
+ {
+ $MacroDefs .= "//MACRO ENABLE_$E\n";
+ }
+ }
+
+#print "\n\n'$features' ==> $MacroDefs\n\n\n";
+ return $MacroDefs;
+}
+
+##################################################################################################################
+
+# Build, Package & Upload a single Variation
sub DoLibrary
{
my ($SDK, $Library, $Path) = @_;
@@ -278,19 +435,19 @@ my $header = "
my $OK = 1;
PrepSdkPaths($SDK);
-
+
chdir($Path) or $OK=0;
PrintErrorMessage("Changing to $Path failed!") if (!$OK);
- return 0 if (!$OK);
+ return 0 if (!$OK);
PrintMessage("Cleaning for $Target") if (!$ReallyQuiet);
system("bldmake bldfiles > NUL 2> NUL");
PrintErrorMessage("'bldmake bldfiles' exited with value " . ($? >> 8)) if ($? >> 8);
- system("abld clean $TargetName urel > NUL 2> NUL");
- PrintErrorMessage("'abld clean $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
+ system("abld CLEAN $TargetName UREL > NUL 2> NUL");
+ PrintErrorMessage("'abld CLEAN $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
# remove file so we are sure that after .lib generation we have a fresh copy!
if (-e $TargetFilePath) { unlink($TargetFilePath) or PrintErrorMessage("Removing $TargetFilePath"); }
-
+
my $Redirection = "OUT:file, ERR:".($RedirectSTDERR ? "file" : "screen");
my $Message = "Building $Target ($Redirection)";
PrintMessage($Message) if (!$ReallyQuiet);
@@ -298,18 +455,18 @@ my $header = "
my $OldSize = (-s $build_log_err);
$Redirection = ($RedirectSTDERR ? "2>> $build_log_err" : "");
- system("abld build $TargetName urel $Redirection >> $build_log_out");
+ system("abld BUILD $TargetName UREL $Redirection >> $build_log_out");
$OK = 0 if ($? >> 8);
# print " STDERR: ".((-s $build_log_err)-$OldSize)." bytes output written to $build_log_err\n+--------------------------------------------------------------------------------------\n" if ($OldSize != (-s $build_log_err));
- PrintErrorMessage("'abld build $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
- return 0 if (!$OK); # ABLD always returns ok :( grr
+ PrintErrorMessage("'abld BUILD $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
+ return 0 if (!$OK); # ABLD always returns ok :( grr
PrintMessage("Done.") if (!$ReallyQuiet);
# did it work? :)
if (-e $TargetFilePath)
{
$LibrariesSucceeded++;
-
+
if ($TargetIntermediatePath ne '' && $TargetIntermediatePath =~ /\\EPOC32\\BUILD\\/i) # make really sure it's a valid path!
{
system("del /S /Q $TargetIntermediatePath > NUL");
@@ -318,9 +475,9 @@ my $header = "
}
else
{
- PrintErrorMessage("'abld build $TargetName urel' apparently failed.");
+ PrintErrorMessage("'abld BUILD $TargetName UREL' apparently failed.");
if ($HaltOnError)
- {
+ {
PrintErrorMessage("Halting on error as requested!");
exit 1;
}
@@ -330,12 +487,12 @@ my $header = "
##################################################################################################################
-# Build, Package & Upload a single Variation
+# Build, Package & Upload a single Variation
sub DoVariation
{
my ($SDK, $Variation, $MacroBlock) = @_;
my $Extra = ($Variation ne '' ? "_$Variation" : "");
- my $Package = sprintf($file_tpl_sis, $version_tpl_sis, $SDK, $Extra);
+ my $Package = sprintf($file_tpl_sis, $version_tpl_sis, $SDK, $Extra);
if ($SkipExistingPackages && -f "$output_dir/$Package")
{
@@ -366,7 +523,7 @@ my $header = "
if ($OK)
{
$OK = BuildVariation($SDK, $Variation, $Package, $MacroBlock);
-
+
if ($OK && $FTP_Host ne '')
{
UploadVariation($SDK, $Variation, $Package);
@@ -382,17 +539,17 @@ sub PrepVariation()
my $OK = 1;
PrepSdkPaths($SDK);
-
+
chdir($build_dir) or $OK=0;
PrintErrorMessage("Changing to $build_dir failed!") if (!$OK);
- return 0 if (!$OK);
+ return 0 if (!$OK);
# insert $MacroBlock into AUTO_MACRO_MASTER in scummvm_base.mmp
PrintMessage("Setting new AUTO_MACROS_MASTER in scummvm_base.mmp for '$Variation'") if (!$ReallyQuiet);
my $n = "AUTO_MACROS_MASTER";
my $a = "\/\/START_$n\/\/";
my $b = "\/\/STOP_$n\/\/";
- my $name = "scummvm_base.mmp";
+ my $name = "scummvm_base.mmp";
my $file = "$build_dir/mmp/$name";
my $updated = " Updated @ ".localtime();
@@ -401,11 +558,11 @@ sub PrepVariation()
return 0 if (!$OK);
my @lines = <FILE>;
close FILE;
-
+
my $onestr = join("",@lines);
$MacroBlock =~ s/^\s*//gm;
$onestr =~ s/$a(.*)$b/$a$updated\n$ExtraMacros$MacroBlock$b/s;
-
+
open FILE, ">$file" or $OK=0;
PrintErrorMessage("Writing file '$file'") if (!$OK);
return 0 if (!$OK);
@@ -418,7 +575,7 @@ sub PrepVariation()
$OK = 0 if ($? >> 8);
PrintErrorMessage("'AdaptAllMMPs.pl' exited with value " . ($? >> 8)) if ($? >> 8);
return 0 if (!$OK);
-
+
# we are here: so all is ok :)
return 1;
}
@@ -431,7 +588,7 @@ sub BuildVariation()
my $TargetName = $SDK_TargetName{$SDK};
my $TargetDir = $SDK_TargetDir{$SDK};
my $OK = 1;
-
+
my $dir = $build_dir."/".$SDK_BuildDirs{$SDK};
$dir =~ s#/#\\#g;
chdir($dir);
@@ -449,13 +606,15 @@ sub BuildVariation()
if (-e $UnlinkFile) { unlink($UnlinkFile) or PrintErrorMessage("Removing $UnlinkFile"); }
$UnlinkFile = $SDK_RootDirs{$SDK}."/epoc32/release/$TargetDir/urel/ScummVM.exe";
if (-e $UnlinkFile) { unlink($UnlinkFile) or PrintErrorMessage("Removing $UnlinkFile"); }
+ # remove all libs here, note they are in another dir!
+ system("del ".$SDK_RootDirs{$SDK}."/epoc32/release/$TargetName/urel/scummvm_*.lib");
system("bldmake bldfiles 2> NUL > NUL");
PrintErrorMessage("'bldmake bldfiles' exited with value " . ($? >> 8)) if ($? >> 8);
- system("abld clean $TargetName urel 2> NUL > NUL");
- PrintErrorMessage("'abld clean $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
-
+ system("abld CLEAN $TargetName UREL 2> NUL > NUL");
+ PrintErrorMessage("'abld CLEAN $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
+
my $Redirection = "OUT:file, ERR:".($RedirectSTDERR ? "file" : "screen");
my $Message = "Building $Package ($Redirection)";
PrintMessage($Message) if (!$ReallyQuiet);
@@ -463,11 +622,11 @@ sub BuildVariation()
my $OldSize = (-s $build_log_err);
$Redirection = ($RedirectSTDERR ? "2>> $build_log_err" : "");
- system("abld build $TargetName urel $Redirection >> $build_log_out");
+ system("abld BUILD $TargetName UREL $Redirection >> $build_log_out");
$OK = 0 if ($? >> 8);
print " STDERR: ".((-s $build_log_err)-$OldSize)." bytes output written to $build_log_err\n+--------------------------------------------------------------------------------------\n" if ($OldSize != (-s $build_log_err) && !$ReallyQuiet);
- PrintErrorMessage("'abld build $TargetName urel' exited with value " . ($? >> 8)) if ($? >> 8);
- return 0 if (!$OK); # ABLD always returns ok :( grr
+ PrintErrorMessage("'abld BUILD $TargetName UREL' exited with value " . ($? >> 8)) if ($? >> 8);
+ return 0 if (!$OK); # ABLD always returns ok :( grr
PrintMessage("Done.") if (!$ReallyQuiet);
# do we have an override suffix for the package name?
@@ -491,7 +650,7 @@ sub BuildVariation()
if (-e "$output_dir/$Package")
{
$PackagesCreated++;
-
+
if ($TargetIntermediatePath ne '' && $TargetIntermediatePath =~ /\\EPOC32\\BUILD\\/i) # make really sure it's a valid path!
{
#PrintMessage("Cleaning $TargetIntermediatePath");
@@ -514,7 +673,7 @@ sub UploadVariation()
use Net::FTP;
my $newerr;
-
+
PrintMessage("Connecting to FTP $FTP_Host") if (!$ReallyQuiet);
$ftp = Net::FTP->new($FTP_Host,Timeout=>240) or $newerr=1;
@@ -529,7 +688,7 @@ sub UploadVariation()
{
PrintMessage("Changing to dir $FTP_Dir");
$ftp->cwd($FTP_Dir) or $newerr=1;
-
+
if ($newerr)
{
PrintErrorMessage("Changing to dir $FTP_Dir! Aborting!");
@@ -541,20 +700,20 @@ sub UploadVariation()
# leave this for possible auto-deletion of old files?
# @files = $ftp->dir or $newerr=1;
# push @ERRORS, "Can't get file list $!\n" if $newerr;
-# print "Got file list\n";
+# print "Got file list\n";
# foreach(@files) {
# print "$_\n";
# }
-
+
PrintMessage("Uploading $Package (".(-s "$output_dir/$Package")." bytes)");
-
+
$ftp->binary;
$ftp->put("$output_dir/$Package") or $newerr=1;
PrintErrorMessage("Uploading package! Aborting!") if $newerr;
$PackagesUploaded++ if (!$newerr);
- }
+ }
- $ftp->quit;
+ $ftp->quit;
}
}
@@ -574,6 +733,7 @@ sub PrepSdkPaths()
# set env stuff
PrintMessage("Prepending $SDK specific paths to %PATH%") if (!$ReallyQuiet);
+ $AdditionalPathEntries .= "$SDK_ToolchainDirs{$SDK};" if ($SDK_ToolchainDirs{$SDK} ne '');
$AdditionalPathEntries .= "$ECompXL_BinDir;" if ($ECompXL_BinDir ne '' && $SDK eq 'UIQ2');
$AdditionalPathEntries .= "$EPOC32RT\\include;";
$AdditionalPathEntries .= "$EPOC32RT\\tools;";
@@ -594,7 +754,7 @@ sub CleanupPath()
{
$path =~ s/\"\Q$ECompXL_BinDir\E\";//g;
}
-
+
while( ($SDK, $RootDir) = each(%SDK_RootDirs) )
{
if ($SDK_RootDirs{$SDK} ne '')
@@ -602,8 +762,8 @@ sub CleanupPath()
my $path_component = "\"".$SDK_RootDirs{$SDK}."\\epoc32\\";
$path =~ s/\Q$path_component\E.*?\";//g;
}
- }
-
+ }
+
return $path;
}
@@ -634,4 +794,5 @@ sub PrintMessage()
}
##################################################################################################################
+
diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index 0b334c08ea..12e5f8f0c4 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -1,75 +1,118 @@
##################################################################################################################
+ @WorkingEngines = qw(
+ scumm agos sky queen gob saga drascula
+ kyra lure agi touche parallaction
+ );
+ @TestingEngines = qw(
+ cruise igor made m4 cine
+ );
+ @BrokenEngines = qw(
+ sword1
+ sword2
+ );
+
+ @EnablableEngines = (@WorkingEngines, @TestingEngines);
+
+ @EnablableSubEngines = qw(
+ scumm_7_8
+ he
+ );
+
+ %UseableFeatures = (
+ 'zlib' => 'zlib.lib',
+ 'mad' => 'libmad.lib',
+ 'tremor' => 'libtremor.lib',
+ 'mpeg2' => 'libmpeg2.lib'
+ );
+
+ # these are normally enabled for each variation
+ #$DefaultFeatures = qw(zlib,mad);
+ $DefaultFeatures = qw(zlib,mad,tremor);
+
+
# you can use these below for speed & clarity or override with custom settings
$DefaultTopMacros = "
MACRO USE_ZLIB // LIB:zlib.lib
MACRO USE_MAD // LIB:libmad.lib
MACRO USE_TREMOR // LIB:libtremor.lib
";
-
+
$DefaultBottomMacros = "
MACRO DISABLE_SWORD1 // LIB:scummvm_sword1.lib
MACRO DISABLE_SWORD2 // LIB:scummvm_sword2.lib
";
-
+
+##################################################################################################################
##
- ## General system information:
+ ## General system information, based on $COMPUTERNAME, so this way
+ ## you can use the same LocalSettings.pl file on multiple machines!
##
+##################################################################################################################
- # this way you can use the same LocalSettings.pl file on multiple machines!
- if ($ENV{'COMPUTERNAME'} eq "BRAAMBOOK")
+ if ($ENV{'COMPUTERNAME'} eq "PC-21") #########################################################################
{
# might use this string for file/dir naming in the future :)
$Producer = "SumthinWicked";
$RedirectSTDERR = 0;
- $HaltOnError = 1;
+ $HaltOnError = 0;
$SkipExistingPackages = 0;
$ReallyQuiet = 0;
-
+ $DevBase = "C:\\S";
+
# specify an optional FTP server to upload to after each Build+Package (can leave empty)
- #$FTP_Host = "host.domain";
- #$FTP_User = "test";
- #$FTP_Pass = "test";
- #$FTP_Dir = "test";
-
#$FTP_Host = "host.com";
$FTP_User = "something";
$FTP_Pass = "password";
$FTP_Dir = "cvsbuilds";
-
+
+ # What Platform SDKs are installed on this machine?
# possible SDKs: ("UIQ2", UIQ3", "S60v1", "S60v2", "S60v3", "S80", "S90")
# Note1: the \epoc32 directory needs to be in these rootdirs
# Note2: these paths do NOT end in a backslash!
- $SDK_RootDirs{'UIQ2'} = "C:\\S\\UIQ_21";
- $SDK_RootDirs{'S60v1'} = "C:\\S\\S60v1";
- $SDK_RootDirs{'S60v2'} = "C:\\S\\S60v2";
- $SDK_RootDirs{'S80'} = "C:\\S\\S80";
- $SDK_RootDirs{'S90'} = "C:\\S\\S90";
- $ECompXL_BinDir = "C:\\S\\ECompXL\\bin"; # only needed for UIQ
- # you need to specify each of the SDKs used in the blocks below!
+ # $SDK_RootDirs{'UIQ2'} = "$DevBase\\UIQ_21";
+ $SDK_RootDirs{'UIQ3'} = "$DevBase\\UIQ3";
+ # $SDK_RootDirs{'S60v1'} = "$DevBase\\S60v1";
+ # $SDK_RootDirs{'S60v2'} = "$DevBase\\S60v2";
+ $SDK_RootDirs{'S60v3'} = "$DevBase\\S60v3";
+ # $SDK_RootDirs{'S80'} = "$DevBase\\S80";
+ # $SDK_RootDirs{'S90'} = "$DevBase\\S90";
+
+ $SDK_ToolchainDirs{'S60v3'} = "$DevBase\\arm-symbianelf\\bin";
+ $SDK_ToolchainDirs{'UIQ2'} = "$DevBase\\ECompXL\\bin"; # only needed for UIQ2/UIQ3
+ $SDK_ToolchainDirs{'UIQ3'} = "$DevBase\\ECompXL\\bin"; # only needed for UIQ2/UIQ3
# these supporting libraries get built first, then all the Variations
# Note: the string {'xxx.lib'} is used in checking in build success: so needs to be accurate!
if (0) # so we can turn them on/off easily
{
- #$SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc";
- #$SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "C:\\S\\libmad-0.15.1b\\group";
- #$SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "C:\\S\\tremor\\epoc";
- $SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = $SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\UIQ";
- #$SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S60";
- #$SDK_LibraryDirs{'S80'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S80";
- #$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
+ ## Standard libraries
+ $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "$DevBase\\zlib-1.2.2\\epoc";
+ #$SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "$DevBase\\libmad-0.15.1b\\group";
+ $SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "$DevBase\\tremor\\epoc";
+
+ ## SDL 1.2.12 / AnotherGuest / Symbian version
+ my $SdlBase = "$DevBase\\SDL-1.2.12-ag\\Symbian";
+ #$SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = "$SdlBase\\S60"; // unsupported?
+ #$SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = "$SdlBase\\S60v2";
+ $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "$SdlBase\\S60v3";
+ #$SDK_LibraryDirs{'S80'}{'esdl.lib'} = "$SdlBase\\S80";
+ #$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "$SdlBase\\S90";
+ #$SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "$SdlBase\\UIQ2"
+ #$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "$SdlBase\\UIQ3";
+
+ ## HardlySupported(TM) :P
+ #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "$DevBase\\mpeg2dec-0.4.0\\epoc";
}
+
+ # now you can add $VariationSets only built on this PC below this line :)
+
+ #$VariationSets{'ALL'}{'scumm'} = "$DefaultFeatures scumm scumm_7_8 he";
+ #$VariationSets{'ALL'}{'all'} = "$DefaultFeatures @WorkingEngines @EnablableSubEngines";
- # backup :P
- #Path=C:\Progra~1\Active\Python24\.;C:\Program Files\Active\Tcl\bin;C:\Progra~1\Active\Perl\bin\;C:\WINDOWS\system32;C:\W
- #INDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\GNU\cvsnt;C:\Progra
- #m Files\WinSCP3\;"C:\Program Files\Common Files\Microsoft Shared\VSA\8.0\VsaEnv\";"c:\Program Files\Microsoft Visual Stu
- #dio 8\VC\bin";"C:\Program Files\UltraEdit-32"
}
- elsif ($ENV{'COMPUTERNAME'} eq "TSSLND0106")
+ elsif ($ENV{'COMPUTERNAME'} eq "TSSLND0106") #################################################################
{
$Producer = "AnotherGuest";
$RedirectSTDERR = 1;
@@ -90,7 +133,7 @@
#$SDK_RootDirs{'S80'}= "C:\\S80";
#$SDK_RootDirs{'S90'}= "C:\\S90";
$ECompXL_BinDir= "C:\\ECompXL\\";
-if (0) # so we can turn them on/off easily
+ if (0) # so we can turn them on/off easily
{
# $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc";
# $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "C:\\S\\libmad-0.15.1b\\group";
@@ -101,9 +144,11 @@ if (0) # so we can turn them on/off easily
# $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
- # now you can add $SDK_Variations only built on this PC here :)
+
+ # now you can add $VariationSets only built on this PC below this line :)
+
}
-elsif ($ENV{'COMPUTERNAME'} eq "BIGMACHINE")
+ elsif ($ENV{'COMPUTERNAME'} eq "BIGMACHINE") #################################################################
{
$Producer = "AnotherGuest";
$RedirectSTDERR = 1;
@@ -116,15 +161,15 @@ elsif ($ENV{'COMPUTERNAME'} eq "BIGMACHINE")
#$FTP_Pass = "password";
#$FTP_Dir = "cvsbuilds";
- #$SDK_RootDirs{'UIQ2'}= "E:\\UIQ2";
- $SDK_RootDirs{'UIQ3'}= "E:\\UIQ3";
- #$SDK_RootDirs{'S60v1'}= "E:\\S60v1";
- #$SDK_RootDirs{'S60v2'}= "E:\\S60v2";
- $SDK_RootDirs{'S60v3'}= "E:\\S60v3";
- #$SDK_RootDirs{'S80'}= "E:\\S80";
- #$SDK_RootDirs{'S90'}= "E:\\S90";
- $ECompXL_BinDir= "E:\\ECompXL\\";
-if (0) # so we can turn them on/off easily
+ #$SDK_RootDirs{'UIQ2'}= "D:\\UIQ2";
+ $SDK_RootDirs{'UIQ3'}= "D:\\UIQ3";
+ #$SDK_RootDirs{'S60v1'}= "D:\\S60v1";
+ #$SDK_RootDirs{'S60v2'}= "D:\\S60v2";
+ $SDK_RootDirs{'S60v3'}= "D:\\S60v3";
+ #$SDK_RootDirs{'S80'}= "D:\\S80";
+ #$SDK_RootDirs{'S90'}= "D:\\S90";
+ $ECompXL_BinDir= "D:\\ECompXL\\";
+ if (0) # so we can turn them on/off easily
{
# $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc";
# $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "C:\\S\\libmad-0.15.1b\\group";
@@ -137,28 +182,32 @@ if (0) # so we can turn them on/off easily
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
#$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
- # now you can add $SDK_Variations only built on this PC here :)
+
+ # now you can add $VariationSets only built on this PC below this line :)
+
}
- else
+ else #########################################################################################################
{
print "ERROR: Computer name ".$ENV{'COMPUTERNAME'}." not recognized! Plz edit _LocalSettings.pl!";
exit 1;
}
+##################################################################################################################
##
## Variation defines:
##
+##################################################################################################################
# second hash index = literal string used in .sis file created.
# empty string also removes the trailing '_'. Some 051101 examples:
- # $SDK_Variations{'UIQ2'}{''} would produce:
+ # $VariationSets{'UIQ2'}{''} would produce:
# scummvm-051101-SymbianUIQ2.sis
- # $SDK_Variations{'S60v2'}{'agos'} would produce:
+ # $VariationSets{'S60v2'}{'agos'} would produce:
# scummvm-051101-SymbianS60v2_agos.sis
- # $SDK_Variations{'ALL'}{'queen'} with all $SDK_RootDirs defined would produce:
+ # $VariationSets{'ALL'}{'queen'} with all $SDK_RootDirs defined would produce:
# scummvm-051101-SymbianUIQ2_queen.sis
# scummvm-051101-SymbianUIQ3_queen.sis
# scummvm-051101-SymbianS60v1_queen.sis
@@ -167,361 +216,50 @@ if (0) # so we can turn them on/off easily
# scummvm-051101-SymbianS80_queen.sis
# scummvm-051101-SymbianS90_queen.sis
- #$SDK_Variations{'ALL'}{'test'} = "$DefaultTopMacro
- # //MACRO USE_TREMOR // LIB:libtremor.lib
- # //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- # //MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- # //MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- # //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- # //MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- # //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- # //MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- #$DefaultBottomMacros";
- #$SDK_Variations{'S60v1'}{'test'} = $SDK_Variations{'UIQ2'}{'test'};
-
-if (1) # all regular combo's
-{
- # the first one includes all SDKs & release-ready engines
-
- $SDK_Variations{'ALL'}{'all'} = "$DefaultTopMacros
- //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- //MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- //MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- //MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- //MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- //MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- //MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- //MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- //MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- //MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
+ # NOTE: empty $VariationSets{''} string instead of 'ALL' = easy way to disable pkg!
- //MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- //MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- //MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- //MACRO DISABLE_MADE // LIB:scummvm_made.lib
- //MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- # now one for each ready-for-release engine
-
- $SDK_Variations{'ALL'}{'scumm'} = "$DefaultTopMacros
- //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'agos'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- //MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'sky'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- //MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'queen'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'gob'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- //MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'saga'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'kyra'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- //MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- # below here you could specify weird & experimental combinations, non-ready engines
-
- $SDK_Variations{'ALL'}{'saga_mini'} = "
- //MACRO USE_ZLIB // LIB:zlib.lib
- //MACRO USE_MAD // LIB:libmad.lib
- //MACRO USE_TREMOR // LIB:libtremor.lib
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
-# $SDK_Variations{'ALL'}{'scumm_no78he'} = "
-# MACRO USE_ZLIB // LIB:zlib.lib
-# MACRO USE_MAD // LIB:libmad.lib
-# //MACRO USE_TREMOR // LIB:libtremor.lib
-# MACRO DISABLE_SCUMM_7_8
-# MACRO DISABLE_SCUMM_HE
-# //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
-# MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
-# MACRO DISABLE_SKY // LIB:scummvm_sky.lib
-# MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
-# MACRO DISABLE_GOB // LIB:scummvm_gob.lib
-# MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
-# MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
-# MACRO DISABLE_AGI // LIB:scummvm_agi.lib
-# MACRO DISABLE_LURE // LIB:scummvm_lure.lib
-# MACRO DISABLE_CINE // LIB:scummvm_cine.lib
-# MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
-# $DefaultBottomMacros";
-
-# $SDK_Variations{'ALL'}{'all_vorbis'} = "
-# MACRO USE_ZLIB // LIB:zlib.lib
-# MACRO USE_MAD // LIB:libmad.lib
-# MACRO USE_TREMOR // LIB:libtremor.lib
-#
-# //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
-# //MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
-# //MACRO DISABLE_SKY // LIB:scummvm_sky.lib
-# //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
-# //MACRO DISABLE_GOB // LIB:scummvm_gob.lib
-# //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
-# //MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
-# $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'lure'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- //MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_agi.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- # empty $SDK_Variations{''} string instead of 'ALL' = package disabled
- $SDK_Variations{'ALL'}{'test_cine'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- //MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
- $SDK_Variations{'ALL'}{'agi'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- //MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- $DefaultBottomMacros";
-
-
- $SDK_Variations{'ALL'}{'test_touche'} = "$DefaultTopMacros
- MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- //MACRO DISABLE_TOUCHE // LIB:scummvm_touche.lib
- MACRO DISABLE_SWORD1 // LIB:scummvm_sword1.lib
- MACRO DISABLE_SWORD2 // LIB:scummvm_sword2.lib
- MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
- MACRO DISABLE_IGOR // LIB:scummvm_igor.lib
- MACRO DISABLE_MADE // LIB:scummvm_made.lib
- MACRO DISABLE_M4 // LIB:scummvm_m4.lib
- ";
-}
+ if (1) # all regular combo's
+ {
+ # the first one includes all SDKs & release-ready engines
+
+ $VariationSets{'ALL'}{'all'} = "$DefaultFeatures @WorkingEngines @EnablableSubEngines";
+
+ # now one for each ready-for-release engine
+ if (0)
+ {
+ foreach (@WorkingEngines)
+ {
+ $VariationSets{'ALL'}{$_} = "$DefaultFeatures $_";
+ }
+ # for scumm, we need to add 2 features:
+ #$VariationSets{'ALL'}{'scumm'} .= " scumm_7_8 he";
+ }
-#
-# $SDK_Variations{'S60v2'}{'test_sword'} = "$DefaultTopMacros
-# MACRO USE_MPEG2 // LIB:libmpeg2.lib
-# MACRO USE_TREMOR // LIB:libtremor.lib
-# MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
-# MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
-# MACRO DISABLE_SKY // LIB:scummvm_sky.lib
-# MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
-# MACRO DISABLE_GOB // LIB:scummvm_gob.lib
-# MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
-# MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
-# MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
-# MACRO DISABLE_CINE // LIB:scummvm_cine.lib
-# MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
-# //MACRO DISABLE_SWORD1 // LIB:scummvm_sword1.lib
-# //MACRO DISABLE_SWORD2 // LIB:scummvm_sword2.lib
-# ";
-# $SDK_Variations{'UIQ2'}{'test_sword'} = $SDK_Variations{'S60v2'}{'test_sword'}
-#
+ # now one for each not-ready-for-release-or-testing engine
+ if (0)
+ {
+ foreach (@TestingEngines)
+ {
+ $VariationSets{'ALL'}{"test_$_"} = "$DefaultFeatures $_";
+ }
+ }
+ # below here you could specify weird & experimental combinations, non-ready engines
+
+ # a small version of the saga engine, because it is so big (no tremor,mad,zlib)
+ #$VariationSets{'ALL'}{'saga_mini'} = "saga";
+
+ # a smaller version of scumm without support for v7, v8 and HE games
+ #$VariationSets{'ALL'}{'scumm_no78he'} = "$DefaultFeatures scumm";
+
+ # maybe you feel lucky and want to test the sword engines? :P
+ #$VariationSets{'S60v2'}{'test_sword'} = "$DefaultFeatures mpeg2 sword1 sword2";
+ #$VariationSets{'UIQ2'}{'test_sword'} = "$DefaultFeatures mpeg2 sword1 sword2";
+
+ # for mega-fast-testing only plz! Warning: contains to engines!
+ #$VariationSets{'ALL'}{'fast_empty'} = "";
+
+ } # end quick-n-fast if (1|0)
-# for mega-fast-testing only plz!
-# $SDK_Variations{'ALL'}{'(fast_empty)'} = "
-# //MACRO USE_ZLIB // LIB:zlib.lib
-# //MACRO USE_MAD // LIB:libmad.lib
-# //MACRO USE_TREMOR // LIB:libtremor.lib
-# MACRO USE_UIQ_SE_VIBRA // LIB:vibration.lib
-# MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
-# MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
-# MACRO DISABLE_SKY // LIB:scummvm_sky.lib
-# //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
-# MACRO DISABLE_GOB // LIB:scummvm_gob.lib
-# MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
-# $DefaultBottomMacros";
##################################################################################################################
diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README
index 0f9df338c3..8ab729a4d0 100644
--- a/backends/platform/symbian/README
+++ b/backends/platform/symbian/README
@@ -38,6 +38,7 @@ Building ScummVM
Lets just say the framework needs quite some time to set up and takes a while
to get used to. If you choose to continue you will need the following items:
+ - UIQ 3.0 SDK (To build for UIQ3 devices)
- UIQ 2.1 SDK (To build for UIQ2 devices);
http://www.symbian.com/developer/sdks_uiq.asp
@@ -58,14 +59,14 @@ Building ScummVM
- zlib, a massively spiffy yet delicately unobtrusive compression library
http://www.zlib.net/
-
- These are probably too heavy-duty for your phone:
+ - latest version of active perl (included with Symbian SDK does not work with the build scripts)
- libogg, the free media file container format
http://www.xiph.org/ogg/
-
+
- libvorbis, the free audio codec
http://www.vorbis.com/
+ These are probably too heavy-duty for your phone:
- flac, the Free Lossless Audio Codec
http://flac.sourceforge.net/
diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
index ff11657b34..3fea916e43 100644
--- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
+++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in
@@ -29,7 +29,7 @@
TARGET ScummVM.exe
TARGETPATH sys\bin
TARGETTYPE exe
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
UID 0x100039ce 0xA0000657
@@ -81,13 +81,6 @@ ALWAYS_BUILD_AS_ARM
STATICLIBRARY esdl.lib
-#if !defined(WINS)
-staticlibrary rate_arm_asm.o
-staticlibrary proc3arm.o
-staticlibrary codec47ARM.o
-staticlibrary gfxARM.o
-#endif
-
// *** Include paths
USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\engines
diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
index a1ac965148..0013d061ca 100644
--- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
+++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in
@@ -30,7 +30,7 @@ TARGET ScummVM.exe
TARGETPATH sys\bin
TARGETTYPE exe
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
UID 0x100039ce 0xA0000657
@@ -82,13 +82,6 @@ ALWAYS_BUILD_AS_ARM
STATICLIBRARY esdl.lib
-#if !defined(WINS)
-staticlibrary rate_arm_asm.o
-staticlibrary proc3arm.o
-staticlibrary codec47ARM.o
-staticlibrary gfxARM.o
-#endif
-
// *** Include paths
USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\engines
diff --git a/backends/platform/symbian/mmp/scummvm_agi.mmp.in b/backends/platform/symbian/mmp/scummvm_agi.mmp.in
index 8432968f32..04cf068133 100644
--- a/backends/platform/symbian/mmp/scummvm_agi.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_agi.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_agi.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_agos.mmp.in b/backends/platform/symbian/mmp/scummvm_agos.mmp.in
index 528349c176..d03a30d88b 100644
--- a/backends/platform/symbian/mmp/scummvm_agos.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_agos.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_agos.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in
index 761d4867e7..d1c8878d4b 100644
--- a/backends/platform/symbian/mmp/scummvm_base.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in
@@ -30,36 +30,15 @@ TARGET scummvm_base.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
// Note: the LIB:*.lib statements are used by AdaptAllMMPs.pl, so don't remove them!
//START_AUTO_MACROS_MASTER//
// empty base file, will be updated by Perl build scripts
-
- // list of possible MACROs: (will be replaced when generating scummvm_base.mmp)
- //MACRO USE_ZLIB // LIB:zlib.lib
- //MACRO USE_MAD // LIB:libmad.lib
- //MACRO USE_TREMOR // LIB:libtremor.lib
- //MACRO USE_UIQ_SE_VIBRA // LIB:vibration.lib
- //MACRO DISABLE_SCUMM_7_8
- //MACRO DISABLE_SCUMM_HE
- //MACRO DISABLE_SCUMM // LIB:scummvm_scumm.lib
- //MACRO DISABLE_AGOS // LIB:scummvm_agos.lib
- //MACRO DISABLE_SKY // LIB:scummvm_sky.lib
- //MACRO DISABLE_QUEEN // LIB:scummvm_queen.lib
- //MACRO DISABLE_GOB // LIB:scummvm_gob.lib
- //MACRO DISABLE_SAGA // LIB:scummvm_saga.lib
- //MACRO DISABLE_KYRA // LIB:scummvm_kyra.lib
- //MACRO DISABLE_SWORD1 // LIB:scummvm_sword1.lib
- //MACRO DISABLE_SWORD2 // LIB:scummvm_sword2.lib
- //MACRO DISABLE_LURE // LIB:scummvm_lure.lib
- //MACRO DISABLE_CINE // LIB:scummvm_cine.lib
- //MACRO DISABLE_AGI // LIB:scummvm_agi.lib
- //MACRO DISABLE_PARALLACTION // LIB:scummvm_parallaction.lib
- //MACRO DISABLE_CRUISE // LIB:scummvm_cruise.lib
- //MACRO DISABLE_DRASCULA // LIB:scummvm_drascula.lib
+ // this file will be modified first, then from here all
+ // MACROs will be replicated to the other MPP files.
//STOP_AUTO_MACROS_MASTER//
@@ -77,6 +56,7 @@ SYSTEMINCLUDE ..\src // for portdefs.h
// *** SOURCE files
+
SOURCEPATH ..\..\..\..\common
//START_AUTO_OBJECTS_COMMON_//
@@ -84,6 +64,7 @@ SOURCEPATH ..\..\..\..\common
//STOP_AUTO_OBJECTS_COMMON_//
+
SOURCEPATH ..\..\..\..\graphics
//START_AUTO_OBJECTS_GRAPHICS_//
@@ -91,6 +72,7 @@ SOURCEPATH ..\..\..\..\graphics
//STOP_AUTO_OBJECTS_GRAPHICS_//
+
SOURCEPATH ..\..\..\..\gui
//START_AUTO_OBJECTS_GUI_//
@@ -103,6 +85,7 @@ SOURCEPATH ..\..\..\..\gui
//SOURCE KeysDialog.cpp
//SOURCE Actions.cpp
+
SOURCEPATH ..\..\..\..\sound
//START_AUTO_OBJECTS_SOUND_//
@@ -110,16 +93,22 @@ SOURCEPATH ..\..\..\..\sound
//STOP_AUTO_OBJECTS_SOUND_//
#if defined (WINS)
-SOURCE rate.cpp
+SOURCE rate.cpp // WINS emulator version: add regular .cpp
#else
-SOURCE rate_arm.cpp
+SOURCE rate_arm.cpp // ARM version: add ASM .cpp wrapper
+SOURCE rate_arm_asm.s // ARM version: add ASM routines
#endif
-sourcepath ..\..\..\..
-source backends\events\default\default-events.cpp
-source backends\timer\default\default-timer.cpp
-source backends\saves\savefile.cpp
-source backends\saves\default\default-saves.cpp
-source backends\saves\compressed\compressed-saves.cpp
-source engines\engine.cpp
+
+
+// add a few files manually, since they are not parsed from modules.mk files
+SOURCEPATH ..\..\..\..
+SOURCE backends\events\default\default-events.cpp
+SOURCE backends\timer\default\default-timer.cpp
+SOURCE backends\saves\savefile.cpp
+SOURCE backends\saves\default\default-saves.cpp
+SOURCE backends\saves\compressed\compressed-saves.cpp
+SOURCE engines\engine.cpp
+
+
// backend specific includes
// backend specific includes
diff --git a/backends/platform/symbian/mmp/scummvm_cine.mmp.in b/backends/platform/symbian/mmp/scummvm_cine.mmp.in
index 052b62759b..cc355b0318 100644
--- a/backends/platform/symbian/mmp/scummvm_cine.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_cine.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_CINE.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in
index ad363984c8..718f80a95b 100644
--- a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_cruise.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in
index 4c9d614446..4979cc91a6 100644
--- a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_drascula.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_gob.mmp.in b/backends/platform/symbian/mmp/scummvm_gob.mmp.in
index 734f3c686c..8522a937ab 100644
--- a/backends/platform/symbian/mmp/scummvm_gob.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_gob.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_gob.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in
index 6c4e9a0a97..503a54ce1f 100644
--- a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_kyra.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_lure.mmp.in b/backends/platform/symbian/mmp/scummvm_lure.mmp.in
index 6b3410e95f..24173c6a57 100644
--- a/backends/platform/symbian/mmp/scummvm_lure.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_lure.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_lure.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_m4.mmp.in b/backends/platform/symbian/mmp/scummvm_m4.mmp.in
index 62a00143be..4429582bd7 100644
--- a/backends/platform/symbian/mmp/scummvm_m4.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_m4.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_m4.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_made.mmp.in b/backends/platform/symbian/mmp/scummvm_made.mmp.in
index 7aac818f4e..cb69cbf115 100644
--- a/backends/platform/symbian/mmp/scummvm_made.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_made.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_made.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in
index 910bb42ec9..4c117fba45 100644
--- a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_parallaction.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_queen.mmp.in b/backends/platform/symbian/mmp/scummvm_queen.mmp.in
index 96b827a994..6bee237f77 100644
--- a/backends/platform/symbian/mmp/scummvm_queen.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_queen.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_queen.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_saga.mmp.in b/backends/platform/symbian/mmp/scummvm_saga.mmp.in
index 9e8c658a8f..c040de250c 100644
--- a/backends/platform/symbian/mmp/scummvm_saga.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_saga.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_saga.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in
index 39490cfd29..7eecfd3ff6 100644
--- a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_scumm.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
@@ -43,23 +43,34 @@ ALWAYS_BUILD_AS_ARM
SOURCEPATH ..\..\..\..\engines\scumm
+
//START_AUTO_OBJECTS_SCUMM_//
// empty base file, will be updated by Perl build scripts
//STOP_AUTO_OBJECTS_SCUMM_//
+#if !defined (WINS)
+SOURCE gfxARM.s // ARM version: add ASM routines
+SOURCE proc3ARM.s // ARM version: add ASM routines
+#endif
+
-//START_AUTO_OBJECTS_SCUMM_DISABLE_SCUMM_7_8//
+//START_AUTO_OBJECTS_SCUMM_ENABLE_SCUMM_7_8//
// empty base file, will be updated by Perl build scripts
-//STOP_AUTO_OBJECTS_SCUMM_DISABLE_SCUMM_7_8//
+//STOP_AUTO_OBJECTS_SCUMM_ENABLE_SCUMM_7_8//
+#if !defined (WINS)
+SOURCE smush/codec47ARM.s // ARM version: add ASM routines
+#endif
-//START_AUTO_OBJECTS_SCUMM_DISABLE_HE//
+
+//START_AUTO_OBJECTS_SCUMM_ENABLE_HE//
// empty base file, will be updated by Perl build scripts
-//STOP_AUTO_OBJECTS_SCUMM_DISABLE_HE//
+//STOP_AUTO_OBJECTS_SCUMM_ENABLE_HE//
+
// *** Include paths
diff --git a/backends/platform/symbian/mmp/scummvm_sky.mmp.in b/backends/platform/symbian/mmp/scummvm_sky.mmp.in
index e359803194..9ae57aa2b6 100644
--- a/backends/platform/symbian/mmp/scummvm_sky.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_sky.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_sky.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in
index 9bc97919c5..ecf71c2d30 100644
--- a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_sword1.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in
index 4d25a41e89..91029b1f8d 100644
--- a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_sword2.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/mmp/scummvm_touche.mmp.in b/backends/platform/symbian/mmp/scummvm_touche.mmp.in
index 9ea7636af5..3b8a7e6105 100644
--- a/backends/platform/symbian/mmp/scummvm_touche.mmp.in
+++ b/backends/platform/symbian/mmp/scummvm_touche.mmp.in
@@ -30,7 +30,7 @@ TARGET scummvm_touche.lib
TARGETTYPE lib
OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp
OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings
-OPTION GCCE -Wno-multichar -Wno-reorder -fsigned-char
+OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char
ALWAYS_BUILD_AS_ARM
//START_AUTO_MACROS_SLAVE//
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index d3e92731db..e3a4027d79 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -33,7 +33,7 @@
#include "gui/Actions.h"
#include "gui/Key.h"
#include "gui/message.h"
-
+#include "sound/mixer_intern.h"
#include "..\..\sdl\main.cpp"
#ifdef SAMPLES_PER_SEC_8000 // the GreanSymbianMMP format cannot handle values for defines :(
@@ -42,10 +42,22 @@
#define SAMPLES_PER_SEC 16000
#endif
+#define KInputBufferLength 128
+// Symbian libc file functionality in order to provide shared file handles
+struct TSymbianFileEntry {
+ RFile iFileHandle;
+ char iInputBuffer[KInputBufferLength];
+ TInt iInputBufferLen;
+ TInt iInputPos;
+};
+
+#define FILE void
////////// extern "C" ///////////////////////////////////////////////////
namespace Symbian {
+
+
// Show a simple Symbian Info win with Msg & exit
void FatalError(const char *msg) {
TPtrC8 msgPtr((const TUint8 *)msg);
@@ -173,11 +185,8 @@ void OSystem_SDL_Symbian::quit() {
OSystem_SDL::quit();
}
-bool OSystem_SDL_Symbian::setSoundCallback(SoundProc proc, void *param) {
+void OSystem_SDL_Symbian::setupMixer() {
- // First save the proc and param
- _sound_proc_param = param;
- _sound_proc = proc;
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
@@ -207,48 +216,53 @@ bool OSystem_SDL_Symbian::setSoundCallback(SoundProc proc, void *param) {
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = (uint16)samples;
-#ifdef S60
desired.callback = symbianMixCallback;
desired.userdata = this;
-#else
- desired.callback = proc;
- desired.userdata = param;
-#endif
+
+ // Create the mixer instance
+ assert(!_mixer);
+ _mixer = new Audio::MixerImpl(this);
+ assert(_mixer);
+
if (SDL_OpenAudio(&desired, &obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
- return false;
- }
- // Note: This should be the obtained output rate, but it seems that at
- // least on some platforms SDL will lie and claim it did get the rate
- // even if it didn't. Probably only happens for "weird" rates, though.
- _samplesPerSec = obtained.freq;
- _channels = obtained.channels;
-
- // Need to create mixbuffer for stereo mix to downmix
- if (_channels != 2) {
- _stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
+ _samplesPerSec = 0;
+ _mixer->setReady(false);
+ } else {
+ // Note: This should be the obtained output rate, but it seems that at
+ // least on some platforms SDL will lie and claim it did get the rate
+ // even if it didn't. Probably only happens for "weird" rates, though.
+ _samplesPerSec = obtained.freq;
+ _channels = obtained.channels;
+
+ // Need to create mixbuffer for stereo mix to downmix
+ if (_channels != 2) {
+ _stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
+ }
+
+ // Tell the mixer that we are ready and start the sound processing
+ _mixer->setOutputRate(_samplesPerSec);
+ _mixer->setReady(true);
+ SDL_PauseAudio(0);
}
-
- SDL_PauseAudio(0);
- return true;
}
/**
* The mixer callback function, passed on to OSystem::setSoundCallback().
* This simply calls the mix() method.
*/
-void OSystem_SDL_Symbian::symbianMixCallback(void *s, byte *samples, int len) {
- static_cast <OSystem_SDL_Symbian*>(s)->symbianMix(samples,len);
-}
+void OSystem_SDL_Symbian::symbianMixCallback(void *sys, byte *samples, int len) {
+ OSystem_SDL_Symbian *this_ = (OSystem_SDL_Symbian *)sys;
+ assert(this_);
+ if (!this_->_mixer)
+ return;
-/**
- * Actual mixing implementation
- */
-void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) {
+#if defined (S60) && !defined(S60V3)
// If not stereo then we need to downmix
- if (_channels != 2) {
- _sound_proc(_sound_proc_param, _stereo_mix_buffer, len * 2);
+ if (this_->_mixer->_channels != 2) {
+ this_->_mixer->mixCallback(_stereo_mix_buffer, len * 2);
+
int16 *bitmixDst = (int16 *)samples;
int16 *bitmixSrc = (int16 *)_stereo_mix_buffer;
@@ -258,9 +272,12 @@ void OSystem_SDL_Symbian::symbianMix(byte *samples, int len) {
bitmixSrc += 2;
}
} else
- _sound_proc(_sound_proc_param, samples, len);
+#else
+ this_->_mixer->mixCallback(samples, len);
+#endif
}
+
/**
* This is an implementation by the remapKey function
* @param SDL_Event to remap
@@ -438,15 +455,9 @@ void OSystem_SDL_Symbian::initZones() {
}
}
-// Symbian libc file functionality in order to provide shared file handles
-struct TSymbianFileEntry {
- RFile iFileHandle;
-};
-
-#define FILE void
-
FILE* symbian_fopen(const char* name, const char* mode) {
TSymbianFileEntry* fileEntry = new TSymbianFileEntry;
+ fileEntry->iInputPos = KErrNotFound;
if (fileEntry != NULL) {
TInt modeLen = strlen(mode);
@@ -504,9 +515,71 @@ void symbian_fclose(FILE* handle) {
}
size_t symbian_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
- TPtr8 pointer( (unsigned char*) ptr, size*numItems);
+ TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));
+ TUint32 totsize = size*numItems;
+ TPtr8 pointer ( (unsigned char*) ptr, totsize);
+
+ // Nothing cached and we want to load at least KInputBufferLength bytes
+ if(totsize >= KInputBufferLength) {
+ TUint32 totLength = 0;
+ if(entry->iInputPos != KErrNotFound)
+ {
+ TPtr8 cacheBuffer( (unsigned char*) entry->iInputBuffer+entry->iInputPos, entry->iInputBufferLen - entry->iInputPos, KInputBufferLength);
+ pointer.Append(cacheBuffer);
+ entry->iInputPos = KErrNotFound;
+ totLength+=pointer.Length();
+ pointer.Set(totLength+(unsigned char*) ptr, 0, totsize-totLength);
+ }
+
+ entry->iFileHandle.Read(pointer);
+ totLength+=pointer.Length();
+
+ pointer.Set((unsigned char*) ptr, totLength, totsize);
+
+ }
+ else {
+ // Nothing in buffer
+ if(entry->iInputPos == KErrNotFound) {
+ TPtr8 cacheBuffer( (unsigned char*) entry->iInputBuffer, KInputBufferLength);
+ entry->iFileHandle.Read(cacheBuffer);
+
+ if(cacheBuffer.Length() >= totsize) {
+ pointer.Copy(cacheBuffer.Left(totsize));
+ entry->iInputPos = totsize;
+ entry->iInputBufferLen = cacheBuffer.Length();
+ }
+ else {
+ pointer.Copy(cacheBuffer);
+ entry->iInputPos = KErrNotFound;
+ }
+
+ }
+ else {
+ TPtr8 cacheBuffer( (unsigned char*) entry->iInputBuffer, entry->iInputBufferLen, KInputBufferLength);
- ((TSymbianFileEntry*)(handle))->iFileHandle.Read(pointer);
+ if(entry->iInputPos+totsize < entry->iInputBufferLen) {
+ pointer.Copy(cacheBuffer.Mid(entry->iInputPos, totsize));
+ entry->iInputPos+=totsize;
+ }
+ else {
+
+ pointer.Copy(cacheBuffer.Mid(entry->iInputPos, entry->iInputBufferLen-entry->iInputPos));
+ cacheBuffer.SetLength(0);
+ entry->iFileHandle.Read(cacheBuffer);
+
+ if(cacheBuffer.Length() >= totsize-pointer.Length()) {
+ TUint32 restSize = totsize-pointer.Length();
+ pointer.Append(cacheBuffer.Left(restSize));
+ entry->iInputPos = restSize;
+ entry->iInputBufferLen = cacheBuffer.Length();
+ }
+ else {
+ pointer.Append(cacheBuffer);
+ entry->iInputPos = KErrNotFound;
+ }
+ }
+ }
+ }
return pointer.Length()/size;
}
@@ -514,6 +587,7 @@ size_t symbian_fread(const void* ptr, size_t size, size_t numItems, FILE* handle
size_t symbian_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) {
TPtrC8 pointer( (unsigned char*) ptr, size*numItems);
+ ((TSymbianFileEntry*)(handle))->iInputPos = KErrNotFound;
if (((TSymbianFileEntry*)(handle))->iFileHandle.Write(pointer) == KErrNone) {
return numItems;
}
@@ -523,12 +597,18 @@ size_t symbian_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handl
bool symbian_feof(FILE* handle) {
TInt pos = 0;
- if (((TSymbianFileEntry*)(handle))->iFileHandle.Seek(ESeekCurrent, pos) == KErrNone) {
+ TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));
+
+ if (entry->iFileHandle.Seek(ESeekCurrent, pos) == KErrNone) {
TInt size = 0;
- if (((TSymbianFileEntry*)(handle))->iFileHandle.Size(size) == KErrNone) {
- if (pos == size)
+ if (entry->iFileHandle.Size(size) == KErrNone) {
+ if(entry->iInputPos == KErrNotFound && pos == size)
return true;
+
+ if(entry->iInputPos != KErrNotFound && pos == size && entry->iInputPos == entry->iInputBufferLen)
+ return true;
+
return false;
}
}
@@ -537,15 +617,21 @@ bool symbian_feof(FILE* handle) {
long int symbian_ftell(FILE* handle) {
TInt pos = 0;
+ TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));
- ((TSymbianFileEntry*)(handle))->iFileHandle.Seek(ESeekCurrent, pos);
-
+ entry->iFileHandle.Seek(ESeekCurrent, pos);
+ if(entry->iInputPos != KErrNotFound)
+ {
+ pos+=(entry->iInputPos - entry->iInputBufferLen);
+ }
return pos;
}
int symbian_fseek(FILE* handle, long int offset, int whence) {
+
TSeek seekMode = ESeekStart;
TInt pos = offset;
+ TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));
switch(whence) {
case SEEK_SET:
@@ -553,14 +639,19 @@ int symbian_fseek(FILE* handle, long int offset, int whence) {
break;
case SEEK_CUR:
seekMode = ESeekCurrent;
+ if(entry->iInputPos != KErrNotFound) {
+ pos+=(entry->iInputPos - entry->iInputBufferLen);
+ }
break;
case SEEK_END:
seekMode = ESeekEnd;
break;
}
+
+ entry->iInputPos = KErrNotFound;
- return ((TSymbianFileEntry*)(handle))->iFileHandle.Seek(seekMode, pos);
+ return entry->iFileHandle.Seek(seekMode, pos);
}
void symbian_clearerr(FILE* /*handle*/) {
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 77e42cd476..71d24f6286 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -58,7 +58,7 @@ public:
// This function is overridden by the symbian port in order to provide MONO audio
// downmix is done by supplying our own audiocallback
//
- virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend
+ virtual void setupMixer(); // overloaded by CE backend
// Overloaded from SDL_Commmon
void quit();
@@ -70,11 +70,6 @@ protected:
//
static void symbianMixCallback(void *s, byte *samples, int len);
- //
- // Actual mixing implementation
- //
- void symbianMix(byte *samples, int len);
-
virtual FilesystemFactory *getFilesystemFactory();
public:
// vibration support
@@ -121,8 +116,6 @@ protected:
// Audio
int _channels;
- SoundProc _sound_proc;
- void *_sound_proc_param;
byte *_stereo_mix_buffer;
// Used to handle joystick navi zones
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index 2723c0bab0..06a4cf374c 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -35,8 +35,8 @@
#include <e32std.h>
#include <math.h>
-#define DISABLE_SCALERS // we only need 1x
-#define DISABLE_HQ_SCALERS
+//#define DISABLE_SCALERS // we only need 1x
+//#define DISABLE_HQ_SCALERS
#if defined(USE_TREMOR) && !defined(USE_VORBIS)
#define USE_VORBIS // make sure this one is defined together with USE_TREMOR!
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 2667ecb69d..9e708345c5 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -91,7 +91,7 @@ void OSystem_Wii::initBackend() {
_startup_time = gettime();
_savefile = new DefaultSaveFileManager();
- _mixer = new Audio::Mixer();
+ _mixer = new Audio::MixerImpl(this);
_timer = new DefaultTimerManager();
initGfx();
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 2a168fd0b7..7fbc560b1a 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -31,7 +31,7 @@
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "graphics/surface.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include <gctypes.h>
#include <gccore.h>
@@ -96,7 +96,7 @@ private:
protected:
Common::SaveFileManager *_savefile;
- Audio::Mixer *_mixer;
+ Audio::MixerImpl *_mixer;
DefaultTimerManager *_timer;
public:
@@ -159,7 +159,6 @@ public:
virtual void deleteMutex(MutexRef mutex);
typedef void (*SoundProc)(void *param, byte *buf, int len);
- virtual int getOutputSampleRate() const;
virtual void quit();
diff --git a/backends/platform/wii/osystem_sfx.cpp b/backends/platform/wii/osystem_sfx.cpp
index 16b2f3b055..0a225e80c7 100644
--- a/backends/platform/wii/osystem_sfx.cpp
+++ b/backends/platform/wii/osystem_sfx.cpp
@@ -36,9 +36,6 @@ static bool sfx_thread_quit = false;
static u8 sb = 0;
static u8 *sound_buffer[2];
-static OSystem_Wii::SoundProc sound_proc = NULL;
-static void *proc_param = NULL;
-
static void audio_switch_buffers() {
AUDIO_StopDMA();
AUDIO_InitDMA((u32) sound_buffer[sb], SFX_THREAD_FRAG_SIZE);
@@ -48,6 +45,7 @@ static void audio_switch_buffers() {
}
static void * sfx_thread_func(void *arg) {
+ Audio::MixerImpl *mixer = (Audio::MixerImpl *) arg;
u8 next_sb;
while (true) {
@@ -57,7 +55,7 @@ static void * sfx_thread_func(void *arg) {
break;
next_sb = sb ^ 1;
- sound_proc(proc_param, sound_buffer[next_sb], SFX_THREAD_FRAG_SIZE);
+ mixer->mixCallback(sound_buffer[next_sb], SFX_THREAD_FRAG_SIZE);
DCFlushRange(sound_buffer[next_sb], SFX_THREAD_FRAG_SIZE);
sb = next_sb;
@@ -75,7 +73,7 @@ void OSystem_Wii::initSfx() {
LWP_InitQueue(&sfx_queue);
- s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, NULL, sfx_stack,
+ s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, _mixer, sfx_stack,
SFX_THREAD_STACKSIZE, SFX_THREAD_PRIO);
if (res) {
@@ -95,9 +93,7 @@ void OSystem_Wii::initSfx() {
DCFlushRange(sound_buffer[0], SFX_THREAD_FRAG_SIZE);
DCFlushRange(sound_buffer[1], SFX_THREAD_FRAG_SIZE);
- sound_proc = Audio::Mixer::mixCallback;
- proc_param = _mixer;
-
+ _mixer->setOutputRate(48000);
_mixer->setReady(true);
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
@@ -127,7 +123,3 @@ void OSystem_Wii::deinitSfx() {
}
}
-int OSystem_Wii::getOutputSampleRate() const {
- return 48000;
-}
-
diff --git a/backends/platform/wince/Makefile b/backends/platform/wince/Makefile
index 734bf82eaa..176971067e 100644
--- a/backends/platform/wince/Makefile
+++ b/backends/platform/wince/Makefile
@@ -19,6 +19,8 @@
## Enable whichever engines you want here
ENABLE_SCUMM = STATIC_PLUGIN
+ENABLE_SCUMM_7_8 = 1
+ENABLE_HE = 1
ENABLE_SKY = STATIC_PLUGIN
ENABLE_QUEEN = STATIC_PLUGIN
ENABLE_GOB = STATIC_PLUGIN
@@ -163,7 +165,8 @@ endif
EXECUTABLE = scummvm.exe
CXXFLAGS := $(CFLAGS)
OBJS :=
-MODULE_DIRS += .
+MODULE_DIRS += ./
+DEPDIR = .deps
OBJS += CEActionsPocket.o CEDevice.o CEScaler.o \
CEActionsSmartphone.o CELauncherDialog.o wince-sdl.o
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp
index 86d93dcb88..c760b1f7df 100644
--- a/backends/platform/wince/missing/missing.cpp
+++ b/backends/platform/wince/missing/missing.cpp
@@ -1,8 +1,34 @@
-/* MISSING.C
- Implementation for standard and semi-standard C library calls missing in WinCE
- environment.
- by Vasyl Tsvirkunov
-*/
+/* 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/* Original code:
+ * Implementation for standard and semi-standard C library calls missing in WinCE
+ * environment.
+ * by Vasyl Tsvirkunov
+ */
+
#include <windows.h>
#include <tchar.h>
@@ -17,19 +43,8 @@
#include "time.h"
#include "dirent.h"
-/* forward declaration */
-
-#if _WIN32_WCE < 300
-
-#define _STDAFX_H
-#include "portdefs.h"
-
-#else
-
char *strdup(const char *strSource);
-#endif
-
#ifdef __GNUC__
#define EXT_C extern "C"
#else
@@ -40,19 +55,27 @@ char *strdup(const char *strSource);
void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *)) {
- size_t i;
+ // Perform binary search
+ size_t lo = 0;
+ size_t hi = nmemb;
+ while (lo < hi) {
+ size_t mid = (lo + hi) / 2;
+ const void *p = ((const char *)base) + mid * size;
+ int tmp = (*compar)(key, p);
+ if (tmp < 0)
+ hi = mid;
+ else if (tmp > 0)
+ lo = mid + 1;
+ else
+ return (void *)p;
+ }
- for (i=0; i<nmemb; i++)
- if (compar(key, (void*)((size_t)base + size * i)) == 0)
- return (void*)((size_t)base + size * i);
return NULL;
}
static WIN32_FIND_DATA wfd;
-/* Very limited implementation of stat. Used by UI.C, MEMORY-P.C (latter is not critical) */
-int stat(const char *fname, struct stat *ss)
-{
+int stat(const char *fname, struct stat *ss) {
TCHAR fnameUnc[MAX_PATH+1];
HANDLE handle;
int len;
@@ -63,8 +86,7 @@ int stat(const char *fname, struct stat *ss)
/* Special case (dummy on WinCE) */
len = strlen(fname);
if (len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' &&
- (len == 2 || fname[len-3] == '\\'))
- {
+ (len == 2 || fname[len-3] == '\\')) {
/* That's everything implemented so far */
memset(ss, 0, sizeof(struct stat));
ss->st_size = 1024;
@@ -74,6 +96,7 @@ int stat(const char *fname, struct stat *ss)
MultiByteToWideChar(CP_ACP, 0, fname, -1, fnameUnc, MAX_PATH);
handle = FindFirstFile(fnameUnc, &wfd);
+ FindClose(handle);
if (handle == INVALID_HANDLE_VALUE)
return -1;
else
@@ -83,20 +106,16 @@ int stat(const char *fname, struct stat *ss)
ss->st_size = wfd.nFileSizeLow;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
ss->st_mode |= S_IFDIR;
-
- FindClose(handle);
}
return 0;
}
char cwd[MAX_PATH+1] = "";
-EXT_C char *getcwd(char *buffer, int maxlen)
-{
+EXT_C char *getcwd(char *buffer, int maxlen) {
TCHAR fileUnc[MAX_PATH+1];
char* plast;
- if (cwd[0] == 0)
- {
+ if (cwd[0] == 0) {
GetModuleFileName(NULL, fileUnc, MAX_PATH);
WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL);
plast = strrchr(cwd, '\\');
@@ -114,8 +133,7 @@ EXT_C char *getcwd(char *buffer, int maxlen)
#ifdef __GNUC__
#undef GetCurrentDirectory
#endif
-EXT_C void GetCurrentDirectory(int len, char *buf)
-{
+EXT_C void GetCurrentDirectory(int len, char *buf) {
getcwd(buf,len);
};
@@ -125,26 +143,22 @@ fully qualified paths refer to root folder rather
than current folder (concept not implemented in CE).
*/
#undef fopen
-EXT_C FILE *wce_fopen(const char* fname, const char* fmode)
-{
+EXT_C FILE *wce_fopen(const char* fname, const char* fmode) {
char fullname[MAX_PATH+1];
if (!fname || fname[0] == '\0')
return NULL;
- if (fname[0] != '\\' && fname[0] != '/')
- {
+ if (fname[0] != '\\' && fname[0] != '/') {
getcwd(fullname, MAX_PATH);
strncat(fullname, "\\", MAX_PATH-strlen(fullname)-1);
strncat(fullname, fname, MAX_PATH-strlen(fullname)-strlen(fname));
return fopen(fullname, fmode);
- }
- else
+ } else
return fopen(fname, fmode);
}
/* Remove file by name */
-int remove(const char* path)
-{
+int remove(const char* path) {
TCHAR pathUnc[MAX_PATH+1];
MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH);
return !DeleteFile(pathUnc);
@@ -158,14 +172,22 @@ int _access(const char *path, int mode) {
WIN32_FIND_DATA ffd;
HANDLE h=FindFirstFile(fname, &ffd);
+ FindClose(h);
if (h == INVALID_HANDLE_VALUE)
return -1; //Can't find file
- FindClose(h);
- if (ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
- return 0; //Always return success if target is directory and exists
+ if (ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {
+ // WORKAROUND: WinCE (or the emulator) sometimes returns bogus direcotry
+ // hits for files that don't exist. Checking for the same fname twice
+ // seems to weed out those false positives.
+ HANDLE h=FindFirstFile(fname, &ffd);
+ FindClose(h);
+ if (h == INVALID_HANDLE_VALUE)
+ return -1; //Can't find file
+ return 0; //Always return success if target is directory and exists
+ }
switch (mode) {
case 00: //Check existence
return 0;
@@ -183,8 +205,7 @@ int _access(const char *path, int mode) {
#ifndef __GNUC__
/* Limited dirent implementation. Used by UI.C and DEVICES.C */
-DIR* opendir(const char* fname)
-{
+DIR* opendir(const char* fname) {
DIR* pdir;
char fnameMask[MAX_PATH+1];
TCHAR fnameUnc[MAX_PATH+1];
@@ -209,13 +230,10 @@ DIR* opendir(const char* fname)
strcpy(pdir->dd_name, fname); /* it has exactly enough space for fname and nul char */
MultiByteToWideChar(CP_ACP, 0, fnameMask, -1, fnameUnc, MAX_PATH);
- if ((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE)
- {
+ if ((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE) {
free(pdir);
return NULL;
- }
- else
- {
+ } else {
WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL);
pdir->dd_dir.d_name = strdup(nameFound);
@@ -224,34 +242,25 @@ DIR* opendir(const char* fname)
return pdir;
}
-struct dirent* readdir(DIR* dir)
-{
+struct dirent* readdir(DIR* dir) {
char nameFound[MAX_PATH+1];
static struct dirent dummy;
- if (dir->dd_stat == 0)
- {
+ if (dir->dd_stat == 0) {
dummy.d_name = ".";
dummy.d_namlen = 1;
dir->dd_stat ++;
return &dummy;
- }
- else if (dir->dd_stat == 1)
- {
+ } else if (dir->dd_stat == 1) {
dummy.d_name = "..";
dummy.d_namlen = 2;
dir->dd_stat ++;
return &dummy;
- }
- else if (dir->dd_stat == 2)
- {
+ } else if (dir->dd_stat == 2) {
dir->dd_stat++;
return &dir->dd_dir;
- }
- else
- {
- if (FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0)
- {
+ } else {
+ if (FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0) {
dir->dd_stat = -1;
return NULL;
}
@@ -283,12 +292,6 @@ int closedir(DIR* dir)
return 1;
}
-/* in our case unlink is the same as remove */
-int unlink(const char* path)
-{
- return remove(path);
-}
-
/* Make directory, Unix style */
void mkdir(char* dirname, int mode)
{
@@ -299,10 +302,8 @@ void mkdir(char* dirname, int mode)
if (*path == '/')
*path = '\\';
/* Run through the string and attempt creating all subdirs on the path */
- for (ptr = path+1; *ptr; ptr ++)
- {
- if (*ptr == '\\' || *ptr == '/')
- {
+ for (ptr = path+1; *ptr; ptr ++) {
+ if (*ptr == '\\' || *ptr == '/') {
*ptr = 0;
MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH);
CreateDirectory(pathUnc, 0);
@@ -313,373 +314,40 @@ void mkdir(char* dirname, int mode)
CreateDirectory(pathUnc, 0);
}
-/* Used in DEVICES.C and UI.C for some purpose. Not critical in this port */
-int system(const char* path) { return 0; }
-
-#if 0
-
-char *tmpnam(char *string)
-{
- TCHAR pTemp[MAX_PATH+1];
- static char buffer[MAX_PATH+1];
- GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp);
- WideCharToMultiByte(CP_ACP, 0, pTemp, -1, buffer, MAX_PATH, NULL, NULL);
-
- if (string)
- {
- strcpy(string, buffer);
- return string;
- }
- else
- return buffer;
-}
-
-FILE *tmpfile()
-{
- TCHAR pTemp[MAX_PATH+1];
- if (!GetTempFileName(TEXT("."), TEXT("A8_"), 0, pTemp))
- return _wfopen(pTemp, TEXT("w+b"));
- else
- return 0;
-}
-
-#endif
-
-void rewind(FILE *stream)
-{
- fseek(stream, 0, SEEK_SET);
-}
-
-
-#if _WIN32_WCE < 300
-
-int isalnum(int c) {
- return ((c >= 'A' && c <= 'Z') ||
- (c >= 'a' && c <= 'z') ||
- (c >= '0' && c <= '9'));
-}
-
-char *_strdup(const char *strSource)
-#else
char *strdup(const char *strSource)
-#endif
{
char* buffer;
- buffer = (char*)malloc(strlen(strSource)+1);
+ size_z len = strlen(strSource)+1;
+ buffer = (char*)malloc(len);
if (buffer)
- strcpy(buffer, strSource);
+ memcpy(buffer, strSource, len);
return buffer;
}
-/* Very limited implementation of sys/time.h */
-void usleep(long usec)
-{
- long msec = usec/1000;
- if (msec <= 0)
- Sleep(0);
- else
- Sleep(msec);
-}
-
-/* This may provide for better sync mechanism */
-unsigned int clock()
-{
- return GetTickCount();
-}
-
-/* And why do people use this? */
-#if _WIN32_WCE >= 300
-void abort()
-{
- exit(1);
-}
-#endif
-
-/*
-IMHO, no project should use this one, it is not portable at all. This implementation
-at least allows some projects to work.
-*/
-char* getenv(char* name)
-{
- static char buffer[MAX_PATH+1];
- if (strcmp(name, "HOME") == 0 || strcmp(name, "HOMEDIR") == 0)
- {
- getcwd(buffer, MAX_PATH);
- return buffer;
- }
- else
- return "";
-}
-
-#if _WIN32_WCE < 300 || defined(_TEST_HPC_STDIO)
-
-void *calloc(size_t n, size_t s) {
- void *result = malloc(n * s);
- if (result)
- memset(result, 0, n * s);
-
- return result;
-}
-
-char *strpbrk(const char *s, const char *accept) {
- int i;
-
- if (!s || !accept)
- return NULL;
-
- for (i=0; i<strlen(s); i++) {
- int j;
- for (j=0; j<strlen(accept); j++)
- if (s[i] == accept[j])
- return (char*)&s[i];
- }
-
- return NULL;
-}
-
-#ifndef _TEST_HPC_STDIO
-
-int isdigit(int c) {
- return (c >='0' && c <= '9');
-}
-
-int isprint(int c) {
- return (c >= ' ' && c <= '~');
-}
-
-int isspace(int c) {
- return (c == ' ');
-}
-
-#endif
-
-#ifndef WIN32_PLATFORM_HPCPRO
-
-
-int printf(const char *format, ...) {
- // useless anyway :)
- return 0;
-}
-
-FILE *fopen(const char *path, const char *mode) {
- TCHAR tempo[MAX_PATH];
- HANDLE result;
- bool writeAccess = (mode[0] == 'W' || mode[0] == 'w');
-
- MultiByteToWideChar(CP_ACP, 0, path, strlen(path) + 1, tempo, sizeof(tempo));
-
- result = CreateFile(tempo, ( writeAccess ? GENERIC_WRITE : GENERIC_READ), 0, NULL, (writeAccess ? CREATE_ALWAYS : OPEN_EXISTING), FILE_ATTRIBUTE_NORMAL, NULL);
- if (result == INVALID_HANDLE_VALUE)
- return NULL;
- else
- return (FILE*)result;
-}
-
-FILE * _wfopen(const TCHAR *path, const TCHAR *mode) {
- HANDLE result;
- bool writeAccess = (mode[0] == 'W' || mode[0] == 'w');
- result = CreateFile(path, ( writeAccess ? GENERIC_WRITE : GENERIC_READ), 0, NULL, (writeAccess ? CREATE_ALWAYS : OPEN_EXISTING), FILE_ATTRIBUTE_NORMAL, NULL);
- if (result == INVALID_HANDLE_VALUE)
- return NULL;
- else
- return (FILE*)result;
-}
-
-FILE *_wfreopen(const TCHAR *path, const TCHAR *mode, FILE *stream) {
- fclose(stream);
- stream = _wfopen(path, mode);
- return stream;
-}
-
-int fclose(FILE *stream) {
- CloseHandle((HANDLE)stream);
- return 1;
-}
-
-int fseek(FILE *stream, long offset, int whence) {
- SetFilePointer((HANDLE)stream, offset, NULL, (whence == SEEK_CUR ? FILE_CURRENT : whence == SEEK_END ? FILE_END : FILE_BEGIN));
- return 0;
-}
-
-long ftell(FILE *stream) {
- return (SetFilePointer((HANDLE)stream, 0, NULL, FILE_CURRENT));
-}
-
-size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
- DWORD sizeWritten;
-
- WriteFile((HANDLE)stream, ptr, size * nmemb, &sizeWritten, NULL);
-
- if (size != 0)
- return sizeWritten / size;
- else
- return 0;
-}
-
-size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) {
- DWORD sizeRead;
-
- ReadFile((HANDLE)stream, ptr, size * nmemb, &sizeRead, NULL);
-
- if (size != 0)
- return sizeRead / size;
- else
- return 0;
-}
-
-int fgetc(FILE *stream) {
- unsigned char c;
- if (fread(&c, 1, 1, stream) != 1)
- return -1;
- else
- return c;
-}
-
-char *fgets(char *s, int size, FILE *stream) {
- int i = 0;
- char tempo[1];
-
- memset(s, 0, size);
- while (fread(tempo, 1, 1, stream)) {
- //if (tempo[0] == '\r')
- // break;
- if (tempo[0] == '\r')
- continue;
- s[i++] = tempo[0];
- if (tempo[0] == '\n')
- break;
- if (i == size)
- break;
- }
- if (!i)
- return NULL;
- else
- return s;
-}
-
-int feof(FILE *stream) {
- DWORD fileSize;
- DWORD filePos;
- fileSize = GetFileSize((HANDLE)stream, NULL);
- filePos = SetFilePointer((HANDLE)stream, 0, 0, FILE_CURRENT);
- return (filePos == 0xFFFFFFFF || filePos > (fileSize - 1));
-}
-
-int ferror(FILE *stream) {
- return 0; // FIXME !
-}
-
-int fprintf(FILE *stream, const char *format, ...) {
- char buf[1024];
- va_list va;
-
- va_start(va, format);
- vsnprintf(buf, 1024, format, va);
- va_end(va);
-
- if (buf[strlen(buf) - 1] == '\n') {
- int i = strlen(buf) - 1;
- buf[i] = '\r';
- buf[i + 1] = '\n';
- buf[i + 2] = 0;
- }
-
- return fwrite(buf, 1, strlen(buf), stream);
-}
-
-FILE* _getstdfilex(int) {
- return NULL;
-}
-
-void clearerr(FILE *stream) {
-}
-
-int fflush(FILE *stream) {
- return 0;
-}
-
-#endif
-
-int stricmp( const char *string1, const char *string2 ) {
- char src[4096];
- char dest[4096];
- int i;
-
- for (i=0; i<strlen(string1); i++)
- if (string1[i] >= 'A' && string1[i] <= 'Z')
- src[i] = string1[i] + 32;
- else
- src[i] = string1[i];
- src[i] = 0;
-
- for (i=0; i<strlen(string2); i++)
- if (string2[i] >= 'A' && string2[i] <= 'Z')
- dest[i] = string2[i] + 32;
- else
- dest[i] = string2[i];
- dest[i] = 0;
-
- return strcmp(src, dest);
-}
-
-char *strrchr(const char *s, int c) {
- int i;
-
- for (i = strlen(s) - 1; i > 0; i--)
- if (s[i] == c)
- return (char*)(s + i);
-
- return NULL;
-}
-
-long int strtol(const char *nptr, char **endptr, int base) {
- // not correct but that's all we are using
-
- long int result;
- sscanf(nptr, "%ld", &result);
- return result;
-}
-
-
-#endif
-
-
// gcc build only functions follow
#else // defined(__GNUC__)
#ifndef __MINGW32CE__
-int islower(int c)
-{
+int islower(int c) {
return (c>='a' && c<='z');
}
-int isspace(int c)
-{
+int isspace(int c) {
return (c==' ' || c=='\f' || c=='\n' || c=='\r' || c=='\t' || c=='\v');
}
-int isalpha(int c)
-{
- return (islower(c) || (c>='A' && c<='Z'));
+int isalpha(int c) {
+ return ((c>='a' && c<='z') || (c>='A' && c<='Z'));
}
-int isalnum(int c)
-{
- return (isalpha(c) || (c>='0' && c<='9'));
-}
-
-int isprint(int c)
-{
- static char punct[] = "!\"#%&'();<=>?[\\]*+,-./:^_{|}~";
- int i = 0, flag = 0;
- while ((punct[i] != 0) && (flag = (punct[i] != c)))
- i++;
- return (isalnum(c) || flag);
+int isalnum(int c) {
+ return ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9'));
}
-extern "C" int atexit(void (*function)(void))
-{
- return 0;
+int isprint(int c) {
+ //static const char punct[] = "!\"#%&'();<=>?[\\]*+,-./:^_{|}~";
+ //return (isalnum(c) || strchr(punct, c));
+ return (32 <= c && c <= 126); // based on BSD manpage
}
#endif
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 8cf5fac279..3f16b4fdd1 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -35,7 +35,7 @@
#include "base/main.h"
#include "base/plugins.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "sound/fmopl.h"
#include "backends/timer/default/default-timer.h"
@@ -94,7 +94,6 @@ static char stdout_fname[MAX_PATH], stderr_fname[MAX_PATH];
// Static member inits
typedef void (*SoundProc)(void *param, byte *buf, int len);
bool OSystem_WINCE3::_soundMaster = true;
-SoundProc OSystem_WINCE3::_originalSoundProc = NULL;
bool _isSmartphone = false;
bool _hasSmartphoneResolution = false;
@@ -403,9 +402,8 @@ void OSystem_WINCE3::initBackend()
{
// Instantiate our own sound mixer
// mixer init is postponed until a game engine is selected.
- if (_mixer == 0) {
- _mixer = new Audio::Mixer();
- }
+ if (_mixer == 0)
+ _mixer = new Audio::MixerImpl(this);
// 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
@@ -770,7 +768,7 @@ void OSystem_WINCE3::create_toolbar() {
_toolbarHandler.setVisible(false);
}
-bool OSystem_WINCE3::setSoundCallback(SoundProc proc, void *param) {
+void OSystem_WINCE3::setupMixer() {
SDL_AudioSpec desired;
int thread_priority;
@@ -779,18 +777,20 @@ bool OSystem_WINCE3::setSoundCallback(SoundProc proc, void *param) {
memset(&desired, 0, sizeof(desired));
- _originalSoundProc = proc;
desired.freq = _sampleRate;
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 128;
desired.callback = private_sound_proc;
- desired.userdata = param;
+ desired.userdata = this;
+
+ // Create the mixer instance
+ if (_mixer == 0)
+ _mixer = new Audio::MixerImpl(this);
// Add sound thread priority
- if (!ConfMan.hasKey("sound_thread_priority")) {
+ if (!ConfMan.hasKey("sound_thread_priority"))
thread_priority = THREAD_PRIORITY_NORMAL;
- }
else
thread_priority = ConfMan.getInt("sound_thread_priority");
@@ -799,16 +799,26 @@ bool OSystem_WINCE3::setSoundCallback(SoundProc proc, void *param) {
SDL_CloseAudio();
if (SDL_OpenAudio(&desired, NULL) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
- return false;
- }
- else
+ _mixer->setReady(false);
+
+ } else {
debug(1, "Sound opened OK, mixing at %d Hz", _sampleRate);
- SDL_PauseAudio(0);
- return true;
+
+ // Re-create mixer to match the output rate
+ delete(_mixer);
+ _mixer = new Audio::MixerImpl(this);
+ _mixer->setOutputRate(_sampleRate);
+ _mixer->setReady(true);
+ SDL_PauseAudio(0);
+ }
}
void OSystem_WINCE3::private_sound_proc(void *param, byte *buf, int len) {
- (*_originalSoundProc)(param, buf, len);
+ OSystem_WINCE3 *this_ = (OSystem_WINCE3 *)param;
+ assert(this_);
+
+ if (this_->_mixer)
+ this_->_mixer->mixCallback(buf, len);
if (!_soundMaster)
memset(buf, 0, len);
}
@@ -838,7 +848,7 @@ bool OSystem_WINCE3::checkOggHighSampleRate() {
}
#endif
-void OSystem_WINCE3::get_sample_rate() {
+void OSystem_WINCE3::compute_sample_rate() {
// Force at least medium quality FM synthesis for FOTAQ
Common::String gameid(ConfMan.get("gameid"));
if (gameid == "queen") {
@@ -875,9 +885,8 @@ void OSystem_WINCE3::setWindowCaption(const char *caption) {
//update_game_settings();
// finalize mixer init
- get_sample_rate();
- bool result = setSoundCallback(Audio::Mixer::mixCallback, _mixer);
- _mixer->setReady(result);
+ compute_sample_rate();
+ setupMixer();
// handle the actual event
OSystem_SDL::setWindowCaption(caption);
@@ -1050,7 +1059,7 @@ void OSystem_WINCE3::update_game_settings() {
}
}
- get_sample_rate();
+ compute_sample_rate();
}
void OSystem_WINCE3::initSize(uint w, uint h) {
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index daa7e832f6..8853c156d8 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -82,7 +82,7 @@ public:
// Overloaded from SDL_Commmon
void quit();
// Overloaded from SDL_Commmon (master volume and sample rate subtleties)
- bool setSoundCallback(SoundProc proc, void *param);
+ void setupMixer();
// Overloaded from OSystem
//void engineInit();
void getTimeAndDate(struct tm &t) const;
@@ -160,13 +160,12 @@ private:
#endif
static void private_sound_proc(void *param, byte *buf, int len);
- static SoundProc _originalSoundProc;
bool update_scalers();
void create_toolbar();
void update_game_settings();
void check_mappings();
- void get_sample_rate();
+ void compute_sample_rate();
void retrieve_mouse_location(int &x, int &y);
diff --git a/backends/platform/x11/module.mk b/backends/platform/x11/module.mk
deleted file mode 100644
index 22015b53be..0000000000
--- a/backends/platform/x11/module.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-MODULE := backends/platform/x11
-
-MODULE_OBJS := \
- x11.o
-
-MODULE_DIRS += \
- backends/platform/x11/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
diff --git a/backends/platform/x11/x11.cpp b/backends/platform/x11/x11.cpp
deleted file mode 100644
index 329d994335..0000000000
--- a/backends/platform/x11/x11.cpp
+++ /dev/null
@@ -1,1050 +0,0 @@
-/* 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-/* The bare pure X11 port done by Lionel 'BBrox' Ulmer */
-
-#include "common/scummsys.h"
-#include "common/events.h"
-#include "common/system.h"
-#include "common/util.h"
-#include "base/main.h"
-#include "backends/platform/x11/x11.h"
-#include "backends/plugins/posix/posix-provider.h"
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <sys/time.h>
-#include <unistd.h>
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XShm.h>
-
-#ifdef __linux__
-#include <linux/soundcard.h>
-#else
-#include <sys/soundcard.h>
-#endif
-
-#include <sched.h>
-#include <pthread.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-
-//#define SAMPLES_PER_SEC 11025
-#define SAMPLES_PER_SEC 22050
-//#define SAMPLES_PER_SEC 44100
-
-
-int main(int argc, char *argv[]) {
- g_system = OSystem_X11::create(0, 0);
- assert(g_system);
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
- g_system->quit(); // TODO: Consider removing / replacing this!
- return res;
-}
-
-OSystem *OSystem_X11::create(int gfx_mode, bool full_screen) {
- OSystem_X11 *syst = new OSystem_X11();
- return syst;
-}
-
-OSystem_X11::OSystem_X11() {
- /* Some members initialization */
- _fake_right_mouse = 0;
- _report_presses = 1;
- _current_shake_pos = 0;
- _new_shake_pos = 0;
- _palette_changed = false;
- _num_of_dirty_rects = 0;
- _overlay_visible = false;
- _mouse_state_changed = true;
- _mouse_visible = true;
- _ms_buf = NULL;
- _curMouseState.x = 0;
- _curMouseState.y = 0;
- _curMouseState.hot_x = 0;
- _curMouseState.hot_y = 0;
- _curMouseState.w = 0;
- _curMouseState.h = 0;
- _palette16 = 0;
- _palette32 = 0;
- _bytesPerPixel = 0;
- _image = 0;
- _local_fb = 0;
- _local_fb_overlay = 0;
-}
-
-OSystem_X11::~OSystem_X11() {
- XFree(_image);
- if (_palette16)
- free(_palette16);
-
- if (_palette32)
- free(_palette32);
-
- if (_ms_buf)
- free(_ms_buf);
-
- free(_local_fb_overlay);
- free(_local_fb);
-}
-
-void OSystem_X11::initBackend() {
- char buf[512];
- XWMHints *wm_hints;
- XGCValues values;
- XTextProperty window_name;
- char *name = (char *)&buf;
- /* For the_window title */
- sprintf(buf, "ScummVM");
-
- _display = XOpenDisplay(NULL);
- if (_display == NULL) {
- error("Could not open display !\n");
- exit(1);
- }
-
- if (XShmQueryExtension(_display)!=True)
- error("No Shared Memory Extension present");
-
- _screen = DefaultScreen(_display);
- _depth = DefaultDepth(_display, _screen);
- switch (_depth) {
- case 16 :
- _bytesPerPixel = 2;
- break;
- case 24 :
- case 32 :
- _bytesPerPixel = 4;
- break;
- }
-
- if (!_bytesPerPixel)
- error("Your screen depth is %ibit. Values other than 16, 24 and 32bit are currently not supported", _depth);
-
- _window_width = 320;
- _window_height = 200;
- _scumm_x = 0;
- _scumm_y = 0;
- _window = XCreateSimpleWindow(_display, XRootWindow(_display, _screen), 0, 0, 320, 200, 0, 0, 0);
- wm_hints = XAllocWMHints();
- if (wm_hints == NULL) {
- error("Not enough memory to allocate Hints !\n");
- exit(1);
- }
- wm_hints->flags = InputHint | StateHint;
- wm_hints->input = True;
- wm_hints->initial_state = NormalState;
- XStringListToTextProperty(&name, 1, &window_name);
- XSetWMProperties(_display, _window, &window_name, &window_name,
- NULL /* argv */ , 0 /* argc */ , NULL /* size hints */ ,
- wm_hints, NULL /* class hints */ );
- XFree(wm_hints);
-
- XSelectInput(_display, _window,
- ExposureMask | KeyPressMask | KeyReleaseMask |
- PointerMotionMask | ButtonPressMask | ButtonReleaseMask | StructureNotifyMask);
-
- values.foreground = BlackPixel(_display, _screen);
- _black_gc = XCreateGC(_display, _window, GCForeground, &values);
-
- XMapWindow(_display, _window);
- XFlush(_display);
-
- _fb_width = 0;
- _fb_height = 0;
-
- if (!_palette16)
- _palette16 = (uint16 *)calloc(256, sizeof(uint16));
- if (!_palette32 && _bytesPerPixel == 4)
- _palette32 = (uint32 *)calloc(256, sizeof(uint32));
-
- while (1) {
- XEvent event;
- XNextEvent(_display, &event);
- switch (event.type) {
- case Expose:
- goto out_of_loop;
- }
- }
-out_of_loop:
- create_empty_cursor();
-
- /* Initialize the timer routines */
- _timer_active = false;
-
- /* And finally start the local timer */
- gettimeofday(&_start_time, NULL);
-
- OSystem::initBackend();
-}
-
-#undef CAPTURE_SOUND
-#define FRAG_SIZE 4096
-
-static void *sound_and_music_thread(void *params) {
- /* Init sound */
- int sound_fd, param, frag_size;
- uint8 sound_buffer[FRAG_SIZE];
- OSystem::SoundProc sound_proc = ((THREAD_PARAM *)params)->sound_proc;
- void *proc_param = ((THREAD_PARAM *)params)->param;
-
-#ifdef CAPTURE_SOUND
- FILE *f = fopen("sound.raw", "wb");
-#endif
-
- sound_fd = open("/dev/dsp", O_WRONLY);
- audio_buf_info info;
- if (sound_fd < 0) {
- warning("Error opening sound device!\n");
- return NULL;
- }
- param = 0;
- frag_size = FRAG_SIZE /* audio fragment size */ ;
- while (frag_size) {
- frag_size >>= 1;
- param++;
- }
- param--;
- param |= /* audio_fragment_num */ 3 << 16;
- if (ioctl(sound_fd, SNDCTL_DSP_SETFRAGMENT, &param) != 0) {
- warning("Error in the SNDCTL_DSP_SETFRAGMENT ioctl!\n");
- return NULL;
- }
- param = AFMT_S16_LE;
- if (ioctl(sound_fd, SNDCTL_DSP_SETFMT, &param) == -1) {
- warning("Error in the SNDCTL_DSP_SETFMT ioctl!\n");
- return NULL;
- }
- if (param != AFMT_S16_LE) {
- warning("AFMT_S16_LE not supported!\n");
- return NULL;
- }
- param = 2;
- if (ioctl(sound_fd, SNDCTL_DSP_CHANNELS, &param) == -1) {
- warning("Error in the SNDCTL_DSP_CHANNELS ioctl!\n");
- return NULL;
- }
- if (param != 2) {
- warning("Stereo mode not supported!\n");
- return NULL;
- }
- param = SAMPLES_PER_SEC;
- if (ioctl(sound_fd, SNDCTL_DSP_SPEED, &param) == -1) {
- warning("Error in the SNDCTL_DSP_SPEED ioctl!\n");
- return NULL;
- }
- if (param != SAMPLES_PER_SEC) {
- warning("%d kHz not supported!\n", SAMPLES_PER_SEC);
- return NULL;
- }
- if (ioctl(sound_fd, SNDCTL_DSP_GETOSPACE, &info) != 0) {
- warning("SNDCTL_DSP_GETOSPACE");
- return NULL;
- }
-
- sched_yield();
- while (1) {
- uint8 *buf = (uint8 *)sound_buffer;
- int size, written;
-
- sound_proc(proc_param, (byte *)sound_buffer, FRAG_SIZE);
-#ifdef CAPTURE_SOUND
- fwrite(buf, 2, FRAG_SIZE >> 1, f);
- fflush(f);
-#endif
- size = FRAG_SIZE;
- while (size > 0) {
- written = write(sound_fd, buf, size);
- buf += written;
- size -= written;
- }
- }
-
- return NULL;
-}
-
-/* Function used to hide the mouse cursor */
-void OSystem_X11::create_empty_cursor() {
- XColor bg;
- Pixmap pixmapBits;
- Cursor cursor = None;
- static const char data[] = { 0 };
-
- bg.red = bg.green = bg.blue = 0x0000;
- pixmapBits = XCreateBitmapFromData(_display, XRootWindow(_display, _screen), data, 1, 1);
- if (pixmapBits) {
- cursor = XCreatePixmapCursor(_display, pixmapBits, pixmapBits, &bg, &bg, 0, 0);
- XFreePixmap(_display, pixmapBits);
- }
- XDefineCursor(_display, _window, cursor);
-}
-
-bool OSystem_X11::hasFeature(Feature f) {
- return false;
-}
-
-void OSystem_X11::setFeatureState(Feature f, bool enable) {
-}
-
-bool OSystem_X11::getFeatureState(Feature f) {
- return false;
-}
-
-const OSystem::GraphicsMode *OSystem_X11::getSupportedGraphicsModes() const {
- static const OSystem::GraphicsMode mode = {"1x", "Normal mode", 0};
- return &mode;
-}
-
-int OSystem_X11::getDefaultGraphicsMode() const {
- return 0;
-}
-
-bool OSystem_X11::setGraphicsMode(int mode) {
- return (mode == 0);
-}
-
-int OSystem_X11::getGraphicsMode() const {
- return 0;
-}
-
-
-uint32 OSystem_X11::getMillis() {
- struct timeval current_time;
- gettimeofday(&current_time, NULL);
- return (uint32)(((current_time.tv_sec - _start_time.tv_sec) * 1000) +
- ((current_time.tv_usec - _start_time.tv_usec) / 1000));
-}
-
-void OSystem_X11::initSize(uint w, uint h) {
- //debug("initSize(%i, %i)", w, h);
- static XShmSegmentInfo shminfo;
-
- if (((uint)_fb_width != w) || ((uint)_fb_height != w)) {
- _fb_width = w;
- _fb_height = h;
-
- /* We need to change the size of the X11_window */
- XWindowChanges new_values;
-
- new_values.width = _fb_width;
- new_values.height = _fb_height;
-
- XConfigureWindow(_display,_window, CWWidth | CWHeight, &new_values);
-
- if (_image)
- XFree(_image);
- _image = XShmCreateImage(_display, DefaultVisual(_display, _screen), _depth, ZPixmap, NULL, &shminfo,_fb_width,_fb_height);
- if (!_image)
- error("Couldn't get image by XShmCreateImage()");
-
- shminfo.shmid = shmget(IPC_PRIVATE, _image->bytes_per_line * _image->height, IPC_CREAT | 0700);
- if (shminfo.shmid < 0)
- error("Couldn't allocate image data by shmget()");
-
- _image->data = shminfo.shmaddr = (char *)shmat(shminfo.shmid, 0, 0);
- shminfo.readOnly = False;
- if (XShmAttach(_display, &shminfo) == 0) {
- error("Could not attach shared memory segment !\n");
- exit(1);
- }
- shmctl(shminfo.shmid, IPC_RMID, 0);
-
- if (_local_fb)
- free(_local_fb);
- if (_local_fb_overlay)
- free(_local_fb_overlay);
- /* Initialize the 'local' frame buffer and the palette */
- _local_fb = (uint8 *)calloc(_fb_width * _fb_height, sizeof(uint8));
- _local_fb_overlay = (uint16 *)calloc(_fb_width * _fb_height, sizeof(uint16));
-
- }
-}
-
-bool OSystem_X11::setSoundCallback(SoundProc proc, void *param) {
- static THREAD_PARAM thread_param;
-
- /* And finally start the music thread */
- thread_param.param = param;
- thread_param.sound_proc = proc;
-
- pthread_create(&_sound_thread, NULL, sound_and_music_thread, (void *)&thread_param);
-
- return true;
-}
-
-void OSystem_X11::clearSoundCallback() {
- // TODO implement this...
- // The sound_thread has to be stopped in a nice way. In particular,
- // using pthread_kill would be a bad idea. Rather, use pthread_cancel,
- // or maybe a global variable, to achieve this.
- // This method shouldn't return until the sound thread really has stopped.
-}
-
-
-void OSystem_X11::setPalette(const byte *colors, uint start, uint num) {
- uint16 *pal = &(_palette16[start]);
- const byte *data = colors;
-
- if (_bytesPerPixel == 4) {
- for (uint i = start; i < start+num; i++) {
- //_palette32[i] = ((uint32 *)colors)[i];
- _palette32[i] = (colors[i * 4 + 0] << 16) | (colors[i * 4 + 1] << 8) | (colors[i * 4 + 2] << 0);
- }
- }
-
- do {
- *pal++ = ((data[0] & 0xF8) << 8) | ((data[1] & 0xFC) << 3) | (data[2] >> 3);
- data += 4;
- num--;
- } while (num > 0);
-
- _palette_changed = true;
-}
-
-#define AddDirtyRec(xi,yi,wi,hi) \
- if (_num_of_dirty_rects < MAX_NUMBER_OF_DIRTY_RECTS) { \
- _ds[_num_of_dirty_rects].x = xi; \
- _ds[_num_of_dirty_rects].y = yi; \
- _ds[_num_of_dirty_rects].w = wi; \
- _ds[_num_of_dirty_rects].h = hi; \
- _num_of_dirty_rects++; \
- }
-
-void OSystem_X11::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
- uint8 *dst;
-
- if (y < 0) {
- h += y;
- buf -= y * pitch;
- y = 0;
- }
- if (h > (_fb_height - y)) {
- h = _fb_height - y;
- }
-
- dst = _local_fb + _fb_width * y + x;
-
- if (h <= 0)
- return;
-
- AddDirtyRec(x, y, w, h);
- while (h-- > 0) {
- memcpy(dst, buf, w);
- dst +=_fb_width;
- buf += pitch;
- }
-}
-
-void OSystem_X11::blit(const DirtyRect *d, uint16 *dst, int pitch) {
- uint8 *ptr_src = _local_fb + (_fb_width * d->y) + d->x;
- uint16 *ptr_dst = dst + ((_fb_width * d->y) + d->x);
- int x, y;
-
- for (y = 0; y < d->h; y++) {
- for (x = 0; x < d->w; x++) {
- *ptr_dst++ = _palette16[*ptr_src++];
- }
- ptr_dst += pitch - d->w;
- ptr_src +=_fb_width - d->w;
- }
-}
-
-void OSystem_X11::blit_convert(const DirtyRect *d, uint8 *dst, int pitch) {
- uint8 *ptr_src = _local_fb + (_fb_width * d->y) + d->x;
- uint8 *ptr_dst = dst + ((_fb_width * d->y) + d->x) * _bytesPerPixel;
- int x, y;
-
- switch (_bytesPerPixel) {
- case 2:
- for (y = 0; y < d->h; y++) {
- for (x = 0; x < d->w; x++) {
- *ptr_dst = _palette16[*ptr_src++];
- ptr_dst += _bytesPerPixel;
- }
- ptr_dst += (pitch - d->w) * _bytesPerPixel;
- ptr_src +=_fb_width - d->w;
- }
- break;
- case 4:
- for (y = 0; y < d->h; y++) {
- for (x = 0; x < d->w; x++) {
- *(uint32 *)ptr_dst = _palette32[*ptr_src];
- ptr_dst += _bytesPerPixel;
- ptr_src++;
- }
- ptr_dst += (pitch - d->w) * _bytesPerPixel;
- ptr_src += _fb_width - d->w;
- }
- }
-}
-
-void OSystem_X11::updateScreen_helper(const DirtyRect *d, DirtyRect *dout) {
-
- if (_overlay_visible == false) {
- blit_convert(d, (uint8 *)_image->data, _fb_width);
- } else {
- uint16 *ptr_src = _local_fb_overlay + (_fb_width * d->y) + d->x;
- uint8 *ptr_dst = (uint8 *)_image->data + ((_fb_width * d->y) + d->x) * _bytesPerPixel;
-
- int y;
-
- switch (_bytesPerPixel) {
- case 2:
- for (y = 0; y < d->h; y++) {
- memcpy(ptr_dst, ptr_src, d->w * sizeof(uint16));
- ptr_dst += _fb_width * sizeof(uint16);
- ptr_src += _fb_width;
- }
- break;
- case 4:
- uint16 currLine, x;
- register uint16 currPixel;
- for (y = d->y; y < d->y + d->h; y++) {
- currLine = y * _fb_width;
- for (x = d->x; x < d->x + d->w; x++) {
- currPixel = _local_fb_overlay[(currLine + x)];
- *(uint32 *)ptr_dst = ((currPixel & 0xF800) << 8) + ((currPixel & 0x07E0) << 5) +
- ((currPixel & 0x001F) << 3);
- ptr_dst += sizeof(uint32);
- }
- ptr_dst += (_fb_width - d->w) * _bytesPerPixel;
- }
-
- }
- }
- if (d->x < dout->x)
- dout->x = d->x;
- if (d->y < dout->y)
- dout->y = d->y;
- if ((d->x + d->w) > dout->w)
- dout->w = d->x + d->w;
- if ((d->y + d->h) > dout->h)
- dout->h = d->y + d->h;
-}
-
-void OSystem_X11::updateScreen() {
- bool full_redraw = false;
- bool need_redraw = false;
- static const DirtyRect ds_full = { 0, 0, _fb_width, _fb_height };
- DirtyRect dout = {_fb_width, _fb_height, 0, 0 };
-
- if (_palette_changed) {
- full_redraw = true;
- _num_of_dirty_rects = 0;
- _palette_changed = false;
- } else if (_num_of_dirty_rects >= MAX_NUMBER_OF_DIRTY_RECTS) {
- full_redraw = true;
- _num_of_dirty_rects = 0;
- }
-
- if (full_redraw) {
- updateScreen_helper(&ds_full, &dout);
- need_redraw = true;
- } else if ((_num_of_dirty_rects > 0) || (_mouse_state_changed == true)) {
- need_redraw = true;
- while (_num_of_dirty_rects > 0) {
- _num_of_dirty_rects--;
- updateScreen_helper(&(_ds[_num_of_dirty_rects]), &dout);
- }
- }
-
- /* Then 'overlay' the mouse on the image */
- draw_mouse(&dout);
-
- if (_current_shake_pos != _new_shake_pos) {
- /* Redraw first the 'black borders' in case of resize */
- if (_current_shake_pos < _new_shake_pos)
- XFillRectangle(_display,_window, _black_gc, 0, _current_shake_pos, _window_width, _new_shake_pos);
- else
- XFillRectangle(_display,_window, _black_gc, 0, _window_height - _current_shake_pos,
- _window_width,_window_height - _new_shake_pos);
- XShmPutImage(_display, _window, DefaultGC(_display, _screen), _image,
- 0, 0, _scumm_x, _scumm_y + _new_shake_pos, _fb_width, _fb_height, 0);
- _current_shake_pos = _new_shake_pos;
- } else if (need_redraw == true) {
- XShmPutImage(_display, _window, DefaultGC(_display, _screen), _image,
- dout.x, dout.y, _scumm_x + dout.x, _scumm_y + dout.y + _current_shake_pos,
- dout.w - dout.x, dout.h - dout.y, 0);
- XFlush(_display);
- }
-}
-
-bool OSystem_X11::showMouse(bool visible)
-{
- if (_mouse_visible == visible)
- return visible;
-
- bool last = _mouse_visible;
- _mouse_visible = visible;
-
- if ((visible == false) && (_mouse_state_changed == false)) {
- undraw_mouse();
- }
- _mouse_state_changed = true;
-
- return last;
-}
-
-void OSystem_X11::quit() {
- exit(0);
-}
-
-void OSystem_X11::setWindowCaption(const char *caption) {
- //debug("setWindowCaption('%s')", caption);
-}
-
-void OSystem_X11::undraw_mouse() {
- AddDirtyRec(_oldMouseState.x, _oldMouseState.y, _oldMouseState.w, _oldMouseState.h);
-}
-
-void OSystem_X11::draw_mouse(DirtyRect *dout) {
- //debug("draw_mouse()");
- _mouse_state_changed = false;
-
- if (_mouse_visible == false)
- return;
-
- int xdraw = _curMouseState.x - _curMouseState.hot_x;
- int ydraw = _curMouseState.y - _curMouseState.hot_y;
- int w = _curMouseState.w;
- int h = _curMouseState.h;
- int real_w;
- int real_h;
-
- uint8 *dst;
- const byte *buf = _ms_buf;
-
- if (ydraw < 0) {
- real_h = h + ydraw;
- buf += (-ydraw) * w;
- ydraw = 0;
- } else {
- real_h = (ydraw + h) > _fb_height ? (_fb_height - ydraw) : h;
- }
- if (xdraw < 0) {
- real_w = w + xdraw;
- buf += (-xdraw);
- xdraw = 0;
- } else {
- real_w = (xdraw + w) > _fb_width ? (_fb_width - xdraw) : w;
- }
-
- dst = (uint8 *)_image->data + ((ydraw *_fb_width) + xdraw) * _bytesPerPixel;
-
- if ((real_h == 0) || (real_w == 0)) {
- return;
- }
-
-
- if (xdraw < dout->x)
- dout->x = xdraw;
- if (ydraw < dout->y)
- dout->y = ydraw;
- if ((xdraw + real_w) > dout->w)
- dout->w = xdraw + real_w;
- if ((ydraw + real_h) > dout->h)
- dout->h = ydraw + real_h;
-
- _oldMouseState.x = xdraw;
- _oldMouseState.y = ydraw;
- _oldMouseState.w = real_w;
- _oldMouseState.h = real_h;
-
- while (real_h > 0) {
- int width = real_w;
- while (width > 0) {
- byte color = *buf;
- if (color != _mouseKeycolor) {
- if (_depth == 16)
- *(uint16 *)dst = _palette16[color];
- else {
- *(uint32 *)dst = _palette32[color];
- }
- }
- buf++;
- dst += _bytesPerPixel;
- width--;
- }
- buf += w - real_w;
- dst += (_fb_width - real_w) * _bytesPerPixel;
- real_h--;
- }
-}
-
-void OSystem_X11::set_mouse_pos(int x, int y) {
- if ((x != _curMouseState.x) || (y != _curMouseState.y)) {
- _curMouseState.x = x;
- _curMouseState.y = y;
- if (_mouse_state_changed == false) {
- undraw_mouse();
- }
- _mouse_state_changed = true;
- }
-}
-
-void OSystem_X11::warpMouse(int x, int y) {
- set_mouse_pos(x, y);
-}
-
-void OSystem_X11::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale) {
- _curMouseState.w = w;
- _curMouseState.h = h;
- _curMouseState.hot_x = hotspot_x;
- _curMouseState.hot_y = hotspot_y;
-
- if (_ms_buf)
- free(_ms_buf);
- _ms_buf = (byte *) malloc(w * h);
- memcpy(_ms_buf, buf, w * h);
-
- if (_mouse_state_changed == false) {
- undraw_mouse();
- }
- _mouseKeycolor = keycolor;
- _mouse_state_changed = true;
-}
-
-void OSystem_X11::setShakePos(int shake_pos) {
- if (_new_shake_pos != shake_pos) {
- if (_mouse_state_changed == false) {
- undraw_mouse();
- }
- _mouse_state_changed = true;
- }
- _new_shake_pos = shake_pos;
-}
-
-int OSystem_X11::getOutputSampleRate() const {
- return SAMPLES_PER_SEC;
-}
-
-void OSystem_X11::delayMillis(uint msecs) {
- usleep(msecs * 1000);
-}
-
-bool OSystem_X11::pollEvent(Common::Event &scumm_event) {
- /* First, handle timers */
- uint32 current_msecs = getMillis();
-
- if (_timer_active && (current_msecs >= _timer_next_expiry)) {
- _timer_duration = _timer_callback(_timer_duration);
- _timer_next_expiry = current_msecs + _timer_duration;
- }
-
- while (XPending(_display)) {
- XEvent event;
-
- XNextEvent(_display, &event);
- switch (event.type) {
- case Expose:{
- int real_w, real_h;
- int real_x, real_y;
- real_x = event.xexpose.x;
- real_y = event.xexpose.y;
- real_w = event.xexpose.width;
- real_h = event.xexpose.height;
- if (real_x < _scumm_x) {
- real_w -= _scumm_x - real_x;
- real_x = 0;
- } else {
- real_x -= _scumm_x;
- }
- if (real_y < _scumm_y) {
- real_h -= _scumm_y - real_y;
- real_y = 0;
- } else {
- real_y -= _scumm_y;
- }
- if ((real_h <= 0) || (real_w <= 0))
- break;
- if ((real_x >=_fb_width) || (real_y >=_fb_height))
- break;
-
- if ((real_x + real_w) >=_fb_width) {
- real_w =_fb_width - real_x;
- }
- if ((real_y + real_h) >=_fb_height) {
- real_h =_fb_height - real_y;
- }
-
- /* Compute the intersection of the expose event with the real ScummVM display zone */
- AddDirtyRec(real_x, real_y, real_w, real_h);
- }
- break;
-
- case KeyPress:{
- /* I am using keycodes here and NOT keysyms to be sure that even if the user
- remaps his iPAQ's keyboard, it will still work.
- */
- int keycode = -1;
- int ascii = -1;
- byte mode = 0;
-
- if (event.xkey.state & 0x01)
- mode |= Common::KBD_SHIFT;
- if (event.xkey.state & 0x04)
- mode |= Common::KBD_CTRL;
- if (event.xkey.state & 0x08)
- mode |= Common::KBD_ALT;
- switch (event.xkey.keycode) {
-
- case 9: /* Escape on my PC */
- case 130: /* Calendar on the iPAQ */
- keycode = 27;
- break;
-
- case 71: /* F5 on my PC */
- case 128: /* Record on the iPAQ */
- keycode = 319;
- break;
-
- case 65: /* Space on my PC */
- case 131: /* Schedule on the iPAQ */
- keycode = 32;
- break;
-
- case 132:
- _report_presses = 0;
- break;
-
- case 133:
- _fake_right_mouse = 1;
- break;
-
- default:{
- KeySym xsym;
- xsym = XKeycodeToKeysym(_display, event.xkey.keycode, 0);
- keycode = xsym;
- if ((xsym >= 'a') && (xsym <= 'z') && (event.xkey.state & 0x01))
- xsym &= ~0x20; /* Handle shifted keys */
- ascii = xsym;
- }
- }
- if (keycode != -1) {
- scumm_event.type = Common::EVENT_KEYDOWN;
- scumm_event.kbd.keycode = keycode;
- scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
- scumm_event.kbd.flags = mode;
- return true;
- }
- }
- break;
-
- case KeyRelease:{
- /* I am using keycodes here and NOT keysyms to be sure that even if the user
- remaps his iPAQ's keyboard, it will still work.
- */
- int keycode = -1;
- int ascii = -1;
- byte mode = 0;
-
- if (event.xkey.state & 0x01)
- mode |= Common::KBD_SHIFT;
- if (event.xkey.state & 0x04)
- mode |= Common::KBD_CTRL;
- if (event.xkey.state & 0x08)
- mode |= Common::KBD_ALT;
- switch (event.xkey.keycode) {
- case 132: /* 'Q' on the iPAQ */
- _report_presses = 1;
- break;
-
- case 133: /* Arrow on the iPAQ */
- _fake_right_mouse = 0;
- break;
-
- default:{
- KeySym xsym;
- xsym = XKeycodeToKeysym(_display, event.xkey.keycode, 0);
- keycode = xsym;
- if ((xsym >= 'a') && (xsym <= 'z') && (event.xkey.state & 0x01))
- xsym &= ~0x20; /* Handle shifted keys */
- ascii = xsym;
- }
- }
- if (keycode != -1) {
- scumm_event.type = Common::EVENT_KEYUP;
- scumm_event.kbd.keycode = keycode;
- scumm_event.kbd.ascii = (ascii != -1 ? ascii : keycode);
- scumm_event.kbd.flags = mode;
- return true;
- }
- }
- break;
-
- case ButtonPress:
- if (_report_presses != 0) {
- if (event.xbutton.button == 1) {
- if (_fake_right_mouse == 0) {
- scumm_event.type = Common::EVENT_LBUTTONDOWN;
- } else {
- scumm_event.type = Common::EVENT_RBUTTONDOWN;
- }
- } else if (event.xbutton.button == 3)
- scumm_event.type = Common::EVENT_RBUTTONDOWN;
- scumm_event.mouse.x = event.xbutton.x - _scumm_x;
- scumm_event.mouse.y = event.xbutton.y - _scumm_y;
- return true;
- }
- break;
-
- case ButtonRelease:
- if (_report_presses != 0) {
- if (event.xbutton.button == 1) {
- if (_fake_right_mouse == 0) {
- scumm_event.type = Common::EVENT_LBUTTONUP;
- } else {
- scumm_event.type = Common::EVENT_RBUTTONUP;
- }
- } else if (event.xbutton.button == 3)
- scumm_event.type = Common::EVENT_RBUTTONUP;
- scumm_event.mouse.x = event.xbutton.x - _scumm_x;
- scumm_event.mouse.y = event.xbutton.y - _scumm_y;
- return true;
- }
- break;
-
- case MotionNotify:
- scumm_event.type = Common::EVENT_MOUSEMOVE;
- scumm_event.mouse.x = event.xmotion.x - _scumm_x;
- scumm_event.mouse.y = event.xmotion.y - _scumm_y;
- set_mouse_pos(scumm_event.mouse.x, scumm_event.mouse.y);
- return true;
-
- case ConfigureNotify:{
- if ((_window_width != event.xconfigure.width) || (_window_height != event.xconfigure.height)) {
- _window_width = event.xconfigure.width;
- _window_height = event.xconfigure.height;
- _scumm_x = (_window_width -_fb_width) / 2;
- _scumm_y = (_window_height -_fb_height) / 2;
- XFillRectangle(_display, _window, _black_gc, 0, 0, _window_width, _window_height);
- }
- }
- break;
-
- default:
- printf("Unhandled event : %d\n", event.type);
- break;
- }
- }
-
- return false;
-}
-
-void OSystem_X11::setTimerCallback(TimerProc callback, int interval) {
- if (callback != NULL) {
- _timer_duration = interval;
- _timer_next_expiry = getMillis() + interval;
- _timer_callback = callback;
- _timer_active = true;
- } else {
- _timer_active = false;
- }
-}
-
-OSystem::MutexRef OSystem_X11::createMutex(void) {
- pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(mutex, NULL);
- return (MutexRef)mutex;
-}
-
-void OSystem_X11::lockMutex(MutexRef mutex) {
- pthread_mutex_lock((pthread_mutex_t *) mutex);
-}
-
-void OSystem_X11::unlockMutex(MutexRef mutex) {
- pthread_mutex_unlock((pthread_mutex_t *) mutex);
-}
-
-void OSystem_X11::deleteMutex(MutexRef mutex) {
- pthread_mutex_destroy((pthread_mutex_t *) mutex);
- free(mutex);
-}
-
-void OSystem_X11::showOverlay() {
- _overlay_visible = true;
-}
-
-void OSystem_X11::hideOverlay() {
- _overlay_visible = false;
- _palette_changed = true; // This is to force a full redraw to hide the overlay
-}
-
-void OSystem_X11::clearOverlay() {
- if (_overlay_visible == false)
- return;
- DirtyRect d = { 0, 0, _fb_width, _fb_height };
- AddDirtyRec(0, 0, _fb_width, _fb_height);
- blit(&d, _local_fb_overlay, _fb_width);
-}
-
-void OSystem_X11::grabOverlay(int16 *dest, int pitch) {
- if (_overlay_visible == false)
- return;
-
- DirtyRect d = { 0, 0, _fb_width, _fb_height };
- blit(&d, (uint16 *)dest, pitch);
-}
-
-void OSystem_X11::copyRectToOverlay(const int16 *src, int pitch, int x, int y, int w, int h) {
- if (_overlay_visible == false)
- return;
- uint16 *dst = _local_fb_overlay + x + (y * _fb_width);
- AddDirtyRec(x, y, w, h);
- while (h > 0) {
- memcpy(dst, src, w * sizeof(*dst));
- dst +=_fb_width;
- src += pitch;
- h--;
- }
-}
-
-int16 OSystem_X11::getHeight() {
- return _fb_height;
-}
-
-int16 OSystem_X11::getWidth() {
- return _fb_width;
-}
-
-void OSystem_X11::grabPalette(byte *colors, uint start, uint num) {
- warning("Dummy: grabPalette()");
-}
diff --git a/backends/platform/x11/x11.h b/backends/platform/x11/x11.h
deleted file mode 100644
index bf5da5745a..0000000000
--- a/backends/platform/x11/x11.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* 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.
- *
- * $URL$
- * $Id$
- *
- */
-
-class OSystem_X11:public OSystem {
-public:
- OSystem_X11();
- ~OSystem_X11();
-
- void initBackend();
-
- // Determine whether the backend supports the specified feature.
- bool hasFeature(Feature f);
-
- // En-/disable the specified feature.
- void setFeatureState(Feature f, bool enable);
-
- // Query the state of the specified feature.
- bool getFeatureState(Feature f);
-
- // Retrieve a list of all graphics modes supported by this backend.
- const GraphicsMode *getSupportedGraphicsModes() const;
-
- // Return the ID of the 'default' graphics mode.
- int getDefaultGraphicsMode() const;
-
- // Switch to the specified graphics mode.
- bool setGraphicsMode(int mode);
-
- // Determine which graphics mode is currently active.
- int getGraphicsMode() const;
-
- // Set colors of the palette
- void setPalette(const byte *colors, uint start, uint num);
-
- // Set the size of the video bitmap.
- // Typically, 320x200
- void initSize(uint w, uint h);
-
- // Draw a bitmap to screen.
- // The screen will not be updated to reflect the new bitmap
- void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
-
- // Update the dirty areas of the screen
- void updateScreen();
-
- // Either show or hide the mouse cursor
- bool showMouse(bool visible);
-
- // Set the position of the mouse cursor
- void set_mouse_pos(int x, int y);
-
- // Warp the mouse cursor. Where set_mouse_pos() only informs the
- // backend of the mouse cursor's current position, this function
- // actually moves the cursor to the specified position.
- void warpMouse(int x, int y);
-
- // Set the bitmap that's used when drawing the cursor.
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1);
-
- // Shaking is used in SCUMM. Set current shake position.
- void setShakePos(int shake_pos);
-
- // Get the number of milliseconds since the program was started.
- uint32 getMillis();
-
- // Delay for a specified amount of milliseconds
- void delayMillis(uint msecs);
-
- // Get the next event.
- // Returns true if an event was retrieved.
- bool pollEvent(Common::Event &event);
-
- // Set function that generates samples
- bool setSoundCallback(SoundProc proc, void *param);
- void clearSoundCallback();
-
- // Determine the output sample rate. Audio data provided by the sound
- // callback will be played using this rate.
- int getOutputSampleRate() const;
-
- // Quit
- void quit();
-
- // Add a callback timer
- void setTimerCallback(TimerProc callback, int interval);
-
- // Mutex handling
- MutexRef createMutex();
- void lockMutex(MutexRef mutex);
- void unlockMutex(MutexRef mutex);
- void deleteMutex(MutexRef mutex);
-
- // Overlay handling for the new menu system
- void showOverlay();
- void hideOverlay();
- void clearOverlay();
- void grabOverlay(int16 *, int);
- void copyRectToOverlay(const int16 *, int, int, int, int, int);
- virtual int16 getHeight();
- virtual int16 getWidth();
-
- virtual void grabPalette(byte *colors, uint start, uint num);
-
- // Set a window caption or any other comparable status display to the
- // given value.
- void setWindowCaption(const char *caption);
-
- static OSystem *create(int gfx_mode, bool full_screen);
-
-private:
- typedef struct {
- int x, y;
- int w, h;
- int hot_x, hot_y;
- } MouseState;
-
- typedef struct {
- int x, y, w, h;
- } DirtyRect;
-
- enum {
- MAX_NUMBER_OF_DIRTY_RECTS = 32
- };
-
- void create_empty_cursor();
- void draw_mouse(DirtyRect *dout);
- void undraw_mouse();
- void updateScreen_helper(const DirtyRect *d, DirtyRect *dout);
- void blit_convert(const DirtyRect *d, uint8 *dst, int pitch);
- void blit(const DirtyRect *d, uint16 *dst, int pitch);
-
- uint8 *_local_fb;
- uint16 *_local_fb_overlay;
- bool _overlay_visible;
-
- int _window_width, _window_height;
- int _fb_width, _fb_height;
- int _scumm_x, _scumm_y;
-
- uint16 *_palette16;
- uint32 *_palette32;
-
- bool _palette_changed;
- Display *_display;
- int _screen, _depth;
- uint8 _bytesPerPixel;
- Window _window;
- GC _black_gc;
- XImage *_image;
- pthread_t _sound_thread;
-
- struct timeval _start_time;
-
- int _fake_right_mouse;
- int _report_presses;
- int _current_shake_pos;
- int _new_shake_pos;
- DirtyRect _ds[MAX_NUMBER_OF_DIRTY_RECTS];
- int _num_of_dirty_rects;
-
- MouseState _oldMouseState, _curMouseState;
- byte *_ms_buf;
- bool _mouse_visible;
- bool _mouse_state_changed;
- byte _mouseKeycolor;
-
- uint32 _timer_duration, _timer_next_expiry;
- bool _timer_active;
- int (*_timer_callback) (int);
-};
-
-typedef struct {
- OSystem::SoundProc sound_proc;
- void *param;
-} THREAD_PARAM;