diff options
Diffstat (limited to 'backends/platform')
35 files changed, 361 insertions, 352 deletions
diff --git a/backends/platform/PalmOS/Src/be_os5.cpp b/backends/platform/PalmOS/Src/be_os5.cpp index aa578dad9c..91e9818c02 100644 --- a/backends/platform/PalmOS/Src/be_os5.cpp +++ b/backends/platform/PalmOS/Src/be_os5.cpp @@ -115,6 +115,10 @@ void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) { } void OSystem_PalmOS5::setWindowCaption(const char *caption) { +FIXME/TODO: Convert caption from ISO Latin 1 to "right" encoding ? +If the output encoding is unclear or conversion impossible, +then one could just skip over any chars > 0x7F and display the rest + Err e; Char buf[64]; Coord w, y, h = FntLineHeight() + 2; diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 0ccd69593e..f86a2c6065 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -232,5 +232,5 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys extern int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, byte &shiftFlags, Interactive *inter = NULL); -extern bool selectGame(char *&, char *&, class Icon &); +extern bool selectGame(char *&, char *&, Common::Language &, Common::Platform &, class Icon &); diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 7a0f71ad1a..795504d243 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -234,8 +234,10 @@ int main() int DCLauncherDialog::runModal() { char *base = NULL, *dir = NULL; + Common::Language language = Common::UNK_LANG; + Common::Platform platform = Common::kPlatformUnknown; - if (!selectGame(base, dir, icon)) + if (!selectGame(base, dir, language, platform, icon)) g_system->quit(); // Set the game path. @@ -243,6 +245,14 @@ int DCLauncherDialog::runModal() if (dir != NULL) ConfMan.set("path", dir, base); + // Set the game language. + if (language != Common::UNK_LANG) + ConfMan.set("language", Common::getLanguageCode(language), base); + + // Set the game platform. + if (platform != Common::kPlatformUnknown) + ConfMan.set("platform", Common::getPlatformCode(platform), base); + // Set the target. ConfMan.setActiveDomain(base); diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 9465769ea3..e2998234c3 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -138,6 +138,8 @@ struct Game char dir[256]; char filename_base[256]; char text[256]; + Common::Language language; + Common::Platform platform; Icon icon; Label label; }; @@ -183,11 +185,15 @@ static void makeDefIcon(Icon &icon) icon.load(scummvm_icon, sizeof(scummvm_icon)); } -static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt) +static bool uniqueGame(const char *base, const char *dir, + Common::Language lang, Common::Platform plf, + Game *games, int cnt) { while (cnt--) if (!strcmp(dir, games->dir) && - !stricmp(base, games->filename_base)) + !stricmp(base, games->filename_base) && + lang == games->language && + plf == games->platform) return false; else games++; @@ -227,14 +233,20 @@ static int findGames(Game *games, int max) if (curr_game < max) { strcpy(games[curr_game].filename_base, ge->gameid().c_str()); strcpy(games[curr_game].dir, dirs[curr_dir-1].name); + games[curr_game].language = ge->language(); + games[curr_game].platform = ge->platform(); if (uniqueGame(games[curr_game].filename_base, - games[curr_game].dir, games, curr_game)) { + games[curr_game].dir, + games[curr_game].language, + games[curr_game].platform, games, curr_game)) { strcpy(games[curr_game].text, ge->description().c_str()); #if 0 - printf("Registered game <%s> in <%s> <%s> because of <%s> <*>\n", - games[curr_game].text, games[curr_game].dir, - games[curr_game].filename_base, + printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n", + games[curr_game].text, + (int)games[curr_game].language, + (int)games[curr_game].platform, + games[curr_game].dir, games[curr_game].filename_base, dirs[curr_dir-1].name); #endif curr_game++; @@ -405,7 +417,7 @@ int gameMenu(Game *games, int num_games) } } -bool selectGame(char *&ret, char *&dir_ret, Icon &icon) +bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon) { Game *games = new Game[MAX_GAMES]; int selected, num_games; @@ -449,6 +461,8 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon) dir_ret = the_game.dir; #endif ret = the_game.filename_base; + lang_ret = the_game.language; + plf_ret = the_game.platform; icon = the_game.icon; return true; } else diff --git a/backends/platform/ds/arm7/Makefile b/backends/platform/ds/arm7/Makefile index 82637845db..a8dc0efe6e 100644 --- a/backends/platform/ds/arm7/Makefile +++ b/backends/platform/ds/arm7/Makefile @@ -151,13 +151,12 @@ $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.bin: %.elf @echo built ... $(notdir $@) - @$(OBJCOPY) -O binary $(TARGET).elf $@ + $(OBJCOPY) -O binary $(TARGET).elf $@ #--------------------------------------------------------------------------------- %.elf: echo ELF - @echo $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf - @$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf + $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index 0e8dd9efeb..7029d96405 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -585,7 +585,7 @@ int main(int argc, char ** argv) { //enable sound // powerOn(POWER_SOUND); - REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(0x7F); + SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); IPC->soundData = 0; IPC->reset = false; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index e35e5edea0..954a33b61d 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -642,12 +642,6 @@ void OSystem_DS::quit() { swiSoftReset();*/ } -void OSystem_DS::setWindowCaption(const char *caption) { -} - -void OSystem_DS::displayMessageOnOSD(const char *msg) { -} - Common::SaveFileManager* OSystem_DS::getSavefileManager() { bool forceSram; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 5a26a25c8b..3db23a5687 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -134,10 +134,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - - virtual void displayMessageOnOSD(const char *msg); - virtual Common::SaveFileManager *getSavefileManager(); void addEvent(Common::Event& e); diff --git a/backends/platform/gp2x/build/bundle.sh b/backends/platform/gp2x/build/bundle.sh index 8d48dcfb06..560f096ed4 100755 --- a/backends/platform/gp2x/build/bundle.sh +++ b/backends/platform/gp2x/build/bundle.sh @@ -12,6 +12,7 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib echo Collecting files. mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`" mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/saves" +mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/plugins" mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/engine-data" echo "Please put your save games in this dir" >> "scummvm-gp2x-`date '+%Y-%m-%d'`/saves/PUT_SAVES_IN_THIS_DIR" @@ -28,8 +29,10 @@ cp ../../../../COPYING ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../COPYRIGHT ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../NEWS ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../gui/themes/scummmodern.zip ./scummvm-gp2x-`date '+%Y-%m-%d'`/ +cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../dists/pred.dic ./scummvm-gp2x-`date '+%Y-%m-%d'`/ cp ../../../../dists/engine-data/* ./scummvm-gp2x-`date '+%Y-%m-%d'`/engine-data +cp ../../../../plugins/* ./scummvm-gp2x-`date '+%Y-%m-%d'`/plugins echo Making Stripped GPE. arm-open2x-linux-strip ./scummvm-gp2x-`date '+%Y-%m-%d'`/scummvm.gp2x diff --git a/backends/platform/gp2x/build/config-alleng.sh b/backends/platform/gp2x/build/config-alleng.sh new file mode 100755 index 0000000000..5724f39dc5 --- /dev/null +++ b/backends/platform/gp2x/build/config-alleng.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo Quick script to make running configure all the time less painful +echo and let all the build work be done from the backend/build folder. + +# Set the paths up here to generate the config. + +PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH +PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH + +# Export the tool names for cross-compiling +export CXX=arm-open2x-linux-g++ +export CXXFLAGS=-march=armv4t +export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include +export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib +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-all-engines --enable-vkeybd +# --enable-plugins --default-dynamic + +echo Generating config for GP2X complete. Check for errors. diff --git a/backends/platform/gp2x/build/config.sh b/backends/platform/gp2x/build/config.sh index 17083d1ea4..55954d6231 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-made --enable-m4 -#--enable-plugins --default-dynamic +./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-vkeybd +# --enable-plugins --default-dynamic echo Generating config for GP2X complete. Check for errors. diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index 1c0fb398db..9a9a59765d 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -38,33 +38,33 @@ // we should really allow users to map any key to a joystick button #define JOY_DEADZONE 2200 -// #define JOY_INVERT_Y #define JOY_XAXIS 0 #define JOY_YAXIS 1 -// GP2X Stick Buttons (Note: The Stick is read as a set of buttons not a HAT type of setup). -#define JOY_BUT_LMOUSE 0x0D -#define JOY_BUT_RMOUSE 0x0E - -#define JOY_BUT_RETURN 0x08 -#define JOY_BUT_ESCAPE 0x09 -#define JOY_BUT_F5 0x0B -#define JOY_BUT_SPACE 0x0F -#define JOY_BUT_TALKUP 0x10 -#define JOY_BUT_TALKDN 0x11 -#define JOY_BUT_ZERO 0x12 - -#define JOY_BUT_COMB 0x0A -#define JOY_BUT_EXIT 0x12 -#define JOY_BUT_PERIOD 0x0C - - -//TODO: Quick hack 101 ;-) Clean this up, -#define TRUE 1 -#define FALSE 0 - -static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) -{ +/* GP2X Wiz: Main Joystick Mappings */ +enum { + GP2X_BUTTON_UP = 0, + GP2X_BUTTON_UPLEFT = 1, + GP2X_BUTTON_LEFT = 2, + GP2X_BUTTON_DOWNLEFT = 3, + GP2X_BUTTON_DOWN = 4, + GP2X_BUTTON_DOWNRIGHT = 5, + GP2X_BUTTON_RIGHT = 6, + GP2X_BUTTON_UPRIGHT = 7, + GP2X_BUTTON_START = 8, + GP2X_BUTTON_SELECT = 9, + GP2X_BUTTON_L = 10, + GP2X_BUTTON_R = 11, + GP2X_BUTTON_A = 12, + GP2X_BUTTON_B = 13, + GP2X_BUTTON_X = 14, + GP2X_BUTTON_Y = 15, + GP2X_BUTTON_VOLUP = 16, + GP2X_BUTTON_VOLDOWN = 17, + GP2X_BUTTON_CLICK = 18 +}; + +static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) { if (key >= SDLK_F1 && key <= SDLK_F9) { return key - SDLK_F1 + Common::ASCII_F1; } else if (key >= SDLK_KP0 && key <= SDLK_KP9) { @@ -197,10 +197,9 @@ void OSystem_GP2X::moveStick() { if (_km.x_down_count!=2){ _km.x_vel = 1; _km.x_down_count = 1; - }else + } else _km.x_vel = 4; - } - else{ + } else { _km.x_vel = 0; _km.x_down_count = 0; } @@ -216,36 +215,16 @@ void OSystem_GP2X::moveStick() { if (_km.y_down_count!=2){ _km.y_vel = 1; _km.y_down_count = 1; - }else + } else _km.y_vel = 4; - } - else{ + } else { _km.y_vel = 0; _km.y_down_count = 0; } } - //Quick default button states for modifier. - - //int GP2X_BUTTON_STATE_UP = FALSE; - //int GP2X_BUTTON_STATE_DOWN = FALSE; - //int GP2X_BUTTON_STATE_LEFT = FALSE; - //int GP2X_BUTTON_STATE_RIGHT = FALSE; - //int GP2X_BUTTON_STATE_UPLEFT = FALSE; - //int GP2X_BUTTON_STATE_UPRIGHT = FALSE; - //int GP2X_BUTTON_STATE_DOWNLEFT = FALSE; - //int GP2X_BUTTON_STATE_DOWNRIGHT = FALSE; - //int GP2X_BUTTON_STATE_CLICK = FALSE; - //int GP2X_BUTTON_STATE_A = FALSE; - //int GP2X_BUTTON_STATE_B = FALSE; - //int GP2X_BUTTON_STATE_Y = FALSE; - //int GP2X_BUTTON_STATE_X = FALSE; - int GP2X_BUTTON_STATE_L = FALSE; - //int GP2X_BUTTON_STATE_R = FALSE; - //int GP2X_BUTTON_STATE_START = FALSE; - //int GP2X_BUTTON_STATE_SELECT = FALSE; - //int GP2X_BUTTON_STATE_VOLUP = FALSE; - //int GP2X_BUTTON_STATE_VOLDOWN = FALSE; +/* Quick default button states for modifiers. */ +int GP2X_BUTTON_STATE_L = false; bool OSystem_GP2X::pollEvent(Common::Event &event) { SDL_Event ev; @@ -273,8 +252,6 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { GP2X_BUTTON_LEFT Cursor Left GP2X_BUTTON_RIGHT Cursor Right - TODO: Add extra directions to cursor mappings. - GP2X_BUTTON_UPLEFT Cursor Up Left GP2X_BUTTON_UPRIGHT Cursor Up Right GP2X_BUTTON_DOWNLEFT Cursor Down Left @@ -288,8 +265,8 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { GP2X_BUTTON_Y Space Bar GP2X_BUTTON_X Right Mouse Click GP2X_BUTTON_L Combo Modifier (Left Trigger) - GP2X_BUTTON_R F5 (Right Trigger) - GP2X_BUTTON_START Return + GP2X_BUTTON_R Return (Right Trigger) + GP2X_BUTTON_START F5 (Game Menu) GP2X_BUTTON_SELECT Escape GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down @@ -299,6 +276,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed) GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis. + GP2X_BUTTON_L & GP2X_BUTTON_START Common::EVENT_MAINMENU (ScummVM Global Main Menu) GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games) */ @@ -357,6 +335,10 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { else if (ev.button.button == SDL_BUTTON_WHEELDOWN) event.type = Common::EVENT_WHEELDOWN; #endif +#if defined(SDL_BUTTON_MIDDLE) + else if (ev.button.button == SDL_BUTTON_MIDDLE) + event.type = Common::EVENT_MBUTTONDOWN; +#endif else break; @@ -369,6 +351,10 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { event.type = Common::EVENT_LBUTTONUP; else if (ev.button.button == SDL_BUTTON_RIGHT) event.type = Common::EVENT_RBUTTONUP; +#if defined(SDL_BUTTON_MIDDLE) + else if (ev.button.button == SDL_BUTTON_MIDDLE) + event.type = Common::EVENT_MBUTTONUP; +#endif else break; fillMouseEvent(event, ev.button.x, ev.button.y); @@ -379,16 +365,16 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { case SDL_JOYBUTTONDOWN: _stickBtn[ev.jbutton.button] = 1; - if (ev.jbutton.button == JOY_BUT_LMOUSE) { + if (ev.jbutton.button == GP2X_BUTTON_B) { event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button == GP2X_BUTTON_CLICK) { event.type = Common::EVENT_LBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); - } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { + } else if (ev.jbutton.button == GP2X_BUTTON_X) { event.type = Common::EVENT_RBUTTONDOWN; fillMouseEvent(event, _km.x, _km.y); - } else if (_stickBtn[JOY_BUT_COMB] && (ev.jbutton.button == JOY_BUT_EXIT)) { + } else if (_stickBtn[GP2X_BUTTON_L] && (ev.jbutton.button == GP2X_BUTTON_SELECT)) { event.type = Common::EVENT_QUIT; } else if (ev.jbutton.button < 8) { moveStick(); @@ -399,19 +385,24 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { event.kbd.flags = 0; switch (ev.jbutton.button) { case GP2X_BUTTON_L: - GP2X_BUTTON_STATE_L = TRUE; + GP2X_BUTTON_STATE_L = true; break; case GP2X_BUTTON_R: - if (GP2X_BUTTON_STATE_L == TRUE) { + if (GP2X_BUTTON_STATE_L == true) { +#ifdef ENABLE_VKEYBD + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0); +#else event.kbd.keycode = Common::KEYCODE_0; event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0); +#endif } else { - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.kbd.keycode = Common::KEYCODE_RETURN; + event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); } break; case GP2X_BUTTON_SELECT: - if (GP2X_BUTTON_STATE_L == TRUE) { + if (GP2X_BUTTON_STATE_L == true) { event.type = Common::EVENT_QUIT; } else { event.kbd.keycode = Common::KEYCODE_ESCAPE; @@ -419,7 +410,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { } break; case GP2X_BUTTON_A: - if (GP2X_BUTTON_STATE_L == TRUE) { + if (GP2X_BUTTON_STATE_L == true) { event.type = Common::EVENT_PREDICTIVE_DIALOG; } else { event.kbd.keycode = Common::KEYCODE_PERIOD; @@ -427,39 +418,21 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { } break; case GP2X_BUTTON_Y: - if (GP2X_BUTTON_STATE_L == TRUE) { + if (GP2X_BUTTON_STATE_L == true) { setZoomOnMouse(); } else { event.kbd.keycode = Common::KEYCODE_SPACE; event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); } break; - case JOY_BUT_RETURN: - event.kbd.keycode = Common::KEYCODE_RETURN; - event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); - break; - case JOY_BUT_ZERO: - event.kbd.keycode = Common::KEYCODE_0; - event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0); + case GP2X_BUTTON_START: + if (GP2X_BUTTON_STATE_L == true) { + event.type = Common::EVENT_MAINMENU; + } else { + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + } break; - - //case GP2X_BUTTON_R: - // if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button == GP2X_BUTTON_R)) { - // displayMessageOnOSD("Exiting ScummVM"); - // //Sync(); - // event.type = Common::EVENT_QUIT; - // break; - // } else if ((ev.jbutton.button == GP2X_BUTTON_L) && (ev.jbutton.button != GP2X_BUTTON_R)) { - // displayMessageOnOSD("Left Trigger Pressed"); - // break; - // } else if ((ev.jbutton.button == GP2X_BUTTON_R) && (ev.jbutton.button != GP2X_BUTTON_L)) { - // event.kbd.keycode = Common::KEYCODE_F5; - // event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); - // break; - // } else { - // break; - // } - // break; case GP2X_BUTTON_VOLUP: //if (GP2X_BUTTON_STATE_L == TRUE) { // displayMessageOnOSD("Setting CPU Speed at 230MHz"); @@ -490,10 +463,13 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { case SDL_JOYBUTTONUP: _stickBtn[ev.jbutton.button] = 0; - if (ev.jbutton.button == JOY_BUT_LMOUSE) { + if (ev.jbutton.button == GP2X_BUTTON_B) { event.type = Common::EVENT_LBUTTONUP; fillMouseEvent(event, _km.x, _km.y); - } else if (ev.jbutton.button == JOY_BUT_RMOUSE) { + } else if (ev.jbutton.button == GP2X_BUTTON_CLICK) { + event.type = Common::EVENT_LBUTTONUP; + fillMouseEvent(event, _km.x, _km.y); + } else if (ev.jbutton.button == GP2X_BUTTON_X) { event.type = Common::EVENT_RBUTTONUP; fillMouseEvent(event, _km.x, _km.y); } else if (ev.jbutton.button < 8) { @@ -517,15 +493,29 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) { event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); break; case GP2X_BUTTON_START: - event.kbd.keycode = Common::KEYCODE_RETURN; - event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); + if (GP2X_BUTTON_STATE_L == true) { + event.type = Common::EVENT_MAINMENU; + } else { + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + } break; case GP2X_BUTTON_L: - GP2X_BUTTON_STATE_L = FALSE; + GP2X_BUTTON_STATE_L = false; break; case GP2X_BUTTON_R: - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + if (GP2X_BUTTON_STATE_L == true) { +#ifdef ENABLE_VKEYBD + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0); +#else + event.kbd.keycode = Common::KEYCODE_0; + event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0); +#endif + } else { + event.kbd.keycode = Common::KEYCODE_RETURN; + event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); + } break; case GP2X_BUTTON_VOLUP: break; diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h index 0427698bc4..89ad1093e4 100644 --- a/backends/platform/gp2x/gp2x-hw.h +++ b/backends/platform/gp2x/gp2x-hw.h @@ -31,29 +31,6 @@ #ifndef GP2X_HW_H #define GP2X_HW_H -//GP2X Main Joystick Mappings -//TODO: Use these more standard mappings over the custom ones. - -#define GP2X_BUTTON_UP (0) -#define GP2X_BUTTON_UPLEFT (1) -#define GP2X_BUTTON_LEFT (2) -#define GP2X_BUTTON_DOWNLEFT (3) -#define GP2X_BUTTON_DOWN (4) -#define GP2X_BUTTON_DOWNRIGHT (5) -#define GP2X_BUTTON_RIGHT (6) -#define GP2X_BUTTON_UPRIGHT (7) -#define GP2X_BUTTON_START (8) -#define GP2X_BUTTON_SELECT (9) -#define GP2X_BUTTON_L (10) -#define GP2X_BUTTON_R (11) -#define GP2X_BUTTON_A (12) -#define GP2X_BUTTON_B (13) -#define GP2X_BUTTON_X (14) -#define GP2X_BUTTON_Y (15) -#define GP2X_BUTTON_VOLUP (16) -#define GP2X_BUTTON_VOLDOWN (17) -#define GP2X_BUTTON_CLICK (18) - #define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer #define SYS_CLK_FREQ 7372800 // Clock Frequency diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp index 62c65e8f5e..15b5e19e5d 100644 --- a/backends/platform/gp2x/gp2x.cpp +++ b/backends/platform/gp2x/gp2x.cpp @@ -33,15 +33,14 @@ #include "backends/platform/gp2x/gp2x-mem.h" #include "common/archive.h" #include "common/config-manager.h" - +#include "common/debug.h" #include "common/events.h" #include "common/util.h" -#include "common/debug.h" #include "common/file.h" #include "base/main.h" -#include "backends/saves/posix/posix-saves.h" +#include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" #include "backends/plugins/posix/posix-provider.h" @@ -72,15 +71,12 @@ static Uint32 timer_handler(Uint32 interval, void *param) { } int main(int argc, char *argv[]) { - //extern OSystem *OSystem_GP2X_create(); - //g_system = OSystem_GP2X_create(); g_system = new OSystem_GP2X(); assert(g_system); - // Check if Plugins are enabled (Using the hacked up GP2X provider) - #ifdef DYNAMIC_MODULES - PluginManager::instance().addPluginProvider(new GP2XPluginProvider()); - #endif +#ifdef DYNAMIC_MODULES + PluginManager::instance().addPluginProvider(new POSIXPluginProvider()); +#endif // Invoke the actual ScummVM main entry point: int res = scummvm_main(argc, argv); @@ -115,7 +111,8 @@ void OSystem_GP2X::initBackend() { #endif char savePath[PATH_MAX+1]; - char workDirName[PATH_MAX+1]; /* To be passed to getcwd system call. */ + char workDirName[PATH_MAX+1]; + if (getcwd(workDirName, PATH_MAX) == NULL) { error("Could not obtain current working directory."); } else { @@ -133,25 +130,9 @@ void OSystem_GP2X::initBackend() { ConfMan.registerDefault("savepath", savePath); - // Setup default extra data path for engine data files to be workingdir/engine-data - - char enginedataPath[PATH_MAX+1]; - - strcpy(enginedataPath, workDirName); - strcat(enginedataPath, "/engine-data"); - printf("Current engine-data directory: %s\n", enginedataPath); - //struct stat sb; - if (stat(enginedataPath, &sb) == -1) - if (errno == ENOENT) // Create the dir if it does not exist - if (mkdir(enginedataPath, 0755) != 0) - warning("mkdir for '%s' failed", enginedataPath); - - //FIXME: Do not use File::addDefaultDirectory, rather implement OSystem::addSysArchivesToSearchSet() ! - Common::File::addDefaultDirectory(enginedataPath); - - // Note: Review and clean this, it's OTT at the moment. + _savefile = new DefaultSaveFileManager(savePath); - #if defined(DUMP_STDOUT) + #ifdef DUMP_STDOUT // The GP2X has a serial console but most users do not use this so we // output all our STDOUT and STDERR to files for debug purposes. char STDOUT_FILE[PATH_MAX+1]; @@ -168,7 +149,7 @@ void OSystem_GP2X::initBackend() { /* Redirect standard input and standard output */ FILE *newfp = freopen(STDOUT_FILE, "w", stdout); - if (newfp == NULL) { /* This happens on NT */ + if (newfp == NULL) { #if !defined(stdout) stdout = fopen(STDOUT_FILE, "w"); #else @@ -178,8 +159,9 @@ void OSystem_GP2X::initBackend() { } #endif } + newfp = freopen(STDERR_FILE, "w", stderr); - if (newfp == NULL) { /* This happens on NT */ + if (newfp == NULL) { #if !defined(stderr) stderr = fopen(STDERR_FILE, "w"); #else @@ -189,8 +171,10 @@ void OSystem_GP2X::initBackend() { } #endif } - setbuf(stderr, NULL); /* No buffering */ - #endif // DUMP_STDOUT + + setbuf(stderr, NULL); + printf("%s\n", "Debug: STDOUT and STDERR redirected to text files."); + #endif /* DUMP_STDOUT */ _graphicsMutex = createMutex(); @@ -199,7 +183,9 @@ void OSystem_GP2X::initBackend() { // Setup other defaults. ConfMan.registerDefault("aspect_ratio", true); - ConfMan.registerDefault("music_volume", 220); // Up default volume as we use a seperate volume system anyway. + + /* Up default volume values as we use a seperate system level volume anyway. */ + ConfMan.registerDefault("music_volume", 220); ConfMan.registerDefault("sfx_volume", 220); ConfMan.registerDefault("speech_volume", 220); ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time. @@ -223,12 +209,6 @@ void OSystem_GP2X::initBackend() { _joystick = SDL_JoystickOpen(joystick_num); } - // Create the savefile manager, if none exists yet (we check for this to - // allow subclasses to provide their own). - if (_savefile == 0) { - _savefile = new POSIXSaveFileManager(); - } - // Create and hook up the mixer, if none exists yet (we check for this to // allow subclasses to provide their own). if (_mixer == 0) { @@ -367,32 +347,37 @@ FilesystemFactory *OSystem_GP2X::getFilesystemFactory() { } void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { + /* Setup default extra data paths for engine data files and plugins */ + char workDirName[PATH_MAX+1]; -#ifdef DATA_PATH - // Add the global DATA_PATH to the directory search list - // FIXME: We use depth = 4 for now, to match the old code. May want to change that - Common::FSNode dataNode(DATA_PATH); - if (dataNode.exists() && dataNode.isDirectory()) { - s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority); + if (getcwd(workDirName, PATH_MAX) == NULL) { + error("Error: Could not obtain current working directory."); } -#endif -#if defined(MACOSX) || defined(IPHONE) - // Get URL of the Resource directory of the .app bundle - CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); - if (fileUrl) { - // Try to convert the URL to an absolute path - UInt8 buf[MAXPATHLEN]; - if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) { - // Success: Add it to the search path - Common::String bundlePath((const char *)buf); - s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority); - } - CFRelease(fileUrl); + Common::FSNode workdirNode(workDirName); + if (workdirNode.exists() && workdirNode.isDirectory()) { + s.add("__GP2X_WORKDIR__", new Common::FSDirectory(workDirName), priority); } -#endif + char enginedataPath[PATH_MAX+1]; + + strcpy(enginedataPath, workDirName); + strcat(enginedataPath, "/engine-data"); + + Common::FSNode engineNode(enginedataPath); + if (engineNode.exists() && engineNode.isDirectory()) { + s.add("__GP2X_ENGDATA__", new Common::FSDirectory(enginedataPath), priority); + } + + char pluginsPath[PATH_MAX+1]; + + strcpy(pluginsPath, workDirName); + strcat(pluginsPath, "/plugins"); + Common::FSNode pluginsNode(pluginsPath); + if (pluginsNode.exists() && pluginsNode.isDirectory()) { + s.add("__GP2X_PLUGINS__", new Common::FSDirectory(pluginsPath), priority); + } } static Common::String getDefaultConfigFileName() { @@ -479,6 +464,12 @@ void OSystem_GP2X::quit() { delete getEventManager(); + #ifdef DUMP_STDOUT + printf("%s\n", "Debug: STDOUT and STDERR text files closed."); + fclose(stdout); + fclose(stderr); + #endif /* DUMP_STDOUT */ + exit(0); } diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh index 1dcdb6389e..506dfcb742 100755 --- a/backends/platform/gp2xwiz/build/bundle.sh +++ b/backends/platform/gp2xwiz/build/bundle.sh @@ -22,6 +22,7 @@ cp ../../../../COPYING ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../COPYRIGHT ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../NEWS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../gui/themes/scummmodern.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins diff --git a/backends/platform/gp2xwiz/build/config-alleng.sh b/backends/platform/gp2xwiz/build/config-alleng.sh index 19ee308908..cfed463edf 100755 --- a/backends/platform/gp2xwiz/build/config-alleng.sh +++ b/backends/platform/gp2xwiz/build/config-alleng.sh @@ -17,6 +17,6 @@ export DEFINES=-DNDEBUG # Edit the configure line to suit. cd ../../../.. -./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --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-all-engines --enable-plugins --default-dynamic +./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --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-all-engines --enable-vkeybd --enable-plugins --default-dynamic echo Generating config for GP2X Wiz complete. Check for errors. diff --git a/backends/platform/gp2xwiz/build/config.sh b/backends/platform/gp2xwiz/build/config.sh index b6889fe3ac..27c1fbf0bf 100755 --- a/backends/platform/gp2xwiz/build/config.sh +++ b/backends/platform/gp2xwiz/build/config.sh @@ -17,6 +17,6 @@ export DEFINES=-DNDEBUG # Edit the configure line to suit. cd ../../../.. -./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --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 --default-dynamic +./configure --backend=gp2xwiz --disable-mt32emu --host=gp2xwiz --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-vkeybd --enable-plugins --default-dynamic echo Generating config for GP2X Wiz complete. Check for errors. diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index ea1b191213..dfb36742dc 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -30,7 +30,7 @@ #include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" #include "backends/platform/gp2xwiz/gp2xwiz-hw.h" -#include "backends/keymapper/keymapper.h" + #include "common/util.h" #include "common/events.h" @@ -41,6 +41,28 @@ #define JOY_XAXIS 0 #define JOY_YAXIS 1 +/* GP2X Wiz: Main Joystick Mappings */ +enum { + GP2X_BUTTON_UP = 0, + GP2X_BUTTON_UPLEFT = 1, + GP2X_BUTTON_LEFT = 2, + GP2X_BUTTON_DOWNLEFT = 3, + GP2X_BUTTON_DOWN = 4, + GP2X_BUTTON_DOWNRIGHT = 5, + GP2X_BUTTON_RIGHT = 6, + GP2X_BUTTON_UPRIGHT = 7, + GP2X_BUTTON_MENU = 8, + GP2X_BUTTON_SELECT = 9, + GP2X_BUTTON_L = 10, + GP2X_BUTTON_R = 11, + GP2X_BUTTON_A = 12, + GP2X_BUTTON_B = 13, + GP2X_BUTTON_X = 14, + GP2X_BUTTON_Y = 15, + GP2X_BUTTON_VOLUP = 16, + GP2X_BUTTON_VOLDOWN = 17 +}; + static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) { if (key >= SDLK_F1 && key <= SDLK_F9) { return key - SDLK_F1 + Common::ASCII_F1; @@ -173,8 +195,8 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { GP2X_BUTTON_Y Space Bar GP2X_BUTTON_X Right Mouse Click GP2X_BUTTON_L Combo Modifier (Left Trigger) - GP2X_BUTTON_R F5 (Right Trigger) - GP2X_BUTTON_MENU Return + GP2X_BUTTON_R Return (Right Trigger) + GP2X_BUTTON_MENU F5 (Game Menu) GP2X_BUTTON_SELECT Escape GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down @@ -291,8 +313,13 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { break; case GP2X_BUTTON_R: if (GP2X_BUTTON_STATE_L == true) { +#ifdef ENABLE_VKEYBD + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0); +#else event.kbd.keycode = Common::KEYCODE_0; event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0); +#endif } else { event.kbd.keycode = Common::KEYCODE_RETURN; event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); @@ -388,8 +415,13 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { break; case GP2X_BUTTON_R: if (GP2X_BUTTON_STATE_L == true) { +#ifdef ENABLE_VKEYBD + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0); +#else event.kbd.keycode = Common::KEYCODE_0; event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0); +#endif } else { event.kbd.keycode = Common::KEYCODE_RETURN; event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0); diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp index c804b0d819..4d69915e27 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp @@ -42,6 +42,16 @@ namespace WIZ_HW { +enum { + VOLUME_NOCHG = 0, + VOLUME_DOWN = 1, + VOLUME_UP = 2, + VOLUME_CHANGE_RATE = 8, + VOLUME_MIN = 0, + VOLUME_INITIAL = 70, + VOLUME_MAX = 100 +}; + int volumeLevel = VOLUME_INITIAL; void deviceInit() { diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.h b/backends/platform/gp2xwiz/gp2xwiz-hw.h index 577facc437..507841e902 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-hw.h +++ b/backends/platform/gp2xwiz/gp2xwiz-hw.h @@ -31,37 +31,8 @@ #ifndef GP2XWIZ_HW_H #define GP2XWIZ_HW_H -/* GP2X Wiz: Main Joystick Mappings */ - -#define GP2X_BUTTON_UP (0) -#define GP2X_BUTTON_UPLEFT (1) -#define GP2X_BUTTON_LEFT (2) -#define GP2X_BUTTON_DOWNLEFT (3) -#define GP2X_BUTTON_DOWN (4) -#define GP2X_BUTTON_DOWNRIGHT (5) -#define GP2X_BUTTON_RIGHT (6) -#define GP2X_BUTTON_UPRIGHT (7) -#define GP2X_BUTTON_MENU (8) -#define GP2X_BUTTON_SELECT (9) -#define GP2X_BUTTON_L (10) -#define GP2X_BUTTON_R (11) -#define GP2X_BUTTON_A (12) -#define GP2X_BUTTON_B (13) -#define GP2X_BUTTON_X (14) -#define GP2X_BUTTON_Y (15) -#define GP2X_BUTTON_VOLUP (16) -#define GP2X_BUTTON_VOLDOWN (17) - namespace WIZ_HW { -#define VOLUME_MIN 0 -#define VOLUME_INITIAL 70 /* Default volume if you call mixerMoveVolume(0) without setting the global var. */ -#define VOLUME_MAX 100 -#define VOLUME_CHANGE_RATE 8 -#define VOLUME_NOCHG 0 -#define VOLUME_DOWN 1 -#define VOLUME_UP 2 - extern int volumeLevel; extern void deviceInit(); diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 0392172aa2..61770a16c2 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -36,6 +36,9 @@ static int _textureHeight = 0; NSLock* _lock = nil; static int _needsScreenUpdate = 0; +static UITouch* _firstTouch = NULL; +static UITouch* _secondTouch = NULL; + // static long lastTick = 0; // static int frames = 0; @@ -47,14 +50,14 @@ void iPhone_updateScreen() { } void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2) { - [_lock lock]; + //[_lock lock]; int y; for (y = y1; y < y2; ++y) { memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2); } - [_lock unlock]; + //[_lock unlock]; } @@ -192,12 +195,12 @@ uint getSizeNextPOT(uint size) { glVertexPointer(2, GL_FLOAT, 0, vertices); glTexCoordPointer(2, GL_FLOAT, 0, texCoords); - [_lock lock]; + //[_lock lock]; // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases // due to the iPhone internals having to convert the whole texture back from its internal format when used. // In the future we could use several tiled textures instead. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer); - [_lock unlock]; + //[_lock unlock]; glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); @@ -280,7 +283,7 @@ uint getSizeNextPOT(uint size) { glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. - int clearCount = 3; + int clearCount = 5; while (clearCount-- > 0) { glClear(GL_COLOR_BUFFER_BIT); [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; @@ -366,7 +369,6 @@ uint getSizeNextPOT(uint size) { ]; } - - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSSet *allTouches = [event allTouches]; @@ -374,11 +376,12 @@ uint getSizeNextPOT(uint size) { switch ([allTouches count]) { case 1: { - UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; + UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; + _firstTouch = touch; [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseDown], @"type", @@ -391,11 +394,12 @@ uint getSizeNextPOT(uint size) { } case 2: { - UITouch *touch = [[allTouches allObjects] objectAtIndex:1]; + UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; + _secondTouch = touch; [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseSecondDown], @"type", @@ -413,14 +417,13 @@ uint getSizeNextPOT(uint size) { { NSSet *allTouches = [event allTouches]; - switch ([allTouches count]) { - case 1: - { - UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; + for (UITouch* touch in touches) { + if (touch == _firstTouch) { + CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseDragged], @"type", @@ -429,15 +432,13 @@ uint getSizeNextPOT(uint size) { nil ] ]; - break; - } - case 2: - { - UITouch *touch = [[allTouches allObjects] objectAtIndex:1]; + + } else if (touch == _secondTouch) { + CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseSecondDragged], @"type", @@ -446,7 +447,7 @@ uint getSizeNextPOT(uint size) { nil ] ]; - break; + } } } diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index b72e8b65d5..7f30c0caaf 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -813,22 +813,22 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, return false; } + static const int kNeededLength = 100; + static const int kMaxDeviation = 20; + int vecX = (x - _gestureStartX); int vecY = (y - _gestureStartY); - int lengthSq = vecX * vecX + vecY * vecY; - //printf("Lengthsq: %u\n", lengthSq); + + int absX = abs(vecX); + int absY = abs(vecY); + + //printf("(%d, %d)\n", vecX, vecY); - if (lengthSq > 15000) { // Long enough gesture to react upon. + if (absX >= kNeededLength || absY >= kNeededLength) { // Long enough gesture to react upon. _gestureStartX = -1; _gestureStartY = -1; - float vecLength = sqrt(lengthSq); - float vecXNorm = vecX / vecLength; - float vecYNorm = vecY / vecLength; - - //printf("Swipe vector: (%.2f, %.2f)\n", vecXNorm, vecYNorm); - - if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm > 0.75) { + if (absX < kMaxDeviation && vecY >= kNeededLength) { // Swipe down event.type = Common::EVENT_KEYDOWN; _queuedInputEvent.type = Common::EVENT_KEYUP; @@ -837,7 +837,10 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5; event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5; _needEventRestPeriod = true; - } else if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm < -0.75) { + return true; + } + + if (absX < kMaxDeviation && -vecY >= kNeededLength) { // Swipe up _mouseClickAndDragEnabled = !_mouseClickAndDragEnabled; const char *dialogMsg; @@ -849,8 +852,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, GUI::TimedMessageDialog dialog(dialogMsg, 1500); dialog.runModal(); return false; - - } else if (vecXNorm > 0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { + } + + if (absY < kMaxDeviation && vecX >= kNeededLength) { // Swipe right _touchpadModeEnabled = !_touchpadModeEnabled; const char *dialogMsg; @@ -862,7 +866,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, dialog.runModal(); return false; - } else if (vecXNorm < -0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { + } + + if (absY < kMaxDeviation && -vecX >= kNeededLength) { // Swipe left return false; } @@ -1106,16 +1112,18 @@ void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBuf outQB->mAudioDataByteSize = 4 * s_AudioQueue.frameCount; s_soundCallback(s_soundParam, (byte *)outQB->mAudioData, outQB->mAudioDataByteSize); AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL); - } else + } else { AudioQueueStop(s_AudioQueue.queue, false); + } } void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) { OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys; assert(this_); - if (this_->_mixer) + if (this_->_mixer) { this_->_mixer->mixCallback(samples, len); + } } void OSystem_IPHONE::setupMixer() { @@ -1202,9 +1210,6 @@ void OSystem_IPHONE::getTimeAndDate(struct tm &t) const { t = *localtime(&curTime); } -void OSystem_IPHONE::setWindowCaption(const char *caption) { -} - Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { assert(_savefile); return _savefile; diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index ceb2102a5f..705f89319a 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -171,8 +171,6 @@ public: virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); virtual void getTimeAndDate(struct tm &t) const; - virtual void setWindowCaption(const char *caption); - virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); virtual Common::TimerManager *getTimerManager(); diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 304b7e80eb..ca4eda9158 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -113,8 +113,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); virtual void getTimeAndDate(struct tm &t) const; @@ -308,9 +306,6 @@ bool OSystem_NULL::setSoundCallback(SoundProc proc, void *param) { void OSystem_NULL::quit() { } -void OSystem_NULL::setWindowCaption(const char *caption) { -} - Common::SaveFileManager *OSystem_NULL::getSavefileManager() { assert(_savefile); return _savefile; diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 29747c0943..ab27d93574 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -73,7 +73,6 @@ public: virtual void unlockScreen(); virtual void updateScreen(); /* TODO : check */ - virtual void fillScreen(unsigned int i) { printf("fillScreen %d\n", i); }; virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); }; /* */ diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 63ea5bc0dc..45be0a0cd3 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -635,12 +635,6 @@ void OSystem_PSP::getTimeAndDate(struct tm &t) const { t = *localtime(&curTime); } -void OSystem_PSP::setWindowCaption(const char *caption) { -} - -void OSystem_PSP::displayMessageOnOSD(const char *msg) { -} - #define PSP_CONFIG_FILE "ms0:/scummvm.ini" Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 7abba332df..34957b293c 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -140,10 +140,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - - virtual void displayMessageOnOSD(const char *msg); - virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); }; diff --git a/backends/platform/psp/psp.spec b/backends/platform/psp/psp.spec index 223bd58098..807b8f93b7 100644 --- a/backends/platform/psp/psp.spec +++ b/backends/platform/psp/psp.spec @@ -1,3 +1,3 @@ %rename lib old_lib *lib: --lg -lm -lstdc++ -lsupc++ -lg -lpsprtc -lpspaudio -lpspuser -lpsputility -lpspdebug -lc -lpspgum -lpspvfpu -lpspgu -lpspctrl -lpspge -lpspdisplay_driver -lpspdisplay -lpsphprm -lpspge_driver -lpspsdk -lpsppower -lpsppower_driver -lpspgum_vfpu -lpspkernel %(old_lib) +%(old_lib) -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lz -lstdc++ -lc -lpspdisplay -lpspgu -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpsputility -lpspsdk -lpspuser diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp index b4fc5e0777..feb2c9a9c5 100644 --- a/backends/platform/sdl/events.cpp +++ b/backends/platform/sdl/events.cpp @@ -252,6 +252,11 @@ bool OSystem_SDL::pollEvent(Common::Event &event) { } #endif + if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'u') { + event.type = Common::EVENT_MUTE; + return true; + } + // Ctrl-Alt-<key> will change the GFX mode if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 3f9b81a912..105206ec07 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -395,13 +395,20 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() { } void OSystem_SDL::setWindowCaption(const char *caption) { - Common::String cap(caption); + Common::String cap; + byte c; + + // The string caption is supposed to be in LATIN-1 encoding. + // SDL expects UTF-8. So we perform the conversion here. + while ((c = *(const byte *)caption++)) { + if (c < 0x80) + cap += c; + else { + cap += 0xC0 | (c >> 6); + cap += 0x80 | (c & 0x3F); + } + } - // Filter out any non-ASCII characters, replacing them by question marks. - // At some point, we may wish to allow LATIN 1 or UTF-8. - for (uint i = 0; i < cap.size(); ++i) - if ((byte)cap[i] > 0x7F) - cap.setChar('?', i); SDL_WM_SetCaption(cap.c_str(), cap.c_str()); } @@ -487,7 +494,7 @@ void OSystem_SDL::quit() { void OSystem_SDL::setupIcon() { int x, y, w, h, ncols, nbytes, i; unsigned int rgba[256]; - unsigned int *icon; + unsigned int *icon; sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) { diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp index c45cef32bd..995b03f200 100644 --- a/backends/platform/symbian/src/SymbianActions.cpp +++ b/backends/platform/symbian/src/SymbianActions.cpp @@ -102,8 +102,15 @@ SymbianActions::SymbianActions() } void SymbianActions::initInstanceMain(OSystem *mainSystem) { + int i; + Actions::initInstanceMain(mainSystem); + // Disable all mappings before setting main mappings again + for (i = 0; i < ACTION_LAST; i++) { + _action_enabled[i] = false; + } + // Mouse Up _action_enabled[ACTION_UP] = true; diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 452f730110..7af1cade8c 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -471,9 +471,18 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { void OSystem_SDL_Symbian::setWindowCaption(const char *caption) { OSystem_SDL::setWindowCaption(caption); +} + +void OSystem_SDL_Symbian::engineInit() { + // Check mappings for the engine just started check_mappings(); } +void OSystem_SDL_Symbian::engineDone() { + // Need to reset engine to basic state after an engine has been running + GUI::Actions::Instance()->initInstanceMain(this); +} + void OSystem_SDL_Symbian::check_mappings() { if (ConfMan.get("gameid").empty() || GUI::Actions::Instance()->initialized()) return; diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h index efca94b706..b873b503be 100644 --- a/backends/platform/symbian/src/SymbianOS.h +++ b/backends/platform/symbian/src/SymbianOS.h @@ -107,6 +107,18 @@ protected: void setWindowCaption(const char *caption); + /** + * Allows the backend to perform engine specific init. + * Called just before the engine is run. + */ + virtual void engineInit(); + + /** + * Allows the backend to perform engine specific de-init. + * Called after the engine finishes. + */ + virtual void engineDone(); + // // Used to intialized special game mappings // diff --git a/backends/platform/wii/wii.mk b/backends/platform/wii/wii.mk index 030cc997eb..f99288c4a6 100644 --- a/backends/platform/wii/wii.mk +++ b/backends/platform/wii/wii.mk @@ -1,61 +1,25 @@ -WII_ELF=scummvm.elf -WII_DOL=scummvm.dol -WII_DISTPATH=$(srcdir)/dists/wii -all: $(WII_DOL) +WII_EXE := scummvm$(EXEEXT) +WII_EXE_STRIPPED := scummvm_stripped$(EXEEXT) -$(WII_DOL): $(WII_ELF) - $(DEVKITPPC)/bin/elf2dol $< $@ +$(WII_EXE_STRIPPED): $(WII_EXE) + $(STRIP) $< -o $@ clean: wiiclean wiiclean: - $(RM) $(WII_DOL) + $(RM) $(WII_EXE_STRIPPED) -wiiload: $(WII_DOL) - $(DEVKITPPC)/bin/wiiload $(WII_DOL) -d3 +wiiload: $(WII_EXE_STRIPPED) + $(DEVKITPPC)/bin/wiiload $< -geckoupload: $(WII_DOL) - $(DEVKITPPC)/bin/geckoupload $(WII_DOL) +geckoupload: $(WII_EXE_STRIPPED) + $(DEVKITPPC)/bin/geckoupload $< wiigdb: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF) + $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_EXE) wiidebug: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF) -x $(srcdir)/backends/platform/wii/gdb.txt - -wiidist: - $(MKDIR) dist/scummvm - $(CP) $(WII_DOL) dist/scummvm/boot.dol - $(CP) $(WII_DISTPATH)/meta.xml dist/scummvm/ - $(CP) $(WII_DISTPATH)/icon.png dist/scummvm/ - $(CP) $(WII_DISTPATH)/READMII dist/scummvm/ - $(CP) $(srcdir)/AUTHORS dist/scummvm/ - $(CP) $(srcdir)/COPYING dist/scummvm/ - $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/ - $(CP) $(srcdir)/COPYRIGHT dist/scummvm/ - $(CP) $(srcdir)/NEWS dist/scummvm/ - $(CP) $(srcdir)/README dist/scummvm/ - $(CP) $(srcdir)/dists/pred.dic dist/scummvm/ - $(CP) $(DIST_FILES_THEMES) dist/scummvm/ -ifneq ($(DIST_FILES_ENGINEDATA),) - $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/ -endif - -gcdist: - $(MKDIR) dist/scummvm - $(CP) $(WII_DOL) dist/scummvm/ - $(CP) $(WII_DISTPATH)/READMII dist/scummvm/ - $(CP) $(srcdir)/AUTHORS dist/scummvm/ - $(CP) $(srcdir)/COPYING dist/scummvm/ - $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/ - $(CP) $(srcdir)/COPYRIGHT dist/scummvm/ - $(CP) $(srcdir)/NEWS dist/scummvm/ - $(CP) $(srcdir)/README dist/scummvm/ - $(CP) $(srcdir)/dists/pred.dic dist/scummvm/ - $(CP) $(DIST_FILES_THEMES) dist/scummvm/ -ifneq ($(DIST_FILES_ENGINEDATA),) - $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/ -endif - -.PHONY: wiiclean wiiload geckoupload wiigdb wiidebug wiidist gcdist + $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_EXE) -x $(srcdir)/backends/platform/wii/gdb.txt + +.PHONY: wiiclean wiiload geckoupload wiigdb wiidebug diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 344edd7143..b8261d029e 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -916,6 +916,8 @@ void OSystem_WINCE3::setWindowCaption(const char *caption) { compute_sample_rate(); setupMixer(); +FIXME: move check_mappings() etc. calls to engineInit() & engineDone() + // handle the actual event OSystem_SDL::setWindowCaption(caption); } |