mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
CleanUp.
This commit is contained in:
1 parent
4c6005545b
commit
7832cebacd
6 files changed
+34
-18
No files matched your search
@@ -255,6 +255,19 @@ void MetaFileSystem::Unmount(std::string prefix, IFileSystem *system)
|
||||
fileSystems.erase(std::remove(fileSystems.begin(), fileSystems.end(), x), fileSystems.end());
|
||||
}
|
||||
|
||||
void MetaFileSystem::Remount(std::string prefix, IFileSystem *oldSystem, IFileSystem *newSystem) {
|
||||
Unmount(prefix, oldSystem);
|
||||
Mount(prefix, newSystem);
|
||||
}
|
||||
|
||||
IFileSystem *MetaFileSystem::GetSystem(const std::string &prefix) {
|
||||
for (auto it = fileSystems.begin(); it != fileSystems.end(); ++it) {
|
||||
if (it->prefix == prefix)
|
||||
return it->system;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MetaFileSystem::Shutdown()
|
||||
{
|
||||
lock_guard guard(lock);
|
||||
|
||||
@@ -51,6 +51,9 @@ public:
|
||||
|
||||
void Mount(std::string prefix, IFileSystem *system);
|
||||
void Unmount(std::string prefix, IFileSystem *system);
|
||||
void Remount(std::string prefix, IFileSystem *oldSystem, IFileSystem *newSystem);
|
||||
|
||||
IFileSystem *GetSystem(const std::string &prefix);
|
||||
|
||||
void ThreadEnded(int threadID);
|
||||
|
||||
|
||||
+15
-11
@@ -42,7 +42,6 @@ static int umdStatChangeEvent = -1;
|
||||
static std::vector<SceUID> umdWaitingThreads;
|
||||
static std::map<SceUID, u64> umdPausedWaits;
|
||||
|
||||
extern IFileSystem* currentUMD;
|
||||
bool UMDReplacePermit = false;
|
||||
|
||||
struct PspUmdInfo {
|
||||
@@ -444,11 +443,10 @@ u32 sceUmdGetErrorStat()
|
||||
}
|
||||
|
||||
void __UmdReplace(std::string filepath) {
|
||||
// Unmount old umd first.
|
||||
pspFileSystem.Unmount("umd0:", currentUMD);
|
||||
pspFileSystem.Unmount("umd1:", currentUMD);
|
||||
pspFileSystem.Unmount("disc0:", currentUMD);
|
||||
pspFileSystem.Unmount("umd:", currentUMD);
|
||||
// Only get system from disc0 seems have been enough.
|
||||
IFileSystem* currentUMD = pspFileSystem.GetSystem("disc0:");
|
||||
if (!currentUMD)
|
||||
return;
|
||||
|
||||
IFileSystem* umd2;
|
||||
FileInfo info;
|
||||
@@ -462,17 +460,23 @@ void __UmdReplace(std::string filepath) {
|
||||
return;
|
||||
umd2 = new ISOFileSystem(&pspFileSystem, bd);
|
||||
|
||||
pspFileSystem.Mount("umd0:", umd2);
|
||||
pspFileSystem.Mount("umd1:", umd2);
|
||||
pspFileSystem.Mount("disc0:", umd2);
|
||||
pspFileSystem.Mount("umd:", umd2);
|
||||
pspFileSystem.Remount("umd0:", currentUMD, umd2);
|
||||
pspFileSystem.Remount("umd1:", currentUMD, umd2);
|
||||
pspFileSystem.Remount("disc0:", currentUMD, umd2);
|
||||
pspFileSystem.Remount("umd:", currentUMD, umd2);
|
||||
}
|
||||
currentUMD = umd2; // Change current umd.
|
||||
delete currentUMD;
|
||||
|
||||
// TODO Is this always correct if UMD was not activated?
|
||||
u32 notifyArg = PSP_UMD_PRESENT | PSP_UMD_READABLE | PSP_UMD_CHANGED;
|
||||
if (driveCBId != -1)
|
||||
__KernelNotifyCallback(driveCBId, notifyArg);
|
||||
}
|
||||
|
||||
bool getUMDReplacePermit() {
|
||||
return UMDReplacePermit;
|
||||
}
|
||||
|
||||
u32 sceUmdReplaceProhibit()
|
||||
{
|
||||
UMDReplacePermit = false;
|
||||
|
||||
@@ -42,5 +42,6 @@ void __UmdInit();
|
||||
void __UmdDoState(PointerWrap &p);
|
||||
|
||||
void __UmdReplace(std::string filepath);
|
||||
bool getUMDReplacePermit();
|
||||
|
||||
void Register_sceUmdUser();
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "HLE/sceKernelMemory.h"
|
||||
#include "ELF/ParamSFO.h"
|
||||
|
||||
IFileSystem* currentUMD;
|
||||
// We gather the game info before actually loading/booting the ISO
|
||||
// to determine if the emulator should enable extra memory and
|
||||
// double-sized texture coordinates.
|
||||
@@ -73,7 +72,6 @@ void InitMemoryForGameISO(std::string fileToStart) {
|
||||
pspFileSystem.Mount("umd1:", umd2);
|
||||
pspFileSystem.Mount("disc0:", umd2);
|
||||
pspFileSystem.Mount("umd:", umd2);
|
||||
currentUMD = umd2;
|
||||
|
||||
std::string gameID;
|
||||
|
||||
@@ -208,7 +206,6 @@ bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string)
|
||||
pspFileSystem.Mount("umd1:", umd2);
|
||||
pspFileSystem.Mount("disc0:", umd2);
|
||||
pspFileSystem.Mount("umd:", umd2);
|
||||
currentUMD = umd2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -513,7 +513,7 @@ void MainScreen::CreateViews() {
|
||||
root_ = new LinearLayout(ORIENT_HORIZONTAL);
|
||||
leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0));
|
||||
rightColumn->ReplaceLayoutParams(new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
|
||||
root_->Add(leftColumn);
|
||||
root_->Add(leftColumn);
|
||||
root_->Add(rightColumn);
|
||||
}
|
||||
|
||||
@@ -705,8 +705,6 @@ GamePauseScreen::~GamePauseScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
extern bool UMDReplacePermit;
|
||||
|
||||
void GamePauseScreen::CreateViews() {
|
||||
static const int NUM_SAVESLOTS = 5;
|
||||
|
||||
@@ -757,7 +755,7 @@ void GamePauseScreen::CreateViews() {
|
||||
rightColumn->Add(rightColumnItems);
|
||||
|
||||
rightColumnItems->SetSpacing(0.0f);
|
||||
if (UMDReplacePermit) {
|
||||
if (getUMDReplacePermit()) {
|
||||
rightColumnItems->Add(new Choice(i->T("Switch UMD")))->OnClick.Handle(this, &GamePauseScreen::OnSwitchUMD);
|
||||
}
|
||||
rightColumnItems->Add(new Choice(i->T("Continue")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
|
||||
Reference in new issue
Block a user