launcher: tell user when loader is missing

At the moment it will just do nothing and go back to menu; instead
print a hopefully helpful text that the file is missing.
This commit is contained in:
lifehackerhansol 2024-10-14 16:41:52 -07:00
parent 5020802b1a
commit 95ff08bdc6
No known key found for this signature in database
GPG Key ID: 80FB184AFC0B3B0E
5 changed files with 23 additions and 0 deletions

View File

@ -46,6 +46,11 @@ bool AcekardLauncher::launchRom(std::string romPath, std::string savePath, u32 f
dbg_printf("load %s\n", romPath.c_str()); dbg_printf("load %s\n", romPath.c_str());
if (access("fat:/__rpg/akloader.nds", F_OK) != 0) {
printLoaderNotFound("fat:/__rpg/akloader.nds");
return false;
}
// akloaders are very old and expect the old-style libfat mount points // akloaders are very old and expect the old-style libfat mount points
romPath.replace(0, 3, "fat0"); romPath.replace(0, 3, "fat0");
savePath.replace(0, 3, "fat0"); savePath.replace(0, 3, "fat0");

View File

@ -7,6 +7,12 @@
#pragma once #pragma once
#include <nds/ndstypes.h> #include <nds/ndstypes.h>
#include "../language.h"
#include "../ui/msgbox.h"
static inline void printLoaderNotFound(std::string loaderPath) {
akui::messageBox(NULL, LANG("loader", "not found"), loaderPath, MB_OK);
}
class ILauncher { class ILauncher {
public: public:

View File

@ -73,6 +73,12 @@ bool NdsBootstrapLauncher::prepareIni() {
bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath, u32 flags, bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath, u32 flags,
u32 cheatOffset, u32 cheatSize) { u32 cheatOffset, u32 cheatSize) {
const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds"; const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds";
if (access(ndsBootstrapPath, F_OK) != 0) {
printLoaderNotFound(ndsBootstrapPath);
return false;
}
std::vector<const char*> argv; std::vector<const char*> argv;
mRomPath = romPath; mRomPath = romPath;

View File

@ -16,6 +16,11 @@ bool PassMeLauncher::launchRom(std::string romPath, std::string savePath, u32 fl
u32 cheatOffset, u32 cheatSize) { u32 cheatOffset, u32 cheatSize) {
const char passMeLoaderPath[] = "fat:/__rpg/PassMeLoader.nds"; const char passMeLoaderPath[] = "fat:/__rpg/PassMeLoader.nds";
if (access(passMeLoaderPath, F_OK) != 0) {
printLoaderNotFound(passMeLoaderPath);
return false;
}
std::vector<const char*> argv; std::vector<const char*> argv;
argv.push_back(passMeLoaderPath); argv.push_back(passMeLoaderPath);
eRunNdsRetCode rc = runNdsFile(argv[0], argv.size(), &argv[0]); eRunNdsRetCode rc = runNdsFile(argv[0], argv.size(), &argv[0]);

View File

@ -275,5 +275,6 @@ favorites = Favorites
[loader] [loader]
text = Use ROM loader text = Use ROM loader
not found = Loader not found
[end] [end]