mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-11 09:05:38 +00:00
Allow using a file browser to choose UMDs during disc change.
This commit is contained in:
parent
6d449139bf
commit
67cb466ee1
@ -55,7 +55,7 @@ static int umdInsertChangeEvent = -1;
|
||||
static std::vector<SceUID> umdWaitingThreads;
|
||||
static std::map<SceUID, u64> umdPausedWaits;
|
||||
|
||||
bool UMDReplacePermit = false;
|
||||
bool g_UMDReplacePermit = false;
|
||||
bool UMDInserted = true;
|
||||
|
||||
struct PspUmdInfo {
|
||||
@ -80,6 +80,7 @@ void __UmdInit()
|
||||
driveCBId = 0;
|
||||
umdWaitingThreads.clear();
|
||||
umdPausedWaits.clear();
|
||||
g_UMDReplacePermit = false;
|
||||
|
||||
__KernelRegisterWaitTypeFuncs(WAITTYPE_UMD, __UmdBeginCallback, __UmdEndCallback);
|
||||
}
|
||||
@ -104,8 +105,8 @@ void __UmdDoState(PointerWrap &p)
|
||||
Do(p, umdPausedWaits);
|
||||
|
||||
if (s > 1) {
|
||||
Do(p, UMDReplacePermit);
|
||||
if (UMDReplacePermit) {
|
||||
Do(p, g_UMDReplacePermit);
|
||||
if (g_UMDReplacePermit) {
|
||||
System_Notify(SystemNotification::UI);
|
||||
}
|
||||
}
|
||||
@ -505,14 +506,15 @@ void __UmdReplace(const Path &filepath) {
|
||||
}
|
||||
|
||||
bool getUMDReplacePermit() {
|
||||
return UMDReplacePermit;
|
||||
return g_UMDReplacePermit;
|
||||
}
|
||||
|
||||
static u32 sceUmdReplaceProhibit()
|
||||
{
|
||||
DEBUG_LOG(SCEIO,"sceUmdReplaceProhibit()");
|
||||
if (UMDReplacePermit) {
|
||||
UMDReplacePermit = false;
|
||||
DEBUG_LOG(SCEIO, "sceUmdReplaceProhibit()");
|
||||
if (g_UMDReplacePermit) {
|
||||
INFO_LOG(SCEIO, "sceUmdReplaceProhibit() - prohibited");
|
||||
g_UMDReplacePermit = false;
|
||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||
}
|
||||
return 0;
|
||||
@ -520,9 +522,10 @@ static u32 sceUmdReplaceProhibit()
|
||||
|
||||
static u32 sceUmdReplacePermit()
|
||||
{
|
||||
DEBUG_LOG(SCEIO,"sceUmdReplacePermit()");
|
||||
if (!UMDReplacePermit) {
|
||||
UMDReplacePermit = true;
|
||||
DEBUG_LOG(SCEIO, "sceUmdReplacePermit()");
|
||||
if (!g_UMDReplacePermit) {
|
||||
INFO_LOG(SCEIO, "sceUmdReplacePermit() - permitted");
|
||||
g_UMDReplacePermit = true;
|
||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1616,7 +1616,19 @@ void UmdReplaceScreen::CreateViews() {
|
||||
|
||||
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 Spacer());
|
||||
rightColumnItems->Add(new Choice(mm->T("Game Settings")))->OnClick.Handle(this, &UmdReplaceScreen::OnGameSettings);
|
||||
|
||||
if (g_Config.HasRecentIsos()) {
|
||||
|
@ -175,7 +175,6 @@ public:
|
||||
protected:
|
||||
void CreateViews() override;
|
||||
void update() override;
|
||||
//virtual void sendMessage(const char *message, const char *value);
|
||||
|
||||
private:
|
||||
UI::EventReturn OnGameSelected(UI::EventParams &e);
|
||||
|
@ -352,7 +352,10 @@ void GamePauseScreen::CreateViews() {
|
||||
|
||||
rightColumnItems->SetSpacing(0.0f);
|
||||
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")));
|
||||
root_->SetDefaultFocusView(continueChoice);
|
||||
@ -469,11 +472,6 @@ UI::EventReturn GamePauseScreen::OnLastSaveUndo(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GamePauseScreen::OnSwitchUMD(UI::EventParams &e) {
|
||||
screenManager()->push(new UmdReplaceScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void GamePauseScreen::CallbackDeleteConfig(bool yes)
|
||||
{
|
||||
if (yes) {
|
||||
|
@ -60,7 +60,6 @@ private:
|
||||
UI::EventReturn OnCreateConfig(UI::EventParams &e);
|
||||
UI::EventReturn OnDeleteConfig(UI::EventParams &e);
|
||||
|
||||
UI::EventReturn OnSwitchUMD(UI::EventParams &e);
|
||||
UI::EventReturn OnState(UI::EventParams &e);
|
||||
|
||||
// hack
|
||||
|
Loading…
x
Reference in New Issue
Block a user