Пример #1
0
int main(int argc, char *argv[])
{
    int i, ret;

    pspDebugScreenInit();
    sceCtrlSetSamplingCycle(0);
    sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);

    printf("Save Encrypt Sample\n");
    printf("by Jim Paris and psp123\n\n");

    printf(" Will encrypt: %s\n", plaintext);
    printf("    Using key:");
    if(gamekey) {
        for (i = 0; i < 0x10; i++)
            printf(" %02x", gamekey[i]);
    } else {
        printf(" none");
    }
    printf("\n\n");
    printf("  Output file: %s\n", encrypted);
    printf("Update hashes: %s\n\n", paramsfo);
    printf("Press X to continue, or O to quit.\n\n");

    if (waitbutton(PSP_CTRL_CROSS | PSP_CTRL_CIRCLE) & PSP_CTRL_CIRCLE)
        goto out;

    printf("Working...\n\n");

    ret = encrypt_file(plaintext, encrypted, datafile, paramsfo, gamekey);
    if(ret < 0) {
        printf("Error: encrypt_file() returned %d\n\n", ret);
    } else {
        printf("Successfully wrote %d bytes to\n", ret);
        printf("  %s\n", encrypted);
        printf("and updated hashes in\n");
        printf("  %s\n\n", paramsfo);
    }

    printf("Press any button to quit\n");
    waitbutton(-1);

out:
    sceKernelExitGame();
    return 0;
}
Пример #2
0
/*主程序入口*/
void main(){
	//初始化GPIO按钮
	//gpiosetup();
	printf ("--OK\n");
	//初始化屏幕及菜单项
	//GPIO控制选择部分
	while(1){
		waitbutton();
		fflush (stdout) ;
		if (digitalRead (BTN_UP) == HIGH){
			//delay (100);
			printf("up\n");
		}
			// }

		// if (digitalRead (BTN_DOWN) == HIGH){delay (100) ;printf("down");
			// }

		// if (digitalRead (BTN_ENTER) == HIGH){delay (100) ;printf("enter");
		// }
	}
	// return 1;

}