Move umd replace to loaders.
This commit is contained in:
parent
0a5ec48382
commit
d09543ebd7
7 changed files with 87 additions and 45 deletions
|
@ -355,3 +355,37 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
|||
coreState = CORE_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UmdReplace(std::string filepath, char *error) {
|
||||
IFileSystem* currentUMD = pspFileSystem.GetSystem("disc0:");
|
||||
|
||||
if (!currentUMD) {
|
||||
error = "has no disc";
|
||||
return false;
|
||||
}
|
||||
|
||||
FileLoader *loadedFile = ConstructFileLoader(filepath);
|
||||
|
||||
if (!loadedFile->Exists()) {
|
||||
delete loadedFile;
|
||||
sprintf(error, "%s doesn't exist", loadedFile->Path().c_str());
|
||||
return false;
|
||||
}
|
||||
UpdateLoadedFile(loadedFile);
|
||||
|
||||
loadedFile = ResolveFileLoaderTarget(loadedFile);
|
||||
IdentifiedFileType type = Identify_File(loadedFile);
|
||||
|
||||
switch (type) {
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
ReInitMemoryForGameISO(loadedFile);
|
||||
break;
|
||||
default:
|
||||
sprintf(error, "Unsupported file type: %i", type);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue