int main() { pspDebugScreenInit(); int devkit = sceKernelDevkitVersion(), cursor = 0; if(devkit != 0x06060010) Exit("This program supports only 6.60!"); printf("USB Mod Flasher\n\n"); setcolor(RED); printf("This Mod is only for the TN-V8 eCFW for the PS Vita!"); setcolor(WHITE); printf("\n\n\n\n\n\n\n\n\n\n\n\nCredits:\nXMB Mod by The Z\nInstaller Port by KanadeEngel\n\nSpecial Thanks to:\nfrostegater"); while(1) { if(cursor > 2) cursor = 0; else if(cursor < 0) cursor = 2; if(cursor == 0) setbcolor(GRAY); printfc(3, 4, " Install XMB Mod. "); setbcolor(BLACK); if(cursor == 1) setbcolor(GRAY); printfc(3, 5, " Restore Original Files. "); setbcolor(BLACK); if(cursor == 2) setbcolor(GRAY); printfc(3, 6, " Exit. "); setbcolor(BLACK); int i; for(i = 0; i < 4; i++) printfc(1, 4 + i, " "); setcolor(BLUE); printfc(1, 4 + cursor, ">"); unsigned int Buttons = wait_press(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); wait_release(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN); SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); if(Buttons & PSP_CTRL_CROSS) { if(cursor != 2) { setc(0, 9); if(assign_flash_zero() < 0) Exit("\n Error in 'flash0:/' assign."); { if(cursor == 0)//Install Mod Module { flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_install_X_icon, size__660_install_X_icon); } else if(cursor == 1)//Restore Original Module flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_original_X_icon, size__660_original_X_icon); } } else Exit(""); break; } else if(Buttons & PSP_CTRL_UP) cursor--; else if(Buttons & PSP_CTRL_DOWN) cursor++; } Exit("Done."); sceKernelExitGame(); return 0; }
int quiz_test() { int i=0,j,k,stat_fast=0; time_t t1,t2,t3; char sql[100]; score = 0; t1 = time(0); while (1) { int level, style, anscount, order[100], order2[100], tout=0; char question[200], ans[6][200], answer[100], now[100], input[6]; t2 = time(0); set_alarm(30, 0, ktimeout, NULL); do { j=rand()%10000+1; sprintf(sql, "SELECT * FROM quiz WHERE id=%d", j); mysql_real_query(&s, sql, strlen(sql)); res = mysql_store_result(&s); row = mysql_fetch_row(res); } while (row==NULL); level = atoi(row[1]); style = atoi(row[2]); strcpy(question, row[3]); anscount = atoi(row[4]); for (j=0;j<anscount;j++) order2[j]=0; for (j=0;j<anscount;j++) { do { k=rand()%anscount; } while (order2[k]==1); order2[k]=1; order[j]=k; } for (j=0;j<anscount;j++) { strcpy(ans[j], row[5+order[j]]); } answer[6]=0; for (j=0;j<6;j++) answer[j]='0'; for (j=0;j<anscount;j++) answer[j]=row[11][order[j]]; mysql_free_result(res); clear(); move(0,0); setfcolor(YELLOW, 1); setbcolor(BLUE); prints(" 开心词典测试(\x1b[31mHAPPYQUIZ\x1b[33m) 测试人:%s 目前得分:\x1b[31m%d\x1b[33m 题号:%d 分值:%d 类型:%s", getCurrentUser()->userid, score, i+1, level, (style==1)?"单选":"多选"); clrtoeol(); for (j=0;j<6;j++) now[j]='0'; now[6]=0; while (1) { char bb[100]; resetcolor(); move(2,0); if (strlen(question)<70) prints("%s", question); else { char q2[100]; strcpy(q2,question+70); question[70]=0; prints("%s\n%s", question, q2); } for (j=0;j<anscount;j++) { move(4+j,0); clrtoeol(); prints("%c. %s %s", 'A'+j, ans[j], (now[j]=='1')?"*":""); } sprintf(bb, "请选择:(A-%c,回车结束)", anscount+'A'-1); getdata(anscount+6, 0, bb, input, 3, 1, NULL, 1); if (kicked) break; input[0] = toupper(input[0]); if (input[0]>='A'&&input[0]<anscount+'A') { if (now[input[0]-'A']=='1') now[input[0]-'A']='0'; else now[input[0]-'A']='1'; if (style==1) break; } else if (input[0]==0&&style==2) break; else { getdata(anscount+7, 0, "退出测试:(Y/N)", input, 3, 1, NULL, 1); if (toupper(input[0])=='Y') { set_alarm(0, 0, NULL, NULL); kicked = 0; return 0; } } } if (kicked) tout=1; set_alarm(0, 0, NULL, NULL); kicked = 0; t3 = time(0); if (t3-t2<=10) stat_fast++; else stat_fast=0; if (strcmp(now, answer)||stat_fast>=10||t3-t1>=7200) { move(anscount+8, 0); setfcolor(RED, 1); if (tout) prints("你超时了\n"); else prints("你答错啦\n"); setfcolor(BLUE, 1); prints(" ,\n"); prints(" (╰╮╮\n"); prints("∞╭⌒ヽ ..\n"); prints("╰( (_Q\n"); prints(" ∨~∨∨\n"); break; } else { move(anscount+8, 0); setfcolor(RED, 1); prints("正确!"); refresh(); sleep(1); i++; score+=level; } } set_alarm(0, 0, NULL, NULL); return 0; }