2015-02-28 01:51:53 +00:00
|
|
|
auto Program::loadMedia(string location) -> void {
|
|
|
|
location.transform("\\", "/");
|
2015-03-03 10:14:49 +00:00
|
|
|
if(!location.endsWith("/")) location.append("/");
|
2015-02-28 01:51:53 +00:00
|
|
|
if(!directory::exists(location)) return;
|
|
|
|
|
|
|
|
string type = suffixname(location).ltrim(".");
|
|
|
|
for(auto& emulator : emulators) {
|
|
|
|
for(auto& media : emulator->media) {
|
|
|
|
if(media.bootable == false) continue;
|
|
|
|
if(media.type != type) continue;
|
|
|
|
return loadMedia(*emulator, media, location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::loadMedia(Emulator::Interface& _emulator, Emulator::Interface::Media& media, const string& location) -> void {
|
2015-03-02 09:13:28 +00:00
|
|
|
unloadMedia();
|
|
|
|
|
2015-02-28 01:51:53 +00:00
|
|
|
mediaPaths(0) = {userpath(), "Emulation/System/", media.name, ".sys/"};
|
|
|
|
mediaPaths(media.id) = location;
|
|
|
|
|
2015-03-02 09:13:28 +00:00
|
|
|
setEmulator(&_emulator);
|
2015-02-28 01:51:53 +00:00
|
|
|
emulator().paletteUpdate(Emulator::Interface::PaletteMode::Standard);
|
|
|
|
emulator().load(media.id);
|
|
|
|
emulator().power();
|
|
|
|
|
2015-03-03 10:14:49 +00:00
|
|
|
presentation->resizeViewport();
|
2015-02-28 01:51:53 +00:00
|
|
|
presentation->setTitle(emulator().title());
|
2015-03-03 10:14:49 +00:00
|
|
|
presentation->systemMenu.setVisible(true);
|
2015-03-02 09:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::unloadMedia() -> void {
|
|
|
|
if(activeEmulator == nullptr) return;
|
|
|
|
emulator().unload();
|
|
|
|
|
|
|
|
setEmulator(nullptr);
|
|
|
|
|
|
|
|
presentation->setTitle({"tomoko v", Emulator::Version});
|
|
|
|
presentation->systemMenu.setVisible(false);
|
2015-02-28 01:51:53 +00:00
|
|
|
}
|