diff options
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 1aa477a29..7ca3652af 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -145,7 +145,7 @@ struct System::Impl { | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { | 147 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { |
| 148 | LOG_DEBUG(HW_Memory, "initialized OK"); | 148 | LOG_DEBUG(Core, "initialized OK"); |
| 149 | 149 | ||
| 150 | device_memory = std::make_unique<Core::DeviceMemory>(); | 150 | device_memory = std::make_unique<Core::DeviceMemory>(); |
| 151 | 151 | ||
| @@ -208,9 +208,11 @@ struct System::Impl { | |||
| 208 | return ResultStatus::Success; | 208 | return ResultStatus::Success; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, | 211 | ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath, |
| 212 | const std::string& filepath) { | 212 | std::size_t program_index) { |
| 213 | app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath)); | 213 | app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath), |
| 214 | program_index); | ||
| 215 | |||
| 214 | if (!app_loader) { | 216 | if (!app_loader) { |
| 215 | LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); | 217 | LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); |
| 216 | return ResultStatus::ErrorGetLoader; | 218 | return ResultStatus::ErrorGetLoader; |
| @@ -416,6 +418,8 @@ struct System::Impl { | |||
| 416 | bool is_multicore{}; | 418 | bool is_multicore{}; |
| 417 | bool is_async_gpu{}; | 419 | bool is_async_gpu{}; |
| 418 | 420 | ||
| 421 | ExecuteProgramCallback execute_program_callback; | ||
| 422 | |||
| 419 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; | 423 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; |
| 420 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; | 424 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; |
| 421 | }; | 425 | }; |
| @@ -451,8 +455,9 @@ void System::Shutdown() { | |||
| 451 | impl->Shutdown(); | 455 | impl->Shutdown(); |
| 452 | } | 456 | } |
| 453 | 457 | ||
| 454 | System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) { | 458 | System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, |
| 455 | return impl->Load(*this, emu_window, filepath); | 459 | std::size_t program_index) { |
| 460 | return impl->Load(*this, emu_window, filepath, program_index); | ||
| 456 | } | 461 | } |
| 457 | 462 | ||
| 458 | bool System::IsPoweredOn() const { | 463 | bool System::IsPoweredOn() const { |
| @@ -789,4 +794,16 @@ bool System::IsMulticore() const { | |||
| 789 | return impl->is_multicore; | 794 | return impl->is_multicore; |
| 790 | } | 795 | } |
| 791 | 796 | ||
| 797 | void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) { | ||
| 798 | impl->execute_program_callback = std::move(callback); | ||
| 799 | } | ||
| 800 | |||
| 801 | void System::ExecuteProgram(std::size_t program_index) { | ||
| 802 | if (impl->execute_program_callback) { | ||
| 803 | impl->execute_program_callback(program_index); | ||
| 804 | } else { | ||
| 805 | LOG_CRITICAL(Core, "execute_program_callback must be initialized by the frontend"); | ||
| 806 | } | ||
| 807 | } | ||
| 808 | |||
| 792 | } // namespace Core | 809 | } // namespace Core |