[XAM] Improved XContentQueryVolumeDeviceType

This commit is contained in:
Adrian
2025-03-15 19:39:25 +00:00
committed by Radosław Gliński
parent 6ae45effd0
commit 1e2f903a4a
2 changed files with 33 additions and 12 deletions

View File

@@ -12,6 +12,7 @@
#include "xenia/base/logging.h" #include "xenia/base/logging.h"
#include "xenia/base/threading.h" #include "xenia/base/threading.h"
#include "xenia/kernel/kernel_state.h" #include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam/xam_content_device.h"
#include "xenia/kernel/xenumerator.h" #include "xenia/kernel/xenumerator.h"
// Notes: // Notes:
@@ -79,18 +80,37 @@ X_HRESULT XamApp::DispatchMessageSync(uint32_t message, uint32_t buffer_ptr,
return X_E_NO_MORE_FILES; return X_E_NO_MORE_FILES;
} }
case 0x00020021: { case 0x00020021: {
struct message_data { struct XContentQueryVolumeDeviceType {
char unk_00[64]; char root_name[64];
xe::be<uint32_t> unk_40; // KeGetCurrentProcessType() < 1 ? 1 : 0 xe::be<uint32_t> is_title_process;
xe::be<uint32_t> unk_44; // ? output_ptr ? xe::be<DeviceType> device_type_ptr;
xe::be<uint32_t> unk_48; // ? overlapped_ptr ? xe::be<uint32_t> overlapped_ptr;
}* data = reinterpret_cast<message_data*>(buffer); }* data = reinterpret_cast<XContentQueryVolumeDeviceType*>(buffer);
assert_true(buffer_length == sizeof(message_data)); assert_true(buffer_length == sizeof(XContentQueryVolumeDeviceType));
auto unk = memory_->TranslateVirtual<xe::be<uint32_t>*>(data->unk_44);
*unk = 0; xe::be<DeviceType>* device_type_ptr =
XELOGD("XamApp(0x00020021)('{}', {:08X}, {:08X}, {:08X})", data->unk_00, memory_->TranslateVirtual<xe::be<DeviceType>*>(
(uint32_t)data->unk_40, (uint32_t)data->unk_44, static_cast<uint32_t>(data->device_type_ptr.get()));
(uint32_t)data->unk_48);
switch (kernel_state_->deployment_type_) {
case XDeploymentType::kGoD:
case XDeploymentType::kHardDrive: {
*device_type_ptr = DeviceType::HDD;
} break;
case XDeploymentType::kOpticalDisc: {
*device_type_ptr = DeviceType::ODD;
} break;
default: {
*device_type_ptr = DeviceType::Invalid;
} break;
}
XELOGD("XContentQueryVolumeDeviceType('{}', {:08X}, {:08X}, {:08X})",
data->root_name,
static_cast<uint32_t>(data->is_title_process.get()),
static_cast<uint32_t>(data->device_type_ptr.get()),
static_cast<uint32_t>(data->overlapped_ptr.get()));
return X_E_SUCCESS; return X_E_SUCCESS;
} }
case 0x00021012: { case 0x00021012: {

View File

@@ -17,6 +17,7 @@ namespace kernel {
namespace xam { namespace xam {
enum class DeviceType : uint32_t { enum class DeviceType : uint32_t {
Invalid = 0,
HDD = 1, HDD = 1,
ODD = 4, ODD = 4,
}; };