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); }
static void DestroyGlobals(void) { GlobalsPtr gP = GetGlobals(); if (!gP) { return; } if (gP->urlBoxLabel) { MemPtrFree(gP->urlBoxLabel); } if (gP->navigationOpen) { MemPtrFree(gP->navigationOpen); } FtrUnregister(kAppFileCreator, ftrGlobals); MemPtrFree(gP); }