void PSPSaveDialog::DisplayEnterBack() { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawImage(okButtonImg, 180, 257, 11, 11, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawImage(cancelButtonImg, 270, 257, 11, 11, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("Enter"), 195, 255, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("Back"), 285, 255, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); }
void DebugStats() { gpu->UpdateStats(); char stats[2048]; sprintf(stats, "Frames: %i\n" "DL processing time: %0.2f ms\n" "Kernel processing time: %0.2f ms\n" "Slowest syscall: %s : %0.2f ms\n" "Most active syscall: %s : %0.2f ms\n" "Draw calls: %i, flushes %i\n" "Cached Draw calls: %i\n" "Num Tracked Vertex Arrays: %i\n" "Vertices Submitted: %i\n" "Cached Vertices Drawn: %i\n" "Uncached Vertices Drawn: %i\n" "FBOs active: %i\n" "Textures active: %i, decoded: %i\n" "Texture invalidations: %i\n" "Vertex shaders loaded: %i\n" "Fragment shaders loaded: %i\n" "Combined shaders loaded: %i\n", gpuStats.numFrames, gpuStats.msProcessingDisplayLists * 1000.0f, kernelStats.msInSyscalls * 1000.0f, kernelStats.slowestSyscallName ? kernelStats.slowestSyscallName : "(none)", kernelStats.slowestSyscallTime * 1000.0f, kernelStats.summedSlowestSyscallName ? kernelStats.summedSlowestSyscallName : "(none)", kernelStats.summedSlowestSyscallTime * 1000.0f, gpuStats.numDrawCalls, gpuStats.numFlushes, gpuStats.numCachedDrawCalls, gpuStats.numTrackedVertexArrays, gpuStats.numVertsSubmitted, gpuStats.numCachedVertsDrawn, gpuStats.numUncachedVertsDrawn, gpuStats.numFBOs, gpuStats.numTextures, gpuStats.numTexturesDecoded, gpuStats.numTextureInvalidations, gpuStats.numVertexShaders, gpuStats.numFragmentShaders, gpuStats.numShaders ); float zoom = 0.3f; /// g_Config.iWindowZoom; float soff = 0.3f; PPGeBegin(); PPGeDrawText(stats, soff, soff, 0, zoom, 0xCC000000); PPGeDrawText(stats, -soff, -soff, 0, zoom, 0xCC000000); PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFFFFFFF); PPGeEnd(); gpuStats.resetFrame(); kernelStats.ResetFrame(); }
void PSPSaveDialog::DisplaySaveDataInfo2() { lock_guard guard(paramLock); if (param.GetFileInfo(currentSelectedSave).size == 0) { } else { char txt[1024]; char date[256]; char am_pm[] = "AM"; char hour_time[10] ; int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour; int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min; switch (g_Config.iTimeFormat) { case 1: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); break; case 2: snprintf(hour_time,10,"%02d:%02d", hour, min); break; default: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); } const char *saveTitle = param.GetFileInfo(currentSelectedSave).saveTitle; int day = param.GetFileInfo(currentSelectedSave).modif_time.tm_mday; int month = param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1; int year = param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900; s64 sizeK = param.GetFileInfo(currentSelectedSave).size / 1024; switch (g_Config.iDateFormat) { case 1: snprintf(date, 256, "%d/%02d/%02d", year, month, day); break; case 2: snprintf(date, 256, "%02d/%02d/%d", month, day, year); break; case 3: snprintf(date, 256, "%02d/%02d/%d", day, month, year); break; default: snprintf(date, 256, "%d/%02d/%02d", year, month, day); } snprintf(txt, 1024, "%s\n%s %s\n%lld KB", saveTitle, date, hour_time, sizeK); std::string saveinfoTxt = txt; PPGeDrawText(saveinfoTxt.c_str(), 9, 202, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000)); PPGeDrawText(saveinfoTxt.c_str(), 8, 200, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); } }
void PSPSaveDialog::DisplaySaveDataInfo1() { if(param.GetFileInfo(currentSelectedSave).size == 0) { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawText(d->T("New Save"), 180, 100, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); } else { char title[512]; char time[512]; char saveTitle[512]; char saveDetail[512]; char am_pm[] = "AM"; char hour_time[10] ; int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour ; int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min ; if (g_Config.itimeformat) { if( hour > 12 ) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); } else snprintf(hour_time,10,"%02d:%02d", hour, min); snprintf(title,512,"%s", param.GetFileInfo(currentSelectedSave).title); snprintf(time,512,"%02d/%02d/%d %s %lld KB" , param.GetFileInfo(currentSelectedSave).modif_time.tm_mday , param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1 , param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900 , hour_time , param.GetFileInfo(currentSelectedSave).size / 1024 ); snprintf(saveTitle,512,"%s", param.GetFileInfo(currentSelectedSave).saveTitle); snprintf(saveDetail,512,"%s", param.GetFileInfo(currentSelectedSave).saveDetail); PPGeDrawRect(180, 139, 980, 140, CalcFadedColor(0xFFFFFFFF)); std::string titleTxt = title; std::string timeTxt = time; std::string saveTitleTxt = saveTitle; std::string saveDetailTxt = saveDetail; PPGeDrawText(titleTxt.c_str(), 180, 120, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFC0C0C0)); PPGeDrawText(timeTxt.c_str(), 180, 141, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveTitleTxt.c_str(), 175, 163, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveDetailTxt.c_str(), 175, 185, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); } }
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo) { const float WRAP_WIDTH = 300.0f; float y = 125.0f; float h; int n; PPGeMeasureText(0, &h, &n, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float h2 = h * (float)n / 2.0f; if (hasYesNo) { I18NCategory *d = GetI18NCategory("Dialog"); const char *choiceText; u32 yesColor, noColor; float x, w; if (yesnoChoice == 1) { choiceText = d->T("Yes"); x = 208.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } else { choiceText = d->T("No"); x = 272.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } PPGeMeasureText(&w, &h, 0, choiceText, FONT_SCALE); w = w / 2.0f + 5.5f; h /= 2.0f; float y2 = y + h2 + 30.0f; h2 += h + 4.0f; y = 132.0f - h; PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF)); PPGeDrawText(d->T("Yes"), 209.0f, y2+3, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000)); PPGeDrawText(d->T("Yes"), 208.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(yesColor)); PPGeDrawText(d->T("No"), 273.0f, y2+3, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000)); PPGeDrawText(d->T("No"), 272.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(noColor)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } } PPGeDrawTextWrapped(text.c_str(), 241.0f, y+3, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000)); PPGeDrawTextWrapped(text.c_str(), 240.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); float sy = 110.0f - h2, ey = 160.0f + h2; PPGeDrawRect(50.0f, sy, 420.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(50.0f, ey, 420.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF)); }
void PSPOskDialog::RenderKeyboard() { int selectedRow = selectedChar / KEYSPERROW; int selectedExtra = selectedChar % KEYSPERROW; char temp[2]; temp[1] = '\0'; u32 limit = oskData.outtextlimit; // TODO: Test more thoroughly. Encountered a game where this was 0. if (limit <= 0) limit = 16; const float keyboardLeftSide = (480.0f - (23.0f * KEYSPERROW)) / 2.0f; float previewLeftSide = (480.0f - (15.0f * limit)) / 2.0f; float title = (480.0f - (7.0f * limit)) / 2.0f; PPGeDrawText(oskDesc.c_str(), title , 20, PPGE_ALIGN_CENTER, 0.5f, CalcFadedColor(0xFFFFFFFF)); for (u32 i = 0; i < limit; ++i) { u32 color = CalcFadedColor(0xFFFFFFFF); if (i < inputChars.size()) temp[0] = inputChars[i]; else if (i == inputChars.size()) { temp[0] = oskKeys[selectedRow][selectedExtra]; color = CalcFadedColor(0xFF3060FF); } else temp[0] = '_'; PPGeDrawText(temp, previewLeftSide + (i * 16.0f), 40.0f, 0, 0.5f, color); } for (int row = 0; row < NUMKEYROWS; ++row) { for (int col = 0; col < KEYSPERROW; ++col) { u32 color = CalcFadedColor(0xFFFFFFFF); if (selectedRow == row && col == selectedExtra) color = CalcFadedColor(0xFF7f7f7f); temp[0] = oskKeys[row][col]; PPGeDrawText(temp, keyboardLeftSide + (25.0f * col), 70.0f + (25.0f * row), 0, 0.6f, color); if (selectedRow == row && col == selectedExtra) PPGeDrawText("_", keyboardLeftSide + (25.0f * col), 70.0f + (25.0f * row), 0, 0.6f, CalcFadedColor(0xFFFFFFFF)); } } }
void PSPSaveDialog::DisplayMessage(std::string text, bool hasYesNo) { const float WRAP_WIDTH = 254.0f; float y = 136.0f, h; int n; PPGeMeasureText(0, &h, &n, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float h2 = h * (float)n / 2.0f; if (hasYesNo) { I18NCategory *di = GetI18NCategory("Dialog"); const char *choiceText; u32 yesColor, noColor; float x, w; if (yesnoChoice == 1) { choiceText = di->T("Yes"); x = 302.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } else { choiceText = di->T("No"); x = 366.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } PPGeMeasureText(&w, &h, 0, choiceText, FONT_SCALE); w = w / 2.0f + 5.5f; h /= 2.0f; float y2 = y + h2 + 4.0f; h2 += h + 4.0f; y = 132.0f - h; PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x40C0C0C0)); PPGeDrawText(di->T("Yes"), 303.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawText(di->T("Yes"), 302.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(yesColor)); PPGeDrawText(di->T("No"), 367.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawText(di->T("No"), 366.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(noColor)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } } PPGeDrawTextWrapped(text.c_str(), 335.0f, y+2, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawTextWrapped(text.c_str(), 334.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); float sy = 122.0f - h2, ey = 150.0f + h2; PPGeDrawRect(202.0f, sy, 466.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(202.0f, ey, 466.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF)); }
void PSPMsgDialog::DisplayYesNo() { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawText(d->T("Yes"), 200, 150, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(yesnoChoice == 1?0xFF0000FF:0xFFFFFFFF)); PPGeDrawText(d->T("No"), 320, 150, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(yesnoChoice == 0?0xFF0000FF:0xFFFFFFFF)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } }
void PSPMsgDialog::DisplayYesNo() { PPGeDrawText("Yes", 200, 150, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(yesnoChoice == 1?0xFF0000FF:0xFFFFFFFF)); PPGeDrawText("No", 320, 150, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(yesnoChoice == 0?0xFF0000FF:0xFFFFFFFF)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } }
void PSPSaveDialog::DisplaySaveDataInfo2() { if(param.GetFileInfo(currentSelectedSave).size == 0) { } else { char txt[1024]; char am_pm[] = "AM"; char hour_time[10] ; int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour ; int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min ; if (g_Config.itimeformat) { if( hour > 12 ) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); } else snprintf(hour_time,10,"%02d:%02d", hour, min); snprintf(txt,1024,"%s\n%02d/%02d/%d %s\n%lld KB" , param.GetFileInfo(currentSelectedSave).saveTitle , param.GetFileInfo(currentSelectedSave).modif_time.tm_mday , param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1 , param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900 , hour_time , param.GetFileInfo(currentSelectedSave).size / 1024 ); std::string saveinfoTxt = txt; PPGeDrawText(saveinfoTxt.c_str(), 10, 180, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); } }
void PSPSaveDialog::DisplayConfirmationYesNo(std::string text) { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawRect(180, 105, 460, 106, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(180, 160, 460, 161, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(text.c_str(), 220, 110, PPGE_ALIGN_LEFT, 0.45f, 0xFFFFFFFF); PPGeDrawText(d->T("Yes"), 250, 140, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(yesnoChoice == 1?0xFF0000FF:0xFFFFFFFF)); PPGeDrawText(d->T("No"), 350, 140, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(yesnoChoice == 0?0xFF0000FF:0xFFFFFFFF)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } }
void PSPNetconfDialog::DrawBanner() { PPGeDrawRect(0, 0, 480, 23, CalcFadedColor(0x65636358)); // TODO: Draw a hexagon icon PPGeDrawImage(10, 6, 12.0f, 12.0f, 1, 10, 1, 10, 10, 10, CalcFadedColor(0xFFFFFFFF)); I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawText(d->T("Network Connection"), 30, 11, PPGE_ALIGN_VCENTER, 0.6f, CalcFadedColor(0xFFFFFFFF)); }
int PSPNetconfDialog::Update(int animSpeed) { UpdateButtons(); I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *err = GetI18NCategory("Error"); const float WRAP_WIDTH = 254.0f; const int confirmBtnImage = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? I_CROSS : I_CIRCLE; const int confirmBtn = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CROSS : CTRL_CIRCLE; if (status == SCE_UTILITY_STATUS_INITIALIZE) { status = SCE_UTILITY_STATUS_RUNNING; } else if (status == SCE_UTILITY_STATUS_RUNNING && (request.netAction == NETCONF_CONNECT_APNET || request.netAction == NETCONF_STATUS_APNET)) { UpdateFade(animSpeed); StartDraw(); DrawBanner(); PPGeDrawRect(0, 0, 480, 272, CalcFadedColor(0x63636363)); PPGeDrawTextWrapped(err->T("PPSSPPDoesNotSupportInternet", "PPSSPP currently does not support connecting to the Internet for DLC, PSN, or game updates."), 241, 132, WRAP_WIDTH, PPGE_ALIGN_CENTER, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawImage(confirmBtnImage, 195, 250, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("OK"), 225, 252, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); if (IsButtonPressed(confirmBtn)) { StartFade(false); status = SCE_UTILITY_STATUS_FINISHED; // TODO: When the dialog is aborted, does it really set the result to this? // It seems to make Phantasy Star Portable 2 happy, so it should be okay for now. request.common.result = SCE_UTILITY_DIALOG_RESULT_ABORT; } } else if (status == SCE_UTILITY_STATUS_RUNNING && (request.netAction == NETCONF_CONNECT_ADHOC || request.netAction == NETCONF_CREATE_ADHOC || request.netAction == NETCONF_JOIN_ADHOC)) { if (request.NetconfData != NULL) { Shutdown(true); if (sceNetAdhocctlCreate(request.NetconfData->groupName) == 0) { status = SCE_UTILITY_STATUS_FINISHED; return 0; } return -1; } } else if (status == SCE_UTILITY_STATUS_FINISHED) { status = SCE_UTILITY_STATUS_SHUTDOWN; } EndDraw(); return 0; }
void CalculateFPS() { static double highestFps = 0.0; static int lastFpsFrame = 0; static double lastFpsTime = 0.0; static double fps = 0.0; time_update(); double now = time_now_d(); if (now >= lastFpsTime + 1.0) { fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime); if (fps > highestFps) highestFps = fps; lastFpsFrame = gpuStats.numFrames; lastFpsTime = now; } char stats[50]; sprintf(stats, "VPS: %0.1f", fps); #ifdef USING_GLES2 float zoom = 0.7f; /// g_Config.iWindowZoom; float soff = 0.7f; #else float zoom = 0.5f; /// g_Config.iWindowZoom; float soff = 0.5f; #endif PPGeBegin(); PPGeDrawText(stats, 476 + soff, 4 + soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476 + -soff, 4 -soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476, 4, PPGE_ALIGN_RIGHT, zoom, 0xFF30FF30); PPGeEnd(); }
void PSPSaveDialog::DisplayBanner(int which) { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawRect(0, 0, 480, 23, CalcFadedColor(0x65636358)); const char *title; switch (which) { case DB_SAVE: title = d->T("Save"); break; case DB_LOAD: title = d->T("Load"); break; case DB_DELETE: title = d->T("Delete"); break; default: title = ""; break; } // TODO: Draw a hexagon icon PPGeDrawText(title, 30, 11, PPGE_ALIGN_VCENTER, 0.6f, CalcFadedColor(0xFFFFFFFF)); }
int PSPOskDialog::Update() { buttons = __CtrlReadLatch(); int selectedRow = selectedChar / KEYSPERROW; int selectedExtra = selectedChar % KEYSPERROW; u32 limit = oskData.outtextlimit; // TODO: Test more thoroughly. Encountered a game where this was 0. if (limit <= 0) limit = 16; if (status == SCE_UTILITY_STATUS_INITIALIZE) { status = SCE_UTILITY_STATUS_RUNNING; } else if (status == SCE_UTILITY_STATUS_RUNNING) { UpdateFade(); StartDraw(); RenderKeyboard(); PPGeDrawImage(I_CROSS, 100, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Select", 130, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawImage(I_CIRCLE, 200, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Delete", 230, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawImage(I_BUTTON, 290, 220, 50, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Start", 305, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Finish", 350, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); if (IsButtonPressed(CTRL_UP)) { selectedChar -= KEYSPERROW; } else if (IsButtonPressed(CTRL_DOWN)) { selectedChar += KEYSPERROW; } else if (IsButtonPressed(CTRL_LEFT)) { selectedChar--; if (((selectedChar + KEYSPERROW) % KEYSPERROW) == KEYSPERROW - 1) selectedChar += KEYSPERROW; } else if (IsButtonPressed(CTRL_RIGHT)) { selectedChar++; if ((selectedChar % KEYSPERROW) == 0) selectedChar -= KEYSPERROW; } selectedChar = (selectedChar + NUMBEROFVALIDCHARS) % NUMBEROFVALIDCHARS; if (IsButtonPressed(CTRL_CROSS)) { if (inputChars.size() < limit) inputChars += oskKeys[selectedRow][selectedExtra]; } else if (IsButtonPressed(CTRL_CIRCLE)) { if (inputChars.size() > 0) inputChars.resize(inputChars.size() - 1); } else if (IsButtonPressed(CTRL_START)) { StartFade(false); } EndDraw(); } else if (status == SCE_UTILITY_STATUS_FINISHED) { status = SCE_UTILITY_STATUS_SHUTDOWN; } for (u32 i = 0; i < limit; ++i) { u16 value = 0; if (i < inputChars.size()) value = 0x0000 ^ inputChars[i]; Memory::Write_U16(value, oskData.outtextPtr + (2 * i)); } oskData.outtextlength = inputChars.size(); oskParams.base.result= 0; oskData.result = PSP_UTILITY_OSK_RESULT_CHANGED; Memory::WriteStruct(oskParams.SceUtilityOskDataPtr, &oskData); Memory::WriteStruct(oskParamsAddr, &oskParams); return 0; }
void PSPSaveDialog::DisplaySaveDataInfo1() { if (param.GetFileInfo(currentSelectedSave).size == 0) { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawText(d->T("NEW DATA"), 180, 136, PPGE_ALIGN_VCENTER, 0.6f, CalcFadedColor(0xFFFFFFFF)); } else { char title[512]; char time[512]; char saveTitle[512]; char saveDetail[512]; char am_pm[] = "AM"; char hour_time[10] ; int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour; int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min; switch (g_Config.iTimeFormat) { case 1: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); break; case 2: snprintf(hour_time,10,"%02d:%02d", hour, min); break; default: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); } snprintf(title, 512, "%s", param.GetFileInfo(currentSelectedSave).title); int day = param.GetFileInfo(currentSelectedSave).modif_time.tm_mday; int month = param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1; int year = param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900; s64 sizeK = param.GetFileInfo(currentSelectedSave).size / 1024; switch (g_Config.iDateFormat) { case 1: snprintf(time, 512, "%d/%02d/%02d %s %lld KB", year, month, day, hour_time, sizeK); break; case 2: snprintf(time, 512, "%02d/%02d/%d %s %lld KB", month, day, year, hour_time, sizeK); break; case 3: snprintf(time, 512, "%02d/%02d/%d %s %lld KB", day, month, year, hour_time, sizeK); break; default: snprintf(time, 512, "%d/%02d/%02d %s %lld KB", year, month, day, hour_time, sizeK); } snprintf(saveTitle, 512, "%s", param.GetFileInfo(currentSelectedSave).saveTitle); snprintf(saveDetail, 512, "%s", param.GetFileInfo(currentSelectedSave).saveDetail); PPGeDrawRect(180, 136, 980, 137, CalcFadedColor(0xFFFFFFFF)); std::string titleTxt = title; std::string timeTxt = time; std::string saveTitleTxt = saveTitle; std::string saveDetailTxt = saveDetail; PPGeDrawText(titleTxt.c_str(), 181, 138, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0x80000000)); PPGeDrawText(titleTxt.c_str(), 180, 136, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0xFFC0C0C0)); PPGeDrawText(timeTxt.c_str(), 181, 139, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000)); PPGeDrawText(timeTxt.c_str(), 180, 137, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveTitleTxt.c_str(), 176, 162, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0x80000000)); PPGeDrawText(saveTitleTxt.c_str(), 175, 159, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveDetailTxt.c_str(), 176, 183, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000)); PPGeDrawText(saveDetailTxt.c_str(), 175, 181, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); } }
void PSPMsgDialog::DisplayEnter() { PPGeDrawImage(okButtonImg, 200, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Enter", 230, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void PSPMsgDialog::DisplayOk() { PPGeDrawText("OK", 250, 150, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFF0000FF)); }
void PSPSaveDialog::DisplayInfo(std::string text) { PPGeDrawRect(180, 105, 460, 106, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(180, 130, 460, 131, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(text.c_str(), 270, 110, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); }
void PSPMsgDialog::DisplayBack() { PPGeDrawImage(cancelButtonImg, 290, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Back", 320, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void hleEnterVblank(u64 userdata, int cyclesLate) { int vbCount = userdata; DEBUG_LOG(HLE, "Enter VBlank %i", vbCount); isVblank = 1; // Fire the vblank listeners before we wake threads. __DisplayFireVblank(); // Wake up threads waiting for VBlank for (size_t i = 0; i < vblankWaitingThreads.size(); i++) { if (--vblankWaitingThreads[i].vcountUnblock == 0) { __KernelResumeThreadFromWait(vblankWaitingThreads[i].threadID, 0); vblankWaitingThreads.erase(vblankWaitingThreads.begin() + i--); } } // Trigger VBlank interrupt handlers. __TriggerInterrupt(PSP_INTR_IMMEDIATE | PSP_INTR_ONLY_IF_ENABLED | PSP_INTR_ALWAYS_RESCHED, PSP_VBLANK_INTR, PSP_INTR_SUB_ALL); CoreTiming::ScheduleEvent(msToCycles(vblankMs) - cyclesLate, leaveVblankEvent, vbCount + 1); // TODO: Should this be done here or in hleLeaveVblank? if (framebufIsLatched) { DEBUG_LOG(HLE, "Setting latched framebuffer %08x (prev: %08x)", latchedFramebuf.topaddr, framebuf.topaddr); framebuf = latchedFramebuf; framebufIsLatched = false; gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); } gpuStats.numFrames++; // Now we can subvert the Ge engine in order to draw custom overlays like stat counters etc. if (g_Config.bShowDebugStats && gpuStats.numDrawCalls) { DebugStats(); } if (g_Config.bShowFPSCounter) { char stats[50]; sprintf(stats, "%0.1f", calculateFPS()); #ifdef USING_GLES2 float zoom = 0.7f; /// g_Config.iWindowZoom; float soff = 0.7f; #else float zoom = 0.5f; /// g_Config.iWindowZoom; float soff = 0.5f; #endif PPGeBegin(); PPGeDrawText(stats, 476 + soff, 4 + soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476 + -soff, 4 -soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476, 4, PPGE_ALIGN_RIGHT, zoom, 0xFF30FF30); PPGeEnd(); } // Draw screen overlays before blitting. Saves and restores the Ge context. // Yeah, this has to be the right moment to end the frame. Give the graphics backend opportunity // to blit the framebuffer, in order to support half-framerate games that otherwise wouldn't have // anything to draw here. gstate_c.skipDrawReason &= ~SKIPDRAW_SKIPFRAME; bool throttle, skipFrame, skipFlip; DoFrameTiming(throttle, skipFrame, skipFlip); // Setting CORE_NEXTFRAME causes a swap. if (skipFrame) { gstate_c.skipDrawReason |= SKIPDRAW_SKIPFRAME; numSkippedFrames++; } else { numSkippedFrames = 0; } if (!skipFlip) { // Might've just quit / been paused. if (coreState == CORE_RUNNING) { coreState = CORE_NEXTFRAME; } CoreTiming::ScheduleEvent(0 - cyclesLate, afterFlipEvent, 0); gpu->CopyDisplayToOutput(); } // Returning here with coreState == CORE_NEXTFRAME causes a buffer flip to happen (next frame). // Right after, we regain control for a little bit in hleAfterFlip. I think that's a great // place to do housekeeping. }
void hleEnterVblank(u64 userdata, int cyclesLate) { int vbCount = userdata; DEBUG_LOG(HLE, "Enter VBlank %i", vbCount); isVblank = 1; // Fire the vblank listeners before we wake threads. __DisplayFireVblank(); // Wake up threads waiting for VBlank for (size_t i = 0; i < vblankWaitingThreads.size(); i++) { __KernelResumeThreadFromWait(vblankWaitingThreads[i].threadID, 0); } vblankWaitingThreads.clear(); // Trigger VBlank interrupt handlers. __TriggerInterrupt(PSP_INTR_IMMEDIATE | PSP_INTR_ONLY_IF_ENABLED, PSP_VBLANK_INTR); CoreTiming::ScheduleEvent(msToCycles(vblankMs) - cyclesLate, leaveVblankEvent, vbCount+1); // TODO: Should this be done here or in hleLeaveVblank? if (framebufIsLatched) { DEBUG_LOG(HLE, "Setting latched framebuffer %08x (prev: %08x)", latchedFramebuf.topaddr, framebuf.topaddr); framebuf = latchedFramebuf; framebufIsLatched = false; gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); } // Draw screen overlays before blitting. Saves and restores the Ge context. gpuStats.numFrames++; // Yeah, this has to be the right moment to end the frame. Give the graphics backend opportunity // to blit the framebuffer, in order to support half-framerate games that otherwise wouldn't have // anything to draw here. gpu->CopyDisplayToOutput(); // Now we can subvert the Ge engine in order to draw custom overlays like stat counters etc. // Here we will be drawing to the non buffered front surface. if (g_Config.bShowDebugStats && gpuStats.numDrawCalls) { gpu->UpdateStats(); char stats[512]; sprintf(stats, "Frames: %i\n" "Draw calls: %i\n" "Draw flushes: %i\n" "Vertices Transformed: %i\n" "Textures active: %i\n" "Textures decoded: %i\n" "Vertex shaders loaded: %i\n" "Fragment shaders loaded: %i\n" "Combined shaders loaded: %i\n", gpuStats.numFrames, gpuStats.numDrawCalls, gpuStats.numFlushes, gpuStats.numVertsTransformed, gpuStats.numTextures, gpuStats.numTexturesDecoded, gpuStats.numVertexShaders, gpuStats.numFragmentShaders, gpuStats.numShaders ); float zoom = 0.7f; /// g_Config.iWindowZoom; PPGeBegin(); PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFc0c0c0); PPGeEnd(); gpuStats.resetFrame(); } host->EndFrame(); #ifdef _WIN32 static double lastFrameTime = 0.0; // Best place to throttle the frame rate on non vsynced platforms is probably here. Let's try it. time_update(); if (lastFrameTime == 0.0) lastFrameTime = time_now_d(); if (!GetAsyncKeyState(VK_TAB)) { while (time_now_d() < lastFrameTime + 1.0 / 60.0) { Common::SleepCurrentThread(1); time_update(); } // Advance lastFrameTime by a constant amount each frame, // but don't let it get too far behind. lastFrameTime = std::max(lastFrameTime + 1.0 / 60.0, time_now_d() - 1.5 / 60.0); } // We are going to have to do something about audio timing for platforms that // are vsynced to something that's not exactly 60fps.. #endif host->BeginFrame(); gpu->BeginFrame(); // Tell the emu core that it's time to stop emulating // Win32 doesn't need this. #ifndef _WIN32 coreState = CORE_NEXTFRAME; #endif }
void PSPDialog::DisplayMessage(std::string text) { PPGeDrawRect(30, 50, 450, 51, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(30, 200, 450, 201, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(text.c_str(), 40, 60, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void PSPSaveDialog::DisplayTitle(std::string name) { PPGeDrawText(name.c_str(), 10, 10, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); }
void hleEnterVblank(u64 userdata, int cyclesLate) { int vbCount = userdata; DEBUG_LOG(HLE, "Enter VBlank %i", vbCount); isVblank = 1; // Fire the vblank listeners before we wake threads. __DisplayFireVblank(); // Wake up threads waiting for VBlank for (size_t i = 0; i < vblankWaitingThreads.size(); i++) { if (--vblankWaitingThreads[i].vcountUnblock == 0) { __KernelResumeThreadFromWait(vblankWaitingThreads[i].threadID, 0); vblankWaitingThreads.erase(vblankWaitingThreads.begin() + i--); } } // Trigger VBlank interrupt handlers. __TriggerInterrupt(PSP_INTR_IMMEDIATE | PSP_INTR_ONLY_IF_ENABLED | PSP_INTR_ALWAYS_RESCHED, PSP_VBLANK_INTR, PSP_INTR_SUB_ALL); CoreTiming::ScheduleEvent(msToCycles(vblankMs) - cyclesLate, leaveVblankEvent, vbCount+1); // TODO: Should this be done here or in hleLeaveVblank? if (framebufIsLatched) { DEBUG_LOG(HLE, "Setting latched framebuffer %08x (prev: %08x)", latchedFramebuf.topaddr, framebuf.topaddr); framebuf = latchedFramebuf; framebufIsLatched = false; gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); } // Draw screen overlays before blitting. Saves and restores the Ge context. gpuStats.numFrames++; // Now we can subvert the Ge engine in order to draw custom overlays like stat counters etc. if (g_Config.bShowDebugStats && gpuStats.numDrawCalls) { gpu->UpdateStats(); char stats[2048]; sprintf(stats, "Frames: %i\n" "DL processing time: %0.2f ms\n" "Kernel processing time: %0.2f ms\n" "Slowest syscall: %s : %0.2f ms\n" "Most active syscall: %s : %0.2f ms\n" "Draw calls: %i, flushes %i\n" "Cached Draw calls: %i\n" "Num Tracked Vertex Arrays: %i\n" "Vertices Submitted: %i\n" "Cached Vertices Drawn: %i\n" "Uncached Vertices Drawn: %i\n" "FBOs active: %i\n" "Textures active: %i, decoded: %i\n" "Texture invalidations: %i\n" "Vertex shaders loaded: %i\n" "Fragment shaders loaded: %i\n" "Combined shaders loaded: %i\n", gpuStats.numFrames, gpuStats.msProcessingDisplayLists * 1000.0f, kernelStats.msInSyscalls * 1000.0f, kernelStats.slowestSyscallName ? kernelStats.slowestSyscallName : "(none)", kernelStats.slowestSyscallTime * 1000.0f, kernelStats.summedSlowestSyscallName ? kernelStats.summedSlowestSyscallName : "(none)", kernelStats.summedSlowestSyscallTime * 1000.0f, gpuStats.numDrawCalls, gpuStats.numFlushes, gpuStats.numCachedDrawCalls, gpuStats.numTrackedVertexArrays, gpuStats.numVertsSubmitted, gpuStats.numCachedVertsDrawn, gpuStats.numUncachedVertsDrawn, gpuStats.numFBOs, gpuStats.numTextures, gpuStats.numTexturesDecoded, gpuStats.numTextureInvalidations, gpuStats.numVertexShaders, gpuStats.numFragmentShaders, gpuStats.numShaders ); float zoom = 0.3f; /// g_Config.iWindowZoom; float soff = 0.3f; PPGeBegin(); PPGeDrawText(stats, soff, soff, 0, zoom, 0xCC000000); PPGeDrawText(stats, -soff, -soff, 0, zoom, 0xCC000000); PPGeDrawText(stats, 0, 0, 0, zoom, 0xFFFFFFFF); PPGeEnd(); gpuStats.resetFrame(); kernelStats.ResetFrame(); } if (g_Config.bShowFPSCounter) { char stats[50]; sprintf(stats, "%0.1f", calculateFPS()); #ifdef USING_GLES2 float zoom = 0.7f; /// g_Config.iWindowZoom; float soff = 0.7f; #else float zoom = 0.5f; /// g_Config.iWindowZoom; float soff = 0.5f; #endif PPGeBegin(); PPGeDrawText(stats, 476 + soff, 4 + soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476 + -soff, 4 -soff, PPGE_ALIGN_RIGHT, zoom, 0xCC000000); PPGeDrawText(stats, 476, 4, PPGE_ALIGN_RIGHT, zoom, 0xFF30FF30); PPGeEnd(); } // Yeah, this has to be the right moment to end the frame. Give the graphics backend opportunity // to blit the framebuffer, in order to support half-framerate games that otherwise wouldn't have // anything to draw here. gpu->CopyDisplayToOutput(); host->EndFrame(); #ifdef _WIN32 // Best place to throttle the frame rate on non vsynced platforms is probably here. Let's try it. time_update(); if (lastFrameTime == 0.0) lastFrameTime = time_now_d(); if (!GetAsyncKeyState(VK_TAB) && !PSP_CoreParameter().headLess) { while (time_now_d() < lastFrameTime + 1.0 / 60.0) { Common::SleepCurrentThread(1); time_update(); } // Advance lastFrameTime by a constant amount each frame, // but don't let it get too far behind. lastFrameTime = std::max(lastFrameTime + 1.0 / 60.0, time_now_d() - 1.5 / 60.0); } // We are going to have to do something about audio timing for platforms that // are vsynced to something that's not exactly 60fps.. #endif host->BeginFrame(); gpu->BeginFrame(); // Tell the emu core that it's time to stop emulating // Win32 doesn't need this. #ifndef _WIN32 coreState = CORE_NEXTFRAME; #endif }
void PSPMsgDialog::DisplayBack() { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawImage(cancelButtonImg, 290, 220, 12, 12, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("Back"), 310, 218, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void PSPMsgDialog::DisplayOk() { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawImage(okButtonImg, 200, 220, 12, 12, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("Enter"), 220, 218, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void PSPDialog::DisplayMessage(std::string text) { PPGeDrawText(text.c_str(), 40, 30, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }
void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) { std::lock_guard<std::mutex> guard(paramLock); tm modif_time; const char *save_title; u32 data_size; if (showNewData || param.GetFileInfo(currentSelectedSave).size == 0) { time_t t; time(&t); localtime_r(&t, &modif_time); save_title = param.GetPspParam()->sfoParam.savedataTitle; // TODO: Account for icon, etc., etc. data_size = param.GetPspParam()->dataSize; } else { modif_time = param.GetFileInfo(currentSelectedSave).modif_time; save_title = param.GetFileInfo(currentSelectedSave).saveTitle; data_size = param.GetFileInfo(currentSelectedSave).size; } char date[256]; char am_pm[] = "AM"; char hour_time[10] ; int hour = modif_time.tm_hour; int min = modif_time.tm_min; switch (g_Config.iTimeFormat) { case 1: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time, 10, "%02d:%02d %s", hour, min, am_pm); break; case 2: snprintf(hour_time, 10, "%02d:%02d", hour, min); break; default: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time, 10, "%02d:%02d %s", hour, min, am_pm); } int day = modif_time.tm_mday; int month = modif_time.tm_mon + 1; int year = modif_time.tm_year + 1900; s64 sizeK = data_size / 1024; switch (g_Config.iDateFormat) { case 1: snprintf(date, 256, "%d/%02d/%02d", year, month, day); break; case 2: snprintf(date, 256, "%02d/%02d/%d", month, day, year); break; case 3: snprintf(date, 256, "%02d/%02d/%d", day, month, year); break; default: snprintf(date, 256, "%d/%02d/%02d", year, month, day); } std::string saveinfoTxt = StringFromFormat("%.128s\n%s %s\n%lld KB", save_title, date, hour_time, sizeK); PPGeDrawText(saveinfoTxt.c_str(), 9, 202, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000)); PPGeDrawText(saveinfoTxt.c_str(), 8, 200, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); }