mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Refactor a little more.
This commit is contained in:
parent
088a02bfdb
commit
5f30793845
2 changed files with 36 additions and 32 deletions
|
@ -254,6 +254,8 @@ static void ShowCompatWarnings(const Compatibility &compat) {
|
|||
}
|
||||
}
|
||||
|
||||
extern const std::string INDEX_FILENAME;
|
||||
|
||||
// NOTE: The loader has already been fully resolved (ResolveFileLoaderTarget) and identified here.
|
||||
static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::string *errorString) {
|
||||
// Default memory settings
|
||||
|
@ -281,6 +283,16 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
|
|||
if (LoadParamSFOFromDisc()) {
|
||||
InitMemorySizeForGame();
|
||||
}
|
||||
if (type == IdentifiedFileType::PSP_DISC_DIRECTORY) {
|
||||
// Check for existence of ppsspp-index.lst - if it exists, the user likely knows what they're doing.
|
||||
// TODO: Better would be to check that it was loaded successfully.
|
||||
if (!File::Exists(g_CoreParameter.fileToStart / INDEX_FILENAME)) {
|
||||
auto sc = GetI18NCategory(I18NCat::SCREEN);
|
||||
g_OSD.Show(OSDType::MESSAGE_CENTERED_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), g_CoreParameter.fileToStart.ToVisualString(), 7.0f);
|
||||
} else {
|
||||
INFO_LOG(Log::Loader, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IdentifiedFileType::PSP_PBP:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
|
@ -319,11 +331,12 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin
|
|||
gameTitle = SanitizeString(g_paramSFO.GetValueString("TITLE"), StringRestriction::NoLineBreaksOrSpecials);
|
||||
}
|
||||
|
||||
std::string title = StringFromFormat("%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), gameTitle.c_str());
|
||||
INFO_LOG(Log::Loader, "%s", title.c_str());
|
||||
System_SetWindowTitle(title);
|
||||
const std::string id = g_paramSFO.GetValueString("DISC_ID");
|
||||
const std::string windowTitle = id.empty() ? gameTitle : id + " : " + gameTitle;
|
||||
INFO_LOG(Log::Loader, "%s", windowTitle.c_str());
|
||||
System_SetWindowTitle(windowTitle);
|
||||
|
||||
currentMIPS = &mipsr4k;
|
||||
auto sc = GetI18NCategory(I18NCat::SCREEN);
|
||||
|
||||
g_symbolMap = new SymbolMap();
|
||||
|
||||
|
|
|
@ -284,33 +284,9 @@ void EmuScreen::bootGame(const Path &filename) {
|
|||
if (!bootAllowStorage(filename))
|
||||
return;
|
||||
|
||||
// We don't want to boot with the wrong game specific config, so wait until info is ready.
|
||||
// TODO: Actually, we read this info again during bootup, so this is not really necessary.
|
||||
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, filename, GameInfoFlags::PARAM_SFO);
|
||||
if (!info->Ready(GameInfoFlags::PARAM_SFO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto sc = GetI18NCategory(I18NCat::SCREEN);
|
||||
if (info->fileType == IdentifiedFileType::PSP_DISC_DIRECTORY) {
|
||||
// Check for existence of ppsspp-index.lst - if it exists, the user likely knows what they're doing.
|
||||
// TODO: Better would be to check that it was loaded successfully.
|
||||
if (!File::Exists(filename / INDEX_FILENAME)) {
|
||||
g_OSD.Show(OSDType::MESSAGE_CENTERED_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), gamePath_.ToVisualString(), 7.0f);
|
||||
} else {
|
||||
INFO_LOG(Log::Loader, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
extraAssertInfoStr_ = info->id + " " + info->GetTitle();
|
||||
SetExtraAssertInfo(extraAssertInfoStr_.c_str());
|
||||
SetAssertCancelCallback(&AssertCancelCallback, this);
|
||||
|
||||
if (!info->id.empty()) {
|
||||
g_Discord.SetPresenceGame(info->GetTitle());
|
||||
} else {
|
||||
g_Discord.SetPresenceGame(sc->T("Untitled PSP game"));
|
||||
}
|
||||
currentMIPS = &mipsr4k;
|
||||
|
||||
CoreParameter coreParam{};
|
||||
coreParam.cpuCore = (CPUCore)g_Config.iCpuCore;
|
||||
|
@ -374,6 +350,24 @@ void EmuScreen::bootGame(const Path &filename) {
|
|||
|
||||
// Only call this on successful boot.
|
||||
void EmuScreen::bootComplete() {
|
||||
// We don't want to boot with the wrong game specific config, so wait until info is ready.
|
||||
// TODO: Actually, we read this info again during bootup, so this is not really necessary.
|
||||
auto sc = GetI18NCategory(I18NCat::SCREEN);
|
||||
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
|
||||
if (g_paramSFO.IsValid()) {
|
||||
g_Discord.SetPresenceGame(SanitizeString(g_paramSFO.GetValueString("TITLE"), StringRestriction::NoLineBreaksOrSpecials));
|
||||
} else {
|
||||
g_Discord.SetPresenceGame(sc->T("Untitled PSP game"));
|
||||
}
|
||||
|
||||
if (g_paramSFO.IsValid()) {
|
||||
std::string gameTitle = SanitizeString(g_paramSFO.GetValueString("TITLE"), StringRestriction::NoLineBreaksOrSpecials, 0, 32);
|
||||
std::string id = g_paramSFO.GetValueString("DISC_ID");
|
||||
extraAssertInfoStr_ = id + " " + gameTitle;
|
||||
SetExtraAssertInfo(extraAssertInfoStr_.c_str());
|
||||
}
|
||||
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
System_Notify(SystemNotification::DISASSEMBLY);
|
||||
|
@ -384,9 +378,6 @@ void EmuScreen::bootComplete() {
|
|||
autoLoad();
|
||||
}
|
||||
|
||||
auto sc = GetI18NCategory(I18NCat::SCREEN);
|
||||
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
|
||||
|
||||
#ifndef MOBILE_DEVICE
|
||||
if (g_Config.bFirstRun) {
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("PressESC", "Press ESC to open the pause menu"));
|
||||
|
|
Loading…
Add table
Reference in a new issue