diff options
author | Chris Apers | 2007-05-01 14:50:55 +0000 |
---|---|---|
committer | Chris Apers | 2007-05-01 14:50:55 +0000 |
commit | 8573ca3f7409108bff0e24ba3a942ca692ce5787 (patch) | |
tree | 69765c162244a502c79d451e5116a8cc5cbd21e9 /backends/platform | |
parent | 54b8a4d06f56b3045f0e5a1ec3709ac1524f48d0 (diff) | |
download | scummvm-rg350-8573ca3f7409108bff0e24ba3a942ca692ce5787.tar.gz scummvm-rg350-8573ca3f7409108bff0e24ba3a942ca692ce5787.tar.bz2 scummvm-rg350-8573ca3f7409108bff0e24ba3a942ca692ce5787.zip |
Added supported games list and got rid of bStartScumm
svn-id: r26716
Diffstat (limited to 'backends/platform')
10 files changed, 293 insertions, 48 deletions
diff --git a/backends/platform/PalmOS/Src/launcher/app.cpp b/backends/platform/PalmOS/Src/launcher/app.cpp index 7f1fb4a9b5..3f57f77125 100644 --- a/backends/platform/PalmOS/Src/launcher/app.cpp +++ b/backends/platform/PalmOS/Src/launcher/app.cpp @@ -35,7 +35,6 @@ #include "mathlib.h" #include "formCards.h" #include "games.h" -#include "extend.h" #include "modules.h" #include "init_mathlib.h" diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp new file mode 100755 index 0000000000..7fd29e6145 --- /dev/null +++ b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp @@ -0,0 +1,275 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001 Ludvig Strigeus + * Copyright (C) 2001-2007 The ScummVM project + * Copyright (C) 2002-2007 Chris Apers - PalmOS Backend + * + * 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 <PalmOS.h> +#include "StarterRsc.h" +#include "formUtil.h" +#include "games.h" +#include "start.h" + +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[] = { + { 10, engine_agos }, + { 1, engine_sky }, + { 2, engine_sword1 }, + { 2, engine_sword2 }, + { 2, engine_cine }, + { 1, engine_queen }, + { 1, engine_lure }, + { 6, engine_gob }, + { 3, engine_kyra }, + { 1, engine_parallaction }, + { 2, engine_saga }, + { 10, engine_scumm }, + { 22, engine_agi }, + { 1, engine_touche }, + { 1, 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/formUtil.h b/backends/platform/PalmOS/Src/launcher/forms/formUtil.h index 90cf1ff37a..e9b87bc49f 100644 --- a/backends/platform/PalmOS/Src/launcher/forms/formUtil.h +++ b/backends/platform/PalmOS/Src/launcher/forms/formUtil.h @@ -4,6 +4,8 @@ #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' diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp index 1709b4c7a2..bd3263350d 100644 --- a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp +++ b/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp @@ -299,8 +299,10 @@ Boolean MainFormHandleEvent(EventPtr eventP) case skinButtonGameStart: if (gPrefs->card.volRefNum == vfsInvalidVolRef) FrmCustomAlert(FrmWarnAlert,"Please select/insert a memory card.", 0, 0); + else if (GamGetSelected() != dmMaxRecordIndex) + StartScummVM(); else - bStartScumm = true; + FrmPopupForm(EngineForm); handled = true; break; diff --git a/backends/platform/PalmOS/Src/launcher/forms/forms.h b/backends/platform/PalmOS/Src/launcher/forms/forms.h index 0bdfd356c7..ca0089d8c1 100644 --- a/backends/platform/PalmOS/Src/launcher/forms/forms.h +++ b/backends/platform/PalmOS/Src/launcher/forms/forms.h @@ -18,5 +18,6 @@ HANDLER(CardSlot) HANDLER(Skins) HANDLER(Music) HANDLER(Info) +HANDLER(Selector) #endif diff --git a/backends/platform/PalmOS/Src/launcher/games.cpp b/backends/platform/PalmOS/Src/launcher/games.cpp index d0e162a4cc..c9fd0a661b 100644 --- a/backends/platform/PalmOS/Src/launcher/games.cpp +++ b/backends/platform/PalmOS/Src/launcher/games.cpp @@ -32,7 +32,6 @@ #include "games.h" #include "skin.h" -#include "extend.h" #include "StarterRsc.h" DmOpenRef gameDB = NULL; diff --git a/backends/platform/PalmOS/Src/launcher/games.h b/backends/platform/PalmOS/Src/launcher/games.h index a26a5021b5..235aca38de 100644 --- a/backends/platform/PalmOS/Src/launcher/games.h +++ b/backends/platform/PalmOS/Src/launcher/games.h @@ -180,8 +180,8 @@ static const struct { } engines[] = { { "agos", "AGOS Engine" }, { "sky", "Beneath a Steel Sky" }, - { "sword1", "Broken Sword 1" }, - { "sword2", "Broken Sword 2" }, + { "sword1", "Broken Sword I" }, + { "sword2", "Broken Sword II" }, { "cine", "Delphine Cinematique v1.0" }, { "queen", "Flight of the Amazon Queen" }, { "lure", "Lure of the Tempress" }, @@ -195,7 +195,6 @@ static const struct { { "cruise", "Cruise for a Corpse" }, }; - // protos Err GamOpenDatabase (); void GamImportDatabase (); diff --git a/backends/platform/PalmOS/Src/launcher/launch.cpp b/backends/platform/PalmOS/Src/launcher/launch.cpp index b370e4d098..8e5de05c8d 100644 --- a/backends/platform/PalmOS/Src/launcher/launch.cpp +++ b/backends/platform/PalmOS/Src/launcher/launch.cpp @@ -29,7 +29,6 @@ #include "games.h" #include "start.h" #include "rumble.h" -#include "extend.h" #include "globals.h" #include "features.h" #include "formUtil.h" @@ -188,54 +187,23 @@ onError: #undef CHECK_FILE #undef BUILD_FILE -Boolean StartScummVM() { +Boolean StartScummVM(Int16 engine) { Char **argvP; UInt8 lightspeed, argc = 0; UInt32 stackSize; Boolean toLauncher, direct, isARM; - UInt8 engine; Char num[6]; - UInt16 index = GamGetSelected(); - argvP = ArgsInit(); direct = false; // start command line (exec name) ArgsAdd(&argvP[argc], "-", NULL, &argc); + UInt16 index = GamGetSelected(); // no game selected if (index == dmMaxRecordIndex) { - ListPtr listP; - UInt16 whichButton; - - // init form - FormPtr frmP = FrmInitForm(EngineForm); - 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); - - whichButton = FrmDoDialog(frmP); - engine = LstGetSelection(listP); - - FrmDeleteForm(frmP); - MemPtrFree(itemsText); - itemsText = NULL; - - if (whichButton == EngineCancelButton) { - 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); - } + if (engine == NO_ENGINE) { // free args ArgsFree(argvP); return false; @@ -244,6 +212,7 @@ Boolean StartScummVM() { // 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; diff --git a/backends/platform/PalmOS/Src/launcher/start.cpp b/backends/platform/PalmOS/Src/launcher/start.cpp index 076c24d6c2..e68228cc77 100644 --- a/backends/platform/PalmOS/Src/launcher/start.cpp +++ b/backends/platform/PalmOS/Src/launcher/start.cpp @@ -43,7 +43,6 @@ GlobalsPreferencePtr gPrefs; GlobalsDataPtr gVars; Boolean bDirectMode = false; -Boolean bStartScumm = false; Boolean bLaunched = false; /*********************************************************************** @@ -200,6 +199,10 @@ static Boolean AppHandleEvent(EventPtr eventP) { FrmSetEventHandler(frmP, InfoFormHandleEvent); break; + case EngineForm: + FrmSetEventHandler(frmP, SelectorFormHandleEvent); + break; + default: // ErrFatalDisplay("Invalid Form Load Event"); break; @@ -231,9 +234,6 @@ static void AppEventLoop(void) { do { EvtGetEvent(&event, evtNoWait); - if(bStartScumm) - bStartScumm = StartScummVM(); - if (! SysHandleEvent(&event)) if (! MenuHandleEvent(0, &event, &error)) if (! AppHandleEvent(&event)) @@ -330,7 +330,7 @@ static UInt32 ScummVMPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { FrmGotoForm(MainForm); }else { GamUnselect(); - bStartScumm = true; + FrmGotoForm(EngineForm); } AppEventLoop(); diff --git a/backends/platform/PalmOS/Src/launcher/start.h b/backends/platform/PalmOS/Src/launcher/start.h index f08d551763..acf9081a83 100644 --- a/backends/platform/PalmOS/Src/launcher/start.h +++ b/backends/platform/PalmOS/Src/launcher/start.h @@ -79,7 +79,6 @@ typedef struct { extern GlobalsPreferencePtr gPrefs; extern Boolean bDirectMode; -extern Boolean bStartScumm; extern Boolean bLaunched; #define appPrefID 0x00 @@ -92,7 +91,7 @@ extern Boolean bLaunched; Err AppStart(void); void AppStop(void); -Boolean StartScummVM(); +Boolean StartScummVM(Int16 engine = -1); void SavePrefs(); Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP); #endif |