[XAM] Added Message: XTitleGetDeploymentType

This commit is contained in:
Gliniak 2024-02-12 22:09:19 +01:00
parent 354d42135d
commit 5ade4a1288
4 changed files with 30 additions and 15 deletions

View File

@ -445,7 +445,9 @@ X_STATUS Emulator::LaunchXexFile(const std::filesystem::path& path) {
// Launch the game. // Launch the game.
auto fs_path = "game:\\" + xe::path_to_utf8(file_name); 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) { 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()) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
return LaunchDefaultModule(path); return LaunchDefaultModule(path);
} }
kernel_state_->deployment_type_ = XDeploymentType::kOpticalDisc;
return result; 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()) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
return LaunchDefaultModule(path); return LaunchDefaultModule(path);
} }
kernel_state_->deployment_type_ = XDeploymentType::kOpticalDisc;
return result; 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()) { if (result == X_STATUS_NOT_FOUND && !cvars::launch_module.empty()) {
return LaunchDefaultModule(path); return LaunchDefaultModule(path);
} }
kernel_state_->deployment_type_ = XDeploymentType::kGoD;
return result; return result;
} }
X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) { X_STATUS Emulator::LaunchDefaultModule(const std::filesystem::path& path) {
cvars::launch_module = ""; cvars::launch_module = "";
std::string module_path = FindLaunchModule(); std::string module_path = FindLaunchModule();
X_STATUS result = CompleteLaunch(path, module_path);
return CompleteLaunch(path, module_path); kernel_state_->deployment_type_ = XDeploymentType::kHardDrive;
return result;
} }
X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) { X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) {

View File

@ -297,6 +297,7 @@ class KernelState {
bool Restore(ByteStream* stream); bool Restore(ByteStream* stream);
uint32_t notification_position_ = 2; uint32_t notification_position_ = 2;
XDeploymentType deployment_type_ = XDeploymentType::kUnknown;
uint32_t GetKeTimestampBundle(); uint32_t GetKeTimestampBundle();
@ -305,11 +306,13 @@ class KernelState {
uint32_t CreateKeTimestampBundle(); uint32_t CreateKeTimestampBundle();
void UpdateKeTimestampBundle(); void UpdateKeTimestampBundle();
void BeginDPCImpersonation(cpu::ppc::PPCContext* context, DPCImpersonationScope& scope); void BeginDPCImpersonation(cpu::ppc::PPCContext* context,
DPCImpersonationScope& scope);
void EndDPCImpersonation(cpu::ppc::PPCContext* context, void EndDPCImpersonation(cpu::ppc::PPCContext* context,
DPCImpersonationScope& end_scope); 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); uint32_t cpu);
private: private:
@ -354,11 +357,12 @@ class KernelState {
uint32_t ke_timestamp_bundle_ptr_ = 0; uint32_t ke_timestamp_bundle_ptr_ = 0;
std::unique_ptr<xe::threading::HighResolutionTimer> timestamp_timer_; std::unique_ptr<xe::threading::HighResolutionTimer> timestamp_timer_;
cpu::backend::GuestTrampolineGroup kernel_trampoline_group_; 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_page_ = 0x8E038634 & (~0xFFFF);
uint32_t strange_hardcoded_location_ = 0x8E038634; uint32_t strange_hardcoded_location_ = 0x8E038634;
friend class XObject; friend class XObject;
public: public:
uint32_t dash_context_ = 0; uint32_t dash_context_ = 0;
std::unordered_map<XObject::Type, uint32_t> std::unordered_map<XObject::Type, uint32_t>

View File

@ -90,14 +90,15 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
} }
case 0x00022005: { case 0x00022005: {
struct message_data { struct message_data {
xe::be<uint32_t> unk_00; // ? output_ptr ? xe::be<uint32_t> deployment_type_ptr;
xe::be<uint32_t> unk_04; // ? value/jump to? ? xe::be<uint32_t> overlapped_ptr;
}* data = reinterpret_cast<message_data*>(buffer); }* data = reinterpret_cast<message_data*>(buffer);
assert_true(buffer_length == sizeof(message_data)); assert_true(buffer_length == sizeof(message_data));
auto unk = memory_->TranslateVirtual<xe::be<uint32_t>*>(data->unk_00); auto deployment_type =
auto adr = *unk; memory_->TranslateVirtual<uint32_t*>(data->deployment_type_ptr);
XELOGD("XamApp(0x00022005)(%.8X, %.8X)", (uint32_t)data->unk_00, *deployment_type = static_cast<uint32_t>(kernel_state_->deployment_type_);
(uint32_t)data->unk_04); XELOGD("XTitleGetDeploymentType({:08X}, {:08X}",
data->deployment_type_ptr, data->overlapped_ptr);
return X_E_SUCCESS; return X_E_SUCCESS;
} }
} }

View File

@ -439,6 +439,13 @@ enum class XContentType : uint32_t {
kCommunityGame = 0x02000000, kCommunityGame = 0x02000000,
}; };
enum class XDeploymentType : uint32_t {
kOpticalDisc = 0,
kHardDrive = 1, // Like extracted?
kGoD = 2,
kUnknown = 0xFF,
};
} // namespace xe } // namespace xe
// clang-format on // clang-format on