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 PSPSaveDialog::DisplaySaveIcon() { int textureColor = CalcFadedColor(0xFFFFFFFF); if (param.GetFileInfo(currentSelectedSave).size == 0) textureColor = CalcFadedColor(0xFF777777); // Calc save image position on screen float w = 144; float h = 80; float x = 27; float y = 97; int tw = 256; int th = 256; if (param.GetFileInfo(currentSelectedSave).textureData != 0) { tw = param.GetFileInfo(currentSelectedSave).textureWidth; th = param.GetFileInfo(currentSelectedSave).textureHeight; PPGeSetTexture(param.GetFileInfo(currentSelectedSave).textureData, param.GetFileInfo(currentSelectedSave).textureWidth, param.GetFileInfo(currentSelectedSave).textureHeight); } else PPGeDisableTexture(); PPGeDrawImage(x, y, w, h, 0, 0 ,1 ,1 ,tw, th, textureColor); if (param.GetFileInfo(currentSelectedSave).textureData != 0) PPGeSetDefaultTexture(); }
void PSPSaveDialog::DisplaySaveIcon() { lock_guard guard(paramLock); int textureColor = CalcFadedColor(0xFFFFFFFF); auto curSave = param.GetFileInfo(currentSelectedSave); if (curSave.size == 0) textureColor = CalcFadedColor(0xFF777777); // Calc save image position on screen float w = 144; float h = 80; float x = 27; float y = 97; int tw = 256; int th = 256; if (curSave.texture != NULL) { curSave.texture->SetTexture(); tw = curSave.texture->Width(); th = curSave.texture->Height(); } else { PPGeDisableTexture(); } PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor); if (curSave.texture != NULL) PPGeSetDefaultTexture(); }
void PSPSaveDialog::DisplaySaveList(bool canMove) { lock_guard guard(paramLock); static int upFramesHeld = 0; static int downFramesHeld = 0; for (int displayCount = 0; displayCount < param.GetFilenameCount(); displayCount++) { int textureColor = 0xFFFFFFFF; auto fileInfo = param.GetFileInfo(displayCount); if (fileInfo.size == 0 && fileInfo.texture != NULL) textureColor = 0xFF777777; // Calc save image position on screen float w, h , x, b; float y = 97; if (displayCount != currentSelectedSave) { w = 81; h = 45; x = 58.5f; } else { w = 144; h = 80; x = 27; b = 1.2; PPGeDrawRect(x-b, y-b, x+w+b, y, CalcFadedColor(0xD0FFFFFF)); // top border PPGeDrawRect(x-b, y, x, y+h, CalcFadedColor(0xD0FFFFFF)); // left border PPGeDrawRect(x-b, y+h, x+w+b, y+h+b, CalcFadedColor(0xD0FFFFFF)); //bottom border PPGeDrawRect(x+w, y, x+w+b, y+h, CalcFadedColor(0xD0FFFFFF)); //right border } if (displayCount < currentSelectedSave) y -= 13 + 45 * (currentSelectedSave - displayCount); else if (displayCount > currentSelectedSave) y += 48 + 45 * (displayCount - currentSelectedSave); // Skip if it's well outside the screen. if (y > 472.0f || y < -200.0f) continue; int tw = 256; int th = 256; if (fileInfo.texture != NULL) { fileInfo.texture->SetTexture(); tw = fileInfo.texture->Width(); th = fileInfo.texture->Height(); PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor); } PPGeSetDefaultTexture(); } if (canMove) { if ( (IsButtonPressed(CTRL_UP) || IsButtonHeld(CTRL_UP, upFramesHeld)) && currentSelectedSave > 0) currentSelectedSave--; else if ( (IsButtonPressed(CTRL_DOWN) || IsButtonHeld(CTRL_DOWN, downFramesHeld)) && currentSelectedSave < (param.GetFilenameCount() - 1)) currentSelectedSave++; } }
void PSPSaveDialog::DisplaySaveList(bool canMove) { int displayCount = 0; for(int i = 0; i < param.GetFilenameCount(); i++) { int textureColor = CalcFadedColor(0xFFFFFFFF); if(param.GetFileInfo(i).size == 0 && param.GetFileInfo(i).textureData == 0) { textureColor = CalcFadedColor(0xFF777777); } // Calc save image position on screen float w = 150; float h = 80; float x = 20; if(displayCount != currentSelectedSave) { w = 80; h = 40; x = 55; } float y = 96; if(displayCount < currentSelectedSave) y -= 10 + 40 * (currentSelectedSave - displayCount ); else if(displayCount > currentSelectedSave) { y += 91 + 40 * (displayCount - currentSelectedSave - 1); } int tw = 256; int th = 256; if(param.GetFileInfo(i).textureData != 0) { tw = param.GetFileInfo(i).textureWidth; th = param.GetFileInfo(i).textureHeight; PPGeSetTexture(param.GetFileInfo(i).textureData, param.GetFileInfo(i).textureWidth, param.GetFileInfo(i).textureHeight); } else { PPGeDisableTexture(); } PPGeDrawImage(x, y, w, h, 0, 0 ,1 ,1 ,tw, th, textureColor); PPGeSetDefaultTexture(); displayCount++; } if(canMove) { if (IsButtonPressed(CTRL_UP) && currentSelectedSave > 0) { currentSelectedSave--; } else if (IsButtonPressed(CTRL_DOWN) && currentSelectedSave < (param.GetFilenameCount()-1)) { currentSelectedSave++; } } }
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)); }
void PSPSaveDialog::DisplaySaveList(bool canMove) { int displayCount = 0; for (int i = 0; i < param.GetFilenameCount(); i++) { int textureColor = 0xFFFFFFFF; if (param.GetFileInfo(i).size == 0 && param.GetFileInfo(i).textureData == 0) textureColor = 0xFF777777; // Calc save image position on screen float w, h , x, b; float y = 97; if (displayCount != currentSelectedSave) { w = 81; h = 45; x = 58.5f; } else { w = 144; h = 80; x = 27; b = 1.2; PPGeDrawRect(x-b, y-b, x+w+b, y, CalcFadedColor(0xD0FFFFFF)); // top border PPGeDrawRect(x-b, y, x, y+h, CalcFadedColor(0xD0FFFFFF)); // left border PPGeDrawRect(x-b, y+h, x+w+b, y+h+b, CalcFadedColor(0xD0FFFFFF)); //bottom border PPGeDrawRect(x+w, y, x+w+b, y+h, CalcFadedColor(0xD0FFFFFF)); //right border } if (displayCount < currentSelectedSave) y -= 13 + 45 * (currentSelectedSave - displayCount); else if (displayCount > currentSelectedSave) y += 48 + 45 * (displayCount - currentSelectedSave); int tw = 256; int th = 256; if (param.GetFileInfo(i).textureData != 0) { tw = param.GetFileInfo(i).textureWidth; th = param.GetFileInfo(i).textureHeight; PPGeSetTexture(param.GetFileInfo(i).textureData, param.GetFileInfo(i).textureWidth, param.GetFileInfo(i).textureHeight); PPGeDrawImage(x, y, w, h, 0, 0, 1, 1, tw, th, textureColor); } else PPGeDisableTexture(); PPGeSetDefaultTexture(); displayCount++; } if (canMove) { if (IsButtonPressed(CTRL_UP) && currentSelectedSave > 0) currentSelectedSave--; else if (IsButtonPressed(CTRL_DOWN) && currentSelectedSave < (param.GetFilenameCount()-1)) currentSelectedSave++; } }
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 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 PPGeDrawImage(10, 6, 12.0f, 12.0f, 1, 10, 1, 10, 10, 10, CalcFadedColor(0xFFFFFFFF)); 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 PSPMsgDialog::DisplayEnter() { PPGeDrawImage(okButtonImg, 200, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText("Enter", 230, 220, PPGE_ALIGN_LEFT, 0.5f, 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 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 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)); }