Don't store xam launch data in guest memory.
This commit is contained in:
parent
75908a9865
commit
9abfc52b77
|
@ -36,6 +36,11 @@ SHIM_CALL XamGetSystemVersion_shim(PPCContext* ppc_context,
|
||||||
SHIM_SET_RETURN_32(0);
|
SHIM_SET_RETURN_32(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XCustomRegisterDynamicActions() {
|
||||||
|
// ???
|
||||||
|
}
|
||||||
|
DECLARE_XAM_EXPORT(XCustomRegisterDynamicActions, ExportTag::kStub);
|
||||||
|
|
||||||
SHIM_CALL XGetAVPack_shim(PPCContext* ppc_context, KernelState* kernel_state) {
|
SHIM_CALL XGetAVPack_shim(PPCContext* ppc_context, KernelState* kernel_state) {
|
||||||
// DWORD
|
// DWORD
|
||||||
// Not sure what the values are for this, but 6 is VGA.
|
// Not sure what the values are for this, but 6 is VGA.
|
||||||
|
@ -97,16 +102,9 @@ dword_result_t XamLoaderSetLaunchData(lpvoid_t data, dword_t size) {
|
||||||
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
|
||||||
|
|
||||||
auto& loader_data = xam->loader_data();
|
auto& loader_data = xam->loader_data();
|
||||||
if (loader_data.launch_data_ptr) {
|
|
||||||
kernel_memory()->SystemHeapFree(loader_data.launch_data_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
loader_data.launch_data_present = size ? true : false;
|
loader_data.launch_data_present = size ? true : false;
|
||||||
loader_data.launch_data_ptr = kernel_memory()->SystemHeapAlloc(size);
|
loader_data.launch_data.resize(size);
|
||||||
loader_data.launch_data_size = size;
|
std::memcpy(loader_data.launch_data.data(), data, size);
|
||||||
|
|
||||||
std::memcpy(kernel_memory()->TranslateVirtual(loader_data.launch_data_ptr),
|
|
||||||
data, size);
|
|
||||||
|
|
||||||
// FIXME: Unknown return value.
|
// FIXME: Unknown return value.
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -118,7 +116,7 @@ dword_result_t XamLoaderGetLaunchDataSize(lpdword_t size_ptr) {
|
||||||
auto& loader_data = xam->loader_data();
|
auto& loader_data = xam->loader_data();
|
||||||
|
|
||||||
if (loader_data.launch_data_present) {
|
if (loader_data.launch_data_present) {
|
||||||
*size_ptr = xam->loader_data().launch_data_size;
|
*size_ptr = uint32_t(xam->loader_data().launch_data.size());
|
||||||
return X_ERROR_SUCCESS;
|
return X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,16 +132,9 @@ dword_result_t XamLoaderGetLaunchData(lpvoid_t buffer_ptr,
|
||||||
return X_ERROR_NOT_FOUND;
|
return X_ERROR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loader_data.launch_data_ptr) {
|
uint32_t copy_size =
|
||||||
uint8_t* loader_buffer_ptr =
|
std::min(uint32_t(loader_data.launch_data.size()), uint32_t(buffer_size));
|
||||||
kernel_memory()->TranslateVirtual(loader_data.launch_data_ptr);
|
std::memcpy(buffer_ptr, loader_data.launch_data.data(), copy_size);
|
||||||
|
|
||||||
uint32_t copy_size =
|
|
||||||
std::min(loader_data.launch_data_size, (uint32_t)buffer_size);
|
|
||||||
|
|
||||||
std::memcpy(buffer_ptr, loader_buffer_ptr, copy_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return X_ERROR_SUCCESS;
|
return X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
DECLARE_XAM_EXPORT(XamLoaderGetLaunchData, ExportTag::kSketchy);
|
DECLARE_XAM_EXPORT(XamLoaderGetLaunchData, ExportTag::kSketchy);
|
||||||
|
|
|
@ -30,8 +30,7 @@ class XamModule : public KernelModule {
|
||||||
|
|
||||||
struct LoaderData {
|
struct LoaderData {
|
||||||
bool launch_data_present = false;
|
bool launch_data_present = false;
|
||||||
uint32_t launch_data_ptr = 0;
|
std::vector<uint8_t> launch_data;
|
||||||
uint32_t launch_data_size = 0;
|
|
||||||
uint32_t launch_flags = 0;
|
uint32_t launch_flags = 0;
|
||||||
std::string launch_path; // Full path to next xex
|
std::string launch_path; // Full path to next xex
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue