示例#1
0
/**
 * Performs detection and initialization of Sony CLIE-specific features.
 * @param diaSettings structure used to store detected configuration.
 * @return error code.
 */
static Err SonySilkLibInit(DIA_Settings* diaSettings) 
{
    UInt32  vskVersion=0;
    Err     error=SysLibFind(sonySysLibNameSilk, &diaSettings->sonySilkLibRefNum);

    if (sysErrLibNotFound==error) {
        error=SysLibLoad('libr', sonySysFileCSilkLib, &diaSettings->sonySilkLibRefNum);
        if (!error) DIA_SetFlag(diaSettings, diaLoadedSonySilkLib);
    }
    if (!error) {
        DIA_SetFlag(diaSettings, diaHasSonySilkLib);
        error = FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &vskVersion);
        if (error) {
            error=SilkLibOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            SilkLibEnableResize(diaSettings->sonySilkLibRefNum);
        }
        else if (vskVersionNum2==vskVersion) {
            error=VskOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            VskSetState(diaSettings->sonySilkLibRefNum, vskStateEnable, vskResizeVertically);			
        }
        else {
            error=VskOpen(diaSettings->sonySilkLibRefNum);
            if (error) goto OnError;
            VskSetState(diaSettings->sonySilkLibRefNum, vskStateEnable, vskResizeHorizontally);			
        }
    }
    else error=errNone;
OnError:
    return error;
}
示例#2
0
static DIAHardwareType InitializeSony( void )
{
    Err    err;
    UInt32 version;

    err = SysLibFind( sonySysLibNameSilk, &sonyRefNum );
    if ( err == sysErrLibNotFound ) {
        err = SysLibLoad( 'libr', sonySysFileCSilkLib, &sonyRefNum );
    }
    if ( err != errNone )
        return DIA_HARDWARE_NONE;
    if ( errNone == FtrGet( sonySysFtrCreator, sonySysFtrNumVskVersion, 
                        &version ) ) {
        /* Version 2 and up */
        err = VskOpen( sonyRefNum );
        if ( errNone == err )
            return DIA_HARDWARE_SONY2;
    }
    else {
        /* Version 1 and up */
        err = SilkLibOpen( sonyRefNum );
        if ( errNone == err ) {
            /* Make sure we are in a Hi-Res mode */
            UInt32 width;
            UInt32 height;
            UInt16 sonyHiResRefNum;

            err = SysLibFind( sonySysLibNameHR, &sonyHiResRefNum );
            if ( err == sysErrLibNotFound )
                err = SysLibLoad( 'libr', sonySysFileCHRLib, &sonyHiResRefNum );
            if ( err == errNone ) {
                err = HROpen( sonyHiResRefNum );
                HRWinScreenMode( sonyHiResRefNum, winScreenModeGet, &width,
                     &height, NULL, NULL );
                HRClose( sonyHiResRefNum );
                if ( width < 320 )
                    return DIA_HARDWARE_NONE;
            }
            else
                return DIA_HARDWARE_NONE;
            }
        return DIA_HARDWARE_SONY1;
    }
    return DIA_HARDWARE_NONE;
}
示例#3
0
Boolean
SonySilk(void)
{
	Err error = errNone;
	UInt32 version;
	UInt16		cardNo;
	LocalID		dbID;

	if (silk_ref != -1)
		return (silk_ref != 0);

	if (SysLibFind(sonySysLibNameSilk, &silk_ref)) {
		error = SysLibLoad('libr', sonySysFileCSilkLib, &silk_ref);
	}
	if (error == sysErrLibNotFound || silk_ref == -1) {
		silk_ref = 0;
		return (0);
	}
	WriteLog("found sony silk library ");

	error = FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &version);
	if (error || !version) {
		silk_ver = 0;
		SilkLibOpen(silk_ref);
	} else {
		VskOpen(silk_ref);
		silk_ver = VskGetAPIVersion(silk_ref);
	}

	WriteLog("version: %d\n", silk_ver);

	SonySetSilkResizable(true);

	SysCurAppDatabase(&cardNo, &dbID);
	SysNotifyRegister(cardNo, dbID, sysNotifyDisplayChangeEvent,
	    SonyNotifyHook, sysNotifyNormalPriority, NULL);


	return (silk_ref != 0);
}