Allow using a file browser to choose UMDs during disc change.
This commit is contained in:
parent
6d449139bf
commit
67cb466ee1
5 changed files with 29 additions and 18 deletions
|
@ -55,7 +55,7 @@ static int umdInsertChangeEvent = -1;
|
||||||
static std::vector<SceUID> umdWaitingThreads;
|
static std::vector<SceUID> umdWaitingThreads;
|
||||||
static std::map<SceUID, u64> umdPausedWaits;
|
static std::map<SceUID, u64> umdPausedWaits;
|
||||||
|
|
||||||
bool UMDReplacePermit = false;
|
bool g_UMDReplacePermit = false;
|
||||||
bool UMDInserted = true;
|
bool UMDInserted = true;
|
||||||
|
|
||||||
struct PspUmdInfo {
|
struct PspUmdInfo {
|
||||||
|
@ -80,6 +80,7 @@ void __UmdInit()
|
||||||
driveCBId = 0;
|
driveCBId = 0;
|
||||||
umdWaitingThreads.clear();
|
umdWaitingThreads.clear();
|
||||||
umdPausedWaits.clear();
|
umdPausedWaits.clear();
|
||||||
|
g_UMDReplacePermit = false;
|
||||||
|
|
||||||
__KernelRegisterWaitTypeFuncs(WAITTYPE_UMD, __UmdBeginCallback, __UmdEndCallback);
|
__KernelRegisterWaitTypeFuncs(WAITTYPE_UMD, __UmdBeginCallback, __UmdEndCallback);
|
||||||
}
|
}
|
||||||
|
@ -104,8 +105,8 @@ void __UmdDoState(PointerWrap &p)
|
||||||
Do(p, umdPausedWaits);
|
Do(p, umdPausedWaits);
|
||||||
|
|
||||||
if (s > 1) {
|
if (s > 1) {
|
||||||
Do(p, UMDReplacePermit);
|
Do(p, g_UMDReplacePermit);
|
||||||
if (UMDReplacePermit) {
|
if (g_UMDReplacePermit) {
|
||||||
System_Notify(SystemNotification::UI);
|
System_Notify(SystemNotification::UI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,14 +506,15 @@ void __UmdReplace(const Path &filepath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getUMDReplacePermit() {
|
bool getUMDReplacePermit() {
|
||||||
return UMDReplacePermit;
|
return g_UMDReplacePermit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceUmdReplaceProhibit()
|
static u32 sceUmdReplaceProhibit()
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SCEIO,"sceUmdReplaceProhibit()");
|
DEBUG_LOG(SCEIO, "sceUmdReplaceProhibit()");
|
||||||
if (UMDReplacePermit) {
|
if (g_UMDReplacePermit) {
|
||||||
UMDReplacePermit = false;
|
INFO_LOG(SCEIO, "sceUmdReplaceProhibit() - prohibited");
|
||||||
|
g_UMDReplacePermit = false;
|
||||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -520,9 +522,10 @@ static u32 sceUmdReplaceProhibit()
|
||||||
|
|
||||||
static u32 sceUmdReplacePermit()
|
static u32 sceUmdReplacePermit()
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SCEIO,"sceUmdReplacePermit()");
|
DEBUG_LOG(SCEIO, "sceUmdReplacePermit()");
|
||||||
if (!UMDReplacePermit) {
|
if (!g_UMDReplacePermit) {
|
||||||
UMDReplacePermit = true;
|
INFO_LOG(SCEIO, "sceUmdReplacePermit() - permitted");
|
||||||
|
g_UMDReplacePermit = true;
|
||||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1616,7 +1616,19 @@ void UmdReplaceScreen::CreateViews() {
|
||||||
|
|
||||||
tabAllGames->OnHoldChoice.Handle(this, &UmdReplaceScreen::OnGameSelected);
|
tabAllGames->OnHoldChoice.Handle(this, &UmdReplaceScreen::OnGameSelected);
|
||||||
|
|
||||||
|
if (System_GetPropertyBool(SYSPROP_HAS_FILE_BROWSER)) {
|
||||||
|
rightColumnItems->Add(new Choice(mm->T("Load", "Load...")))->OnClick.Add([&](UI::EventParams &e) {
|
||||||
|
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||||
|
System_BrowseForFile(mm->T("Load"), BrowseFileType::BOOTABLE, [&](const std::string &value, int) {
|
||||||
|
__UmdReplace(Path(value));
|
||||||
|
TriggerFinish(DR_OK);
|
||||||
|
});
|
||||||
|
return EVENT_DONE;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
rightColumnItems->Add(new Choice(di->T("Cancel")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
rightColumnItems->Add(new Choice(di->T("Cancel")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
||||||
|
rightColumnItems->Add(new Spacer());
|
||||||
rightColumnItems->Add(new Choice(mm->T("Game Settings")))->OnClick.Handle(this, &UmdReplaceScreen::OnGameSettings);
|
rightColumnItems->Add(new Choice(mm->T("Game Settings")))->OnClick.Handle(this, &UmdReplaceScreen::OnGameSettings);
|
||||||
|
|
||||||
if (g_Config.HasRecentIsos()) {
|
if (g_Config.HasRecentIsos()) {
|
||||||
|
|
|
@ -175,7 +175,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void CreateViews() override;
|
void CreateViews() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
//virtual void sendMessage(const char *message, const char *value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UI::EventReturn OnGameSelected(UI::EventParams &e);
|
UI::EventReturn OnGameSelected(UI::EventParams &e);
|
||||||
|
|
|
@ -352,7 +352,10 @@ void GamePauseScreen::CreateViews() {
|
||||||
|
|
||||||
rightColumnItems->SetSpacing(0.0f);
|
rightColumnItems->SetSpacing(0.0f);
|
||||||
if (getUMDReplacePermit()) {
|
if (getUMDReplacePermit()) {
|
||||||
rightColumnItems->Add(new Choice(pa->T("Switch UMD")))->OnClick.Handle(this, &GamePauseScreen::OnSwitchUMD);
|
rightColumnItems->Add(new Choice(pa->T("Switch UMD")))->OnClick.Add([=](UI::EventParams &) {
|
||||||
|
screenManager()->push(new UmdReplaceScreen());
|
||||||
|
return UI::EVENT_DONE;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Choice *continueChoice = rightColumnItems->Add(new Choice(pa->T("Continue")));
|
Choice *continueChoice = rightColumnItems->Add(new Choice(pa->T("Continue")));
|
||||||
root_->SetDefaultFocusView(continueChoice);
|
root_->SetDefaultFocusView(continueChoice);
|
||||||
|
@ -469,11 +472,6 @@ UI::EventReturn GamePauseScreen::OnLastSaveUndo(UI::EventParams &e) {
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::EventReturn GamePauseScreen::OnSwitchUMD(UI::EventParams &e) {
|
|
||||||
screenManager()->push(new UmdReplaceScreen());
|
|
||||||
return UI::EVENT_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GamePauseScreen::CallbackDeleteConfig(bool yes)
|
void GamePauseScreen::CallbackDeleteConfig(bool yes)
|
||||||
{
|
{
|
||||||
if (yes) {
|
if (yes) {
|
||||||
|
|
|
@ -60,7 +60,6 @@ private:
|
||||||
UI::EventReturn OnCreateConfig(UI::EventParams &e);
|
UI::EventReturn OnCreateConfig(UI::EventParams &e);
|
||||||
UI::EventReturn OnDeleteConfig(UI::EventParams &e);
|
UI::EventReturn OnDeleteConfig(UI::EventParams &e);
|
||||||
|
|
||||||
UI::EventReturn OnSwitchUMD(UI::EventParams &e);
|
|
||||||
UI::EventReturn OnState(UI::EventParams &e);
|
UI::EventReturn OnState(UI::EventParams &e);
|
||||||
|
|
||||||
// hack
|
// hack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue