Replace the notifications with a bare-bones progress bar

This commit is contained in:
Henrik Rydgård 2023-08-17 14:42:25 +02:00
parent e00a41702c
commit 1cf2a161a0
3 changed files with 33 additions and 3 deletions

View file

@ -19,6 +19,7 @@
#include "Common/CommonTypes.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/System/OSD.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
@ -38,6 +39,8 @@ const static u32 GAMEDATA_BYTES_PER_READ = 32768;
// If this is too high, some games (e.g. Senjou no Valkyria 3) will lag.
const static u32 GAMEDATA_READS_PER_UPDATE = 20;
const u32 PSP_UTILITY_GAMEDATA_MODE_SHOW_PROGRESS = 1;
const u32 ERROR_UTILITY_GAMEDATA_MEMSTRICK_REMOVED = 0x80111901;
const u32 ERROR_UTILITY_GAMEDATA_MEMSTRICK_WRITE_PROTECTED = 0x80111903;
const u32 ERROR_UTILITY_GAMEDATA_INVALID_MODE = 0x80111908;
@ -272,13 +275,38 @@ void PSPGamedataInstallDialog::UpdateProgress() {
progressValue = (int)((allReadSize * 100) / allFilesSize);
else
progressValue = 100;
auto di = GetI18NCategory("Dialog");
std::string temp = di->T("Save");
osm.Show(temp + " " + std::to_string(progressValue) + " / 100", 0.5f);
if (param->mode == PSP_UTILITY_GAMEDATA_MODE_SHOW_PROGRESS) {
RenderProgress(progressValue);
}
param->progress = progressValue;
param.NotifyWrite("DialogResult");
}
void PSPGamedataInstallDialog::RenderProgress(int percentage) {
StartDraw();
float barWidth = 380;
float barX = (480 - barWidth) / 2;
float barWidthDone = barWidth * percentage / 100;
float barH = 10.0;
float barY = 272 / 2 - barH / 2;
PPGeDrawRect(barX - 3, barY - 3, barX + barWidth + 3, barY + barH + 3, 0x30000000);
PPGeDrawRect(barX, barY, barX + barWidth, barY + barH, 0xFF707070);
PPGeDrawRect(barX, barY, barX + barWidthDone, barY + barH, 0xFFE0E0E0);
auto di = GetI18NCategory(I18NCat::DIALOG);
fadeValue = 255;
PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_HCENTER, 0.6f);
PPGeDrawText(di->T("Installing..."), 480 / 2, barY + barH + 10, textStyle);
EndDraw();
}
void PSPGamedataInstallDialog::DoState(PointerWrap &p) {
auto s = p.Section("PSPGamedataInstallDialog", 0, 4);
if (!s)

View file

@ -54,6 +54,7 @@ protected:
private:
void UpdateProgress();
void RenderProgress(int percentage);
void OpenNextFile();
void CopyCurrentFileData();
void CloseCurrentFile();

View file

@ -395,6 +395,7 @@ Finish = Finish
GE Frame Dumps = GE Frame Dumps
Grid = Grid
Inactive = Inactive
Installing... = Installing...
InternalError = An internal error has occurred.
Load = Load
Load completed = Load completed.