diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index 83015c945..946fe1036 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -445,7 +445,9 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path) { // Launch the game. auto fs_path = "game:\\" + xe::path_to_utf8(file_name); - return CompleteLaunch(path, fs_path); + X_STATUS result = CompleteLaunch(path, fs_path); + kernel_state_->deployment_type_ = XDeploymentType::kHardDrive; + return result; } X_STATUS Emulator::LaunchDiscImage(const std::filesystem::path& path) { @@ -455,7 +457,7 @@ X_STATUS Emulator::LaunchDiscImage(const std::filesystem::path& path) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) { return LaunchDefaultModule(path); } - + kernel_state_->deployment_type_ = XDeploymentType::kOpticalDisc; return result; } @@ -466,7 +468,7 @@ X_STATUS Emulator::LaunchDiscArchive(const std::filesystem::path& path) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) { return LaunchDefaultModule(path); } - + kernel_state_->deployment_type_ = XDeploymentType::kOpticalDisc; return result; } @@ -477,15 +479,16 @@ X_STATUS Emulator::LaunchStfsContainer(const std::filesystem::path& path) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) { return LaunchDefaultModule(path); } - + kernel_state_->deployment_type_ = XDeploymentType::kGoD; return result; } X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) { cvars::launch_module = ""; std::string module_path = FindLaunchModule(); - - return CompleteLaunch(path, module_path); + X_STATUS result = CompleteLaunch(path, module_path); + kernel_state_->deployment_type_ = XDeploymentType::kHardDrive; + return result; } X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) { diff --git a/src/xenia/kernel/kernel_state.h b/src/xenia/kernel/kernel_state.h index 8324d51e7..31939e816 100644 --- a/src/xenia/kernel/kernel_state.h +++ b/src/xenia/kernel/kernel_state.h @@ -297,6 +297,7 @@ class KernelState { bool Restore(ByteStream* stream); uint32_t notification_position_ = 2; + XDeploymentType deployment_type_ = XDeploymentType::kUnknown; uint32_t GetKeTimestampBundle(); @@ -305,11 +306,13 @@ class KernelState { uint32_t CreateKeTimestampBundle(); void UpdateKeTimestampBundle(); - void BeginDPCImpersonation(cpu::ppc::PPCContext* context, DPCImpersonationScope& scope); + void BeginDPCImpersonation(cpu::ppc::PPCContext* context, + DPCImpersonationScope& scope); void EndDPCImpersonation(cpu::ppc::PPCContext* context, DPCImpersonationScope& end_scope); - void EmulateCPInterruptDPC(uint32_t interrupt_callback,uint32_t interrupt_callback_data, uint32_t source, + void EmulateCPInterruptDPC(uint32_t interrupt_callback, + uint32_t interrupt_callback_data, uint32_t source, uint32_t cpu); private: @@ -354,11 +357,12 @@ class KernelState { uint32_t ke_timestamp_bundle_ptr_ = 0; std::unique_ptr timestamp_timer_; cpu::backend::GuestTrampolineGroup kernel_trampoline_group_; - //fixed address referenced by dashboards. Data is currently unknown + // fixed address referenced by dashboards. Data is currently unknown uint32_t strange_hardcoded_page_ = 0x8E038634 & (~0xFFFF); uint32_t strange_hardcoded_location_ = 0x8E038634; friend class XObject; + public: uint32_t dash_context_ = 0; std::unordered_map diff --git a/src/xenia/kernel/xam/apps/xam_app.cc b/src/xenia/kernel/xam/apps/xam_app.cc index ded317b41..3e12b706d 100644 --- a/src/xenia/kernel/xam/apps/xam_app.cc +++ b/src/xenia/kernel/xam/apps/xam_app.cc @@ -90,14 +90,15 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, } case 0x00022005: { struct message_data { - xe::be unk_00; // ? output_ptr ? - xe::be unk_04; // ? value/jump to? ? + xe::be deployment_type_ptr; + xe::be overlapped_ptr; }* data = reinterpret_cast(buffer); assert_true(buffer_length == sizeof(message_data)); - auto unk = memory_->TranslateVirtual*>(data->unk_00); - auto adr = *unk; - XELOGD("XamApp(0x00022005)(%.8X, %.8X)", (uint32_t)data->unk_00, - (uint32_t)data->unk_04); + auto deployment_type = + memory_->TranslateVirtual(data->deployment_type_ptr); + *deployment_type = static_cast(kernel_state_->deployment_type_); + XELOGD("XTitleGetDeploymentType({:08X}, {:08X}", + data->deployment_type_ptr, data->overlapped_ptr); return X_E_SUCCESS; } } diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index cd77acc7d..e6d7a6900 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -439,6 +439,13 @@ enum class XContentType : uint32_t { kCommunityGame = 0x02000000, }; +enum class XDeploymentType : uint32_t { + kOpticalDisc = 0, + kHardDrive = 1, // Like extracted? + kGoD = 2, + kUnknown = 0xFF, +}; + } // namespace xe // clang-format on