From 3d79b7983dbb6dd41be75471e4285a4a9720eca2 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Mon, 28 Dec 2020 15:35:19 +0000 Subject: [PATCH] Try to use the image as FD first and HD if this fails. Signed-off-by: Andrea Odetti --- source/frontends/libretro/game.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/source/frontends/libretro/game.cpp b/source/frontends/libretro/game.cpp index 1aee3364..41a9d383 100644 --- a/source/frontends/libretro/game.cpp +++ b/source/frontends/libretro/game.cpp @@ -32,6 +32,27 @@ namespace display_message(g_pAppTitle.c_str()); } + bool insertDisk(const std::string & filename) + { + if (filename.empty()) + { + return false; + } + + Disk2InterfaceCard& disk2Card = dynamic_cast(GetCardMgr().GetRef(SLOT6)); + const ImageError_e error = disk2Card.InsertDisk(DRIVE_1, filename.c_str(), IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE); + + if (error == eIMAGE_ERROR_NONE) + { + return true; + } + + // try a hard disk + HD_SetEnabled(true); + BOOL bRes = HD_Insert(HARDDISK_1, filename); + return bRes == TRUE; + } + } unsigned Game::ourInputDevices[MAX_PADS] = {RETRO_DEVICE_NONE}; @@ -307,7 +328,7 @@ void Game::drawVideoBuffer() bool Game::loadGame(const std::string & path) { - const bool ok = DoDiskInsert(SLOT6, DRIVE_1, path.c_str()); + const bool ok = insertDisk(path); return ok; }