Esempio n. 1
0
/* PalmOS 5.x or higher specific operations */
static void OS5( void )
{
    Err    err;
    UInt32 processorType;
    UInt32 autoBackup;

    err = FtrGet( sysFileCSystem, sysFtrNumProcessorID, &processorType );
    if ( err == errNone )
        have68K = sysFtrNumProcessorIs68K( processorType );
#ifdef BUILD_ARMLETS
    if ( err == errNone && sysFtrNumProcessorIsARM( processorType ) )
        supportArmlets = true;
    else
#endif
        supportArmlets = false;

    supportNVFS = ( errNone == FtrGet( sysFtrCreator, sysFtrNumDmAutoBackup, 
                                   &autoBackup ) && 
                    autoBackup != 0 );

    supportedCompression ^= ( 1 << BitmapCompressionTypePackBits );
}
UInt32 PilotMain(UInt16 launchCode, MemPtr launchParameters, UInt16 launchFlags)
{
	UInt32 Value;
	UInt32 Result = errNone;
	UInt32 CPU;
	launch Launch;
	Launch.launchParameters = launchParameters;
	Launch.launchCode = launchCode;
	Launch.launchFlags = launchFlags;

	if ((launchCode == sysAppLaunchCmdNormalLaunch ||
		launchCode == sysAppLaunchCmdOpenDB ||
		launchCode == sysAppLaunchCmdCustomBase) && !RomVersionCheck(launchFlags))
	{
		FtrGet(sysFileCSystem, sysFtrNumProcessorID, &CPU);
		if (CPU == sysFtrNumProcessorx86)
		{
			Module = PealLoadFromResources('armc', 1000, NULL, PROJECT_FOURCC,32,0,0,0); // just for testing

			Launch.FreeModule = PealUnload;
			Launch.LoadModule = LoadModule;
			Launch.GetSymbol = LookupSymbol86;
			Launch.PealCall = PealCall86;
			Launch.Module = Module;
			PceNativeCall(PALMOS_IX86_FUNC(PROJECT_OUTPUT,PaceMain86),&Launch);

			if (Module)
				PealUnload(Module);
		}
		else
		if (sysFtrNumProcessorIsARM(CPU))
		{
			UInt32 Version;
			Boolean MemSema;

			FtrGet(sysFtrCreator, sysFtrNumROMVersion, &Version);
			MemSema = Version < sysMakeROMVersion(6,0,0,sysROMStageDevelopment,0);

			Module = PealLoadFromResources('armc', 1000, NULL, PROJECT_FOURCC,32,0,0,MemSema);
			if (Module)
			{
				PaceMain = PealLookupSymbol(Module, "PaceMain");
				if (PaceMain)
				{
					Launch.FreeModule = PealUnload;
					Launch.LoadModule = LoadModule;
					Launch.GetSymbol = PealLookupSymbol;
					Launch.PealCall = PealCall;
					Launch.Module = Module;

					Result = PealCall(Module,PaceMain,&Launch);
				}
				PealUnload(Module);
				MemHeapCompact(GetHeapId()); 
			}
		}
		else
			FrmCustomAlert(WarningOKAlert, "ARM processor is required to run this application!", " ", " ");

		if (FtrGet(PROJECT_FOURCC,20,&Value)==errNone)
			FtrPtrFree(PROJECT_FOURCC,20);
	}
	else
	if (launchCode == sysAppLaunchCmdNotify && (launchFlags & sysAppLaunchFlagSubCall)!=0)
	{
		FtrGet(sysFileCSystem, sysFtrNumProcessorID, &CPU);
		if (CPU == sysFtrNumProcessorx86)
			Result = PceNativeCall(PALMOS_IX86_FUNC(PROJECT_OUTPUT,PaceMain86),&Launch);
		else
		if (sysFtrNumProcessorIsARM(CPU) && Module && PaceMain)
			Result = PealCall(Module,PaceMain,&Launch);
	}
	return Result;
}
Esempio n. 3
0
static void FlopSpeakCmd(UInt16 formID, UInt16 ifieldID, UInt16 ofieldID)
{
    FormPtr frm;
    FieldPtr fld;
    UInt16 obj;
    CharPtr p;
    VoidHand h;
    UInt32 processor_type;
    const char *ch=NULL;
    
    frm = FrmGetFormPtr(formID);
    obj = FrmGetObjectIndex(frm, ifieldID);
    fld = (FieldPtr)FrmGetObjectPtr(frm, obj);
    h = (VoidHand)FldGetTextHandle(fld);
    p = (CharPtr)MemHandleLock(h);

    /* Check we are on an ARM */
    FtrGet(sysFileCSystem, sysFtrNumProcessorID, &processor_type);
    if (processor_type == sysFtrNumProcessorx86)
	ch = "Flite doesn't run on the emulator";
    else if (!sysFtrNumProcessorIsARM(processor_type))
	ch = "Flite requires an ARM processor";
    else
    {   /* We're on an ARM -- so setup flite */
	if (!flite) 
	{
	    flite = flite_init();
	    if (flite == 0)
		ch = "Flite failed to initialize";
	    else
	    {
		flite->PlayPosition = 0;
		flite->output = output;
		flite->max_output = FlopMaxOutputChars;
		ch = flite->output;
	    }
	}

	if (FlopPlay == false)
	{
	    FlopPlay = true;
	    StrPrintF(input,"%s",p);
	    if (flite->utt_length == 0)
		flite->start = 0;
	    /* toggle play/stop button to play */
	}
	else
	{
	    FlopPlay = false;
	    flite->start = flite->PlayPosition;
	    /* toggle play/stop button to stop */
	}
    }

    if (ch)
    {
	/* Update the output field with any new information */
	SetField(FlopForm, FlopOutput, ch);
	FrmDrawForm(FrmGetFormPtr(FlopForm));
    }

    MemHandleUnlock(h);
}