Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamically set host/host0 path when directly executing elf #1004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source/PS2VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<CIopBios*>(m_iop->m_bios.get());

iopOs->GetIoman()->RegisterDevice("host", std::make_shared<Iop::Ioman::CPathDirectoryDevice>(execPath.parent_path()));
iopOs->GetIoman()->RegisterDevice("host0", std::make_shared<Iop::Ioman::CPathDirectoryDevice>(execPath.parent_path()));
m_ee->m_os->BootFromFile(execPath);
}

void CPS2VM::ReloadExecutable(const char* executablePath, const CPS2OS::ArgumentList& arguments)
{
ResetVM();
Expand Down
1 change: 1 addition & 0 deletions Source/PS2VM.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
2 changes: 1 addition & 1 deletion Source/ui_android/NativeInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/ui_ios/EmulatorViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Source/ui_qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down