Core: Add a file open dialog and refactor logic around loading new games

This commit is contained in:
Dr. Chat
2016-06-18 20:42:28 -05:00
parent dcd71c1613
commit b82f6a990a
5 changed files with 127 additions and 98 deletions

View File

@@ -13,6 +13,7 @@
#include <functional>
#include <string>
#include "xenia/base/delegate.h"
#include "xenia/base/exception_handler.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/memory.h"
@@ -105,18 +106,17 @@ class Emulator {
// Launches a game from the given file path.
// This will attempt to infer the type of the given file (such as an iso, etc)
// using heuristics.
X_STATUS LaunchPath(std::wstring path, std::function<void()> on_launch);
X_STATUS LaunchPath(std::wstring path);
// Launches a game from a .xex file by mounting the containing folder as if it
// was an extracted STFS container.
X_STATUS LaunchXexFile(std::wstring path, std::function<void()> on_launch);
X_STATUS LaunchXexFile(std::wstring path);
// Launches a game from a disc image file (.iso, etc).
X_STATUS LaunchDiscImage(std::wstring path, std::function<void()> on_launch);
X_STATUS LaunchDiscImage(std::wstring path);
// Launches a game from an STFS container file.
X_STATUS LaunchStfsContainer(std::wstring path,
std::function<void()> on_launch);
X_STATUS LaunchStfsContainer(std::wstring path);
void Pause();
void Resume();
@@ -127,13 +127,16 @@ class Emulator {
void WaitUntilExit();
public:
xe::Delegate<> on_launch;
xe::Delegate<> on_exit;
private:
static bool ExceptionCallbackThunk(Exception* ex, void* data);
bool ExceptionCallback(Exception* ex);
X_STATUS CompleteLaunch(const std::wstring& path,
const std::string& module_path,
std::function<void()> on_launch);
const std::string& module_path);
std::wstring command_line_;
std::wstring game_title_;
@@ -152,6 +155,7 @@ class Emulator {
std::unique_ptr<kernel::KernelState> kernel_state_;
threading::Thread* main_thread_ = nullptr;
uint32_t title_id_ = 0; // Currently running title ID
bool paused_ = false;
bool restoring_ = false;