diff --git a/Source/PS2VM.cpp b/Source/PS2VM.cpp index 82959de334..b5c069cb33 100644 --- a/Source/PS2VM.cpp +++ b/Source/PS2VM.cpp @@ -25,6 +25,7 @@ #include "iop/IopBios.h" #include "iop/ioman/HardDiskDevice.h" #include "iop/ioman/OpticalMediaDevice.h" +#include "iop/ioman/PathDirectoryDevice.h" #include "iop/ioman/PreferenceDirectoryDevice.h" #include "Log.h" #include "ISO9660/BlockProvider.h" @@ -755,6 +756,15 @@ void CPS2VM::RegisterModulesInPadHandler() m_pad->InsertListener(&m_iop->m_sio2); } +void CPS2VM::BootFromFile(const fs::path& execPath) +{ + auto iopOs = dynamic_cast(m_iop->m_bios.get()); + + iopOs->GetIoman()->RegisterDevice("host", std::make_shared(execPath.parent_path())); + iopOs->GetIoman()->RegisterDevice("host0", std::make_shared(execPath.parent_path())); + m_ee->m_os->BootFromFile(execPath); +} + void CPS2VM::ReloadExecutable(const char* executablePath, const CPS2OS::ArgumentList& arguments) { ResetVM(); diff --git a/Source/PS2VM.h b/Source/PS2VM.h index 56654ada06..d44ddc5df2 100644 --- a/Source/PS2VM.h +++ b/Source/PS2VM.h @@ -75,6 +75,7 @@ class CPS2VM : public CVirtualMachine void TriggerFrameDump(const FrameDumpCallback&); CPU_UTILISATION_INFO GetCpuUtilisationInfo() const; + void BootFromFile(const fs::path&); #ifdef DEBUGGER_INCLUDED std::string MakeDebugTagsPackagePath(const char*); diff --git a/Source/ui_android/NativeInterop.cpp b/Source/ui_android/NativeInterop.cpp index 1b43b9f081..54f342e88b 100644 --- a/Source/ui_android/NativeInterop.cpp +++ b/Source/ui_android/NativeInterop.cpp @@ -141,7 +141,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeIntero ResetVirtualMachine(); try { - g_virtualMachine->m_ee->m_os->BootFromFile(GetStringFromJstring(env, selectedFilePath)); + g_virtualMachine->BootFromFile(GetStringFromJstring(env, selectedFilePath)); } catch(const std::exception& exception) { diff --git a/Source/ui_ios/EmulatorViewController.mm b/Source/ui_ios/EmulatorViewController.mm index 4799c06376..9aa8b0d16c 100644 --- a/Source/ui_ios/EmulatorViewController.mm +++ b/Source/ui_ios/EmulatorViewController.mm @@ -102,7 +102,7 @@ - (void)viewDidAppear:(BOOL)animated auto bootablePath = fs::path([self.bootablePath fileSystemRepresentation]); if(IsBootableExecutablePath(bootablePath)) { - g_virtualMachine->m_ee->m_os->BootFromFile(bootablePath); + g_virtualMachine->BootFromFile(bootablePath); } else { diff --git a/Source/ui_qt/mainwindow.cpp b/Source/ui_qt/mainwindow.cpp index 9e2b9cfa03..eb5a33827e 100644 --- a/Source/ui_qt/mainwindow.cpp +++ b/Source/ui_qt/mainwindow.cpp @@ -374,7 +374,7 @@ void MainWindow::BootElf(fs::path filePath) { m_virtualMachine->Pause(); m_virtualMachine->Reset(); - m_virtualMachine->m_ee->m_os->BootFromFile(filePath); + m_virtualMachine->BootFromFile(filePath); #ifndef DEBUGGER_INCLUDED m_virtualMachine->Resume(); #endif