[Scummvm-cvs-logs] SF.net SVN: scummvm: [26716] scummvm/trunk/backends/platform/PalmOS/Src/ launcher

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Tue May 1 16:50:55 CEST 2007


Revision: 26716
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26716&view=rev
Author:   chrilith
Date:     2007-05-01 07:50:55 -0700 (Tue, 01 May 2007)

Log Message:
-----------
Added supported games list and got rid of bStartScumm

Modified Paths:
--------------
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/app.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formUtil.h
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/forms.h
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.h
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/launch.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.h

Added Paths:
-----------
    scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/app.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/app.cpp	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/app.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -35,7 +35,6 @@
 #include "mathlib.h"
 #include "formCards.h"
 #include "games.h"
-#include "extend.h"
 
 #include "modules.h"
 #include "init_mathlib.h"

Added: scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp	                        (rev 0)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -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;
+}


Property changes on: scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formUtil.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formUtil.h	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formUtil.h	2007-05-01 14:50:55 UTC (rev 26716)
@@ -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'

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -299,8 +299,10 @@
 						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;
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/forms.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/forms.h	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/forms/forms.h	2007-05-01 14:50:55 UTC (rev 26716)
@@ -18,5 +18,6 @@
 HANDLER(Skins)
 HANDLER(Music)
 HANDLER(Info)
+HANDLER(Selector)
 
 #endif

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.cpp	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -32,7 +32,6 @@
 #include "games.h"
 #include "skin.h"
 
-#include "extend.h"
 #include "StarterRsc.h"
 
 DmOpenRef gameDB = NULL;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.h	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/games.h	2007-05-01 14:50:55 UTC (rev 26716)
@@ -180,8 +180,8 @@
 } 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 @@
 	{ "cruise",			"Cruise for a Corpse" },
 };
 
-
 // protos
 Err		GamOpenDatabase		();
 void	GamImportDatabase	();

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/launch.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/launch.cpp	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/launch.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -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 @@
 #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 @@
 		// 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;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.cpp	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.cpp	2007-05-01 14:50:55 UTC (rev 26716)
@@ -43,7 +43,6 @@
 GlobalsDataPtr gVars;
 
 Boolean bDirectMode = false;
-Boolean bStartScumm = false;
 Boolean bLaunched	= false;
 
 /***********************************************************************
@@ -200,6 +199,10 @@
 				FrmSetEventHandler(frmP, InfoFormHandleEvent);
 				break;
 
+			case EngineForm:
+				FrmSetEventHandler(frmP, SelectorFormHandleEvent);
+				break;
+
 			default:
 //				ErrFatalDisplay("Invalid Form Load Event");
 				break;
@@ -231,9 +234,6 @@
 	do {
 		EvtGetEvent(&event, evtNoWait);
 
-		if(bStartScumm)
-			bStartScumm = StartScummVM();
-
 		if (! SysHandleEvent(&event))
 			if (! MenuHandleEvent(0, &event, &error))
 				if (! AppHandleEvent(&event))
@@ -330,7 +330,7 @@
 				FrmGotoForm(MainForm);
 			}else {
 				GamUnselect();
-				bStartScumm = true;
+				FrmGotoForm(EngineForm);
 			}
 
 			AppEventLoop();

Modified: scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.h	2007-05-01 14:49:13 UTC (rev 26715)
+++ scummvm/trunk/backends/platform/PalmOS/Src/launcher/start.h	2007-05-01 14:50:55 UTC (rev 26716)
@@ -79,7 +79,6 @@
 extern GlobalsPreferencePtr gPrefs;
 
 extern Boolean bDirectMode;
-extern Boolean bStartScumm;
 extern Boolean bLaunched;
 
 #define appPrefID				0x00
@@ -92,7 +91,7 @@
 
 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list