From 762c569207f778b5b3efad9414a3cfe943424316 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 13 Jul 2010 08:00:22 +0000 Subject: PSP: Typos in trace.h svn-id: r50844 --- backends/platform/psp/trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h index ade8fd7214..5c0ea86e42 100644 --- a/backends/platform/psp/trace.h +++ b/backends/platform/psp/trace.h @@ -32,9 +32,9 @@ /* Choose to print to file/screen/both */ #ifdef __PSP_PRINT_TO_FILE__ - #define __PSP_PRINT__(format,...) PSPDebugTrace(false, format, ## __VA_ARGS__) + #define __PSP_PRINT__(format,...) PspDebugTrace(false, format, ## __VA_ARGS__) #elif defined __PSP_PRINT_TO_FILE_AND_SCREEN__ - #define __PSP_PRINT__(format,...) PSPDebugTrace(true, format, ## __VA_ARGS__) + #define __PSP_PRINT__(format,...) PspDebugTrace(true, format, ## __VA_ARGS__) #else /* default - print to screen */ #define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__) #endif /* PSP_PRINT_TO_FILE/SCREEN */ -- cgit v1.2.3 From bc0c3061100a87d14a75c72296124b741e713218 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 14 Jul 2010 04:33:35 +0000 Subject: If the ALSA driver hasn't been opened, closing it should do nothing. This keeps ScummVM from crashing if, for instance, someone accidentally closes the driver twice. svn-id: r50870 --- backends/midi/alsa.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index a82fffdf0d..6a1a8e88ae 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -150,10 +150,13 @@ int MidiDriver_ALSA::open() { } void MidiDriver_ALSA::close() { - _isOpen = false; - MidiDriver_MPU401::close(); - if (seq_handle) - snd_seq_close(seq_handle); + if (_isOpen) { + _isOpen = false; + MidiDriver_MPU401::close(); + if (seq_handle) + snd_seq_close(seq_handle); + } else + warning("MidiDriver_ALSA: Closing the driver before opening it"); } void MidiDriver_ALSA::send(uint32 b) { -- cgit v1.2.3 From 0b48a71c9955b39117e2eb35b3e398f5c95c008a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Jul 2010 18:41:38 +0000 Subject: Remove PalmOS port svn-id: r50964 --- backends/events/default/default-events.cpp | 4 +- backends/fs/palmos/palmos-fs-factory.cpp | 42 -- backends/fs/palmos/palmos-fs-factory.h | 49 -- backends/fs/palmos/palmos-fs.cpp | 212 ------- backends/midi/ypa1.cpp | 141 ----- backends/midi/zodiac.cpp | 161 ------ backends/module.mk | 1 - .../platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc | Bin 52995 -> 0 bytes backends/platform/PalmOS/Rsc/Starter.rsrc | 0 backends/platform/PalmOS/Rsc/StarterRsc.h | 395 ------------- backends/platform/PalmOS/Rsc/batLow.bmp | Bin 1592 -> 0 bytes backends/platform/PalmOS/Rsc/keyAlt.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/keyCommand.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/keyCtrl.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/modules.rcp | 71 --- backends/platform/PalmOS/Rsc/modulesrsc.h | 6 - backends/platform/PalmOS/Rsc/numpad.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Src/args.cpp | 106 ---- backends/platform/PalmOS/Src/args.h | 44 -- backends/platform/PalmOS/Src/base_event.cpp | 458 --------------- backends/platform/PalmOS/Src/base_gfx.cpp | 198 ------- backends/platform/PalmOS/Src/base_mouse.cpp | 101 ---- backends/platform/PalmOS/Src/be_68k.cpp | 27 - backends/platform/PalmOS/Src/be_68k.h | 27 - backends/platform/PalmOS/Src/be_base.cpp | 203 ------- backends/platform/PalmOS/Src/be_base.h | 265 --------- backends/platform/PalmOS/Src/be_os5.cpp | 169 ------ backends/platform/PalmOS/Src/be_os5.h | 189 ------- backends/platform/PalmOS/Src/be_os5ex.cpp | 103 ---- backends/platform/PalmOS/Src/be_os5ex.h | 68 --- backends/platform/PalmOS/Src/be_zodiac.cpp | 74 --- backends/platform/PalmOS/Src/be_zodiac.h | 76 --- backends/platform/PalmOS/Src/cd_aeroplayer.cpp | 166 ------ backends/platform/PalmOS/Src/cd_aeroplayer.h | 65 --- backends/platform/PalmOS/Src/cd_default.cpp | 104 ---- backends/platform/PalmOS/Src/cd_default.h | 51 -- backends/platform/PalmOS/Src/cd_msa.cpp | 261 --------- backends/platform/PalmOS/Src/cd_msa.h | 68 --- backends/platform/PalmOS/Src/cd_pockettunes.cpp | 238 -------- backends/platform/PalmOS/Src/cd_pockettunes.h | 69 --- backends/platform/PalmOS/Src/cdaudio.h | 67 --- backends/platform/PalmOS/Src/extend.cpp | 109 ---- backends/platform/PalmOS/Src/features.h | 17 - backends/platform/PalmOS/Src/globals.h | 114 ---- backends/platform/PalmOS/Src/i_zodiac.cpp | 41 -- backends/platform/PalmOS/Src/i_zodiac.h | 12 - backends/platform/PalmOS/Src/init_golcd.cpp | 121 ---- backends/platform/PalmOS/Src/init_golcd.h | 22 - backends/platform/PalmOS/Src/init_mathlib.cpp | 29 - backends/platform/PalmOS/Src/init_mathlib.h | 7 - backends/platform/PalmOS/Src/init_pa1lib.cpp | 32 -- backends/platform/PalmOS/Src/init_pa1lib.h | 22 - backends/platform/PalmOS/Src/init_palmos.cpp | 172 ------ backends/platform/PalmOS/Src/init_palmos.h | 42 -- backends/platform/PalmOS/Src/init_sony.cpp | 163 ------ backends/platform/PalmOS/Src/init_sony.h | 40 -- backends/platform/PalmOS/Src/init_stuffs.cpp | 134 ----- backends/platform/PalmOS/Src/init_stuffs.h | 11 - backends/platform/PalmOS/Src/launcher/app.cpp | 360 ------------ .../PalmOS/Src/launcher/forms/formCards.cpp | 383 ------------- .../platform/PalmOS/Src/launcher/forms/formCards.h | 33 -- .../PalmOS/Src/launcher/forms/formEditGame.cpp | 612 --------------------- .../PalmOS/Src/launcher/forms/formEditGame.h | 39 -- .../PalmOS/Src/launcher/forms/formMisc.cpp | 275 --------- .../PalmOS/Src/launcher/forms/formSelect.cpp | 278 ---------- .../PalmOS/Src/launcher/forms/formSkins.cpp | 267 --------- .../PalmOS/Src/launcher/forms/formUtil.cpp | 60 -- .../platform/PalmOS/Src/launcher/forms/formUtil.h | 23 - .../PalmOS/Src/launcher/forms/forminfo.cpp | 146 ----- .../PalmOS/Src/launcher/forms/formmain.cpp | 364 ------------ .../PalmOS/Src/launcher/forms/formmusic.cpp | 388 ------------- .../platform/PalmOS/Src/launcher/forms/forms.h | 23 - .../PalmOS/Src/launcher/forms/formtabs.cpp | 242 -------- .../platform/PalmOS/Src/launcher/forms/formtabs.h | 24 - backends/platform/PalmOS/Src/launcher/games.cpp | 548 ------------------ backends/platform/PalmOS/Src/launcher/games.h | 212 ------- backends/platform/PalmOS/Src/launcher/launch.cpp | 512 ----------------- backends/platform/PalmOS/Src/launcher/skin.cpp | 612 --------------------- backends/platform/PalmOS/Src/launcher/skin.h | 131 ----- backends/platform/PalmOS/Src/launcher/start.cpp | 367 ------------ backends/platform/PalmOS/Src/launcher/start.h | 98 ---- backends/platform/PalmOS/Src/modules.cpp | 156 ------ backends/platform/PalmOS/Src/modules.h | 22 - backends/platform/PalmOS/Src/native/oscalls.cpp | 92 ---- backends/platform/PalmOS/Src/native/oscalls.h | 58 -- backends/platform/PalmOS/Src/native/pace.h | 103 ---- backends/platform/PalmOS/Src/native/pnoARM.c | 60 -- backends/platform/PalmOS/Src/native/pnoStartup.c | 28 - backends/platform/PalmOS/Src/native/zodiacARM.cpp | 150 ----- .../platform/PalmOS/Src/native/zodiacStartup.cpp | 161 ------ backends/platform/PalmOS/Src/os5_event.cpp | 82 --- backends/platform/PalmOS/Src/os5_gfx.cpp | 309 ----------- backends/platform/PalmOS/Src/os5_mouse.cpp | 157 ------ backends/platform/PalmOS/Src/os5_overlay.cpp | 76 --- backends/platform/PalmOS/Src/os5_renderer.cpp | 118 ---- backends/platform/PalmOS/Src/os5_sound.cpp | 156 ------ backends/platform/PalmOS/Src/os5ex_sound.cpp | 43 -- backends/platform/PalmOS/Src/palmdefs.h | 21 - backends/platform/PalmOS/Src/prefixes/compile.h | 76 --- backends/platform/PalmOS/Src/prefixes/native_agi.h | 11 - .../platform/PalmOS/Src/prefixes/native_agos.h | 7 - .../platform/PalmOS/Src/prefixes/native_cine.h | 12 - .../platform/PalmOS/Src/prefixes/native_common.h | 19 - .../platform/PalmOS/Src/prefixes/native_cruise.h | 11 - .../platform/PalmOS/Src/prefixes/native_drascula.h | 7 - backends/platform/PalmOS/Src/prefixes/native_gob.h | 7 - .../platform/PalmOS/Src/prefixes/native_kyra.h | 7 - .../platform/PalmOS/Src/prefixes/native_lure.h | 11 - backends/platform/PalmOS/Src/prefixes/native_m4.h | 7 - .../platform/PalmOS/Src/prefixes/native_made.h | 7 - .../PalmOS/Src/prefixes/native_parallaction.h | 11 - .../platform/PalmOS/Src/prefixes/native_queen.h | 7 - .../platform/PalmOS/Src/prefixes/native_saga.h | 7 - .../platform/PalmOS/Src/prefixes/native_scumm.h | 12 - backends/platform/PalmOS/Src/prefixes/native_sky.h | 7 - .../platform/PalmOS/Src/prefixes/native_sword1.h | 9 - .../platform/PalmOS/Src/prefixes/native_sword2.h | 10 - .../platform/PalmOS/Src/prefixes/native_touche.h | 7 - .../platform/PalmOS/Src/prefixes/prefix_frontend.h | 9 - backends/platform/PalmOS/Src/prefixes/prefix_os5.h | 13 - .../platform/PalmOS/Src/prefixes/prefix_zodiac.h | 13 - backends/platform/PalmOS/Src/rumble.cpp | 140 ----- backends/platform/PalmOS/Src/rumble.h | 34 -- backends/platform/PalmOS/Src/snd_pa1.cpp | 113 ---- backends/platform/PalmOS/Src/stuffs.h | 32 -- backends/platform/PalmOS/Src/vibrate.h | 61 -- backends/platform/PalmOS/Src/zodiac_event.cpp | 100 ---- backends/platform/PalmOS/Src/zodiac_gfx.cpp | 309 ----------- backends/platform/PalmOS/Src/zodiac_mouse.cpp | 153 ------ backends/platform/PalmOS/Src/zodiac_overlay.cpp | 67 --- backends/platform/PalmOS/arm.bat | 3 - backends/platform/PalmOS/scummvm.mcp | Bin 1147982 -> 0 bytes 132 files changed, 1 insertion(+), 14454 deletions(-) delete mode 100644 backends/fs/palmos/palmos-fs-factory.cpp delete mode 100644 backends/fs/palmos/palmos-fs-factory.h delete mode 100644 backends/fs/palmos/palmos-fs.cpp delete mode 100644 backends/midi/ypa1.cpp delete mode 100644 backends/midi/zodiac.cpp delete mode 100644 backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc delete mode 100644 backends/platform/PalmOS/Rsc/Starter.rsrc delete mode 100644 backends/platform/PalmOS/Rsc/StarterRsc.h delete mode 100644 backends/platform/PalmOS/Rsc/batLow.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyAlt.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyCommand.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyCtrl.bmp delete mode 100644 backends/platform/PalmOS/Rsc/modules.rcp delete mode 100644 backends/platform/PalmOS/Rsc/modulesrsc.h delete mode 100644 backends/platform/PalmOS/Rsc/numpad.bmp delete mode 100644 backends/platform/PalmOS/Src/args.cpp delete mode 100644 backends/platform/PalmOS/Src/args.h delete mode 100644 backends/platform/PalmOS/Src/base_event.cpp delete mode 100644 backends/platform/PalmOS/Src/base_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/base_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/be_68k.cpp delete mode 100644 backends/platform/PalmOS/Src/be_68k.h delete mode 100644 backends/platform/PalmOS/Src/be_base.cpp delete mode 100644 backends/platform/PalmOS/Src/be_base.h delete mode 100644 backends/platform/PalmOS/Src/be_os5.cpp delete mode 100644 backends/platform/PalmOS/Src/be_os5.h delete mode 100644 backends/platform/PalmOS/Src/be_os5ex.cpp delete mode 100644 backends/platform/PalmOS/Src/be_os5ex.h delete mode 100644 backends/platform/PalmOS/Src/be_zodiac.cpp delete mode 100644 backends/platform/PalmOS/Src/be_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/cd_aeroplayer.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_aeroplayer.h delete mode 100644 backends/platform/PalmOS/Src/cd_default.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_default.h delete mode 100644 backends/platform/PalmOS/Src/cd_msa.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_msa.h delete mode 100644 backends/platform/PalmOS/Src/cd_pockettunes.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_pockettunes.h delete mode 100644 backends/platform/PalmOS/Src/cdaudio.h delete mode 100644 backends/platform/PalmOS/Src/extend.cpp delete mode 100644 backends/platform/PalmOS/Src/features.h delete mode 100644 backends/platform/PalmOS/Src/globals.h delete mode 100644 backends/platform/PalmOS/Src/i_zodiac.cpp delete mode 100644 backends/platform/PalmOS/Src/i_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/init_golcd.cpp delete mode 100644 backends/platform/PalmOS/Src/init_golcd.h delete mode 100644 backends/platform/PalmOS/Src/init_mathlib.cpp delete mode 100644 backends/platform/PalmOS/Src/init_mathlib.h delete mode 100644 backends/platform/PalmOS/Src/init_pa1lib.cpp delete mode 100644 backends/platform/PalmOS/Src/init_pa1lib.h delete mode 100644 backends/platform/PalmOS/Src/init_palmos.cpp delete mode 100644 backends/platform/PalmOS/Src/init_palmos.h delete mode 100644 backends/platform/PalmOS/Src/init_sony.cpp delete mode 100644 backends/platform/PalmOS/Src/init_sony.h delete mode 100644 backends/platform/PalmOS/Src/init_stuffs.cpp delete mode 100644 backends/platform/PalmOS/Src/init_stuffs.h delete mode 100644 backends/platform/PalmOS/Src/launcher/app.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formCards.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formCards.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formEditGame.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formUtil.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formmain.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/forms.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formtabs.h delete mode 100644 backends/platform/PalmOS/Src/launcher/games.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/games.h delete mode 100644 backends/platform/PalmOS/Src/launcher/launch.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/skin.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/skin.h delete mode 100644 backends/platform/PalmOS/Src/launcher/start.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/start.h delete mode 100644 backends/platform/PalmOS/Src/modules.cpp delete mode 100644 backends/platform/PalmOS/Src/modules.h delete mode 100644 backends/platform/PalmOS/Src/native/oscalls.cpp delete mode 100644 backends/platform/PalmOS/Src/native/oscalls.h delete mode 100644 backends/platform/PalmOS/Src/native/pace.h delete mode 100644 backends/platform/PalmOS/Src/native/pnoARM.c delete mode 100644 backends/platform/PalmOS/Src/native/pnoStartup.c delete mode 100644 backends/platform/PalmOS/Src/native/zodiacARM.cpp delete mode 100644 backends/platform/PalmOS/Src/native/zodiacStartup.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_event.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_overlay.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_renderer.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_sound.cpp delete mode 100644 backends/platform/PalmOS/Src/os5ex_sound.cpp delete mode 100644 backends/platform/PalmOS/Src/palmdefs.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/compile.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_agi.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_agos.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_cine.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_common.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_cruise.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_drascula.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_gob.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_kyra.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_lure.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_m4.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_made.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_parallaction.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_queen.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_saga.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_scumm.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sky.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sword1.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sword2.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_touche.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_frontend.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_os5.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/rumble.cpp delete mode 100644 backends/platform/PalmOS/Src/rumble.h delete mode 100644 backends/platform/PalmOS/Src/snd_pa1.cpp delete mode 100644 backends/platform/PalmOS/Src/stuffs.h delete mode 100644 backends/platform/PalmOS/Src/vibrate.h delete mode 100644 backends/platform/PalmOS/Src/zodiac_event.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_overlay.cpp delete mode 100755 backends/platform/PalmOS/arm.bat delete mode 100644 backends/platform/PalmOS/scummvm.mcp (limited to 'backends') diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 212cb130c1..0616713eab 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -95,13 +95,11 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { case Common::EVENT_KEYDOWN: _modifierState = event.kbd.flags; // init continuous event stream - // not done on PalmOS because keyboard is emulated and keyup is not generated -#if !defined(PALMOS_MODE) _currentKeyDown.ascii = event.kbd.ascii; _currentKeyDown.keycode = event.kbd.keycode; _currentKeyDown.flags = event.kbd.flags; _keyRepeatTime = time + kKeyRepeatInitialDelay; -#endif + // Global Main Menu if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) { if (g_engine && !g_engine->isPaused()) { diff --git a/backends/fs/palmos/palmos-fs-factory.cpp b/backends/fs/palmos/palmos-fs-factory.cpp deleted file mode 100644 index 97b3644205..0000000000 --- a/backends/fs/palmos/palmos-fs-factory.cpp +++ /dev/null @@ -1,42 +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$ - */ - -#if defined(PALMOS_MODE) -#include "backends/fs/palmos/palmos-fs-factory.h" -#include "backends/fs/palmos/palmos-fs.cpp" - -DECLARE_SINGLETON(PalmOSFilesystemFactory) - -AbstractFSNode *PalmOSFilesystemFactory::makeRootFileNode() const { - return new PalmOSFilesystemNode(); -} - -AbstractFSNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const { - return new PalmOSFilesystemNode(); -} - -AbstractFSNode *PalmOSFilesystemFactory::makeFileNodePath(const Common::String &path) const { - return new PalmOSFilesystemNode(path); -} -#endif diff --git a/backends/fs/palmos/palmos-fs-factory.h b/backends/fs/palmos/palmos-fs-factory.h deleted file mode 100644 index 72729c570d..0000000000 --- a/backends/fs/palmos/palmos-fs-factory.h +++ /dev/null @@ -1,49 +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$ - */ - -#ifndef PALMOS_FILESYSTEM_FACTORY_H -#define PALMOS_FILESYSTEM_FACTORY_H - -#include "common/singleton.h" -#include "backends/fs/fs-factory.h" - -/** - * Creates PalmOSFilesystemNode objects. - * - * Parts of this class are documented in the base interface class, FilesystemFactory. - */ -class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton { -public: - virtual AbstractFSNode *makeRootFileNode() const; - virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const; - -protected: - PalmOSFilesystemFactory() {}; - -private: - friend class Common::Singleton; -}; - -#endif /*PALMOS_FILESYSTEM_FACTORY_H*/ diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp deleted file mode 100644 index 4e05f75d19..0000000000 --- a/backends/fs/palmos/palmos-fs.cpp +++ /dev/null @@ -1,212 +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$ - */ - -#if defined(PALMOS_MODE) - -#include "PalmVersion.h" -#include "globals.h" - -#include "backends/fs/abstract-fs.h" -#include "backends/fs/stdiostream.h" - -/** - * Implementation of the ScummVM file system API based on PalmOS VFS API. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class PalmOSFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isValid; - bool _isPseudoRoot; // TODO: get rid of this - -public: - /** - * Creates a PalmOSFilesystemNode with the root node as path. - */ - PalmOSFilesystemNode(); - - /** - * Creates a PalmOSFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - PalmOSFilesystemNode(const Common::String &p); - - virtual bool exists() const { return _isValid; } - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const { return true; } //FIXME: this is just a stub - virtual bool isWritable() const { return true; } //FIXME: this is just a stub - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); - -private: - /** - * Adds a single PalmOSFilesystemNode to a given list. - * This method is used by getChildren() to populate the directory entries list. - * - * @param list List to put the file entry node in. - * @param mode Mode to use while adding the file entry to the list. - * @param base Common::String with the directory being listed. - * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. - */ - static void addFile(AbstractFSList &list, ListMode mode, const Char *base, FileInfoType* find_data); -}; - -void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, FileInfoType* find_data) { - PalmOSFilesystemNode entry; - bool isDir; - - isDir = (find_data->attributes & vfsFileAttrDirectory); - - if ((!isDir && mode == Common::FSNode::kListDirectoriesOnly) || - (isDir && mode == Common::FSNode::kListFilesOnly)) - return; - - entry._isDirectory = isDir; - entry._displayName = find_data->nameP; - entry._path = base; - entry._path += find_data->nameP; - - if (entry._isDirectory) - entry._path += "/"; - - entry._isValid = true; - entry._isPseudoRoot = false; - - list.push_back(new PalmOSFilesystemNode(entry)); -} - -PalmOSFilesystemNode::PalmOSFilesystemNode() { - _isDirectory = true; - _displayName = "Root"; - _isValid = true; - _path = "/"; - _isPseudoRoot = false; -} - -PalmOSFilesystemNode::PalmOSFilesystemNode(const Common::String &p) { - assert(p.size() > 0); - - _path = p; - _displayName = lastPathComponent(_path, '/'); - - UInt32 attr; - FileRef handle; - Err error = VFSFileOpen(gVars->VFS.volRefNum, _path.c_str(), vfsModeRead, &handle); - if (!error) { - error = VFSFileGetAttributes(handle, &attr); - VFSFileClose(handle); - } - - if (error) { - _isValid = false; - _isDirectory = false; - - } else { - _isValid = true; - _isDirectory = (attr & vfsFileAttrDirectory); - } - - _isPseudoRoot = false; -} - -AbstractFSNode *PalmOSFilesystemNode::getChild(const Common::String &n) const { - // FIXME: Pretty lame implementation! We do no error checking to speak - // of, do not check if this is a special node, etc. - assert(_isDirectory); - - Common::String newPath(_path); - if (_path.lastChar() != '/') - newPath += '/'; - newPath += n; - - return new PalmOSFilesystemNode(newPath); -} - -bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { - assert(_isDirectory); - - //TODO: honor the hidden flag - - Err error; - Char nameP[256]; - FileInfoType desc; - FileRef handle; - UInt32 dirIterator = expIteratorStart; - - desc.nameP = nameP; - desc.nameBufLen = 256; - - error = VFSFileOpen(gVars->VFS.volRefNum, _path.c_str(), vfsModeRead, &handle); - if (error) - return false; - - while (dirIterator != expIteratorStop) { - error = VFSDirEntryEnumerate(handle, &dirIterator, &desc); - if (!error) - addFile(myList, mode, _path.c_str(), &desc); - } - - VFSFileClose(handle); - return true; -} - -AbstractFSNode *PalmOSFilesystemNode::getParent() const { - PalmOSFilesystemNode *p = 0; - - if (!_isPseudoRoot) { - const char *start = _path.c_str(); - const char *end = lastPathComponent(_path, '/'); - - p = new PalmOSFilesystemNode(); - p->_path = Common::String(start, end - start); - p->_isValid = true; - p->_isDirectory = true; - p->_displayName = lastPathComponent(p->_path, '/'); - p->_isPseudoRoot =(p->_path == "/"); - } - - return p; -} - -Common::SeekableReadStream *PalmOSFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); -} - -Common::WriteStream *PalmOSFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); -} - -#endif // PALMOS_MODE diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp deleted file mode 100644 index fb114d625c..0000000000 --- a/backends/midi/ypa1.cpp +++ /dev/null @@ -1,141 +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$ - */ - -#include "common/util.h" -#include "sound/musicplugin.h" -#include "sound/mpu401.h" - -#include "Pa1Lib.h" - -class MidiDriver_YamahaPa1:public MidiDriver_MPU401 { -public: - MidiDriver_YamahaPa1(); - int open(); - void close(); - void send(uint32 b); - -private: - UInt8 _midiHandle; - Boolean _isOpen; - }; - -MidiDriver_YamahaPa1::MidiDriver_YamahaPa1() { - _isOpen = false; - _midiHandle = 0; -} - -int MidiDriver_YamahaPa1::open() { - if (!(_isOpen = Pa1Lib_midiOpen(NULL, &_midiHandle))) - return MERR_DEVICE_NOT_AVAILABLE; - - return 0; -} - -void MidiDriver_YamahaPa1::close() { - if (_isOpen) { - _isOpen = false; - MidiDriver_MPU401::close(); - for (UInt8 channel = 0; channel < 16; channel++) { - Pa1Lib_midiControlChange(_midiHandle, channel, 120,0); // all sound off - Pa1Lib_midiControlChange(_midiHandle, channel, 121,0); // reset all controller - Pa1Lib_midiControlChange(_midiHandle, channel, 123, 0); // all notes off - } - Pa1Lib_midiClose(_midiHandle); - } -} - -void MidiDriver_YamahaPa1::send(uint32 b) { - if (!_isOpen) - return; - - UInt8 midiCmd[4]; - UInt8 chanID,mdCmd; - - midiCmd[3] = (b & 0xFF000000) >> 24; - midiCmd[2] = (b & 0x00FF0000) >> 16; - midiCmd[1] = (b & 0x0000FF00) >> 8; - midiCmd[0] = (b & 0x000000FF); - - chanID = (midiCmd[0] & 0x0F) ; - mdCmd = midiCmd[0] & 0xF0; - - switch (mdCmd) { - case 0x80: // note off - Pa1Lib_midiNoteOff(_midiHandle, chanID, midiCmd[1], 0); - break; - - case 0x90: // note on - Pa1Lib_midiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xB0: // control change - Pa1Lib_midiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xC0: // progam change - Pa1Lib_midiProgramChange(_midiHandle, chanID, midiCmd[1]); - break; - - case 0xE0: // pitchBend - Pa1Lib_midiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8))); - break; - } -} - - -// Plugin interface - -class YamahaPa1MusicPlugin : public MusicPluginObject { -public: - const char *getName() const { - return "Yamaha Pa1"; - } - - const char *getId() const { - return "ypa1"; - } - - MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; -}; - -MusicDevices YamahaPa1MusicPlugin::getDevices() const { - MusicDevices devices; - // TODO: Return a different music type depending on the configuration - // TODO: List the available devices - devices.push_back(MusicDevice(this, "", MT_GM)); - return devices; -} - -Common::Error YamahaPa1MusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_YamahaPa1(); - - return Common::kNoError; -} - -//#if PLUGIN_ENABLED_DYNAMIC(YPA1) - //REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin); -//#else - REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin); -//#endif diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp deleted file mode 100644 index e848315ca4..0000000000 --- a/backends/midi/zodiac.cpp +++ /dev/null @@ -1,161 +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$ - */ - -#include "common/util.h" -#include "sound/musicplugin.h" -#include "sound/mpu401.h" - -#ifndef DISABLE_TAPWAVE - -#include - - -class MidiDriver_Zodiac:public MidiDriver_MPU401 { -public: - MidiDriver_Zodiac(); - int open(); - void close(); - void send(uint32 b); - void sysEx(const byte *msg, uint16 length); - -private: - TwMidiHandle _midiHandle; - Boolean _isOpen; - Int32 _oldVol; - }; - -MidiDriver_Zodiac::MidiDriver_Zodiac() { - _isOpen = false; - _midiHandle = 0; -} - -int MidiDriver_Zodiac::open() { - Err e; - - if (e = TwMidiOpen(&_midiHandle)) - return MERR_DEVICE_NOT_AVAILABLE; - - TwMidiGetMasterVolume(&_oldVol); - TwMidiSetMasterVolume(twMidiMaxVolume); // TODO : set volume based on gVars - - _isOpen = true; - return 0; -} - -void MidiDriver_Zodiac::close() { - if (_isOpen) { - _isOpen = false; - MidiDriver_MPU401::close(); - - TwMidiSetMasterVolume(_oldVol); - TwMidiClose(_midiHandle); - } -} - -void MidiDriver_Zodiac::send(uint32 b) { - if (!_isOpen) - return; - - UInt8 midiCmd[4]; - UInt8 chanID,mdCmd; - - midiCmd[3] = (b & 0xFF000000) >> 24; - midiCmd[2] = (b & 0x00FF0000) >> 16; - midiCmd[1] = (b & 0x0000FF00) >> 8; - midiCmd[0] = (b & 0x000000FF); - - chanID = (midiCmd[0] & 0x0F) ; - mdCmd = midiCmd[0] & 0xF0; - - switch (mdCmd) { - case 0x80: // note off - TwMidiNoteOff(_midiHandle, chanID, midiCmd[1], 0); - break; - - case 0x90: // note on - TwMidiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xB0: // control change - TwMidiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xC0: // progam change - TwMidiProgramChange(_midiHandle, chanID, midiCmd[1]); - break; - - case 0xE0: // pitchBend - TwMidiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8))); - break; - } -} - -void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) { - unsigned char buf[266]; - - buf[0] = 0xF0; - memcpy(buf + 1, msg, length); - buf[length + 1] = 0xF7; - - TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2); -} - - -// Plugin interface - -class ZodiacMusicPlugin : public MusicPluginObject { -public: - const char *getName() const { - return "Tapwave Zodiac"; - } - - const char *getId() const { - return "zodiac"; - } - - MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; -}; - -MusicDevices ZodiacMusicPlugin::getDevices() const { - MusicDevices devices; - // TODO: Return a different music type depending on the configuration - // TODO: List the available devices - devices.push_back(MusicDevice(this, "", MT_GM)); - return devices; -} - -Common::Error ZodiacMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_Zodiac(); - - return Common::kNoError; -} - -//#if PLUGIN_ENABLED_DYNAMIC(ZODIAC) - //REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin); -//#else - REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin); -//#endif - -#endif diff --git a/backends/module.mk b/backends/module.mk index 59df56b468..fb48f3d249 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -7,7 +7,6 @@ MODULE_OBJS := \ fs/stdiostream.o \ fs/amigaos4/amigaos4-fs-factory.o \ fs/ds/ds-fs-factory.o \ - fs/palmos/palmos-fs-factory.o \ fs/posix/posix-fs-factory.o \ fs/ps2/ps2-fs-factory.o \ fs/psp/psp-fs-factory.o \ diff --git a/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc b/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc deleted file mode 100644 index 70f74412e7..0000000000 Binary files a/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/Starter.rsrc b/backends/platform/PalmOS/Rsc/Starter.rsrc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/backends/platform/PalmOS/Rsc/StarterRsc.h b/backends/platform/PalmOS/Rsc/StarterRsc.h deleted file mode 100644 index fba46b310b..0000000000 --- a/backends/platform/PalmOS/Rsc/StarterRsc.h +++ /dev/null @@ -1,395 +0,0 @@ -#ifndef STARTERRSC_H -#define STARTERRSC_H - -// Header generated by Constructor for Palm OS (R) 1.9.1 -// -// Generated at 12:00:06 on samedi 25 août 2007 -// -// Generated for file: Starter.rsrc -// -// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE -// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST -// -// Palm App Name: "ScummVM" -// -// Palm App Version: "1.0" - - -// Resource: tFRM 1000 -#define MainForm 1000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) -#define MainCardsButton 1003 //(Left Origin = 135, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 0, Font = Standard) -#define MainAboutButton 1012 //(Left Origin = 148, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Standard) -#define MainMSBitMap 1100 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1100, Usable = 0) -#define MainMSNoneBitMap 1110 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1110, Usable = 0) -#define MainUnnamed1010BitMap 2000 //(Left Origin = 148, Top Origin = 1, Bitmap Resource ID = 2000, Usable = 1) - -// Resource: tFRM 1200 -#define SkinsForm 1200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1203) -#define SkinsOKButton 1202 //(Left Origin = 5, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsCancelButton 1203 //(Left Origin = 43, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsDeleteButton 1205 //(Left Origin = 119, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsBeamButton 1206 //(Left Origin = 81, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsSoundClickCheckbox 1204 //(Left Origin = 5, Top Origin = 118, Width = 93, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define SkinsSkinList 1201 //(Left Origin = 5, Top Origin = 17, Width = 146, Usable = 1, Font = Standard, Visible Items = 9) - -// Resource: tFRM 1500 -#define CardSlotForm 1500 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define CardSlotOkButton 1510 //(Left Origin = 3, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define CardSlotCancelButton 1511 //(Left Origin = 44, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2700 -#define MiscForm 2700 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define MiscOKButton 2710 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define MiscCancelButton 2711 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2000 -#define ConvertForm 2000 //(Left Origin = 34, Top Origin = 64, Width = 91, Height = 32, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define ConvertUnnamed2001Label 2001 //(Left Origin = 7, Top Origin = 4, Usable = 1, Font = Standard) -#define ConvertUnnamed2002Label 2002 //(Left Origin = 16, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 2100 -#define BeamForm 2100 //(Left Origin = 2, Top Origin = 72, Width = 156, Height = 86, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define BeamSendButton 2105 //(Left Origin = 5, Top Origin = 69, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define BeamCancelButton 2106 //(Left Origin = 47, Top Origin = 69, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define BeamMathlibCheckbox 2101 //(Left Origin = 4, Top Origin = 28, Width = 55, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamGamesCheckbox 2103 //(Left Origin = 4, Top Origin = 40, Width = 86, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamSkinCheckbox 2104 //(Left Origin = 4, Top Origin = 52, Width = 84, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamUnnamed2102Label 2102 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 2200 -#define MusicForm 2200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define MusicOKButton 2210 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define MusicCancelButton 2211 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2300 -#define TabMusicForm 2300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMusicMusicCheckbox 2301 //(Left Origin = 4, Top Origin = 12, Width = 100, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define TabMusicMultiMidiCheckbox 2308 //(Left Origin = 4, Top Origin = 24, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMusicTempoField 2302 //(Left Origin = 54, Top Origin = 36, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMusicTitleLabel 2303 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMusicUnnamed2304Label 2304 //(Left Origin = 21, Top Origin = 48, Usable = 1, Font = Standard) -#define TabMusicUnnamed2305Label 2305 //(Left Origin = 16, Top Origin = 60, Usable = 1, Font = Standard) -#define TabMusicUnnamed2306Label 2306 //(Left Origin = 18, Top Origin = 36, Usable = 1, Font = Standard) -#define TabMusicUnnamed2307Label 2307 //(Left Origin = 72, Top Origin = 36, Usable = 1, Font = Standard) -#define TabMusicUnnamed2309Label 2309 //(Left Origin = 28, Top Origin = 72, Usable = 1, Font = Standard) -#define TabMusicRateList 2311 //(Left Origin = 54, Top Origin = 73, Width = 55, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMusicQualityList 2313 //(Left Origin = 54, Top Origin = 60, Width = 60, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMusicDriverList 2331 //(Left Origin = 54, Top Origin = 24, Width = 65, Usable = 0, Font = Standard, Visible Items = 4) -#define TabMusicRatePopTrigger 2310 //(Left Origin = 54, Top Origin = 72, Width = 55, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2311) -#define TabMusicQualityPopTrigger 2312 //(Left Origin = 54, Top Origin = 60, Width = 50, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2313) -#define TabMusicDriverPopTrigger 2330 //(Left Origin = 54, Top Origin = 48, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2331) - -// Resource: tFRM 2500 -#define TabAudioCDForm 2500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 110, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabAudioCDMP3Checkbox 2502 //(Left Origin = 4, Top Origin = 12, Width = 125, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabAudioCDLengthSecsField 2504 //(Left Origin = 112, Top Origin = 60, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabAudioCDFirstTrackField 2507 //(Left Origin = 112, Top Origin = 50, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 80, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabAudioCDUnnamed2501Label 2501 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabAudioCDUnnamed2503Label 2503 //(Left Origin = 20, Top Origin = 60, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2505Label 2505 //(Left Origin = 130, Top Origin = 61, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2506Label 2506 //(Left Origin = 21, Top Origin = 48, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2508Label 2508 //(Left Origin = 25, Top Origin = 24, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2511Label 2511 //(Left Origin = 21, Top Origin = 36, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2514Label 2514 //(Left Origin = 4, Top Origin = 80, Usable = 1, Font = Standard) -#define TabAudioCDDriverList 2510 //(Left Origin = 58, Top Origin = 24, Width = 90, Usable = 0, Font = Standard, Visible Items = 4) -#define TabAudioCDFormatList 2513 //(Left Origin = 58, Top Origin = 36, Width = 70, Usable = 0, Font = Standard, Visible Items = 2) -#define TabAudioCDDriverPopTrigger 2509 //(Left Origin = 58, Top Origin = 24, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2510) -#define TabAudioCDFormatPopTrigger 2512 //(Left Origin = 58, Top Origin = 36, Width = 70, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2513) - -// Resource: tFRM 2600 -#define TabVolumeForm 2600 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabVolumeUnnamed2601Label 2601 //(Left Origin = 29, Top Origin = 69, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2603Label 2603 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabVolumeUnnamed2606Label 2606 //(Left Origin = 26, Top Origin = 15, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2607Label 2607 //(Left Origin = 12, Top Origin = 30, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2608Label 2608 //(Left Origin = 20, Top Origin = 45, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2610Label 2610 //(Left Origin = 14, Top Origin = 84, Usable = 1, Font = Standard) -#define TabVolumeMusicSliderControl 2602 //(Left Origin = 58, Top Origin = 12, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeSfxSliderControl 2604 //(Left Origin = 58, Top Origin = 27, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumePalmSliderControl 2605 //(Left Origin = 58, Top Origin = 66, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 100, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeSpeechSliderControl 2609 //(Left Origin = 58, Top Origin = 42, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeAudioCDSliderControl 2611 //(Left Origin = 58, Top Origin = 81, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 100, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) - -// Resource: tFRM 2800 -#define TabMiscPalmOSForm 2800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscPalmOSVibratorCheckbox 2802 //(Left Origin = 4, Top Origin = 12, Width = 128, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSNoAutoOffCheckbox 2803 //(Left Origin = 4, Top Origin = 24, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSStdPaletteCheckbox 2804 //(Left Origin = 4, Top Origin = 84, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSLargerStackCheckbox 2805 //(Left Origin = 4, Top Origin = 36, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSAdvancedCheckbox 2806 //(Left Origin = 4, Top Origin = 96, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSArrowCheckbox 2807 //(Left Origin = 4, Top Origin = 72, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSExitLauncherCheckbox 2810 //(Left Origin = 4, Top Origin = 48, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSStylusClickCheckbox 2811 //(Left Origin = 4, Top Origin = 60, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSTabTitlePalmLabel 2801 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) - -// Resource: tFRM 2900 -#define TabMiscScummVMForm 2900 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscScummVMAutosaveCheckbox 2902 //(Left Origin = 4, Top Origin = 48, Width = 90, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDebugCheckbox 2904 //(Left Origin = 4, Top Origin = 60, Width = 90, Height = 12, Usable = 0, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDemoCheckbox 2905 //(Left Origin = 4, Top Origin = 12, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMCopyProtectionCheckbox 2906 //(Left Origin = 4, Top Origin = 24, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMAltIntroCheckbox 2908 //(Left Origin = 4, Top Origin = 36, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDebugLevelField 2907 //(Left Origin = 101, Top Origin = 60, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 1, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMiscScummVMAutosaveField 2910 //(Left Origin = 101, Top Origin = 48, Width = 20, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMiscScummVMTabTitleScummLabel 2901 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMiscScummVMUnnamed2903Label 2903 //(Left Origin = 97, Top Origin = 61, Usable = 1, Font = Standard) -#define TabMiscScummVMUnnamed2909Label 2909 //(Left Origin = 97, Top Origin = 48, Usable = 1, Font = Standard) -#define TabMiscScummVMUnnamed2911Label 2911 //(Left Origin = 123, Top Origin = 48, Usable = 1, Font = Standard) - -// Resource: tFRM 3000 -#define GameEditForm 3000 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1411) -#define GameEditOKButton 3020 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditCancelButton 3021 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditDeleteButton 3023 //(Left Origin = 109, Top Origin = 139, Width = 42, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditUnnamed3022GraffitiShift 3022 //(Left Origin = 87, Top Origin = 140) - -// Resource: tFRM 3100 -#define TabGameInfoForm 3100 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameInfoEntryNameField 3102 //(Left Origin = 4, Top Origin = 12, Width = 151, Height = 24, Usable = 1, Editable = 1, Underline = 1, Single Line = 0, Dynamic Size = 0, Left Justified = 1, Max Characters = 50, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoPathField 3104 //(Left Origin = 37, Top Origin = 38, Width = 118, Height = 24, Usable = 1, Editable = 1, Underline = 1, Single Line = 0, Dynamic Size = 0, Left Justified = 1, Max Characters = 150, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoGameField 3106 //(Left Origin = 37, Top Origin = 64, Width = 52, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 15, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoUnnamed3101Label 3101 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameInfoUnnamed3103Label 3103 //(Left Origin = 11, Top Origin = 38, Usable = 1, Font = Standard) -#define TabGameInfoUnnamed3105Label 3105 //(Left Origin = 6, Top Origin = 64, Usable = 1, Font = Standard) -#define TabGameInfoUnnamed3107Label 3107 //(Left Origin = 4, Top Origin = 79, Usable = 1, Font = Standard) -#define TabGameInfoEngineList 3109 //(Left Origin = 37, Top Origin = 57, Width = 115, Usable = 0, Font = Standard, Visible Items = 3) -#define TabGameInfoBrowsePushButton 3110 //(Left Origin = 11, Top Origin = 50, Width = 22, Height = 12, Usable = 1, Group ID = 0, Font = Standard) -#define TabGameInfoEnginePopTrigger 3108 //(Left Origin = 37, Top Origin = 79, Width = 115, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3109) - -// Resource: tFRM 3200 -#define TabGameDisplayForm 3200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 95, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameDisplayFilterCheckbox 3205 //(Left Origin = 4, Top Origin = 36, Width = 80, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define TabGameDisplayFullscreenCheckbox 3206 //(Left Origin = 4, Top Origin = 60, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameDisplayAspectRatioCheckbox 3207 //(Left Origin = 4, Top Origin = 48, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameDisplayUnnamed3201Label 3201 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameDisplayUnnamed3202Label 3202 //(Left Origin = 5, Top Origin = 24, Usable = 1, Font = Standard) -#define TabGameDisplayUnnamed3208Label 3208 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabGameDisplayGfxListList 3204 //(Left Origin = 38, Top Origin = 12, Width = 75, Usable = 0, Font = Standard, Visible Items = 2) -#define TabGameDisplayRenderList 3210 //(Left Origin = 38, Top Origin = 24, Width = 75, Usable = 0, Font = Standard, Visible Items = 6) -#define TabGameDisplayGfxPopupPopTrigger 3203 //(Left Origin = 38, Top Origin = 12, Width = 80, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3204) -#define TabGameDisplayRenderPopTrigger 3209 //(Left Origin = 38, Top Origin = 24, Width = 85, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3209) - -// Resource: tFRM 3300 -#define TabGameOptionsForm 3300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameOptionsLoadSlotCheckbox 3302 //(Left Origin = 4, Top Origin = 24, Width = 85, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsStartRoomCheckbox 3303 //(Left Origin = 4, Top Origin = 36, Width = 84, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsAmigaCheckbox 3306 //(Left Origin = 4, Top Origin = 48, Width = 81, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsSubtitlesCheckbox 3307 //(Left Origin = 4, Top Origin = 60, Width = 82, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsTalkSpeedCheckbox 3308 //(Left Origin = 4, Top Origin = 12, Width = 66, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsLoadSlotField 3304 //(Left Origin = 92, Top Origin = 24, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 2, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsStartRoomField 3305 //(Left Origin = 92, Top Origin = 36, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsTalkSpeedField 3309 //(Left Origin = 92, Top Origin = 12, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsUnnamed3301Label 3301 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameOptionsUnnamed3314Label 3314 //(Left Origin = 88, Top Origin = 24, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3315Label 3315 //(Left Origin = 88, Top Origin = 36, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3316Label 3316 //(Left Origin = 88, Top Origin = 12, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3317Label 3317 //(Left Origin = 88, Top Origin = 48, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3318Label 3318 //(Left Origin = 88, Top Origin = 60, Usable = 1, Font = Standard) -#define TabGameOptionsLanguageList 3311 //(Left Origin = 92, Top Origin = 15, Width = 64, Usable = 0, Font = Standard, Visible Items = 5) -#define TabGameOptionsPlatformList 3313 //(Left Origin = 92, Top Origin = 15, Width = 64, Usable = 0, Font = Standard, Visible Items = 4) -#define TabGameOptionsLanguagePopTrigger 3310 //(Left Origin = 90, Top Origin = 60, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3311) -#define TabGameOptionsPlatformPopTrigger 3312 //(Left Origin = 90, Top Origin = 48, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3313) - -// Resource: tFRM 3400 -#define ImportForm 3400 //(Left Origin = 34, Top Origin = 64, Width = 91, Height = 32, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define ImportUnnamed3401Label 3401 //(Left Origin = 4, Top Origin = 4, Usable = 1, Font = Standard) -#define ImportUnnamed3402Label 3402 //(Left Origin = 16, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 1400 -#define EngineForm 1400 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define EngineOkButton 1403 //(Left Origin = 4, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define EngineCancelButton 1420 //(Left Origin = 45, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define EngineUnnamed1402Label 1402 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold) -#define EngineUnnamed1404Label 1404 //(Left Origin = 4, Top Origin = 88, Usable = 1, Font = Bold) -#define EngineListList 1401 //(Left Origin = 4, Top Origin = 30, Width = 148, Usable = 1, Font = Standard, Visible Items = 5) -#define EngineSupportedList 1405 //(Left Origin = 4, Top Origin = 102, Width = 148, Usable = 1, Font = Standard, Visible Items = 3) - -// Resource: tFRM 4000 -#define InfoForm 4000 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define InfoOKButton 4020 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 4100 -#define TabInfoAboutForm 4100 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 125, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoAboutTabTitleAboutLabel 4101 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoAboutUnnamed4103Label 4103 //(Left Origin = 23, Top Origin = 58, Usable = 1, Font = Bold) -#define TabInfoAboutUnnamed4104Label 4104 //(Left Origin = 34, Top Origin = 70, Usable = 1, Font = Standard) -#define TabInfoAboutUnnamed4105Label 4105 //(Left Origin = 8, Top Origin = 82, Usable = 1, Font = Bold) - -// Resource: tFRM 4200 -#define TabInfoVersionForm 4200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoVersionTabTitleAboutLabel 4201 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4202Label 4202 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4203Label 4203 //(Left Origin = 24, Top Origin = 24, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4204Label 4204 //(Left Origin = 4, Top Origin = 42, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4205Label 4205 //(Left Origin = 5, Top Origin = 53, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4206Label 4206 //(Left Origin = 4, Top Origin = 72, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4207Label 4207 //(Left Origin = 4, Top Origin = 84, Usable = 1, Font = Standard) - -// Resource: tFRM 4300 -#define TabInfoSystemForm 4300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoSystemTabTitleAboutLabel 4301 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoSystemUnnamed4302Label 4302 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4303Label 4303 //(Left Origin = 13, Top Origin = 24, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4304Label 4304 //(Left Origin = 5, Top Origin = 36, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4305Label 4305 //(Left Origin = 96, Top Origin = 0, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4306Label 4306 //(Left Origin = 132, Top Origin = 0, Usable = 1, Font = Standard) - -// Resource: tFRM 1600 -#define TabCardConfigForm 1600 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 110, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabCardConfigDetectCheckbox 1602 //(Left Origin = 4, Top Origin = 86, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigCacheCheckbox 1604 //(Left Origin = 4, Top Origin = 62, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigLedCheckbox 1608 //(Left Origin = 4, Top Origin = 50, Width = 130, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigCacheSizeField 1606 //(Left Origin = 68, Top Origin = 74, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabCardConfigTabTitleAboutLabel 1601 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabCardConfigUnnamed1605Label 1605 //(Left Origin = 21, Top Origin = 74, Usable = 1, Font = Standard) -#define TabCardConfigUnnamed1607Label 1607 //(Left Origin = 88, Top Origin = 74, Usable = 1, Font = Standard) -#define TabCardConfigSlotList 1620 //(Left Origin = 7, Top Origin = 14, Width = 146, Usable = 1, Font = Standard, Visible Items = 3) - -// Resource: tFRM 1700 -#define TabCardGameListForm 1700 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabCardGameListMoveCheckbox 1702 //(Left Origin = 4, Top Origin = 12, Width = 143, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListDeleteCheckbox 1703 //(Left Origin = 4, Top Origin = 24, Width = 142, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListConfirmCheckbox 1704 //(Left Origin = 4, Top Origin = 36, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListUnnamed1701Label 1701 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) - -// Resource: tFRM 3500 -#define TabMiscExtsForm 3500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 80, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscExtsLightspeedCheckbox 3502 //(Left Origin = 4, Top Origin = 24, Width = 95, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscExtsGolcdCheckbox 3505 //(Left Origin = 4, Top Origin = 12, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscExtsTabTitleMoreLabel 3501 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMiscExtsNothingLabel 3506 //(Left Origin = 4, Top Origin = 36, Usable = 0, Font = Standard) -#define TabMiscExtsLightspeedList 3504 //(Left Origin = 96, Top Origin = 24, Width = 50, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMiscExtsLightspeedPopTrigger 3503 //(Left Origin = 96, Top Origin = 24, Width = 60, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3504) - - -// Resource: Talt 1001 -#define RomIncompatibleAlert 1001 -#define RomIncompatibleOK 0 - -// Resource: Talt 1000 -#define FrmWarnAlert 1000 -#define FrmWarnOK 0 - -// Resource: Talt 1100 -#define FrmErrorAlert 1100 -#define FrmErrorCancel 0 - -// Resource: Talt 1300 -#define FrmConfirmAlert 1300 -#define FrmConfirmYes 0 -#define FrmConfirmNo 1 - -// Resource: Talt 1400 -#define FrmInfoAlert 1400 -#define FrmInfoOK 0 - - -// Resource: MBAR 1000 -#define MainFormMenuBar 1000 - - -// Resource: MENU 1000 -#define MainOptionsMenu 1000 -#define MainOptionsMisc 1000 // Command Key: I -#define MainOptionsSkins 1001 -#define MainOptionsBeam 1003 -#define MainOptionsAbout 1005 - -// Resource: MENU 1100 -#define MainGamesMenu 1100 -#define MainGamesNew 1100 // Command Key: N -#define MainGamesEdit 1101 // Command Key: E -#define MainGamesMusicSound 1102 // Command Key: M -#define MainGamesDelete 1103 -#define MainGamesMemoryCard 1105 // Command Key: C - - -// Resource: tSTR 9991 -#define ClieCatString 9991 // "32779" - -// Resource: tSTR 9990 -#define ClieDescString 9990 // "Play your favorite Point'n'Click games" - - -// Resource: PICT 1001 -#define Bitmap 1001 - -// Resource: PICT 1002 -#define Bitmap2 1002 - -// Resource: PICT 1008 -#define Bitmap3 1008 - -// Resource: PICT 1011 -#define Bitmap4 1011 - -// Resource: PICT 1012 -#define Bitmap5 1012 - -// Resource: PICT 1018 -#define Bitmap6 1018 - -// Resource: PICT 2000 -#define infoBitmap 2000 - -// Resource: PICT 1100 -#define msOnBitmap 1100 - -// Resource: PICT 1009 -#define Bitmap7 1009 - -// Resource: PICT 1010 -#define Bitmap8 1010 - -// Resource: PICT 1110 -#define msNoneBitmap 1110 - -// Resource: PICT 1020 -#define BitmapID1020Bitmap 1020 - -// Resource: PICT 1019 -#define BitmapID1019Bitmap 1019 - -// Resource: PICT 1200 -#define msOnD2Bitmap 1200 - -// Resource: PICT 1300 -#define msNoneD2Bitmap 1300 - -// Resource: PICT 2100 -#define infoD2Bitmap 2100 - -// Resource: PICT 1501 -#define ScummVMlogoD1Bitmap 1501 - -// Resource: PICT 1502 -#define ScummVMlogoD2Bitmap 1502 - -// Resource: PICT 1000 -#define icon16bitD2Bitmap 1000 - - -// Resource: tbmf 1000 -#define Icon_infoBitmapFamily 1000 - -// Resource: tbmf 1100 -#define MsOnBitmapFamily 1100 - -// Resource: tbmf 2000 -#define InfoBitmapFamily 2000 - -// Resource: tbmf 1110 -#define MsNoneBitmapFamily 1110 - -// Resource: tbmf 1200 -#define LogoBitmapFamily 1200 - - -// Resource: taif 1000 -#define Largeicons12and8bitsAppIconFamily 1000 - -// Resource: taif 1001 -#define Smallicons12and8bitsAppIconFamily 1001 - - -#endif // STARTERRSC_H diff --git a/backends/platform/PalmOS/Rsc/batLow.bmp b/backends/platform/PalmOS/Rsc/batLow.bmp deleted file mode 100644 index 1d18131450..0000000000 Binary files a/backends/platform/PalmOS/Rsc/batLow.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyAlt.bmp b/backends/platform/PalmOS/Rsc/keyAlt.bmp deleted file mode 100644 index 28165394f8..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyAlt.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyCommand.bmp b/backends/platform/PalmOS/Rsc/keyCommand.bmp deleted file mode 100644 index 1324037cd3..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyCommand.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyCtrl.bmp b/backends/platform/PalmOS/Rsc/keyCtrl.bmp deleted file mode 100644 index fed20fd8d0..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyCtrl.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/modules.rcp b/backends/platform/PalmOS/Rsc/modules.rcp deleted file mode 100644 index c7b17221b2..0000000000 --- a/backends/platform/PalmOS/Rsc/modules.rcp +++ /dev/null @@ -1,71 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * Copyright (C) 2001 Ludvig Strigeus - * Copyright (C) 2001-2010 The ScummVM project - * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend - * - * 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$ - * - */ - -BITMAP ID 3100 -BEGIN - BITMAP "keyCommand.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3101 -BEGIN - BITMAP "keyAlt.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3102 -BEGIN - BITMAP "keyCtrl.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3120 -BEGIN - BITMAP "batLow.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3130 -BEGIN - BITMAP "numpad.bmp" BPP 1 DENSITY 2 -END - -/* -BITMAP ID 3100 "keyCommand.bmp" DENSITY 2 -BITMAP ID 3101 "keyAlt.bmp" DENSITY 2 -BITMAP ID 3102 "keyCtrl.bmp" DENSITY 2 -BITMAP ID 3120 "batLow.bmp" DENSITY 2 -BITMAP ID 3130 "numpad.bmp" DENSITY 2 -*/ -BITMAP ID 3000 "keyCommand.bmp" DENSITY 1 -BITMAP ID 3001 "keyAlt.bmp" DENSITY 1 -BITMAP ID 3002 "keyCtrl.bmp" DENSITY 1 -BITMAP ID 3020 "batLow.bmp" DENSITY 1 -BITMAP ID 3030 "numpad.bmp" DENSITY 1 - -ALERT ID 1200 - DEFAULTBUTTON 0 - ERROR -BEGIN - TITLE "ScummVM Fatal Error" - MESSAGE "^1" - BUTTONS "Exit" -END - diff --git a/backends/platform/PalmOS/Rsc/modulesrsc.h b/backends/platform/PalmOS/Rsc/modulesrsc.h deleted file mode 100644 index 14b32ee0b6..0000000000 --- a/backends/platform/PalmOS/Rsc/modulesrsc.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MODULESRSC_H -#define MODULESRSC_H - -#define FrmFatalErrorAlert 1200 - -#endif diff --git a/backends/platform/PalmOS/Rsc/numpad.bmp b/backends/platform/PalmOS/Rsc/numpad.bmp deleted file mode 100644 index 7763d76c05..0000000000 Binary files a/backends/platform/PalmOS/Rsc/numpad.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Src/args.cpp b/backends/platform/PalmOS/Src/args.cpp deleted file mode 100644 index bfc34866e3..0000000000 --- a/backends/platform/PalmOS/Src/args.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include "palmdefs.h" -#include "args.h" -#include "pace.h" -#include "endianutils.h" - -Char **ArgsInit() { - // first 4 bytes keep the real address of the chunk - MemHandle argvH = MemHandleNew(sizeof(Char *) + (MAX_ARG * sizeof(Char **) + 2)); - // real addr - Char *lockP = (Char *)MemHandleLock(argvH); - // 4byte aligned - Char **argvP = (Char **)ALIGN_4BYTE(lockP); - // save real addr - argvP[0] = lockP; - // initial position - argvP++; - - for (UInt8 count = 0; count < MAX_ARG; count++) - argvP[count] = NULL; - - return argvP; -} - -void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP) { - if (argP) { - MemHandle newArg; - UInt16 len2 = 0; - UInt16 len1 = StrLen(argP); - - if (len1 > 0) { - if (parmP) - len2 = StrLen(parmP); - - (*countArgP)++; - newArg = MemHandleNew(len1 + len2 + 1); // +1 = NULL CHAR - *argvP = (Char *)MemHandleLock(newArg); - StrCopy(*argvP, argP); - - if (parmP) - StrCat(*argvP, parmP); - } - } -} - -void ArgsFree(Char **argvP) { - if (!argvP) - return; - - MemHandle oldH; - - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) { - oldH = MemPtrRecoverHandle(argvP[count]); - MemHandleUnlock(oldH); - MemHandleFree(oldH); - } - - argvP--; - oldH = MemPtrRecoverHandle(argvP[0]); - MemHandleUnlock(oldH); - MemHandleFree(oldH); -} - -void ArgsSetOwner(Char **argvP, UInt16 owner) { - if (!argvP) - return; - - MemHandle oldH; - - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) { - oldH = MemPtrRecoverHandle(argvP[count]); - MemHandleSetOwner(oldH, owner); - } - - argvP--; - oldH = MemPtrRecoverHandle(argvP[0]); - MemHandleSetOwner(oldH, owner); -} - -void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm) { - if (arm) { - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) - argvP[count] = (Char *)ByteSwap32(argvP[count]); - } - - FtrSet(appFileCreator, ftrArgsData , (UInt32)argvP); - FtrSet(appFileCreator, ftrArgsCount, (UInt32)countArg); -} - -void ArgsExportRelease(Boolean arm) { - if (arm) { - Char **argvP; - Err e = FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP); - - if (argvP) - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) - argvP[count] = (Char *)ByteSwap32(argvP[count]); - } - - FtrUnregister(appFileCreator, ftrArgsCount); - FtrUnregister(appFileCreator, ftrArgsData); -} diff --git a/backends/platform/PalmOS/Src/args.h b/backends/platform/PalmOS/Src/args.h deleted file mode 100644 index fa988fe35f..0000000000 --- a/backends/platform/PalmOS/Src/args.h +++ /dev/null @@ -1,44 +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$ - * - */ - -#ifndef ARGS_H -#define ARGS_H - -#define MAX_ARG 25 - -#define ftrArgsData 1300 -#define ftrArgsCount 1301 -#define ftrVars 1302 -#define ftrStack 1303 - -Char **ArgsInit(); -void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP); -void ArgsFree(Char **argvP); -void ArgsSetOwner(Char **argvP, UInt16 owner); - -void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm); -void ArgsExportRelease(Boolean arm); - -#endif diff --git a/backends/platform/PalmOS/Src/base_event.cpp b/backends/platform/PalmOS/Src/base_event.cpp deleted file mode 100644 index ae93514e34..0000000000 --- a/backends/platform/PalmOS/Src/base_event.cpp +++ /dev/null @@ -1,458 +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$ - * - */ - -#include "be_base.h" -#include "common/events.h" - -#ifdef STDLIB_TRACE_MEMORY -# include -#endif - -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) -extern "C" void SysEventGet(EventType *eventP, Int32 timeout); -extern "C" void SysEventAddToQueue (const EventType *eventP); -#endif - -void OSystem_PalmBase::timer_handler() { - UInt32 msecs = getMillis(); - - if (_timer.active && (msecs >= _timer.nextExpiry)) { - _timer.duration = _timer.callback(_timer.duration); - _timer.nextExpiry = msecs + _timer.duration; - } -} - -void OSystem_PalmBase::battery_handler() { - // check battery level every 15secs - if ((TimGetTicks() - _batCheckLast) > _batCheckTicks) { - UInt16 voltage, warnThreshold, criticalThreshold; - Boolean pluggedIn; - voltage = SysBatteryInfoV20(false, &warnThreshold, &criticalThreshold, NULL, NULL, &pluggedIn); - - if (!pluggedIn) { - if (voltage <= warnThreshold) { - if (!_showBatLow) { - _showBatLow = true; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, true, 2); - displayMessageOnOSD("Battery low."); - } - } else { - if (_showBatLow) { - _showBatLow = false; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, false); - } - } - - if (voltage <= criticalThreshold) { - ::EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrPowerOff; - event.data.keyDown.modifiers = commandKeyMask; -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) - SysEventAddToQueue(&event); -#else - EvtAddEventToQueue(&event); -#endif - } - } - - _batCheckLast = TimGetTicks(); - } -} - -bool OSystem_PalmBase::pollEvent(Common::Event &event) { - ::EventType ev; - Boolean handled; - UInt32 keyCurrentState; - Coord x, y; - - battery_handler(); - timer_handler(); - sound_handler(); - - for (;;) { - // check for hardkey repeat for mouse emulation - keyCurrentState = KeyCurrentState(); - - // if it was a key pressed, let the keyup event raise - if (_keyExtraPressed) { - if (gVars->arrowKeys) { - if (_keyExtraPressed & _keyExtra.bitLeft) { - if (!(keyCurrentState & _keyExtra.bitLeft)) { - _keyExtraPressed &= ~_keyExtra.bitLeft; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_LEFT; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitRight) { - if (!(keyCurrentState & _keyExtra.bitRight)) { - _keyExtraPressed &= ~_keyExtra.bitRight; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_RIGHT; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitUp) { - if (!(keyCurrentState & _keyExtra.bitUp)) { - _keyExtraPressed &= ~_keyExtra.bitUp; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_UP; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitDown) { - if (!(keyCurrentState & _keyExtra.bitDown)) { - _keyExtraPressed &= ~_keyExtra.bitDown; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_DOWN; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - } - - if (_keyExtraPressed & _keyExtra.bitActionA) { - if (!(keyCurrentState & _keyExtra.bitActionA)) { - _keyExtraPressed &= ~_keyExtra.bitActionA; - - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - if (_keyExtraPressed & _keyExtra.bitActionB) { - if (!(keyCurrentState & _keyExtra.bitActionB)) { - _keyExtraPressed &= ~_keyExtra.bitActionB; - - event.type = Common::EVENT_RBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - // no more event till up is raised - return false; - } - - if (!(keyCurrentState & _keyExtraMask)) { - _lastKeyRepeat = 0; - - } else if (getMillis() >= (_keyExtraRepeat + _keyExtraDelay)) { - _keyExtraRepeat = getMillis(); - - if (gVars->arrowKeys) { - if (keyCurrentState & _keyExtra.bitLeft) { - _keyExtraPressed |= _keyExtra.bitLeft; - event.kbd.keycode = Common::KEYCODE_LEFT; - - } else if (keyCurrentState & _keyExtra.bitRight) { - _keyExtraPressed |= _keyExtra.bitRight; - event.kbd.keycode = Common::KEYCODE_RIGHT; - - } else if (keyCurrentState & _keyExtra.bitUp) { - _keyExtraPressed |= _keyExtra.bitUp; - event.kbd.keycode = Common::KEYCODE_UP; - - } else if (keyCurrentState & _keyExtra.bitDown) { - _keyExtraPressed |= _keyExtra.bitDown; - event.kbd.keycode = Common::KEYCODE_DOWN; - } - - event.type = Common::EVENT_KEYDOWN; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - - } else { - Int8 sx = 0; - Int8 sy = 0; - - if (keyCurrentState & _keyExtra.bitUp) - sy = -1; - else if (keyCurrentState & _keyExtra.bitDown) - sy = +1; - - if (keyCurrentState & _keyExtra.bitLeft) - sx = -1; - else if (keyCurrentState & _keyExtra.bitRight) - sx = +1; - - if (sx || sy) { - simulate_mouse(event, sx, sy, &x, &y); - event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - - return true; - } - } - } - -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) - SysEventGet(&ev, evtNoWait); -#else - EvtGetEvent(&ev, evtNoWait); -#endif - - if (ev.eType == keyUpEvent) { - Common::KeyCode k = Common::KEYCODE_INVALID; - switch (ev.data.keyUp.chr) { - - // arrow keys - case chrUpArrow: - k = Common::KEYCODE_UP; break; - case chrDownArrow: - k = Common::KEYCODE_DOWN; break; - case chrRightArrow: - k = Common::KEYCODE_RIGHT; break; - case chrLeftArrow: - k = Common::KEYCODE_LEFT; break; - } - - if (k) { - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = k; - event.kbd.ascii = k; - event.kbd.flags = 0; - return true; - } - - } else if (ev.eType == keyDownEvent) { - Common::KeyCode k = Common::KEYCODE_INVALID; - switch (ev.data.keyDown.chr) { - // ESC key - case vchrLaunch: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = Common::ASCII_ESCAPE; - event.kbd.flags = 0; - return true; - - // F5 = menu - case vchrMenu: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - event.kbd.flags = 0; - return true; - - // if hotsync pressed, etc... - case vchrHardCradle: - case vchrHardCradle2: - case vchrLowBattery: - case vchrFind: -// case vchrBrightness: // volume control on Zodiac, let other backends disable it - case vchrContrast: - // do nothing - return true; - - // arrow keys - case chrUpArrow: - k = Common::KEYCODE_UP; break; - case chrDownArrow: - k = Common::KEYCODE_DOWN; break; - case chrRightArrow: - k = Common::KEYCODE_RIGHT; break; - case chrLeftArrow: - k = Common::KEYCODE_LEFT; break; - - // return - case chrLineFeed: - case chrCarriageReturn: - k = Common::KEYCODE_RETURN; break; - - } - - if (k) { - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = k; - event.kbd.ascii = k; - event.kbd.flags = 0; - return true; - } - } - - if (check_event(event, &ev)) - return true; - - // prevent crash when alarm is raised - handled = ((ev.eType == keyDownEvent) && - (ev.data.keyDown.modifiers & commandKeyMask) && - ((ev.data.keyDown.chr == vchrAttnStateChanged) || - (ev.data.keyDown.chr == vchrAttnUnsnooze))); - - // graffiti strokes, auto-off, etc... - if (!handled) - if (SysHandleEvent(&ev)) - continue; - - switch (ev.eType) { - case penMoveEvent: - get_coordinates(&ev, x, y); - - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - if (abs(y - event.mouse.y) <= 2 || abs(x - event.mouse.x) <= 2) - return false; - - event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case penDownEvent: - get_coordinates(&ev, x, y); - - // indy fight mode - if (_useNumPad && !_overlayVisible) { - char num = '1'; - num += 9 - - (3 - (3 * x / _screenWidth )) - - (3 * (3 * y / _screenHeight)); - - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = (Common::KeyCode)num; - event.kbd.ascii = num; - event.kbd.flags = 0; - - _wasKey = true; - return true; - } - - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_MOUSEMOVE); - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case penUpEvent: - get_coordinates(&ev, x, y); - - event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONUP : Common::EVENT_MOUSEMOVE); - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case keyDownEvent: - if (ev.data.keyDown.chr == vchrCommand && - (ev.data.keyDown.modifiers & commandKeyMask)) { - - _lastKeyModifier++; - _lastKeyModifier %= kModifierCount; - - if (_lastKeyModifier) - draw_osd((kDrawKeyState + _lastKeyModifier - 1), 2, _screenDest.h + 2, true); - else - draw_osd(kDrawKeyState, 2, _screenDest.h + 2, false); - - return false; - } - - char mask = 0; - UInt16 key = ev.data.keyDown.chr; - - if (_lastKeyModifier == kModifierNone) { - // for keyboard mode - if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= Common::KBD_SHIFT; - if (ev.data.keyDown.modifiers & controlKeyMask) mask |= Common::KBD_CTRL; - if (ev.data.keyDown.modifiers & optionKeyMask) mask |= Common::KBD_ALT; - if (ev.data.keyDown.modifiers & commandKeyMask) mask |= Common::KBD_CTRL|Common::KBD_ALT; - } else { - // for grafiti mode - if (_lastKeyModifier == kModifierCommand) mask = Common::KBD_CTRL|Common::KBD_ALT; - if (_lastKeyModifier == kModifierAlt) mask = Common::KBD_ALT; - if (_lastKeyModifier == kModifierCtrl) mask = Common::KBD_CTRL; - } - - if (_lastKeyModifier) - draw_osd(kDrawKeyState, 2, _screenDest.h + 2, false); - _lastKeyModifier = kModifierNone; - - // F1 -> F10 key - if (key >= '0' && key <= '9' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { - key = (key == '0') ? 324 : (315 + key - '1'); - mask = 0; - -#ifdef STDLIB_TRACE_MEMORY - // print memory - } else if (key == 'm' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { - printf("Used memory: %d\n", __stdlib_trace_memory); -#endif - // exit - } else if ((key == 'z' && mask == Common::KBD_CTRL) || (mask == Common::KBD_ALT && key == 'x')) { - event.type = Common::EVENT_QUIT; - return true; - - // num pad (indy fight mode) - } else if (key == 'n' && mask == (Common::KBD_CTRL|Common::KBD_ALT) && !_overlayVisible) { - _useNumPad = !_useNumPad; - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, _useNumPad, 1); - displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off."); - return false; - } - - // other keys - _wasKey = true; - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = (Common::KeyCode)key; - event.kbd.ascii = key; - event.kbd.flags = mask; - return true; - - default: - if (_wasKey && ev.eType != keyHoldEvent) { - event.type = Common::EVENT_KEYUP; - _wasKey = false; - return true; - } - return false; - }; - } -} diff --git a/backends/platform/PalmOS/Src/base_gfx.cpp b/backends/platform/PalmOS/Src/base_gfx.cpp deleted file mode 100644 index 46238efdc2..0000000000 --- a/backends/platform/PalmOS/Src/base_gfx.cpp +++ /dev/null @@ -1,198 +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$ - * - */ - -#include "be_base.h" - -/* - * Graphics modes - * - */ - -static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { - {"1x", "Normal", GFX_NORMAL}, - {"wide", "Wide", GFX_WIDE}, - {0, 0, 0} -}; - -int OSystem_PalmBase::getDefaultGraphicsMode() const { - return GFX_NORMAL; -} - -const OSystem::GraphicsMode *OSystem_PalmBase::getSupportedGraphicsModes() const { - return int_getSupportedGraphicsModes(); -} - -const OSystem::GraphicsMode *OSystem_PalmBase::int_getSupportedGraphicsModes() const { - return s_supportedGraphicsModes; -} - -int OSystem_PalmBase::getGraphicsMode() const { - return _mode; -} - -bool OSystem_PalmBase::setGraphicsMode(int mode) { - switch (mode) { - case GFX_NORMAL: - case GFX_WIDE: - _setMode = mode; - break; - - default: - warning("unknown gfx mode %d", mode); - _setMode = GFX_NORMAL; - return false; - } - - return true; -} - -/* - * Init - * - */ - -void OSystem_PalmBase::initSize(uint w, uint h, const Graphics::PixelFormat *format) { - _screenWidth = w; - _screenHeight = h; - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - unload_gfx_mode(); - _mode = _setMode; - load_gfx_mode(); - - warpMouse(200, 150); - int_initSize(w, h); -} - -/* - * Palette - * - */ -void OSystem_PalmBase::setPalette(const byte *colors, uint start, uint num) { - RGBColorType *base = _currentPalette + start; - - for (uint i = 0; i < num; i++) { - base[i].r = colors[0]; - base[i].g = colors[1]; - base[i].b = colors[2]; - - extras_palette(i + start, colors[0], colors[1], colors[2]); - colors += 4; - } - - if (start < _paletteDirtyStart) - _paletteDirtyStart = start; - - if (start + num > _paletteDirtyEnd) - _paletteDirtyEnd = start + num; -} - -void OSystem_PalmBase::grabPalette(byte *colors, uint start, uint num) { - const RGBColorType *base = _currentPalette + start; - - for (uint i = 0; i < num; ++i) { - colors[i * 4] = base[i].r; - colors[i * 4 + 1] = base[i].g; - colors[i * 4 + 2] = base[i].b; - colors[i * 4 + 3] = 0xFF; - } -} - -/* - * Screen - * - */ - -void OSystem_PalmBase::setShakePos(int shakeOffset) { - _new_shake_pos = shakeOffset; - int_setShakePos(shakeOffset); -} - -void OSystem_PalmBase::updateScreen() { - // Check whether the palette was changed in the meantime and update the - // screen surface accordingly. - if (_paletteDirtyEnd != 0 && _setPalette) { - WinSetDrawWindow(WinGetDisplayWindow()); - WinPalette(winPaletteSet, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart, _currentPalette + _paletteDirtyStart); - _paletteDirtyEnd = 0; - //_redawOSD = true; - } - if (_redawOSD) { - _redawOSD = false; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, _showBatLow, 2); - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, (_useNumPad && !_overlayVisible), 1); - } - int_updateScreen(); - -} - -void OSystem_PalmBase::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { -//return; - - MemHandle hTemp = DmGetResource('abmp', id + 100); - - if (hTemp) { - /*static const UInt32 pal[3] = { - (TwGfxComponentsToPackedRGB(0,255,0)), - (TwGfxComponentsToPackedRGB(255,255,0)), - (TwGfxComponentsToPackedRGB(255,0,0)) - };*/ - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - BmpGetDimensions(bmTemp, &w, &h, 0); - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType r = { dst.x, dst.y, w, h }; - - RectangleType c; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinGetClip(&c); - WinResetClip(); - if (show) { - WinSetDrawWindow(_screenH); - WinSetBackColor(0); - WinSetForeColor(120); // pal[color] - WinFillRectangle(&r, 0); - WinSetDrawMode(winOverlay); - WinDrawBitmap(bmTemp, 0, 0); - WinSetDrawMode(winPaint); - - } else { - WinSetBackColor(0); - WinFillRectangle(&r, 0); - } - WinSetClip(&c); - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/base_mouse.cpp b/backends/platform/PalmOS/Src/base_mouse.cpp deleted file mode 100644 index bf11a4b106..0000000000 --- a/backends/platform/PalmOS/Src/base_mouse.cpp +++ /dev/null @@ -1,101 +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$ - * - */ - -#include "be_base.h" - -void OSystem_PalmBase::warpMouse(int x, int y) { - if (x != _mouseCurState.x || y != _mouseCurState.y) { - x = x >= _screenWidth ? _screenWidth - 1 : x; - y = y >= _screenHeight ? _screenHeight - 1 : y; - - _mouseCurState.x = x; - _mouseCurState.y = y; - } -} - -bool OSystem_PalmBase::showMouse(bool visible) { - bool last = _mouseVisible; - _mouseVisible = visible; - - return last; -} - -void OSystem_PalmBase::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { - if (w == 0 || h == 0) - return; - - _mouseHotspotX = hotspotX; - _mouseHotspotY = hotspotY; - - _mouseKeyColor = keycolor; - - if (_mouseCurState.w != w || _mouseCurState.h != h) { - _mouseCurState.w = w; - _mouseCurState.h = h; - - if (_mouseDataP) - free(_mouseDataP); - - if (_mouseBackupP) - free(_mouseBackupP); - - _mouseDataP = (byte *)malloc(w * h); - _mouseBackupP = (byte *)malloc(w * h * 2); // if 16bit = *2 - } - - if (!_mouseBackupP) { - free(_mouseDataP); - _mouseDataP = NULL; - } - - if (_mouseDataP) - memcpy(_mouseDataP, buf, w * h); -} - -void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) { - Int16 x = _mouseCurState.x; - Int16 y = _mouseCurState.y; - Int16 slow, fact; - - _lastKeyRepeat++; - fact = _screenWidth / 320; - fact = (fact) ? fact : 1; - - if (_lastKeyRepeat > 32 * fact) - _lastKeyRepeat = 32 * fact; - - slow = (iHoriz && iVert) ? 2 : 1; - - x += iHoriz * (_lastKeyRepeat >> 2) / slow * fact; - y += iVert * (_lastKeyRepeat >> 2) / slow * fact; - - x = (x < 0 ) ? 0 : x; - x = (x >= _screenWidth ) ? _screenWidth - 1 : x; - y = (y < 0 ) ? 0 : y; - y = (y >= _screenHeight ) ? _screenHeight - 1 : y; - - *xr = x; - *yr = y; -} diff --git a/backends/platform/PalmOS/Src/be_68k.cpp b/backends/platform/PalmOS/Src/be_68k.cpp deleted file mode 100644 index 77b1e22615..0000000000 --- a/backends/platform/PalmOS/Src/be_68k.cpp +++ /dev/null @@ -1,27 +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$ - * - */ - - -/* More to come */ diff --git a/backends/platform/PalmOS/Src/be_68k.h b/backends/platform/PalmOS/Src/be_68k.h deleted file mode 100644 index 77b1e22615..0000000000 --- a/backends/platform/PalmOS/Src/be_68k.h +++ /dev/null @@ -1,27 +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$ - * - */ - - -/* More to come */ diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp deleted file mode 100644 index b3caee105d..0000000000 --- a/backends/platform/PalmOS/Src/be_base.cpp +++ /dev/null @@ -1,203 +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$ - * - */ - -#include "be_base.h" -#include "common/config-file.h" -#include "common/config-manager.h" -#include "backends/saves/default/default-saves.h" -#include "backends/timer/default/default-timer.h" -#include "backends/fs/palmos/palmos-fs-factory.h" -#include "sound/mixer_intern.h" - -#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved/" - - -OSystem_PalmBase::OSystem_PalmBase() { - _overlayVisible = false; - - _current_shake_pos = 0; - _new_shake_pos = 0; - - _paletteDirtyStart = 0; - _paletteDirtyEnd = 0; - - _gfxLoaded = false; - _modeChanged = false; - _setMode = GFX_NORMAL; - _mode = _setMode; - _redawOSD = false; - _setPalette = true; - - _offScreenH = NULL; - _screenH = NULL; - _offScreenP = NULL; - _screenP = NULL; - _screenPitch = gVars->screenPitch; - - _wasKey = false; - _lastKeyModifier = kModifierNone; - _lastKeyRepeat = 100; - _useNumPad = false; - _showBatLow = false; - _batCheckTicks = SysTicksPerSecond() * 15; - _batCheckLast = TimGetTicks(); - - _saveMgr = 0; - _timerMgr = 0; - _mixerMgr = 0; - - _mouseDataP = NULL; - _mouseBackupP = NULL; - _mouseVisible = false; - _mouseDrawn = false; - MemSet(&_keyExtra, sizeof(_keyExtra), 0); - MemSet(&_mouseCurState, sizeof(_mouseCurState), 0); - MemSet(&_mouseOldState, sizeof(_mouseOldState), 0); - MemSet(&_timer, sizeof(TimerType), 0); - MemSet(&_sound, sizeof(SoundType), 0); - - _keyExtraRepeat = 0; - _keyExtraPressed = 0; - _keyExtraDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25); -} - -static int timer_handler(int t) { - DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager(); - tm->handler(); - return t; -} - -void OSystem_PalmBase::initBackend() { - if (gVars->autoSave != -1) - ConfMan.setInt("autosave_period", gVars->autoSave); - - _keyExtra.bitUp = keyBitPageUp; - _keyExtra.bitDown = keyBitPageDown; - _keyExtra.bitLeft = keyBitHard2; - _keyExtra.bitRight = keyBitHard3; - - int_initBackend(); - _keyExtraMask = (_keyExtra.bitUp | _keyExtra.bitDown | _keyExtra.bitLeft | _keyExtra.bitRight | _keyExtra.bitActionA | _keyExtra.bitActionB); - - // Create the savefile manager, if none exists yet (we check for this to - // allow subclasses to provide their own). - if (_saveMgr == 0) { - _saveMgr = new DefaultSaveFileManager(DEFAULT_SAVE_PATH); - } - - // Create and hook up the mixer, if none exists yet (we check for this to - // allow subclasses to provide their own). - if (_mixerMgr == 0) { - setupMixer(); - } - - // Create and hook up the timer manager, if none exists yet (we check for - // this to allow subclasses to provide their own). - if (_timerMgr == 0) { - _timerMgr = new DefaultTimerManager(); - setTimerCallback(::timer_handler, 10); - } - - OSystem::initBackend(); -} - -void OSystem_PalmBase::getTimeAndDate(TimeDate &td) const { - time_t curTime = time(0); - struct tm t = *localtime(&curTime); - td.tm_sec = t.tm_sec; - td.tm_min = t.tm_min; - td.tm_hour = t.tm_hour; - td.tm_mday = t.tm_mday; - td.tm_mon = t.tm_mon; - td.tm_year = t.tm_year; -} - -uint32 OSystem_PalmBase::getMillis() { - return TimGetTicks() * 1000 / SysTicksPerSecond(); -} - -void OSystem_PalmBase::delayMillis(uint msecs) { - Int32 delay = computeMsecs(msecs); - - if (delay > 0) - SysTaskDelay(delay); -} - -void OSystem_PalmBase::setTimerCallback(TimerProc callback, int timer) { - if (callback != NULL) { - _timer.duration = timer; - _timer.nextExpiry = getMillis() + timer; - _timer.callback = callback; - _timer.active = true; - } else { - _timer.active = false; - } -} - -void OSystem_PalmBase::quit() { - int_quit(); - clearSoundCallback(); - unload_gfx_mode(); - - if (_mouseDataP) { - MemPtrFree(_mouseBackupP); - MemPtrFree(_mouseDataP); - } - - delete _saveMgr; - delete _timerMgr; - delete _mixerMgr; - - exit(0); -} - -Common::SaveFileManager *OSystem_PalmBase::getSavefileManager() { - return _saveMgr; -} - -Audio::Mixer *OSystem_PalmBase::getMixer() { - return _mixerMgr; -} - -Common::TimerManager *OSystem_PalmBase::getTimerManager() { - return _timerMgr; -} - -FilesystemFactory *OSystem_PalmBase::getFilesystemFactory() { - return &PalmOSFilesystemFactory::instance(); -} - - -#define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini" - -Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() { - Common::FSNode file(PALMOS_CONFIG_FILE); - return file.createReadStream(); -} - -Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() { - Common::FSNode file(PALMOS_CONFIG_FILE); - return file.createWriteStream(); -} diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h deleted file mode 100644 index 1885114ace..0000000000 --- a/backends/platform/PalmOS/Src/be_base.h +++ /dev/null @@ -1,265 +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$ - * - */ - -#ifndef BE_BASE_H -#define BE_BASE_H - -#include - -#include "PalmVersion.h" -#include "globals.h" - -#include "backends/base-backend.h" -#include "common/scummsys.h" -#include "common/events.h" -#include "graphics/surface.h" -#include "graphics/colormasks.h" - -namespace Audio { - class MixerImpl; -} - -namespace Common { - class SaveFileManager; - class TimerManager; -} - -enum { - GFX_NORMAL = 0, - GFX_WIDE, -}; - -// OSD key state -enum { - kModifierNone = 0, - kModifierCommand, - kModifierAlt, - kModifierCtrl, - kModifierCount -}; - -// Mouse button event -enum { - vchrMouseLeft = vchrHardKeyMax - 2, - vchrMouseRight = vchrHardKeyMax - 1 -}; - -// OSD resource id -#define kDrawKeyState 3000 -#define kDrawNumPad 3010 -#define kDrawBatLow 3020 -#define kDrawFight 3030 - -#define computeMsecs(x) ((SysTicksPerSecond() * x) / 1000) - - -//typedef void (*SoundProc)(void *param, byte *buf, int len); -typedef void (*SoundProc)(byte *buf, uint len); -typedef int (*TimerProc)(int interval); - -typedef struct { - UInt32 duration, nextExpiry; - Boolean active; - TimerProc callback; -} TimerType, *TimerPtr; - -typedef struct { - Boolean active; - void *proc; - void *param; -} SoundType, *SoundPtr; - -class OSystem_PalmBase : public BaseBackend { -private: - virtual void int_initBackend() { } - - virtual const GraphicsMode *int_getSupportedGraphicsModes() const; - virtual void int_updateScreen() = 0; - virtual void int_initSize(uint w, uint h) = 0; - virtual void int_setShakePos(int shakeOffset) { } - - virtual void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b) { } - virtual void int_quit() { } - - virtual void unload_gfx_mode() = 0; - virtual void load_gfx_mode() = 0; - - virtual void draw_mouse() = 0; - virtual void undraw_mouse() = 0; - - virtual bool check_event(Common::Event &event, EventPtr ev) = 0; - - virtual void timer_handler(); - void battery_handler(); - virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0; - void simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr); - - virtual void sound_handler() = 0; - virtual bool setupMixer() = 0; - virtual void clearSoundCallback() = 0; - -protected: - OSystem_PalmBase(); - - virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - virtual void clear_screen() = 0; - - struct MousePos { - int16 x,y,w,h; - }; - - TimerType _timer; - SoundType _sound; - - Common::SaveFileManager *_saveMgr; - Audio::MixerImpl *_mixerMgr; - Common::TimerManager *_timerMgr; - - RGBColorType _currentPalette[256]; - uint _paletteDirtyStart, _paletteDirtyEnd; - - int _mode, _setMode; - int16 _screenWidth, _screenHeight; - Boolean _modeChanged, _gfxLoaded; - UInt32 _screenPitch; - - PointType _screenOffset; - struct { - Coord w, h; - } _screenDest; - byte *_screenP, *_offScreenP; - WinHandle _screenH, _offScreenH; - - int _current_shake_pos; - int _new_shake_pos; - - Boolean _overlayVisible; - Boolean _redawOSD, _setPalette; - - UInt32 _keyExtraMask, _keyExtraPressed, _keyExtraRepeat, _keyExtraDelay; - struct { - UInt32 bitUp; - UInt32 bitDown; - UInt32 bitLeft; - UInt32 bitRight; - UInt32 bitActionA; // left mouse button - UInt32 bitActionB; // right mouse button - } _keyExtra; - - bool _mouseVisible; - bool _mouseDrawn; - MousePos _mouseCurState; - MousePos _mouseOldState; - int16 _mouseHotspotX; - int16 _mouseHotspotY; - byte _mouseKeyColor; - byte *_mouseDataP, *_mouseBackupP; - - - bool _wasKey; - UInt8 _lastKeyModifier; - UInt32 _lastKeyRepeat; - Boolean _useNumPad, _showBatLow; - UInt32 _batCheckTicks, _batCheckLast; - -public: - void initBackend(); - -/* - virtual void setFeatureState(Feature f, bool enable) {}; - - - bool hasFeature(Feature f); - bool getFeatureState(Feature f); - - virtual void beginGFXTransaction(); - virtual void endGFXTransaction(); - - virtual int16 getOverlayHeight(); - virtual int16 getOverlayWidth(); - - virtual void setCursorPalette(const byte *colors, uint start, uint num); - virtual void disableCursorPalette(bool disable); - - virtual void displayMessageOnOSD(const char *msg); -*/ - const GraphicsMode *getSupportedGraphicsModes() const; - int getGraphicsMode() const; - virtual int getDefaultGraphicsMode() const; - virtual bool setGraphicsMode(int mode); - - void initSize(uint w, uint h, const Graphics::PixelFormat *format); - int16 getWidth() { return _screenWidth; } - int16 getHeight() { return _screenHeight; } - - void setShakePos(int shakeOffset); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; - virtual void updateScreen(); - - bool showMouse(bool visible); - void warpMouse(int x, int y); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); - - virtual void showOverlay() = 0; - virtual void hideOverlay() = 0; - virtual void clearOverlay() = 0; - virtual void grabOverlay(OverlayColor *buf, int pitch) = 0; - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0; - - int16 getOverlayWidth() { return getWidth(); } - int16 getOverlayHeight() { return getHeight(); } - - void setPalette(const byte *colors, uint start, uint num); - void grabPalette(byte *colors, uint start, uint num); - virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); } - - bool pollEvent(Common::Event &event); - - - void getTimeAndDate(TimeDate& td) const; - virtual uint32 getMillis(); - virtual void delayMillis(uint msecs); - - virtual void setTimerCallback(TimerProc callback, int interval); - - virtual MutexRef createMutex() { return NULL; } - virtual void lockMutex(MutexRef mutex) {} - virtual void unlockMutex(MutexRef mutex) {} - virtual void deleteMutex(MutexRef mutex) {} - - virtual Audio::Mixer *getMixer(); - - void quit(); - virtual void setWindowCaption(const char *caption) = 0; - - Common::SaveFileManager *getSavefileManager(); - Common::TimerManager *getTimerManager(); - FilesystemFactory *getFilesystemFactory(); - - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); -}; - -#endif diff --git a/backends/platform/PalmOS/Src/be_os5.cpp b/backends/platform/PalmOS/Src/be_os5.cpp deleted file mode 100644 index c9ef9ecf7c..0000000000 --- a/backends/platform/PalmOS/Src/be_os5.cpp +++ /dev/null @@ -1,169 +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$ - * - */ - -#include "be_os5.h" -#include - -OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() { - _sound.active = false; - _setPalette = false; - - _workScreenH = NULL; - _overlayH = NULL; - _isSwitchable = false; - _wasRotated = false; - _cursorPaletteDisabled = true; - - MemSet(&_soundEx, sizeof(SoundExType), 0); - _soundEx.sound = &_sound; -} - -void OSystem_PalmOS5::calc_scale() { - for (int y = 0; y < _screenDest.h; y++) { - int ys = y * _screenHeight / _screenDest.h; - _scaleTableY[y] = ys * _screenWidth; - } - - for (int x = 0; x < _screenDest.w; x++) { - int xs = x * _screenWidth / _screenDest.w; - _scaleTableX[x] = xs; - } -} - -void OSystem_PalmOS5::calc_rect(Boolean fullscreen) { - Int32 w, h; - - if (fullscreen) { - w = (_ratio.adjustAspect == kRatioWidth) ? _ratio.width : gVars->screenFullWidth; - h = (_ratio.adjustAspect == kRatioHeight) ? _ratio.height : gVars->screenFullHeight; - - _screenOffset.x = (_ratio.adjustAspect == kRatioWidth) ? (gVars->screenFullWidth - _ratio.width) / 2 : 0; - _screenOffset.y = (_ratio.adjustAspect == kRatioHeight) ? (gVars->screenFullHeight - _ratio.height) / 2 : 0; - - } else { - w = gVars->screenWidth; - h = gVars->screenHeight * _screenHeight / _screenWidth; - - _screenOffset.x = 0; - _screenOffset.y = (gVars->screenHeight - h) / 2; - } - - _screenDest.w = w; - _screenDest.h = h; -} - -void OSystem_PalmOS5::int_initBackend() { - _keyExtra.bitUp = keyBitRockerUp|keyBitPageUp; - _keyExtra.bitDown = keyBitRockerDown|keyBitPageDown; - _keyExtra.bitLeft = keyBitRockerLeft; - _keyExtra.bitRight = keyBitRockerRight; - _keyExtra.bitActionA = keyBitHard3; - _keyExtra.bitActionB = keyBitHard4; -} - -bool OSystem_PalmOS5::hasFeature(Feature f) { - switch (f) { - case kFeatureCursorHasPalette: - return true; - } - - return false; -} - -void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) { - switch (f) { -/* case kFeatureFullscreenMode: - if (_gfxLoaded) - if (OPTIONS_TST(kOptModeWide) && _initMode != GFX_WIDE) { - _fullscreen = enable; - hotswap_gfx_mode(_mode); - } - break; -*/ - case kFeatureAspectRatioCorrection: - if (_mode == GFX_WIDE) { - _ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3; - //calc_rect(true); - hotswap_gfx_mode(_mode); -// TwGfxSetClip(_palmScreenP, &_dstRect); - clear_screen(); - } - break; - } -} - -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; - const Char *loading = "Loading, please wait\0"; - - // allocate bitmap - BitmapTypeV3 *bmp2P; - BitmapType *bmp1P = BmpCreate(320, (h * 3), 8, NULL, &e); - WinHandle tmpH = WinCreateBitmapWindow(bmp1P, &e); - - WinSetDrawWindow(tmpH); - WinSetBackColor(0); - WinSetTextColor(255); - WinEraseWindow(); - - // loading message - FntSetFont(boldFont); - w = FntCharsWidth(loading, StrLen(loading)); - w = (320 - w) / 2; - WinDrawChars(loading, StrLen(loading), w, 0 + h); - - // caption - FntSetFont(stdFont); - w = FntCharsWidth(caption, StrLen(caption)); - w = (320 - w) / 2; - WinDrawChars(caption, StrLen(caption), w, 0); - - // memory size - StrPrintF(buf, "memory : %ld KB", gVars->startupMemory); - w = FntCharsWidth(buf, StrLen(buf)); - w = (320 - w) / 2; - WinDrawChars(buf, StrLen(buf), w, h * 2); - - // set the bitmap as v3 - bmp2P = BmpCreateBitmapV3(bmp1P, kDensityDouble, BmpGetBits(bmp1P), NULL); - y = (80 - (h / 4) - 5); - - // draw it - WinSetDrawWindow(WinGetDisplayWindow()); - WinEraseWindow(); - WinDrawBitmap((BitmapPtr)bmp2P, 0, y); - - // free - WinDeleteWindow(tmpH, 0); - BmpDelete((BitmapPtr)bmp2P); - BmpDelete(bmp1P); -} diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h deleted file mode 100644 index 2040c7faea..0000000000 --- a/backends/platform/PalmOS/Src/be_os5.h +++ /dev/null @@ -1,189 +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$ - * - */ - -#ifndef BE_OS5_H -#define BE_OS5_H - -#include "be_base.h" - -#if !defined(SYSTEM_CALLBACK) || defined(PALMOS_68K) -# define SYSTEM_CALLBACK -# ifdef PALMOS_ARM -# define CALLBACK_PROLOGUE \ - __asm { \ - stmfd r13!,{r9,r10}; \ - ldr r9,[r0]; \ - ldr r10,[r0,#4]; \ - } -# define CALLBACK_EPILOGUE __asm { ldmfd r13!,{r9,r10} } -# define CALLBACK_INIT(regs) \ - __asm { \ - ldr r0, = regs; \ - add r0,r0,r10; \ - str r9,[r0]; \ - str r10,[r0,#4]; \ - } -# else -# define CALLBACK_PROLOGUE \ - asm ( \ - movem.l a4-a5, -(sp); \ - move.l UserDataP, a0; \ - move.l 0(a0), a4; \ - move.l 4(a0), a5; \ - ); -# define CALLBACK_EPILOGUE asm ( movem.l (sp)+, a4-a5 ); -# define CALLBACK_INIT(regs) \ - { \ - void *ptr = ®s; \ - asm ( \ - move.l ptr, a0; \ - move.l a4, 0(a0); \ - move.l a5, 4(a0); \ - ); \ - } -# endif -#else -# define CALLBACK_PROLOGUE -# define CALLBACK_EPILOGUE -# define CALLBACK_INIT(regs) -#endif - -// TODO : change / remove this -#define gfxMakeDisplayRGB_BigEndian(_r,_g,_b) \ - ( (((_g) & 0xFC) << 11) | (((_b) & 0xF8) << 5) | ((_r) & 0xF8) | (((_g) & 0xFF) >> 5) ) - -#define gfxMakeDisplayRGB_LittleEndian(_r,_g,_b) \ - ( (((_r) & 0xF8) << 8) | (((_g) & 0xFC) << 3) | (((_b) & 0xF8) >> 3) ) - -#if CPU_TYPE == CPU_68K -#define gfxMakeDisplayRGB(_r,_g,_b) gfxMakeDisplayRGB_BigEndian(_r,_g,_b) -#else -#define gfxMakeDisplayRGB(_r,_g,_b) gfxMakeDisplayRGB_LittleEndian(_r,_g,_b) -#endif - -typedef struct { - // for real thread version only - UInt32 __reg1; - UInt32 __reg2; - - // no real thread version - Boolean set; - UInt32 size; - void *dataP; - - // default sound stuff - SndStreamRef handle; - SoundPtr sound; -} SoundExType, *SoundExPtr; -extern SoundExType _soundEx; - -class OSystem_PalmOS5 : public OSystem_PalmBase { -protected: - uint16 _nativePal[256], _mousePal[256]; - -private: - uint16 _scaleTableX[512]; - uint32 _scaleTableY[512]; - - typedef void (OSystem_PalmOS5::*RendererProc)(RectangleType &r, PointType &p); - RendererProc _render; - - Graphics::Surface _framebuffer; - - OverlayColor *_overlayP; - WinHandle _overlayH, _workScreenH; - uint16 *_workScreenP; - - Boolean _isSwitchable, _wasRotated; - - virtual void int_initBackend(); - virtual void int_updateScreen(); - virtual void int_initSize(uint w, uint h); - - virtual void unload_gfx_mode(); - virtual void load_gfx_mode(); - virtual void hotswap_gfx_mode(int mode); - - void draw_mouse(); - void undraw_mouse(); - virtual bool check_event(Common::Event &event, EventPtr ev); - void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b); - void calc_scale(); - - void render_landscapeAny(RectangleType &r, PointType &p); - void render_landscape15x(RectangleType &r, PointType &p); - void render_1x(RectangleType &r, PointType &p); - WinHandle alloc_screen(Coord w, Coord h); - virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - - virtual SndStreamVariableBufferCallback sound_callback(); - virtual void sound_handler(); - virtual bool setupMixer(); - void clearSoundCallback(); - -protected: - UInt16 _sysOldCoord, _sysOldOrientation, _sysOldTriggerState; - Boolean _stretched, _cursorPaletteDisabled; - - enum { - kRatioNone = 0, - kRatioHeight, - kRatioWidth - }; - struct { - UInt8 adjustAspect; - Coord width; // (width x 320) - Coord height; // (480 x height) - } _ratio; - - void calc_rect(Boolean fullscreen); - void get_coordinates(EventPtr ev, Coord &x, Coord &y); - void clear_screen(); - -public: - OSystem_PalmOS5(); - static OSystem *create(); - - bool hasFeature(Feature f); - void setFeatureState(Feature f, bool enable); - - void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); - virtual Graphics::Surface *lockScreen(); - virtual void unlockScreen(); - - void setCursorPalette(const byte *colors, uint start, uint num); - void disableCursorPalette(bool disable); - - void showOverlay(); - void hideOverlay(); - virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); - - void setWindowCaption(const char *caption); - -}; - -#endif diff --git a/backends/platform/PalmOS/Src/be_os5ex.cpp b/backends/platform/PalmOS/Src/be_os5ex.cpp deleted file mode 100644 index 05bf5e49ce..0000000000 --- a/backends/platform/PalmOS/Src/be_os5ex.cpp +++ /dev/null @@ -1,103 +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$ - * - */ - -// for DAL.h -#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS - -#include "be_os5ex.h" -#include "palmdefs.h" - -#include -#include - -static TimerExType _timerEx; - -OSystem_PalmOS5Ex::OSystem_PalmOS5Ex() : OSystem_PalmOS5() { - _timerEx.timerID = 0; - _timerEx.timer = &_timer; - _timerEx.ticks = SysTicksPerSecond(); -} - -static SYSTEM_CALLBACK void timer_handler(void *userDataP) { - CALLBACK_PROLOGUE - TimerExPtr _timerEx = (TimerExPtr)userDataP; - TimerPtr _timer = _timerEx->timer; - _timer->duration = _timer->callback(_timer->duration); - KALTimerSet(_timerEx->timerID, (_timer->duration * _timerEx->ticks / 1000)); - CALLBACK_EPILOGUE -} - -void OSystem_PalmOS5Ex::setTimerCallback(TimerProc callback, int timer) { - if (_timer.active && _timerEx.timerID) - KALTimerDelete(_timerEx.timerID); - - if (callback != NULL) { - Err e; - CALLBACK_INIT(_timerEx); - _timer.duration = timer; - _timer.callback = callback; - - // create the timer - e = KALTimerCreate(&_timerEx.timerID, appFileCreator, &::timer_handler, &_timerEx); - if (!e) { - e = KALTimerSet(_timerEx.timerID, (timer * _timerEx.ticks / 1000)); - if (e) KALTimerDelete(_timerEx.timerID); - } - _timer.active = (!e); - - } else { - _timer.active = false; - } - - if (!_timer.active) - _timerEx.timerID = 0; -} - -OSystem::MutexRef OSystem_PalmOS5Ex::createMutex() { - UInt32 mutexID; - Err e = KALMutexCreate(&mutexID, appFileCreator); - return (MutexRef)(e ? NULL : mutexID); - -} - -void OSystem_PalmOS5Ex::lockMutex(MutexRef mutex) { - if (mutex) - KALMutexReserve((UInt32)mutex); -} - -void OSystem_PalmOS5Ex::unlockMutex(MutexRef mutex) { - if (mutex) - KALMutexRelease((UInt32)mutex, 0); -} - -void OSystem_PalmOS5Ex::deleteMutex(MutexRef mutex) { - if (mutex) - KALMutexDelete((UInt32)mutex); -} - -void OSystem_PalmOS5Ex::int_quit() { - if (_timerEx.timerID) - KALTimerDelete(_timerEx.timerID); -} diff --git a/backends/platform/PalmOS/Src/be_os5ex.h b/backends/platform/PalmOS/Src/be_os5ex.h deleted file mode 100644 index f9842d82ac..0000000000 --- a/backends/platform/PalmOS/Src/be_os5ex.h +++ /dev/null @@ -1,68 +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$ - * - */ - -#ifndef BE_OS5EX_H -#define BE_OS5EX_H - -#include "be_os5.h" - -#undef dprintf // fix compilation in Zodiac mode - -#ifndef PALMOS_ARM -// Not usable with 68k mode (?), so ... -#define OSystem_PalmOS5Ex OSystem_PalmOS5 -#else - -typedef struct { - UInt32 __r9; - UInt32 __r10; - UInt32 timerID; - UInt32 ticks; - - TimerPtr timer; -} TimerExType, *TimerExPtr; - -class OSystem_PalmOS5Ex : public OSystem_PalmOS5 { -private: - void timer_handler() {} - void sound_handler() {} - void int_quit(); - - SndStreamVariableBufferCallback sound_callback(); - -public: - OSystem_PalmOS5Ex(); - static OSystem *create(); - - void setTimerCallback(TimerProc callback, int interval); - - MutexRef createMutex(); - void lockMutex(MutexRef mutex); - void unlockMutex(MutexRef mutex); - void deleteMutex(MutexRef mutex); -}; -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/be_zodiac.cpp b/backends/platform/PalmOS/Src/be_zodiac.cpp deleted file mode 100644 index d6e7e2c292..0000000000 --- a/backends/platform/PalmOS/Src/be_zodiac.cpp +++ /dev/null @@ -1,74 +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$ - * - */ - -#include "be_zodiac.h" - -OSystem_PalmZodiac::OSystem_PalmZodiac() : OSystem_PalmOS5Ex() { - _gfxH = NULL; - _overlayP = NULL; - _palmScreenP = NULL; - _tmpScreenP = NULL; - _stretched = false; -} - -void OSystem_PalmZodiac::int_initBackend() { - _keyExtra.bitUp = keyBitRockerUp; - _keyExtra.bitDown = keyBitRockerDown; - _keyExtra.bitLeft = keyBitRockerLeft; - _keyExtra.bitRight = keyBitRockerRight; - -// _keyExtra.bitActionA = keyBitActionD; -// _keyExtra.bitActionB = keyBitActionB; -} - -void OSystem_PalmZodiac::calc_rect(Boolean fullscreen) { - OSystem_PalmOS5::calc_rect(fullscreen); - - _dstRect.x = _screenOffset.x; - _dstRect.y = _screenOffset.y; - _dstRect.w = _screenDest.w; - _dstRect.h = _screenDest.h; -} - -void OSystem_PalmZodiac::setFeatureState(Feature f, bool enable) { - switch (f) { -/* case kFeatureFullscreenMode: - if (_gfxLoaded) - if (OPTIONS_TST(kOptModeWide) && _initMode != GFX_WIDE) { - _fullscreen = enable; - hotswap_gfx_mode(_mode); - } - break; -*/ - case kFeatureAspectRatioCorrection: - if (_mode == GFX_WIDE) { - _ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3; - calc_rect(true); - TwGfxSetClip(_palmScreenP, &_dstRect); - clear_screen(); - } - break; - } -} diff --git a/backends/platform/PalmOS/Src/be_zodiac.h b/backends/platform/PalmOS/Src/be_zodiac.h deleted file mode 100644 index 28fcf29ddd..0000000000 --- a/backends/platform/PalmOS/Src/be_zodiac.h +++ /dev/null @@ -1,76 +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$ - * - */ - -#ifndef BE_ZODIAC_H -#define BE_ZODIAC_H - -#include -#include "be_os5ex.h" - -#define MIN_OFFSET 20 - -class OSystem_PalmZodiac : public OSystem_PalmOS5Ex { -private: - - TwGfxType *_gfxH; - TwGfxSurfaceType *_palmScreenP, *_tmpScreenP; - TwGfxSurfaceType *_overlayP; - Boolean _fullscreen; - - TwGfxPointType _srcPos; - TwGfxRectType _srcRect, _dstRect; - TwGfxBitmapType _srcBmp; - - void int_initBackend(); - void int_setShakePos(int shakeOffset); - - void draw_mouse(); - void undraw_mouse(); - - void unload_gfx_mode(); - void load_gfx_mode(); - void hotswap_gfx_mode(int mode); - - void calc_rect(Boolean fullscreen); - bool check_event(Common::Event &event, EventPtr ev); - void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - -public: - OSystem_PalmZodiac(); - - static OSystem *create(); - - void setFeatureState(Feature f, bool enable); - - int getDefaultGraphicsMode() const; - - void updateScreen(); - - void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_aeroplayer.cpp b/backends/platform/PalmOS/Src/cd_aeroplayer.cpp deleted file mode 100644 index c30fba595c..0000000000 --- a/backends/platform/PalmOS/Src/cd_aeroplayer.cpp +++ /dev/null @@ -1,166 +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$ - * - */ - -#include "common/system.h" -#include "common/config-manager.h" - -#include "cd_aeroplayer.h" - -AeroCDPlayer::AeroCDPlayer(OSystem *sys) { - _sys = sys; - StrCopy(gameP, ConfMan.getActiveDomainName().c_str()); -} - -bool AeroCDPlayer::init() { - aeroplayer_Startup(); - _isInitialized = aeroplayer_PlayerIsActive(); - - if (_isInitialized) - _volumeLimit = aeroplayer_GetMaxVolumeIndex(); - - return _isInitialized; -} - -void AeroCDPlayer::release() { - aeroplayer_Shutdown(); - - // self delete - delete this; -} - -UInt32 AeroCDPlayer::getStatus() { - return aeroplayer_GetPlaybackStatus(); -} - -UInt32 AeroCDPlayer::getPosition() { - return aeroplayer_GetPosition_msec(); -} - -UInt32 AeroCDPlayer::getDuration() { - return aeroplayer_GetDuration_msec(); -} - -void AeroCDPlayer::setPosition(UInt32 value) { - aeroplayer_Seek_abs_msec(value); -} - -void AeroCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - aeroplayer_SetVolumeIndex((_volumeLimit * volume) / 100); -} - -bool AeroCDPlayer::poll() { - return - ( _pckLoops != 0 && - ( getPosition() < _pckTrackEndFrame && - getStatus() == AEROPLAYER_STATUS_PLAY - ) - ); -} - -void AeroCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_pckStopTime != 0 && _sys->getMillis() >= _pckStopTime) { - forceStop(); - _pckLoops = 0; - _pckStopTime = 0; - _pckTrackEndFrame = 0; - return; - } - - // not fully played - if (getPosition() < _pckTrackEndFrame && getStatus() == AEROPLAYER_STATUS_PLAY) - return; - - aeroplayer_Pause(); -// _pckStopTime = _sys->getMillis(); - - // loop again ? - if (_pckLoops > 0) - _pckLoops--; - - // loop if needed - if (_pckLoops == 0) - forceStop(); - else { - //_pckStopTime = 0; - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - setPosition(0); - } else { - setPosition(_pckTrackStartFrame); - } - - aeroplayer_Play(); - _pckEndTime = _sys->getMillis() + _pckTrackDuration; - } -} - -void AeroCDPlayer::stop() { - _pckStopTime = _sys->getMillis(); - _pckLoops = 0; - return; -} - -void AeroCDPlayer::forceStop() { - if (getStatus() != AEROPLAYER_STATUS_STOP) - aeroplayer_PlayTrack(vfsInvalidVolRef, NULL); -} - -void AeroCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - Char fileP[100]; - static const Char *ext[] = { "mp3", "ogg" }; - -// if (duration > 0) -// duration += 5; - - _pckTrack = track; - _pckLoops = num_loops; - _pckTrackStartFrame = TO_MSECS(start_frame); - _pckTrackDuration = TO_MSECS(duration); - - StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]); - aeroplayer_Pause(); - aeroplayer_PlayTrack(gVars->VFS.volRefNum, fileP); - aeroplayer_Pause(); - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - _pckTrackDuration = getDuration(); - } else { - setPosition(_pckTrackStartFrame); - if (_pckTrackDuration == 0) - _pckTrackDuration = getDuration() - _pckTrackStartFrame; - } - - aeroplayer_Play(); - - _pckStopTime = 0; - _pckTrackEndFrame = _pckTrackStartFrame + _pckTrackDuration; - _pckEndTime = _sys->getMillis() + _pckTrackDuration; -} diff --git a/backends/platform/PalmOS/Src/cd_aeroplayer.h b/backends/platform/PalmOS/Src/cd_aeroplayer.h deleted file mode 100644 index e661e06d52..0000000000 --- a/backends/platform/PalmOS/Src/cd_aeroplayer.h +++ /dev/null @@ -1,65 +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$ - * - */ - -#ifndef CD_AEROPLAYER_H -#define CD_AEROPLAYER_H - -#include "cdaudio.h" -#include "aeroplayer_public.h" - -class AeroCDPlayer : public CDAudio { -public: - AeroCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - -private: - OSystem *_sys; - Char gameP[15]; - - UInt32 getStatus(); - void setPosition(UInt32 value); - UInt32 getDuration(); - UInt32 getPosition(); - void forceStop(); - - UInt16 _volumeLimit; - - Boolean _isPlaying; - // cdrom - UInt16 _pckLoops, _pckTrack; - UInt32 _pckTrackStartFrame, _pckTrackEndFrame; - UInt32 _pckStopTime, _pckEndTime, _pckTrackDuration; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_default.cpp b/backends/platform/PalmOS/Src/cd_default.cpp deleted file mode 100644 index 416701524d..0000000000 --- a/backends/platform/PalmOS/Src/cd_default.cpp +++ /dev/null @@ -1,104 +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$ - * - */ -#include "common/system.h" -#include "cd_default.h" - -DefaultCDPlayer::DefaultCDPlayer(OSystem *sys) { - _sys = sys; -} - -bool DefaultCDPlayer::init() { - _isInitialized = true; - return _isInitialized; -} - -void DefaultCDPlayer::release() { - // self delete - delete this; -} - -bool DefaultCDPlayer::poll() { - return (_defLoops != 0 && _sys->getMillis() < _defTrackEndFrame); -} - -void DefaultCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_defStopTime != 0 && _sys->getMillis() >= _defStopTime) { - _defLoops = 0; - _defStopTime = 0; - _defTrackEndFrame = 0; - return; - } - - // not fully played - if (_sys->getMillis() < _defTrackEndFrame) - return; - - if (_defLoops == 0) - return; - - // loop again ? - if (_defLoops > 0) - _defLoops--; - - // loop if needed - if (_defLoops != 0) { - _defTrackEndFrame = _sys->getMillis() + _defTrackLength; - } -} - -void DefaultCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - _defStopTime = _sys->getMillis() + 100; - _defLoops = 0; - return; -} - -void DefaultCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - UInt32 fullLength; - - _defLoops = num_loops; - start_frame = TO_MSECS(start_frame); - duration = TO_MSECS(duration); - - // frame in milli-seconds - _defStopTime = 0; - fullLength = start_frame + gVars->CD.defaultTrackLength * 1000; - - if (duration > 0) { - _defTrackLength = duration; - } else if (start_frame > 0) { - _defTrackLength = fullLength; - _defTrackLength -= start_frame; - } else { - _defTrackLength = fullLength; - } - - // try to play the track - _defTrackEndFrame = _sys->getMillis() + _defTrackLength; -} diff --git a/backends/platform/PalmOS/Src/cd_default.h b/backends/platform/PalmOS/Src/cd_default.h deleted file mode 100644 index 69d909b1e7..0000000000 --- a/backends/platform/PalmOS/Src/cd_default.h +++ /dev/null @@ -1,51 +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$ - * - */ - - #ifndef CD_DEFAULT_H - #define CD_DEFAULT_H - - #include "cdaudio.h" - - class DefaultCDPlayer : public CDAudio { - public: - DefaultCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - private: - OSystem *_sys; - - // cdrom - UInt16 _defLoops; - UInt32 _defStopTime, _defTrackEndFrame, _defTrackLength; - }; - - #endif diff --git a/backends/platform/PalmOS/Src/cd_msa.cpp b/backends/platform/PalmOS/Src/cd_msa.cpp deleted file mode 100644 index 5812d49b6d..0000000000 --- a/backends/platform/PalmOS/Src/cd_msa.cpp +++ /dev/null @@ -1,261 +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$ - * - */ -#include -#include "common/system.h" -#include "cd_msa.h" -#include "start.h" // for appFileCreat - -static void doErr(Err e, const Char *msg) { - Char err[100]; - StrPrintF(err, "%ld : " , e); - StrCat(err,msg); - FrmCustomAlert(1000,err,0,0); -} - -MsaCDPlayer::MsaCDPlayer(OSystem *sys) { - _sys = sys; - _msaRefNum = sysInvalidRefNum; - - _msaLoops = 0; - _msaStopTime = 0; - _msaTrackEndSu = 0; -} - -bool MsaCDPlayer::init() { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - Err error = errNone; - - if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - // not found with audio adapter ?! - //if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) { - if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum))) - if (error == sysErrLibNotFound) - error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum); - - // FIXME : still don't understand how this lib works, it seems to be very unstable - // and with the very bad documentation provided by Sony it's difficult to find out why - // this doesn't work the same way on build-in MP3 device and external MP3 devices - if (!error) { - //MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ... - error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum); - - //if (error == msaErrAlreadyOpen) - // error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator); - - //error = (error != msaErrStillOpen) ? error : errNone; - } - //} - } - -// if (error) -// _msaRefNum = sysInvalidRefNum; - - _isInitialized = (_msaRefNum != sysInvalidRefNum); - initInternal(); - return _isInitialized; -} - -void MsaCDPlayer::initInternal() { - if (!_isInitialized) - return; - - Err e; - Char nameP[256]; - UInt32 dummy, albumIterater = albumIteratorStart; - - MemSet(&_msaAlbum, sizeof(_msaAlbum), 0); - _msaAlbum.maskflag = msa_INF_ALBUM; - _msaAlbum.code = msa_LANG_CODE_ASCII; - _msaAlbum.nameP = nameP; - _msaAlbum.fileNameLength = 256; - - e = MsaAlbumEnumerate(_msaRefNum, &albumIterater, &_msaAlbum); - e = MsaSetAlbum(_msaRefNum, _msaAlbum.albumRefNum, &dummy); - - // TODO : use RMC to control volume - MsaOutCapabilityType capability; - MsaOutGetCapability(_msaRefNum, &capability); - _volumeLLimit = capability.volumeLLimit; - _volumeRLimit = capability.volumeRLimit; -} - -void MsaCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - MsaOutSetVolume(_msaRefNum, (_volumeLLimit * volume) / 100, (_volumeRLimit * volume) / 100); -} - -void MsaCDPlayer::release() { - if (_isInitialized) { - if (_msaRefNum != sysInvalidRefNum) { - // stop the current track if any (needed if we use enforce open to prevent the track to play after exit) - MsaStop(_msaRefNum, true); - MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); - } - } - - // self delete - delete this; -} - -bool MsaCDPlayer::poll() { - if (!_isInitialized) - return false; - - MsaPBStatus pb; - MsaGetPBStatus(_msaRefNum, &pb); - return (_msaLoops != 0 && (pb.currentSU < _msaTrackEndSu || pb.status != msa_STOPSTATUS)); -} - -void MsaCDPlayer::update() { - if (!_isInitialized) - return; - - // get playback status - MsaPBStatus pb; - MsaGetPBStatus(_msaRefNum, &pb); - - // stop replay upon request of stopCD() - if (_msaStopTime != 0 && _sys->getMillis() >= _msaStopTime) { - MsaStop(_msaRefNum, true); - _msaLoops = 0; - _msaStopTime = 0; - _msaTrackEndSu = 0; - return; - } - - // not fully played nad still playing the correct track - // (when playing a full track the return SU is not correct - // and so we need to check if we are still playing the correct track) - if (pb.currentSU < _msaTrackEndSu) { - UInt16 trackNo; - MsaPBListIndexToTrackNo(_msaRefNum, pb.currentpblistindex, &trackNo); - if (trackNo == _msaTrack) - return; - } - - MsaStop(_msaRefNum, true); - - if (_msaLoops == 0) - return; - - // track ends and last play, force stop if still playing -/* if (_msaLoops != 1 && pb.status != msa_STOPSTATUS) { - MsaStop(_msaRefNum, true); - return; - } -*/ - // loop again ? - if (_msaLoops > 0) - _msaLoops--; - - // loop if needed - if (_msaLoops != 0) { - if (_msaStartFrame == 0 && _msaDuration == 0) - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - else - MsaPlay(_msaRefNum, _msaTrack, _msaTrackStartSu, msa_PBRATE_SP); - } -} - -void MsaCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - if (!_isInitialized) - return; - - _msaStopTime = _sys->getMillis() + 100; - _msaLoops = 0; - return; -} - -void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!_isInitialized) - return; - - if (!num_loops && !start_frame) - return; - - _msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album) - _msaLoops = num_loops; - _msaStartFrame = TO_MSECS(start_frame); - _msaDuration = TO_MSECS(duration); - - Err e; - MemHandle trackH; - - // stop current play if any - MsaStop(_msaRefNum, true); - _msaStopTime = 0; - - // retreive track infos - e = MsaGetTrackInfo(_msaRefNum, _msaTrack, 0, msa_LANG_CODE_ASCII, &trackH); - - // track exists - if (!e && trackH) { - MsaTime msaTime; - MsaTrackInfo *trackP; - UInt32 SU, fullLength; - - // FIXME (?) : this enable MsaSuToTime to return the right value in some cases - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - MsaStop(_msaRefNum, true); - - // get the msa time - trackP = (MsaTrackInfo *)MemHandleLock(trackH); - MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime); - SU = trackP->totalsu; - MemPtrUnlock(trackP); - MemHandleFree(trackH); - - // MSA frame in milli-seconds - fullLength = FROM_MIN(msaTime.minute); - fullLength += FROM_SEC(msaTime.second); - fullLength += msaTime.frame; - - if (_msaDuration > 0) { - _msaTrackLength = _msaDuration; - } else if (_msaStartFrame > 0) { - _msaTrackLength = fullLength; - _msaTrackLength -= _msaStartFrame; - } else { - _msaTrackLength = fullLength; - } - - // try to play the track - if (start_frame == 0 && duration == 0) { - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - _msaTrackEndSu = SU; - } else { - // FIXME : MsaTimeToSu doesn't work ... (may work with previous FIXME) - _msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU)); - _msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU)); - _msaTrackEndSu += _msaTrackStartSu; - - if (_msaTrackEndSu > SU) - _msaTrackEndSu = SU; - - MsaPlay(_msaRefNum, _msaTrack, _msaTrackStartSu, msa_PBRATE_SP); - } - } - // TODO : use default track length if track not found -} diff --git a/backends/platform/PalmOS/Src/cd_msa.h b/backends/platform/PalmOS/Src/cd_msa.h deleted file mode 100644 index 223bc0efcf..0000000000 --- a/backends/platform/PalmOS/Src/cd_msa.h +++ /dev/null @@ -1,68 +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$ - * - */ - -#ifndef CD_MSA_H -#define CD_MSA_H - -#include "cdaudio.h" - -class MsaCDPlayer : public CDAudio { -public: - MsaCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - - private: - void initInternal(); - - OSystem *_sys; - UInt16 _msaRefNum; - - UInt32 _volumeLLimit; - UInt32 _volumeRLimit; - - // cdrom - AlbumInfoType _msaAlbum; - UInt16 _msaLoops; - - UInt32 _msaStopTime; - - UInt32 _msaStartFrame; - UInt32 _msaDuration; - - UInt16 _msaTrack; - UInt32 _msaTrackStartSu, _msaTrackEndSu; - UInt32 _msaTrackLength; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_pockettunes.cpp b/backends/platform/PalmOS/Src/cd_pockettunes.cpp deleted file mode 100644 index 5a9f3874eb..0000000000 --- a/backends/platform/PalmOS/Src/cd_pockettunes.cpp +++ /dev/null @@ -1,238 +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$ - * - */ -#include "common/system.h" -#include "common/config-manager.h" - -#include "cd_pockettunes.h" - -PckTunesCDPlayer::PckTunesCDPlayer(OSystem *sys) { - _sys = sys; - StrCopy(gameP, ConfMan.getActiveDomainName().c_str()); -} - -bool PckTunesCDPlayer::init() { - PocketTunesStart(); - _isInitialized = PocketTunesIsRunning(); - _isPlaying = false; - _pAction = NULL; - - if (_isInitialized) { - _pAction = (PocketTunesAction*)MemPtrNew(sizeof(PocketTunesAction)); - _volumeLimit = getVolumeLimit(); - } - - _isInitialized = (_isInitialized && _pAction); - return _isInitialized; -} - -void PckTunesCDPlayer::release() { - PocketTunesStop(); - if (_pAction) - MemPtrFree(_pAction); - - // self delete - delete this; -} - -UInt32 PckTunesCDPlayer::getVolumeLimit() { - UInt32 value = 0; - - if (!_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueMaxVolume; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -UInt32 PckTunesCDPlayer::getStatus() { - UInt32 status = kPtunesStopped; - - if (!_isPlaying || !_pAction) - return status; - - _pAction->action = kPocketTunesActionGetStatus; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - status = _pAction->data.getStatusAction.status; - - return status; -} - -UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) { - UInt32 value = deflt; - - if (!_isPlaying || !_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueSongPosition; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -UInt32 PckTunesCDPlayer::getDuration() { - UInt32 value = gVars->CD.defaultTrackLength; - - if (!_isPlaying || !_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueSongDuration; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -void PckTunesCDPlayer::setPosition(UInt32 value) { - if (!_isPlaying) - return; - - PocketTunesAction *pAction = AllocateAsynchronousActionStruct(); - if (!pAction) - return; - - pAction->action = kPocketTunesActionSetValue; - pAction->data.getValueAction.which = kPtunesValueSongPosition; - pAction->data.getValueAction.value = value; - - EvtGetEvent(&_eAction, evtNoWait); - PocketTunesCall(pAction); -} - -void PckTunesCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - - PocketTunesAction *pAction = AllocateAsynchronousActionStruct(); - if (!pAction) - return; - - pAction->action = kPocketTunesActionSetValue; - pAction->data.getValueAction.which = kPtunesValueVolume; - pAction->data.getValueAction.value = (_volumeLimit * volume) / 100; - - EvtGetEvent(&_eAction, evtNoWait); - PocketTunesCall(pAction); -} - -bool PckTunesCDPlayer::poll() { - return (_pckLoops != 0 && (getPosition(_pckTrackEndFrame) < _pckTrackEndFrame || getStatus() != kPtunesStopped)); -} - -void PckTunesCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_pckStopTime != 0 && _sys->getMillis() >= _pckStopTime) { - PocketTunesStop(); - _pckLoops = 0; - _pckStopTime = 0; - _pckTrackEndFrame = 0; - return; - } - - // not fully played - if (getPosition(_pckTrackEndFrame) < _pckTrackEndFrame && getStatus() != kPtunesStopped) - return; - - PocketTunesStop(); - - if (_pckLoops == 0) - return; - - // loop again ? - if (_pckLoops > 0) - _pckLoops--; - - // loop if needed - if (_pckLoops != 0 && _isPlaying) { - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - setPosition(0); - } else { - setPosition(_pckTrackStartFrame); - } - - PocketTunesPlay(); - } -} - -void PckTunesCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - _pckStopTime = _sys->getMillis() + 100; - _pckLoops = 0; - return; -} - -void PckTunesCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - EventType e; - Char nameP[256], fileP[100]; - static const Char *ext[] = { "mp3", "ogg" }; - - _pckTrack = track; - _pckLoops = num_loops; - _pckTrackStartFrame = TO_MSECS(start_frame); - _pckTrackDuration = TO_MSECS(duration); - - VFSVolumeGetLabel(gVars->VFS.volRefNum, nameP, 256); - - StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]); - - if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) { - EvtGetEvent(&e, evtNoWait); - PocketTunesPauseIfPlaying(); - _isPlaying = true; - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - _pckTrackDuration = getDuration(); - } else { - setPosition(_pckTrackStartFrame); - if (_pckTrackDuration == 0) - _pckTrackDuration = getDuration() - _pckTrackStartFrame; - } - - PocketTunesPlay(); - - } else { - _isPlaying = false; - _pckTrackDuration = gVars->CD.defaultTrackLength * 1000; - } - - _pckStopTime = 0; - _pckTrackEndFrame = _pckTrackStartFrame + _pckTrackDuration; -} diff --git a/backends/platform/PalmOS/Src/cd_pockettunes.h b/backends/platform/PalmOS/Src/cd_pockettunes.h deleted file mode 100644 index 77938d846a..0000000000 --- a/backends/platform/PalmOS/Src/cd_pockettunes.h +++ /dev/null @@ -1,69 +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$ - * - */ - - #ifndef CD_POCKETTUNES_H - #define CD_POCKETTUNES_H - - #include "cdaudio.h" - #include "pockettunes.h" - - class PckTunesCDPlayer : public CDAudio { - public: - PckTunesCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - - private: - OSystem *_sys; - Char gameP[15]; - - PocketTunesAction *_pAction; // prevent memory fragmentation - EventType _eAction; - - UInt32 getStatus(); - void setPosition(UInt32 value); - UInt32 getDuration(); - UInt32 getPosition(UInt32 deft); - - UInt32 _volumeLimit; - UInt32 getVolumeLimit(); - - Boolean _isPlaying; - // cdrom - UInt16 _pckLoops, _pckTrack; - UInt32 _pckTrackStartFrame, _pckTrackEndFrame; - UInt32 _pckStopTime, _pckTrackDuration; - }; - - #endif - diff --git a/backends/platform/PalmOS/Src/cdaudio.h b/backends/platform/PalmOS/Src/cdaudio.h deleted file mode 100644 index 7a3f5e56e4..0000000000 --- a/backends/platform/PalmOS/Src/cdaudio.h +++ /dev/null @@ -1,67 +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$ - * - */ - -#ifndef CDAUDIO_H -#define CDAUDIO_H - -#include "common/system.h" - -// CD frames are 1/75 sec -#define CD_FPS 75 -#define TO_MSECS(frame) ((UInt32)((frame) * 1000 / CD_FPS)) - -// consider frame at 1/1000 sec -#define FROM_MIN(mins) ((UInt32)((mins) * 60 * 1000)) -#define FROM_SEC(secs) ((UInt32)((secs) * 1000)) - -class CDAudio { -public: - CDAudio() { - _isInitialized = false; - _volumeLevel = 100; - }; - - virtual bool init() = 0; - virtual void release() = 0; - - // OSystem functions - virtual bool poll() = 0; - virtual void play(int track, int num_loops, int start_frame, int duration) = 0; - virtual void stop() = 0; - virtual void update() = 0; - - // volume in percent - virtual void setVolume(int volume) { _volumeLevel = volume; } - virtual int getVolume() const { return _volumeLevel; } - - virtual void upVolume(int value) {} - virtual void downVolume(int value) {} - -protected: - int _volumeLevel; - bool _isInitialized; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/extend.cpp b/backends/platform/PalmOS/Src/extend.cpp deleted file mode 100644 index 430563a302..0000000000 --- a/backends/platform/PalmOS/Src/extend.cpp +++ /dev/null @@ -1,109 +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$ - * - */ - -#include "PalmVersion.h" -#include -#include "globals.h" - -#include "modulesrsc.h" - -void PalmFatalError(const char *err) { - WinSetDrawWindow(WinGetDisplayWindow()); - WinPalette(winPaletteSetToDefault,0,0,0); - WinSetBackColor(0); - WinEraseWindow(); - FrmCustomAlert(FrmFatalErrorAlert, err, 0,0); -} - -void DrawStatus(Boolean show) { - if (OPTIONS_TST(kOptDisableOnScrDisp)) - return; - - UInt8 x,y; - UInt32 depth, d1; - Boolean d2; - WinScreenMode(winScreenModeGet, &d1, &d1, &depth, &d2); - Int16 color = (show ? gVars->indicator.on : gVars->indicator.off); - - if (depth == 8) { - UInt8 *src = (UInt8 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); - src += gVars->screenPitch + 1; - for (y=0; y < 4; y++) { - for (x=0; x < 4; x++) - src[x] = color; - - src += gVars->screenPitch; - } - - } else if (depth == 16) { - Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); - src += gVars->screenPitch + 1; - for (y=0; y < 4; y++) { - for (x=0; x < 4; x++) - src[x] = color; - - src += gVars->screenPitch; - } - } -} - -#ifndef PALMOS_ARM - -// This is now required since some classes are now very big :) -#include "MemGlue.h" -void *operator new(UInt32 size) { - void *ptr = MemGluePtrNew(size); - MemSet(ptr, 0, size); - return ptr; -} - -void *operator new [] (UInt32 size) { - void *ptr = MemGluePtrNew(size); - MemSet(ptr, 0, size); - return ptr; -} -#elif defined(COMPILE_OS5) || defined(STDLIB_TRACE_MEMORY) - -void *operator new(UInt32 size) { - void *ptr = malloc(size); - MemSet(ptr, 0, size); - return ptr; -} - -void *operator new [] (UInt32 size) { - void *ptr = malloc(size); - MemSet(ptr, 0, size); - return ptr; -} - -void operator delete(void *ptr) throw() { - if (ptr) free(ptr); -} - -void operator delete[](void *ptr) throw() { - if (ptr) free(ptr); -} - -#endif diff --git a/backends/platform/PalmOS/Src/features.h b/backends/platform/PalmOS/Src/features.h deleted file mode 100644 index f82c7692fa..0000000000 --- a/backends/platform/PalmOS/Src/features.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __FEATURES_H__ -#define __FEATURES_H__ - -enum { - ftrBufferOverlay = 1000, - ftrBufferBackup, - ftrBufferHotSwap -}; - -#define FREE_FTR(num) \ - { \ - UInt32 ptr; \ - FtrGet(appFileCreator, num, &ptr); \ - if (ptr) FtrPtrFree(appFileCreator, num); \ - } - -#endif diff --git a/backends/platform/PalmOS/Src/globals.h b/backends/platform/PalmOS/Src/globals.h deleted file mode 100644 index 796832df82..0000000000 --- a/backends/platform/PalmOS/Src/globals.h +++ /dev/null @@ -1,114 +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$ - * - */ - -#ifndef GLOBALS_H -#define GLOBALS_H - -#include -#include "stuffs.h" - -enum { - INIT_VIBRATOR = 1 << 0x00, - INIT_PA1LIB = 1 << 0x01, - INIT_ARM = 1 << 0x02, - INIT_AUTOOFF = 1 << 0x03, - INIT_GOLCD = 1 << 0x04 -}; - -enum { - FM_QUALITY_LOW = 0, - FM_QUALITY_MED, - FM_QUALITY_HI, - FM_QUALITY_INI -}; - -typedef struct { - // common parts - UInt32 _4B, _2B; - - // 4 bytes part - UInt32 startupMemory; - UInt32 slkVersion; - UInt32 options; - UInt32 screenPitch; - - struct { - FileRef logFile; - UInt32 cacheSize; - UInt16 volRefNum; - UInt16 dummy; - } VFS; - - // 2 bytes part - UInt16 HRrefNum; - UInt16 slkRefNum; - Coord screenWidth, screenHeight; // silkarea shown - Coord screenFullWidth, screenFullHeight; // silkarea hidden - Int16 autoSave; - struct { - Int16 on; - Int16 off; - Int16 showLED; - } indicator; - - // 1 byte part - Boolean vibrator; - Boolean stdPalette; - Boolean filter; - Boolean stylusClick; - Boolean arrowKeys; - UInt8 init; - UInt8 palmVolume; - UInt8 fmQuality; - UInt8 advancedMode; - -} GlobalsDataType, *GlobalsDataPtr; - -extern GlobalsDataPtr gVars; - -#define VARS_EXPORT() gVars->_4B = 6; \ - gVars->_2B = 12; - -#define DO_VARS(z, t, o) \ - { Int8 *tmp = (Int8 *)gVars + o + 8; \ - for (Int8 cnt = 0; cnt < gVars->z; cnt++) \ - { UInt##t val = *((UInt##t *)tmp); \ - val = ByteSwap##t(val); \ - *((UInt##t *)tmp) = val; \ - tmp += (t / 8); \ - } \ - } - -#define OPTIONS_DEF() gVars->options - -#define HWR_INIT(x) (gVars->init & (x)) -#define HWR_SET(x) gVars->init |= (x) -#define HWR_RST(x) gVars->init &= ~(x) -#define HWR_RSTALL() gVars->init = 0 -#define HWR_GET() (gVars->init) - -#define ARM(x) gVars->arm[x] - -#endif diff --git a/backends/platform/PalmOS/Src/i_zodiac.cpp b/backends/platform/PalmOS/Src/i_zodiac.cpp deleted file mode 100644 index 20b06aa61f..0000000000 --- a/backends/platform/PalmOS/Src/i_zodiac.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include "extend.h" - -#ifndef DISABLE_TAPWAVE - -#include "tapwave.h" -#include "i_zodiac.h" - -// _twBmpV3 = offscreen bitmap, must be set before this call -Err ZodiacInit(void **ptrP, Int32 w, Int32 h) { - Err e; - - TwGfxSurfaceInfoType surface = { - sizeof(TwGfxSurfaceInfoType), - w, h, w * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - - e = SysSetOrientation(sysOrientationLandscape); - e = TwGfxOpen((TwGfxType **)&_twGfxLib, NULL); - e = TwGfxAllocSurface( (TwGfxType *)_twGfxLib, - (TwGfxSurfaceType **)&_twSrc, - &surface); - - e = TwGfxGetPalmDisplaySurface( (TwGfxType *)_twGfxLib, - (TwGfxSurfaceType **)&_twDst); - - return e; -} - -Err ZodiacRelease(void **ptrP) { - Err e = errNone; - - TwGfxFreeSurface((TwGfxSurfaceType *)_twSrc); - TwGfxClose((TwGfxType *)_twGfxLib); - - return e; -} - -#endif diff --git a/backends/platform/PalmOS/Src/i_zodiac.h b/backends/platform/PalmOS/Src/i_zodiac.h deleted file mode 100644 index 96a373a22e..0000000000 --- a/backends/platform/PalmOS/Src/i_zodiac.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _I_ZODIAC_H_ -#define _I_ZODIAC_H_ - -#define _twGfxLib ptrP[0] -#define _twSrc ptrP[1] -#define _twDst ptrP[2] -#define _twBmpV3 ptrP[3] - -Err ZodiacInit(void **ptrP, Int32 w, Int32 h); -Err ZodiacRelease(void **ptrP); - -#endif diff --git a/backends/platform/PalmOS/Src/init_golcd.cpp b/backends/platform/PalmOS/Src/init_golcd.cpp deleted file mode 100644 index b09d3b104e..0000000000 --- a/backends/platform/PalmOS/Src/init_golcd.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include - -#include "init_golcd.h" - -// you can use this handle directly -MemHandle gGoLcdH; - -Err GoLCDInit(MemHandle *goLcdH) { - if (!goLcdH) - return sysErrParamErr; - - Err e; - UInt16 refNum; - Boolean loaded = false; - *goLcdH = NULL; - - if (e = SysLibFind(goLcdLibName, &refNum)) - loaded = !(e = SysLibLoad(goLcdLibType, goLcdLibCreator, &refNum)); - - if (!e) - if ((e = GoLcdLibOpen(refNum))) - SysLibRemove(refNum); - - if (!e) { - MemHandle lcdH = MemHandleNew(sizeof(GoLCDType)); - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(lcdH); - MemSet(lcdP, MemHandleSize(lcdH), 0); - lcdP->refNum = refNum; - lcdP->timeout = GoLcdGetTimeout(refNum, goLcdPenTapMode); - MemPtrUnlock(lcdP); - *goLcdH = lcdH; - } - - return e; -} - -Err GoLCDRelease(MemHandle goLcdH) { - if (!goLcdH) - return sysErrParamErr; - - Err e; - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - if (lcdP->refNum != sysInvalidRefNum) - if (!(e = GoLcdLibClose(lcdP->refNum))) - e = SysLibRemove(lcdP->refNum); - - MemPtrUnlock(lcdP); - MemHandleFree(goLcdH); - - return e; -} - -Boolean GoLCDPointInBounds(MemHandle goLcdH, Coord x, Coord y) { - Boolean inBounds = false; - - if (!goLcdH) - return inBounds; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - inBounds = (lcdP->active && RctPtInRectangle(x, y, &(lcdP->bounds))); - MemPtrUnlock(lcdP); - - return inBounds; -} - -void GoLCDSetInk(MemHandle goLcdH, RGBColorType *inkP) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - MemMove(&(lcdP->ink), inkP, sizeof(RGBColorType)); - MemPtrUnlock(lcdP); -} - -void GoLCDSetBounds(MemHandle goLcdH, RectangleType *boundsP) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - MemMove(&(lcdP->bounds), boundsP, sizeof(RectangleType)); - MemPtrUnlock(lcdP); -} - -void GoLCDActivate(MemHandle goLcdH, Boolean active) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - - if (active) { - if (!lcdP->active) { - lcdP->active = true; - GoLcdSetInkState(lcdP->refNum, goLcdInkEnabled, goLcdColorOverride, &(lcdP->ink)); - GoLcdSetBounds(lcdP->refNum, &(lcdP->bounds)); - GoLcdSetGsiState(lcdP->refNum, goLcdGsiNormal, goLcdColorDefault, 0); - GoLcdSetTimeout(lcdP->refNum, goLcdPenTapMode, lcdP->timeout); - GoLcdSetStatus(lcdP->refNum, goLcdEnabled); - } - - } else { - lcdP->active = false; - GoLcdSetInkState(lcdP->refNum, goLcdInkDisabled, goLcdColorDefault, 0); - GoLcdSetStatus(lcdP->refNum, goLcdDisabled); - } - - MemPtrUnlock(lcdP); -} - -Boolean GoLCDToggle(MemHandle goLcdH) { - if (!goLcdH) - return; - - Boolean active; - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - active = lcdP->active; - MemPtrUnlock(lcdP); - - GoLCDActivate(goLcdH, !active); - return (!active); -} diff --git a/backends/platform/PalmOS/Src/init_golcd.h b/backends/platform/PalmOS/Src/init_golcd.h deleted file mode 100644 index 7750a13a52..0000000000 --- a/backends/platform/PalmOS/Src/init_golcd.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INIT_GOLCD_H -#define INIT_GOLCD_H - -typedef struct { - Boolean active; - UInt16 refNum; - RectangleType bounds; - RGBColorType ink; - UInt32 timeout; -} GoLCDType; - -extern MemHandle gGoLcdH; - -Err GoLCDInit(MemHandle *goLcdH); -Err GoLCDRelease(MemHandle goLcdH); -void GoLCDSetInk(MemHandle goLcdH, RGBColorType *inkP); -void GoLCDSetBounds(MemHandle goLcdH, RectangleType *boundsP); -void GoLCDActivate(MemHandle goLcdH, Boolean active); -Boolean GoLCDToggle(MemHandle goLcdH); -Boolean GoLCDPointInBounds(MemHandle goLcdH, Coord x, Coord y); - -#endif diff --git a/backends/platform/PalmOS/Src/init_mathlib.cpp b/backends/platform/PalmOS/Src/init_mathlib.cpp deleted file mode 100644 index 1ea39c3e0a..0000000000 --- a/backends/platform/PalmOS/Src/init_mathlib.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include "globals.h" -#include "init_mathlib.h" -#include "mathlib.h" - -Err MathlibInit() { - Err e; - - if ((e = SysLibFind(MathLibName, &MathLibRef))) - if (e == sysErrLibNotFound) // couldn't find lib - e = SysLibLoad(LibType, MathLibCreator, &MathLibRef); - - if (e) return sysErrLibNotFound; - - e = MathLibOpen(MathLibRef, MathLibVersion); - return e; -} - -void MathlibRelease() { - UInt16 useCount; - - if (MathLibRef != sysInvalidRefNum) { - MathLibClose(MathLibRef, &useCount); - - if (!useCount) - SysLibRemove(MathLibRef); - } -} diff --git a/backends/platform/PalmOS/Src/init_mathlib.h b/backends/platform/PalmOS/Src/init_mathlib.h deleted file mode 100644 index 1901e1330d..0000000000 --- a/backends/platform/PalmOS/Src/init_mathlib.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef INIT_MATHLIB_H -#define INIT_MATHLIB_H - -Err MathlibInit(); -void MathlibRelease(); - -#endif diff --git a/backends/platform/PalmOS/Src/init_pa1lib.cpp b/backends/platform/PalmOS/Src/init_pa1lib.cpp deleted file mode 100644 index d5b0340cae..0000000000 --- a/backends/platform/PalmOS/Src/init_pa1lib.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -#include "pa1lib.h" -#include "init_pa1lib.h" - -void *sndStateOnFuncP = NULL; -void *sndStateOffFuncP = NULL; - -#define SndStateOn(a,b,c) if (sndStateOnFuncP)((sndStateOnType)(sndStateOnFuncP))(a, b, c); -#define SndStateOff(a) if (sndStateOffFuncP)((sndStateOffType)(sndStateOffFuncP))(a); - -void Pa1libInit(UInt16 vol) { - Pa1Lib_Open(); - - // Doesn't work on T4xx and T6xx series ? - FtrGet(sonySysFtrCreatorSystem, sonySysFtrNumSystemAOutSndStateOnHandlerP, (UInt32*) &sndStateOnFuncP); - FtrGet(sonySysFtrCreatorSystem, sonySysFtrNumSystemAOutSndStateOffHandlerP, (UInt32*) &sndStateOffFuncP); - - SndStateOn(aOutSndKindSp, vol, vol); - SndStateOn(aOutSndKindHp, vol, vol); - - Pa1Lib_devHpVolume(vol, vol); - Pa1Lib_devSpVolume(vol); -} - -void Pa1libRelease() { - SndStateOff(aOutSndKindSp); - SndStateOff(aOutSndKindHp); - - Pa1Lib_Close(); -} diff --git a/backends/platform/PalmOS/Src/init_pa1lib.h b/backends/platform/PalmOS/Src/init_pa1lib.h deleted file mode 100644 index d5be11d278..0000000000 --- a/backends/platform/PalmOS/Src/init_pa1lib.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INIT_PA1LIB_H -#define INIT_PA1LIB_H - -// need to move this on a .h file -#define sonySysFileCSystem 'SsYs' /* Sony overall System */ -#define sonySysFtrCreatorSystem sonySysFileCSystem - -#define sonySysFtrNumSystemBase 10000 -#define sonySysFtrNumSystemAOutSndStateOnHandlerP (sonySysFtrNumSystemBase + 4) -#define sonySysFtrNumSystemAOutSndStateOffHandlerP (sonySysFtrNumSystemBase + 5) - -typedef void (*sndStateOnType) (UInt8 /* kind */, UInt8 /* L volume 0-31 */, UInt8 /* R volume 0-31 */); -typedef void (*sndStateOffType) (UInt8 /* kind */); - -/* kind */ -#define aOutSndKindSp (0) /* Speaker volume */ -#define aOutSndKindHp (2) /* HeadPhone volume */ - -void Pa1libInit(UInt16 vol); -void Pa1libRelease(); - -#endif diff --git a/backends/platform/PalmOS/Src/init_palmos.cpp b/backends/platform/PalmOS/Src/init_palmos.cpp deleted file mode 100644 index 3a72382362..0000000000 --- a/backends/platform/PalmOS/Src/init_palmos.cpp +++ /dev/null @@ -1,172 +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$ - * - */ - -#include - -#include "globals.h" -#include "init_palmos.h" - -static UInt16 autoOffDelay; - -void PalmInit(UInt8 init) { - // set screen depth - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - - if (init & INIT_AUTOOFF) { - autoOffDelay = SysSetAutoOffTime(0); - EvtResetAutoOffTimer(); - } - -} - -void PalmRelease(UInt8 init) { - if (init & INIT_AUTOOFF) { - SysSetAutoOffTime(autoOffDelay); - EvtResetAutoOffTimer(); - } -} - -Err PalmHRInit(UInt32 depth) { - Err e; - UInt32 width = 320; - UInt32 height = 320; - Boolean color = true; - - e = WinScreenMode (winScreenModeSet, &width, &height, &depth, &color); - - if (!e) { - UInt32 attr; - WinScreenGetAttribute(winScreenDensity, &attr); - e = (attr != kDensityDouble); - } - - return e; -} - -void PalmHRRelease() { - // should i do something here ? -} - -UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) { - UInt32 ftr; - UInt8 mode = 0; - - Coord sw = 160; - Coord sh = 160; - - // Hi-Density present ? - if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &ftr)) { - if (ftr >= 4) { - sw = 320; - sh = 320; - } - } - - Coord fw = sw; - Coord fh = sh; - - // if feature set, not set on Garmin iQue3600 ??? - if (!(FtrGet(sysFtrCreator, sysFtrNumInputAreaFlags, &ftr))) { - if (ftr & grfFtrInputAreaFlagCollapsible) { - UInt16 curOrientation = SysGetOrientation(); - - if (curOrientation == sysOrientationLandscape || - curOrientation == sysOrientationReverseLandscape - ) - mode = PALM_LANDSCAPE; - else - mode = PALM_PORTRAIT; - - PINSetInputTriggerState(pinInputTriggerEnabled); - PINSetInputAreaState(pinInputAreaClosed); - StatHide(); - - WinGetDisplayExtent(&fw, &fh); - fw *= 2; - fh *= 2; - - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); - PINSetInputTriggerState(pinInputTriggerDisabled); - } - } - - if (stdw) *stdw = sw; - if (stdh) *stdh = sh; - if (fullw) *fullw = fw; - if (fullh) *fullh = fh; - - return mode; -} - -void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP) { - UInt32 free, max; - - Int16 i; - Int16 nCards; - UInt16 cardNo; - UInt16 heapID; - - UInt32 storageMemory = 0; - UInt32 dynamicMemory = 0; - UInt32 storageFree = 0; - UInt32 dynamicFree = 0; - - // Iterate through each card to support devices with multiple cards. - nCards = MemNumCards(); - - for (cardNo = 0; cardNo < nCards; cardNo++) { - // Iterate through the RAM heaps on a card (excludes ROM). - for (i=0; i< MemNumRAMHeaps(cardNo); i++) { - // Obtain the ID of the heap. - heapID = MemHeapID(cardNo, i); - // Calculate the total memory and free memory of the heap. - MemHeapFreeBytes(heapID, &free, &max); - - // If the heap is dynamic, increment the dynamic memory total. - if (MemHeapDynamic(heapID)) { - dynamicMemory += MemHeapSize(heapID); - dynamicFree += free; - - // The heap is nondynamic (storage ?). - } else { - storageMemory += MemHeapSize(heapID); - storageFree += free; - } - } - } - // Reduce the stats to KB. Round the results. - dynamicMemory = dynamicMemory / 1024L; - storageMemory = storageMemory / 1024L; - - dynamicFree = dynamicFree / 1024L; - storageFree = storageFree / 1024L; - - if (dynamicMemoryP) *dynamicMemoryP = dynamicMemory; - if (storageMemoryP) *storageMemoryP = storageMemory; - if (dynamicFreeP) *dynamicFreeP = dynamicFree; - if (storageFreeP) *storageFreeP = storageFree; -} diff --git a/backends/platform/PalmOS/Src/init_palmos.h b/backends/platform/PalmOS/Src/init_palmos.h deleted file mode 100644 index d4691dd15b..0000000000 --- a/backends/platform/PalmOS/Src/init_palmos.h +++ /dev/null @@ -1,42 +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$ - * - */ - -#ifndef INIT_PALMOS_H -#define INIT_PALMOS_H - -#define PALM_PORTRAIT 1 -#define PALM_LANDSCAPE 2 - -void PalmInit(UInt8 init); -void PalmRelease(UInt8 init); - -Err PalmHRInit(UInt32 depth); -void PalmHRRelease(); - - -UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh); -void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP); - -#endif diff --git a/backends/platform/PalmOS/Src/init_sony.cpp b/backends/platform/PalmOS/Src/init_sony.cpp deleted file mode 100644 index f6728d08b3..0000000000 --- a/backends/platform/PalmOS/Src/init_sony.cpp +++ /dev/null @@ -1,163 +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$ - * - */ - -#include -#include -#include "init_sony.h" - -UInt16 SilkInit(UInt32 *retVersion) { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - UInt32 version; - UInt16 slkRefNum; - Err e; - - // Sony HiRes+ - if (!(e = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrSilk) { - - if ((e = SysLibFind(sonySysLibNameSilk, &slkRefNum))) - if (e == sysErrLibNotFound) - e = SysLibLoad(sonySysFileTSilkLib, sonySysFileCSilkLib, &slkRefNum); - - if (!e) { - e = FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &version); - if (e) { - // v1 = NR - e = SilkLibOpen(slkRefNum); - if (!e) version = vskVersionNum1; - - } else { - // v2 = NX/NZ - // v3 = UX... - e = VskOpen(slkRefNum); - } - } - } else - e = sysErrLibNotFound; - } - - if (e) { - version = 0; - slkRefNum = sysInvalidRefNum; - } - - *retVersion = version; - return slkRefNum; -} - -void SilkRelease(UInt16 slkRefNum) { - if (slkRefNum != sysInvalidRefNum) - SilkLibClose(slkRefNum); -} - -UInt16 SonyHRInit(UInt32 depth) { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - Err e; - UInt16 HRrefNum; - - // test if sonyHR is present - if (!(e = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrHR) { // HR available - - if ((e = SysLibFind(sonySysLibNameHR, &HRrefNum))) - if (e == sysErrLibNotFound) // can't find lib - e = SysLibLoad( 'libr', sonySysFileCHRLib, &HRrefNum); - - // Now we can use HR lib. Executes Open library. - if (!e) e = HROpen(HRrefNum); - } - } - - if (e) HRrefNum = sysInvalidRefNum; - - if (HRrefNum != sysInvalidRefNum) { - UInt32 width = hrWidth; - UInt32 height = hrHeight; - Boolean color = true; - - e = HRWinScreenMode(HRrefNum, winScreenModeSet, &width, &height, &depth, &color); - // error ? release and return an invalid reference number - if (e) { - SonyHRRelease(HRrefNum); - HRrefNum = sysInvalidRefNum; - } - } - - return HRrefNum; -} - -void SonyHRRelease(UInt16 HRrefNum) { - if (HRrefNum != sysInvalidRefNum) { - HRClose(HRrefNum); - //SysLibRemove(HRrefNum); // never call this !! - } -} - -UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) { - UInt32 version; - UInt16 slkRefNum; - UInt8 mode = 0; - - Coord sw = 160; - Coord sh = 160; - Coord fw = sw; - Coord fh = sh; - - if (HRrefNum != sysInvalidRefNum) { - sw = hrWidth; - sh = hrHeight; - fw = sw; - fh = sh; - - slkRefNum = SilkInit(&version); - - if (slkRefNum != sysInvalidRefNum) { - if (version == vskVersionNum1) { - SilkLibEnableResize(slkRefNum); - SilkLibResizeDispWin(slkRefNum, silkResizeMax); - HRWinGetWindowExtent(HRrefNum, &fw, &fh); - SilkLibResizeDispWin(slkRefNum, silkResizeNormal); - SilkLibDisableResize(slkRefNum); - mode = SONY_PORTRAIT; - - } else { - VskSetState(slkRefNum, vskStateEnable, (version == vskVersionNum2 ? vskResizeVertically : vskResizeHorizontally)); - VskSetState(slkRefNum, vskStateResize, vskResizeNone); - HRWinGetWindowExtent(HRrefNum, &fw, &fh); - VskSetState(slkRefNum, vskStateResize, vskResizeMax); - VskSetState(slkRefNum, vskStateEnable, vskResizeDisable); - mode = (version == vskVersionNum3 ? SONY_LANDSCAPE : SONY_PORTRAIT); - } - SilkRelease(slkRefNum); - } - } - - *stdw = sw; - *stdh = sh; - *fullw = fw; - *fullh = fh; - - return mode; -} diff --git a/backends/platform/PalmOS/Src/init_sony.h b/backends/platform/PalmOS/Src/init_sony.h deleted file mode 100644 index 86224283f6..0000000000 --- a/backends/platform/PalmOS/Src/init_sony.h +++ /dev/null @@ -1,40 +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$ - * - */ - -#ifndef INIT_SONY_H -#define INIT_SONY_H - -#define SONY_PORTRAIT 1 -#define SONY_LANDSCAPE 2 - -UInt16 SilkInit(UInt32 *retVersion); -void SilkRelease(UInt16 slkRefNum); - -UInt16 SonyHRInit(UInt32 depth); -void SonyHRRelease(UInt16 HRrefNum); - -UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh); - -#endif diff --git a/backends/platform/PalmOS/Src/init_stuffs.cpp b/backends/platform/PalmOS/Src/init_stuffs.cpp deleted file mode 100644 index 51bfe755eb..0000000000 --- a/backends/platform/PalmOS/Src/init_stuffs.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include - -#ifndef DISABLE_SONY -#include -#endif - -#include -#include -#include -#include - -#include "globals.h" // for OPTIONS_DEF() -#include "init_stuffs.h" -#include "stuffs.h" - -#ifndef DISABLE_TAPWAVE -#define __TWKEYS_H__ // bad hack -#include "tapwave.h" -#endif - -#ifndef DISABLE_PA1LIB -#include "Pa1Lib.h" -#endif - -#ifndef DISABLE_LIGHTSPEED -#include "lightspeed_public.h" -#endif - -// TODO : check the depth to set correct value -// works only for 8bit for now -UInt32 StuffsGetPitch(Coord fullw) { - UInt32 pitch = 0; - - if (OPTIONS_TST(kOptModeHiDensity)) { - WinScreenGetAttribute(winScreenRowBytes, &pitch); - - // FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode - if (pitch < fullw) - pitch = fullw; - - } else { - pitch = fullw; - } - - return pitch; -} - -void *StuffsForceVG() { - // create an empty form to force the VG to be shown - FormType *frmP = FrmNewForm(4567, NULL, 0,0,0,0, false, 0, 0, 0); - FrmDrawForm(frmP); - return frmP; -} - -void StuffsReleaseVG(void *vg) { - FrmDeleteForm((FormPtr)vg); -} - -void StuffsGetFeatures() { - UInt32 ulProcessorType, manufacturer, version, depth; - Boolean color; - -#ifndef DISABLE_TAPWAVE - // Tapwave Zodiac libs ? - if (!FtrGet(sysFileCSystem, sysFtrNumOEMCompanyID, &manufacturer)) - if (manufacturer == twCreatorID) { - OPTIONS_SET(kOptDeviceZodiac); - OPTIONS_SET(kOpt5WayNavigatorV2); - } -#endif - - // Hi-Density present ? - if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &version)) - if (version >= 4) - OPTIONS_SET(kOptModeHiDensity); - - // OS5 ? - if (!FtrGet(sysFtrCreator, sysFtrNumROMVersion, &version)) - if (version >= kOS5Version) - OPTIONS_SET(kOptDeviceOS5); - - // ARM ? - if (!FtrGet(sysFileCSystem, sysFtrNumProcessorID, &ulProcessorType)) - if (sysFtrNumProcessorIsARM(ulProcessorType)) - OPTIONS_SET(kOptDeviceARM); - else if (ulProcessorType == sysFtrNumProcessorx86) - OPTIONS_SET(kOptDeviceProcX86); - - // 5Way Navigator - if (!FtrGet(hsFtrCreator, hsFtrIDNavigationSupported, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - - } else if (!FtrGet(sysFtrCreator, sysFtrNumFiveWayNavVersion, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - else - OPTIONS_SET(kOpt5WayNavigatorV1); - - } else if (!FtrGet(navFtrCreator, navFtrVersion, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - else - OPTIONS_SET(kOpt5WayNavigatorV1); - } - - // Palm Sound API ? - if (!FtrGet(sysFileCSoundMgr, sndFtrIDVersion, &version)) - if (version >= 1) - OPTIONS_SET(kOptPalmSoundAPI); - -#ifndef DISABLE_PA1LIB - // Sony Pa1 Sound API - if (Pa1Lib_Open()) { - OPTIONS_SET(kOptSonyPa1LibAPI); - Pa1Lib_Close(); - } -#endif - - // GoLCD - if (!FtrGet(goLcdLibCreator, goLcdLibFtrNum, &version)) - OPTIONS_SET(kOptGoLcdAPI); - -#ifndef DISABLE_LIGHTSPEED - // Lightspeed - if (LS_Installed()) - OPTIONS_SET(kOptLightspeedAPI); -#endif - - // check for 16bit mode - if (!WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL, &depth, &color)) - OPTIONS_SET(((depth & 0x8000) ? kOptMode16Bit : kOptNone)); - -} diff --git a/backends/platform/PalmOS/Src/init_stuffs.h b/backends/platform/PalmOS/Src/init_stuffs.h deleted file mode 100644 index 124510eeac..0000000000 --- a/backends/platform/PalmOS/Src/init_stuffs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef INIT_STUFFS_H -#define INIT_STUFFS_H - -#define kOS5Version sysMakeROMVersion(5,0,0,sysROMStageRelease,0) - -void StuffsGetFeatures(); -UInt32 StuffsGetPitch(Coord fullw); -void *StuffsForceVG(); -void StuffsReleaseVG(void *vg); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/app.cpp b/backends/platform/PalmOS/Src/launcher/app.cpp deleted file mode 100644 index 9bb1c1479b..0000000000 --- a/backends/platform/PalmOS/Src/launcher/app.cpp +++ /dev/null @@ -1,360 +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$ - * - */ - -#include -#include -#include - -#include "StarterRsc.h" -#include "palmdefs.h" -#include "start.h" -#include "globals.h" -#include "rumble.h" - -#include "mathlib.h" -#include "formCards.h" -#include "games.h" - -#include "modules.h" -#include "init_mathlib.h" -#include "init_sony.h" -#include "init_palmos.h" -#include "init_stuffs.h" - -/*********************************************************************** - * - * FUNCTION: AppStart - * - * DESCRIPTION: Get the current application's preferences. - * - * PARAMETERS: nothing - * - * RETURNED: Err value 0 if nothing went wrong - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err AppStartCheckHRmode() -{ - Err e = errNone; - UInt32 depth = (OPTIONS_TST(kOptMode16Bit) && OPTIONS_TST(kOptDeviceOS5)) ? 16 : 8; - - // try to init Sony HR mode then Palm HR mode - gVars->HRrefNum = SonyHRInit(depth); - - if (gVars->HRrefNum == sysInvalidRefNum) { - if (e = PalmHRInit(depth)) - FrmCustomAlert(FrmErrorAlert,"Your device doesn't seem to support Hi-Res or 256color mode.",0,0); - } else { - OPTIONS_SET(kOptDeviceClie); - } - - return e; -} - -static void AppStopHRMode() { - if (gVars->HRrefNum != sysInvalidRefNum) - SonyHRRelease(gVars->HRrefNum); - else - PalmHRRelease(); -} - -static Err AppStartCheckNotify() { - UInt32 romVersion; - Err err; - - err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); - if (!err) { - UInt16 cardNo; - LocalID dbID; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (!err) { - SysNotifyRegister(cardNo, dbID, sysNotifyVolumeMountedEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sysNotifyVolumeUnmountedEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sonySysNotifyMsaEnforceOpenEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sysNotifyDisplayResizedEvent, NULL, sysNotifyNormalPriority, NULL); - } - } - - return err; -} - -static Err AppStartLoadSkin() { - Err err = errNone; - - // if skin defined, check if the db still exists - if (gPrefs->skin.dbID) { - UInt32 type, creator; - - // check if the DB still exists - DmSearchStateType state; - UInt16 cardNo; - LocalID dbID; - Boolean found = false; - err = DmGetNextDatabaseByTypeCreator(true, &state, 'skin', appFileCreator, false, &cardNo, &dbID); - while (!err && dbID && !found) { - found = (cardNo == gPrefs->skin.cardNo && dbID == gPrefs->skin.dbID); - err = DmGetNextDatabaseByTypeCreator(false, &state, 'skin', appFileCreator, false, &cardNo, &dbID); - } - - if (found) { - // remember to check version for next revision of the skin - err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0,0, &type, &creator); - if (!err) - if (type != 'skin' || creator != appFileCreator) - err = dmErrInvalidParam; - } - - if (!found || err) - MemSet(&(gPrefs->skin),sizeof(SkinInfoType),0); - } - - // No skin ? try to get the first one - if (!gPrefs->skin.dbID) { - DmSearchStateType stateInfo; - - err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &gPrefs->skin.cardNo, &gPrefs->skin.dbID); - if (!err) - err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - - return err; -} - -static Err AppStartCheckMathLib() { - Err e = MathlibInit(); - - switch (e) { - case errNone: - break; - case sysErrLibNotFound: - FrmCustomAlert(FrmErrorAlert,"Can't find MathLib !",0,0); - break; - default: - FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0); - break; - } - - return e; -} - -static void AppStopMathLib() { - MathlibRelease(); -} - -static void AppStartCheckScreenSize() { - Coord sw, sh, fw, fh; - UInt8 mode; - - OPTIONS_RST(kOptCollapsible); - OPTIONS_RST(kOptModeWide); - OPTIONS_RST(kOptModeLandscape); - OPTIONS_RST(kOptModeRotatable); - - // we are on a sony device - if (OPTIONS_TST(kOptDeviceClie)) { - mode = SonyScreenSize(gVars->HRrefNum, &sw, &sh, &fw, &fh); - if (mode) { - OPTIONS_SET(kOptModeWide); - OPTIONS_SET((mode == SONY_LANDSCAPE) ? kOptModeLandscape : kOptNone); - } - } else { - mode = PalmScreenSize(&sw, &sh, &fw, &fh); - if (mode) { - OPTIONS_SET(kOptCollapsible); - OPTIONS_SET(kOptModeWide); - OPTIONS_SET((mode == PALM_LANDSCAPE) ? kOptModeLandscape : kOptNone); - // TODO: doesn't work with Sony - OPTIONS_SET(SysGlueTrapExists(pinSysSetOrientation) ? kOptModeRotatable :kOptNone); - } - } - - gVars->screenWidth = sw; - gVars->screenHeight = sh; - - gVars->screenFullWidth = fw; - gVars->screenFullHeight = fh; -} - -#define max(id,value) gVars->memory[id] = (gVars->memory[id] < value ? value : gVars->memory[id]) -#define min(id,value) gVars->memory[id] = (gVars->memory[id] > value ? value : gVars->memory[id]) -#define threshold 700 - -static void AppStartSetMemory() { - UInt32 mem, def; - PalmGetMemory(0,0,0,&mem); - def = (mem > threshold) ? (mem - threshold) * 1024 : 0; - gVars->startupMemory = mem; -} - -#undef threshold -#undef min -#undef max - -Err AppStart(void) { - UInt16 dataSize, checkSize = 0; - Err error; - -#ifndef _DEBUG_ENGINE - // delete old databases - ModDelete(); -#endif - - // allocate global variables space - dataSize = sizeof(GlobalsDataType); - gVars = (GlobalsDataType *)MemPtrNew(dataSize); - MemSet(gVars, dataSize, 0); - - gVars->indicator.on = 255; - gVars->indicator.off = 0; - gVars->HRrefNum = sysInvalidRefNum; - gVars->VFS.volRefNum = vfsInvalidVolRef; - gVars->slkRefNum = sysInvalidRefNum; - gVars->options = kOptNone; - - // set memory required by the differents engines - AppStartSetMemory(); - StuffsGetFeatures(); - - // allocate prefs space - dataSize = sizeof(GlobalsPreferenceType); - gPrefs = (GlobalsPreferenceType *)MemPtrNew(dataSize); - MemSet(gPrefs, dataSize, 0); - - // Read the saved preferences / saved-state information. - if (PrefGetAppPreferences(appFileCreator, appPrefID, NULL, &checkSize, true) == noPreferenceFound || checkSize != dataSize) { - // reset all elements - MemSet(gPrefs, dataSize, 0); - - gPrefs->card.volRefNum = vfsInvalidVolRef; - gPrefs->card.cacheSize = 4096; - gPrefs->card.useCache = true; - gPrefs->card.showLED = true; - gPrefs->card.autoDetect = true; - - gPrefs->autoOff = true; - gPrefs->vibrator = RumbleExists(); - gPrefs->debug = false; - gPrefs->exitLauncher = true; - gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5); - gPrefs->stylusClick = true; - - } else { - PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true); - } - - if (!OPTIONS_TST(kOptDeviceARM)) { - error = AppStartCheckMathLib(); - if (error) return (error); - } - - error = AppStartCheckHRmode(); - if (error) return (error); - - bDirectMode = (AppStartLoadSkin() != errNone); - - // if volref previously defined, check if it's a valid one - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - VolumeInfoType volInfo; - Err err = VFSVolumeInfo(gPrefs->card.volRefNum, &volInfo); - if (err) - gPrefs->card.volRefNum = parseCards(); - } - else - gPrefs->card.volRefNum = parseCards(); - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - CardSlotCreateDirs(); - - // open games database - error = GamOpenDatabase(); - if (error) return (error); - GamImportDatabase(); - - AppStartCheckScreenSize(); - AppStartCheckNotify(); // not fatal error if not avalaible - - return error; -} - -/*********************************************************************** - * - * FUNCTION: AppStop - * - * DESCRIPTION: Save the current state of the application. - * - * PARAMETERS: nothing - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err AppStopCheckNotify() -{ - UInt32 romVersion; - Err err; - - err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); - if (!err) { - UInt16 cardNo; - LocalID dbID; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (!err) { - SysNotifyUnregister(cardNo, dbID, sysNotifyVolumeUnmountedEvent, sysNotifyNormalPriority); - SysNotifyUnregister(cardNo, dbID, sysNotifyVolumeMountedEvent, sysNotifyNormalPriority); - // sonySysNotifyMsaEnforceOpenEvent - SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority); - } - } - - return err; -} - -void AppStop(void) { - // Close all the open forms. - FrmCloseAllForms(); - WinEraseWindow(); - WinPalette(winPaletteSetToDefault, 0, 256, NULL); - - // Close and move Game list database - GamCloseDatabase(false); - - // Write the saved preferences / saved-state information. This data - // will saved during a HotSync backup. - SavePrefs(); - - // stop all - AppStopCheckNotify(); - if (!OPTIONS_TST(kOptDeviceARM)) - AppStopMathLib(); - AppStopHRMode(); - - if (!bLaunched) - MemPtrFree(gVars); -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp b/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp deleted file mode 100644 index eb4654ed10..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp +++ /dev/null @@ -1,383 +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$ - * - */ - -#include -#include -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "globals.h" - -typedef struct { - UInt16 volRefNum; - Char nameP[expCardInfoStringMaxLen+1]; - -} CardInfoType; - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static void CardSlotFormExit(Boolean bSave); - -static void CardSlotFreeList() { - MemHandle cards = NULL; - MemHandle items = NULL; - - if (itemsText && itemsList) { - cards = MemPtrRecoverHandle(itemsList); - items = MemPtrRecoverHandle(itemsText); - - itemsText = NULL; - itemsList = NULL; - } - itemsType = ITEM_TYPE_UNKNOWN; - - if (items && cards) { - MemHandleUnlock(items); - MemHandleUnlock(cards); - MemHandleFree(items); - MemHandleFree(cards); - } -} - -static UInt16 CardSlotFillList(Boolean getRefNum = false) { - Err err; - UInt16 index; - UInt16 volRefNum; - UInt32 volIterator = vfsIteratorStart|vfsIncludePrivateVolumes; - UInt8 counter = 0; - UInt32 other = 1; - - MemHandle items = NULL; - MemHandle cards = NULL; - CardInfoType *cardsInfo; - - // retreive card infos - while (volIterator != vfsIteratorStop) { - err = VFSVolumeEnumerate(&volRefNum, &volIterator); - - if (!err) { - Char labelP[expCardInfoStringMaxLen+1]; - MemSet(labelP, expCardInfoStringMaxLen+1, 0); - err = VFSVolumeGetLabel(volRefNum, labelP, expCardInfoStringMaxLen+1); - - if (err || StrLen(labelP) == 0) { // if no label try to retreive card type - VolumeInfoType volInfo; - err = VFSVolumeInfo(volRefNum, &volInfo); - - if (!err) { - ExpCardInfoType info; - err = ExpCardInfo(volInfo.slotRefNum, &info); - StrCopy(labelP, info.deviceClassStr); - } - - if (err) // if err default name - StrPrintF(labelP,"Other Card %ld", other++); - } - - if (!cards) - cards = MemHandleNew(sizeof(CardInfoType)); - else - MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType)); - - cardsInfo = (CardInfoType *)MemHandleLock(cards); - cardsInfo[counter].volRefNum = volRefNum; - StrCopy(cardsInfo[counter].nameP, labelP); - MemHandleUnlock(cards); - counter++; - } - } - - if (counter > 0) { - // set the list items ... - if (!getRefNum) { - for (index = 0; index < counter; index++) { - if (!items) - items = MemHandleNew(sizeof(Char *)); - else - MemHandleResize(items, MemHandleSize(items) + sizeof(Char *)); - - itemsText = (Char **)MemHandleLock(items); - itemsText[index] = cardsInfo[index].nameP; - MemHandleUnlock(items); - } - - // save globals - itemsText = (Char **)MemHandleLock(items); - itemsList = (void *)MemHandleLock(cards); - itemsType = ITEM_TYPE_CARD; - - // ... or just return a default volRefNum - } else { - UInt16 volRefNum; - - cardsInfo = (CardInfoType *)MemHandleLock(cards); - volRefNum = cardsInfo[0].volRefNum; // return the first volref - MemHandleUnlock(cards); - MemHandleFree(cards); - - return volRefNum; - } - - // no card found ? free old list in any or return invalid volref - } else { - if (!getRefNum) - CardSlotFreeList(); - else - return vfsInvalidVolRef; - } - - return counter; -} - -static void ConfigTabInit(Boolean update = false) { - ListPtr listP; - - UInt16 index; - Int16 selected = -1; - - UInt16 counter = CardSlotFillList(); - listP = (ListType *)GetObjectPtr(TabCardConfigSlotList); - - // itemsText can be NULL if counter = 0 - LstSetListChoices (listP, itemsText, counter); - if (counter > 0) { - CardInfoType *cardsInfo = (CardInfoType *)itemsList; - - for (index = 0; index < counter; index++) { - if (cardsInfo[index].volRefNum == gPrefs->card.volRefNum) { - selected = index; - break; - } - } - - LstSetSelection(listP, selected); - } - - if (!update) { - FieldType *fld1P; - Char *cacheP; - MemHandle cacheH; - - fld1P = (FieldType *)GetObjectPtr(TabCardConfigCacheSizeField); - cacheH = MemHandleNew(FldGetMaxChars(fld1P)+1); - cacheP = (Char *)MemHandleLock(cacheH); - StrIToA(cacheP, gPrefs->card.cacheSize / 1024); - MemHandleUnlock(cacheH); - - FldSetTextHandle(fld1P, cacheH); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigCacheCheckbox), gPrefs->card.useCache); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigLedCheckbox), gPrefs->card.showLED); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigDetectCheckbox), gPrefs->card.autoDetect); - // update ? redraw the list - } else { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); - } -} - -static UInt16 ConfigTabSave() { - ControlType *cckP[3]; - FieldType *fld1P; - ListPtr listP; - FormPtr frmP; - UInt16 updateCode = frmRedrawUpdateMS; - - cckP[0] = (ControlType *)GetObjectPtr(TabCardConfigCacheCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabCardConfigLedCheckbox); - cckP[2] = (ControlType *)GetObjectPtr(TabCardConfigDetectCheckbox); - - gPrefs->card.useCache = CtlGetValue(cckP[0]); - gPrefs->card.showLED = CtlGetValue(cckP[1]); - gPrefs->card.autoDetect = CtlGetValue(cckP[2]); - - fld1P = (FieldType *)GetObjectPtr(TabCardConfigCacheSizeField); - frmP = FrmGetActiveForm(); - if (FldGetTextLength(fld1P) == 0 && CtlGetValue(cckP[0]) == 1) { - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabCardConfigCacheSizeField)); - FrmCustomAlert(FrmWarnAlert,"You must specified a cache size.",0,0); - return 0; - } - gPrefs->card.cacheSize = StrAToI(FldGetTextPtr(fld1P)) * 1024; - - Int16 selected; - CardInfoType *cardsInfo = (CardInfoType *)itemsList; - - listP = (ListType *)GetObjectPtr(TabCardConfigSlotList); - selected = LstGetSelection(listP); - if (selected == -1) { - gPrefs->card.volRefNum = vfsInvalidVolRef; - } else if (gPrefs->card.volRefNum != cardsInfo[selected].volRefNum) { - updateCode = frmRedrawUpdateMSImport; - gPrefs->card.volRefNum = cardsInfo[selected].volRefNum; - } - - CardSlotCreateDirs(); - CardSlotFreeList(); - - return updateCode; -} - -static void GameListTabInit() { - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox), gPrefs->card.moveDB); - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListDeleteCheckbox), gPrefs->card.deleteDB); - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListConfirmCheckbox), gPrefs->card.confirmMoveDB); -} - -static void GameListTabSave() { - ControlType *cckP[3]; - - cckP[0] = (ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabCardGameListDeleteCheckbox); - cckP[2] = (ControlType *)GetObjectPtr(TabCardGameListConfirmCheckbox); - - gPrefs->card.moveDB = CtlGetValue(cckP[0]); - gPrefs->card.deleteDB = CtlGetValue(cckP[1]); - gPrefs->card.confirmMoveDB = CtlGetValue(cckP[2]); -} - -static void GameListTabDraw() { - ControlType *cck1P; - FormPtr frmP = FrmGetActiveForm(); - - cck1P = (ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox); - if (CtlGetValue(cck1P)) { - FrmShowObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListDeleteCheckbox)); - FrmShowObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListConfirmCheckbox)); - } else { - FrmHideObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListDeleteCheckbox)); - FrmHideObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListConfirmCheckbox)); - } -} - -static void CardSlotFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - tabP = TabNewTabs(2); - TabAddContent(&frmP, tabP, "Cards", TabCardConfigForm); - TabAddContent(&frmP, tabP, "Game List", TabCardGameListForm, GameListTabDraw); - - ConfigTabInit(); - GameListTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -static void CardSlotFormSave() { - UInt16 updateCode; - updateCode = ConfigTabSave(); - if (!updateCode) return; - GameListTabSave(); - CardSlotCreateDirs(); - - TabDeleteTabs(myTabP); - FrmReturnToMain(updateCode); -} - -static void CardSlotFormCancel() { - CardSlotFreeList(); - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -Boolean CardSlotFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - CardSlotFormInit(); - handled = true; - break; - - case frmCloseEvent: - CardSlotFormCancel(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (CardSlotForm + 1) : - case (CardSlotForm + 2) : - lastTab = (eventP->data.ctlSelect.controlID - CardSlotForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case CardSlotOkButton: - CardSlotFormSave(); - break; - - case CardSlotCancelButton: - CardSlotFormCancel(); - break; - - case TabCardGameListMoveCheckbox: - GameListTabDraw(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} - -void CardSlotCreateDirs() { - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - VFSDirCreate(gPrefs->card.volRefNum, "/PALM"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Games"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Saved"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Audio"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Mods"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Themes"); - } -} - -void CardSlotFormUpdate() { - if (itemsType == ITEM_TYPE_CARD) { - CardSlotFreeList(); - ConfigTabInit(true); - } -} - -UInt16 parseCards() { - UInt16 volRefNum = CardSlotFillList(true); - CardSlotFreeList(); - return volRefNum; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formCards.h b/backends/platform/PalmOS/Src/launcher/forms/formCards.h deleted file mode 100644 index 766c4793b9..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formCards.h +++ /dev/null @@ -1,33 +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$ - * - */ - -#ifndef __FORMCARDS_H__ -#define __FORMCARDS_H__ - -UInt16 parseCards(); -void CardSlotFormUpdate(); -void CardSlotCreateDirs(); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp b/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp deleted file mode 100644 index 0540c12577..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp +++ /dev/null @@ -1,612 +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$ - * - */ - -#include -#include -#include -#include - -#include "formTabs.h" -#include "forms.h" - -#include "start.h" -#include "games.h" -#include "skin.h" - -#define errBadParam 0x1000 - -static TabType *myTabP; -static UInt16 lastTab = 0; - -UInt8 gFormEditMode; - -static void GameTabInit(GameInfoType *gameInfoP) { - FieldType *fld1P, *fld2P, *fld3P; - Char *nameP, *pathP, *gameP; - MemHandle nameH, pathH, gameH; - ListType *list1P; - - list1P = (ListType *)GetObjectPtr(TabGameInfoEngineList); - - itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *)); - for (int i = 0; i < ENGINE_COUNT; i++) - itemsText[i] = (Char *)engines[i].nameP; - LstSetListChoices(list1P, itemsText, ENGINE_COUNT); - - fld1P = (FieldType *)GetObjectPtr(TabGameInfoEntryNameField); - fld2P = (FieldType *)GetObjectPtr(TabGameInfoPathField); - fld3P = (FieldType *)GetObjectPtr(TabGameInfoGameField); - - nameH = MemHandleNew(FldGetMaxChars(fld1P)+1); - pathH = MemHandleNew(FldGetMaxChars(fld2P)+1); - gameH = MemHandleNew(FldGetMaxChars(fld3P)+1); - - nameP = (Char *)MemHandleLock(nameH); - pathP = (Char *)MemHandleLock(pathH); - gameP = (Char *)MemHandleLock(gameH); - - if (gameInfoP) { - LstSetSelection(list1P, gameInfoP->engine); - LstSetTopItem(list1P, gameInfoP->engine); - StrCopy(nameP, gameInfoP->nameP); - StrCopy(pathP, gameInfoP->pathP); - StrCopy(gameP, gameInfoP->gameP); - } else { - LstSetSelection(list1P, 0); - MemSet(nameP,MemHandleSize(nameH),0); - MemSet(pathP,MemHandleSize(pathH),0); - MemSet(gameP,MemHandleSize(gameH),0); - } - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameInfoEnginePopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - MemHandleUnlock(nameH); - MemHandleUnlock(pathH); - MemHandleUnlock(gameH); - - FldSetTextHandle(fld1P, nameH); - FldSetTextHandle(fld2P, pathH); - FldSetTextHandle(fld3P, gameH); -} - -static Err GameTabSave(GameInfoType *gameInfoP) { - FieldType *fld1P, *fld2P, *fld3P; - ListType *list1P; - - FormType *frmP = FrmGetActiveForm(); - list1P = (ListType *)GetObjectPtr(TabGameInfoEngineList); - - fld1P = (FieldType *)GetObjectPtr(TabGameInfoEntryNameField); - fld2P = (FieldType *)GetObjectPtr(TabGameInfoPathField); - fld3P = (FieldType *)GetObjectPtr(TabGameInfoGameField); - - FldTrimText(fld1P); - FldTrimText(fld2P); - FldTrimText(fld3P); - - // test case - if (!gameInfoP) { - if (FldGetTextLength(fld1P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify an entry name.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoEntryNameField)); - return errBadParam; - - } else if (FldGetTextLength(fld2P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify a path.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoPathField)); - return errBadParam; - - } else if (FldGetTextLength(fld3P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify a game.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoGameField)); - return errBadParam; - } - - } else { - gameInfoP->engine = LstGetSelection(list1P); - StrCopy(gameInfoP->nameP, FldGetTextPtr(fld1P)); - StrCopy(gameInfoP->pathP, FldGetTextPtr(fld2P)); - StrCopy(gameInfoP->gameP, FldGetTextPtr(fld3P)); - - if (gameInfoP->pathP[StrLen(gameInfoP->pathP)-1] != '/') - StrCat(gameInfoP->pathP, "/"); - - MemPtrFree(itemsText); - itemsText = NULL; - } - - return errNone; -} - -static void DisplayInit(GameInfoType *gameInfoP) { - ListType *list1P, *list2P; - - list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList); - list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList); - - if (gameInfoP) { - LstSetSelection(list1P, gameInfoP->gfxMode); - LstSetSelection(list2P, gameInfoP->renderMode); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), gameInfoP->filter); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox), gameInfoP->fullscreen); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox), gameInfoP->aspectRatio); - - } else { - LstSetSelection(list1P, 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox), 0); - } - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameDisplayGfxPopupPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - CtlSetLabel((ControlType *)GetObjectPtr(TabGameDisplayRenderPopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); -} - -static Err DisplaySave(GameInfoType *gameInfoP) { - ListType *list1P, *list2P; - ControlType *cck6P, *cck7P, *cck8P; - - FormType *frmP = FrmGetActiveForm(); - - list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList); - list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList); - cck6P = (ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox); - cck7P = (ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox); - cck8P = (ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox); - - if (!gameInfoP) { - } else { - gameInfoP->gfxMode = LstGetSelection(list1P); - gameInfoP->renderMode = LstGetSelection(list2P); - gameInfoP->filter = CtlGetValue(cck6P); - gameInfoP->fullscreen = CtlGetValue(cck7P); - gameInfoP->aspectRatio = CtlGetValue(cck8P); - } - - return errNone; -} - -static void OptionsInit(GameInfoType *gameInfoP) { - ListType *list2P, *list3P; - FieldType *fld4P, *fld5P, *fld6P; - Char *loadP, *roomP, *talkP; - MemHandle loadH, roomH, talkH; - - list2P = (ListType *)GetObjectPtr(TabGameOptionsLanguageList); - list3P = (ListType *)GetObjectPtr(TabGameOptionsPlatformList); - - fld4P = (FieldType *)GetObjectPtr(TabGameOptionsLoadSlotField); - fld5P = (FieldType *)GetObjectPtr(TabGameOptionsStartRoomField); - fld6P = (FieldType *)GetObjectPtr(TabGameOptionsTalkSpeedField); - - loadH = MemHandleNew(FldGetMaxChars(fld4P)+1); - roomH = MemHandleNew(FldGetMaxChars(fld5P)+1); - talkH = MemHandleNew(FldGetMaxChars(fld6P)+1); - - loadP = (Char *)MemHandleLock(loadH); - roomP = (Char *)MemHandleLock(roomH); - talkP = (Char *)MemHandleLock(talkH); - - if (gameInfoP) { - LstSetSelection(list2P, gameInfoP->language); - LstSetTopItem(list2P, gameInfoP->language); - LstSetSelection(list3P, gameInfoP->platform); - LstSetTopItem(list3P, gameInfoP->platform); - - StrIToA(loadP, gameInfoP->loadSlot); - StrIToA(roomP, gameInfoP->bootValue); - StrIToA(talkP, gameInfoP->talkValue); - - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox), gameInfoP->autoLoad); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox), gameInfoP->bootParam); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox), gameInfoP->setPlatform); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox), gameInfoP->subtitles); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox), gameInfoP->talkSpeed); - - } else { - LstSetSelection(list2P, 0); - LstSetSelection(list3P, 0); - - StrIToA(loadP, 0); - StrIToA(roomP, 0); - StrIToA(talkP, 60); - - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox), 1); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox), 0); - } - - MemHandleUnlock(loadH); - MemHandleUnlock(roomH); - MemHandleUnlock(talkH); - - FldSetTextHandle(fld4P, loadH); - FldSetTextHandle(fld5P, roomH); - FldSetTextHandle(fld6P, talkH); - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameOptionsLanguagePopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - CtlSetLabel((ControlType *)GetObjectPtr(TabGameOptionsPlatformPopTrigger), LstGetSelectionText(list3P, LstGetSelection(list3P))); -} - -static Err OptionsSave(GameInfoType *gameInfoP) { - FieldType *fld4P, *fld5P, *fld6P; - ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P; - ListType *list2P, *list3P; - - FormType *frmP = FrmGetActiveForm(); - - list2P = (ListType *)GetObjectPtr(TabGameOptionsLanguageList); - list3P = (ListType *)GetObjectPtr(TabGameOptionsPlatformList); - - fld4P = (FieldType *)GetObjectPtr(TabGameOptionsLoadSlotField); - fld5P = (FieldType *)GetObjectPtr(TabGameOptionsStartRoomField); - fld6P = (FieldType *)GetObjectPtr(TabGameOptionsTalkSpeedField); - - cck1P = (ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox); - cck3P = (ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox); - cck4P = (ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox); - cck5P = (ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox); - - if (!gameInfoP) { - if (FldGetTextLength(fld5P) == 0 && CtlGetValue(cck2P) == 1) { - FrmCustomAlert(FrmWarnAlert,"You must specify a room number.",0,0); - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsStartRoomField)); - return errBadParam; - - } else if (FldGetTextLength(fld6P) == 0 && CtlGetValue(cck5P) == 1) { - FrmCustomAlert(FrmWarnAlert,"You must specify a talk speed.",0,0); - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsTalkSpeedField)); - return errBadParam; - } - } else { - gameInfoP->language = LstGetSelection(list2P); - gameInfoP->platform = LstGetSelection(list3P); - - gameInfoP->autoLoad = CtlGetValue(cck1P); - gameInfoP->bootParam = CtlGetValue(cck2P); - gameInfoP->setPlatform = CtlGetValue(cck3P); - gameInfoP->subtitles = (CtlGetValue(cck4P)); - gameInfoP->talkSpeed = CtlGetValue(cck5P); - - gameInfoP->loadSlot = StrAToI(FldGetTextPtr(fld4P)); - gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P)); - gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P)); - } - - return errNone; -} - -static void GameManInit(UInt16 index) { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - UInt16 active = lastTab; - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "Game", TabGameInfoForm); - TabAddContent(&frmP, tabP, "Display", TabGameDisplayForm); - TabAddContent(&frmP, tabP, "Options", TabGameOptionsForm); - - UInt16 refNum; - if (SysLibFind(kFileBrowserLibName, &refNum)) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabGameInfoBrowsePushButton)); - - if (index != dmMaxRecordIndex) { - MemHandle recordH = NULL; - GameInfoType *gameInfoP; - - recordH = DmQueryRecord(gameDB, index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - - GameTabInit(gameInfoP); - DisplayInit(gameInfoP); - OptionsInit(gameInfoP); - - MemHandleUnlock(recordH); - CtlSetUsable((ControlType *)GetObjectPtr(GameEditDeleteButton),true); - } else { - active = 0; // new game ? start with first tab - GameTabInit(0); - DisplayInit(0); - OptionsInit(0); - CtlSetUsable((ControlType *)GetObjectPtr(GameEditDeleteButton),false); - } - - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoEntryNameField)); - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, active); - - myTabP = tabP; -} - -static void GameManSave(UInt16 index) { - MemHandle recordH; - GameInfoType *gameInfoP, newGameInfo; - - if (GameTabSave(0) == errBadParam) return; - if (DisplaySave(0) == errBadParam) return; - if (OptionsSave(0) == errBadParam) return; - - if (index != dmMaxRecordIndex) { - recordH = DmGetRecord(gameDB, index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - MemMove(&newGameInfo, gameInfoP, sizeof(GameInfoType)); - - } else { - index = dmMaxRecordIndex; - GamUnselect(); - recordH = DmNewRecord(gameDB, &index, sizeof(GameInfoType)); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - - MemSet(&newGameInfo, sizeof(GameInfoType), 0); - newGameInfo.version = curItemVersion; - newGameInfo.icnID = 0xFFFF; - newGameInfo.selected = true; - - // default sound data - newGameInfo.musicInfo.volume.palm = 50; - newGameInfo.musicInfo.volume.music = 192; - newGameInfo.musicInfo.volume.sfx = 192; - newGameInfo.musicInfo.volume.speech = 192; - newGameInfo.musicInfo.volume.audiocd = 50; - - newGameInfo.musicInfo.sound.tempo = 100; - newGameInfo.musicInfo.sound.defaultTrackLength = 10; - newGameInfo.musicInfo.sound.firstTrack = 1; - } - - GameTabSave(&newGameInfo); - DisplaySave(&newGameInfo); - OptionsSave(&newGameInfo); - - DmWrite(gameInfoP, 0, &newGameInfo, sizeof(GameInfoType)); - - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - GamSortList(); - // update list position - { - RectangleType rArea; - UInt16 posIndex, maxView; - - // get the sorted index - index = GamGetSelected(); - // if new item is out of the list bounds, change current list pos - SknGetListBounds(&rArea, NULL); - maxView = rArea.extent.y / sknInfoListItemSize; - posIndex = gPrefs->listPosition; - - // if out of the current list position - if (!(index >= posIndex && index < (posIndex + maxView))) - gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed - } - - TabDeleteTabs(myTabP); - FrmReturnToMain(); - SknUpdateList(); -} - -/*********************************************************************** - * - * FUNCTION: EditGameFormSave - * FUNCTION: EditGameFormInit - * FUNCTION: EditGameFormHandleEvent - * - * DESCRIPTION: - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -void EditGameFormDelete(Boolean direct) { - UInt16 index = GamGetSelected(); - - if (index == dmMaxRecordIndex) { - FrmCustomAlert(FrmWarnAlert, "Select an entry first.",0,0); - return; - - } else if (FrmCustomAlert(FrmConfirmAlert, "Do you really want to delete this entry ?", 0, 0) == FrmConfirmYes) { - DmRemoveRecord(gameDB, index); - if (!direct) { - TabDeleteTabs(myTabP); - FrmReturnToMain(); - } - GamSortList(); - SknUpdateList(); - } -} - -static void EditGameCancel() { - if (itemsText) { - MemPtrFree(itemsText); - itemsText = NULL; - } - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void EditGameBowser() { - UInt16 refNum; - Err e; - - ControlPtr butP = (ControlType *)GetObjectPtr(TabGameInfoBrowsePushButton); - CtlSetValue(butP, 0); - - e = SysLibFind (kFileBrowserLibName, &refNum); - if (!e) { - e = FileBrowserLibOpen (refNum); - if (!e) { - UInt16 volRefNum = gPrefs->card.volRefNum; - Char *textP, *pathP = (Char *)MemPtrNew(kFileBrowserLibPathBufferSize); - pathP[0] = chrNull; - - if (FileBrowserLibShowOpenDialog(refNum, &volRefNum, pathP, 0, 0, 0, "Game Data Path", kFileBrowserLibFlagNoFiles)) { - FieldPtr fldP; - MemHandle textH; - Int16 offset, copySize, maxSize; - - fldP = (FieldType *)GetObjectPtr(TabGameInfoPathField); - maxSize = FldGetMaxChars(fldP); - textH = FldGetTextHandle(fldP); - - FldSetTextHandle(fldP, NULL); - textP = (Char *)MemHandleLock(textH); - offset = 0; - copySize = StrLen(pathP); - - if (StrNCaselessCompare(pathP, "/Palm/Programs/ScummVM/Games/", 29) == 0) { - if (StrLen(pathP) == 29) { - copySize = 1; - pathP[0] = '.'; - } else { - copySize -= 29; - offset = 29; - } - } - - if (copySize > maxSize) - copySize = maxSize; - StrNCopy(textP, pathP + offset, copySize); - - MemHandleUnlock(textH); - FldSetTextHandle(fldP, textH); - FldDrawField(fldP); - FldGrabFocus(fldP); - } - - MemPtrFree(pathP); - FileBrowserLibClose(refNum); - } - } -} - -Boolean EditGameFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmCloseEvent: - EditGameCancel(); - handled = true; - break; - - case frmOpenEvent: - switch (gFormEditMode) { - case edtModeAdd: - GameManInit(dmMaxRecordIndex); - break; - case edtModeEdit: - case edtModeParams: - default : - GameManInit(GamGetSelected()); - break; - } - handled = true; - break; - - case keyDownEvent: - switch (eventP->data.keyDown.chr) { - case chrLineFeed: - case chrCarriageReturn: - return true; - } - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (GameEditForm + 1) : - case (GameEditForm + 2) : - case (GameEditForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - GameEditForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case GameEditOKButton: - switch (gFormEditMode) { - case edtModeAdd: - GameManSave(dmMaxRecordIndex); - break; - case edtModeEdit: - case edtModeParams: - default : - GameManSave(GamGetSelected()); - break; - } - break; - - case GameEditCancelButton: - EditGameCancel(); - break; - - case GameEditDeleteButton: - EditGameFormDelete(false); - break; - - case TabGameInfoBrowsePushButton: - EditGameBowser(); - break; - - case TabGameInfoEnginePopTrigger: - FrmList(eventP, TabGameInfoEngineList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameInfoEngineList)); - break; - - case TabGameDisplayGfxPopupPopTrigger: - FrmList(eventP, TabGameDisplayGfxListList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameDisplayGfxListList)); - break; - - case TabGameDisplayRenderPopTrigger: - FrmList(eventP, TabGameDisplayRenderList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameDisplayRenderList)); - break; - - case TabGameOptionsLanguagePopTrigger: - FrmList(eventP, TabGameOptionsLanguageList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameOptionsLanguageList)); - break; - - case TabGameOptionsPlatformPopTrigger: - FrmList(eventP, TabGameOptionsPlatformList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameOptionsPlatformList)); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h b/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h deleted file mode 100644 index 90d271e115..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h +++ /dev/null @@ -1,39 +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$ - * - */ - -#ifndef __FORMEDITGAME_H__ -#define __FORMEDITGAME_H__ - -// edit game mode -enum { - edtModeAdd, - edtModeEdit, - edtModeParams -}; - -extern UInt8 gFormEditMode; -void EditGameFormDelete(Boolean direct); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp b/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp deleted file mode 100644 index 35b44486e9..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp +++ /dev/null @@ -1,275 +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$ - * - */ - -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "globals.h" - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static Boolean ScummVMTabSave() { - FieldType *fld1P, *fld2P; - ControlType *cckP[11]; - FormPtr frmP; - - fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); - fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField); - - cckP[0] = (ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox); - cckP[3] = (ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox); - cckP[6] = (ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox); - cckP[9] = (ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox); - cckP[10]= (ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox); - - frmP = FrmGetActiveForm(); - if (FldGetTextLength(fld1P) == 0 && CtlGetValue(cckP[3]) == 1) { - TabSetActive(frmP, myTabP, 1); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMiscScummVMDebugLevelField)); - FrmCustomAlert(FrmWarnAlert,"You must specify a debug level.",0,0); - return false; - - } else if (FldGetTextLength(fld2P) == 0 && CtlGetValue(cckP[0]) == 1) { - TabSetActive(frmP, myTabP, 1); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMiscScummVMAutosaveField)); - FrmCustomAlert(FrmWarnAlert,"You must specify a period.",0,0); - return false; - } - - gPrefs->autoSave = CtlGetValue(cckP[0]); - gPrefs->debug = CtlGetValue(cckP[3]); - gPrefs->demoMode = CtlGetValue(cckP[6]); - gPrefs->copyProtection = CtlGetValue(cckP[9]); - gPrefs->altIntro = CtlGetValue(cckP[10]); - - gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P)); - gPrefs->autoSavePeriod = StrAToI(FldGetTextPtr(fld2P)); - - return true; -} - -static void PalmOSTabSave() { - ControlType *cckP[11]; - - if (OPTIONS_TST(kOptDeviceARM) && !OPTIONS_TST(kOptDeviceZodiac)) { - cckP[3]= (ControlType *)GetObjectPtr(TabMiscPalmOSAdvancedCheckbox); - gPrefs->advancedMode = CtlGetValue(cckP[3]); - } - - if (!OPTIONS_TST(kOptDeviceARM)) { - cckP[2] = (ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox); - gPrefs->stdPalette = CtlGetValue(cckP[2]); - } - - cckP[0] = (ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox); - cckP[4] = (ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox); - cckP[5] = (ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox); - cckP[6] = (ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox); - cckP[7] = (ControlType *)GetObjectPtr(TabMiscPalmOSArrowCheckbox); - - gPrefs->vibrator = CtlGetValue(cckP[0]); - gPrefs->autoOff = !CtlGetValue(cckP[1]); - gPrefs->setStack = CtlGetValue(cckP[4]); - gPrefs->exitLauncher = CtlGetValue(cckP[5]); - gPrefs->stylusClick = !CtlGetValue(cckP[6]); - gPrefs->arrowKeys = CtlGetValue(cckP[7]); -} - -static void ExtsTabSave() { - ControlType *cckP[2]; - - if (OPTIONS_TST(kOptLightspeedAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); - cckP[0] = (ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox); - - gPrefs->lightspeed.enable = CtlGetValue(cckP[0]); - gPrefs->lightspeed.mode = LstGetSelection(list1P); - } - if (OPTIONS_TST(kOptGoLcdAPI)) { - cckP[1] = (ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox); - gPrefs->goLCD = CtlGetValue(cckP[1]); - } -} - -static void ScummVMTabInit() { - FieldType *fld1P, *fld2P; - Char *levelP, *periodP; - MemHandle levelH, periodH; - - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox), gPrefs->autoSave); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox), gPrefs->debug); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox), gPrefs->demoMode); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox), gPrefs->copyProtection); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox), gPrefs->altIntro); - - fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); - fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField); - - levelH = MemHandleNew(FldGetMaxChars(fld1P)+1); - levelP = (Char *)MemHandleLock(levelH); - StrIToA(levelP, gPrefs->debugLevel); - MemHandleUnlock(levelH); - - periodH = MemHandleNew(FldGetMaxChars(fld2P)+1); - periodP = (Char *)MemHandleLock(periodH); - StrIToA(periodP, gPrefs->autoSavePeriod); - MemHandleUnlock(periodH); - - FldSetTextHandle(fld1P, levelH); - FldSetTextHandle(fld2P, periodH); -} - -static void PalmOSTabInit() { - if (OPTIONS_TST(kOptDeviceARM) && !OPTIONS_TST(kOptDeviceZodiac)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSAdvancedCheckbox), gPrefs->advancedMode); - - if (!OPTIONS_TST(kOptDeviceARM)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox), gPrefs->stdPalette); - - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox), gPrefs->exitLauncher); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox), gPrefs->setStack); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox), gPrefs->vibrator); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox), !gPrefs->autoOff); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox), !gPrefs->stylusClick); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSArrowCheckbox), gPrefs->arrowKeys); -} - -static void ExtsTabInit() { - if (OPTIONS_TST(kOptLightspeedAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); - LstSetSelection(list1P, gPrefs->lightspeed.mode); - CtlSetLabel((ControlType *)GetObjectPtr(TabMiscExtsLightspeedPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox), gPrefs->lightspeed.enable); - } - - if (OPTIONS_TST(kOptGoLcdAPI)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox), gPrefs->goLCD); -} - -static void MiscFormSave() { - if (!ScummVMTabSave()) return; - PalmOSTabSave(); - ExtsTabSave(); - - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void MiscFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - UInt8 extsCnt = 2; - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "PalmOS", TabMiscPalmOSForm); - TabAddContent(&frmP, tabP, "ScummVM", TabMiscScummVMForm); - TabAddContent(&frmP, tabP, "More ...", TabMiscExtsForm); - - if (OPTIONS_TST(kOptDeviceARM)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscPalmOSStdPaletteCheckbox)); - TabMoveUpObject(frmP, TabMiscPalmOSAdvancedCheckbox, 12); - } - - if (!OPTIONS_TST(kOptDeviceARM) || OPTIONS_TST(kOptDeviceZodiac)) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscPalmOSAdvancedCheckbox)); - - if (!OPTIONS_TST(kOptGoLcdAPI)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsGolcdCheckbox)); - // move lightspeed - TabMoveUpObject(frmP, TabMiscExtsLightspeedCheckbox, 12); - TabMoveUpObject(frmP, TabMiscExtsLightspeedPopTrigger, 12); - TabMoveUpObject(frmP, TabMiscExtsLightspeedList, 12); - TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); - extsCnt--; - } - - if (!OPTIONS_TST(kOptLightspeedAPI)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedCheckbox)); -// FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); // cannot remove this ? - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedPopTrigger)); - TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); - extsCnt--; - } - - if (extsCnt) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsNothingLabel)); - - PalmOSTabInit(); - ScummVMTabInit(); - ExtsTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean MiscFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - MiscFormInit(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (MiscForm + 1) : - case (MiscForm + 2) : - case (MiscForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - MiscForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case TabMiscExtsLightspeedPopTrigger: - FrmList(eventP, TabMiscExtsLightspeedList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); - break; - - case MiscOKButton: - MiscFormSave(); - break; - - case MiscCancelButton: - TabDeleteTabs(myTabP); - FrmReturnToMain(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp deleted file mode 100644 index bb0ac894c2..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp +++ /dev/null @@ -1,278 +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$ - * - */ - -#include -#include "StarterRsc.h" -#include "formUtil.h" -#include "games.h" -#include "start.h" - -#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) - -static Char **items = NULL; -Int16 selectedEngine = -1; - -// Supported games -static const char *engine_agos[] = { - "Demon in my Pocket", - "Elvira - Mistress of the Dark", - "Elvira II - The Jaws of Cerberus", - "Jumble", - "NoPatience", - "Simon the Sorcerer I", - "Simon the Sorcerer II", - "Swampy Adventures", - "The Feeble Files", - "Waxworks" -}; - -static const char *engine_sky[] = { - "Floppy, CD and Demo" -}; - -static const char *engine_sword1[] = { - "The Shadow of the Templars (PC/Mac)", - "The Shadow of the Templars (Demo)" -}; - -static const char *engine_sword2[] = { - "The Smoking Mirror", - "The Smoking Mirror (Demo)" -}; - -static const char *engine_cine[] = { - "Future Wars", - "Operation Stealth" -}; - -static const char *engine_queen[] = { - "Flight of the Amazon Queen" -}; - -static const char *engine_lure[] = { - "Lure of the Tempress" -}; - -static const char *engine_gob[] = { - "Bargon Attack", - "Gobliiins", - "Gobliins 2", - "Goblins Quest 3", - "The Bizarre Adventures of Woodruff and the Schnibble", - "Ween: The Prophecy", -}; - -static const char *engine_kyra[] = { - "The Legend of Kyrandia", - "The Legend of Kyrandia: The Hand of Fate", - "The Legend of Kyrandia: Malcolm's Revenge" -}; - -static const char *engine_parallaction[] = { - "Nippon Safes Inc." -}; - -static const char *engine_saga[] = { - "I Have No Mouth And I Must Scream", - "Inherit the earth" -}; - -static const char *engine_scumm[] = { - "Day of the Tentacle", - "Indiana Jones and the Fate of Atlantis", - "Indiana Jones and the Last Crusade", - "Loom", - "Maniac Mansion", - "Monkey Island 2: LeChuck's Revenge", - "Passport to Adventure", - "Sam & Max Hit the Road", - "The Secret of Monkey Island" - "Zak McKracken and the Alien Mindbenders" -}; - -static const char *engine_agi[] = { - "AGI Tetris", - "Caitlyn's Destiny", - "Donald Duck's Playground", - "Fanmade AGI game", - "Gold Rush!", - "King's Quest I: Quest for the Crown", - "King's Quest II: Romancing the Throne", - "King's Quest III: To Heir Is Human", - "King's Quest IV: The Perils of Rosella", - "Leisure Suit Larry in the Land of the Lounge Lizards", - "Mixed-Up Mother Goose", - "Manhunter 1: New York", - "Manhunter 2: San Francisco", - "Police Quest I: In Pursuit of the Death Angel", - "Serguei's Destiny 1", - "Serguei's Destiny 2", - "Space Quest 0: Replicated", - "Space Quest I: The Sarien Encounter", - "Space Quest II: Vohaul's Revenge", - "Space Quest X: The Lost Chapter", - "The Black Cauldron", - "Xmas Card" -}; - -static const char *engine_touche[] = { - "Touche: The Adventures of the Fifth Musketeer" -}; - -static const char *engine_cruise[] = { - "Cruise for a Corpse" -}; - -static const struct { - int size; - const char **listP; -} supported[] = { - { ARRAYSIZE(engine_agos), engine_agos }, - { ARRAYSIZE(engine_sky), engine_sky }, - { ARRAYSIZE(engine_sword1), engine_sword1 }, - { ARRAYSIZE(engine_sword2), engine_sword2 }, - { ARRAYSIZE(engine_cine), engine_cine }, - { ARRAYSIZE(engine_queen), engine_queen }, - { ARRAYSIZE(engine_lure), engine_lure }, - { ARRAYSIZE(engine_gob), engine_gob }, - { ARRAYSIZE(engine_kyra), engine_kyra }, - { ARRAYSIZE(engine_parallaction), engine_parallaction }, - { ARRAYSIZE(engine_saga), engine_saga }, - { ARRAYSIZE(engine_scumm), engine_scumm }, - { ARRAYSIZE(engine_agi), engine_agi }, - { ARRAYSIZE(engine_touche), engine_touche }, - { ARRAYSIZE(engine_cruise), engine_cruise } -}; - -static void SelectorSetList(Int16 sel) { - ListType *listP; - FormPtr frmP = FrmGetActiveForm(); - - Boolean toBeDrawn = (items != NULL); - if (items) - MemPtrFree(items); - - listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineSupportedList)); - items = (Char **)MemPtrNew(supported[sel].size * sizeof(Char *)); - - for (int i = 0; i < supported[sel].size; i++) - items[i] = (Char *)supported[sel].listP[i]; - - LstSetListChoices (listP, items, supported[sel].size); - LstSetTopItem(listP, 0); - LstSetSelection(listP, -1); - - if (toBeDrawn) { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); - } -} - -static void SelectorFormInit() { - ListType *listP; - FormPtr frmP = FrmGetActiveForm(); - - listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineListList)); - itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *)); - - for (int i = 0; i < ENGINE_COUNT; i++) - itemsText[i] = (Char *)engines[i].nameP; - - LstSetListChoices (listP, itemsText, ENGINE_COUNT); - LstSetSelection(listP, 0); - - SelectorSetList(0); - - FrmDrawForm(frmP); -} - -static void SelectorFormFree(bool quit) { - items = NULL; - - if (!quit) { - ListType *listP = (ListType *)GetObjectPtr(EngineListList); - Int16 sel = LstGetSelection(listP); - - FrmReturnToMain(); - StartScummVM(sel); - - } else { - FrmReturnToMain(); - - if (bDirectMode) { - // force exit if nothing selected - EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrLaunch; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue(&event, 0, true); - } - } -} - -Boolean SelectorFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - SelectorFormInit(); - handled = true; - break; - - case frmCloseEvent: - SelectorFormFree(true); - handled = true; - break; - - case lstSelectEvent: - if (eventP->data.lstSelect.listID == EngineSupportedList) - LstSetSelection(eventP->data.lstSelect.pList, -1); - else - SelectorSetList(eventP->data.lstSelect.selection); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case EngineOkButton: - SelectorFormFree(false); - break; - - case EngineCancelButton: - SelectorFormFree(true); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp deleted file mode 100644 index 9566a25311..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#include - -#include "palmdefs.h" -#include "start.h" -#include "forms.h" -#include "skin.h" -#include "globals.h" - -static Int16 SkinsFormCompare(SkinInfoType *a, SkinInfoType *b, SortRecordInfoPtr, SortRecordInfoPtr, MemHandle) { - return StrCompare(a->nameP, b->nameP); -} - -static void SkinsFormInit(Boolean bDraw) { - MemHandle skins = NULL; - SkinInfoType *skinsInfo; - UInt16 numSkins = 0; - - FormPtr frmP; - ListType *listP; - MemHandle items = NULL; - ControlType *cck1P; - DmSearchStateType stateInfo; - UInt16 cardNo; - LocalID dbID; - - Err errInfo; - Char nameP[32]; - - itemsText = NULL; - - // parse and save skins - Err err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); - while (!err && dbID) { - errInfo = DmDatabaseInfo (cardNo, dbID, nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - if (!errInfo) - { - if (!skins) - skins = MemHandleNew(sizeof(SkinInfoType)); - else - MemHandleResize(skins, MemHandleSize(skins) + sizeof(SkinInfoType)); - - skinsInfo = (SkinInfoType *)MemHandleLock(skins); - StrCopy(skinsInfo[numSkins].nameP, nameP); - skinsInfo[numSkins].cardNo = cardNo; - skinsInfo[numSkins].dbID = dbID; - MemHandleUnlock(skins); - numSkins++; - } - err = DmGetNextDatabaseByTypeCreator(false, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); - } - - Int16 selected = -1; - - cck1P = (ControlType *)GetObjectPtr(SkinsSoundClickCheckbox); - CtlSetValue(cck1P, gPrefs->soundClick); - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - skinsInfo = (SkinInfoType *)MemHandleLock(skins); - SysQSort(skinsInfo, numSkins, sizeof(SkinInfoType), (CmpFuncPtr)SkinsFormCompare, 0); - - // create itemsText (TODO: create a custom draw function) - for (UInt16 index=0; index < numSkins; index++) - { - if (!items) - items = MemHandleNew(sizeof(Char *)); - else - MemHandleResize(items, MemHandleSize(items) + sizeof(Char *)); - - itemsText = (Char **)MemHandleLock(items); - itemsText[index] = skinsInfo[index].nameP; - MemHandleUnlock(items); - - if ( gPrefs->skin.cardNo == skinsInfo[index].cardNo && - gPrefs->skin.dbID == skinsInfo[index].dbID && - StrCompare(gPrefs->skin.nameP, skinsInfo[index].nameP) == 0) - selected = index; - } - // save globals and set list - itemsText = (Char **)MemHandleLock(items); - itemsList = (void *)skinsInfo; - itemsType = ITEM_TYPE_SKIN; - - LstSetListChoices (listP, itemsText, numSkins); - LstSetSelection(listP, selected); - - // bDraw = true -> draw whole from - // bDraw = false -> redraw list - if (bDraw) { - frmP = FrmGetActiveForm(); - FrmDrawForm(frmP); - } else { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); -// LstSetSelection(listP, 0); - } -} - -static void SkinsFormExit(Boolean bSave) { - MemHandle skins; - MemHandle items; - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (bSave && selected == -1) { // may never occurred... - FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - skins = MemPtrRecoverHandle(skinsInfo); - items = MemPtrRecoverHandle(itemsText); - - itemsText = NULL; - itemsList = NULL; - itemsType = ITEM_TYPE_UNKNOWN; - - if (bSave) { - ControlType *cck1P; - - StrCopy(gPrefs->skin.nameP, skinsInfo[selected].nameP); - gPrefs->skin.cardNo = skinsInfo[selected].cardNo; - gPrefs->skin.dbID = skinsInfo[selected].dbID; - -/* DmOpenRef skinDB = SknOpenSkin(); - UInt32 depth = SknGetDepth(skinDB); - SknCloseSkin(skinDB); - - if (depth != 8 && depth != 16) depth = 8; - - if (depth == 16 && !OPTIONS_TST(kOptMode16Bit)) { - FrmCustomAlert(FrmInfoAlert, "You can only use 8bit skin on your device.", 0, 0); - gPrefs->skin.cardNo = cardNo; - gPrefs->skin.dbID = dbID; - } -*/ - cck1P = (ControlType *)GetObjectPtr(SkinsSoundClickCheckbox); - gPrefs->soundClick = CtlGetValue(cck1P); - } - - FrmReturnToMain(); - - MemHandleUnlock(items); - MemHandleUnlock(skins); - MemHandleFree(items); - MemHandleFree(skins); - - if (bSave) - SknApplySkin(); -} - -static void SkinsFormBeam() { - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - Err err; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (selected == -1) { // may never occurred... - FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - err = SendDatabase(0, skinsInfo[selected].dbID, "skin.pdb", "\nScummVM Skin"); - -// if (err) -// FrmCustomAlert(FrmErrorAlert, "Unable to beam this skin.",0,0); -} - -static void SkinsFormDelete() { - MemHandle skins; - MemHandle items; - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (selected == -1) { // may never occurred... - FrmCustomAlert(FrmInfoAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - skins = MemPtrRecoverHandle(skinsInfo); - items = MemPtrRecoverHandle(itemsText); - - if ( gPrefs->skin.cardNo == skinsInfo[selected].cardNo && - gPrefs->skin.dbID == skinsInfo[selected].dbID && - StrCompare(gPrefs->skin.nameP, skinsInfo[selected].nameP) == 0) { - FrmCustomAlert(FrmInfoAlert, "You cannot delete the active skin.",0,0); - return; - - } else { - Err err = DmDeleteDatabase(0, skinsInfo[selected].dbID); - if (!err) { - - itemsText = NULL; - itemsList = NULL; - itemsType = ITEM_TYPE_UNKNOWN; - - MemHandleUnlock(items); - MemHandleUnlock(skins); - MemHandleFree(items); - MemHandleFree(skins); - - SkinsFormInit(false); - } else { - FrmCustomAlert(FrmErrorAlert, "Skin deletion failed.",0,0); - } - } - -} -Boolean SkinsFormHandleEvent(EventPtr eventP) { - Boolean handled = false; - - switch (eventP->eType) { - - case frmOpenEvent: - SkinsFormInit(true); - handled = true; - break; - - case frmCloseEvent: - SkinsFormExit(false); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case SkinsOKButton: - SkinsFormExit(true); - break; - - case SkinsCancelButton: - SkinsFormExit(false); - break; - - case SkinsBeamButton: - SkinsFormBeam(); - break; - - case SkinsDeleteButton: - SkinsFormDelete(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp b/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp deleted file mode 100644 index 6d1d55e6e2..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include - -#include "forms.h" - -Char **itemsText = NULL; -void *itemsList = NULL; -Char itemsType = ITEM_TYPE_UNKNOWN; - -void FrmReturnToMain(UInt16 updateCode) { - // if there is a form loaded, prevent crash on OS5 - if (FrmGetFirstForm()) { - FrmUpdateForm(MainForm, updateCode); - FrmReturnToForm(MainForm); - } -} - -void FldTrimText(FieldPtr fldP) { - MemHandle tmpH; - Char *tmpP; - - tmpH = FldGetTextHandle(fldP); - FldSetTextHandle(fldP, NULL); - tmpP = (Char *)MemHandleLock(tmpH); - TxtGlueStripSpaces(tmpP, true, true); - MemHandleUnlock(tmpH); - FldSetTextHandle(fldP, tmpH); -} - -/*********************************************************************** - * - * FUNCTION: GetObjectPtr - * - * DESCRIPTION: This routine returns a pointer to an object in the current - * form. - * - * PARAMETERS: formId - id of the form to display - * - * RETURNED: void * - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -void * GetObjectPtr(UInt16 objectID) { - FormPtr frmP; - - frmP = FrmGetActiveForm(); - return FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID)); -} - -void FrmList(EventPtr eventP, UInt16 objectID) { - ListType *listP; - UInt16 listItem; - - listP = (ListType *)GetObjectPtr(objectID); - listItem = LstPopupList(listP); - CtlSetLabel(eventP->data.ctlSelect.pControl, LstGetSelectionText(listP, LstGetSelection(listP))); -} - diff --git a/backends/platform/PalmOS/Src/launcher/forms/formUtil.h b/backends/platform/PalmOS/Src/launcher/forms/formUtil.h deleted file mode 100644 index e9b87bc49f..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formUtil.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __FORMUTIL_H__ -#define __FORMUTIL_H__ - -#define frmRedrawUpdateMS (frmRedrawUpdateCode + 1) -#define frmRedrawUpdateMSImport (frmRedrawUpdateCode + 2) - -#define NO_ENGINE -1 - -// form list draw -#define ITEM_TYPE_UNKNOWN 'U' -#define ITEM_TYPE_CARD 'C' -#define ITEM_TYPE_SKIN 'S' - -extern Char **itemsText; -extern void *itemsList; -extern Char itemsType; - -void FrmReturnToMain(UInt16 updateCode = frmRedrawUpdateMS); -void * GetObjectPtr(UInt16 objectID); -void FldTrimText(FieldPtr fldP); -void FrmList(EventPtr eventP, UInt16 objectID); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp b/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp deleted file mode 100644 index 3f4ab1b28f..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" - -#include "base/version.h" -#include "globals.h" -#include "init_palmos.h" - -/*********************************************************************** - * - * FUNCTION: MiscOptionsFormSave - * FUNCTION: MiscOptionsFormInit - * FUNCTION: MiscOptionsFormHandleEvent - * - * DESCRIPTION: Misc. Options form functions - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static TabType *myTabP; -static UInt16 lastTab = 0; - -static UInt32 GetStackSize() { - MemPtr startPP, endPP; - SysGetStackInfo(&startPP, &endPP); - - return ((Char *)endPP - (Char *)startPP) / 1024L; -} - -static void VersionTabDraw() { - WinDrawChars(gScummVMVersion, StrLen(gScummVMVersion), 47, 12 + 30); - WinDrawChars(gScummVMBuildDate, StrLen(gScummVMBuildDate), 47, 24 + 30); -} - -static void SystemTabDraw() { - Coord x; - UInt32 dm, sm, df, sf, stack; - Char num[10]; - - PalmGetMemory(&sm, &dm, &sf, 0); - stack = GetStackSize(); - df = gVars->startupMemory; - - WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground)); - FntSetFont(stdFont); - - StrIToA(num, dm); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 12 + 30); - - StrIToA(num, sm); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 24 + 30); - - StrIToA(num, stack); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 36 + 30); - - StrIToA(num, df); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 12 + 30); - - StrIToA(num, sf); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 24 + 30); - - StrCopy(num,"-"); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 36 + 30); -} - -static void InfoFormSave() { - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void AboutTabDraw() { - MemHandle hTemp; - BitmapPtr bmpTemp; - - hTemp = DmGetResource (bitmapRsc, 1200); - if (hTemp) { - bmpTemp = (BitmapType *)MemHandleLock(hTemp); - WinDrawBitmap(bmpTemp,3,44); - MemPtrUnlock(bmpTemp); - DmReleaseResource(hTemp); - } -} - -static void InfoFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "About", TabInfoAboutForm, AboutTabDraw); - TabAddContent(&frmP, tabP, "Version", TabInfoVersionForm, VersionTabDraw); - TabAddContent(&frmP, tabP, "Memory", TabInfoSystemForm, SystemTabDraw); - - lastTab = 0; - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean InfoFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - InfoFormInit(); - handled = true; - break; - - case frmCloseEvent: - InfoFormSave(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (InfoForm + 1) : - case (InfoForm + 2) : - case (InfoForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - InfoForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case InfoOKButton: - InfoFormSave(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp deleted file mode 100644 index ca2e18ee6d..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp +++ /dev/null @@ -1,364 +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$ - * - */ - -#include - -#include "StarterRsc.h" -#include "start.h" -#include "skin.h" -#include "games.h" -#include "globals.h" - -#include "base/version.h" - -#include "formEditGame.h" -#include "formUtil.h" - -static UInt16 sknLastOn = skinButtonNone; - -static Err BeamMe() { - UInt16 cardNo; - LocalID dbID; - Err err; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (dbID) - err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games"); - else - err = DmGetLastErr(); - - return err; -} - -/*********************************************************************** - * - * FUNCTION: MainFormInit - * - * DESCRIPTION: This routine initializes the MainForm form. - * - * PARAMETERS: frm - pointer to the MainForm form. - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void MainFormInit() -{ - SknApplySkin(); -} - -/*********************************************************************** - * - * FUNCTION: MainFormDoCommand - * - * DESCRIPTION: This routine performs the menu command specified. - * - * PARAMETERS: command - menu item id - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -static Boolean MainFormDoCommand(UInt16 command) -{ - Boolean handled = false; - - switch (command) { - case MainGamesMemoryCard: - FrmPopupForm(CardSlotForm); - handled = true; - break; - - case MainGamesNew: - gFormEditMode = edtModeAdd; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case MainGamesEdit: - gFormEditMode = edtModeEdit; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case MainGamesDelete: - EditGameFormDelete(true); - handled = true; - break; - - case MainOptionsBeam: - BeamMe(); - //if (BeamMe()) - //FrmCustomAlert(FrmErrorAlert,"Unable to beam ScummVM for PalmOS.",0,0); - handled = true; - break; - - case MainOptionsAbout: - FrmPopupForm(InfoForm); - handled = true; - break; - - case MainGamesMusicSound: - FrmPopupForm(MusicForm); - handled = true; - break; - - case MainOptionsSkins: - FrmPopupForm(SkinsForm); - handled = true; - break; - - case MainOptionsMisc: - FrmPopupForm(MiscForm); - handled = true; - break; - } - - MenuEraseStatus(0); - return handled; -} - -/*********************************************************************** - * - * FUNCTION: MainFormHandleEvent - * - * DESCRIPTION: This routine is the event handler for the - * "MainForm" of this application. - * - * PARAMETERS: eventP - a pointer to an EventType structure - * - * RETURNED: true if the event has handle and should not be passed - * to a higher level handler. - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -static Boolean PenDownRepeat() { - Coord x,y; - Boolean penDown, handled = false; - EvtGetPen(&x, &y, &penDown); - - if (penDown && sknLastOn) { - RectangleType r; - DmOpenRef skinDBP; - - skinDBP = SknOpenSkin(); - SknGetObjectBounds(skinDBP, sknLastOn, &r); - - if (RctPtInRectangle(x*2, y*2, &r)) { - if (SknGetState(skinDBP, sknLastOn) != sknStateSelected) { - SknSetState(skinDBP, sknLastOn, sknStateSelected); - SknShowObject(skinDBP, sknLastOn); - } - - switch (sknLastOn) { - case skinSliderUpArrow: - case skinSliderDownArrow: - handled = SknProcessArrowAction(sknLastOn); - break; - } - - } else { - if (SknGetState(skinDBP, sknLastOn) != sknStateNormal) { - SknSetState(skinDBP, sknLastOn, sknStateNormal); - SknShowObject(skinDBP, sknLastOn); - } - } - - SknCloseSkin(skinDBP); - } - - return handled; -} - - -Boolean MainFormHandleEvent(EventPtr eventP) -{ - Boolean handled = false; - FormPtr frmP; - Coord x,y; - DmOpenRef skinDBP; - - switch (eventP->eType) { - case frmUpdateEvent: - { - RectangleType r; - UInt16 idx; - IndexedColorType bgColor = UIColorGetTableEntryIndex(UIFormFill); - frmP = FrmGetFormPtr(MainForm); - - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - idx = FrmGetObjectIndex (frmP, MainMSBitMap); - else - idx = FrmGetObjectIndex (frmP, MainMSNoneBitMap); - - WinSetDrawMode(winPaint); - WinSetBackColor(bgColor); - FrmGetObjectBounds(frmP, idx, &r); - WinEraseRectangle(&r, 0); - FrmShowObject(frmP, idx); - - if (eventP->data.frmUpdate.updateCode == frmRedrawUpdateMSImport) { - GamImportDatabase(); - SknUpdateList(); - } - handled = true; - break; - } - case menuEvent: - handled = MainFormDoCommand(eventP->data.menu.itemID); - break; - - case frmOpenEvent: - MainFormInit(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case MainCardsButton: - //gPrefs->card.volRefNum = parseCards(true); - FrmPopupForm(CardSlotForm); - break; - - case MainAboutButton: - FrmPopupForm(InfoForm); - break; - -// case MainListTypeSelTrigger: -// FrmList(eventP, MainListTypeList); -// break; - } - handled = true; - break; - - case penUpEvent: - x = eventP->screenX; - y = eventP->screenY; - lastIndex = dmMaxRecordIndex; // enable select/unselect list item - - if (sknLastOn != skinButtonNone) { - RectangleType r; - skinDBP = SknOpenSkin(); - SknGetObjectBounds(skinDBP, sknLastOn, &r); - SknSetState(skinDBP, sknLastOn, sknStateNormal); - SknShowObject(skinDBP, sknLastOn); - SknCloseSkin(skinDBP); - - if (RctPtInRectangle(x*2, y*2, &r)) { - switch (sknLastOn) { - case skinButtonGameAdd: - gFormEditMode = edtModeAdd; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case skinButtonGameAudio: - FrmPopupForm(MusicForm); - handled = true; - break; - - case skinButtonGameEdit: - case skinButtonGameParams: - gFormEditMode = edtModeParams; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case skinButtonGameStart: - if (gPrefs->card.volRefNum == vfsInvalidVolRef) - FrmCustomAlert(FrmWarnAlert,"Please select/insert a memory card.", 0, 0); - else if (GamGetSelected() != dmMaxRecordIndex) - StartScummVM(); - else - FrmPopupForm(EngineForm); - handled = true; - break; - - case skinButtonGameDelete: - EditGameFormDelete(true); - break; - } - } - sknLastOn = skinButtonNone; - } - break; - - case penDownEvent: - case penMoveEvent: - if (sknLastOn == skinButtonNone) { - x = eventP->screenX; - y = eventP->screenY; - skinDBP = SknOpenSkin(); - - switch (sknLastOn = SknCheckClick(skinDBP, x,y)) { - case skinButtonNone: - break; - case skinSliderUpArrow: - case skinSliderDownArrow: - case skinButtonGameAdd: - case skinButtonGameEdit: - case skinButtonGameParams: - case skinButtonGameStart: - case skinButtonGameDelete: - case skinButtonGameAudio: - SknSetState(skinDBP, sknLastOn, sknStateSelected); - SknShowObject(skinDBP, sknLastOn); - if (gPrefs->soundClick) - SndPlaySystemSound(sndClick); - handled = true; - break; - default: - FrmCustomAlert(FrmWarnAlert,"Unknown button !",0,0); - } - SknCloseSkin(skinDBP); - SknSelect(x, y); - } - break; - - case keyDownEvent: - if ( (eventP->data.keyDown.chr >= 'a' && eventP->data.keyDown.chr <= 'z') || - (eventP->data.keyDown.chr >= 'A' && eventP->data.keyDown.chr <= 'Z')) { - if (GamJumpTo(eventP->data.keyDown.chr)) { - SknUpdateList(); - handled = true; - } - } - break; - - default: - handled = PenDownRepeat(); - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp deleted file mode 100644 index 48399efa95..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp +++ /dev/null @@ -1,388 +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$ - * - */ - -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "games.h" - -#include "globals.h" - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static GameInfoType *gameInfoP = NULL; - -// Music -static Boolean MusicTabSave() { - ControlType *cck1P, *cck2P; - ListType *list1P, *list2P, *list3P; - FieldType *fld1P; - UInt16 tempo; - FormPtr frmP; - - frmP = FrmGetActiveForm(); - - cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabMusicMultiMidiCheckbox); - - list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - list2P = (ListType *)GetObjectPtr(TabMusicRateList); - list3P = (ListType *)GetObjectPtr(TabMusicQualityList); - - fld1P = (FieldType *)GetObjectPtr(TabMusicTempoField); - - tempo = StrAToI(FldGetTextPtr(fld1P)); - if (tempo < 50 || tempo > 200) { - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMusicTempoField)); - FrmCustomAlert(FrmErrorAlert, "Invalid tempo value (50...200)", 0, 0); - return false; - } - - gameInfoP->musicInfo.sound.music = CtlGetValue(cck1P); - gameInfoP->musicInfo.sound.multiMidi = CtlGetValue(cck2P); - - gameInfoP->musicInfo.sound.drvMusic = LstGetSelection(list1P); - gameInfoP->musicInfo.sound.rate = LstGetSelection(list2P); - gameInfoP->fmQuality = LstGetSelection(list3P); - gameInfoP->musicInfo.sound.tempo = tempo; - - return true; -} - -static void MusicTabInit() { - ControlType *cck1P, *cck2P; - ListType *list1P, *list2P, *list3P; - FieldType *fld1P; - MemHandle tempoH; - Char *tempoP; - - cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabMusicMultiMidiCheckbox); - - list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - list2P = (ListType *)GetObjectPtr(TabMusicRateList); - list3P = (ListType *)GetObjectPtr(TabMusicQualityList); - - fld1P = (FieldType *)GetObjectPtr(TabMusicTempoField); - - CtlSetValue(cck1P, gameInfoP->musicInfo.sound.music); - CtlSetValue(cck2P, gameInfoP->musicInfo.sound.multiMidi); - - if (gameInfoP->musicInfo.sound.drvMusic > 5) - gameInfoP->musicInfo.sound.drvMusic = 0; - - - LstSetSelection(list1P, gameInfoP->musicInfo.sound.drvMusic); - LstSetTopItem(list1P, gameInfoP->musicInfo.sound.drvMusic); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - LstSetSelection(list2P, gameInfoP->musicInfo.sound.rate); - LstSetTopItem(list2P, gameInfoP->musicInfo.sound.rate); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicRatePopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - - LstSetSelection(list3P, gameInfoP->fmQuality); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicQualityPopTrigger), LstGetSelectionText(list3P, LstGetSelection(list3P))); - - tempoH = MemHandleNew(FldGetMaxChars(fld1P)+1); - tempoP = (Char *)MemHandleLock(tempoH); - StrIToA(tempoP, gameInfoP->musicInfo.sound.tempo); - MemHandleUnlock(tempoH); - FldSetTextHandle(fld1P, tempoH); -} - -// Audio CD -static Boolean AudioCDTabSave() { - ControlType *cck3P; - FieldType *fld2P, *fld3P; - ListType *list1P, *list2P; - UInt16 firstTrack; - FormPtr frmP; - - frmP = FrmGetActiveForm(); - - cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); - fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField); - fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); - list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); - list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - - firstTrack = StrAToI(FldGetTextPtr(fld3P)); - if (firstTrack < 1 || firstTrack > 999) { - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabAudioCDFirstTrackField)); - FrmCustomAlert(FrmErrorAlert, "Invalid track value (1...999)", 0, 0); - return false; - } - - gameInfoP->musicInfo.sound.CD = CtlGetValue(cck3P); - - gameInfoP->musicInfo.sound.drvCD = LstGetSelection(list1P); - gameInfoP->musicInfo.sound.frtCD = LstGetSelection(list2P); - - gameInfoP->musicInfo.sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P)); - gameInfoP->musicInfo.sound.firstTrack = firstTrack; - - return true; -} - -static void AudioCDTabInit() { - ControlType *cck3P; - FieldType *fld2P, *fld3P; - ListType *list1P, *list2P; - MemHandle lengthH, firstTrackH; - Char *lengthP, *firstTrackP; - - cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); - fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField); - fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); - list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); - list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - - LstSetSelection(list1P, gameInfoP->musicInfo.sound.drvCD); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - LstSetSelection(list2P, gameInfoP->musicInfo.sound.frtCD); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - - CtlSetValue(cck3P, gameInfoP->musicInfo.sound.CD); - - lengthH = MemHandleNew(FldGetMaxChars(fld2P)+1); - lengthP = (Char *)MemHandleLock(lengthH); - StrIToA(lengthP, gameInfoP->musicInfo.sound.defaultTrackLength); - MemHandleUnlock(lengthH); - FldSetTextHandle(fld2P, lengthH); - - firstTrackH = MemHandleNew(FldGetMaxChars(fld3P)+1); - firstTrackP = (Char *)MemHandleLock(firstTrackH); - StrIToA(firstTrackP, gameInfoP->musicInfo.sound.firstTrack); - MemHandleUnlock(firstTrackH); - FldSetTextHandle(fld3P, firstTrackH); -} - -// Volume -static void VolumeTabSave() { - SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; - - slid1P = (SliderControlType *)GetObjectPtr(TabVolumePalmSliderControl); - slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); - slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); - slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl); - slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl); - - CtlGetSliderValues ((ControlType *)slid1P, 0, 0, 0, &gameInfoP->musicInfo.volume.palm); - CtlGetSliderValues ((ControlType *)slid2P, 0, 0, 0, &gameInfoP->musicInfo.volume.music); - CtlGetSliderValues ((ControlType *)slid3P, 0, 0, 0, &gameInfoP->musicInfo.volume.sfx); - CtlGetSliderValues ((ControlType *)slid4P, 0, 0, 0, &gameInfoP->musicInfo.volume.speech); - CtlGetSliderValues ((ControlType *)slid5P, 0, 0, 0, &gameInfoP->musicInfo.volume.audiocd); -} - -static void VolumeTabInit() { - SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; - UInt16 value; - - slid1P = (SliderControlType *)GetObjectPtr(TabVolumePalmSliderControl); - slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); - slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); - slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl); - slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl); - - value = gameInfoP->musicInfo.volume.palm; - CtlSetSliderValues ((ControlType *)slid1P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.music; - CtlSetSliderValues ((ControlType *)slid2P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.sfx; - CtlSetSliderValues ((ControlType *)slid3P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.speech; - CtlSetSliderValues ((ControlType *)slid4P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.audiocd; - CtlSetSliderValues ((ControlType *)slid5P, 0, 0, 0, &value); -} - -static void MusicFormSave(UInt16 index) { - if (index != dmMaxRecordIndex) { - MemHandle recordH; - GameInfoType *ogameInfoP; - - if (!MusicTabSave()) return; - if (!AudioCDTabSave()) return; - VolumeTabSave(); - - recordH = DmGetRecord(gameDB, index); - ogameInfoP = (GameInfoType *)MemHandleLock(recordH); - DmWrite(ogameInfoP, 0, gameInfoP, sizeof(GameInfoType)); - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - } - - MemPtrFree(gameInfoP); - gameInfoP = NULL; - - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} -static void MusicFormInit(UInt16 index) { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - if (index != dmMaxRecordIndex) { - MemHandle recordH = NULL; - GameInfoType *ogameInfoP; - - recordH = DmQueryRecord(gameDB, index); - ogameInfoP = (GameInfoType *)MemHandleLock(recordH); - - if (!ogameInfoP) { - FrmCustomAlert(FrmErrorAlert, "An error occurred.",0,0); - return; - } - - gameInfoP = (GameInfoType *)MemPtrNew(sizeof(GameInfoType)); - MemMove(gameInfoP, ogameInfoP, sizeof(GameInfoType)); - MemHandleUnlock(recordH); - - } else { - FrmCustomAlert(FrmWarnAlert, "Select an entry first.",0,0); - FrmReturnToMain(); - return; - } - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "Sound", TabMusicForm); - TabAddContent(&frmP, tabP, "Volume", TabVolumeForm); - TabAddContent(&frmP, tabP, "Audio CD", TabAudioCDForm); - - MusicTabInit(); - AudioCDTabInit(); - VolumeTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean MusicFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - MusicFormInit(GamGetSelected()); - handled = true; - break; - - case frmCloseEvent: - MusicFormSave(dmMaxRecordIndex); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (MusicForm + 1) : - case (MusicForm + 2) : - case (MusicForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - MusicForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case TabMusicDriverPopTrigger: - FrmList(eventP, TabMusicDriverList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicDriverList)); - - if (!OPTIONS_TST(kOptDeviceZodiac) && !OPTIONS_TST(kOptSonyPa1LibAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - - if (LstGetSelection(list1P) == 4) { - FrmCustomAlert(FrmInfoAlert, "There is no built-in MIDI support on your device.", 0, 0); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - } - break; - - case TabMusicQualityPopTrigger: - FrmList(eventP, TabMusicQualityList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicQualityList)); - break; - - case TabMusicRatePopTrigger: - FrmList(eventP, TabMusicRateList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicRateList)); - - if (!OPTIONS_TST(kOptPalmSoundAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMusicRateList); - - if (LstGetSelection(list1P) != 0) { - FrmCustomAlert(FrmInfoAlert, "You cannot use this rate on your device.", 0, 0); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicRatePopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - } - break; - - case TabAudioCDFormatPopTrigger: - FrmList(eventP, TabAudioCDFormatList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDFormatList)); - - if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) { - ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - break; - - case TabAudioCDDriverPopTrigger: - FrmList(eventP, TabAudioCDDriverList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDDriverList)); - - if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) { - ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - break; - - case MusicOKButton: - MusicFormSave(GamGetSelected()); - break; - - case MusicCancelButton: - MusicFormSave(dmMaxRecordIndex); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/forms.h b/backends/platform/PalmOS/Src/launcher/forms/forms.h deleted file mode 100644 index ca0089d8c1..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/forms.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __FORMS_H__ -#define __FORMS_H__ - -#include "StarterRsc.h" -#include "formUtil.h" - -#include "formEditGame.h" -#include "formCards.h" - - -#define HANDLER(x) Boolean x##FormHandleEvent(EventPtr eventP); - -HANDLER(Main) -HANDLER(EditGame) -HANDLER(SystemInfo) -HANDLER(Misc) -HANDLER(CardSlot) -HANDLER(Skins) -HANDLER(Music) -HANDLER(Info) -HANDLER(Selector) - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp b/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp deleted file mode 100644 index d3f18e39d7..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include -#include -#include - -#include "globals.h" -#include "formTabs.h" - -TabType *TabNewTabs(UInt16 cnt) { - TabType *newP = new TabType; - - newP->count = 0; - newP->width = 0; - newP->tabs = new TabDataType[cnt]; - - return newP; -} - -void TabMoveUpObject(FormType *frmP, UInt16 objID, Coord amount) { - Coord x, y; - FrmGetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), &x, &y); - FrmSetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), x, y - amount); -} - -void TabDeleteTabs(TabType *tabP) { - UInt16 cnt, num; - num = MemPtrSize(tabP->tabs) / sizeof(TabDataType); - - for (cnt = 0; cnt < num; cnt++) - FrmDeleteForm(tabP->tabs[cnt].srcP); - - delete tabP->tabs; - delete tabP; -} - -Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc) { - FormType *srcP; - UInt16 cnt; - void *objP, **dstP; - UInt16 objNum; - Coord x, y, w, h; - UInt16 id; - RectangleType r; - - dstP = (void **)frmP; - srcP = FrmInitForm(rscID); - - objNum = FrmGetNumberOfObjects(srcP); - - // save tab data - - // it's required to keep to source forms active - // while the tab form is not close for list data ptr (items text) - // TODO : fix this ! - tabP->tabs[tabP->count].srcP = srcP; - tabP->tabs[tabP->count].first = FrmGetObjectId(srcP, 0); - tabP->tabs[tabP->count].last = FrmGetObjectId(srcP, objNum - 1); - tabP->tabs[tabP->count].drawFunc= drawFunc; - tabP->count++; - tabP->active = tabP->count; - - // create tab - FntSetFont(stdFont); - x = 4 + tabP->width; - y = 16; - w = FntCharsWidth(nameP, StrLen(nameP)) + 6; - h = 12; - ControlType *addP = CtlNewControl(dstP, (FrmGetFormId(*frmP) + tabP->count), buttonCtl, nameP, x, y, w, h, stdFont, 0, true); - CtlGlueSetFrameStyle(addP, noButtonFrame); - tabP->width += w + 3; - - // create tab content - for (cnt = 0; cnt < objNum; cnt++) { - objP = FrmGetObjectPtr(srcP, cnt); - id = FrmGetObjectId(srcP, cnt); - FrmGetObjectBounds(srcP, cnt, &r); - x = r.topLeft.x - 2; - y = r.topLeft.y + 30; - w = r.extent.x; - h = r.extent.y; - - FrmSetObjectPosition(srcP, cnt, x, y); - - switch (FrmGetObjectType(srcP, cnt)) { - case frmListObj: { - // HOWTO : to auto link the list to a popup trigger the listID must be popupID + 1 if popup id - // desn't exist the triggerID will be 0 and the list will be shown, but take care to not define - // ListID - 1 object if you want to show the list. - ListType *newP; - Char **itemsP = LstGlueGetItemsText((ListType *)objP); - FontID font = LstGlueGetFont((ListType *)objP); - UInt16 visible = LstGetVisibleItems((ListType *)objP); - UInt16 items = LstGetNumberOfItems((ListType *)objP); - UInt16 trigger = id - 1; - trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0; - - LstNewList(dstP, id, x, y, w, h, font, visible, trigger); - newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - LstSetListChoices(newP, itemsP, items); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - case frmFieldObj: { - FieldAttrType attr; - FontID font = FldGetFont((FieldType *)objP); - UInt16 maxChars = FldGetMaxChars((FieldType *)objP); - FldGetAttributes((FieldType *)objP, &attr); - FldNewField(dstP, id, x, y, w, h, font, maxChars, attr.editable, attr.underlined, attr.singleLine, attr.dynamicSize, (JustificationType)attr.justification, attr.autoShift, attr.hasScrollBar, attr.numeric); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - case frmControlObj: { - const Char *textP = CtlGetLabel((ControlType *)objP); - ControlStyleType style = CtlGlueGetControlStyle((ControlType *)objP); - FontID font = CtlGlueGetFont((ControlType *)objP); - ControlType *newP = CtlNewControl(dstP, id, style, textP, x, y, w, h, font, 0, true); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - switch (style) { - case sliderCtl: - { - UInt16 min, max, page, val; - CtlGetSliderValues((ControlType *)objP, &min, &max, &page, &val); - CtlSetSliderValues(newP, &min, &max, &page, &val); - break; - } - } - break; - } - case frmLabelObj: { - const Char *textP = FrmGetLabel(srcP, id); - FontID font = FrmGlueGetLabelFont(srcP, id); - FrmNewLabel((FormType **)dstP, id, textP, x, y, font); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - - case frmBitmapObj: { -/* UInt16 family = id + 1; - FrmNewBitmap((FormType **)dstP, id, id, x, y); - //FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); -*/ break; - } - } - } - - frmP = (FormType **)dstP; // save new form ptr - return errNone; -} - -void TabSetActive(FormType *frmP, TabType *tabP, UInt16 num) { - UInt16 cnt, idx; - RectangleType r; - TabDataPtr dataP; - - if (tabP->active == num) - return; - - dataP = &tabP->tabs[tabP->active]; - - // hide active tab objects - if (tabP->active != tabP->count) { - for (cnt = dataP->first; cnt <= dataP->last; cnt++) { - if ((idx = FrmGetObjectIndex(frmP, cnt)) != frmInvalidObjectId) - FrmHideObject(frmP, idx); - } - } - - // save active tab - tabP->active = num; - dataP = &tabP->tabs[num]; - - // draw tab limit - WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill)); - WinDrawLine(1, 14, 154,14); - WinDrawLine(1, 15, 154,15); - RctSetRectangle(&r, 1, 30, 154, 100); - WinDrawRectangle(&r, 0); - WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); - WinDrawLine(1, 28, 154,28); - - // set tabs size - for (cnt = 0; cnt < tabP->count; cnt++) { - idx = FrmGetObjectIndex (frmP, (FrmGetFormId(frmP) + cnt + 1)); - - if (idx != frmInvalidObjectId) { - FrmGetObjectBounds(frmP, idx, &r); - r.topLeft.y = (num == cnt) ? 17 : 17; - r.extent.y = (num == cnt) ? 12 : 11; - FrmSetObjectBounds(frmP, idx, &r); - - if (num == cnt) { - RGBColorType yellow = {0,255,192,0}; - - UInt8 line = /*(UIColorGetTableEntryIndex(UIFormFill) == UIColorGetTableEntryIndex(UIFieldTextHighlightBackground)) ? - WinRGBToIndex(&yellow) :*/ - UIColorGetTableEntryIndex(UIFieldTextHighlightBackground); - - r.topLeft.y -= 1; - WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); - WinDrawRectangleFrame(simpleFrame, &r); - WinSetForeColor(line); - WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y); - FrmShowObject(frmP, idx); - - } else { - UInt8 frame = UIColorGetTableEntryIndex(UIObjectFrame); - RGBColorType light; - WinIndexToRGB(frame, &light); - light.r = (255 - light.r) > 72 ? light.r + 72 : 255; - light.g = (255 - light.g) > 72 ? light.g + 72 : 255; - light.b = (255 - light.b) > 72 ? light.b + 72 : 255; - - WinSetForeColor(WinRGBToIndex(&light)); - WinDrawRectangleFrame(simpleFrame, &r); - WinSetForeColor(frame); - WinDrawLine(r.topLeft.x - 1, r.topLeft.y + r.extent.y, r.topLeft.x + r.extent.x, r.topLeft.y + r.extent.y); - } - - // round corner - WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill)); - if (OPTIONS_TST(kOptModeHiDensity)) { - WinSetCoordinateSystem(kCoordinatesNative); - WinDrawPixel((r.topLeft.x - 1) * 2, (r.topLeft.y - 1) * 2); - WinDrawPixel((r.topLeft.x + r.extent.x) * 2 + 1, (r.topLeft.y - 1) * 2); - WinSetCoordinateSystem(kCoordinatesStandard); - - } else { - // TODO - } - } - } - - // show objects - for (cnt = dataP->first; cnt <= dataP->last; cnt++) { - if ((idx = FrmGetObjectIndex(frmP, cnt)) != frmInvalidObjectId) - FrmShowObject(frmP, idx); - } - - // post draw function - if (dataP->drawFunc) - (dataP->drawFunc)(); -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formtabs.h b/backends/platform/PalmOS/Src/launcher/forms/formtabs.h deleted file mode 100644 index f14c2ff4e4..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formtabs.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __FORMTABS_H__ -#define __FORMTABS_H__ - -typedef void (TabProc)(); - -typedef struct { - FormPtr srcP; - UInt16 first; - UInt16 last; - TabProc *drawFunc; -} TabDataType, *TabDataPtr; - -typedef struct { - UInt16 count, active; - Coord width; - TabDataPtr tabs; -} TabType, *TabPtr; - -TabType *TabNewTabs (UInt16 cnt); -void TabDeleteTabs (TabType *tabP); -Err TabAddContent (FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc = 0); -void TabSetActive (FormType *frmP, TabType *tabP, UInt16 num); -void TabMoveUpObject (FormType *frmP, UInt16 objID, Coord amount); -#endif diff --git a/backends/platform/PalmOS/Src/launcher/games.cpp b/backends/platform/PalmOS/Src/launcher/games.cpp deleted file mode 100644 index c3f7ef3e4a..0000000000 --- a/backends/platform/PalmOS/Src/launcher/games.cpp +++ /dev/null @@ -1,548 +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$ - * - */ - -#include -#include -#include - -#include "globals.h" -#include "palmdefs.h" -#include "start.h" -#include "games.h" -#include "skin.h" - -#include "StarterRsc.h" - -DmOpenRef gameDB = NULL; - -static Err GamUpdateList() { - if (gameDB) { - UInt16 numRecs = DmNumRecords(gameDB); - - if (numRecs > 0) { - MemHandle tmpH; - UInt32 version, size; - UInt32 *versionP; - - // get record size and version - tmpH = DmQueryRecord(gameDB, 0); - size = MemHandleSize(tmpH); - versionP = (UInt32 *)MemHandleLock(tmpH); - version = *versionP; - MemHandleUnlock(tmpH); - - // check record - if (version != curItemVersion || size != sizeof(GameInfoType)) { - UInt16 index; - GameInfoType gitCur; - void *tmpP; - FormPtr ofmP, frmP; - - // show dialog - ofmP = FrmGetActiveForm(); - frmP = FrmInitForm(ConvertForm); - FrmSetActiveForm(frmP); - FrmDrawForm(frmP); - SysTaskDelay(1 * SysTicksPerSecond()); - - MemSet(&gitCur, sizeof(GameInfoType), 0); - - if (version == itemVersion_357 || - version == itemVersion_356 || - version == itemVersion_355 || - version == itemVersion_354 || - version == itemVersion_353 || - version == itemVersion_352 || - version == itemVersion_351 || - version == itemVersion_350 || - version == itemVersion_340 || - version == itemVersion_330 || - version == itemVersion_320 || - version == itemVersion_310 || - version == itemVersion_300 || - version == itemVersion_270 || - version == itemVersion_260 || - version == itemVersion_250) { - for (index = 0; index < numRecs; index++) { - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&gitCur, tmpP, MemHandleSize(tmpH)); - MemHandleUnlock(tmpH); - - // new format - gitCur.version = curItemVersion; - - if (version < itemVersion_300) { - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - } - - if (version < itemVersion_310) - gitCur.engine = 0; - - if (version < itemVersion_320) - gitCur.renderMode = 0; - - if (version <= itemVersion_330) { - gitCur.fmQuality = 0; - gitCur.gfxMode = (gitCur.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - if (gitCur.engine == 0) gitCur.engine = 8; - else if (gitCur.engine == 1) gitCur.engine = 7; - else if (gitCur.engine == 2) gitCur.engine = 3; - else if (gitCur.engine == 3) gitCur.engine = 1; - else if (gitCur.engine == 4) gitCur.engine = 0; - else if (gitCur.engine == 5) gitCur.engine = 6; - else if (gitCur.engine == 6) gitCur.engine = 4; - else if (gitCur.engine == 7) gitCur.engine = 5; - else if (gitCur.engine == 8) gitCur.engine = 2; - - if (gitCur.renderMode == 1) gitCur.renderMode = 4; - else if (gitCur.renderMode == 2) gitCur.renderMode = 5; - else if (gitCur.renderMode == 3) gitCur.renderMode = 2; - else if (gitCur.renderMode == 4) gitCur.renderMode = 3; - else if (gitCur.renderMode == 5) gitCur.renderMode = 1; - - if (gitCur.platform == 2) gitCur.platform = 6; - else if (gitCur.platform == 5) gitCur.platform = 8; - else if (gitCur.platform == 6) gitCur.platform = 2; - - if (gitCur.language == 1) gitCur.language = 4; - else if (gitCur.language == 2) gitCur.language = 6; - else if (gitCur.language == 3) gitCur.language = 5; - else if (gitCur.language == 4) gitCur.language = 8; - else if (gitCur.language == 5) gitCur.language = 11; - else if (gitCur.language == 6) gitCur.language = 13; - else if (gitCur.language == 7) gitCur.language = 9; - else if (gitCur.language == 8) gitCur.language = 1; - else if (gitCur.language == 9) gitCur.language = 10; - else if (gitCur.language == 10) gitCur.language = 7; - else if (gitCur.language == 11) gitCur.language = 12; - else if (gitCur.language == 12) gitCur.language = 2; - else if (gitCur.language == 13) gitCur.language = 3; - - if (gitCur.musicInfo.sound.drvMusic == 1) gitCur.musicInfo.sound.drvMusic = 4; - else if (gitCur.musicInfo.sound.drvMusic == 2) gitCur.musicInfo.sound.drvMusic = 5; - else if (gitCur.musicInfo.sound.drvMusic == 4) gitCur.musicInfo.sound.drvMusic = 2; - else if (gitCur.musicInfo.sound.drvMusic == 5) gitCur.musicInfo.sound.drvMusic = 1; - } - - if (version <= itemVersion_340) { - gitCur.platform++; - - if (gitCur.language == 3) - gitCur.language = 0; - else if (gitCur.language >= 11) - gitCur.language++; - } - - if (version <= itemVersion_350) - if (gitCur.platform >= 9) - gitCur.platform++; - - if (version <= itemVersion_351) { - if (gitCur.engine >= ENGINE_LURE) // newly added engine - gitCur.engine++; - - if (gitCur.engine == ENGINE_SCUMM) // reorder - gitCur.engine = ENGINE_AGOS; - else if (gitCur.engine == ENGINE_AGOS) - gitCur.engine = ENGINE_SCUMM; - } - - if (version <= itemVersion_352) { - if (gitCur.engine >= ENGINE_CINE) // newly added engine - gitCur.engine++; - - gitCur.platform++; - } - - if (version <= itemVersion_353) - gitCur.musicInfo.sound.drvMusic++; - - if (version <= itemVersion_354) - if (gitCur.engine >= ENGINE_AGI) // newly added engine - gitCur.engine++; - - if (version <= itemVersion_355) { - gitCur.engine++; // renamed Simon -> AGOS - if (gitCur.engine == ENGINE_COUNT) - gitCur.engine = ENGINE_AGOS; - } - - if (version <= itemVersion_356) { - if (gitCur.platform >= 3) - gitCur.platform++; - } - - if (version <= itemVersion_357) - if (gitCur.engine >= ENGINE_PARALLACTION) // newly added engine - gitCur.engine++; - - if (gitCur.musicInfo.volume.palm > 100) - gitCur.musicInfo.volume.palm = 50; - - // simply resize the old record - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - - } else if (version == itemVersion_200) { - // need conversion from V2 -> V3.5.2 - GameInfoTypeV2 git0; - - for (index = 0; index < numRecs; index++) { - - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&git0, tmpP, sizeof(GameInfoTypeV2)); - MemHandleUnlock(tmpH); - - // convert to new format - gitCur.version = curItemVersion; - gitCur.icnID = 0xFFFF; - gitCur.selected = git0.selected; - StrCopy(gitCur.nameP, git0.nameP); - StrCopy(gitCur.pathP, git0.pathP); - StrCopy(gitCur.gameP, git0.gameP); - gitCur.gfxMode = (git0.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - gitCur.autoLoad = git0.autoLoad; - gitCur.bootParam = git0.bootParam; - gitCur.setPlatform = git0.setPlatform; - gitCur.subtitles = git0.subtitles; - gitCur.talkSpeed = git0.talkSpeed; - - gitCur.loadSlot = git0.loadSlot; - gitCur.bootValue = git0.bootValue; - gitCur.talkValue = git0.talkValue; - gitCur.platform = git0.platform; - gitCur.language = git0.language; - - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - - // to V3.4 - if (gitCur.platform == 2) gitCur.platform = 6; - else if (gitCur.platform == 5) gitCur.platform = 8; - else if (gitCur.platform == 6) gitCur.platform = 2; - - if (gitCur.language == 1) gitCur.language = 4; - else if (gitCur.language == 2) gitCur.language = 6; - else if (gitCur.language == 3) gitCur.language = 5; - else if (gitCur.language == 4) gitCur.language = 8; - else if (gitCur.language == 5) gitCur.language = 11; - else if (gitCur.language == 6) gitCur.language = 13; - else if (gitCur.language == 7) gitCur.language = 9; - else if (gitCur.language == 8) gitCur.language = 1; - else if (gitCur.language == 9) gitCur.language = 10; - else if (gitCur.language == 10) gitCur.language = 7; - else if (gitCur.language == 11) gitCur.language = 12; - else if (gitCur.language == 12) gitCur.language = 2; - else if (gitCur.language == 13) gitCur.language = 3; - - if (gitCur.musicInfo.sound.drvMusic == 1) gitCur.musicInfo.sound.drvMusic = 4; - else if (gitCur.musicInfo.sound.drvMusic == 2) gitCur.musicInfo.sound.drvMusic = 5; - else if (gitCur.musicInfo.sound.drvMusic == 4) gitCur.musicInfo.sound.drvMusic = 2; - else if (gitCur.musicInfo.sound.drvMusic == 5) gitCur.musicInfo.sound.drvMusic = 1; - - // to V3.5 - gitCur.platform++; - - if (gitCur.language == 3) - gitCur.language = 0; - else if (gitCur.language >= 11) - gitCur.language++; - - // to V3.5.1 - if (gitCur.platform >= 9) - gitCur.platform++; - - //to V3.5.3 - gitCur.musicInfo.sound.drvMusic++; - - // ----- - gitCur.engine = ENGINE_SCUMM; - - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - } else { - // need conversion from V0 -> V3.5.2 - GameInfoTypeV0 git0; - - for (index = 0; index < numRecs; index++) { - - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&git0, tmpP, sizeof(GameInfoTypeV0)); - MemHandleUnlock(tmpH); - - // convert to new format - gitCur.version = curItemVersion; - gitCur.icnID = 0xFFFF; - gitCur.selected = git0.selected; - StrCopy(gitCur.nameP, git0.nameP); - StrCopy(gitCur.pathP, git0.pathP); - StrCopy(gitCur.gameP, git0.gameP); - gitCur.gfxMode = (git0.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - gitCur.autoLoad = git0.autoLoad; - gitCur.bootParam = git0.bootParam; - gitCur.setPlatform = git0.amiga; // amiga become platform amiga/atari-st/machintosh - gitCur.platform = 1; - gitCur.subtitles = git0.subtitles; - gitCur.talkSpeed = git0.talkSpeed; - - gitCur.loadSlot = git0.loadSlot; - gitCur.bootValue = git0.bootValue; - gitCur.talkValue = git0.talkValue; - gitCur.platform = 2; // default to amiga - gitCur.language = git0.language; - - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - - gitCur.engine = ENGINE_SCUMM; - - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - } - - FrmEraseForm(frmP); - FrmDeleteForm(frmP); - if (ofmP) - FrmSetActiveForm(ofmP); - } - } - } - - return errNone; -} - -Err GamOpenDatabase() { - Err err = errNone; - - gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite); - - if (!gameDB) { - err = DmCreateDatabase(0, "ScummVM-Data", appFileCreator, 'DATA', false); - if (!err) { - gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite); - - if (!gameDB) - err = DmGetLastErr(); - } - } - - if (err) - FrmCustomAlert(FrmErrorAlert,"Cannot open/create games list DB !",0,0); - else - err = GamUpdateList(); - - return err; -} - -void GamImportDatabase() { - if (gPrefs->card.volRefNum != vfsInvalidVolRef && gPrefs->card.moveDB) { - FileRef file; - Err e; - - e = VFSFileOpen(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", vfsModeRead, &file); - if (!e) { - UInt16 oCardNo, nCardNo; - LocalID oDbID, nDbID; - - VFSFileClose(file); - if (gPrefs->card.confirmMoveDB) - if (FrmCustomAlert(FrmConfirmAlert, "Do you want to import games database from memory card ?", 0, 0) == FrmConfirmNo) { - // prevent to replace the file on memory card - gPrefs->card.moveDB = false; - return; - } - - // get current db info and rename it - DmOpenDatabaseInfo(gameDB, &oDbID, 0, 0, &oCardNo, 0); - GamCloseDatabase(true); - e = DmDeleteDatabase(oCardNo, oDbID); - - if (!e) - if (e = VFSImportDatabaseFromFile(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", &nCardNo, &nDbID)) - FrmCustomAlert(FrmErrorAlert, "Failed to import games database from memory card.", 0, 0); - - GamOpenDatabase(); - } - } -} - -void GamCloseDatabase(Boolean ignoreCardParams) { - if (gameDB) { - LocalID dbID; - UInt16 cardNo; - - DmOpenDatabaseInfo(gameDB, &dbID, 0, 0, &cardNo, 0); - DmCloseDatabase(gameDB); - - if (!ignoreCardParams) { - if (gPrefs->card.moveDB && gPrefs->card.volRefNum != vfsInvalidVolRef) { - VFSFileRename(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", "listdata-old.pdb"); - Err e = VFSExportDatabaseToFile(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", cardNo, dbID); - if (!e) { - VFSFileDelete(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata-old.pdb"); - if (gPrefs->card.deleteDB) - DmDeleteDatabase(cardNo, dbID); - } else { - VFSFileRename(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata-old.pdb", "listdata.pdb"); - } - } - } - } - gameDB = NULL; -} - -static Int16 GamCompare(GameInfoType *a, GameInfoType *b, SortRecordInfoPtr, SortRecordInfoPtr, MemHandle) { - return StrCaselessCompare(a->nameP, b->nameP); -} - -Err GamSortList() { - return DmQuickSort (gameDB, (DmComparF *)GamCompare, 0); -} - -void GamUnselect() { - GameInfoType *game; - - MemHandle recordH; - UInt16 index; - - index = GamGetSelected(); - - if (index != dmMaxRecordIndex) { - Boolean newValue; - - recordH = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(recordH); - - newValue = false; - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - } -} - -UInt16 GamGetSelected() { - MemHandle record; - GameInfoType *game; - Boolean selected; - UInt16 index = DmNumRecords(gameDB)-1; - - while (index != (UInt16)-1) { - record = DmQueryRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - selected = game->selected; - MemHandleUnlock(record); - - if (selected) - return index; - - index--; - } - - return dmMaxRecordIndex; -} - -Boolean GamJumpTo(Char letter) { - MemHandle record; - GameInfoType *game; - Boolean found = false; - UInt16 index = 0; - UInt16 maxIndex = DmNumRecords(gameDB); - UInt16 active = GamGetSelected(); - - while (index < maxIndex) { - record = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - if (tolower(game->nameP[0]) == tolower(letter)) { - found = true; - - if (index != active) { - RectangleType rArea; - UInt16 maxView; - Boolean newValue = true; - - SknGetListBounds(&rArea, NULL); - maxView = rArea.extent.y / sknInfoListItemSize; - - GamUnselect(); - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView)) - gPrefs->listPosition = index; - } - } - - MemHandleUnlock(record); - DmReleaseRecord (gameDB, index, 0); - - index++; - - if (found) - return found; - } - - return found; -} diff --git a/backends/platform/PalmOS/Src/launcher/games.h b/backends/platform/PalmOS/Src/launcher/games.h deleted file mode 100644 index 7c381a40f4..0000000000 --- a/backends/platform/PalmOS/Src/launcher/games.h +++ /dev/null @@ -1,212 +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$ - * - */ - -#ifndef __GAMES_H__ -#define __GAMES_H__ - -#define curItemVersion sysMakeROMVersion(3,5,8,0,0) // Parallaction engine - - -#define itemVersion_357 sysMakeROMVersion(3,5,7,0,0) // Added : Apple IIgs -#define itemVersion_356 sysMakeROMVersion(3,5,6,0,0) // Changed : Simon -> AGOS -#define itemVersion_355 sysMakeROMVersion(3,5,5,0,0) // Added : AGI engine -#define itemVersion_354 sysMakeROMVersion(3,5,4,0,0) // Added : Default/Auto music driver -#define itemVersion_353 sysMakeROMVersion(3,5,3,0,0) // Added : CinE engine and 3DO platform -#define itemVersion_352 sysMakeROMVersion(3,5,2,0,0) // Added : Lure engine -#define itemVersion_351 sysMakeROMVersion(3,5,1,0,0) // Added : Sega CD platform -#define itemVersion_350 sysMakeROMVersion(3,5,0,0,0) -#define itemVersion_340 sysMakeROMVersion(3,4,0,0,0) -#define itemVersion_330 sysMakeROMVersion(3,3,0,0,0) -#define itemVersion_320 sysMakeROMVersion(3,2,0,0,0) -#define itemVersion_310 sysMakeROMVersion(3,1,0,0,0) -#define itemVersion_300 sysMakeROMVersion(3,0,0,0,0) -#define itemVersion_270 sysMakeROMVersion(2,7,0,0,0) -#define itemVersion_260 sysMakeROMVersion(2,6,0,0,0) -#define itemVersion_250 sysMakeROMVersion(2,5,0,0,0) -#define itemVersion_200 sysMakeROMVersion(2,0,0,0,0) - -// old config structs -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[10]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - UInt16 loadSlot; - Boolean bootParam; - UInt16 bootValue; - Boolean amiga; - Boolean subtitles; - Boolean talkSpeed; - UInt16 talkValue; - UInt8 language; - -} GameInfoTypeV0; - -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[10]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - Boolean bootParam; - Boolean setPlatform; - Boolean subtitles; - Boolean talkSpeed; - - UInt16 loadSlot; - UInt16 bootValue; - UInt16 talkValue; - UInt8 platform; - UInt8 language; - -} GameInfoTypeV2; - - -// Current config -typedef struct { - struct { - UInt16 palm; - UInt16 music; - UInt16 sfx; // TODO : remove - UInt16 speech; - UInt16 audiocd; - } volume; - - struct { - // midi - Boolean multiMidi; - Boolean music; // TODO : rename this, it is enable audio option - UInt8 drvMusic; - UInt8 tempo; - // sound FX - Boolean sfx; // TODO : remove this - UInt8 rate; - // CD audio - Boolean CD; - UInt8 drvCD, frtCD; - UInt16 defaultTrackLength; - UInt16 firstTrack; - } sound; -} MusicInfoType; - -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[15]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - Boolean bootParam; - Boolean setPlatform; - Boolean subtitles; - Boolean talkSpeed; - - UInt16 loadSlot; - UInt16 bootValue; - UInt16 talkValue; - UInt8 platform; - UInt8 language; // |- v2.5 - - Boolean filter; // v2.6 - Boolean fullscreen; // | - Boolean aspectRatio; // |- v2.7 - - MusicInfoType musicInfo;// v3.0 - - UInt8 engine; // |- v3.1 - UInt8 renderMode; // |- v3.2 -// Boolean use16Bit; // |- v3.3 // removed - UInt8 fmQuality; // |- v3.4 // replace use16Bit -} GameInfoType; - -enum { - ENGINE_AGOS = 0, - ENGINE_SKY, - ENGINE_SWORD1, - ENGINE_SWORD2, - ENGINE_CINE, - ENGINE_QUEEN, - ENGINE_LURE, - ENGINE_GOB, - ENGINE_KYRA, - ENGINE_PARALLACTION, - ENGINE_SAGA, - ENGINE_SCUMM, - ENGINE_AGI, - ENGINE_TOUCHE, - ENGINE_CRUISE, - ENGINE_DRASCULA, - ENGINE_COUNT -}; - -static const struct { - const char *fileP; - const char *nameP; -} engines[] = { - { "agos", "AGOS Engine" }, - { "sky", "Beneath a Steel Sky" }, - { "sword1", "Broken Sword I" }, - { "sword2", "Broken Sword II" }, - { "cine", "Delphine Cinematique v1.0" }, - { "queen", "Flight of the Amazon Queen" }, - { "lure", "Lure of the Tempress" }, - { "gob", "Gobliiins, Bargon Attack and more" }, - { "kyra", "Kyrandia" }, - { "parallaction", "Parallaction" }, - { "saga", "SAGA Engine" }, - { "scumm", "Scumm Games" }, - { "agi", "Sierra AGI" }, - { "touche", "Touche: The Adventures of the Fifth Musketeer" }, - { "cruise", "Beta -> Cruise for a Corpse" }, - { "drascula", "Beta -> Drascula" }, -}; - -// protos -Err GamOpenDatabase (); -void GamImportDatabase (); -void GamCloseDatabase (Boolean ignoreCardParams); -Err GamSortList (); -UInt16 GamGetSelected (); -void GamUnselect (); -Boolean GamJumpTo (Char letter); - -extern DmOpenRef gameDB; - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/launch.cpp b/backends/platform/PalmOS/Src/launcher/launch.cpp deleted file mode 100644 index d83a34e94c..0000000000 --- a/backends/platform/PalmOS/Src/launcher/launch.cpp +++ /dev/null @@ -1,512 +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$ - * - */ - -#include -#include -#include "StarterRsc.h" - -#include "games.h" -#include "start.h" -#include "rumble.h" -#include "globals.h" -#include "features.h" -#include "formUtil.h" -#include "formCards.h" -#include "palmdefs.h" - -#include "init_palmos.h" -#include "init_stuffs.h" - -#include "modules.h" -#include "args.h" - - -#define BUILD_ERROR(m) \ - { StrCopy(msg, m); \ - StrCat(msg, "\n\nPlease check that all required files are installed on your card, and you have enough free storage memory."); \ - goto onError; } - -#define BUILD_FILE(h,m) \ - StrCopy(filename, "/Palm/Programs/ScummVM/Mods/"); \ - StrCat(filename, h); \ - StrCat(filename, m); - -#define FIND_FILE() \ - if (*volRefNum == vfsInvalidVolRef) \ - *volRefNum = ModFind(filename); - - -#define CHECK_FILE(m) \ - e = VFSFileOpen(*volRefNum, filename, vfsModeRead, &file); \ - if (e) \ - BUILD_ERROR(m) \ - else \ - VFSFileClose(file); - -#define IMPRT_FILE(m) \ - e = VFSImportDatabaseFromFile(*volRefNum, filename, &cardNo, &dbID); \ - if (e) \ - BUILD_ERROR(m) - -#define DELET_FILE(f) \ - del_dbID = DmFindDatabase(0, f); \ - if (del_dbID) \ - DmDeleteDatabase(0, del_dbID); - -void ModDelete() { - LocalID del_dbID; - - DELET_FILE("Glbs::Common"); - DELET_FILE("Glbs::Engine"); - DELET_FILE("ScummVM-Engine"); -} - -UInt16 ModFind(const Char *f) { - Err e; - UInt16 volRefNum; - FileRef r; - UInt32 volIterator = vfsIteratorStart|vfsIncludePrivateVolumes; - while (volIterator != vfsIteratorStop) { - e = VFSVolumeEnumerate(&volRefNum, &volIterator); - - if (!e) e = VFSFileOpen(volRefNum, f, vfsModeRead, &r); - if (!e) e = VFSFileClose(r); - if (!e) break; - } - - return volRefNum; -} - -static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) { - DmOpenRef dbRef = DmOpenDatabase(cardNo, dbID, dmModeReadWrite); - - if (dbRef) { - MemHandle pref = DmGetResource('pref',0); - UInt32 size = 0; - - if (pref) { - SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref); - size = data->stackSize; - - if (newSize) { - SysAppPrefsType newData; - MemMove(&newData, data, sizeof(SysAppPrefsType)); - newData.stackSize = newSize; - DmWrite(data, 0, &newData, sizeof(SysAppPrefsType)); - } - - MemPtrUnlock(data); - DmReleaseResource(pref); - } - - DmCloseDatabase(dbRef); - } -} - -static Err ModImport(UInt16 *volRefNum, UInt8 engine, Boolean *armP) { -#ifndef _DEBUG_ENGINE - char filename[256]; - UInt16 cardNo; - LocalID dbID; - UInt32 result; - FileRef file; -#endif - char msg[256]; - FormPtr ofmP, frmP; - Err e = errNone; - - ofmP = FrmGetActiveForm(); - frmP = FrmInitForm(ImportForm); - FrmSetActiveForm(frmP); - FrmDrawForm(frmP); - - // In debug mode, the engine files are directly uploaded to the simulator -#ifndef _DEBUG_ENGINE - // engine file ? - BUILD_FILE(engines[engine].fileP, ".engine"); - FIND_FILE (); - CHECK_FILE("ScummVM engine file was not found !"); - IMPRT_FILE("Cannot import engine file !"); - - // need more files ? - dbID = DmFindDatabase(0, "ScummVM-Engine"); // be sure to have the correct dbID - e = SysAppLaunch(cardNo, dbID, 0, sysAppLaunchCustomEngineGetInfo, 0, &result); - *armP = ((result & GET_MODEARM) == GET_MODEARM); - -/* ARM ONLY FOR NOW, NOT REQUIRED - // common file ? - if (!e && (result & GET_DATACOMMON)) { - BUILD_FILE("common", ".data"); - CHECK_FILE("Common data file was not found !"); - IMPRT_FILE("Cannot import common data file !"); - } - // data file ? - if (!e && (result & GET_DATAENGINE)) { - BUILD_FILE(engines[engine].fileP, ".data"); - CHECK_FILE("Engine data file was not found !"); - IMPRT_FILE("Cannot import engine data file !"); - } -*/ -#endif - // if error, cleanup - if (e) ModDelete(); - -onError: - FrmEraseForm(frmP); - FrmDeleteForm(frmP); - if (e) { - if (ofmP) FrmSetActiveForm(ofmP); - FrmCustomAlert(FrmErrorAlert, msg, 0, 0); - } - - return e; -} - -#undef DELET_FILE -#undef CHECK_FILE -#undef BUILD_FILE - -Boolean StartScummVM(Int16 engine) { - Char **argvP; - UInt8 lightspeed, argc = 0; - UInt32 stackSize; - Boolean toLauncher, direct, isARM; - Char num[6]; - - argvP = ArgsInit(); - direct = false; - - // start command line (exec name) - ArgsAdd(&argvP[argc], "-", NULL, &argc); - // standard path - ArgsAdd(&argvP[argc], "--themepath=", "/PALM/Programs/ScummVM/Themes", &argc); - - UInt16 index = GamGetSelected(); - // no game selected - if (index == dmMaxRecordIndex) { - if (engine == NO_ENGINE) { - // free args - ArgsFree(argvP); - return false; - } - - // default values - if (bDirectMode) - gPrefs->card.volRefNum = parseCards(); // always use the first removable card available (?) - - gVars->filter = true; - gVars->palmVolume = 50; - gVars->fmQuality = FM_QUALITY_INI; - direct = true; - - // somthing selected - } else { - Char pathP[256]; - MemHandle recordH; - GameInfoType *gameInfoP; - - recordH = DmQueryRecord(gameDB,index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - engine = gameInfoP->engine; - - // build path - StrCopy(pathP,"/Palm/Programs/ScummVM/Games/"); - if (gameInfoP->pathP[0] == '/') - StrCopy(pathP, gameInfoP->pathP); - else if (!(gameInfoP->pathP[0] == '.' && StrLen(gameInfoP->pathP) == 1)) - StrCat(pathP, gameInfoP->pathP); - - // path - ArgsAdd(&argvP[argc], "-p", pathP, &argc); - - // language - if (gameInfoP->language > 0) { - const Char *lang = "zh\0cz\0gb\0en\0fr\0de\0hb\0it\0jp\0kr\0pl\0pt\0ru\0es\0se\0"; - ArgsAdd(&argvP[argc], "-q", (lang + (gameInfoP->language - 1) * 3), &argc); - } - - // fullscreen ? - if (gameInfoP->fullscreen) - ArgsAdd(&argvP[argc], "-f", NULL, &argc); - - // aspect-ratio ? - ArgsAdd(&argvP[argc], (gameInfoP->aspectRatio ? "--aspect-ratio" : "--no-aspect-ratio"), NULL, &argc); - - // gfx mode - gVars->filter = gameInfoP->filter; - - switch (gameInfoP->renderMode) { - case 1: - ArgsAdd(&argvP[argc], "--render-mode=", "amiga", &argc); - break; - case 2: - ArgsAdd(&argvP[argc], "--render-mode=", "cga", &argc); - break; - case 3: - ArgsAdd(&argvP[argc], "--render-mode=", "ega", &argc); - break; - case 4: - ArgsAdd(&argvP[argc], "--render-mode=", "hercAmber", &argc); - break; - case 5: - ArgsAdd(&argvP[argc], "--render-mode=", "hercGreen", &argc); - break; - } - - switch (gameInfoP->gfxMode) { - case 1: - ArgsAdd(&argvP[argc], "-g", "wide", &argc); - break; - default: - ArgsAdd(&argvP[argc], "-g", "1x", &argc); - break; - } - - // load state - if (gameInfoP->autoLoad) { - StrIToA(num, gameInfoP->loadSlot); - ArgsAdd(&argvP[argc], "-x", num, &argc); - } - // boot script parameter - if (gameInfoP->bootParam) { - StrIToA(num, gameInfoP->bootValue); - ArgsAdd(&argvP[argc], "-b", num, &argc); - } - // not a PC version - if (gameInfoP->setPlatform) { - static const char *platform[] = { - "3do", - "acorn", - "amiga", - "2gs", - "atari", - "c64", - "pc", - "fmtowns", - "linux", - "mac", - "nes", - "segacd", - "windows" - }; - ArgsAdd(&argvP[argc], "--platform=", platform[gameInfoP->platform], &argc); - } - - // subtitles - if (gameInfoP->subtitles) - ArgsAdd(&argvP[argc], "-n", NULL, &argc); - - // multi midi ? - if (gameInfoP->musicInfo.sound.multiMidi) - ArgsAdd(&argvP[argc], "--multi-midi", NULL, &argc); - - if (engine == ENGINE_SCUMM) { - // music tempo - StrIToA(num, gameInfoP->musicInfo.sound.tempo); - ArgsAdd(&argvP[argc], "--tempo=", num, &argc); - } - - // talk speed - if (gameInfoP->talkSpeed) { - StrIToA(num, gameInfoP->talkValue); - ArgsAdd(&argvP[argc], "--talkspeed=", num, &argc); - } - - // music driver - if (gameInfoP->musicInfo.sound.music) { - static char *drv[] = { - "auto", - "null", - "adlib", - "towns", - "pcjr", - "native", - "pcspk" - }; - - if (StrCompare(drv[gameInfoP->musicInfo.sound.drvMusic], "native") == 0) { - if (OPTIONS_TST(kOptDeviceZodiac)) - ArgsAdd(&argvP[argc], "-e", "zodiac", &argc); // Tapwave Zodiac - else if (OPTIONS_TST(kOptSonyPa1LibAPI)) - ArgsAdd(&argvP[argc], "-e", "ypa1", &argc); // Pa1Lib devices - else - ArgsAdd(&argvP[argc], "-e", "auto", &argc); // no driver, switch to auto - } else { - ArgsAdd(&argvP[argc], "-e", drv[gameInfoP->musicInfo.sound.drvMusic], &argc); - } - - // output rate - UInt32 rates[] = {4000, 8000, 11025, 22050, 44100}; - StrIToA(num, rates[gameInfoP->musicInfo.sound.rate]); - ArgsAdd(&argvP[argc], "--output-rate=", num, &argc); - - // FM quality - gVars->fmQuality = gameInfoP->fmQuality; - - } else { - ArgsAdd(&argvP[argc], "-e", "null", &argc); - } - - // volume control - StrIToA(num, gameInfoP->musicInfo.volume.sfx); - ArgsAdd(&argvP[argc], "-s", num, &argc); - StrIToA(num, gameInfoP->musicInfo.volume.music); - ArgsAdd(&argvP[argc], "-m", num, &argc); - StrIToA(num, gameInfoP->musicInfo.volume.speech); - ArgsAdd(&argvP[argc], "-r", num, &argc); - - // game name - ArgsAdd(&argvP[argc], gameInfoP->gameP, NULL, &argc); - - gVars->palmVolume = gameInfoP->musicInfo.sound.music ? gameInfoP->musicInfo.volume.palm : 0; - - MemHandleUnlock(recordH); - } // end no game / game selected - - // common command line options - - // debug level - if (gPrefs->debug) { - StrIToA(num, gPrefs->debugLevel); - ArgsAdd(&argvP[argc], "-d", num, &argc); - } - - if (engine == ENGINE_QUEEN || engine == ENGINE_SKY) { - // alternative intro ? - if (gPrefs->altIntro) - ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc); - } - - if (engine == ENGINE_SCUMM) { - // demo mode ? - if (gPrefs->demoMode) - ArgsAdd(&argvP[argc], "--demo-mode", NULL, &argc); - } - - // copy protection ? - if (gPrefs->copyProtection) - ArgsAdd(&argvP[argc], "--copy-protection", NULL, &argc); - - // exceed max args ? - if (argc > MAX_ARG) - FrmCustomAlert(FrmErrorAlert, "Too many parameters.",0,0); - - // set some common options - stackSize = (gPrefs->setStack ? STACK_LARGER : STACK_DEFAULT); - lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255); - toLauncher= (gPrefs->exitLauncher); - - // gVars values - // (gVars->HRrefNum defined in checkHRmode on Clie) -#ifndef _DEBUG_ENGINE - gVars->VFS.volRefNum = (gPrefs->card.autoDetect ? vfsInvalidVolRef : gPrefs->card.volRefNum); -#else - gVars->VFS.volRefNum = gPrefs->card.volRefNum; -#endif - gVars->vibrator = gPrefs->vibrator; - gVars->stdPalette = gPrefs->stdPalette; - gVars->VFS.cacheSize = (gPrefs->card.useCache ? gPrefs->card.cacheSize : 0); - gVars->indicator.showLED= gPrefs->card.showLED; - gVars->stylusClick = gPrefs->stylusClick; - gVars->autoSave = (gPrefs->autoSave ? gPrefs->autoSavePeriod : -1); - gVars->advancedMode = gPrefs->advancedMode; - gVars->arrowKeys = gPrefs->arrowKeys; - - // user params - HWR_RSTALL(); - - if (gPrefs->goLCD) - HWR_SET(INIT_GOLCD); - else - OPTIONS_RST(kOptGoLcdAPI); - - if (!gPrefs->autoOff) - HWR_SET(INIT_AUTOOFF); - - if (gVars->vibrator) - HWR_SET(INIT_VIBRATOR); -/* ???? - if ( musicDriver == 1 || - musicDriver == 3 || - musicDriver == 4 || - musicDriver == sysInvalidRefNum) { - HWR_SET(INIT_PA1LIB); - } -*/ - if (ModImport(&gVars->VFS.volRefNum, engine, &isARM) != errNone) { - if (bDirectMode) { - // and force exit if nothing selected - EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrLaunch; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue(&event, 0, true); - } - ArgsFree(argvP); - return false; - } - - // reset mode if screen rotation occurred (DIA only) - if (!direct && OPTIONS_TST(kOptCollapsible)) { - UInt8 mode = PalmScreenSize(0,0, &(gVars->screenFullWidth), &(gVars->screenFullHeight)); - OPTIONS_RST(kOptModeLandscape); - OPTIONS_SET((mode == PALM_LANDSCAPE) ? kOptModeLandscape : kOptNone); - } - - // free and save globals pref memory - GamCloseDatabase(false); - FrmCloseAllForms(); - SavePrefs(); - - { - UInt16 cardNo; - UInt32 dbID; - - LaunchParamType *cmdPBP = (LaunchParamType *)MemPtrNew(sizeof(LaunchParamType)); - - MemPtrSetOwner(cmdPBP, 0); - MemPtrSetOwner(gVars, 0); - ArgsSetOwner(argvP, 0); - - cardNo = 0; - dbID = DmFindDatabase(0, "ScummVM-Engine"); - - if (isARM) - FtrSet(appFileCreator, ftrStack , (stackSize * 4)); - else - ModSetStack(stackSize, cardNo, dbID); - - cmdPBP->args.argc = argc; - cmdPBP->args.argv = argvP; - cmdPBP->gVars = gVars; - cmdPBP->lightspeed = lightspeed; - cmdPBP->exitLauncher = toLauncher; - - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch, cmdPBP); - bLaunched = true; - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/launcher/skin.cpp b/backends/platform/PalmOS/Src/launcher/skin.cpp deleted file mode 100644 index 4c3f722aa1..0000000000 --- a/backends/platform/PalmOS/Src/launcher/skin.cpp +++ /dev/null @@ -1,612 +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$ - * - */ - -#include -#include -#include - -#include "start.h" -#include "games.h" -#include "globals.h" -#include "skin.h" -#include "StarterRsc.h" - -UInt16 lastIndex = dmMaxRecordIndex; // last select index in the list to prevent flash -static WinHandle winLockH = NULL; - -MemPtr SknScreenLock(WinLockInitType initMode) { - Err e; - RectangleType r; - - WinGetBounds(WinGetDisplayWindow(), &r); - winLockH = WinCreateOffscreenWindow(r.extent.x, r.extent.y, nativeFormat, &e); - WinSetDrawWindow(winLockH); - - if (initMode == winLockCopy) - WinCopyRectangle(WinGetDisplayWindow(), winLockH, &r, 0, 0, winPaint); - - return BmpGetBits(WinGetBitmap(winLockH)); -} - -void SknScreenUnlock() { - RectangleType r; - - WinGetBounds(winLockH, &r); - WinCopyRectangle(winLockH, WinGetDisplayWindow(), &r, 0, 0, winPaint); - WinSetDrawWindow(WinGetDisplayWindow()); - WinDeleteWindow(winLockH, false); - winLockH = NULL; -} - -static void SknGetListColors(DmOpenRef skinDBP, UInt8 *text, UInt8 *selected, UInt8 *background) { - UInt16 colIndex; - MemHandle colH; - UInt8 *colTemp; - - // default - *text = UIColorGetTableEntryIndex (UIMenuForeground); - *selected = UIColorGetTableEntryIndex (UIMenuSelectedForeground); - *background = UIColorGetTableEntryIndex (UIMenuSelectedFill); - - if (skinDBP) { - colIndex = DmFindResource (skinDBP, sknColorsRsc, skinColors, NULL); - - if (colIndex != (UInt16)-1) { - colH = DmGetResourceIndex(skinDBP, colIndex); - - if (colH) { - colTemp = (UInt8 *)MemHandleLock(colH); - - *text = colTemp[0]; - *selected = colTemp[1]; - *background = colTemp[2]; - - MemPtrUnlock(colTemp); - DmReleaseResource(colH); - } - } - } -} - -static void SknCopyBits(DmOpenRef skinDBP, DmResID bitmapID, const RectangleType *srcRect, Coord destX, Coord destY) { - MemHandle hTemp; - BitmapPtr bmpTemp; - UInt16 index; - - Coord cx, cy, cw, ch, bw, bh; - RectangleType copy, old; - - if (skinDBP) { - // find the bitmap - index = DmFindResource (skinDBP, bitmapRsc, bitmapID, NULL); - - if (index != (UInt16)-1) { - hTemp = DmGetResourceIndex(skinDBP,index); - - if (hTemp) { - bmpTemp = (BitmapType *)MemHandleLock(hTemp); - BmpGlueGetDimensions(bmpTemp, &bw, &bh, 0); - - if (!srcRect) { - cx = 0; - cy = 0; - cw = bw; - ch = bh; - } else { - cx = srcRect->topLeft.x; - cy = srcRect->topLeft.y; - cw = srcRect->extent.x; - ch = srcRect->extent.y; - } - - if (ch) { - WinGetClip(&old); - if (OPTIONS_TST(kOptModeHiDensity)) { - Err e; - BitmapTypeV3 *bmp2P; - - // create an uncompressed version of the bitmap - WinHandle win = WinCreateOffscreenWindow(bw, bh, screenFormat, &e); - WinHandle old = WinGetDrawWindow(); - WinSetDrawWindow(win); - WinDrawBitmap(bmpTemp, 0, 0); - WinSetDrawWindow(old); - - bmp2P = BmpCreateBitmapV3(WinGetBitmap(win), kDensityDouble, BmpGetBits(WinGetBitmap(win)), NULL); - - copy.topLeft.x = destX / 2; - copy.topLeft.y = destY / 2; - copy.extent.x = cw / 2; - copy.extent.y = ch / 2; - - WinSetClip(©); - WinDrawBitmap((BitmapPtr)bmp2P, (destX - cx) / 2, (destY - cy) / 2); - BmpDelete((BitmapPtr)bmp2P); - WinDeleteWindow(win, false); - - } else { - copy.topLeft.x = destX; - copy.topLeft.y = destY; - copy.extent.x = cw; - copy.extent.y = ch; - - HRWinSetClip(gVars->HRrefNum, ©); - HRWinDrawBitmap(gVars->HRrefNum, bmpTemp, destX - cx, destY - cy); - } - WinSetClip(&old); - } - - MemPtrUnlock(bmpTemp); - DmReleaseResource(hTemp); - } - } - } -} - -void SknApplySkin() { - DmOpenRef skinDBP; - RectangleType r; - FormPtr frmP = FrmGetActiveForm(); - - // draw skin - FrmDrawForm(frmP); - SknScreenLock(winLockCopy); - - skinDBP = SknOpenSkin(); - - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSBitMap)); - else - FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSNoneBitMap)); - - WinSetForeColor(255); - WinSetDrawMode(winPaint); - WinDrawLine (0, 14, 159, 14); - WinDrawLine (0, 13, 159, 13); - - SknGetObjectBounds(skinDBP, skinBackgroundImageTop, &r); - SknCopyBits(skinDBP, skinBackgroundImageTop, 0, r.topLeft.x, r.topLeft.y); - SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &r); - SknCopyBits(skinDBP, skinBackgroundImageBottom, 0, r.topLeft.x, r.topLeft.y); - - for (UInt16 resID = 1100; resID <= 7000; resID += 100) { - SknSetState(skinDBP, resID, sknStateNormal); - SknShowObject(skinDBP, resID); - } - - SknCloseSkin(skinDBP); - SknScreenUnlock(); - SknUpdateList(); -} - -void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP) { - - UInt16 bmpIndex, strIndex; - MemHandle hBmp, hStr; - BitmapType *bmpTemp; - UInt8 *strTemp; - - RctSetRectangle(rP, 0, 0, 0, 0); - - if (skinDBP) { - bmpIndex = DmFindResource (skinDBP, bitmapRsc, resID, NULL); - - if (bmpIndex != (UInt16)-1) { // if bmp exists - strIndex = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (strIndex != (UInt16)-1) { // if params exist - hBmp = DmGetResourceIndex(skinDBP,bmpIndex); - - if (hBmp) { - hStr = DmGetResourceIndex(skinDBP,strIndex); - - if (hStr) { - // buttons : state|x|y|w/h slider|draw mode|x1/y1 keep|x2/y2 keep slider - // list (160mode) : state|x|y|w|h| - bmpTemp = (BitmapType *)MemHandleLock(hBmp); - strTemp = (UInt8 *)MemHandleLock(hStr); - - BmpGlueGetDimensions(bmpTemp, &(rP->extent.x), &(rP->extent.y), 0); - rP->topLeft.x = strTemp[sknInfoPosX] * 2; - rP->topLeft.y = strTemp[sknInfoPosY] * 2; - - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - - MemPtrUnlock(bmpTemp); - DmReleaseResource(hBmp); - } - } - } - } -} - -DmOpenRef SknOpenSkin() { - return DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly); -} - -void SknCloseSkin(DmOpenRef skinDBP) { - if (skinDBP) - DmCloseDatabase(skinDBP); -} - -UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState) { - - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 oldState = 0; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - oldState = strTemp[sknInfoState]; - - if (oldState != newState) { - DmWrite(strTemp, 0, &newState, 1); - } - - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return oldState; -} - -UInt8 SknGetDepth(DmOpenRef skinDBP) { - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 depth = 8; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknDepthRsc, skinDepth, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - depth = *strTemp; - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return depth; -} - -UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID) { - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 oldState = sknStateDisabled; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - oldState = strTemp[sknInfoState]; - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return oldState; -} - -void SknShowObject(DmOpenRef skinDBP, DmResID resID) { - RectangleType r; - UInt8 state = SknGetState(skinDBP, resID); - SknGetObjectBounds(skinDBP, resID, &r); - SknCopyBits(skinDBP, resID + state, NULL, r.topLeft.x, r.topLeft.y); -} - -void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP) { - DmOpenRef skinDBP; - UInt16 strIndex; - MemHandle hStr; - UInt8 *strTemp; - UInt16 x,y,w,h; - - skinDBP = DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly); - if (skinDBP) { - strIndex = DmFindResource (skinDBP, sknPosRsc, skinList, NULL); - - if (strIndex != 0xFFFF) { // if params exist - hStr = DmGetResourceIndex(skinDBP,strIndex); - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - - x = strTemp[sknInfoPosX]; - y = strTemp[sknInfoPosY]; - w = strTemp[sknInfoListWidth]; - h = strTemp[sknInfoListSize] * sknInfoListItemSize; - - if (rAreaP) - RctSetRectangle(rAreaP ,x, y, w, h); - if (rArea2xP) - RctSetRectangle(rArea2xP, x+x, y+y, w+w, h+h); - - MemHandleUnlock(hStr); - DmReleaseResource(hStr); - } - } - - DmCloseDatabase(skinDBP); - } -} - -static void SknRedrawTools(DmOpenRef skinDBP) { - if (GamGetSelected() == dmMaxRecordIndex) { - if (SknGetState(skinDBP, skinButtonGameDelete) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameDelete,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameDelete); - } - if (SknGetState(skinDBP, skinButtonGameEdit) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameEdit,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameEdit); - } - if (SknGetState(skinDBP, skinButtonGameAudio) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameAudio,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameAudio); - } - - } else { - if (SknGetState(skinDBP, skinButtonGameDelete) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameDelete,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameDelete); - } - if (SknGetState(skinDBP, skinButtonGameEdit) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameEdit,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameEdit); - } - if (SknGetState(skinDBP, skinButtonGameAudio) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameAudio,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameAudio); - } - } -} - -static void SknRedrawSlider(DmOpenRef skinDBP, UInt16 index, UInt16 maxIndex, UInt16 perPage) { - if (maxIndex <= perPage) { - if (SknGetState(skinDBP,skinSliderUpArrow) != sknStateDisabled) { - SknSetState(skinDBP,skinSliderUpArrow,sknStateDisabled); - SknShowObject(skinDBP,skinSliderUpArrow); - } - if (SknGetState(skinDBP,skinSliderDownArrow) != sknStateDisabled) { - SknSetState(skinDBP,skinSliderDownArrow,sknStateDisabled); - SknShowObject(skinDBP,skinSliderDownArrow); - } - - } else { - if (SknGetState(skinDBP,skinSliderUpArrow) == sknStateDisabled) { - SknSetState(skinDBP,skinSliderUpArrow,sknStateNormal); - SknShowObject(skinDBP,skinSliderUpArrow); - } - if (SknGetState(skinDBP,skinSliderDownArrow) == sknStateDisabled) { - SknSetState(skinDBP,skinSliderDownArrow,sknStateNormal); - SknShowObject(skinDBP,skinSliderDownArrow); - } - } -} - -void SknUpdateList() { - MemHandle record; - Int32 index, maxIndex, maxView; - GameInfoType *game; - RectangleType rArea, rField, rCopy, rArea2x; - DmOpenRef skinDBP; - - UInt8 txtColor, norColor, selColor, bkgColor; - UInt16 x,y; - - SknScreenLock(winLockCopy); - - SknGetListBounds(&rArea, &rArea2x); - skinDBP = SknOpenSkin(); - // set default bg - WinSetForeColor(UIColorGetTableEntryIndex (UIFormFill)); - WinDrawRectangle(&rArea,0); - // copy top bg - SknGetObjectBounds(skinDBP, skinBackgroundImageTop, &rField); - RctGetIntersection(&rArea2x, &rField, &rCopy); - x = rCopy.topLeft.x; - y = rCopy.topLeft.y; - rCopy.topLeft.x -= rField.topLeft.x; - rCopy.topLeft.y -= rField.topLeft.y; - SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y); - // copy bottom bg - SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField); - RctGetIntersection(&rArea2x, &rField, &rCopy); - x = rCopy.topLeft.x; - y = rCopy.topLeft.y; - rCopy.topLeft.x -= rField.topLeft.x; - rCopy.topLeft.y -= rField.topLeft.y; - SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y); - - FntSetFont(stdFont); - - index = gPrefs->listPosition; - maxIndex = DmNumRecords(gameDB); - maxView = rArea.extent.y / sknInfoListItemSize; - - if (index > 0 && (index + maxView) > maxIndex) - index -= (index + maxView) - maxIndex; - - if (index < 0) - index = 0; - - gPrefs->listPosition = index; - - SknRedrawSlider(skinDBP, index, maxIndex, maxView); - SknRedrawTools(skinDBP); - SknGetListColors(skinDBP, &norColor, &selColor, &bkgColor); - - SknCloseSkin(skinDBP); - - while (index < (gPrefs->listPosition + maxView) && index < maxIndex) { - record = DmQueryRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - // text box - RctSetRectangle(&rField, rArea.topLeft.x, (rArea.topLeft.y + sknInfoListItemSize * (index - gPrefs->listPosition)), rArea.extent.x, sknInfoListItemSize); - WinSetClip(&rField); - - if (game->selected) { - WinSetDrawMode(winPaint); - WinSetForeColor(bkgColor); - WinDrawRectangle(&rField,0); - txtColor = selColor; - } - else - txtColor = norColor; - - // clipping - rField.topLeft.x += 2; - rField.extent.x -= 4; - WinSetClip(&rField); - // draw text mask - WinSetTextColor(255); - WinSetDrawMode(winMask); - WinPaintChars(game->nameP, StrLen(game->nameP), rField.topLeft.x, rField.topLeft.y); - // draw text - if (txtColor) { - WinSetTextColor(txtColor); - WinSetDrawMode(winOverlay); - WinPaintChars(game->nameP, StrLen(game->nameP), rField.topLeft.x, rField.topLeft.y); - } - - MemHandleUnlock(record); - index++; - } - - RctSetRectangle(&rArea,0,0,160,160); - WinSetClip(&rArea); - SknScreenUnlock(); -} - -UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my) { - UInt16 resID; - RectangleType r; - - mx *= 2; - my *= 2; - - if (skinDBP) { - for (resID = 1100; resID <= 7000; resID += 100) { - if (SknGetState(skinDBP, resID) != sknStateDisabled) { - SknGetObjectBounds(skinDBP, resID, &r); - if (RctPtInRectangle(mx, my, &r)) { - return resID; - } - } - } - } - - return 0; -} - -void SknSelect(Coord x, Coord y) { - RectangleType rArea; - SknGetListBounds(&rArea,0); - - if (RctPtInRectangle(x, y, &rArea)) { - UInt16 index; - MemHandle record; - GameInfoType *game; - UInt16 oldIndex; - - index = (y - rArea.topLeft.y) / sknInfoListItemSize + gPrefs->listPosition; - - if (index == lastIndex) - return; - - if (index < DmNumRecords(gameDB)) { - Boolean newValue; - - oldIndex = GamGetSelected(); - - if (oldIndex != index && oldIndex != dmMaxRecordIndex) - GamUnselect(); - - record = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - newValue = !game->selected; - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - MemHandleUnlock(record); - DmReleaseRecord (gameDB, index, 0); - - lastIndex = index; - SknUpdateList(); - } - } -} - -Boolean SknProcessArrowAction(UInt16 button) { - Boolean handled = false; - - switch (button) { - case skinSliderUpArrow: - if (gPrefs->listPosition > 0) { - gPrefs->listPosition--; - SknUpdateList(); - } - handled = true; - break; - - case skinSliderDownArrow: - RectangleType rArea; - UInt16 maxView; - - SknGetListBounds(&rArea, 0); - maxView = rArea.extent.y / sknInfoListItemSize; - - if (gPrefs->listPosition < DmNumRecords(gameDB)-maxView) { - gPrefs->listPosition++; - SknUpdateList(); - } - handled = true; - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/skin.h b/backends/platform/PalmOS/Src/launcher/skin.h deleted file mode 100644 index e8a81e7e2d..0000000000 --- a/backends/platform/PalmOS/Src/launcher/skin.h +++ /dev/null @@ -1,131 +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$ - * - */ - -#ifndef __SKIN_H__ -#define __SKIN_H__ - -// skin -#define sknInfoState 0 -#define sknInfoPosX 1 -#define sknInfoPosY 2 - -#define sknInfoMaxWOrH 3 -#define sknInfoDrawMode 4 -#define sknInfoKeepXOrY1 5 -#define sknInfoKeepXOrY2 7 - -#define sknInfoListWidth sknInfoMaxWOrH -#define sknInfoListHeight sknInfoDrawMode -#define sknInfoListSize sknInfoListHeight -#define sknInfoListItemSize 12 - -#define sknPosRsc 'sPos' -#define sknColorsRsc 'sCol' -#define sknDepthRsc 'sDep' - -#define sknStateNormal 0 -#define sknStateSelected 10 -#define sknStateDisabled 20 - -#define sknSelectedState(bmp) (bmp + sknStateSelected) -#define sknDisabledState(bmp) (bmp + sknStateDisabled) - -// skin elements -#define skinList 500 -#define skinColors 600 -#define skinDepth 700 - -#define skinButtonNone 0 - -#define skinSliderUpArrow 2000 -#define skinSliderDownArrow 2100 - -#define skinButtonGameParams 3000 -#define skinButtonGameAdd 3100 -#define skinButtonGameEdit 3200 -#define skinButtonGameAudio 3300 -#define skinButtonGameDelete 4000 -#define skinButtonGameStart 7000 - -#define skinBackgroundImageTop 1000 -#define skinBackgroundImageBottom 1010 -/// - - -#define skinToolsBackground 1100 - -#define skinListUpArrowNormal 1500 -#define skinListUpArrowOver 1510 -#define skinListUpArrowDisabled 1540 - -#define skinListDownArrowNormal 1800 -#define skinListDownArrowOver 1810 -#define skinListDownArrowDisabled 1840 - -#define skinButtonGameInfoNormal 2000 -#define skinButtonGameInfoOver 2010 -#define skinButtonGameInfoDisabled 2040 - -#define skinButtonGameParamNormal 3000 -#define skinButtonGameParamOver 3010 - -#define skinButtonGameDeleteNormal 4000 -#define skinButtonGameDeleteOver 4010 -#define skinButtonGameDeleteDisabled 4040 - -#define skinButtonVibratorNormal 5000 -#define skinButtonVibratorOver 5010 -#define skinButtonVibratorSelected 5020 -#define skinButtonVibratorSelectedOver 5030 -#define skinButtonVibratorDisabled 5040 - - -#define skinButtonSleepNormal 6000 -#define skinButtonSleepOver 6010 -#define skinButtonSleepSelected 6020 -#define skinButtonSleepSelectedOver 9030 - -#define skinButtonPlayNormal 7000 -#define skinButtonPlayOver 7010 -#define skinButtonPlayDisabled 7040 - -// protos -void SknApplySkin(); -void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP); -DmOpenRef SknOpenSkin(); -void SknCloseSkin(DmOpenRef skinDBP); -UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState); -void SknShowObject(DmOpenRef skinDBP, DmResID resID); -UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID); -void SknUpdateList(); -void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP); -UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my); -void SknSelect(Coord x, Coord y); -Boolean SknProcessArrowAction(UInt16 button); -UInt8 SknGetDepth(DmOpenRef skinDBP); - -extern UInt16 lastIndex; - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/start.cpp b/backends/platform/PalmOS/Src/launcher/start.cpp deleted file mode 100644 index b5e8f24884..0000000000 --- a/backends/platform/PalmOS/Src/launcher/start.cpp +++ /dev/null @@ -1,367 +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$ - * - */ - -#include -#include - -#include "palmdefs.h" -#include "start.h" -#include "games.h" -#include "globals.h" -#include "modules.h" -#include "skin.h" - -#include "forms.h" - -/*********************************************************************** - * - * Global variables - * - ***********************************************************************/ -GlobalsPreferencePtr gPrefs; -GlobalsDataPtr gVars; - -Boolean bDirectMode = false; -Boolean bLaunched = false; - -/*********************************************************************** - * - * Internal Constants - * - ***********************************************************************/ - -// Define the minimum OS version we support (3.5 for now). -#define kOurMinVersion sysMakeROMVersion(3,5,0,sysROMStageRelease,0) -#define kPalmOS10Version sysMakeROMVersion(1,0,0,sysROMStageRelease,0) - -/*********************************************************************** - * - * Internal Functions - * - ***********************************************************************/ - -// Callback for ExgDBWrite to send data with Exchange Manager -static Err WriteDBData(const void* dataP, UInt32* sizeP, void* userDataP) { - Err err; - *sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err); - return err; -} - -Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP) { - ExgSocketType exgSocket; - Err err; - - // Create exgSocket structure - MemSet(&exgSocket, sizeof(exgSocket), 0); - exgSocket.description = descriptionP; - exgSocket.name = nameP; - - // Start an exchange put operation - err = ExgPut(&exgSocket); - if (!err) { - err = ExgDBWrite(WriteDBData, &exgSocket, NULL, dbID, cardNo); - err = ExgDisconnect(&exgSocket, err); - } - - return err; -} - - -/*********************************************************************** - * - * FUNCTION: RomVersionCompatible - * - * DESCRIPTION: This routine checks that a ROM version is meet your - * minimum requirement. - * - * PARAMETERS: requiredVersion - minimum rom version required - * (see sysFtrNumROMVersion in SystemMgr.h - * for format) - * launchFlags - flags that indicate if the application - * UI is initialized. - * - * RETURNED: error code or zero if rom is compatible - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags) { - UInt32 romVersion; - - // See if we're on in minimum required version of the ROM or later. - FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); - if (romVersion < requiredVersion) { - if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) == - (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) { - - FrmAlert (RomIncompatibleAlert); - - // Palm OS 1.0 will continuously relaunch this app unless we switch to - // another safe one. - if (romVersion <= kPalmOS10Version) - AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL); - - } - return sysErrRomIncompatible; - } - - return errNone; -} - -/////////////////////////////////////////////////////////////////////// - - -void SavePrefs() { - if (gPrefs) { - PrefSetAppPreferences(appFileCreator, appPrefID, appPrefVersionNum, gPrefs, sizeof (GlobalsPreferenceType), true); - MemPtrFree(gPrefs); - gPrefs = NULL; - } -} - -/*********************************************************************** - * - * FUNCTION: AppHandleEvent - * - * DESCRIPTION: This routine loads form resources and set the event - * handler for the form loaded. - * - * PARAMETERS: event - a pointer to an EventType structure - * - * RETURNED: true if the event has handle and should not be passed - * to a higher level handler. - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Boolean AppHandleEvent(EventPtr eventP) { - UInt16 formId; - FormPtr frmP; - - if (eventP->eType == frmLoadEvent) { - // Load the form resource. - formId = eventP->data.frmLoad.formID; - frmP = FrmInitForm(formId); - FrmSetActiveForm(frmP); - - // Set the event handler for the form. The handler of the currently - // active form is called by FrmHandleEvent each time is receives an - // event. - switch (formId) { - case MainForm: - FrmSetEventHandler(frmP, MainFormHandleEvent); - break; - - case SkinsForm: - FrmSetEventHandler(frmP, SkinsFormHandleEvent); - break; - - case GameEditForm: - FrmSetEventHandler(frmP, EditGameFormHandleEvent); - break; - - case MiscForm: - FrmSetEventHandler(frmP, MiscFormHandleEvent); - break; - - case CardSlotForm: - FrmSetEventHandler(frmP, CardSlotFormHandleEvent); - break; - - case MusicForm: - FrmSetEventHandler(frmP, MusicFormHandleEvent); - break; - - case InfoForm: - FrmSetEventHandler(frmP, InfoFormHandleEvent); - break; - - case EngineForm: - FrmSetEventHandler(frmP, SelectorFormHandleEvent); - break; - - default: -// ErrFatalDisplay("Invalid Form Load Event"); - break; - } - return true; - } - - return false; -} - -/*********************************************************************** - * - * FUNCTION: AppEventLoop - * - * DESCRIPTION: This routine is the event loop for the application. - * - * PARAMETERS: nothing - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void AppEventLoop(void) { - UInt16 error; - EventType event; - - do { - EvtGetEvent(&event, evtNoWait); - - if (! SysHandleEvent(&event)) - if (! MenuHandleEvent(0, &event, &error)) - if (! AppHandleEvent(&event)) - FrmDispatchEvent(&event); - - } while (event.eType != appStopEvent); -} - -/*********************************************************************** - * - * FUNCTION: ScummVMPalmMain - * - * DESCRIPTION: This is the main entry point for the application. - * - * PARAMETERS: cmd - word value specifying the launch code. - * cmdPB - pointer to a structure that is associated with the launch code. - * launchFlags - word value providing extra information about the launch. - * - * RETURNED: Result of launch - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void AppLaunchCmdNotify(UInt16 LaunchFlags, SysNotifyParamType * pData) { - switch (pData->notifyType) { - case sysNotifyVolumeMountedEvent: - pData->handled = true; // don't switch - - if (gPrefs) { // gPrefs exists ? so we are in the palm selector - CardSlotFormUpdate(); // redraw card list if needed - - if (gPrefs->card.volRefNum == vfsInvalidVolRef) { - VFSAnyMountParamType *notifyDetailsP = (VFSAnyMountParamType *)pData->notifyDetailsP; - gPrefs->card.volRefNum = notifyDetailsP->volRefNum; - - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - CardSlotCreateDirs(); - FrmUpdateForm(MainForm, frmRedrawUpdateMSImport); - } - } - } - break; - - case sysNotifyVolumeUnmountedEvent: - if (gPrefs) { - CardSlotFormUpdate(); - - if (gPrefs->card.volRefNum == (UInt16)pData->notifyDetailsP) { - gPrefs->card.volRefNum = vfsInvalidVolRef; - - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - FrmUpdateForm(MainForm, frmRedrawUpdateMS); - } - } - break; - - case sysNotifyDisplayResizedEvent: - if (gVars) - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - SknApplySkin(); - break; - - case sonySysNotifyMsaEnforceOpenEvent: - // what am i supposed to do here ??? - break; - } -} - -static UInt32 ScummVMPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - Err error; - - error = RomVersionCompatible (kOurMinVersion, launchFlags); - if (error) return (error); - - switch (cmd) { - case sysAppLaunchCmdNotify: - AppLaunchCmdNotify(launchFlags, (SysNotifyParamType *) cmdPBP); - break; - - case sysAppLaunchCustomEngineDelete: -#ifndef _DEBUG_ENGINE - ModDelete(); -#endif - break; - - case sysAppLaunchCmdNormalLaunch: - error = AppStart(); - if (error) - goto end; - - if (!bDirectMode) { - FrmGotoForm(MainForm); - }else { - GamUnselect(); - FrmGotoForm(EngineForm); - } - - AppEventLoop(); -end: - AppStop(); - break; - - default: - break; - - } - return error; -} - -/*********************************************************************** - * - * FUNCTION: PilotMain - * - * DESCRIPTION: This is the main entry point for the application. - * - * PARAMETERS: cmd - word value specifying the launch code. - * cmdPB - pointer to a structure that is associated with the launch code. - * launchFlags - word value providing extra information about the launch. - * RETURNED: Result of launch - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - return ScummVMPalmMain(cmd, cmdPBP, launchFlags); -} diff --git a/backends/platform/PalmOS/Src/launcher/start.h b/backends/platform/PalmOS/Src/launcher/start.h deleted file mode 100644 index 3ed52b465b..0000000000 --- a/backends/platform/PalmOS/Src/launcher/start.h +++ /dev/null @@ -1,98 +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$ - * - */ - -#ifndef __START_H__ -#define __START_H__ - -typedef struct { - Char nameP[32]; - UInt16 cardNo; - LocalID dbID; -} SkinInfoType, *SkinInfoPtr; - -typedef struct { - - //skin params - SkinInfoType skin; // card where is located the skin - Boolean soundClick; - - Boolean vibrator; - Boolean autoOff; - Boolean setStack; - Boolean exitLauncher; - Boolean goLCD; - Boolean stylusClick; - Boolean arrowKeys; - - UInt16 listPosition; - UInt16 autoSavePeriod; - - struct { - UInt16 volRefNum; - UInt32 cacheSize; - Boolean useCache; - Boolean showLED; - Boolean autoDetect; - Boolean moveDB; - Boolean deleteDB; - Boolean confirmMoveDB; - } card; - - Boolean debug; - UInt16 debugLevel; - Boolean stdPalette; - Boolean demoMode; - Boolean copyProtection; - Boolean oldarm;// TODO : free slot... - Boolean altIntro; - Boolean autoSave; - Boolean advancedMode; - - struct { - Boolean enable; - UInt8 mode; - } lightspeed; - -} GlobalsPreferenceType, *GlobalsPreferencePtr; - -extern GlobalsPreferencePtr gPrefs; - -extern Boolean bDirectMode; -extern Boolean bLaunched; - -#define appPrefID 0x00 -#define appVersionNum 0x01 -#define appPrefVersionNum 0x02 - -#define STACK_DEFAULT 8192 -#define STACK_LARGER 16384 -#define STACK_GET 0 - -Err AppStart(void); -void AppStop(void); -Boolean StartScummVM(Int16 engine = -1); -void SavePrefs(); -Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP); -#endif diff --git a/backends/platform/PalmOS/Src/modules.cpp b/backends/platform/PalmOS/Src/modules.cpp deleted file mode 100644 index b16e2cf7d5..0000000000 --- a/backends/platform/PalmOS/Src/modules.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include - -#include "palmdefs.h" -#include "args.h" -#include "globals.h" -#include "modules.h" -#include "features.h" - -#include "rumble.h" -#include "init_mathlib.h" -#include "init_pa1lib.h" -#include "init_palmos.h" -#include "init_stuffs.h" -#include "init_sony.h" -#include "init_golcd.h" - -#ifndef DISABLE_LIGHTSPEED -#include "lightspeed_public.h" -#endif - -GlobalsDataPtr gVars; - -#include "endianutils.h" -#include - -#ifdef COMPILE_ZODIAC -# include -# include -#endif - -void run(int argc, char *argv[]) { - // init args - ArgsExportInit(argv, argc, true); - - // init system - PalmHRInit(16); - PalmInit(HWR_GET()); - void *__ptr = StuffsForceVG(); - - gVars->screenPitch = StuffsGetPitch(gVars->screenFullWidth); - - // export global struct to ARM - VARS_EXPORT(); - DO_VARS(_4B, 32, 0); - DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32))); - FtrSet(appFileCreator, ftrVars , (UInt32)gVars); - - // run the module -#ifdef COMPILE_ZODIAC - NativeFuncType *entry; - TwLoadModule(0, 0, 0, 1, twLoadFlagTNA|twLoadFlagQuickRun, &entry); -#else - PnoDescriptor pno; - PnoLoadFromResources(&pno, 'ARMC', 1, appFileCreator, 1); - PnoCall(&pno, 0); - PnoUnload(&pno); -#endif - - // reset globals - DO_VARS(_4B, 32, 0); - DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32))); - - // release - StuffsReleaseVG(__ptr); - PalmRelease(HWR_GET()); - PalmHRRelease(); - - // free args - ArgsExportRelease(true); - ArgsFree(argv); - - // release global struct - FtrUnregister(appFileCreator, ftrVars); - FtrUnregister(appFileCreator, ftrStack); - MemPtrFree(gVars); - - // reset the palette if needed - WinPalette(winPaletteSetToDefault, 0, 256, NULL); -} - -static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) -{ - UInt32 result = 0; - - switch (cmd) { - case sysAppLaunchCustomEngineGetInfo: { -#ifdef PALMOS_NATIVE - result = GET_MODEARM; -#else -# if defined(ENABLE_SCUMM) || \ - defined(ENABLE_AGOS) || \ - defined(ENABLE_SWORD1) - result = GET_DATACOMMON|GET_DATAENGINE|GET_MODE68K; -# else - result = GET_DATACOMMON|GET_MODE68K; -# endif -#endif - break; - } - - case sysAppLaunchCmdNormalLaunch: { - if (cmdPBP) { - Char **argvP; - UInt16 cardNo; - LocalID dbID; - - LaunchParamType *lp = (LaunchParamType *)cmdPBP; - - gVars = lp->gVars; - argvP = lp->args.argv; - - // get the free memory on the dynamic heap - PalmGetMemory(0,0,0, &(gVars->startupMemory)); - -#ifndef DISABLE_LIGHTSPEED - switch (lp->lightspeed) { - case 0: - LS_SetCPUSpeedHigh(); - break; - case 1: - LS_SetCPUSpeedNormal(); - break; - case 2: - LS_SetCPUSpeedLow(); - break; - } -#endif - // MemPtrSetOwner(gVars, ownerID); - // ArgsSetOwner(argvP, ownerID); // will be freed by main(...) - // MemPtrFree(lp); // will be freed by the system on exit - - run(lp->args.argc, argvP); - - cardNo = 0; - dbID = DmFindDatabase(0, "ScummVM"); - if (dbID) { - if (lp->exitLauncher) - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCustomEngineDelete,0); - else - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch,0); - } - } - break; - } - - default: - break; - - } - - return result; -} - -UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - return ModulesPalmMain(cmd, cmdPBP, launchFlags); -} diff --git a/backends/platform/PalmOS/Src/modules.h b/backends/platform/PalmOS/Src/modules.h deleted file mode 100644 index d172ad11c2..0000000000 --- a/backends/platform/PalmOS/Src/modules.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MODULES_H -#define MODULES_H - -#include "globals.h" - -#define sysAppLaunchCode_SVMRunEngine (sysAppLaunchCmdCustomBase + 0) - -void ModDelete(); - -typedef struct { - UInt8 lightspeed; - Boolean exitLauncher; - - struct { - UInt8 argc; - Char **argv; - } args; - - GlobalsDataPtr gVars; -} LaunchParamType; - -#endif diff --git a/backends/platform/PalmOS/Src/native/oscalls.cpp b/backends/platform/PalmOS/Src/native/oscalls.cpp deleted file mode 100644 index 9bfd01393f..0000000000 --- a/backends/platform/PalmOS/Src/native/oscalls.cpp +++ /dev/null @@ -1,92 +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$ - * - */ - -#include -#include "pace.h" - -GlobalsType global; - - -PACE_CLASS_WRAPPER(Err) - __68k_StatShow(void) { - PACE_PIN_EXEC_NP(pinStatShow, Err) -} - -PACE_CLASS_WRAPPER(Err) - __68k_StatHide(void) { - PACE_PIN_EXEC_NP(pinStatHide, Err) -} - -PACE_CLASS_WRAPPER(Err) - __68k_PINSetInputAreaState(UInt16 state) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(state) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinPINSetInputAreaState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_PINGetInputAreaState(void) { - PACE_PIN_EXEC_NP(pinPINGetInputAreaState, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_PINSetInputTriggerState(UInt16 state) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(state) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinPINSetInputTriggerState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_PINGetInputTriggerState(void) { - PACE_PIN_EXEC_NP(pinPINGetInputTriggerState, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_SysSetOrientation(UInt16 orientation) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(orientation) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinSysSetOrientation, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_SysGetOrientation(void) { - PACE_PIN_EXEC_NP(pinSysGetOrientation, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_SysSetOrientationTriggerState(UInt16 triggerState) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(triggerState) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinSysSetOrientationTriggerState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_SysGetOrientationTriggerState(void) { - PACE_PIN_EXEC_NP(pinSysGetOrientationTriggerState, UInt16) -} diff --git a/backends/platform/PalmOS/Src/native/oscalls.h b/backends/platform/PalmOS/Src/native/oscalls.h deleted file mode 100644 index 071b409130..0000000000 --- a/backends/platform/PalmOS/Src/native/oscalls.h +++ /dev/null @@ -1,58 +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$ - * - */ - -#ifndef _OSCALLS_H_ -#define _OSCALLS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PALMOS_ARM -# define __68K(a) __68k_##a -#else -# define __68K(a) a -#endif - -Err __68k_StatShow(); -Err __68k_StatHide(); - -Err __68k_PINSetInputAreaState(UInt16 state); -UInt16 __68k_PINGetInputAreaState(void); - -Err __68k_PINSetInputTriggerState(UInt16 state); -UInt16 __68k_PINGetInputTriggerState(void); - -Err __68k_SysSetOrientation(UInt16 orientation); -UInt16 __68k_SysGetOrientation(void); - -Err __68k_SysSetOrientationTriggerState(UInt16 triggerState); -UInt16 __68k_SysGetOrientationTriggerState(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/native/pace.h b/backends/platform/PalmOS/Src/native/pace.h deleted file mode 100644 index 37b903b2c3..0000000000 --- a/backends/platform/PalmOS/Src/native/pace.h +++ /dev/null @@ -1,103 +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$ - * - */ - -#ifndef PACE_H -#define PACE_H - -#include -//#include "endianutils.h" - -// local definition of the emulation state structure -typedef struct { - UInt32 instr; - UInt32 regData[8]; - UInt32 regAddress[8]; - UInt32 regPC; -} EmulStateType; - -typedef struct { - EmulStateType *emulStateP; - Call68KFuncType *call68KFuncP; -} GlobalsType; - -extern GlobalsType global; - -// TODO : check this, already defined in ARMlet_Runtime -//extern EmulStateType *g_emulStateP; -//extern Call68KFuncType *g_call68KFuncP; -#define g_emulStateP global.emulStateP -#define g_call68KFuncP global.call68KFuncP - - -#ifdef __cplusplus -# define PACE_CLASS_WRAPPER(rv) extern "C" rv -#else -# define PACE_CLASS_WRAPPER(rv) rv -#endif -#define PACE_CALLBACK_PTR g_call68KFuncP -#define PACE_EMULSTATE g_emulStateP - -#define ALIGN_4BYTE(addr) (((UInt32)(addr) + 3) & 0xFFFFFFFC) - -/****** TAKEN FROM PACEInteface.cpp (ARMlet_Runtime) ******/ -// local definition of the emulation state structure - -#define PACE_PARAMS_INIT() \ - UInt8 params[] = { - -#define PACE_PARAMS_ADD8(param) \ - (UInt8)(param), \ - 0, - -#define PACE_PARAMS_ADD16(param) \ - (UInt8)((UInt16)(param) >> 8), \ - (UInt8)(param), - -#define PACE_PARAMS_ADD32(param) \ - (UInt8)((UInt32)(param) >> 24), \ - (UInt8)((UInt32)(param) >> 16), \ - (UInt8)((UInt32)(param) >> 8), \ - (UInt8)(param), - -#define PACE_PARAMS_END() \ - }; - -// PIN -#define PACE_PIN_EXEC_NP(pinTrap, returnType) \ - PACE_EMULSTATE->regData[2] = pinTrap; \ - return ((returnType)((PACE_CALLBACK_PTR)( \ - static_cast(PACE_EMULSTATE), \ - PceNativeTrapNo(sysTrapPinsDispatch), \ - NULL, 0))); - -#define PACE_PIN_EXEC(pinTrap, returnType) \ - PACE_EMULSTATE->regData[2] = pinTrap; \ - return ((returnType)((PACE_CALLBACK_PTR)( \ - static_cast(PACE_EMULSTATE), \ - PceNativeTrapNo(sysTrapPinsDispatch), \ - ¶ms, \ - sizeof(params)))); - -#endif diff --git a/backends/platform/PalmOS/Src/native/pnoARM.c b/backends/platform/PalmOS/Src/native/pnoARM.c deleted file mode 100644 index 48c4fee972..0000000000 --- a/backends/platform/PalmOS/Src/native/pnoARM.c +++ /dev/null @@ -1,60 +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$ - * - */ - -#ifdef COMPILE_OS5 - -#include -#include -#include "pace.h" - -// Linker still looks for ARMlet_Main as entry point, but the -// "ARMlet" name is now officially discouraged. Compare an -// contrast to "PilotMain" for 68K applications. -#define PNO_Main ARMlet_Main - -/* Prepare static initializers */ -extern long __sinit__[]; -extern void __ARMlet_Startup__(); - -/* simple function pointer */ -typedef void (*StaticInitializer)(void); - -unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) { - global.emulStateP = (EmulStateType *)emulStateP; - global.call68KFuncP = call68KFuncP; - - // handle static initializers - if (__sinit__) { - long base = (long)__ARMlet_Startup__; - long s, *p; - - for (p = __sinit__; p && (s = *p) != 0; p++) - ((StaticInitializer)(s + base))(); - } - - return PilotMain(sysAppLaunchCmdNormalLaunch, userData68KP, 0); -} - -#endif diff --git a/backends/platform/PalmOS/Src/native/pnoStartup.c b/backends/platform/PalmOS/Src/native/pnoStartup.c deleted file mode 100644 index b76cac3024..0000000000 --- a/backends/platform/PalmOS/Src/native/pnoStartup.c +++ /dev/null @@ -1,28 +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$ - * - */ - -#ifdef COMPILE_OS5 -# include "(Source)/ARMlet_Startup.c" -#endif diff --git a/backends/platform/PalmOS/Src/native/zodiacARM.cpp b/backends/platform/PalmOS/Src/native/zodiacARM.cpp deleted file mode 100644 index 7323bb6d69..0000000000 --- a/backends/platform/PalmOS/Src/native/zodiacARM.cpp +++ /dev/null @@ -1,150 +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$ - * - */ - -#include "PalmVersion.h" -#include - -#include "globals.h" -#include "args.h" -#include "palmdefs.h" - -#include "rumble.h" - - -//#include -//#define DEBUG_ARM - -#include "base/main.h" -#ifdef COMPILE_ZODIAC -# include "be_zodiac.h" -#endif -#include "be_os5ex.h" - -GlobalsDataType g_vars; -GlobalsDataPtr gVars = &g_vars; -UInt32 g_stackSize; - -extern "C" void __destroy_global_chain(void); -extern void DrawStatus(Boolean show); - -static void palm_main(int argc, char **argvP) { -#ifdef COMPILE_OS5 - if (gVars->advancedMode) - g_system = new OSystem_PalmOS5Ex(); - else - g_system = new OSystem_PalmOS5(); -#elif defined(COMPILE_ZODIAC) - g_system = new OSystem_PalmZodiac(); -#else - #error "No target defined." -#endif - - assert(g_system); - - scummvm_main(argc, argvP); - - g_system->quit(); // TODO: Consider removing / replacing this! -} - -static void Go() { - void *tmp; - char **argvP; - int argc; - -#ifdef DEBUG_ARM -// Tell the debugger we want to enable full debugging - UInt32 flags = AdnDebugEnableGet(); - flags |= kAdnEnableMasterSwitch | kAdnEnableFullDebugging; - AdnDebugEnableSet(flags); -// Tell the debugger where our code lives in memory: - AdnDebugNativeRegister(sysFileTApplication, appFileCreator, 'ARMC', 1); -#endif - - // get global struct - FtrGet(appFileCreator, ftrVars, (UInt32 *)&tmp); - MemMove(gVars, tmp, sizeof(GlobalsDataType)); - - // init STDIO - stdio_set_cache(0); - stdio_init(gVars->VFS.volRefNum, "/PALM/Programs/ScummVM/scumm.log"); - if (gVars->indicator.showLED) - stdio_set_led(DrawStatus); - stdio_set_cache(gVars->VFS.cacheSize); - - // get args - FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP); - FtrGet(appFileCreator, ftrArgsCount, (UInt32 *)&argc); - - // init system - WinSetDrawWindow(WinGetDisplayWindow()); - if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit(); - - // run ... - DO_EXIT ( palm_main(argc, argvP); ) - - // release - if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease(); - stdio_release(); - -#ifdef DEBUG_ARM - AdnDebugNativeUnregister(); -#endif -} - -/* Stack size */ - -Int8 *g_newStack, *g_newStackPos; -void *g_oldStack; - -static asm void *StkSwap(void *newStack ,void *dummy) { - mov r1, r13 - mov r13, r0 - mov r0, r1 - bx lr -} - -extern UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - if (cmd == sysAppLaunchCmdNormalLaunch) { - FtrGet(appFileCreator, ftrStack, &g_stackSize); - if (!g_stackSize) - g_stackSize = 32 * 1024; - - g_newStack = (Int8 *)malloc(g_stackSize + 8); - g_newStackPos = (g_newStack + g_stackSize); - g_newStackPos -= ((UInt32)g_newStackPos & 7); - - g_oldStack = StkSwap(g_newStackPos, 0); - - Go(); - - StkSwap(g_oldStack, 0); - free(g_newStack); - } - - // Destroy all constructed global objects - __destroy_global_chain(); - - return 0; -} diff --git a/backends/platform/PalmOS/Src/native/zodiacStartup.cpp b/backends/platform/PalmOS/Src/native/zodiacStartup.cpp deleted file mode 100644 index 7f6264c1ac..0000000000 --- a/backends/platform/PalmOS/Src/native/zodiacStartup.cpp +++ /dev/null @@ -1,161 +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$ - * - */ - -#ifdef COMPILE_ZODIAC - -#include - -#ifndef __PALMOS_ARMLET__ -#error "__PALMOS_ARMLET__ is not defined!!!" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This variable holds the Tapwave Native Application interface - * dispatch table. General ARM API calls will go through this table. - */ -struct TwGlue* twGlue; -const void* twEmulState; -Call68KFuncType* twCall68KFunc; - -#ifdef __MWERKS__ - -#if __PALMOS_ARMLET__ < 0x120 -#error "You must use CodeWarrior for Palm OS 9.3 or later!!!" -#endif - - -UInt32 __ARMlet_Startup__(const void*, void*, Call68KFuncType*); - -/* - * These symbols aren't real, but are linker-generated symbols that - * mark the start and end of the various data sections. - */ -extern long __DataStart__[]; -extern long __sinit__[]; -extern long __RODataStart__[]; -extern long __BSSStart__[]; -extern long __BSSEnd__[]; -extern long __CodeRelocStart__[]; -extern long __CodeRelocEnd__[]; -extern long __DataRelocStart__[]; -extern long __DataRelocEnd__[]; - -/* simple function pointer */ -typedef void (*StaticInitializer)(void); - -/* - * This function performs relocation for Tapwave Native Application. - */ -static void relocate(void) -{ - // this symbol points to the very beginning of current application - long base = (long) __ARMlet_Startup__; - long *cur, *end; - - // handle static initializers - if (__sinit__) { - long s, *p; - - for (p = __sinit__; p && (s = *p) != 0; p++) - ((StaticInitializer)(s + base))(); - } - - // handle code-to-data relocation - cur = __CodeRelocStart__; - end = __CodeRelocEnd__; - for (; cur < end; cur++) { - *(long*)(base + *cur) += base; - } - - // handle data-to-data relocation - cur = __DataRelocStart__; - end = __DataRelocEnd__; - for (; cur < end; cur++) { - *(long*)(base + *cur) += base; - } -} - -/* - * This is the real entrypoint for Tapwave Native Application. It - * depends on various CodeWarrior 9.2 compiler/linker/runtime features. - */ -static SYSTEM_CALLBACK UInt32 -Startup(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) -{ - if (emulStateP) { - twEmulState = emulStateP; - twCall68KFunc = call68KFuncP; - // COMMENT: normal pace native object launch - return PilotMain(sysAppLaunchCmdNormalLaunch, userData68KP, 0); - } else { - // Setup TNA interface dispatch table - twGlue = (struct TwGlue*) userData68KP; - - // OPTIONAL: relocate data segment - relocate(); - - // OPTIONAL: initialize the floating-point library - // _fp_init(); - - return 0; - } -} - -#pragma PIC off -asm UInt32 -__ARMlet_Startup__(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) -{ - b Startup // 0 forwarding call - nop // 4 - nop // 8 - nop // 12 - nop // 16 - nop // 20 - nop // 24 - dcd 'TWNA' // 28 Tapwave Native Application - dcd 1 // 32 version 1 - dcd 'cdwr' // 36 make this section the same as the __ARMlet_Startup__ - dcd __DataStart__ // 40 used by CodeWarrior 9.2 - dcd __RODataStart__ // 44 - dcd __BSSStart__ // 48 - dcd __BSSEnd__ // 52 - dcd __CodeRelocStart__ // 56 - dcd __CodeRelocEnd__ // 60 - dcd __DataRelocStart__ // 64 - dcd __DataRelocEnd__ // 68 -} -#pragma PIC reset - -#endif // __MWERKS__ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/os5_event.cpp b/backends/platform/PalmOS/Src/os5_event.cpp deleted file mode 100644 index 534c2eb4f9..0000000000 --- a/backends/platform/PalmOS/Src/os5_event.cpp +++ /dev/null @@ -1,82 +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$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::get_coordinates(EventPtr ev, Coord &x, Coord &y) { - Boolean dummy; - EvtGetPenNative(WinGetDisplayWindow(), &ev->screenX, &ev->screenY, &dummy); - - x = (ev->screenX - _screenOffset.x); - y = (ev->screenY - _screenOffset.y); - - if (_stretched) { - x = (x * _screenWidth) / _screenDest.w; - y = (y * _screenHeight) / _screenDest.h; - } -} - -bool OSystem_PalmOS5::check_event(Common::Event &event, EventPtr ev) { - if (ev->eType == keyUpEvent) { - switch (ev->data.keyUp.chr) { - case vchrHard3: - case vchrHard4: - // will be handled by hard keys - return true; - } - - } else if (ev->eType == keyDownEvent) { - switch (ev->data.keyDown.chr) { - - // hot swap gfx -// case 0x1B04: - case vchrHard1: - if (OPTIONS_TST(kOptCollapsible)) - hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE); - return false; // not a key - -// case 0x1B05: - case vchrHard2: - setFeatureState(kFeatureAspectRatioCorrection, 0); - return false; // not a key - - case vchrHard3: - _keyExtraPressed |= _keyExtra.bitActionA; - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrHard4: - _keyExtraPressed |= _keyExtra.bitActionB; - event.type = Common::EVENT_RBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp deleted file mode 100644 index 6a7b21e100..0000000000 --- a/backends/platform/PalmOS/Src/os5_gfx.cpp +++ /dev/null @@ -1,309 +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$ - * - */ - -#include "be_os5.h" -#include "graphics/surface.h" -#include "common/config-manager.h" -#include -#include - -#include "oscalls.h" - -void OSystem_PalmOS5::int_initSize(uint w, uint h) { -} - -WinHandle OSystem_PalmOS5::alloc_screen(Coord w, Coord h) { - Err e; - WinHandle winH; - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - winH = WinCreateOffscreenWindow(w, h, nativeFormat, &e); - WinSetCoordinateSystem(old); - - return winH; -} - -void OSystem_PalmOS5::load_gfx_mode() { - Err e; - - if (_gfxLoaded) - return; - _gfxLoaded = true; - - // get command line config -// _fullscreen = ConfMan.getBool("fullscreen"); // TODO : (NORMAL mode) - _ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone; - - // precalc ratio (WIDE mode) - _ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight); - _ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth); - - _offScreenP = (byte *)malloc(_screenWidth * _screenHeight); - - MemSet(_offScreenP, _screenWidth * _screenHeight, 0); - MemSet(_nativePal, sizeof(_nativePal), 0); - MemSet(_currentPalette, sizeof(_currentPalette), 0); - - UInt32 depth = 16; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - if (OPTIONS_TST(kOptModeRotatable)) { - _sysOldOrientation = __68K(SysGetOrientation()); - _sysOldTriggerState = __68K(PINGetInputTriggerState()); - __68K(SysSetOrientation(sysOrientationLandscape)); - __68K(SysSetOrientationTriggerState(sysOrientationTriggerDisabled)); - __68K(PINSetInputTriggerState(pinInputTriggerDisabled)); - } - - gVars->indicator.on = Graphics::RGBToColor >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor >(0,0,0); - - _overlayH = alloc_screen(_screenWidth, _screenHeight); - _overlayP = (OverlayColor *)(BmpGetBits(WinGetBitmap(_overlayH))); - - _screenH = WinGetDisplayWindow(); - _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))); - - _isSwitchable = OPTIONS_TST(kOptModeLandscape) && OPTIONS_TST(kOptCollapsible); - if (!_isSwitchable) - _mode = GFX_NORMAL; - - hotswap_gfx_mode(_mode); -} - -void OSystem_PalmOS5::hotswap_gfx_mode(int mode) { - Err e; - - if (_mode != GFX_NORMAL && !_isSwitchable) - return; - - if (_workScreenH) - WinDeleteWindow(_workScreenH, false); - _workScreenH = NULL; - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - // prevent bad DIA redraw (Stat part) - if (mode == GFX_NORMAL) { - _redawOSD = true; - _stretched = (_screenWidth > gVars->screenWidth); - - if (OPTIONS_TST(kOptCollapsible)) { - //AiaSetInputAreaState(aiaInputAreaShow); // For T3 ?? - __68K(StatShow()); - __68K(PINSetInputAreaState(pinInputAreaOpen)); - } - - if (_stretched) { - calc_rect(false); - } else { - // offsets - _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2; - _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2; - } - - } else { - _redawOSD = false; - _stretched = true; - - if (OPTIONS_TST(kOptCollapsible)) { - // T3 DIA library is 68k base, there is no possible native call - //AiaSetInputAreaState(aiaInputAreaFullScreen); - __68K(PINSetInputAreaState(pinInputAreaClosed)); - __68K(StatHide()); - } - - calc_rect(true); - } - - if (_stretched) { - OPTIONS_SET(kOptDisableOnScrDisp); - if (_screenHeight == 200 && _screenDest.h == 300) { - _render = &OSystem_PalmOS5::render_landscape15x; - } else { - _render = &OSystem_PalmOS5::render_landscapeAny; - calc_scale(); - } - } else { - OPTIONS_RST(kOptDisableOnScrDisp); - _render = &OSystem_PalmOS5::render_1x; - } - - _workScreenH = alloc_screen(_screenDest.w, _screenDest.h); - _workScreenP = (uint16 *)(BmpGetBits(WinGetBitmap(_workScreenH))); - MemSet(_workScreenP, _screenDest.w * _screenDest.h * 2, 0); - - _mode = mode; - clear_screen(); -} - -void OSystem_PalmOS5::unload_gfx_mode() { - if (!_gfxLoaded) - return; - _gfxLoaded = false; - - // mouse data freed in quit() - free(_offScreenP); - - if (_workScreenH) - WinDeleteWindow(_workScreenH, false); - if (_overlayH) - WinDeleteWindow(_overlayH, false); - - _workScreenH = NULL; - _overlayH = NULL; - - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - if (OPTIONS_TST(kOptModeRotatable)) { - __68K(PINSetInputTriggerState(_sysOldTriggerState)); - __68K(SysSetOrientation(_sysOldOrientation)); - } - - WinSetCoordinateSystem(_sysOldCoord); -} - -void OSystem_PalmOS5::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { - // Clip the coordinates - if (x < 0) { - w += x; - buf -= x; - x = 0; - } - - if (y < 0) { - h += y; - buf -= y * pitch; - y = 0; - } - - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (h > _screenHeight - y) - h = _screenHeight - y; - - if (w <= 0 || h <= 0) - return; - - byte *dst = _offScreenP + y * _screenWidth + x; - - if (w == pitch && w == _screenWidth) { - MemMove(dst, buf, w * h); - } else { - do { - MemMove(dst, buf, w); - dst += _screenWidth; - buf += pitch; - } while (--h); - } -} - -Graphics::Surface *OSystem_PalmOS5::lockScreen() { - _framebuffer.pixels = _offScreenP; - _framebuffer.w = _screenWidth; - _framebuffer.h = _screenHeight; - _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; - - return &_framebuffer; -} - -void OSystem_PalmOS5::unlockScreen() { - // The screen is always completely update anyway, so we don't have to force a full update here. -} - -void OSystem_PalmOS5::int_updateScreen() { - RectangleType r; - PointType p; - - draw_mouse(); - ((this)->*(_render))(r, p); - - _sysOldCoord = WinSetCoordinateSystem(kCoordinatesNative); - WinCopyRectangle(_workScreenH, _screenH, &r, p.x, p.y, winPaint); - WinSetCoordinateSystem(_sysOldCoord); - undraw_mouse(); -} - -void OSystem_PalmOS5::clear_screen() { - RGBColorType rgb = { 0,0,0,0 }; - WinSetDrawWindow(WinGetDisplayWindow()); - WinSetBackColorRGB(&rgb, 0); - WinEraseWindow(); -} - -void OSystem_PalmOS5::extras_palette(uint8 index, uint8 r, uint8 g, uint8 b) { - _nativePal[index] = gfxMakeDisplayRGB(r, g, b); -} - -void OSystem_PalmOS5::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { - if (_mode != GFX_NORMAL) - return; -// MemHandle hTemp = DmGetResource(bitmapRsc, id); - MemHandle hTemp = DmGetResource('abmp', id + 100); - - if (hTemp) { - RGBColorType oldRGB; - static const RGBColorType pal[4] = { - {0,0,255,0}, - {0,255,255,0}, - {0,255,0,0}, - {0,0,0,0} - }; - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - BmpGetDimensions(bmTemp, &w, &h, 0); - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType c, r = { dst.x, dst.y, w, h }; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinSetDrawWindow(_screenH); - WinGetClip(&c); - WinResetClip(); - - if (show) { - WinSetForeColorRGB(&pal[3], &oldRGB); - WinSetBackColorRGB(&pal[color], &oldRGB); - WinDrawBitmap(bmTemp, dst.x, dst.y); - } else { - WinSetBackColorRGB(&pal[3], &oldRGB); - WinFillRectangle(&r, 0); - } - - WinSetClip(&c); - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/os5_mouse.cpp b/backends/platform/PalmOS/Src/os5_mouse.cpp deleted file mode 100644 index c019e1607d..0000000000 --- a/backends/platform/PalmOS/Src/os5_mouse.cpp +++ /dev/null @@ -1,157 +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$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) { - for (uint i = 0; i < num; i++) { - _mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]); - colors += 4; - } - - _cursorPaletteDisabled = false; -} - -void OSystem_PalmOS5::disableCursorPalette(bool disable) { - _cursorPaletteDisabled = disable; -} - -// TODO: this code is almost the same as Zodiac version. -void OSystem_PalmOS5::draw_mouse() { - if (!_mouseDataP || _mouseDrawn || !_mouseVisible) - return; - - byte *src = _mouseDataP; - - int x = _mouseCurState.x - _mouseHotspotX; - int y = _mouseCurState.y - _mouseHotspotY; - int w = _mouseCurState.w; - int h = _mouseCurState.h; - - // clip the mouse rect - if (y < 0) { - src -= y * w; - h += y; - y = 0; - } - if (x < 0) { - src -= x; - w += x; - x = 0; - } - - if (h > _screenHeight - y) - h = _screenHeight - y; - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (w <= 0 || h <= 0) - return; - - // store the bounding box so that undraw mouse can restore the area the - // mouse currently covers to its original content - _mouseOldState.x = x; - _mouseOldState.y = y; - _mouseOldState.w = w; - _mouseOldState.h = h; - - byte color; - int ww; - - if (_overlayVisible) { - uint16 *bak = (uint16 *)_mouseBackupP; - uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - uint16 *dst = _overlayP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = pal[color]; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - - } else { - byte *bak = _mouseBackupP; - byte *dst =_offScreenP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = color; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - } - - _mouseDrawn = true; -} - -void OSystem_PalmOS5::undraw_mouse() { - if (!_mouseDrawn) - return; - - int h = _mouseOldState.h; - - // no need to do clipping here, since draw_mouse() did that already - if (_overlayVisible) { - uint16 *dst = _overlayP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - uint16 *bak = (uint16 *)_mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w * 2); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - - } else { - byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - byte *bak = _mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - } - - _mouseDrawn = false; -} diff --git a/backends/platform/PalmOS/Src/os5_overlay.cpp b/backends/platform/PalmOS/Src/os5_overlay.cpp deleted file mode 100644 index 7e16a6b7b9..0000000000 --- a/backends/platform/PalmOS/Src/os5_overlay.cpp +++ /dev/null @@ -1,76 +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$ - * - */ - -#include "be_os5.h" -#include "common/endian.h" - -void OSystem_PalmOS5::showOverlay() { - // hide fight indicator - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, false); - - undraw_mouse(); - _overlayVisible = true; - clearOverlay(); -} - -void OSystem_PalmOS5::hideOverlay() { - undraw_mouse(); - _overlayVisible = false; - _redawOSD = true; -} - -void OSystem_PalmOS5::clearOverlay() { - if (!_overlayVisible) - return; - - byte *src = _offScreenP; - uint16 *dst = _overlayP; - int cnt = _screenWidth * _screenHeight; - do { - *dst++ = _nativePal[*src++]; - } while (--cnt); -} - -void OSystem_PalmOS5::grabOverlay(OverlayColor *buf, int pitch) { - OverlayColor *src = _overlayP; - int h = _screenHeight; - do { - memcpy(buf, src, _screenWidth * 2); - src += _screenWidth; - buf += pitch; - } while (--h); -} - -void OSystem_PalmOS5::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - if (w == 0 || h == 0) - return; - - OverlayColor *dst = _overlayP + x + y * _screenWidth; - do { - memcpy(dst, buf, w * 2); - dst += _screenWidth; - buf += pitch; - } while (--h); -} diff --git a/backends/platform/PalmOS/Src/os5_renderer.cpp b/backends/platform/PalmOS/Src/os5_renderer.cpp deleted file mode 100644 index fea3ec28d7..0000000000 --- a/backends/platform/PalmOS/Src/os5_renderer.cpp +++ /dev/null @@ -1,118 +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$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::render_1x(RectangleType &r, PointType &p) { - Coord o = 0; - - if (_overlayVisible) { - uint16 *src = _overlayP; - uint16 *dst = _workScreenP; - MemMove(dst, src, _screenWidth * _screenHeight * 2); - - } else { - byte *src = _offScreenP; - uint16 *dst = _workScreenP; - int cnt = _screenWidth * _screenHeight; - o = _current_shake_pos; - - do { - *dst++ = _nativePal[*src++]; - } while (--cnt); - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, _screenWidth, _screenHeight - o); -} - -void OSystem_PalmOS5::render_landscapeAny(RectangleType &r, PointType &p) { - Coord x, y, o = 0; - uint16 *dst = _workScreenP; - - if (_overlayVisible) { - for (y = 0; y < _screenDest.h; y++) { - uint16 *src = _overlayP + *(_scaleTableY + y); - for (x = 0; x < _screenDest.w; x++) { - *dst++ = *(src + *(_scaleTableX + x)); - } - } - - } else { - o = _current_shake_pos; - - for (y = 0; y < _screenDest.h; y++) { - byte *src = _offScreenP + *(_scaleTableY + y); - for (x = 0; x < _screenDest.w; x++) { - *dst++ = *(_nativePal + *(src + *(_scaleTableX + x))); - } - } - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, _screenDest.w, _screenDest.h - o); -} - -void OSystem_PalmOS5::render_landscape15x(RectangleType &r, PointType &p) { - Coord x, y, o = 0; - uint16 *dst = _workScreenP; - - if (_overlayVisible) { - uint16 *src = _overlayP; - - for (y = 0; y < 100; y++) { - // draw 2 lines - for (x = 0; x < 320; x++) { - *dst++ = *src++; - *dst++ = *src; - *dst++ = *src++; - } - // copy the second to the next line - MemMove(dst, dst - 480, 480 * 2); - dst += 480; - } - } else { - byte *src = _offScreenP; - o = _current_shake_pos; - - for (y = 0; y < 100; y++) { - // draw 2 lines - for (x = 0; x < 320; x++) { - *dst++ = _nativePal[*src++]; - *dst++ = _nativePal[*src]; - *dst++ = _nativePal[*src++]; - } - // copy the second to the next line - MemMove(dst, dst - 480, 480 * 2); - dst += 480; - } - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, 480, 300 - o); -} diff --git a/backends/platform/PalmOS/Src/os5_sound.cpp b/backends/platform/PalmOS/Src/os5_sound.cpp deleted file mode 100644 index 73ab64c0d5..0000000000 --- a/backends/platform/PalmOS/Src/os5_sound.cpp +++ /dev/null @@ -1,156 +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$ - * - */ - -#include "be_os5.h" -#include "common/config-manager.h" -#include "sound/mixer_intern.h" - - -#ifdef PALMOS_ARM -# ifdef COMPILE_ZODIAC -# define SAMPLES_PER_SEC 44100 -# else -# define SAMPLES_PER_SEC 22050 -# endif -#else -# define SAMPLES_PER_SEC 8000 -#endif - - -SoundExType _soundEx; - -static Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { - SoundExType *_soundEx = (SoundExType *)UserDataP; - SoundType *_sound = _soundEx->sound; - - if (_soundEx->set && _soundEx->size) { - MemMove(bufferP, _soundEx->dataP, _soundEx->size); - *bufferSizeP = _soundEx->size; - _soundEx->set = false; - - } else { - _soundEx->size = *bufferSizeP; - MemSet(bufferP, 128, 0); - *bufferSizeP = 128; - } - - return errNone; -} - -void OSystem_PalmOS5::sound_handler() { - if (_sound.active) { - if (_soundEx.size && !_soundEx.set) { - if (!_soundEx.dataP) - _soundEx.dataP = MemPtrNew(_soundEx.size); - - _mixerMgr->mixCallback((byte *)_soundEx.dataP, _soundEx.size); - _soundEx.set = true; - } - }// TODO : no Sound API case -} - -SndStreamVariableBufferCallback OSystem_PalmOS5::sound_callback() { - return sndCallback; -} - -bool OSystem_PalmOS5::setupMixer() { - Err e; - Boolean success = false; - - uint32 samplesPerSec; - if (ConfMan.hasKey("output_rate")) - samplesPerSec = ConfMan.getInt("output_rate"); - else - samplesPerSec = SAMPLES_PER_SEC; - - _mixerMgr = new Audio::MixerImpl(this, samplesPerSec); - - if (!_sound.active) { - if (gVars->fmQuality != FM_QUALITY_INI) { - ConfMan.setBool("FM_medium_quality", (gVars->fmQuality == FM_QUALITY_MED)); - ConfMan.setBool("FM_high_quality", (gVars->fmQuality == FM_QUALITY_HI)); - } - -#if defined (COMPILE_OS5) - CALLBACK_INIT(_soundEx); -#endif - _sound.proc = 0; - _sound.param = _mixerMgr; - _sound.active = true; // always true when we call this function, false when sound is off - - _soundEx.handle = 0; - _soundEx.size = 0; // set by the callback - _soundEx.set = false; - _soundEx.dataP = NULL; // set by the handler - - // try to create sound stream - if (OPTIONS_TST(kOptPalmSoundAPI)) { - e = SndStreamCreateExtended( - &_soundEx.handle, - sndOutput, - sndFormatPCM, - samplesPerSec, - sndInt16Little, - sndStereo, - sound_callback(), - &_soundEx, - 8192 -#ifdef COMPILE_OS5 - ,true -#endif - ); - - e = e ? e : SndStreamStart(_soundEx.handle); - e = e ? e : SndStreamSetVolume(_soundEx.handle, 1024L * gVars->palmVolume / 100); - success = (e == errNone); - - // no Sound API - } else { - _soundEx.size = 512; - _soundEx.dataP = MemPtrNew(_soundEx.size); - } - } - // if not true some scenes (indy3 256,...) may freeze (ESC to skip) - - _mixerMgr->setReady(true); - - return true; -} - -void OSystem_PalmOS5::clearSoundCallback() { - if (_sound.active) { - if (OPTIONS_TST(kOptPalmSoundAPI)) { - SndStreamStop(_soundEx.handle); - SndStreamDelete(_soundEx.handle); - } - - if (_soundEx.dataP) - MemPtrFree(_soundEx.dataP); - } - - _sound.active = false; - _soundEx.handle = NULL; - _soundEx.dataP = NULL; -} diff --git a/backends/platform/PalmOS/Src/os5ex_sound.cpp b/backends/platform/PalmOS/Src/os5ex_sound.cpp deleted file mode 100644 index f27f5a202d..0000000000 --- a/backends/platform/PalmOS/Src/os5ex_sound.cpp +++ /dev/null @@ -1,43 +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$ - * - */ - -#include "be_os5ex.h" -#include "sound/mixer_intern.h" - -static SYSTEM_CALLBACK Err sndCallbackEx(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { - CALLBACK_PROLOGUE - SoundType *_sound = ((SoundExType *)UserDataP)->sound; -// ((SoundProc)_sound->proc)(_sound->param, (byte *)bufferP, *bufferSizeP); - - Audio::MixerImpl *_mixerMgr = ( Audio::MixerImpl *)_sound->param; - _mixerMgr->mixCallback((byte *)bufferP, *bufferSizeP); - - CALLBACK_EPILOGUE - return errNone; -} - -SndStreamVariableBufferCallback OSystem_PalmOS5Ex::sound_callback() { - return sndCallbackEx; -} diff --git a/backends/platform/PalmOS/Src/palmdefs.h b/backends/platform/PalmOS/Src/palmdefs.h deleted file mode 100644 index d37b533a21..0000000000 --- a/backends/platform/PalmOS/Src/palmdefs.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef PALMDEFS_H -#define PALMDEFS_H - -#define appFileCreator 'ScVM' -#define sysAppLaunchCustomEngineDelete (sysAppLaunchCmdCustomBase + 0) -#define sysAppLaunchCustomEngineGetInfo (sysAppLaunchCmdCustomBase + 1) - -enum { - GET_NONE = 0, - GET_DATACOMMON = 1 << 1, - GET_DATAENGINE = 1 << 2, - - GET_MODE68K = 1 << 14, - GET_MODEARM = 1 << 15, -}; - -SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP) - SYS_TRAP(sysTrapSysGetAppInfo); - - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/compile.h b/backends/platform/PalmOS/Src/prefixes/compile.h deleted file mode 100644 index bb7230187a..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/compile.h +++ /dev/null @@ -1,76 +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$ - * - */ - -#ifndef __COMPILE_H__ -#define __COMPILE_H__ - -#undef ENABLE_SCUMM -#undef ENABLE_SCUMM_7_8 -#undef ENABLE_HE - -#undef ENABLE_AGOS -#undef ENABLE_SKY -#undef ENABLE_SWORD1 -#undef ENABLE_SWORD2 -#undef ENABLE_QUEEN -#undef ENABLE_SAGA -#undef ENABLE_KYRA -#undef ENABLE_AWE -#undef ENABLE_GOB -#undef ENABLE_LURE -#undef ENABLE_CINE -#undef ENABLE_AGI -#undef ENABLE_TOUCHE -#undef ENABLE_PARALLACTION -#undef ENABLE_CRUISE -#undef ENABLE_DRASCULA - -// ScummVM -#define USE_SCALERS -#define DISABLE_FANCY_THEMES -//#define CT_NO_TRANSPARENCY -//#define REDUCE_MEMORY_USAGE - -#include "compile_base.h" - -//#define DISABLE_ADLIB -//#define DISABLE_LIGHTSPEED - -#ifdef COMPILE_ZODIAC -# undef DISABLE_FANCY_THEMES -# define USE_ZLIB -// set an external ZLIB since save/load implementation -// doesn't support built-in zodiac version which is 1.1.4 -// (seen inflateInit2 which err on "MAX_WBITS + 32") -# define USE_ZLIB_EXTERNAL -# define DISABLE_SONY -#endif - -#ifdef COMPILE_OS5 -# define DISABLE_TAPWAVE -# define USE_ZLIB -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_agi.h b/backends/platform/PalmOS/Src/prefixes/native_agi.h deleted file mode 100644 index f3feee8c70..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_agi.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_AGI STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_agos.h b/backends/platform/PalmOS/Src/prefixes/native_agos.h deleted file mode 100644 index 8a804e3116..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_agos.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_AGOS STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_cine.h b/backends/platform/PalmOS/Src/prefixes/native_cine.h deleted file mode 100644 index 3d19d9c557..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_cine.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_CINE STATIC_PLUGIN -#define _DEBUG - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_common.h b/backends/platform/PalmOS/Src/prefixes/native_common.h deleted file mode 100644 index af4db70932..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_common.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ZNATIVE_COMMON_H -#define ZNATIVE_COMMON_H - -#include "compile.h" - -#define __TWNEW_H__ - -#define PALMOS_ARM -#define DISABLE_LIGHTSPEED - -#define USE_MAD -#define USE_TREMOR -#define USE_VORBIS -//#define USE_MPEG2 - -// enable assert -//#define _DEBUG - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_cruise.h b/backends/platform/PalmOS/Src/prefixes/native_cruise.h deleted file mode 100644 index 89e6e65a70..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_cruise.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_CRUISE STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_drascula.h b/backends/platform/PalmOS/Src/prefixes/native_drascula.h deleted file mode 100644 index 35bc381af4..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_drascula.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_DRASCULA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_gob.h b/backends/platform/PalmOS/Src/prefixes/native_gob.h deleted file mode 100644 index 9cb34099d0..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_gob.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_GOB STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_kyra.h b/backends/platform/PalmOS/Src/prefixes/native_kyra.h deleted file mode 100644 index 3b09c63a6f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_kyra.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_KYRA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_lure.h b/backends/platform/PalmOS/Src/prefixes/native_lure.h deleted file mode 100644 index 71835ee644..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_lure.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_LURE STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_m4.h b/backends/platform/PalmOS/Src/prefixes/native_m4.h deleted file mode 100644 index 3bf85460a6..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_m4.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_M4 STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_made.h b/backends/platform/PalmOS/Src/prefixes/native_made.h deleted file mode 100644 index fd439ed181..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_made.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_MADE STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_parallaction.h b/backends/platform/PalmOS/Src/prefixes/native_parallaction.h deleted file mode 100644 index e8d46cc382..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_parallaction.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_PARALLACTION STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_queen.h b/backends/platform/PalmOS/Src/prefixes/native_queen.h deleted file mode 100644 index 85bb5a0a04..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_queen.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_QUEEN STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_saga.h b/backends/platform/PalmOS/Src/prefixes/native_saga.h deleted file mode 100644 index 19db05b633..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_saga.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SAGA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_scumm.h b/backends/platform/PalmOS/Src/prefixes/native_scumm.h deleted file mode 100644 index b8433a3fa8..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_scumm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SCUMM STATIC_PLUGIN -#define ENABLE_SCUMM_7_8 -#define ENABLE_HE - -#define USE_ARM_GFX_ASM -#define USE_ARM_SMUSH_ASM - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sky.h b/backends/platform/PalmOS/Src/prefixes/native_sky.h deleted file mode 100644 index 49b157471f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sky.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SKY STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sword1.h b/backends/platform/PalmOS/Src/prefixes/native_sword1.h deleted file mode 100644 index 6ae7bb9050..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sword1.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SWORD1 STATIC_PLUGIN -#define USE_MPEG2 -#define USE_VORBIS - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sword2.h b/backends/platform/PalmOS/Src/prefixes/native_sword2.h deleted file mode 100644 index 5e9c45b047..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sword2.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SWORD2 STATIC_PLUGIN -#undef _DEBUG -#define USE_MPEG2 -#define USE_VORBIS - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_touche.h b/backends/platform/PalmOS/Src/prefixes/native_touche.h deleted file mode 100644 index acf50e2787..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_touche.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_TOUCHE STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h b/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h deleted file mode 100644 index 8473214746..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#define PALMOS_68K -#define PALMOS_MODE - -//#define _DEBUG_ENGINE - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_os5.h b/backends/platform/PalmOS/Src/prefixes/prefix_os5.h deleted file mode 100644 index 6d84c543af..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_os5.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -// PalmOS -#define PALMOS_MODE -#define PALMOS_68K -#define PALMOS_NATIVE - -#define COMPILE_OS5 -#define DISABLE_SONY -#define DISABLE_PA1LIB - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h b/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h deleted file mode 100644 index 49331d356f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -// PalmOS -#define PALMOS_MODE -#define PALMOS_68K -#define PALMOS_NATIVE - -#define COMPILE_ZODIAC -#define DISABLE_SONY -#define DISABLE_PA1LIB - -#endif diff --git a/backends/platform/PalmOS/Src/rumble.cpp b/backends/platform/PalmOS/Src/rumble.cpp deleted file mode 100644 index 513152f49c..0000000000 --- a/backends/platform/PalmOS/Src/rumble.cpp +++ /dev/null @@ -1,140 +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$ - * - */ - -#include -#include "globals.h" -#include "vibrate.h" -#include "rumble.h" - -#ifndef DISABLE_TAPWAVE -#include "tapwave.h" - -TwDeviceHandle hRumble; -#endif - -Boolean RumbleExists() { - Boolean exists = false; - Err e; - -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - e = TwDeviceOpen(&hRumble, "vibrator0", "w"); - if (!e) { - exists = true; - TwDeviceClose(hRumble); - } - - } else -#endif - { -#ifndef PALMOS_ARM - - UInt32 romVersion; - - e = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); - if (!e) { - if (romVersion >= sysMakeROMVersion(4,0,0,sysROMStageRelease,0)) { - Boolean active = false; - e = HwrVibrateAttributes(0, kHwrVibrateActive, &active); - exists = (!e) ? true : exists; - } - } -#endif - } - - - return exists; -} - -void RumbleRun(Boolean active) { -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - if (active) { - UInt8 buf[] = { '\64', '\100' }; - TwDeviceControl(hRumble, 'play', buf, sizeof(buf)); - } else { - TwDeviceControl(hRumble, 'stop', 0, 0); - } - - } else -#endif - { -#ifndef PALMOS_ARM - UInt32 pattern = active ? 0xFF000000 : 0x00000000; - - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateActive, &active); -#endif - } - -} - -Boolean RumbleInit() { - Boolean done = false; - -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - Err e = TwDeviceOpen(&hRumble, "vibrator0", "w"); - done = (!e); - - } else -#endif - { -#ifndef PALMOS_ARM - if (RumbleExists()) { - UInt16 cycle = (SysTicksPerSecond())/2; - UInt32 pattern = 0xFF000000; - UInt16 delay = 1; - UInt16 repeat = 1; - - HwrVibrateAttributes(1, kHwrVibrateRate, &cycle); - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateDelay, &delay); - HwrVibrateAttributes(1, kHwrVibrateRepeatCount, &repeat); - - done = true; - } -#endif - } - return done; -} - -void RumbleRelease() { -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - TwDeviceClose(hRumble); - - } else -#endif - { -#ifndef PALMOS_ARM - UInt32 pattern = 0x00000000; - Boolean active = false; - - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateActive, &active); -#endif - } -} diff --git a/backends/platform/PalmOS/Src/rumble.h b/backends/platform/PalmOS/Src/rumble.h deleted file mode 100644 index 680c0eb164..0000000000 --- a/backends/platform/PalmOS/Src/rumble.h +++ /dev/null @@ -1,34 +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$ - * - */ - -#ifndef __RUMBLE_H__ -#define __RUMBLE_H__ - -Boolean RumbleExists (); -void RumbleRun (Boolean active); -Boolean RumbleInit (); -void RumbleRelease (); - -#endif diff --git a/backends/platform/PalmOS/Src/snd_pa1.cpp b/backends/platform/PalmOS/Src/snd_pa1.cpp deleted file mode 100644 index ddaf6495f6..0000000000 --- a/backends/platform/PalmOS/Src/snd_pa1.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -#include "native.h" -#include "globals.h" - -#ifdef COMPILE_PA1SND -# include -#endif - - -static Int32 diffLookup[16] = { - 1,3,5,7,9,11,13,15, - -1,-3,-5,-7,-9,-11,-13,-15, -}; - -static Int32 indexScale[16] = { - 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266, - 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 /* same value for speedup */ -}; - -static int limit(int val,int min,int max) { - if (valmax) return max; - else return val; -} - -void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) { -#ifndef COMPILE_PA1SND -/* - if (OPTIONS_TST(kOptDeviceARM)) { - PnoDescriptor pno; - ARMPa1SndType userData = {src, dst, length}; - - MemPtr armP = _PnoInit(ARM_PA1SND, &pno); - _PnoCall(&pno, &userData); - _PnoFree(&pno, armP); - - return; - } -*/ - int data,val,diff; - int signal,step; -#else - long chan1, chan2; - long data,val,diff; - long signal,step; -#endif - - signal = 0; - step = 0x7F; - length >>= 3; // 16bit stereo -> 4bit mono - - do { - - // high nibble -#ifdef COMPILE_PA1SND - chan1 = ByteSwap16(*src); - src++; - chan2 = ByteSwap16(*src); - src++; - - diff = ((chan1 + chan2) >> 1) - signal; -#else - diff = ((*src++ + *src++) >> 1) - signal; -#endif - diff <<= 3; - diff /= step; - - val = abs(diff) >> 1; - - if (val > 7) val = 7; - if (diff < 0) val+= 8; - - signal+= (step * diffLookup[val]) >> 3; - signal = limit(signal, -32768, 32767); - - step = (step * indexScale[val]) >> 8; - step = limit(step, 0x7F, 0x6000); - - data = val; - - // low nibble -#ifdef COMPILE_PA1SND - chan1 = ByteSwap16(*src); - src++; - chan2 = ByteSwap16(*src); - src++; - - diff = ((chan1 + chan2) >> 1) - signal; -#else - diff = ((*src++ + *src++) >> 1) - signal; -#endif - diff <<= 3; - diff /= step; - - val = abs(diff) >> 1; - - if (val > 7) val = 7; - if (diff < 0) val+= 8; - - signal+= (step * diffLookup[val]) >> 3; - signal = limit(signal, -32768, 32767); - - step = (step * indexScale[val]) >> 8; - step = limit(step, 0x7F, 0x6000); - - data |= val << 4; - - *dst++ = (UInt8)data; - - } while (--length); - -} diff --git a/backends/platform/PalmOS/Src/stuffs.h b/backends/platform/PalmOS/Src/stuffs.h deleted file mode 100644 index 25bf17c8c6..0000000000 --- a/backends/platform/PalmOS/Src/stuffs.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef STUFFS_H -#define STUFFS_H - -enum { - kOptNone = 0, - kOptDeviceARM = 1 << 0x00, - kOptDeviceOS5 = 1 << 0x01, - kOptDeviceClie = 1 << 0x02, - kOptDeviceZodiac = 1 << 0x03, - kOptModeWide = 1 << 0x04, - kOptModeLandscape = 1 << 0x05, - kOptMode16Bit = 1 << 0x06, - kOptModeHiDensity = 1 << 0x07, - kOptCollapsible = 1 << 0x08, - kOptDisableOnScrDisp = 1 << 0x09, - kOpt5WayNavigatorV1 = 1 << 0x0A, - kOpt5WayNavigatorV2 = 1 << 0x0B, - kOptPalmSoundAPI = 1 << 0x0C, - kOptSonyPa1LibAPI = 1 << 0x0D, - kOptGoLcdAPI = 1 << 0x0E, - kOptLightspeedAPI = 1 << 0x0F, - kOptModeRotatable = 1 << 0x10, - - kOptDeviceProcX86 = 1 << 0x1F // DEBUG only -}; - -// WARNING : you need to define OPTIONS_DEF() -#define OPTIONS_TST(x) (OPTIONS_DEF() & (x)) -#define OPTIONS_SET(x) OPTIONS_DEF() |= (x) -#define OPTIONS_RST(x) OPTIONS_DEF() &= ~(x) - -#endif diff --git a/backends/platform/PalmOS/Src/vibrate.h b/backends/platform/PalmOS/Src/vibrate.h deleted file mode 100644 index 37604be5b7..0000000000 --- a/backends/platform/PalmOS/Src/vibrate.h +++ /dev/null @@ -1,61 +0,0 @@ -/********************************************************************** -** ** -** vibrate.h ** -** ** -** Definitions for setting/retrieving the state of the vibrator on ** -** PalmOS 4.x devices. These calls are not officially supported by ** -** Palm Inc and subsidiaries. It is not guaranteed that these calls ** -** will work at all or at least the same on every device. YOU ARE ** -** USING THESE ENTIRELY ON YOUR VERY OWN RISK ! ** -** ** -** Please send corrections to dseifert@dseifert.com ** -**********************************************************************/ - -#include - -/* HwrVibrateAttributes takes three arguments: -** Boolean set Should the setting be set (1) or retrieved (0) -** UInt32 setting what should be set -** void* value pointer to the value to set, or to store the -** retrieved setting -*/ - -Err HwrVibrateAttributes(Boolean set, UInt32 setting, void *value) - SYS_TRAP(sysTrapHwrVibrateAttributes); - -/* to determine whether the vibrator is supported on a specific device, you -** need to make sure that you are running on PalmOS 4.x (so that the -** trap exists), that the attention manager exists and you need to check -** whether HwrVibrateAttributes(0, 1, &active) returns an error code of -** 0. ('active' is a Boolean). -*/ - - -/***************************************************************/ -/* For the second parameter, the following defines can be used */ -/***************************************************************/ - -/* *value points to a Boolean stating the state of the vibrator */ -#define kHwrVibrateActive 1 - -/* *value points to a UInt16, specifying the length of one cycle. -** value is in ticks (1/100 seconds) */ -#define kHwrVibrateRate 2 - -/* *value points to a UInt32, specifying the pattern of vibrating -** -** example: -** 0xFFFFFFFF stay on, no vibrating -** 0x0F0F0F0F vibrate four times in equal intervals -** 0xAAAAAAAA vibrate really fast (not recommended) -** 0x0F0F0000 vibrate twice, then pause -*/ -#define kHwrVibratePattern 3 - -/* *value points to a UInt16, specifying the delay between two -** cycles in ticks */ -#define kHwrVibrateDelay 4 - -/* *value points to a UInt16 specifying the amount of repeats. */ -#define kHwrVibrateRepeatCount 5 - diff --git a/backends/platform/PalmOS/Src/zodiac_event.cpp b/backends/platform/PalmOS/Src/zodiac_event.cpp deleted file mode 100644 index f629c4cbd6..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_event.cpp +++ /dev/null @@ -1,100 +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$ - * - */ - -#include "be_zodiac.h" - -bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) { - if (ev->eType == keyUpEvent) { - switch (ev->data.keyDown.chr) { - case vchrActionLeft: - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrActionRight: - event.type = Common::EVENT_RBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - - } else if (ev->eType == keyDownEvent) { - switch (ev->data.keyDown.chr) { - // F5 = menu - case vchrThumbWheelBack: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - event.kbd.flags = 0; - return true; - - case vchrTriggerLeft: - hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE); - return false; // not a key - - case vchrTriggerRight: - setFeatureState(kFeatureAspectRatioCorrection, 0); - return false; // not a key - - case vchrActionLeft: - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrActionRight: - event.type = Common::EVENT_RBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - // skip text - case vchrActionDown: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_PERIOD; - event.kbd.ascii = '.'; - event.kbd.flags = 0; - return true; - - // trun off - case vchrAutoOff: - case vchrPowerOff: - // pause the sound thread if any - if (_sound.active) - SndStreamPause(_soundEx.handle, true); - break; - - case vchrLateWakeup: - // resume the sound thread if any - if (_sound.active) - SndStreamPause(_soundEx.handle, false); - break; - } - - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/zodiac_gfx.cpp b/backends/platform/PalmOS/Src/zodiac_gfx.cpp deleted file mode 100644 index 98c563e101..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_gfx.cpp +++ /dev/null @@ -1,309 +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$ - * - */ - -#include "be_zodiac.h" -#include "common/config-manager.h" -#include "rumble.h" - -static asm Err _TwGfxOpen(void **aResult, void *aInfoResult) { - stmfd sp!, {r4-r11,lr} - ldr r9, [r9] - ldr r9, [r9] - sub sp, sp, #0x24 - mov r6, r0 - mov r7, r1 - ldr pc, =0x200995F0 -} - -int OSystem_PalmZodiac::getDefaultGraphicsMode() const { - return GFX_WIDE; -} - -void OSystem_PalmZodiac::load_gfx_mode() { - Err e; - - if (_gfxLoaded) - return; - _gfxLoaded = true; - - // get command line config - _fullscreen = ConfMan.getBool("fullscreen"); // TODO : (NORMAL mode) - _ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone; - - // precalc ratio (WIDE mode) - _ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight); - _ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth); - - _offScreenP = (byte *)MemPtrNew(_screenWidth * _screenHeight); - - MemSet(_offScreenP, _screenWidth * _screenHeight, 0); - MemSet(_nativePal, sizeof(_nativePal), 0); - MemSet(_currentPalette, sizeof(_currentPalette), 0); - - UInt32 depth = 16; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - - _sysOldOrientation = SysGetOrientation(); - _sysOldTriggerState = PINGetInputTriggerState(); - SysSetOrientation(sysOrientationLandscape); - SysSetOrientationTriggerState(sysOrientationTriggerDisabled); - PINSetInputTriggerState(pinInputTriggerDisabled); - - gVars->indicator.on = Graphics::RGBToColor >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor >(0,0,0); - - _screenH = WinGetDisplayWindow(); - _screenP = (byte *)BmpGetBits(WinGetBitmap(_screenH)); - - e = _TwGfxOpen((void **)&_gfxH, 0); - e = TwGfxGetPalmDisplaySurface(_gfxH, &_palmScreenP); - - // overlay buffer - TwGfxSurfaceInfoType nfo = { - sizeof(TwGfxSurfaceInfoType), - _screenWidth, _screenHeight, _screenWidth * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - e = TwGfxAllocSurface(_gfxH, &_overlayP, &nfo); - - // prepare main bitmap - _srcBmp.size = sizeof(TwGfxBitmapType); - _srcBmp.width = _screenWidth; - _srcBmp.height = _screenHeight; - _srcBmp.rowBytes = _screenWidth; - _srcBmp.pixelFormat = twGfxPixelFormat8bpp; - _srcBmp.data = _offScreenP; - _srcBmp.palette = (UInt16 *)_nativePal; - - _srcRect.x = 0; - _srcRect.y = 0; - _srcRect.w = _screenWidth; - _srcRect.h = _screenHeight; - - hotswap_gfx_mode(_mode); -} - -void OSystem_PalmZodiac::hotswap_gfx_mode(int mode) { - Err e; - TwGfxSetClip(_palmScreenP, 0); - WinSetDrawWindow(_screenH); - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - // prevent bad DIA redraw (Stat part) - if (mode == GFX_NORMAL) { - _redawOSD = true; - _stretched = (_screenWidth > gVars->screenWidth); - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); - - if (_stretched) { - calc_rect(false); - } else { - // offsets - _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2; - _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2; - - // clip Tapwave API - TwGfxRectType rt = { _screenOffset.x, _screenOffset.y, _screenWidth, _screenHeight }; - TwGfxSetClip(_palmScreenP, &rt); - } - - } else { - _redawOSD = false; - _stretched = true; - PINSetInputAreaState(pinInputAreaClosed); - StatHide(); - - calc_rect(true); - } - - if (_stretched) { - OPTIONS_SET(kOptDisableOnScrDisp); - TwGfxSetClip(_palmScreenP, &_dstRect); - - if (!_tmpScreenP) { - // wide buffer - TwGfxSurfaceInfoType nfo = { - sizeof(TwGfxSurfaceInfoType), - _screenWidth, _screenHeight, _screenWidth * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - e = TwGfxAllocSurface(_gfxH, &_tmpScreenP, &nfo); - } - } else { - OPTIONS_RST(kOptDisableOnScrDisp); - if (_tmpScreenP) { - e = TwGfxFreeSurface(_tmpScreenP); - _tmpScreenP = NULL; - } - } - - _mode = mode; - _srcPos.x = _screenOffset.x; - _srcPos.y = _screenOffset.y; - clear_screen(); -// updateScreen(); -} - -void OSystem_PalmZodiac::unload_gfx_mode() { - Err e; - - if (!_gfxLoaded) - return; - _gfxLoaded = false; - - if (_tmpScreenP) { - e = TwGfxFreeSurface(_tmpScreenP); - _tmpScreenP = NULL; - } - - e = TwGfxFreeSurface(_overlayP); - e = TwGfxClose(_gfxH); - - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - MemPtrFree(_offScreenP); - - PINSetInputTriggerState(_sysOldTriggerState); - SysSetOrientation(_sysOldOrientation); - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); -} - -static void rumblePack(Boolean active) { - if (!gVars->vibrator) - return; - - RumbleRun(active); -} - -void OSystem_PalmZodiac::int_setShakePos(int shakeOffset) { - if (shakeOffset == 0) - rumblePack(false); -} - -void OSystem_PalmZodiac::updateScreen() { - Err e; - - // draw the mouse pointer - draw_mouse(); - - // update the screen - if (_overlayVisible) { - if (_stretched) { - TwGfxRectType dst = {_dstRect.x, _dstRect.y, _dstRect.w, _dstRect.h}; - e = TwGfxStretchBlt2(_palmScreenP, &dst, _overlayP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); - } else { - e = TwGfxBitBlt(_palmScreenP, &_srcPos, _overlayP, &_srcRect); - } - - } else { - if (_stretched) { - TwGfxPointType pos = {0, 0}; - TwGfxRectType dst = {_dstRect.x, _dstRect.y, _dstRect.w, _dstRect.h}; - - if (_new_shake_pos != _current_shake_pos) { - TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _dstRect.w, _new_shake_pos }; - - if (_new_shake_pos != 0) { - TwGfxFillRect(_palmScreenP, &r, 0); - rumblePack(_new_shake_pos >= 3); - } - r.y += dst.h; - r.h = _current_shake_pos; - TwGfxFillRect(_palmScreenP, &r, 0); - - _current_shake_pos = _new_shake_pos; - dst.y += _new_shake_pos; - } - e = TwGfxDrawBitmap(_tmpScreenP, &pos, &_srcBmp); - e = TwGfxWaitForVBlank(_gfxH); - e = TwGfxStretchBlt2(_palmScreenP, &dst, _tmpScreenP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); - - } else { - TwGfxPointType pos = {_srcPos.x, _srcPos.y}; - - if (_new_shake_pos != _current_shake_pos) { - if (_new_shake_pos != 0) { - TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _screenWidth, _new_shake_pos }; - TwGfxFillRect(_palmScreenP, &r, 0); - rumblePack(_new_shake_pos >= 3); - } - _current_shake_pos = _new_shake_pos; - pos.y += _new_shake_pos; - } - e = TwGfxDrawBitmap(_palmScreenP, &pos, &_srcBmp); - } - } - - // undraw the mouse - undraw_mouse(); -} - -void OSystem_PalmZodiac::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { - if (_mode != GFX_NORMAL) - return; - MemHandle hTemp = DmGetResource(bitmapRsc, id + 100); - - if (hTemp) { - RGBColorType oldRGB; - static const RGBColorType pal[4] = { - {0,0,255,0}, - {0,255,255,0}, - {0,255,0,0}, - {0,0,0,0} - }; - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - WinGetBitmapDimensions(bmTemp, &w, &h); // return the size of the low density bmp - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType c, r = { dst.x, dst.y, w * 2, h * 2 }; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinSetDrawWindow(_screenH); - if (show) { - WinSetForeColorRGB(&pal[3], &oldRGB); - WinSetBackColorRGB(&pal[color], &oldRGB); - WinPaintBitmap(bmTemp, dst.x, dst.y); - } else { - WinSetBackColorRGB(&pal[3], &oldRGB); - WinFillRectangle(&r, 0); - } - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/zodiac_mouse.cpp b/backends/platform/PalmOS/Src/zodiac_mouse.cpp deleted file mode 100644 index 39a789aaa1..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_mouse.cpp +++ /dev/null @@ -1,153 +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$ - * - */ - -#include "be_zodiac.h" - -void OSystem_PalmZodiac::draw_mouse() { - if (!_mouseDataP || _mouseDrawn || !_mouseVisible) - return; - - byte *src = _mouseDataP; - - int x = _mouseCurState.x - _mouseHotspotX; - int y = _mouseCurState.y - _mouseHotspotY; - int w = _mouseCurState.w; - int h = _mouseCurState.h; - - // clip the mouse rect - if (y < 0) { - src -= y * w; - h += y; - y = 0; - } - if (x < 0) { - src -= x; - w += x; - x = 0; - } - - if (h > _screenHeight - y) - h = _screenHeight - y; - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (w <= 0 || h <= 0) - return; - - // store the bounding box so that undraw mouse can restore the area the - // mouse currently covers to its original content - _mouseOldState.x = x; - _mouseOldState.y = y; - _mouseOldState.w = w; - _mouseOldState.h = h; - - byte color; - int ww; - - if (_overlayVisible) { - uint16 *bak = (uint16 *)_mouseBackupP; - uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - uint16 *dst; - - TwGfxLockSurface(_overlayP, (void **)&dst); - dst += y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = pal[color]; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - - TwGfxUnlockSurface(_overlayP, true); - - } else { - byte *bak = _mouseBackupP; - byte *dst =_offScreenP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = color; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - } - - _mouseDrawn = true; -} - -void OSystem_PalmZodiac::undraw_mouse() { - if (!_mouseDrawn) - return; - - int h = _mouseOldState.h; - - // no need to do clipping here, since draw_mouse() did that already - if (_overlayVisible) { - uint16 *dst; - uint16 *bak = (uint16 *)_mouseBackupP; - - TwGfxLockSurface(_overlayP, (void **)&dst); - dst += _mouseOldState.y * _screenWidth + _mouseOldState.x; - - do { - MemMove(dst, bak, _mouseOldState.w * 2); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - - TwGfxUnlockSurface(_overlayP, true); - - } else { - byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - byte *bak = _mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - } - - _mouseDrawn = false; -} diff --git a/backends/platform/PalmOS/Src/zodiac_overlay.cpp b/backends/platform/PalmOS/Src/zodiac_overlay.cpp deleted file mode 100644 index f8322e8fa5..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_overlay.cpp +++ /dev/null @@ -1,67 +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$ - * - */ - -#include "be_zodiac.h" -#include "common/endian.h" - -void OSystem_PalmZodiac::clearOverlay() { - if (!_overlayVisible) - return; - - Err e; - TwGfxPointType pos = {0, 0}; - TwGfxBitmapType bmp = { - sizeof(TwGfxBitmapType), - _screenWidth, _screenHeight, _screenWidth, twGfxPixelFormat8bpp, - (void *)_offScreenP, (UInt16 *)_nativePal - }; - e = TwGfxDrawBitmap(_overlayP, &pos, &bmp); -} - -void OSystem_PalmZodiac::grabOverlay(OverlayColor *buf, int pitch) { - Err e; - OverlayColor *src; - - e = TwGfxLockSurface(_overlayP, (void **)&src); - int h = _screenHeight; - do { - memcpy(buf, src, _screenWidth * 2); - src += _screenWidth; - buf += pitch; - } while (--h); - - e = TwGfxUnlockSurface(_overlayP, 0); -} - -void OSystem_PalmZodiac::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - Err e; - TwGfxPointType pos = {x, y}; - TwGfxBitmapType bmp = { - sizeof(TwGfxBitmapType), - w, h, pitch * 2 , twGfxPixelFormatRGB565_LE, - (void *)buf, 0 - }; - e = TwGfxDrawBitmap(_overlayP, &pos, &bmp); -} diff --git a/backends/platform/PalmOS/arm.bat b/backends/platform/PalmOS/arm.bat deleted file mode 100755 index 547ae391fe..0000000000 --- a/backends/platform/PalmOS/arm.bat +++ /dev/null @@ -1,3 +0,0 @@ -as.exe --defsym PALMOS_MODE=1 ../../../sound/rate_arm_asm.s -o Obj/rate_arm_asm.o -as.exe --defsym PALMOS_MODE=1 ../../../engines/scumm/gfxARM.s -o Obj/gfxARM.o -as.exe --defsym PALMOS_MODE=1 ../../../engines/scumm/smush/codec47ARM.s -o Obj/codec47ARM.o diff --git a/backends/platform/PalmOS/scummvm.mcp b/backends/platform/PalmOS/scummvm.mcp deleted file mode 100644 index a01967d059..0000000000 Binary files a/backends/platform/PalmOS/scummvm.mcp and /dev/null differ -- cgit v1.2.3 From 58a1fbc13c116d3fa69c426c0cdeb459d354fbf0 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 18 Jul 2010 06:49:56 +0000 Subject: Made memcpy faster but not as fast with uncached mem. svn-id: r50980 --- backends/platform/psp/display_client.cpp | 15 +- backends/platform/psp/memory.cpp | 627 ++++++++++++++++++++----------- backends/platform/psp/memory.h | 211 +++++++---- backends/platform/psp/module.mk | 3 +- backends/platform/psp/psp_main.cpp | 11 +- 5 files changed, 559 insertions(+), 308 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp index c5a6250188..71b505ec7c 100644 --- a/backends/platform/psp/display_client.cpp +++ b/backends/platform/psp/display_client.cpp @@ -340,11 +340,17 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u if (pitch == realWidthInBytes && pitch == recWidthInBytes) { //memcpy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth)); - Copier::copy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), _pixelFormat); + else + PspMemory::fastCopy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth)); } else { do { //memcpy(dst, buf, recWidthInBytes); - Copier::copy(dst, buf, recWidthInBytes, &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, buf, recWidthInBytes, _pixelFormat); + else + PspMemory::fastCopy(dst, buf, recWidthInBytes); buf += pitch; dst += realWidthInBytes; } while (--recHeight); @@ -363,7 +369,10 @@ void Buffer::copyToArray(byte *dst, int pitch) { do { //memcpy(dst, src, sourceWidthInBytes); - Copier::copy(dst, src, sourceWidthInBytes, &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, src, sourceWidthInBytes, _pixelFormat); + else + PspMemory::fastCopy(dst, src, sourceWidthInBytes); src += realWidthInBytes; dst += pitch; } while (--h); diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp index e134a7d0f4..d66650aee5 100644 --- a/backends/platform/psp/memory.cpp +++ b/backends/platform/psp/memory.cpp @@ -1,223 +1,404 @@ -/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#include "common/scummsys.h" -#include "common/singleton.h" -#include "common/list.h" -#include "backends/platform/psp/psppixelformat.h" -#include "backends/platform/psp/memory.h" - -// Class Copier -------------------------------------------------------------------------- -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - -void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) { - DEBUG_ENTER_FUNC(); - - uint32 prefixDst = (((uint32)dst) & 0x3); - prefixDst = prefixDst ? 4 - prefixDst : 0; // prefix only if we have address % 4 != 0 - uint32 prefixSrc = (((uint32)src) & 0x3); - prefixSrc = prefixSrc ? 4 - prefixSrc : 0; // prefix only if we have address % 4 != 0 - uint32 *dst32, *src32; - bool swapRB = format ? format->swapRB : false; // take swap value from pixelformat if it's given -#ifdef __PSP_DEBUG_PRINT__ - uint32 debugBytes = bytes; - const byte *debugDst = dst, *debugSrc = src; -#endif - uint32 words, remainingBytes; - - //PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%d], swap[%s], prefixDst[%u], prefixSrc[%u]\n", dst, src, bytes, swapRB ? "true" : "false", prefixDst, prefixSrc); - - if (prefixDst || prefixSrc) { // we're not aligned to word boundaries - if (prefixDst != prefixSrc) { // worst case: we can never be aligned. this mode is highly inefficient. try to get engines not to use this mode too much - PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src, dst); - if ((prefixDst & 1) || (prefixSrc & 1)) - copy8(dst, src, bytes); // no swap is possible on 8 bit - else - copy16((uint16 *)dst, (uint16 *)src, bytes, format); - - goto test; - } - - // Do the prefix: the part to get us aligned - if (prefixDst & 1) { // byte - copy8(dst, src, prefixDst); // no swap available - } else { // short - copy16((uint16 *)dst, (uint16 *)src, prefixDst, format); - } - if (bytes > prefixDst) // check that we can afford to subtract from bytes - bytes -= prefixDst; - else { - return; - } - dst32 = (uint32 *)(dst + prefixDst); - src32 = (uint32 *)(src + prefixSrc); - } else { // We're aligned to word boundaries - dst32 = (uint32 *)dst; - src32 = (uint32 *)src; - } - - words = bytes >> 2; - remainingBytes = bytes & 0x3; - - if (swapRB) { // need to swap - for (; words > 0; words--) { - *dst32 = format->swapRedBlue32(*src32); - dst32++; - src32++; - } - } else { // no swapping - for (; words > 0; words--) { - *dst32 = *src32; - dst32++; - src32++; - } - } - - // Do any remaining bytes - if (remainingBytes) { - if (remainingBytes & 1) // we have bytes left - copy8((byte *)dst32, (byte *)src32, remainingBytes); - else // 16bits left - copy16((uint16*)dst32, (uint16 *)src32, remainingBytes, format); - } - -test: - // debug -#ifdef __PSP_DEBUG_PRINT__ - bool mismatch = false; - - for (uint32 i = 0; i < debugBytes; i++) { - if (debugDst[i] != debugSrc[i]) { - if (mismatch == false) { - PSP_DEBUG_PRINT_SAMELN("mismatch in copy:\n"); - PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u], swap[%s], prefixDst[%u], prefixSrc[%u]\n", debugDst, debugSrc, debugBytes, swapRB ? "true" : "false", prefixDst, prefixSrc); - mismatch = true; - } - PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); - } - } - if (mismatch) - PSP_DEBUG_PRINT("\n"); -#endif - - return; // So we have something to jump to with the label -} - -inline void Copier::copy8(byte *dst, const byte *src, uint32 bytes) { - for (; bytes > 0; bytes--) { - *dst = *src; - dst++; - src++; - } -} - -inline void Copier::copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) { - uint32 shorts = bytes >> 1; - uint32 remainingBytes = bytes & 1; - bool swapRB = format ? format->swapRB : false; - - if (swapRB) { - for (; shorts > 0 ; shorts--) { - *dst = format->swapRedBlue16(*src); - dst++; - src++; - } - } else { - for (; shorts > 0 ; shorts--) { - *dst = *src; - dst++; - src++; - } - } - if (remainingBytes) - *(byte *)dst = *(byte *)src; -} - - -// Class VramAllocator ----------------------------------- - -DECLARE_SINGLETON(VramAllocator) - -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - - -void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { - DEBUG_ENTER_FUNC(); - assert(size > 0); - - byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; - Common::List::iterator i; - - // Find a block that fits, starting from the beginning - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - byte *currAddress = (*i).address; - - if (currAddress - lastAddress >= size) // We found a match - break; - - if ((*i).getEnd() > lastAddress) - lastAddress = (byte *)(*i).getEnd(); - } - - if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { - PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", - size, _bytesAllocated); - return NULL; - } - - _allocList.insert(i, Allocation(lastAddress, size)); - _bytesAllocated += size; - - PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); - PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - - return lastAddress; -} - -// Deallocate a block from VRAM -void VramAllocator::deallocate(void *address) { - DEBUG_ENTER_FUNC(); - address = (byte *)CACHED(address); // Make sure all addresses are the same - - Common::List::iterator i; - - // Find the Allocator to deallocate - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - if ((*i).address == address) { - _bytesAllocated -= (*i).size; - _allocList.erase(i); - PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); - return; - } - } - - PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); -} +/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include "common/singleton.h" +#include "common/list.h" +#include "backends/platform/psp/PSPPixelFormat.h" +#include "backends/platform/psp/memory.h" + +// Class Copier -------------------------------------------------------------------------- +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +//#define TEST_MEMORY_COPY + +// swapRB is used to swap red and blue in the display +void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const byte *debugDst = dst, *debugSrc = src; +#endif + + PSP_DEBUG_PRINT("copy(): dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst) & 0x3); + + if (prefixDst) { + prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0 + PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst); + + bytes -= prefixDst; // remember we assume bytes >= 4 + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + copy8(dst, src, bytes); +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif + return; + } + + while (prefixDst--) { + *dst++ = *src++; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); + } else { + copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); + } + +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif +} + +void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { + + bool mismatch = false; + PSP_INFO_PRINT("testing memcpy..."); + + for (uint32 i = 0; i < debugBytes; i++) { + if (debugDst[i] != debugSrc[i]) { + if (mismatch == false) { + PSP_DEBUG_PRINT_SAMELN("**** mismatch in copy! ****\n"); + PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); + } + } + if (mismatch) { + PSP_DEBUG_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + +// +// used to swap red and blue +void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix + + if (prefixDst) { + bytes -= prefixDst; // remember we assume bytes > 4 + *dst16++ = *src16++; + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { // check if it's worthwhile to continue + swap16(dst16, src16, bytes, format); + return; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src16) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); + swap32Misaligned((uint32 *)dst16, (uint16 *)src16, bytes, format); + } else { + swap32Aligned((uint32 *)dst16, (uint32 *)src16, bytes, format); + } +} + +void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { + PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); + + int words8 = bytes >> 5; + + // try blocks of 8 words at a time + if (words8) { + while (words8--) { + dst32[0] = src32[0]; + dst32[1] = src32[1]; + dst32[2] = src32[2]; + dst32[3] = src32[3]; + dst32[4] = src32[4]; + dst32[5] = src32[5]; + dst32[6] = src32[6]; + dst32[7] = src32[7]; + dst32 += 8; + src32 += 8; + } + } + + int words4 = (bytes & 0x1F) >> 4; + + // try blocks of 4 words at a time + if (words4) { + dst32[0] = src32[0]; + dst32[1] = src32[1]; + dst32[2] = src32[2]; + dst32[3] = src32[3]; + dst32 += 4; + src32 += 4; + } + + int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above + int wordsLeft = bytesLeft >> 2; + + // now just do single words + while (wordsLeft) { + *dst32++ = *src32++; + wordsLeft--; + } + + bytesLeft = bytes & 0x3; // get remaining bytes + + PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); + + byte *dst = (byte *)dst32; + byte *src = (byte *)src32; + + while (bytesLeft--) { + *dst++ = *src++; + } +} + +void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + int words = bytes >> 2; + + // try blocks of 4 words at a time + for (; words - 4 >= 0; words -= 4) { + dst32[0] = format.swapRedBlue32(src32[0]); + dst32[1] = format.swapRedBlue32(src32[1]); + dst32[2] = format.swapRedBlue32(src32[2]); + dst32[3] = format.swapRedBlue32(src32[3]); + dst32 += 4; + src32 += 4; + } + + // now just do words + for (; words > 0; words--) { + *dst32++ = format.swapRedBlue32(*src32++); + } + + uint32 remainingBytes = bytes & 0x3; + + if (remainingBytes) { // for swap, must be a 16 bit value + *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); // only 1 short left + } +} + + +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { + PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); + + uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment + uint32 offset; + + switch (alignSrc) { + case 1: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); + break; + case 2: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); + break; + case 3: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); + break; + } + + uint32 remainingBytes = bytes & 3; + + if (remainingBytes) { + byte *dst = (byte *)dst32; + src += offset; + dst += offset; + copy8(dst, src, remainingBytes); + } +} + +// returns offset in dst +uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { + uint32 *origDst32 = dst32; + register uint32 dstWord, srcWord; + + PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], words[%d]\n", alignSrc, dst32, src32, words); + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + + srcWord = src32[0]; + + while (words4--) { + dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << lastShiftValue; + dst32[0] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << lastShiftValue; + dst32[1] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << lastShiftValue; + dst32[2] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << lastShiftValue; + dst32[3] = dstWord; + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + srcWord = *src32++; + + while (words--) { + dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << lastShiftValue; + *dst32++ = dstWord; + } + } + + return (byte *)dst32 - (byte *)origDst32; +} +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + if (bytes < MIN_AMOUNT_FOR_MISALIGNED_COPY) { // less than a certain number of bytes it's just not worth it + swap16((uint16 *)dst32, src16, bytes, format); + return; + } + + int words = bytes >> 2; + uint32 remainingBytes = bytes & 3; + + uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment + + // we read one word ahead of what we write + // setup the first read + uint32 lastWord = ((*src32++) >> 16) & 0xFFFF; + + for (; words; words--) { + uint32 srcWord = *src32++; + uint32 curWord = (srcWord >> 16) & 0xFFFF; + lastWord |= (srcWord & 0xFFFF) << 16; // take the part of the src that belongs to this word + *dst32++ = format.swapRedBlue32(lastWord); + lastWord = curWord; + } + + if (remainingBytes) { // add in the remaining stuff + *(uint16 *)dst32 = format.swapRedBlue16((uint16)lastWord); + } +} + +inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { + PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + + uint32 shorts = bytes >> 1; + uint32 remainingBytes = bytes & 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = *src16++; + } + if (remainingBytes) + *(byte *)dst16 = *(byte *)src16; +} + +// Class VramAllocator ----------------------------------- + +DECLARE_SINGLETON(VramAllocator) + +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + + +void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { + DEBUG_ENTER_FUNC(); + assert(size > 0); + + byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; + Common::List::iterator i; + + // Find a block that fits, starting from the beginning + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + byte *currAddress = (*i).address; + + if (currAddress - lastAddress >= size) // We found a match + break; + + if ((*i).getEnd() > lastAddress) + lastAddress = (byte *)(*i).getEnd(); + } + + if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { + PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", + size, _bytesAllocated); + return NULL; + } + + _allocList.insert(i, Allocation(lastAddress, size)); + _bytesAllocated += size; + + PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); + PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); + + return lastAddress; +} + +// Deallocate a block from VRAM +void VramAllocator::deallocate(void *address) { + DEBUG_ENTER_FUNC(); + address = (byte *)CACHED(address); // Make sure all addresses are the same + + Common::List::iterator i; + + // Find the Allocator to deallocate + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + if ((*i).address == address) { + _bytesAllocated -= (*i).size; + _allocList.erase(i); + PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); + return; + } + } + + PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); +} diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index a198095090..81a77cca1c 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -1,80 +1,131 @@ - -/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#ifndef PSP_MEMORY_H -#define PSP_MEMORY_H - -#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ -#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ - -/** - * Class that does memory copying and swapping if needed - */ -class Copier { -public: - static void copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format = NULL); - static void copy8(byte *dst, const byte *src, uint32 bytes); - static void copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format = NULL); -}; - -/** - * Class that allocates memory in the VRAM - */ -class VramAllocator : public Common::Singleton { -public: - VramAllocator() : _bytesAllocated(0) {} - void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes - void deallocate(void *pointer); - - static inline bool isAddressInVram(void *address) { - if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) - return true; - return false; - } - - -private: - /** - * Used to allocate in VRAM - */ - struct Allocation { - byte *address; - uint32 size; - void *getEnd() { return address + size; } - Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} - Allocation() : address(0), size(0) {} - }; - - enum { - VRAM_START_ADDRESS = 0x04000000, - VRAM_END_ADDRESS = 0x04200000, - VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations - }; - Common::List _allocList; // List of allocations - uint32 _bytesAllocated; -}; - -#endif /* PSP_MEMORY_H */ + +/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#ifndef PSP_MEMORY_H +#define PSP_MEMORY_H + +#include "backends/platform/psp/psppixelformat.h" +#include "common/list.h" + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 +#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 + +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +/** + * Class that does memory copying and swapping if needed + */ +class PspMemory { +private: + static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); + static void copy(byte *dst, const byte *src, uint32 bytes); + static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); + static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); + static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); + static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); + static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); + + // For swapping, we know that we have multiples of 16 bits + static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + uint32 shorts = bytes >> 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = format.swapRedBlue16(*src16++); + } + } + + static void copy8(byte *dst, const byte *src, uint32 bytes) { + PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + while (bytes--) { + *dst++ = *src++; + } + } + +public: + // This is the interface to the outside world + static void fastCopy(byte *dst, const byte *src, uint32 bytes) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { + copy8(dst, src, bytes); + } else { // go to more powerful copy + copy(dst, src, bytes); + } + } + + static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { + swap16((uint16 *)dst, (uint16 *)src, bytes, format); + } else { // go to more powerful copy + swap((uint16 *)dst, (uint16 *)src, bytes, format); + } + } +}; + +/** + * Class that allocates memory in the VRAM + */ +class VramAllocator : public Common::Singleton { +public: + VramAllocator() : _bytesAllocated(0) {} + void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes + void deallocate(void *pointer); + + static inline bool isAddressInVram(void *address) { + if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) + return true; + return false; + } + + +private: + /** + * Used to allocate in VRAM + */ + struct Allocation { + byte *address; + uint32 size; + void *getEnd() { return address + size; } + Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} + Allocation() : address(0), size(0) {} + }; + + enum { + VRAM_START_ADDRESS = 0x04000000, + VRAM_END_ADDRESS = 0x04200000, + VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations + }; + Common::List _allocList; // List of allocations + uint32 _bytesAllocated; +}; + +#endif /* PSP_MEMORY_H */ diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk index e9c896acfd..855554e980 100644 --- a/backends/platform/psp/module.mk +++ b/backends/platform/psp/module.mk @@ -16,7 +16,8 @@ MODULE_OBJS := powerman.o \ audio.o \ thread.o \ rtc.o \ - mp3.o + mp3.o \ + tests.o MODULE_DIRS += \ backends/platform/psp/ diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index c26aed539e..b84702115f 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -44,12 +44,15 @@ #include "backends/plugins/psp/psp-provider.h" #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" +#include "backends/platform/psp/tests.h" #include "backends/platform/psp/trace.h" #ifdef ENABLE_PROFILING #include #endif +#define ENABLE_TESTS /* to enable tests of PSP architecture */ + /** * Define the module info section * @@ -153,7 +156,7 @@ int SetupCallbacks(void) { #undef main int main(void) { //change clock rate to 333mhz - scePowerSetClockFrequency(333, 333, 166); + scePowerSetClockFrequency(222, 222, 111); PowerManager::instance(); // Setup power manager @@ -169,6 +172,12 @@ int main(void) { PluginManager::instance().addPluginProvider(new PSPPluginProvider()); #endif +#ifdef ENABLE_TESTS + PSP_INFO_PRINT("running tests\n"); + tests(); + sceKernelSleepThread(); +#endif + int res = scummvm_main(argc, argv); g_system->quit(); // TODO: Consider removing / replacing this! -- cgit v1.2.3 From 844a332f8de4ab74ec1c739c2ab6f41e8d957d53 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 18 Jul 2010 06:59:25 +0000 Subject: PSP: forgot test files svn-id: r50981 --- backends/platform/psp/tests.cpp | 656 ++++++++++++++++++++++++++++++++++++++++ backends/platform/psp/tests.h | 26 ++ 2 files changed, 682 insertions(+) create mode 100644 backends/platform/psp/tests.cpp create mode 100644 backends/platform/psp/tests.h (limited to 'backends') diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp new file mode 100644 index 0000000000..25c07fd723 --- /dev/null +++ b/backends/platform/psp/tests.cpp @@ -0,0 +1,656 @@ +/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "backends/platform/psp/rtc.h" +#include "backends/platform/psp/thread.h" +#include "backends/platform/psp/memory.h" + + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +//#define __PSP_DEBUG_FUNCS__ +//#define __PSP_DEBUG_PRINT__ + +// Results: (333Mhz/222Mhz) +// Getting a tick: 1-2 us +// Getting a time structure: 9/14us +// ie. using a tick and just dividing by 1000 saves us time. + +#include "backends/platform/psp/trace.h" + +void test_ticks() { + uint32 ticksPerSecond = sceRtcGetTickResolution(); + PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond); + + uint32 currentTicks1[2]; + uint32 currentTicks2[2]; + + sceRtcGetCurrentTick((u64 *)currentTicks1); + sceRtcGetCurrentTick((u64 *)currentTicks2); + PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks1[0], currentTicks1[1], currentTicks1[0], currentTicks1[1]); + PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks2[0], currentTicks2[1], currentTicks2[0], currentTicks2[1]); + + pspTime time; + sceRtcSetTick(&time, (u64 *)currentTicks2); + PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds); + + pspTime time1; + pspTime time2; + sceRtcGetCurrentClockLocalTime(&time1); + sceRtcGetCurrentClockLocalTime(&time2); + PSP_INFO_PRINT("time1, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time1.year, time1.month, time1.day, time1.hour, time1.minutes, time1.seconds, time1.microseconds); + PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds); +} + +void test_getMicros() { + uint32 time1, time2, time3, time4; + time1 = PspRtc::instance().getMicros(); + time2 = PspRtc::instance().getMicros(); + time3 = PspRtc::instance().getMicros(); + time4 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1); +} + +void read_and_time(uint32 bytes, char *buffer, FILE *file) { + uint32 time1 = PspRtc::instance().getMicros(); + // test minimal read + fread(buffer, bytes, 1, file); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Reading %d byte takes %dus\n", bytes, time2-time1); +} + +/* + 333MHz/222MHz + Reading 1 byte takes 2590us / 3167 + Reading 10 byte takes 8us / 9 + Reading 50 byte takes 8us / 11 + Reading 100 byte takes 8us / 11 + Reading 1000 byte takes 915us / 1131 + Reading 1000 byte takes 911us + Reading 1000 byte takes 914us + Reading 1000 byte takes 943us + Reading 1000 byte takes 915us + Reading 1000 byte takes 923us + Reading 1000 byte takes 22us + Reading 1000 byte takes 916us + Reading 1000 byte takes 913us / 1,120 + Reading 1000 byte takes 909us / 1,122 + Reading 2000 byte takes 1806us / 2,284 + Reading 3000 byte takes 2697us / 3,374 + Reading 4000 byte takes 3652us / 4,592 + Reading 5000 byte takes 4551us / 5,544 + Reading 6000 byte takes 5356us / 6,676 + Reading 7000 byte takes 6800us / 8,358 + Reading 8000 byte takes 6794us / 8,454 + Reading 9000 byte takes 6782us / 8,563 + Reading 10000 byte takes 8497us / 10,631 + Reading 30000 byte takes 25995us / 32,473 + Reading 50000 byte takes 42467us / 52,893 + Reading 80000 byte takes 68457us / 85,291 + Reading 100000 byte takes 85103us / 106,163 + Reading 500000 byte takes 427337us / 531,679 + Reading 1000000 byte takes 854831us / 1,063,107 +*/ +// Function to test the impact of MS reads +// These tests can't be done from shell - the cache screws them up +void test_ms_reads() { + FILE *file; + file = fopen("ms0:/psp/music/track1.mp3", "r"); + + char *buffer = (char *)malloc(2 * 1024 * 1024); + + read_and_time(1, buffer, file); + read_and_time(10, buffer, file); + read_and_time(50, buffer, file); + read_and_time(100, buffer, file); + for (int i = 0; i< 10; i++) + read_and_time(1000, buffer, file); + read_and_time(2000, buffer, file); + read_and_time(3000, buffer, file); + read_and_time(4000, buffer, file); + read_and_time(5000, buffer, file); + read_and_time(6000, buffer, file); + read_and_time(7000, buffer, file); + read_and_time(8000, buffer, file); + read_and_time(9000, buffer, file); + read_and_time(10000, buffer, file); + read_and_time(30000, buffer, file); + read_and_time(50000, buffer, file); + read_and_time(80000, buffer, file); + read_and_time(100000, buffer, file); + read_and_time(500000, buffer, file); + read_and_time(1000000, buffer, file); + + fclose(file); + free(buffer); +} + +void seek_and_time(int bytes, int origin, FILE *file) { + char buffer[1000]; + + uint32 time1 = PspRtc::instance().getMicros(); + // test minimal read + fseek(file, bytes, origin); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Seeking %d byte from %d took %dus\n", bytes, origin, time2-time1); + + time1 = PspRtc::instance().getMicros(); + // test minimal read + fread(buffer, 1000, 1, file); + time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Reading 1000 bytes took %dus\n", time2-time1); +} + +/* +333MHz +Seeking 0 byte from 0 took 946us +Reading 1000 bytes took 1781us +Seeking 5 byte from 0 took 6us +Reading 1000 bytes took 19us +Seeking 1000 byte from 0 took 5us +Reading 1000 bytes took 913us +Seeking 100 byte from 0 took 955us +Reading 1000 bytes took 906us +Seeking 10000 byte from 0 took 963us +Reading 1000 bytes took 905us +Seeking -5 byte from 1 took 1022us +Reading 1000 bytes took 949us +Seeking -100 byte from 1 took 1040us +Reading 1000 bytes took 907us +Seeking 100 byte from 1 took 1044us +Reading 1000 bytes took 930us +Seeking 0 byte from 2 took 7211us +Reading 1000 bytes took 80us +Seeking 10000 byte from 2 took 3636us +Reading 1000 bytes took 110us +*/ + +void test_seeks() { + FILE *file; + file = fopen("ms0:/psp/music/track1.mp3", "r"); + + seek_and_time(0, SEEK_SET, file); + seek_and_time(5, SEEK_SET, file); + seek_and_time(1000, SEEK_SET, file); + seek_and_time(100, SEEK_SET, file); + seek_and_time(10000, SEEK_SET, file); + seek_and_time(-5, SEEK_CUR, file); + seek_and_time(-100, SEEK_CUR, file); + seek_and_time(100, SEEK_CUR, file); + seek_and_time(0, SEEK_END, file); + seek_and_time(-10000, SEEK_END, file); + + fclose(file); +} + +// 222: 5-7us +int testGetThreadId() { + uint32 time1 = PspRtc::instance().getMicros(); + int threadId = sceKernelGetThreadId(); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Getting thread ID %d took %dus\n", threadId, time2-time1); + + return threadId; +} + +// 222: 4-5us +void testGetPriority() { + uint32 time1 = PspRtc::instance().getMicros(); + int priority = sceKernelGetThreadCurrentPriority(); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Getting thread priority %d took %dus\n", priority, time2-time1); +} + +// 222: 9-10us +void testChangePriority(int id, int priority) { + uint32 time1 = PspRtc::instance().getMicros(); + sceKernelChangeThreadPriority(id, priority); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1); +} + +void test_thread() { + int id; + id = testGetThreadId(); + testGetThreadId(); + testGetPriority(); + testGetPriority(); + testChangePriority(id, 30); + testChangePriority(id, 35); + testChangePriority(id, 25); + + // test context switch time + for (int i=0; i<10; i++) { + uint time1 = PspRtc::instance().getMicros(); + PspThread::delayMicros(0); + uint time2 = PspRtc::instance().getMicros(); + PSP_INFO_PRINT("poll %d. context switch Time = %dus\n", i, time2-time1); // 10-15us + } +} + +int test_mem_read(uint32 words) { + uint32 __attribute__((aligned(64))) buffer[1024]; + register uint32 r = 0; + + // uncached + uint32 *pBuffer = (uint32 *)UNCACHED(buffer); + + uint32 time1 = PspRtc::instance().getMicros(); + + for (int i=0; i= 4 - - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue - copy8(dst, src, bytes); -#ifdef TEST_MEMORY_COPY - testCopy(debugDst, debugSrc, debugBytes); -#endif - return; - } - - while (prefixDst--) { - *dst++ = *src++; - } - } - - // check the source pointer alignment now - uint32 alignSrc = (((uint32)src) & 0x3); - - if (alignSrc) { // we'll need to realign our reads - copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); - } else { - copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); - } - -#ifdef TEST_MEMORY_COPY - testCopy(debugDst, debugSrc, debugBytes); -#endif -} - -void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { - - bool mismatch = false; - PSP_INFO_PRINT("testing memcpy..."); - - for (uint32 i = 0; i < debugBytes; i++) { - if (debugDst[i] != debugSrc[i]) { - if (mismatch == false) { - PSP_DEBUG_PRINT_SAMELN("**** mismatch in copy! ****\n"); - PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); - mismatch = true; - } - PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); - } - } - if (mismatch) { - PSP_DEBUG_PRINT("\n"); - } else { - PSP_INFO_PRINT("ok\n"); - } -} - -// -// used to swap red and blue -void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - - // align the destination pointer first - uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix - - if (prefixDst) { - bytes -= prefixDst; // remember we assume bytes > 4 - *dst16++ = *src16++; - - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { // check if it's worthwhile to continue - swap16(dst16, src16, bytes, format); - return; - } - } - - // check the source pointer alignment now - uint32 alignSrc = (((uint32)src16) & 0x3); - - if (alignSrc) { // we'll need to realign our reads - PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); - swap32Misaligned((uint32 *)dst16, (uint16 *)src16, bytes, format); - } else { - swap32Aligned((uint32 *)dst16, (uint32 *)src16, bytes, format); - } -} - -void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { - PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); - - int words8 = bytes >> 5; - - // try blocks of 8 words at a time - if (words8) { - while (words8--) { - dst32[0] = src32[0]; - dst32[1] = src32[1]; - dst32[2] = src32[2]; - dst32[3] = src32[3]; - dst32[4] = src32[4]; - dst32[5] = src32[5]; - dst32[6] = src32[6]; - dst32[7] = src32[7]; - dst32 += 8; - src32 += 8; - } - } - - int words4 = (bytes & 0x1F) >> 4; - - // try blocks of 4 words at a time - if (words4) { - dst32[0] = src32[0]; - dst32[1] = src32[1]; - dst32[2] = src32[2]; - dst32[3] = src32[3]; - dst32 += 4; - src32 += 4; - } - - int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above - int wordsLeft = bytesLeft >> 2; - - // now just do single words - while (wordsLeft) { - *dst32++ = *src32++; - wordsLeft--; - } - - bytesLeft = bytes & 0x3; // get remaining bytes - - PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); - - byte *dst = (byte *)dst32; - byte *src = (byte *)src32; - - while (bytesLeft--) { - *dst++ = *src++; - } -} - -void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - int words = bytes >> 2; - - // try blocks of 4 words at a time - for (; words - 4 >= 0; words -= 4) { - dst32[0] = format.swapRedBlue32(src32[0]); - dst32[1] = format.swapRedBlue32(src32[1]); - dst32[2] = format.swapRedBlue32(src32[2]); - dst32[3] = format.swapRedBlue32(src32[3]); - dst32 += 4; - src32 += 4; - } - - // now just do words - for (; words > 0; words--) { - *dst32++ = format.swapRedBlue32(*src32++); - } - - uint32 remainingBytes = bytes & 0x3; - - if (remainingBytes) { // for swap, must be a 16 bit value - *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); // only 1 short left - } -} - - -// More challenging -- need to shift -// Assume dst is aligned -void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { - PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); - - uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment - uint32 offset; - - switch (alignSrc) { - case 1: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); - break; - case 2: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); - break; - case 3: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); - break; - } - - uint32 remainingBytes = bytes & 3; - - if (remainingBytes) { - byte *dst = (byte *)dst32; - src += offset; - dst += offset; - copy8(dst, src, remainingBytes); - } -} - -// returns offset in dst -uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { - uint32 *origDst32 = dst32; - register uint32 dstWord, srcWord; - - PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], words[%d]\n", alignSrc, dst32, src32, words); - - // Try to do groups of 4 words - uint32 words4 = bytes >> 4; - - srcWord = src32[0]; - - while (words4--) { - dstWord = srcWord >> shiftValue; - srcWord = src32[1]; - dstWord |= srcWord << lastShiftValue; - dst32[0] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[2]; - dstWord |= srcWord << lastShiftValue; - dst32[1] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[3]; - dstWord |= srcWord << lastShiftValue; - dst32[2] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[4]; - dstWord |= srcWord << lastShiftValue; - dst32[3] = dstWord; - src32 += 4; - dst32 += 4; - } - - uint32 words = (bytes & 0xF) >> 2; - - // we read one word ahead of what we write - // setup the first read - if (words) { - srcWord = *src32++; - - while (words--) { - dstWord = srcWord >> shiftValue; - srcWord = *src32++; - dstWord |= srcWord << lastShiftValue; - *dst32++ = dstWord; - } - } - - return (byte *)dst32 - (byte *)origDst32; -} -// More challenging -- need to shift -// Assume dst is aligned -void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - if (bytes < MIN_AMOUNT_FOR_MISALIGNED_COPY) { // less than a certain number of bytes it's just not worth it - swap16((uint16 *)dst32, src16, bytes, format); - return; - } - - int words = bytes >> 2; - uint32 remainingBytes = bytes & 3; - - uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment - - // we read one word ahead of what we write - // setup the first read - uint32 lastWord = ((*src32++) >> 16) & 0xFFFF; - - for (; words; words--) { - uint32 srcWord = *src32++; - uint32 curWord = (srcWord >> 16) & 0xFFFF; - lastWord |= (srcWord & 0xFFFF) << 16; // take the part of the src that belongs to this word - *dst32++ = format.swapRedBlue32(lastWord); - lastWord = curWord; - } - - if (remainingBytes) { // add in the remaining stuff - *(uint16 *)dst32 = format.swapRedBlue16((uint16)lastWord); - } -} - -inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { - PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); - - uint32 shorts = bytes >> 1; - uint32 remainingBytes = bytes & 1; - - for (; shorts > 0 ; shorts--) { - *dst16++ = *src16++; - } - if (remainingBytes) - *(byte *)dst16 = *(byte *)src16; -} - -// Class VramAllocator ----------------------------------- - -DECLARE_SINGLETON(VramAllocator) - -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - - -void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { - DEBUG_ENTER_FUNC(); - assert(size > 0); - - byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; - Common::List::iterator i; - - // Find a block that fits, starting from the beginning - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - byte *currAddress = (*i).address; - - if (currAddress - lastAddress >= size) // We found a match - break; - - if ((*i).getEnd() > lastAddress) - lastAddress = (byte *)(*i).getEnd(); - } - - if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { - PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", - size, _bytesAllocated); - return NULL; - } - - _allocList.insert(i, Allocation(lastAddress, size)); - _bytesAllocated += size; - - PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); - PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - - return lastAddress; -} - -// Deallocate a block from VRAM -void VramAllocator::deallocate(void *address) { - DEBUG_ENTER_FUNC(); - address = (byte *)CACHED(address); // Make sure all addresses are the same - - Common::List::iterator i; - - // Find the Allocator to deallocate - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - if ((*i).address == address) { - _bytesAllocated -= (*i).size; - _allocList.erase(i); - PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); - return; - } - } - - PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); -} +/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include "common/singleton.h" +#include "common/list.h" +#include "backends/platform/psp/PSPPixelFormat.h" +#include "backends/platform/psp/memory.h" + +// Class Copier -------------------------------------------------------------------------- +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +//#define TEST_MEMORY_COPY + +extern "C" { + +void *__wrap_memcpy(void *dst, void *src, size_t bytes) { + PspMemory::fastCopy((byte *)dst, (byte *)src, bytes); + return dst; +} + +} + +void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const byte *debugDst = dst, *debugSrc = src; +#endif + + PSP_DEBUG_PRINT("copy(): dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst) & 0x3); + + if (prefixDst) { + prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0 + PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst); + + bytes -= prefixDst; // remember we assume bytes >= 4 + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + copy8(dst, src, bytes + prefixDst); +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif + return; + } + + while (prefixDst--) { + *dst++ = *src++; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); + } else { + copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); + } + +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif +} + +void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { + + bool mismatch = false; + PSP_INFO_PRINT("testing fastCopy..."); + + for (uint32 i = 0; i < debugBytes; i++) { + if (debugDst[i] != debugSrc[i]) { + if (!mismatch) { + PSP_INFO_PRINT("**** mismatch in copy! ****\n"); + PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_INFO_PRINT("[%d]%x!=%x ", i, debugSrc[i], debugDst[i]); + } + } + if (mismatch) { + PSP_INFO_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + +// +// used to swap red and blue +void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const uint16 *debugDst = dst16, *debugSrc = src16; +#endif + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix + + if (prefixDst) { + bytes -= prefixDst; // remember we assume bytes > 4 + *dst16++ = format.swapRedBlue16(*src16++); + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + swap16(dst16, src16, bytes, format); + +#ifdef TEST_MEMORY_COPY + testSwap(debugDst, debugSrc, debugBytes, format); +#endif + return; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src16) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); + swap32Misaligned((uint32 *)dst16, src16, bytes, format); + } else { + swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format); + } + +#ifdef TEST_MEMORY_COPY + testSwap(debugDst, debugSrc, debugBytes, format); +#endif + +} + +void PspMemory::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) { + + bool mismatch = false; + PSP_INFO_PRINT("testing fastSwap..."); + + uint32 shorts = debugBytes >> 1; + + for (uint32 i = 0; i < shorts; i++) { + if (debugDst[i] != format.swapRedBlue16(debugSrc[i])) { + if (!mismatch) { + PSP_INFO_PRINT("**** mismatch in swap! ****\n"); + PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_INFO_PRINT("[%d]%x!=%x ", i<<1, format.swapRedBlue16(debugSrc[i]), debugDst[i]); + } + } + if (mismatch) { + PSP_INFO_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + + +void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { + PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); + + int words8 = bytes >> 5; + + // try blocks of 8 words at a time + if (words8) { + while (words8--) { + uint32 a, b, c, d; + a = src32[0]; + b = src32[1]; + c = src32[2]; + d = src32[3]; + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + a = src32[4]; + b = src32[5]; + c = src32[6]; + d = src32[7]; + dst32[4] = a; + dst32[5] = b; + dst32[6] = c; + dst32[7] = d; + dst32 += 8; + src32 += 8; + } + } + + int words4 = (bytes & 0x1F) >> 4; + + // try blocks of 4 words at a time + if (words4) { + uint32 a, b, c, d; + a = src32[0]; + b = src32[1]; + c = src32[2]; + d = src32[3]; + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + dst32 += 4; + src32 += 4; + } + + int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above + int wordsLeft = bytesLeft >> 2; + + // now just do single words + while (wordsLeft) { + *dst32++ = *src32++; + wordsLeft--; + } + + bytesLeft = bytes & 0x3; // get remaining bytes + + PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); + + byte *dst = (byte *)dst32; + byte *src = (byte *)src32; + + while (bytesLeft--) { + *dst++ = *src++; + } +} + +void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + int words4 = bytes >> 4; + + // try blocks of 4 words at a time + while (words4--) { + uint32 a, b, c, d; + a = format.swapRedBlue32(src32[0]); + b = format.swapRedBlue32(src32[1]); + c = format.swapRedBlue32(src32[2]); + d = format.swapRedBlue32(src32[3]); + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + dst32 += 4; + src32 += 4; + } + + uint32 bytesLeft = bytes & 0xF; + uint32 words = bytesLeft >> 2; + + // now just do words + while (words--) { + *dst32++ = format.swapRedBlue32(*src32++); + } + + bytesLeft = bytes & 0x3; + + if (bytesLeft) { // for swap, can only be 1 short left + *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); + } +} + + +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { + PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); + + uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment + uint32 offset; + + switch (alignSrc) { + case 1: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); + break; + case 2: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); + break; + default: /* 3 */ + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); + break; + } + + uint32 remainingBytes = bytes & 3; + + if (remainingBytes) { + byte *dst = (byte *)dst32; + src += offset; + dst += offset; + copy8(dst, src, remainingBytes); + } +} + +// returns offset in dst +uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { + uint32 *origDst32 = dst32; + register uint32 dstWord, srcWord; + + PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], bytes[%d]\n", alignSrc, dst32, src32, bytes); + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + + srcWord = src32[0]; + + while (words4--) { + dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << lastShiftValue; + dst32[0] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << lastShiftValue; + dst32[1] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << lastShiftValue; + dst32[2] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << lastShiftValue; + dst32[3] = dstWord; + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + src32++; // we already loaded the value, so just increment + + while (words--) { + dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << lastShiftValue; + *dst32++ = dstWord; + } + } + + return (byte *)dst32 - (byte *)origDst32; +} + +// More challenging -- need to shift +// We assume dst is aligned +void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + + const uint32 shiftValue = 16; + uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + uint32 srcWord = src32[0]; // preload + + while (words4--) { + uint32 dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << shiftValue; + dst32[0] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << shiftValue; + dst32[1] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << shiftValue; + dst32[2] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << shiftValue; + dst32[3] = format.swapRedBlue32(dstWord); + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + //srcWord = *src32++; // don't need this. already loaded + src32++; // we already have the value loaded in + + while (words--) { + uint32 dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << shiftValue; + *dst32++ = format.swapRedBlue32(dstWord); + } + } + + uint32 bytesLeft = bytes & 3; + + if (bytesLeft) { // for swap, can only be 1 short left + *((uint16 *)dst32) = format.swapRedBlue16((uint16)(srcWord >> shiftValue)); + } +} + +inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { + PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + + uint32 shorts = bytes >> 1; + uint32 remainingBytes = bytes & 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = *src16++; + } + if (remainingBytes) + *(byte *)dst16 = *(byte *)src16; +} + +// Class VramAllocator ----------------------------------- + +DECLARE_SINGLETON(VramAllocator) + +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + + +void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { + DEBUG_ENTER_FUNC(); + assert(size > 0); + + byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; + Common::List::iterator i; + + // Find a block that fits, starting from the beginning + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + byte *currAddress = (*i).address; + + if (currAddress - lastAddress >= size) // We found a match + break; + + if ((*i).getEnd() > lastAddress) + lastAddress = (byte *)(*i).getEnd(); + } + + if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { + PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", + size, _bytesAllocated); + return NULL; + } + + _allocList.insert(i, Allocation(lastAddress, size)); + _bytesAllocated += size; + + PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); + PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); + + return lastAddress; +} + +// Deallocate a block from VRAM +void VramAllocator::deallocate(void *address) { + DEBUG_ENTER_FUNC(); + address = (byte *)CACHED(address); // Make sure all addresses are the same + + Common::List::iterator i; + + // Find the Allocator to deallocate + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + if ((*i).address == address) { + _bytesAllocated -= (*i).size; + _allocList.erase(i); + PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); + return; + } + } + + PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); +} diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index 81a77cca1c..c9b3d21cb6 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -1,131 +1,132 @@ - -/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#ifndef PSP_MEMORY_H -#define PSP_MEMORY_H - -#include "backends/platform/psp/psppixelformat.h" -#include "common/list.h" - -#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ -#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ - -#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 -#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 - -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - -/** - * Class that does memory copying and swapping if needed - */ -class PspMemory { -private: - static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); - static void copy(byte *dst, const byte *src, uint32 bytes); - static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); - static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); - static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); - static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); - static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); - static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); - static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); - - // For swapping, we know that we have multiples of 16 bits - static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); - uint32 shorts = bytes >> 1; - - for (; shorts > 0 ; shorts--) { - *dst16++ = format.swapRedBlue16(*src16++); - } - } - - static void copy8(byte *dst, const byte *src, uint32 bytes) { - PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); - while (bytes--) { - *dst++ = *src++; - } - } - -public: - // This is the interface to the outside world - static void fastCopy(byte *dst, const byte *src, uint32 bytes) { - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { - copy8(dst, src, bytes); - } else { // go to more powerful copy - copy(dst, src, bytes); - } - } - - static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { - swap16((uint16 *)dst, (uint16 *)src, bytes, format); - } else { // go to more powerful copy - swap((uint16 *)dst, (uint16 *)src, bytes, format); - } - } -}; - -/** - * Class that allocates memory in the VRAM - */ -class VramAllocator : public Common::Singleton { -public: - VramAllocator() : _bytesAllocated(0) {} - void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes - void deallocate(void *pointer); - - static inline bool isAddressInVram(void *address) { - if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) - return true; - return false; - } - - -private: - /** - * Used to allocate in VRAM - */ - struct Allocation { - byte *address; - uint32 size; - void *getEnd() { return address + size; } - Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} - Allocation() : address(0), size(0) {} - }; - - enum { - VRAM_START_ADDRESS = 0x04000000, - VRAM_END_ADDRESS = 0x04200000, - VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations - }; - Common::List _allocList; // List of allocations - uint32 _bytesAllocated; -}; - -#endif /* PSP_MEMORY_H */ + +/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#ifndef PSP_MEMORY_H +#define PSP_MEMORY_H + +#include "backends/platform/psp/psppixelformat.h" +#include "common/list.h" + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 +#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 + +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +/** + * Class that does memory copying and swapping if needed + */ +class PspMemory { +private: + static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); + static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format); + static void copy(byte *dst, const byte *src, uint32 bytes); + static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); + static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); + static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); + static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); + static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); + + // For swapping, we know that we have multiples of 16 bits + static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + uint32 shorts = bytes >> 1; + + while (shorts--) { + *dst16++ = format.swapRedBlue16(*src16++); + } + } + + static void copy8(byte *dst, const byte *src, uint32 bytes) { + PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + while (bytes--) { + *dst++ = *src++; + } + } + +public: + // This is the interface to the outside world + static void fastCopy(byte *dst, const byte *src, uint32 bytes) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { + copy8(dst, src, bytes); + } else { // go to more powerful copy + copy(dst, src, bytes); + } + } + + static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { + swap16((uint16 *)dst, (uint16 *)src, bytes, format); + } else { // go to more powerful copy + swap((uint16 *)dst, (uint16 *)src, bytes, format); + } + } +}; + +/** + * Class that allocates memory in the VRAM + */ +class VramAllocator : public Common::Singleton { +public: + VramAllocator() : _bytesAllocated(0) {} + void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes + void deallocate(void *pointer); + + static inline bool isAddressInVram(void *address) { + if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) + return true; + return false; + } + + +private: + /** + * Used to allocate in VRAM + */ + struct Allocation { + byte *address; + uint32 size; + void *getEnd() { return address + size; } + Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} + Allocation() : address(0), size(0) {} + }; + + enum { + VRAM_START_ADDRESS = 0x04000000, + VRAM_END_ADDRESS = 0x04200000, + VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations + }; + Common::List _allocList; // List of allocations + uint32 _bytesAllocated; +}; + +#endif /* PSP_MEMORY_H */ diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index b84702115f..dba9a8fc2b 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -44,15 +44,13 @@ #include "backends/plugins/psp/psp-provider.h" #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" -#include "backends/platform/psp/tests.h" +#include "backends/platform/psp/tests.h" /* for unit/speed tests */ #include "backends/platform/psp/trace.h" #ifdef ENABLE_PROFILING #include #endif -#define ENABLE_TESTS /* to enable tests of PSP architecture */ - /** * Define the module info section * @@ -156,7 +154,7 @@ int SetupCallbacks(void) { #undef main int main(void) { //change clock rate to 333mhz - scePowerSetClockFrequency(222, 222, 111); + scePowerSetClockFrequency(333, 333, 166); PowerManager::instance(); // Setup power manager @@ -172,10 +170,11 @@ int main(void) { PluginManager::instance().addPluginProvider(new PSPPluginProvider()); #endif -#ifdef ENABLE_TESTS +/* unit/speed tests */ +#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) PSP_INFO_PRINT("running tests\n"); - tests(); - sceKernelSleepThread(); + psp_tests(); + sceKernelSleepThread(); // that's it. That's all we're doing #endif int res = scummvm_main(argc, argv); diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp index 25c07fd723..d1bdb9e640 100644 --- a/backends/platform/psp/tests.cpp +++ b/backends/platform/psp/tests.cpp @@ -23,6 +23,13 @@ * */ +// PSP speed and unit tests. Activate in tests.h +// You may also want to build without any engines. + +#include "backends/platform/psp/tests.h" + +#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) + #include "common/scummsys.h" #include #include @@ -51,7 +58,36 @@ #include "backends/platform/psp/trace.h" -void test_ticks() { +class PspSpeedTests { +public: + void tickSpeed(); + void getMicrosSpeed(); + void seekSpeed(); + void msReadSpeed(); + void threadFunctionsSpeed(); + void semaphoreSpeed(); + static int threadFunc(SceSize args, void *argp); + void semaphoreManyThreadSpeed(); + void fastCopySpeed(); + +private: + enum { + MEMCPY_BUFFER_SIZE = 8192 + }; + static PspSemaphore _sem; // semaphore + + void readAndTime(uint32 bytes, char *buffer, FILE *file); + void seekAndTime(int bytes, int origin, FILE *file); + void fastCopySpecificSize(byte *dst, byte *src, uint32 bytes); + void fastCopyDifferentSizes(byte *dst, byte *src); + int getThreadIdSpeed(); + void getPrioritySpeed(); + void changePrioritySpeed(int id, int priority); +}; + +PspSemaphore PspSpeedTests::_sem(0); + +void PspSpeedTests::tickSpeed() { uint32 ticksPerSecond = sceRtcGetTickResolution(); PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond); @@ -75,7 +111,7 @@ void test_ticks() { PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds); } -void test_getMicros() { +void PspSpeedTests::getMicrosSpeed() { uint32 time1, time2, time3, time4; time1 = PspRtc::instance().getMicros(); time2 = PspRtc::instance().getMicros(); @@ -85,7 +121,7 @@ void test_getMicros() { PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1); } -void read_and_time(uint32 bytes, char *buffer, FILE *file) { +void PspSpeedTests::readAndTime(uint32 bytes, char *buffer, FILE *file) { uint32 time1 = PspRtc::instance().getMicros(); // test minimal read fread(buffer, bytes, 1, file); @@ -101,18 +137,8 @@ void read_and_time(uint32 bytes, char *buffer, FILE *file) { Reading 50 byte takes 8us / 11 Reading 100 byte takes 8us / 11 Reading 1000 byte takes 915us / 1131 - Reading 1000 byte takes 911us - Reading 1000 byte takes 914us - Reading 1000 byte takes 943us - Reading 1000 byte takes 915us - Reading 1000 byte takes 923us - Reading 1000 byte takes 22us - Reading 1000 byte takes 916us - Reading 1000 byte takes 913us / 1,120 - Reading 1000 byte takes 909us / 1,122 Reading 2000 byte takes 1806us / 2,284 Reading 3000 byte takes 2697us / 3,374 - Reading 4000 byte takes 3652us / 4,592 Reading 5000 byte takes 4551us / 5,544 Reading 6000 byte takes 5356us / 6,676 Reading 7000 byte takes 6800us / 8,358 @@ -120,47 +146,40 @@ void read_and_time(uint32 bytes, char *buffer, FILE *file) { Reading 9000 byte takes 6782us / 8,563 Reading 10000 byte takes 8497us / 10,631 Reading 30000 byte takes 25995us / 32,473 - Reading 50000 byte takes 42467us / 52,893 Reading 80000 byte takes 68457us / 85,291 Reading 100000 byte takes 85103us / 106,163 - Reading 500000 byte takes 427337us / 531,679 - Reading 1000000 byte takes 854831us / 1,063,107 */ // Function to test the impact of MS reads // These tests can't be done from shell - the cache screws them up -void test_ms_reads() { +void PspSpeedTests::msReadSpeed() { FILE *file; file = fopen("ms0:/psp/music/track1.mp3", "r"); char *buffer = (char *)malloc(2 * 1024 * 1024); - read_and_time(1, buffer, file); - read_and_time(10, buffer, file); - read_and_time(50, buffer, file); - read_and_time(100, buffer, file); - for (int i = 0; i< 10; i++) - read_and_time(1000, buffer, file); - read_and_time(2000, buffer, file); - read_and_time(3000, buffer, file); - read_and_time(4000, buffer, file); - read_and_time(5000, buffer, file); - read_and_time(6000, buffer, file); - read_and_time(7000, buffer, file); - read_and_time(8000, buffer, file); - read_and_time(9000, buffer, file); - read_and_time(10000, buffer, file); - read_and_time(30000, buffer, file); - read_and_time(50000, buffer, file); - read_and_time(80000, buffer, file); - read_and_time(100000, buffer, file); - read_and_time(500000, buffer, file); - read_and_time(1000000, buffer, file); + readAndTime(1, buffer, file); + readAndTime(10, buffer, file); + readAndTime(50, buffer, file); + readAndTime(100, buffer, file); + readAndTime(1000, buffer, file); + readAndTime(2000, buffer, file); + readAndTime(3000, buffer, file); + readAndTime(5000, buffer, file); + readAndTime(6000, buffer, file); + readAndTime(7000, buffer, file); + readAndTime(8000, buffer, file); + readAndTime(9000, buffer, file); + readAndTime(10000, buffer, file); + readAndTime(30000, buffer, file); + readAndTime(50000, buffer, file); + readAndTime(80000, buffer, file); + readAndTime(100000, buffer, file); fclose(file); free(buffer); } -void seek_and_time(int bytes, int origin, FILE *file) { +void PspSpeedTests::seekAndTime(int bytes, int origin, FILE *file) { char buffer[1000]; uint32 time1 = PspRtc::instance().getMicros(); @@ -202,26 +221,26 @@ Seeking 10000 byte from 2 took 3636us Reading 1000 bytes took 110us */ -void test_seeks() { +void PspSpeedTests::seekSpeed() { FILE *file; file = fopen("ms0:/psp/music/track1.mp3", "r"); - seek_and_time(0, SEEK_SET, file); - seek_and_time(5, SEEK_SET, file); - seek_and_time(1000, SEEK_SET, file); - seek_and_time(100, SEEK_SET, file); - seek_and_time(10000, SEEK_SET, file); - seek_and_time(-5, SEEK_CUR, file); - seek_and_time(-100, SEEK_CUR, file); - seek_and_time(100, SEEK_CUR, file); - seek_and_time(0, SEEK_END, file); - seek_and_time(-10000, SEEK_END, file); + seekAndTime(0, SEEK_SET, file); + seekAndTime(5, SEEK_SET, file); + seekAndTime(1000, SEEK_SET, file); + seekAndTime(100, SEEK_SET, file); + seekAndTime(10000, SEEK_SET, file); + seekAndTime(-5, SEEK_CUR, file); + seekAndTime(-100, SEEK_CUR, file); + seekAndTime(100, SEEK_CUR, file); + seekAndTime(0, SEEK_END, file); + seekAndTime(-10000, SEEK_END, file); fclose(file); } // 222: 5-7us -int testGetThreadId() { +int PspSpeedTests::getThreadIdSpeed() { uint32 time1 = PspRtc::instance().getMicros(); int threadId = sceKernelGetThreadId(); uint32 time2 = PspRtc::instance().getMicros(); @@ -232,7 +251,7 @@ int testGetThreadId() { } // 222: 4-5us -void testGetPriority() { +void PspSpeedTests::getPrioritySpeed() { uint32 time1 = PspRtc::instance().getMicros(); int priority = sceKernelGetThreadCurrentPriority(); uint32 time2 = PspRtc::instance().getMicros(); @@ -241,7 +260,7 @@ void testGetPriority() { } // 222: 9-10us -void testChangePriority(int id, int priority) { +void PspSpeedTests::changePrioritySpeed(int id, int priority) { uint32 time1 = PspRtc::instance().getMicros(); sceKernelChangeThreadPriority(id, priority); uint32 time2 = PspRtc::instance().getMicros(); @@ -249,15 +268,16 @@ void testChangePriority(int id, int priority) { PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1); } -void test_thread() { +void PspSpeedTests::threadFunctionsSpeed() { + // very unscientific -- just ballpark int id; - id = testGetThreadId(); - testGetThreadId(); - testGetPriority(); - testGetPriority(); - testChangePriority(id, 30); - testChangePriority(id, 35); - testChangePriority(id, 25); + id = getThreadIdSpeed(); + getThreadIdSpeed(); + getPrioritySpeed(); + getPrioritySpeed(); + changePrioritySpeed(id, 30); + changePrioritySpeed(id, 35); + changePrioritySpeed(id, 25); // test context switch time for (int i=0; i<10; i++) { @@ -268,118 +288,12 @@ void test_thread() { } } -int test_mem_read(uint32 words) { - uint32 __attribute__((aligned(64))) buffer[1024]; - register uint32 r = 0; +void PspSpeedTests::semaphoreSpeed() { + PspSemaphore sem(1); - // uncached - uint32 *pBuffer = (uint32 *)UNCACHED(buffer); - uint32 time1 = PspRtc::instance().getMicros(); - for (int i=0; i= 0) - break; + if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { + // subscribe to MIDI port + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { + error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); } - - if (i >= ARRAYSIZE(defaultPorts)) - error("Can't subscribe to MIDI port (65:0) or (17:0)"); } printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port); @@ -230,24 +197,6 @@ void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) { send_event(1); } -int MidiDriver_ALSA::parse_addr(const char *arg, int *client, int *port) { - const char *p; - - if (isdigit(*arg)) { - if ((p = strpbrk(arg, ADDR_DELIM)) == NULL) - return -1; - *client = atoi(arg); - *port = atoi(p + 1); - } else { - if (*arg == 's' || *arg == 'S') { - *client = SND_SEQ_ADDRESS_SUBSCRIBERS; - *port = 0; - } else - return -1; - } - return 0; -} - void MidiDriver_ALSA::send_event(int do_flush) { snd_seq_ev_set_direct(&ev); snd_seq_ev_set_source(&ev, my_port); @@ -261,6 +210,43 @@ void MidiDriver_ALSA::send_event(int do_flush) { // Plugin interface +class AlsaDevice { +public: + AlsaDevice(Common::String name, MusicType mt, int client, int port); + Common::String getName(); + MusicType getType(); + int getClient(); + int getPort(); + +private: + Common::String _name; + MusicType _type; + int _client; + int _port; +}; + +typedef Common::List AlsaDevices; + +AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client, int port) + : _name(name), _type(mt), _client(client), _port(port) { +} + +Common::String AlsaDevice::getName() { + return _name; +} + +MusicType AlsaDevice::getType() { + return _type; +} + +int AlsaDevice::getClient() { + return _client; +} + +int AlsaDevice::getPort() { + return _port; +} + class AlsaMusicPlugin : public MusicPluginObject { public: const char *getName() const { @@ -271,8 +257,12 @@ public: return "alsa"; } + AlsaDevices getAlsaDevices() const; MusicDevices getDevices() const; Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; + +private: + static int parse_addr(const char *arg, int *client, int *port); }; #define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) @@ -286,11 +276,10 @@ static int check_permission(snd_seq_port_info_t *pinfo) return 0; } -MusicDevices AlsaMusicPlugin::getDevices() const { - MusicDevices devices; - - snd_seq_t *seq; - if (my_snd_seq_open(&seq) < 0) +AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { + AlsaDevices devices; + snd_seq_t *seq_handle; + if (my_snd_seq_open(&seq_handle) < 0) return devices; // can't open sequencer snd_seq_client_info_t *cinfo; @@ -298,32 +287,154 @@ MusicDevices AlsaMusicPlugin::getDevices() const { snd_seq_port_info_t *pinfo; snd_seq_port_info_alloca(&pinfo); snd_seq_client_info_set_client(cinfo, -1); - while (snd_seq_query_next_client(seq, cinfo) >= 0) { + while (snd_seq_query_next_client(seq_handle, cinfo) >= 0) { bool found_valid_port = false; /* reset query info */ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); snd_seq_port_info_set_port(pinfo, -1); - while (!found_valid_port && snd_seq_query_next_port(seq, pinfo) >= 0) { + while (!found_valid_port && snd_seq_query_next_port(seq_handle, pinfo) >= 0) { if (check_permission(pinfo)) { found_valid_port = true; - // TODO: Return a different music type depending on the configuration - devices.push_back(MusicDevice(this, snd_seq_client_info_get_name(cinfo), MT_GM)); - //snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo) + + const char *name = snd_seq_client_info_get_name(cinfo); + // TODO: Can we figure out the appropriate music type? + MusicType type = MT_GM; + int client = snd_seq_client_info_get_client(cinfo); + int port = snd_seq_port_info_get_port(pinfo); + + devices.push_back(AlsaDevice(name, type, client, port)); } } } - snd_seq_close(seq); + snd_seq_close(seq_handle); return devices; } -Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_ALSA(); +MusicDevices AlsaMusicPlugin::getDevices() const { + MusicDevices devices; + Common::Array used; + AlsaDevices::iterator d; + int i; + + AlsaDevices alsaDevices = getAlsaDevices(); + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + used.push_back(false); + } + + // Since the default behaviour is to use the first device in the list, + // try to put something sensible there. We used to have 17:0 and 65:0 + // as defaults. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + int client = d->getClient(); + if (client == 17 || client == 65) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + used[i] = true; + } + } + + // 128:0 is probably TiMidity, or something like that, so that's + // probably a good second choice. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + if (d->getClient() == 128) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + used[i] = true; + } + } + + // Add the remaining devices in the order they were found. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + + if (!used[i]) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + } + } + + return devices; +} + +Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle dev) const { + bool found = false; + int seq_client, seq_port; + + const char *var = NULL; + + // TODO: Upgrade from old alsa_port setting. This probably isn't the + // right place to do that, though. + + if (ConfMan.hasKey("alsa_port")) { + warning("AlsaMusicPlugin: Found old 'alsa_port' setting, which will be ignored"); + } + + // The SCUMMVM_PORT environment variable can still be used to override + // any config setting. + + var = getenv("SCUMMVM_PORT"); + if (var) { + warning("AlsaMusicPlugin: SCUMMVM_PORT environment variable overrides config settings"); + if (parse_addr(var, &seq_client, &seq_port) >= 0) { + found = true; + } else { + warning("AlsaMusicPlugin: Invalid port %s, using config settings instead", var); + } + } + + // Try to match the setting to an available ALSA device. + + if (!found && dev) { + AlsaDevices alsaDevices = getAlsaDevices(); + + for (AlsaDevices::iterator d = alsaDevices.begin(); d != alsaDevices.end(); ++d) { + MusicDevice device(this, d->getName(), d->getType()); + + if (device.getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) { + found = true; + seq_client = d->getClient(); + seq_port = d->getPort(); + break; + } + } + } + + // Still nothing? Try a sensible default. + + if (!found) { + // TODO: What's a sensible default anyway? And exactly when do + // we get to this case? + + warning("AlsaMusicPlugin: Using 17:0 as default ALSA port"); + seq_client = 17; + seq_port = 0; + } + + *mididriver = new MidiDriver_ALSA(seq_client, seq_port); return Common::kNoError; } +int AlsaMusicPlugin::parse_addr(const char *arg, int *client, int *port) { + const char *p; + + if (isdigit(*arg)) { + if ((p = strpbrk(arg, ADDR_DELIM)) == NULL) + return -1; + *client = atoi(arg); + *port = atoi(p + 1); + } else { + if (*arg == 's' || *arg == 'S') { + *client = SND_SEQ_ADDRESS_SUBSCRIBERS; + *port = 0; + } else + return -1; + } + return 0; +} + //#if PLUGIN_ENABLED_DYNAMIC(ALSA) //REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin); //#else -- cgit v1.2.3 From 211fcfe7bab49ceeb5e81f4dcb1be7e73c58d7c9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Jul 2010 08:24:34 +0000 Subject: MIDI: Build and use ALSA driver if and only if USE_ALSA is defined svn-id: r51053 --- backends/midi/alsa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 076655bfed..a895ef8b80 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -24,7 +24,7 @@ #include "common/scummsys.h" -#if defined(UNIX) && defined(USE_ALSA) +#if defined(USE_ALSA) #include "common/config-manager.h" #include "common/util.h" -- cgit v1.2.3 From 37aa8a7499e6aa1698beb7e241c42ba19475a83a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Jul 2010 08:25:13 +0000 Subject: BUILD: Unify adding -DUNIX to DEFINES; complete SEQ MIDI detection * Added a yes/no variable _unix to configure, which controls when -DUNIX is added to DEFINES * Enable SEQ MIDI via _seq_midi by default on UNIX type systems, except for those which override that. * Switch SEQ MIDI code to check #define USE_SEQ_MIDI (alternatively, we could compile it only conditionally...) svn-id: r51055 --- backends/midi/seq.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index b1815adee5..06685df59a 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -28,7 +28,7 @@ * both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html) */ -#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__) +#if defined(USE_SEQ_MIDI) #include "common/util.h" #include "sound/musicplugin.h" -- cgit v1.2.3 From 5b3f31feec43db358c1ad9bb38a7e602b5a90bb0 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 20 Jul 2010 08:56:53 +0000 Subject: General: Fixed building the SEQ MIDI driver An #include was missing, causing the driver to never be built. Also fixed what looked like a cut-and-paste error in generating the features string. svn-id: r51056 --- backends/midi/seq.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends') diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 06685df59a..e3d2c35b39 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -28,6 +28,8 @@ * both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html) */ +#include "common/scummsys.h" + #if defined(USE_SEQ_MIDI) #include "common/util.h" -- cgit v1.2.3 From 7b485a797884dc24ddcde990dba450ca610875d9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Jul 2010 12:09:54 +0000 Subject: GP2XWIZ: Fix warning svn-id: r51203 --- backends/platform/gp2xwiz/gp2xwiz-graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp index 6abddd52f3..f6ad226d42 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp @@ -138,7 +138,7 @@ bool OSystem_GP2XWIZ::loadGFXMode() { if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) _videoMode.aspectRatioCorrection = false; - OSystem_SDL::loadGFXMode(); + return OSystem_SDL::loadGFXMode(); } void OSystem_GP2XWIZ::drawMouse() { -- cgit v1.2.3 From b3f08d183b5fdafa850dc87401fc74d71476ef5d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 Jul 2010 16:38:31 +0000 Subject: SDL: Fix bug #3025258 Bug #3025258: "Cursor Leaves Trail in GUI when Screen is Shaking". Based on patch provided by eriktorbjorn but extended with another edge case. svn-id: r51212 --- backends/platform/sdl/graphics.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 35c5b57db6..a97a153f3c 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -783,7 +783,8 @@ void OSystem_SDL::internUpdateScreen() { #endif // If the shake position changed, fill the dirty area with blackness - if (_currentShakePos != _newShakePos) { + if (_currentShakePos != _newShakePos || + (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) { SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; if (_videoMode.aspectRatioCorrection && !_overlayVisible) @@ -1681,7 +1682,7 @@ void OSystem_SDL::undrawMouse() { return; if (_mouseBackup.w != 0 && _mouseBackup.h != 0) - addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); + addDirtyRect(x, y - _currentShakePos, _mouseBackup.w, _mouseBackup.h); } void OSystem_SDL::drawMouse() { -- cgit v1.2.3 From d508ba67663c3150d2c7052cf568234e8739bdfb Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 27 Jul 2010 11:16:44 +0000 Subject: Remove Android themeengine patch - an improved version is now part of the main ScummVM codebase thanks to fingolfin :) svn-id: r51362 --- backends/platform/android/README.build | 4 - .../android/scummvm-android-themeengine.patch | 135 --------------------- 2 files changed, 139 deletions(-) delete mode 100644 backends/platform/android/scummvm-android-themeengine.patch (limited to 'backends') diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build index 3d1cf433a7..1c407bd469 100644 --- a/backends/platform/android/README.build +++ b/backends/platform/android/README.build @@ -67,10 +67,6 @@ toolchains around. Building ScummVM ================ -Apply the theme engine patch: - - patch -p1 < backends/platform/android/scummvm-android-themeengine.patch - (Optionally) compress scummmodern.zip: (ScummVM usually ships it uncompressed, but Android can read it more efficiently if it is compressed *before* adding it to the apk) diff --git a/backends/platform/android/scummvm-android-themeengine.patch b/backends/platform/android/scummvm-android-themeengine.patch deleted file mode 100644 index 1eafe7fb62..0000000000 --- a/backends/platform/android/scummvm-android-themeengine.patch +++ /dev/null @@ -1,135 +0,0 @@ -diff -r 884e66fd1b9c gui/ThemeEngine.cpp ---- a/gui/ThemeEngine.cpp Tue Apr 13 09:30:52 2010 +1000 -+++ b/gui/ThemeEngine.cpp Fri May 28 23:24:43 2010 +1000 -@@ -390,21 +390,19 @@ - - // Try to create a Common::Archive with the files of the theme. - if (!_themeArchive && !_themeFile.empty()) { -- Common::FSNode node(_themeFile); -- if (node.getName().hasSuffix(".zip") && !node.isDirectory()) { -+ Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile); -+ if (member && member->getName().hasSuffix(".zip")) { - #ifdef USE_ZLIB -- Common::Archive *zipArchive = Common::makeZipArchive(node); -+ Common::Archive *zipArchive = Common::makeZipArchive(member->createReadStream()); - - if (!zipArchive) { -- warning("Failed to open Zip archive '%s'.", node.getPath().c_str()); -+ warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str()); - } - _themeArchive = zipArchive; - #else - warning("Trying to load theme '%s' in a Zip archive without zLib support", _themeFile.c_str()); - return false; - #endif -- } else if (node.isDirectory()) { -- _themeArchive = new Common::FSDirectory(node); - } - } - -@@ -1436,6 +1434,30 @@ - return tok.empty(); - } - -+bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName) { -+ Common::File stream; -+ bool foundHeader = false; -+ -+ if (member.getName().hasSuffix(".zip")) { -+#ifdef USE_ZLIB -+ Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream()); -+ -+ if (zipArchive && zipArchive->hasFile("THEMERC")) { -+ stream.open("THEMERC", *zipArchive); -+ } -+ -+ delete zipArchive; -+#endif -+ } -+ -+ if (stream.isOpen()) { -+ Common::String stxHeader = stream.readLine(); -+ foundHeader = themeConfigParseHeader(stxHeader, themeName); -+ } -+ -+ return foundHeader; -+} -+ - bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &themeName) { - Common::File stream; - bool foundHeader = false; -@@ -1493,10 +1515,6 @@ - if (ConfMan.hasKey("themepath")) - listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list); - --#ifdef DATA_PATH -- listUsableThemes(Common::FSNode(DATA_PATH), list); --#endif -- - #if defined(MACOSX) || defined(IPHONE) - CFURLRef resourceUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); - if (resourceUrl) { -@@ -1509,10 +1527,7 @@ - } - #endif - -- if (ConfMan.hasKey("extrapath")) -- listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list); -- -- listUsableThemes(Common::FSNode("."), list, 1); -+ listUsableThemes(SearchMan, list); - - // Now we need to strip all duplicates - // TODO: It might not be the best idea to strip duplicates. The user might -@@ -1531,6 +1546,34 @@ - output.clear(); - } - -+void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List &list) { -+ ThemeDescriptor td; -+ -+#ifdef USE_ZLIB -+ Common::ArchiveMemberList fileList; -+ archive.listMatchingMembers(fileList, "*.zip"); -+ for (Common::ArchiveMemberList::iterator i = fileList.begin(); -+ i != fileList.end(); ++i) { -+ td.name.clear(); -+ if (themeConfigUsable(**i, td.name)) { -+ td.filename = (*i)->getName(); -+ td.id = (*i)->getDisplayName(); -+ -+ // If the name of the node object also contains -+ // the ".zip" suffix, we will strip it. -+ if (td.id.hasSuffix(".zip")) { -+ for (int j = 0; j < 4; ++j) -+ td.id.deleteLastChar(); -+ } -+ -+ list.push_back(td); -+ } -+ } -+ -+ fileList.clear(); -+#endif -+} -+ - void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List &list, int depth) { - if (!node.exists() || !node.isReadable() || !node.isDirectory()) - return; -diff -r 884e66fd1b9c gui/ThemeEngine.h ---- a/gui/ThemeEngine.h Tue Apr 13 09:30:52 2010 +1000 -+++ b/gui/ThemeEngine.h Fri May 28 23:24:43 2010 +1000 -@@ -560,11 +560,13 @@ - static void listUsableThemes(Common::List &list); - private: - static bool themeConfigUsable(const Common::FSNode &node, Common::String &themeName); -+ static bool themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName); - static bool themeConfigParseHeader(Common::String header, Common::String &themeName); - - static Common::String getThemeFile(const Common::String &id); - static Common::String getThemeId(const Common::String &filename); - static void listUsableThemes(const Common::FSNode &node, Common::List &list, int depth = -1); -+ static void listUsableThemes(Common::Archive &archive, Common::List &list); - - protected: - OSystem *_system; /** Global system object. */ -- cgit v1.2.3 From 2db4e71b6693f47f2fc48c78e8cff5e570c1f8d1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 Jul 2010 13:01:10 +0000 Subject: ALSA: Simplify device querying code. Thanks to eriktorbjorn for some quick testing. svn-id: r51366 --- backends/midi/alsa.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index a895ef8b80..1f7f7d2ba3 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -314,46 +314,41 @@ AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { MusicDevices AlsaMusicPlugin::getDevices() const { MusicDevices devices; - Common::Array used; AlsaDevices::iterator d; - int i; AlsaDevices alsaDevices = getAlsaDevices(); - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - used.push_back(false); - } - // Since the default behaviour is to use the first device in the list, // try to put something sensible there. We used to have 17:0 and 65:0 // as defaults. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - int client = d->getClient(); + for (d = alsaDevices.begin(); d != alsaDevices.end();) { + const int client = d->getClient(); + if (client == 17 || client == 65) { devices.push_back(MusicDevice(this, d->getName(), d->getType())); - used[i] = true; + d = alsaDevices.erase(d); + } else { + ++d; } } // 128:0 is probably TiMidity, or something like that, so that's // probably a good second choice. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + for (d = alsaDevices.begin(); d != alsaDevices.end();) { if (d->getClient() == 128) { devices.push_back(MusicDevice(this, d->getName(), d->getType())); - used[i] = true; + d = alsaDevices.erase(d); + } else { + ++d; } } // Add the remaining devices in the order they were found. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - - if (!used[i]) { - devices.push_back(MusicDevice(this, d->getName(), d->getType())); - } - } + for (d = alsaDevices.begin(); d != alsaDevices.end(); ++d) + devices.push_back(MusicDevice(this, d->getName(), d->getType())); return devices; } -- cgit v1.2.3 From 47f93e9d07e64b8746d9008afb1234744e095914 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 27 Jul 2010 16:35:28 +0000 Subject: ALSA: Tweak capability and type flags for the MIDI port This keeps ScummVM's own port from being included in the list of available MIDI devices. svn-id: r51378 --- backends/midi/alsa.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 1f7f7d2ba3..2b36cdc3cf 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -93,9 +93,14 @@ int MidiDriver_ALSA::open() { } snd_seq_set_client_group(seq_handle, "input"); - my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0", - SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE | - SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_MIDI_GENERIC); + // According to http://www.alsa-project.org/~tiwai/alsa-subs.html + // you can set read or write capabilities to allow other clients to + // read or write the port. I don't think we need that, unless maybe + // to be able to record the sound, but I can't get that to work even + // with those capabilities. + + my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0", 0, + SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION); if (my_port < 0) { snd_seq_close(seq_handle); -- cgit v1.2.3 From bbd3f0dbb3f76417237882ae8dfe5acfab73b50b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 27 Jul 2010 17:18:02 +0000 Subject: ALSA: Be more intelligent when picking MIDI port Often, a client has more than one available port. Pick the first one that isn't already in use. For instance, on my computer client 17 is the "Emu10k1 WaveTable", and it has four available ports. If, say, aplaymidi is already playing on port 17:0, ScummVM will use port 17:1 instead. Otherwise the two programs will mess up each others instruments and controller settings. Of course, in reality I doubt that anyone will run two different MIDI playing applications at once. svn-id: r51380 --- backends/midi/alsa.cpp | 76 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 25 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 2b36cdc3cf..4f73d7384b 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -48,6 +48,17 @@ #define my_snd_seq_open(seqp) snd_seq_open(seqp, SND_SEQ_OPEN) #endif +#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) + +static int check_permission(snd_seq_port_info_t *pinfo) +{ + if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) { + if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)) + return 1; + } + return 0; +} + /* * parse address string */ @@ -109,7 +120,41 @@ int MidiDriver_ALSA::open() { } if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { - // subscribe to MIDI port + // Subscribe to MIDI port. Prefer one that doesn't already have + // any connections, unless we've forced a port number already. + if (seq_port == -1) { + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + snd_seq_get_any_client_info(seq_handle, seq_client, cinfo); + + int first_port = -1; + int found_port = -1; + + snd_seq_port_info_set_client(pinfo, seq_client); + snd_seq_port_info_set_port(pinfo, -1); + while (found_port == -1 && snd_seq_query_next_port(seq_handle, pinfo) >= 0) { + if (check_permission(pinfo)) { + if (first_port == -1) + first_port = snd_seq_port_info_get_port(pinfo); + if (found_port == -1 && snd_seq_port_info_get_write_use(pinfo) == 0) + found_port = snd_seq_port_info_get_port(pinfo); + } + } + + if (found_port == -1) { + // Should we abort here? For now, use the first + // available port. + seq_port = first_port; + warning("MidiDriver_ALSA: All ports on client %d (%s) are already in use", seq_client, snd_seq_client_info_get_name(cinfo)); + } else { + seq_port = found_port; + } + } + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); } @@ -217,23 +262,21 @@ void MidiDriver_ALSA::send_event(int do_flush) { class AlsaDevice { public: - AlsaDevice(Common::String name, MusicType mt, int client, int port); + AlsaDevice(Common::String name, MusicType mt, int client); Common::String getName(); MusicType getType(); int getClient(); - int getPort(); private: Common::String _name; MusicType _type; int _client; - int _port; }; typedef Common::List AlsaDevices; -AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client, int port) - : _name(name), _type(mt), _client(client), _port(port) { +AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client) + : _name(name), _type(mt), _client(client) { } Common::String AlsaDevice::getName() { @@ -248,10 +291,6 @@ int AlsaDevice::getClient() { return _client; } -int AlsaDevice::getPort() { - return _port; -} - class AlsaMusicPlugin : public MusicPluginObject { public: const char *getName() const { @@ -270,17 +309,6 @@ private: static int parse_addr(const char *arg, int *client, int *port); }; -#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) - -static int check_permission(snd_seq_port_info_t *pinfo) -{ - if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) { - if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)) - return 1; - } - return 0; -} - AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { AlsaDevices devices; snd_seq_t *seq_handle; @@ -306,9 +334,7 @@ AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { // TODO: Can we figure out the appropriate music type? MusicType type = MT_GM; int client = snd_seq_client_info_get_client(cinfo); - int port = snd_seq_port_info_get_port(pinfo); - - devices.push_back(AlsaDevice(name, type, client, port)); + devices.push_back(AlsaDevice(name, type, client)); } } } @@ -395,7 +421,7 @@ Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDrive if (device.getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) { found = true; seq_client = d->getClient(); - seq_port = d->getPort(); + seq_port = -1; break; } } -- cgit v1.2.3 From 264d17ccc7644440d4cd3dc64e14f3e0bd431fd4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:02:14 +0000 Subject: BUILD: Compile & link certain files only for specific BACKEND values svn-id: r51465 --- backends/module.mk | 47 +++++++++++++++++++++++++++++--------- backends/platform/dc/Makefile | 2 ++ backends/platform/ds/arm9/makefile | 2 ++ backends/platform/ds/module.mk | 1 - backends/platform/n64/Makefile | 2 ++ backends/platform/ps2/Makefile.gdb | 2 ++ backends/platform/ps2/Makefile.ps2 | 2 ++ backends/platform/psp/Makefile | 3 ++- 8 files changed, 48 insertions(+), 13 deletions(-) (limited to 'backends') diff --git a/backends/module.mk b/backends/module.mk index fb48f3d249..e0a3f4c683 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -6,16 +6,9 @@ MODULE_OBJS := \ fs/abstract-fs.o \ fs/stdiostream.o \ fs/amigaos4/amigaos4-fs-factory.o \ - fs/ds/ds-fs-factory.o \ fs/posix/posix-fs-factory.o \ - fs/ps2/ps2-fs-factory.o \ - fs/psp/psp-fs-factory.o \ - fs/psp/psp-stream.o \ fs/symbian/symbian-fs-factory.o \ fs/windows/windows-fs-factory.o \ - fs/wii/wii-fs-factory.o \ - fs/n64/n64-fs-factory.o \ - fs/n64/romfsstream.o \ keymapper/action.o \ keymapper/keymap.o \ keymapper/keymapper.o \ @@ -29,22 +22,54 @@ MODULE_OBJS := \ midi/timidity.o \ midi/dmedia.o \ midi/windows.o \ - plugins/dc/dc-provider.o \ plugins/posix/posix-provider.o \ plugins/sdl/sdl-provider.o \ plugins/win32/win32-provider.o \ - plugins/psp/psp-provider.o \ saves/savefile.o \ saves/default/default-saves.o \ saves/posix/posix-saves.o \ - saves/psp/psp-saves.o \ timer/default/default-timer.o \ - timer/psp/timer.o \ vkeybd/image-map.o \ vkeybd/polygon.o \ vkeybd/virtual-keyboard.o \ vkeybd/virtual-keyboard-gui.o \ vkeybd/virtual-keyboard-parser.o +ifeq ($(BACKEND),dc) +MODULE_OBJS += \ + plugins/dc/dc-provider.o +endif + +ifeq ($(BACKEND),ds) +MODULE_OBJS += \ + fs/ds/ds-fs-factory.o \ + fs/ds/ds-fs.o +endif + +ifeq ($(BACKEND),n64) +MODULE_OBJS += \ + fs/n64/n64-fs-factory.o \ + fs/n64/romfsstream.o +endif + +ifeq ($(BACKEND),ps2) +MODULE_OBJS += \ + fs/ps2/ps2-fs-factory.o +endif + +ifeq ($(BACKEND),psp) +MODULE_OBJS += \ + fs/psp/psp-fs-factory.o \ + fs/psp/psp-stream.o \ + plugins/psp/psp-provider.o \ + saves/psp/psp-saves.o \ + timer/psp/timer.o +endif + +ifeq ($(BACKEND),wii) +MODULE_OBJS += \ + fs/wii/wii-fs-factory.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile index 2dcf9b7a7c..4494e8da78 100644 --- a/backends/platform/dc/Makefile +++ b/backends/platform/dc/Makefile @@ -69,6 +69,8 @@ OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \ MODULE_DIRS += ./ +BACKEND := dc + include $(srcdir)/Makefile.common scummvm.bin : scummvm.elf diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 079e23aec0..c99342c28e 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -251,6 +251,8 @@ ifdef WRAP_MALLOC DEFINES += -DWRAP_MALLOC endif +BACKEND := ds + INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \ -I$(portdir)/data -I$(portdir)/../commoninclude \ -I$(portdir)/source -I$(portdir)/source/mad \ diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index f6b69b3633..5f186f2528 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -8,7 +8,6 @@ PORT_OBJS := \ arm9/source/blitters_arm.o \ arm9/source/cdaudio.o \ arm9/source/dsmain.o \ - ../../fs/ds/ds-fs.o \ arm9/source/gbampsave.o \ arm9/source/scummhelp.o \ arm9/source/osystem_ds.o \ diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile index 914e6e9c9e..b8b2e61f77 100644 --- a/backends/platform/n64/Makefile +++ b/backends/platform/n64/Makefile @@ -64,6 +64,8 @@ ENABLE_SCUMM = $(ENABLED) OBJS := nintendo64.o osys_n64_base.o osys_n64_events.o osys_n64_utilities.o pakfs_save_manager.o framfs_save_manager.o +BACKEND := n64 + include $(srcdir)/Makefile.common MODULE_DIRS += ./ diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb index 41ac58d629..53646a9546 100644 --- a/backends/platform/ps2/Makefile.gdb +++ b/backends/platform/ps2/Makefile.gdb @@ -75,6 +75,8 @@ OBJS := backends/platform/ps2/DmaPipe.o \ MODULE_DIRS += . +BACKEND := ps2 + include $(srcdir)/Makefile.common LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2 index bf7ac0aca0..d2a8d210e4 100644 --- a/backends/platform/ps2/Makefile.ps2 +++ b/backends/platform/ps2/Makefile.ps2 @@ -75,6 +75,8 @@ OBJS := backends/platform/ps2/DmaPipe.o \ MODULE_DIRS += . +BACKEND := ps2 + include $(srcdir)/Makefile.common LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile index 994d201f65..617ef7c8cc 100644 --- a/backends/platform/psp/Makefile +++ b/backends/platform/psp/Makefile @@ -64,7 +64,6 @@ ifeq ($(PSPSDK),) $(error $$(PSPSDK) cannot be obtained.) endif - # Variables for common Scummvm makefile CXX = psp-g++ CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti @@ -151,6 +150,8 @@ OBJS := powerman.o \ mp3.o \ tests.o +BACKEND := psp + # Include common Scummvm makefile include $(srcdir)/Makefile.common -- cgit v1.2.3 From 2692e55208d8945b24d9a6c451a61856ed601a94 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:02:30 +0000 Subject: BUILD: Fix MODULE_DIRS for WinCE port svn-id: r51466 --- backends/platform/wince/module.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/wince/module.mk b/backends/platform/wince/module.mk index 6e328b0af4..6b438f91c9 100644 --- a/backends/platform/wince/module.mk +++ b/backends/platform/wince/module.mk @@ -29,7 +29,9 @@ MODULE_OBJS := \ smartLandScale.o MODULE_DIRS += \ - backends/platform/wince/ + backends/platform/wince/ \ + backends/platform/wince/CEgui/ \ + backends/platform/wince/CEkeys/ # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -- cgit v1.2.3 From d22ebd358dec75762c97f30d8a2fa8630e4268c2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:03:21 +0000 Subject: BUILD: Unify how MODULE_DIRS is computed for backends This should help avoid situations where MODULE_DIRS is not set to a complete list of build dirs (which causes troubles with the automatic header dependency detection logic). On the long run, we should replace the relevant code by a macro or also use rules.mk for this (with yet another if/else case add to it). svn-id: r51467 --- backends/platform/android/module.mk | 9 ++++----- backends/platform/dc/module.mk | 9 ++++----- backends/platform/ds/module.mk | 9 ++++----- backends/platform/gp2x/module.mk | 9 ++++----- backends/platform/gp2xwiz/module.mk | 9 ++++----- backends/platform/iphone/module.mk | 9 ++++----- backends/platform/linuxmoto/module.mk | 9 ++++----- backends/platform/n64/module.mk | 9 ++++----- backends/platform/null/module.mk | 9 ++++----- backends/platform/ps2/module.mk | 9 ++++----- backends/platform/psp/module.mk | 9 ++++----- backends/platform/samsungtv/module.mk | 9 ++++----- backends/platform/sdl/module.mk | 9 ++++----- backends/platform/wii/module.mk | 9 ++++----- backends/platform/wince/module.mk | 11 ++++------- 15 files changed, 60 insertions(+), 77 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk index c7b98b996d..b457b388b1 100644 --- a/backends/platform/android/module.mk +++ b/backends/platform/android/module.mk @@ -3,11 +3,10 @@ MODULE := backends/platform/android MODULE_OBJS := \ android.o asset-archive.o video.o -MODULE_DIRS += \ - backends/platform/android/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) JAVA_SRC = \ $(MODULE)/org/inodes/gus/scummvm/ScummVM.java \ diff --git a/backends/platform/dc/module.mk b/backends/platform/dc/module.mk index eecb91909c..c52ca1a474 100644 --- a/backends/platform/dc/module.mk +++ b/backends/platform/dc/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/dc MODULE_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 += \ - backends/platform/dc/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index 5f186f2528..7298267db4 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -98,11 +98,10 @@ $(MODULE)/arm9/source/touchkeyboard.o: \ MODULE_DIRS += \ - backends/platform/ds/ \ backends/platform/ds/arm7/source/ \ backends/platform/ds/arm7/source/libcartreset/ \ - backends/platform/ds/arm9/source/ \ - backends/platform/ds/arm9/source/fat/ -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk index 50a771219a..d4f145c64f 100644 --- a/backends/platform/gp2x/module.mk +++ b/backends/platform/gp2x/module.mk @@ -7,8 +7,7 @@ MODULE_OBJS := \ graphics.o \ gp2x.o \ -MODULE_DIRS += \ - backends/platform/gp2x/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/gp2xwiz/module.mk b/backends/platform/gp2xwiz/module.mk index f457d51615..edf2f2a717 100644 --- a/backends/platform/gp2xwiz/module.mk +++ b/backends/platform/gp2xwiz/module.mk @@ -6,11 +6,10 @@ MODULE_OBJS := \ gp2xwiz-hw.o \ gp2xwiz-main.o -MODULE_DIRS += \ - backends/platform/gp2xwiz/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) # Hack to ensure the SDL backend is built so we can use OSystem_SDL. -include $(srcdir)/backends/platform/sdl/module.mk \ No newline at end of file diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk index 28bc8d3ac7..9768e6ded4 100644 --- a/backends/platform/iphone/module.mk +++ b/backends/platform/iphone/module.mk @@ -10,8 +10,7 @@ MODULE_OBJS := \ iphone_keyboard.o \ blit_arm.o -MODULE_DIRS += \ - backends/platform/iphone/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/linuxmoto/module.mk b/backends/platform/linuxmoto/module.mk index 8123d6e2ac..316ecbf78e 100644 --- a/backends/platform/linuxmoto/module.mk +++ b/backends/platform/linuxmoto/module.mk @@ -7,11 +7,10 @@ MODULE_OBJS := \ linuxmoto-sdl.o \ hardwarekeys.o -MODULE_DIRS += \ - backends/platform/linuxmoto/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) # HACK: The linuxmoto backend is based on the SDL one, so we load that, too. include $(srcdir)/backends/platform/sdl/module.mk diff --git a/backends/platform/n64/module.mk b/backends/platform/n64/module.mk index 34a7badb44..8fb6ba49ab 100644 --- a/backends/platform/n64/module.mk +++ b/backends/platform/n64/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/n64 MODULE_OBJS := \ nintendo64.o -MODULE_DIRS += \ - backends/platform/n64/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/null/module.mk b/backends/platform/null/module.mk index 12a2cbc510..30345d7ac2 100644 --- a/backends/platform/null/module.mk +++ b/backends/platform/null/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/null MODULE_OBJS := \ null.o -MODULE_DIRS += \ - backends/platform/null/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/ps2/module.mk b/backends/platform/ps2/module.mk index 86b12cb668..bf95a5501d 100644 --- a/backends/platform/ps2/module.mk +++ b/backends/platform/ps2/module.mk @@ -18,8 +18,7 @@ MODULE_OBJS := \ ps2time.o \ ps2debug.o -MODULE_DIRS += \ - backends/platform/ps2/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk index 855554e980..4652189ab4 100644 --- a/backends/platform/psp/module.mk +++ b/backends/platform/psp/module.mk @@ -19,8 +19,7 @@ MODULE_OBJS := powerman.o \ mp3.o \ tests.o -MODULE_DIRS += \ - backends/platform/psp/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/samsungtv/module.mk b/backends/platform/samsungtv/module.mk index 27e2cfa77d..d7ebe75080 100644 --- a/backends/platform/samsungtv/module.mk +++ b/backends/platform/samsungtv/module.mk @@ -5,8 +5,7 @@ MODULE_OBJS := \ main.o \ samsungtv.o -MODULE_DIRS += \ - backends/platform/samsungtv/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk index f6ec769253..43751a57b2 100644 --- a/backends/platform/sdl/module.mk +++ b/backends/platform/sdl/module.mk @@ -7,8 +7,7 @@ MODULE_OBJS := \ main.o \ sdl.o -MODULE_DIRS += \ - backends/platform/sdl/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/wii/module.mk b/backends/platform/wii/module.mk index cf55a182c0..88e75fba26 100644 --- a/backends/platform/wii/module.mk +++ b/backends/platform/wii/module.mk @@ -8,8 +8,7 @@ MODULE_OBJS := \ osystem_sfx.o \ osystem_events.o -MODULE_DIRS += \ - backends/platform/wii/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) diff --git a/backends/platform/wince/module.mk b/backends/platform/wince/module.mk index 6b438f91c9..2d852670f8 100644 --- a/backends/platform/wince/module.mk +++ b/backends/platform/wince/module.mk @@ -28,10 +28,7 @@ MODULE_OBJS := \ PocketSCUMM.o \ smartLandScale.o -MODULE_DIRS += \ - backends/platform/wince/ \ - backends/platform/wince/CEgui/ \ - backends/platform/wince/CEkeys/ - -# We don't use the rules.mk here on purpose -OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) +# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. +MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) +OBJS := $(MODULE_OBJS) $(OBJS) +MODULE_DIRS += $(sort $(dir $(MODULE_OBJS))) -- cgit v1.2.3 From 8de57b0b2942cfd039c5bef47699809f2b5ccc60 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 16:24:08 +0000 Subject: DS: Get rid of DS_NON_SCUMM_BUILD and DS_SCUMM_BUILD svn-id: r51473 --- backends/platform/ds/arm9/makefile | 24 ++++++++++++------------ backends/platform/ds/arm9/source/dsoptions.cpp | 6 ------ 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index c99342c28e..fac50178b4 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -110,7 +110,7 @@ USE_ARM_COSTUME_ASM = 1 #WRAP_MALLOC = 1 ifdef DS_BUILD_A - DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM + DEFINES = -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM LOGO = logoa.bmp ENABLE_SCUMM = STATIC_PLUGIN USE_ARM_GFX_ASM = 1 @@ -118,7 +118,7 @@ ifdef DS_BUILD_A endif ifdef DS_BUILD_B - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_B + DEFINES = -DDS_BUILD_B LOGO = logob.bmp ENABLE_SKY = STATIC_PLUGIN ENABLE_QUEEN = STATIC_PLUGIN @@ -126,14 +126,14 @@ ifdef DS_BUILD_B endif ifdef DS_BUILD_C - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_C + DEFINES = -DDS_BUILD_C LOGO = logoc.bmp ENABLE_AGOS = STATIC_PLUGIN BUILD=scummvm-C endif ifdef DS_BUILD_D - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D + DEFINES = -DDS_BUILD_D LOGO = logod.bmp ENABLE_GOB = STATIC_PLUGIN ENABLE_CINE = STATIC_PLUGIN @@ -142,42 +142,42 @@ ifdef DS_BUILD_D endif ifdef DS_BUILD_E - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_E + DEFINES = -DDS_BUILD_E LOGO = logoe.bmp ENABLE_SAGA = STATIC_PLUGIN BUILD=scummvm-E endif ifdef DS_BUILD_F - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_F + DEFINES = -DDS_BUILD_F LOGO = logof.bmp ENABLE_KYRA = STATIC_PLUGIN BUILD=scummvm-F endif ifdef DS_BUILD_G - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_G + DEFINES = -DDS_BUILD_G LOGO = logog.bmp ENABLE_LURE = STATIC_PLUGIN BUILD=scummvm-G endif ifdef DS_BUILD_H - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H + DEFINES = -DDS_BUILD_H LOGO = logoh.bmp ENABLE_PARALLACTION = STATIC_PLUGIN BUILD=scummvm-H endif ifdef DS_BUILD_I - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_I + DEFINES = -DDS_BUILD_I LOGO = logoi.bmp ENABLE_MADE = STATIC_PLUGIN BUILD=scummvm-I endif ifdef DS_BUILD_K - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_K + DEFINES = -DDS_BUILD_K LOGO = logok.bmp ENABLE_CRUISE = STATIC_PLUGIN BUILD=scummvm-K @@ -185,14 +185,14 @@ endif #ifdef DS_BUILD_L -# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_L +# DEFINES = -DDS_BUILD_L # LOGO = logog.bmp # ENABLE_DRASCULA = STATIC_PLUGIN # BUILD=scummvm-K #endif #ifdef DS_BUILD_M -# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_M +# DEFINES = -DDS_BUILD_M # LOGO = logog.bmp # ENABLE_TUCKER = STATIC_PLUGIN # BUILD=scummvm-K diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index cc89c41017..6721a4910a 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -128,12 +128,6 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _radioButtonMode = false; -#ifdef DS_SCUMM_BUILD - if (!DS::isGBAMPAvailable()) { -// addButton(this, 100, 140, "Delete Save", 0, 'dels', 'D'); - } -#endif - // new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", Graphics::kTextAlignCenter); -- cgit v1.2.3 From 148c830d769aaf4fd4e08e46284d419ff0c93f18 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 16:24:25 +0000 Subject: DS: Add WRAP_MALLOC support to ds.mk, update comments svn-id: r51474 --- backends/platform/ds/ds.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 27309663d1..97f104c391 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -12,6 +12,11 @@ # build I: --enable-made --disable-mad # build K: --enable-cruise --disable-mad # +# However, this could be automated using a simple script, which generates +# subdirs for each build, and runs configure in those subdirs with the right +# parameters (all builds would still share the same set of source code files, +# thanks to our "out of tree" building support). +# # This does not currently take care of some things: # * It does not #define DS_BUILD_A etc. -- most uses of that should be # eliminated, though. Only usage should be for selecting the default config @@ -21,6 +26,9 @@ # too; we need to investigate those. # * It does not currently adjust the logo. Ideally, if we ever get real plugin # support, that should be necessary anymore anyway. +# * No support for USE_DEBUGGER and USE_PROFILER yet. I envision that we would +# integrate them with the --enable-debug and --enable-profiling configure options, +# I simply haven't gotten around to do that yet. # * ... # Set location of ndsdir so that we can easily refer to files in it @@ -59,6 +67,12 @@ LOGO = logoa.bmp # folder. +ifdef WRAP_MALLOC + LDFLAGS += -Wl,--wrap,malloc + DEFINES += -DWRAP_MALLOC +endif + + # Compiler options for files which should be optimised for speed OPT_SPEED := -O3 -- cgit v1.2.3 From 3e8a972602663810465414cd9aad6dddab6a2f14 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Thu, 29 Jul 2010 19:11:49 +0000 Subject: DC: Specialize createConfig{Read,Write}Stream Implement platform-specific variants of createConfigReadStream() and createConfigWriteStream(), instead of inheriting the BaseBackend definitions. Nonstandard behavious is as follows: * createConfigWriteStream() always returns 0 (read-only filesystem) * createConfigReadStream() returns an empty MemoryReadStream instead of NULL if scummvm.ini does not exist. This is to make sure that loadDefaultConfigFile() always clears out any old config data, as I'll want to restart config parsing from scratch after a disc swap. svn-id: r51478 --- backends/platform/dc/dc.h | 3 +++ backends/platform/dc/dcmain.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) (limited to 'backends') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index e87a0a8c90..057ab283cf 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -233,6 +233,9 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys Common::SaveFileManager *createSavefileManager(); + + Common::SeekableReadStream *createConfigReadStream(); + Common::WriteStream *createConfigWriteStream(); }; diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 5a9286093f..5fde919650 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -31,6 +31,7 @@ #include "icon.h" #include "DCLauncherDialog.h" #include +#include #include "backends/plugins/dc/dc-provider.h" #include "sound/mixer_intern.h" @@ -206,6 +207,16 @@ void OSystem_Dreamcast::getTimeAndDate(TimeDate &td) const { td.tm_year = t.tm_year; } +Common::SeekableReadStream *OSystem_Dreamcast::createConfigReadStream() { + Common::FSNode file("/scummvm.ini"); + Common::SeekableReadStream *s = file.createReadStream(); + return s? s : new Common::MemoryReadStream((const byte *)"", 0); +} + +Common::WriteStream *OSystem_Dreamcast::createConfigWriteStream() { + return 0; +} + void DCHardware::dc_init_hardware() { #ifndef NOSERIAL -- cgit v1.2.3 From 630127bc077e56c619c816a89e1d577c38b5eafb Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Thu, 29 Jul 2010 20:37:56 +0000 Subject: DC: Let scummvm.ini override autodetect of games If a game CD has a scummvm.ini file with at least one game domain in it, the normal autodetection is now bypassed and a menu of only the games in the .ini file is presented instead. The descriptions of the games are taken from the .ini file, but icons are still scanned for in the old fashion. Note that previously ScummVM would read global options from the scummvm.ini file on the boot disc (if present), but now global options are instead taken from the scummvm.ini on the game disc (in case of a disc swap). svn-id: r51480 --- backends/platform/dc/selector.cpp | 98 ++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 31 deletions(-) (limited to 'backends') diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 0d8e0a0188..0d9b931d2c 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "dc.h" #include "icon.h" #include "label.h" @@ -200,12 +201,43 @@ static bool uniqueGame(const char *base, const char *dir, return true; } -static int findGames(Game *games, int max) +static int findGames(Game *games, int max, bool use_ini) { Dir *dirs = new Dir[MAX_DIR]; - int curr_game = 0, curr_dir = 0, num_dirs = 1; - dirs[0].node = Common::FSNode(""); - while (curr_game < max && curr_dir < num_dirs) { + int curr_game = 0, curr_dir = 0, num_dirs = 0; + + if (use_ini) { + ConfMan.loadDefaultConfigFile(); + Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); + for(Common::ConfigManager::DomainMap::const_iterator i = + game_domains.begin(); curr_game < max && i != game_domains.end(); i++) { + Common::String path = (*i)._value["path"]; + if (path.size() && path.lastChar() != '/') + path += "/"; + int j; + for (j=0; j= num_dirs) { + if (num_dirs >= MAX_DIR) + continue; + dirs[j = num_dirs++].node = Common::FSNode(path); + } + if (curr_game < max) { + strcpy(games[curr_game].filename_base, (*i)._key.c_str()); + strncpy(games[curr_game].dir, dirs[j].node.getPath().c_str(), 256); + games[curr_game].dir[255] = '\0'; + games[curr_game].language = Common::UNK_LANG; + games[curr_game].platform = Common::kPlatformUnknown; + strcpy(games[curr_game].text, (*i)._value["description"].c_str()); + curr_game++; + } + } + } else { + dirs[num_dirs++].node = Common::FSNode(""); + } + + while ((curr_game < max || use_ini) && curr_dir < num_dirs) { strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252); dirs[curr_dir].name[251] = '\0'; dirs[curr_dir].deficon[0] = '\0'; @@ -214,44 +246,46 @@ static int findGames(Game *games, int max) for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end(); ++entry) { if (entry->isDirectory()) { - if (num_dirs < MAX_DIR && strcasecmp(entry->getDisplayName().c_str(), - "install")) { + if (!use_ini && num_dirs < MAX_DIR && + strcasecmp(entry->getDisplayName().c_str(), "install")) { dirs[num_dirs].node = *entry; num_dirs++; } } else if (isIcon(*entry)) strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str()); - else + else if(!use_ini) files.push_back(*entry); } - GameList candidates = EngineMan.detectGames(files); - - for (GameList::const_iterator ge = candidates.begin(); - ge != candidates.end(); ++ge) - 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].language, - games[curr_game].platform, games, curr_game)) { - - strcpy(games[curr_game].text, ge->description().c_str()); + if (!use_ini) { + GameList candidates = EngineMan.detectGames(files); + + for (GameList::const_iterator ge = candidates.begin(); + ge != candidates.end(); ++ge) + 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].language, + games[curr_game].platform, games, curr_game)) { + + strcpy(games[curr_game].text, ge->description().c_str()); #if 0 - 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); + 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++; + curr_game++; + } } - } + } } for (int i=0; i