[Kernel] Cleanup XamLoaderSetLaunchData, XamLoaderGetLaunchData.

This commit is contained in:
gibbed 2018-11-22 04:29:35 -06:00
parent 473b9d3c3a
commit 463f21e484
1 changed files with 7 additions and 10 deletions

View File

@ -92,27 +92,24 @@ dword_result_t XamLoaderSetLaunchData(lpvoid_t data, dword_t size) {
loader_data.launch_data_present = size ? true : false; loader_data.launch_data_present = size ? true : false;
loader_data.launch_data.resize(size); loader_data.launch_data.resize(size);
std::memcpy(loader_data.launch_data.data(), data, size); std::memcpy(loader_data.launch_data.data(), data, size);
// FIXME: Unknown return value.
return 0; return 0;
} }
DECLARE_XAM_EXPORT1(XamLoaderSetLaunchData, kNone, kSketchy); DECLARE_XAM_EXPORT1(XamLoaderSetLaunchData, kNone, kSketchy);
dword_result_t XamLoaderGetLaunchDataSize(lpdword_t size_ptr) { dword_result_t XamLoaderGetLaunchDataSize(lpdword_t size_ptr) {
auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
auto& loader_data = xam->loader_data();
if (!size_ptr) { if (!size_ptr) {
return X_ERROR_INVALID_PARAMETER; return X_ERROR_INVALID_PARAMETER;
} }
if (loader_data.launch_data_present) { auto xam = kernel_state()->GetKernelModule<XamModule>("xam.xex");
*size_ptr = uint32_t(xam->loader_data().launch_data.size()); auto& loader_data = xam->loader_data();
return X_ERROR_SUCCESS; if (!loader_data.launch_data_present) {
*size_ptr = 0;
return X_ERROR_NOT_FOUND;
} }
*size_ptr = 0; *size_ptr = uint32_t(xam->loader_data().launch_data.size());
return X_ERROR_NOT_FOUND; return X_ERROR_SUCCESS;
} }
DECLARE_XAM_EXPORT1(XamLoaderGetLaunchDataSize, kNone, kSketchy); DECLARE_XAM_EXPORT1(XamLoaderGetLaunchDataSize, kNone, kSketchy);