[Kernel] Move xam_content to new shim convention.
This commit is contained in:
parent
927acf1902
commit
e1d448f630
|
@ -33,125 +33,100 @@ static const DeviceInfo dummy_device_info_ = {
|
||||||
L"Dummy HDD",
|
L"Dummy HDD",
|
||||||
};
|
};
|
||||||
|
|
||||||
SHIM_CALL XamContentGetLicenseMask_shim(PPCContext* ppc_context,
|
dword_result_t XamContentGetLicenseMask(lpdword_t mask_ptr,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t mask_ptr = SHIM_GET_ARG_32(0);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
|
|
||||||
XELOGD("XamContentGetLicenseMask(%.8X, %.8X)", mask_ptr, overlapped_ptr);
|
|
||||||
|
|
||||||
// Each bit in the mask represents a granted license. Available licenses
|
// Each bit in the mask represents a granted license. Available licenses
|
||||||
// seems to vary from game to game, but most appear to use bit 0 to indicate
|
// seems to vary from game to game, but most appear to use bit 0 to indicate
|
||||||
// if the game is purchased or not.
|
// if the game is purchased or not.
|
||||||
SHIM_SET_MEM_32(mask_ptr, 0);
|
*mask_ptr = 0;
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, X_ERROR_SUCCESS);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr,
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
X_ERROR_SUCCESS);
|
||||||
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
return X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetLicenseMask, kContent, kStub);
|
||||||
|
|
||||||
SHIM_CALL XamContentGetDeviceName_shim(PPCContext* ppc_context,
|
dword_result_t XamContentGetDeviceName(dword_t device_id,
|
||||||
KernelState* kernel_state) {
|
lpwstring_t name_buffer,
|
||||||
uint32_t device_id = SHIM_GET_ARG_32(0);
|
dword_t name_capacity) {
|
||||||
uint32_t name_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
uint32_t name_capacity = SHIM_GET_ARG_32(2);
|
|
||||||
|
|
||||||
XELOGD("XamContentGetDeviceName(%.8X, %.8X, %d)", device_id, name_ptr,
|
|
||||||
name_capacity);
|
|
||||||
|
|
||||||
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_DEVICE_NOT_CONNECTED);
|
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name_capacity < dummy_device_info_.name.size() + 1) {
|
if (name_capacity < dummy_device_info_.name.size() + 1) {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_INSUFFICIENT_BUFFER);
|
return X_ERROR_INSUFFICIENT_BUFFER;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xe::store_and_swap<std::wstring>(SHIM_MEM_ADDR(name_ptr),
|
xe::store_and_swap<std::wstring>(name_buffer, dummy_device_info_.name);
|
||||||
dummy_device_info_.name);
|
return X_ERROR_SUCCESS;
|
||||||
|
|
||||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetDeviceName, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentGetDeviceState_shim(PPCContext* ppc_context,
|
dword_result_t XamContentGetDeviceState(dword_t device_id,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t device_id = SHIM_GET_ARG_32(0);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
|
|
||||||
XELOGD("XamContentGetDeviceState(%.8X, %.8X)", device_id, overlapped_ptr);
|
|
||||||
|
|
||||||
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediateEx(
|
kernel_state()->CompleteOverlappedImmediateEx(
|
||||||
overlapped_ptr, X_ERROR_FUNCTION_FAILED, X_ERROR_DEVICE_NOT_CONNECTED,
|
overlapped_ptr, X_ERROR_FUNCTION_FAILED, X_ERROR_DEVICE_NOT_CONNECTED,
|
||||||
0);
|
0);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_DEVICE_NOT_CONNECTED);
|
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, X_ERROR_SUCCESS);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr,
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
X_ERROR_SUCCESS);
|
||||||
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
return X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetDeviceState, kContent, kStub);
|
||||||
|
|
||||||
SHIM_CALL XamContentGetDeviceData_shim(PPCContext* ppc_context,
|
typedef struct {
|
||||||
KernelState* kernel_state) {
|
xe::be<uint32_t> device_id;
|
||||||
uint32_t device_id = SHIM_GET_ARG_32(0);
|
xe::be<uint32_t> unknown;
|
||||||
uint32_t device_data_ptr = SHIM_GET_ARG_32(1);
|
xe::be<uint64_t> total_bytes;
|
||||||
|
xe::be<uint64_t> free_bytes;
|
||||||
XELOGD("XamContentGetDeviceData(%.8X, %.8X)", device_id, device_data_ptr);
|
xe::be<uint16_t> name[28];
|
||||||
|
} X_CONTENT_DEVICE_DATA;
|
||||||
|
|
||||||
|
dword_result_t XamContentGetDeviceData(
|
||||||
|
dword_t device_id, pointer_t<X_CONTENT_DEVICE_DATA> device_data) {
|
||||||
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
if ((device_id & 0xFFFF0000) != dummy_device_info_.device_id) {
|
||||||
// TODO(benvanik): memset 0 the data?
|
// TODO(benvanik): memset 0 the data?
|
||||||
SHIM_SET_RETURN_32(X_ERROR_DEVICE_NOT_CONNECTED);
|
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& device_info = dummy_device_info_;
|
const auto& device_info = dummy_device_info_;
|
||||||
SHIM_SET_MEM_32(device_data_ptr + 0, device_info.device_id);
|
device_data->device_id = device_info.device_id;
|
||||||
SHIM_SET_MEM_32(device_data_ptr + 4, device_id & 0xFFFF); // Fake it.
|
device_data->unknown = device_id & 0xFFFF; // Fake it.
|
||||||
SHIM_SET_MEM_64(device_data_ptr + 8, device_info.total_bytes);
|
device_data->total_bytes = device_info.total_bytes;
|
||||||
SHIM_SET_MEM_64(device_data_ptr + 16, device_info.free_bytes);
|
device_data->free_bytes = device_info.free_bytes;
|
||||||
xe::store_and_swap<std::wstring>(SHIM_MEM_ADDR(device_data_ptr + 24),
|
xe::store_and_swap<std::wstring>(&device_data->name[0], device_info.name);
|
||||||
device_info.name);
|
return X_ERROR_SUCCESS;
|
||||||
|
|
||||||
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetDeviceData, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentResolve_shim(PPCContext* ppc_context,
|
dword_result_t XamContentResolve(dword_t user_index, lpvoid_t content_data_ptr,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t buffer_ptr, dword_t buffer_size,
|
||||||
uint32_t user_index = SHIM_GET_ARG_32(0);
|
dword_t unk1, dword_t unk2, dword_t unk3) {
|
||||||
uint32_t content_data_ptr = SHIM_GET_ARG_32(1);
|
auto content_data = XCONTENT_DATA((uint8_t*)content_data_ptr);
|
||||||
uint32_t buffer_ptr = SHIM_GET_ARG_32(2);
|
|
||||||
uint32_t buffer_size = SHIM_GET_ARG_32(3);
|
|
||||||
uint32_t unk1 = SHIM_GET_ARG_32(4); // 1
|
|
||||||
uint32_t unk2 = SHIM_GET_ARG_32(5); // 0
|
|
||||||
uint32_t unk3 = SHIM_GET_ARG_32(6); // 0
|
|
||||||
|
|
||||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentResolve(%d, %.8X, %.8X, %d, %.8X, %.8X, %.8X)", user_index,
|
|
||||||
content_data_ptr, buffer_ptr, buffer_size, unk1, unk2, unk3);
|
|
||||||
|
|
||||||
// Result of buffer_ptr is sent to RtlInitAnsiString.
|
// Result of buffer_ptr is sent to RtlInitAnsiString.
|
||||||
// buffer_size is usually 260 (max path).
|
// buffer_size is usually 260 (max path).
|
||||||
// Games expect zero if resolve was successful.
|
// Games expect zero if resolve was successful.
|
||||||
assert_always();
|
assert_always();
|
||||||
XELOGW("XamContentResolve unimplemented!");
|
XELOGW("XamContentResolve unimplemented!");
|
||||||
|
return X_ERROR_NOT_FOUND;
|
||||||
SHIM_SET_RETURN_32(X_ERROR_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentResolve, kContent, kStub);
|
||||||
|
|
||||||
// http://gameservice.googlecode.com/svn-history/r14/trunk/ContentManager.cpp
|
// http://gameservice.googlecode.com/svn-history/r14/trunk/ContentManager.cpp
|
||||||
// https://github.com/LestaD/SourceEngine2007/blob/master/se2007/engine/xboxsystem.cpp#L499
|
// https://github.com/LestaD/SourceEngine2007/blob/master/se2007/engine/xboxsystem.cpp#L499
|
||||||
|
@ -312,104 +287,79 @@ dword_result_t XamContentOpenFile(dword_t user_index, lpstring_t root_name,
|
||||||
}
|
}
|
||||||
DECLARE_XAM_EXPORT1(XamContentOpenFile, kContent, kStub);
|
DECLARE_XAM_EXPORT1(XamContentOpenFile, kContent, kStub);
|
||||||
|
|
||||||
SHIM_CALL XamContentFlush_shim(PPCContext* ppc_context,
|
dword_result_t XamContentFlush(lpstring_t root_name,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t root_name_ptr = SHIM_GET_ARG_32(0);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
|
|
||||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentFlush(%.8X(%s), %.8X)", root_name_ptr, root_name.c_str(),
|
|
||||||
overlapped_ptr);
|
|
||||||
|
|
||||||
X_RESULT result = X_ERROR_SUCCESS;
|
X_RESULT result = X_ERROR_SUCCESS;
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentFlush, kContent, kStub);
|
||||||
|
|
||||||
SHIM_CALL XamContentClose_shim(PPCContext* ppc_context,
|
dword_result_t XamContentClose(lpstring_t root_name,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t root_name_ptr = SHIM_GET_ARG_32(0);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
|
|
||||||
auto root_name = xe::load_and_swap<std::string>(SHIM_MEM_ADDR(root_name_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentClose(%.8X(%s), %.8X)", root_name_ptr, root_name.c_str(),
|
|
||||||
overlapped_ptr);
|
|
||||||
|
|
||||||
// Closes a previously opened root from XamContentCreate*.
|
// Closes a previously opened root from XamContentCreate*.
|
||||||
auto result = kernel_state->content_manager()->CloseContent(root_name);
|
auto result =
|
||||||
|
kernel_state()->content_manager()->CloseContent(root_name.value());
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentClose, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentGetCreator_shim(PPCContext* ppc_context,
|
dword_result_t XamContentGetCreator(dword_t user_index,
|
||||||
KernelState* kernel_state) {
|
lpvoid_t content_data_ptr,
|
||||||
uint32_t user_index = SHIM_GET_ARG_32(0);
|
lpdword_t is_creator_ptr,
|
||||||
uint32_t content_data_ptr = SHIM_GET_ARG_32(1);
|
lpqword_t creator_xuid_ptr,
|
||||||
uint32_t is_creator_ptr = SHIM_GET_ARG_32(2);
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t creator_xuid_ptr = SHIM_GET_ARG_32(3);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(4);
|
|
||||||
|
|
||||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentGetCreator(%d, %.8X, %.8X, %.8X, %.8X)", user_index,
|
|
||||||
content_data_ptr, is_creator_ptr, creator_xuid_ptr, overlapped_ptr);
|
|
||||||
|
|
||||||
auto result = X_ERROR_SUCCESS;
|
auto result = X_ERROR_SUCCESS;
|
||||||
|
|
||||||
|
auto content_data = XCONTENT_DATA((uint8_t*)content_data_ptr);
|
||||||
|
|
||||||
if (content_data.content_type == 1) {
|
if (content_data.content_type == 1) {
|
||||||
// User always creates saves.
|
// User always creates saves.
|
||||||
SHIM_SET_MEM_32(is_creator_ptr, 1);
|
*is_creator_ptr = 1;
|
||||||
if (creator_xuid_ptr) {
|
if (creator_xuid_ptr) {
|
||||||
SHIM_SET_MEM_64(creator_xuid_ptr, kernel_state->user_profile()->xuid());
|
*creator_xuid_ptr = kernel_state()->user_profile()->xuid();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_MEM_32(is_creator_ptr, 0);
|
*is_creator_ptr = 0;
|
||||||
if (creator_xuid_ptr) {
|
if (creator_xuid_ptr) {
|
||||||
SHIM_SET_MEM_64(creator_xuid_ptr, 0);
|
*creator_xuid_ptr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetCreator, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentGetThumbnail_shim(PPCContext* ppc_context,
|
dword_result_t XamContentGetThumbnail(dword_t user_index,
|
||||||
KernelState* kernel_state) {
|
lpvoid_t content_data_ptr,
|
||||||
uint32_t user_index = SHIM_GET_ARG_32(0);
|
lpvoid_t buffer_ptr,
|
||||||
uint32_t content_data_ptr = SHIM_GET_ARG_32(1);
|
lpdword_t buffer_size_ptr,
|
||||||
uint32_t buffer_ptr = SHIM_GET_ARG_32(2);
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t buffer_size_ptr = SHIM_GET_ARG_32(3);
|
assert_not_null(buffer_size_ptr);
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(4);
|
uint32_t buffer_size = *buffer_size_ptr;
|
||||||
|
auto content_data = XCONTENT_DATA((uint8_t*)content_data_ptr);
|
||||||
assert_not_zero(buffer_size_ptr);
|
|
||||||
uint32_t buffer_size = SHIM_MEM_32(buffer_size_ptr);
|
|
||||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentGetThumbnail(%d, %.8X, %.8X, %.8X(%d), %.8X)", user_index,
|
|
||||||
content_data_ptr, buffer_ptr, buffer_size_ptr, buffer_size,
|
|
||||||
overlapped_ptr);
|
|
||||||
|
|
||||||
// Get thumbnail (if it exists).
|
// Get thumbnail (if it exists).
|
||||||
std::vector<uint8_t> buffer;
|
std::vector<uint8_t> buffer;
|
||||||
auto result = kernel_state->content_manager()->GetContentThumbnail(
|
auto result = kernel_state()->content_manager()->GetContentThumbnail(
|
||||||
content_data, &buffer);
|
content_data, &buffer);
|
||||||
|
|
||||||
SHIM_SET_MEM_32(buffer_size_ptr, uint32_t(buffer.size()));
|
*buffer_size_ptr = uint32_t(buffer.size());
|
||||||
|
|
||||||
if (XSUCCEEDED(result)) {
|
if (XSUCCEEDED(result)) {
|
||||||
// Write data, if we were given a pointer.
|
// Write data, if we were given a pointer.
|
||||||
|
@ -420,80 +370,58 @@ SHIM_CALL XamContentGetThumbnail_shim(PPCContext* ppc_context,
|
||||||
result = X_ERROR_INSUFFICIENT_BUFFER;
|
result = X_ERROR_INSUFFICIENT_BUFFER;
|
||||||
} else {
|
} else {
|
||||||
// Copy data.
|
// Copy data.
|
||||||
std::memcpy(SHIM_MEM_ADDR(buffer_ptr), buffer.data(), buffer.size());
|
std::memcpy((uint8_t*)buffer_ptr, buffer.data(), buffer.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentGetThumbnail, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentSetThumbnail_shim(PPCContext* ppc_context,
|
dword_result_t XamContentSetThumbnail(dword_t user_index,
|
||||||
KernelState* kernel_state) {
|
lpvoid_t content_data_ptr,
|
||||||
uint32_t user_index = SHIM_GET_ARG_32(0);
|
lpvoid_t buffer_ptr, dword_t buffer_size,
|
||||||
uint32_t content_data_ptr = SHIM_GET_ARG_32(1);
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t buffer_ptr = SHIM_GET_ARG_32(2);
|
auto content_data = XCONTENT_DATA((uint8_t*)content_data_ptr);
|
||||||
uint32_t buffer_size = SHIM_GET_ARG_32(3);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(4);
|
|
||||||
|
|
||||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
|
||||||
|
|
||||||
XELOGD("XamContentSetThumbnail(%d, %.8X, %.8X, %d, %.8X)", user_index,
|
|
||||||
content_data_ptr, buffer_ptr, buffer_size, overlapped_ptr);
|
|
||||||
|
|
||||||
// Buffer is PNG data.
|
// Buffer is PNG data.
|
||||||
auto buffer = std::vector<uint8_t>(SHIM_MEM_ADDR(buffer_ptr),
|
auto buffer = std::vector<uint8_t>((uint8_t*)buffer_ptr,
|
||||||
SHIM_MEM_ADDR(buffer_ptr) + buffer_size);
|
(uint8_t*)buffer_ptr + buffer_size);
|
||||||
auto result = kernel_state->content_manager()->SetContentThumbnail(
|
auto result = kernel_state()->content_manager()->SetContentThumbnail(
|
||||||
content_data, std::move(buffer));
|
content_data, std::move(buffer));
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentSetThumbnail, kContent, kImplemented);
|
||||||
|
|
||||||
SHIM_CALL XamContentDelete_shim(PPCContext* ppc_context,
|
dword_result_t XamContentDelete(dword_t user_index, lpvoid_t content_data_ptr,
|
||||||
KernelState* kernel_state) {
|
lpunknown_t overlapped_ptr) {
|
||||||
uint32_t user_index = SHIM_GET_ARG_32(0);
|
auto content_data = XCONTENT_DATA((uint8_t*)content_data_ptr);
|
||||||
uint32_t content_data_ptr = SHIM_GET_ARG_32(1);
|
|
||||||
uint32_t overlapped_ptr = SHIM_GET_ARG_32(2);
|
|
||||||
|
|
||||||
auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr));
|
auto result = kernel_state()->content_manager()->DeleteContent(content_data);
|
||||||
|
|
||||||
XELOGD("XamContentDelete(%d, %.8X, %.8X)", user_index, content_data_ptr,
|
|
||||||
overlapped_ptr);
|
|
||||||
|
|
||||||
auto result = kernel_state->content_manager()->DeleteContent(content_data);
|
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, result);
|
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
return X_ERROR_IO_PENDING;
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DECLARE_XAM_EXPORT1(XamContentDelete, kContent, kImplemented);
|
||||||
|
|
||||||
void RegisterContentExports(xe::cpu::ExportResolver* export_resolver,
|
void RegisterContentExports(xe::cpu::ExportResolver* export_resolver,
|
||||||
KernelState* kernel_state) {
|
KernelState* kernel_state) {
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetLicenseMask, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceName, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceState, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceData, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentResolve, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentFlush, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentClose, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetCreator, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentGetThumbnail, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentSetThumbnail, state);
|
|
||||||
SHIM_SET_MAPPING("xam.xex", XamContentDelete, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xam
|
} // namespace xam
|
||||||
|
|
Loading…
Reference in New Issue