Loader, Frontends: Refactor loader creation and game loading

This allows frontends to keep a single loader and use it multiple times
e.g. for code loading and SMDH parsing.
This commit is contained in:
Emmanuel Gil Peyrot 2016-05-17 23:06:33 +01:00
parent 51ee2d2eb1
commit 8fc9c03126
6 changed files with 37 additions and 49 deletions

View file

@ -114,7 +114,13 @@ int main(int argc, char **argv) {
System::Init(emu_window.get());
SCOPE_EXIT({ System::Shutdown(); });
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
std::unique_ptr<Loader::AppLoader> loader = Loader::GetFileLoader(boot_filename);
if (!loader) {
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", boot_filename.c_str());
return -1;
}
Loader::ResultStatus load_result = loader->Load();
if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
return -1;