Interface: Support loading filenames on command line
This commit is contained in:
@ -1,11 +1,46 @@
|
||||
#include "host_interface.h"
|
||||
#include "YBaseLib/ByteStream.h"
|
||||
#include "YBaseLib/Log.h"
|
||||
#include "system.h"
|
||||
Log_SetChannel(HostInterface);
|
||||
|
||||
HostInterface::HostInterface() = default;
|
||||
|
||||
HostInterface::~HostInterface() = default;
|
||||
|
||||
bool HostInterface::InitializeSystem(const char* filename, const char* save_state_filename)
|
||||
{
|
||||
m_system = std::make_unique<System>(this);
|
||||
if (!m_system->Initialize())
|
||||
{
|
||||
m_system.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_system->Reset();
|
||||
|
||||
if (filename)
|
||||
{
|
||||
const StaticString filename_str(filename);
|
||||
if (filename_str.EndsWith(".psxexe", false) || filename_str.EndsWith(".exe", false))
|
||||
{
|
||||
Log_InfoPrintf("Sideloading EXE file %s", filename);
|
||||
if (!m_system->LoadEXE(filename))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to load EXE file %s", filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (save_state_filename)
|
||||
LoadState(save_state_filename);
|
||||
|
||||
// Resume execution.
|
||||
m_running = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HostInterface::LoadState(const char* filename)
|
||||
{
|
||||
ByteStream* stream;
|
||||
|
||||
@ -14,6 +14,8 @@ public:
|
||||
HostInterface();
|
||||
virtual ~HostInterface();
|
||||
|
||||
bool InitializeSystem(const char* filename, const char* save_state_filename);
|
||||
|
||||
virtual void SetDisplayTexture(GL::Texture* texture, u32 offset_x, u32 offset_y, u32 width, u32 height) = 0;
|
||||
virtual void ReportMessage(const char* message) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user