diff options
author | Chris Apers | 2006-02-12 18:36:57 +0000 |
---|---|---|
committer | Chris Apers | 2006-02-12 18:36:57 +0000 |
commit | 5975bd1fe659c8ac0bfac3856197105deed9fa77 (patch) | |
tree | d92cfab2e153508681c59fa912d2904c9e2f41b4 /backends/PalmOS/Src | |
parent | 353ea3881f7d651ded9be6b3f034987fcb7adddc (diff) | |
download | scummvm-rg350-5975bd1fe659c8ac0bfac3856197105deed9fa77.tar.gz scummvm-rg350-5975bd1fe659c8ac0bfac3856197105deed9fa77.tar.bz2 scummvm-rg350-5975bd1fe659c8ac0bfac3856197105deed9fa77.zip |
- Added ARM module launcher
- Updated 68k launcher with lastest changes to gVars
+ GoLCD API support
+ Fix for invisible DIA using Stuffs*VG functions
+ New communication process between frontend and module to know if the module needs extra files
+ Get free memory at startup
svn-id: r20636
Diffstat (limited to 'backends/PalmOS/Src')
-rw-r--r-- | backends/PalmOS/Src/modules.cpp | 124 |
1 files changed, 108 insertions, 16 deletions
diff --git a/backends/PalmOS/Src/modules.cpp b/backends/PalmOS/Src/modules.cpp index 9357de5abc..e27e85eaf3 100644 --- a/backends/PalmOS/Src/modules.cpp +++ b/backends/PalmOS/Src/modules.cpp @@ -13,9 +13,10 @@ #include "rumble.h" #include "init_mathlib.h" #include "init_pa1lib.h" -#include "init_arm.h" #include "init_palmos.h" +#include "init_stuffs.h" #include "init_sony.h" +#include "init_golcd.h" #ifndef DISABLE_LIGHTSPEED #include "lightspeed_public.h" @@ -23,6 +24,73 @@ GlobalsDataPtr gVars; +#ifdef PALMOS_NATIVE + +#include "endianutils.h" +#include <PNOLoader.h> + +#ifdef COMPILE_ZODIAC +# include <tapwave.h> +# include <TwRuntime.h> +#else +# include <TwDefs.h> +#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 + UInt32 glue; + FtrGet(twFtrCreator, twFtrAPIGlue, &glue); + + PnoDescriptor pno; + PnoLoadFromResources(&pno, 'ARMC', 1, appFileCreator, 1); + PnoCall(&pno, (void*)glue); + 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); +} + +#else + void run(int argc, char *argv[]) { MathlibInit(); @@ -30,21 +98,26 @@ void run(int argc, char *argv[]) { if (gVars->HRrefNum == sysInvalidRefNum) PalmHRInit(8); gVars->slkRefNum= SilkInit(&(gVars->slkVersion)); + gVars->screenPitch = StuffsGetPitch(gVars->screenFullWidth); // create file for printf, warnings, etc... - StdioInit(gVars->volRefNum, "/PALM/Programs/ScummVM/scumm.log", DrawStatus); + StdioInit(gVars->VFS.volRefNum, "/PALM/Programs/ScummVM/scumm.log"); + if (gVars->indicator.showLED) StdioSetLedProc(DrawStatus); + StdioSetCacheSize(gVars->VFS.cacheSize); gUnistdCWD = SCUMMVM_SAVEPATH; - + // init hardware - if (HWR_INIT(INIT_PA1LIB)) Pa1libInit(); + if (HWR_INIT(INIT_GOLCD)) GoLCDInit(&gGoLcdH); + if (HWR_INIT(INIT_PA1LIB)) Pa1libInit(gVars->palmVolume); if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit(); - if (HWR_INIT(INIT_ARM)) ARMInit(); PalmInit(HWR_GET()); if (!gVars->vibrator) HWR_RST(INIT_VIBRATOR); GlbOpen(); + // be sure to have a VG + void *__ptr = StuffsForceVG(); DO_EXIT( main(argc, argv); ) @@ -53,12 +126,13 @@ void run(int argc, char *argv[]) { FREE_FTR(ftrBufferBackup) FREE_FTR(ftrBufferHotSwap) + StuffsReleaseVG(__ptr); GlbClose(); PalmRelease(HWR_GET()); - if (HWR_INIT(INIT_ARM)) ARMRelease(); if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease(); if (HWR_INIT(INIT_PA1LIB)) Pa1libRelease(); + if (HWR_INIT(INIT_GOLCD)) GoLCDRelease(gGoLcdH); // close log file StdioRelease(); @@ -72,23 +146,42 @@ void run(int argc, char *argv[]) { WinPalette(winPaletteSetToDefault, 0, 256, NULL); // ArgsFree(argvP); // called in main(...) } +#endif static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - switch (cmd) - { - case sysAppLaunchCmdNormalLaunch: - { + UInt32 result = 0; + + switch (cmd) { + case sysAppLaunchCustomEngineGetInfo: { +#ifdef PALMOS_NATIVE + result = GET_MODEARM; +#else +# if !defined(DISABLE_SCUMM) || \ + !defined(DISABLE_SIMON) || \ + !defined(DISABLE_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: @@ -105,14 +198,14 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) // 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, sysAppLaunchCustomDeleteEngine,0); + SysUIAppSwitch(cardNo, dbID, sysAppLaunchCustomEngineDelete,0); else SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch,0); } @@ -125,10 +218,9 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) } - return 0; + return result; } -UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) -{ +UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { return ModulesPalmMain(cmd, cmdPBP, launchFlags); } |