mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[XAM] Added overlap to XamUserWriteProfileSettings
This fixes saving in Earthworm Jim Additionally fixed issue with not setting xuid to -1 when not provided
This commit is contained in:
parent
c4867250e4
commit
23d1f7a308
|
|
@ -319,6 +319,7 @@ uint32_t XamUserReadProfileSettingsEx(uint32_t title_id, uint32_t user_index,
|
||||||
if (xuids) {
|
if (xuids) {
|
||||||
out_setting->xuid = user_profile->xuid();
|
out_setting->xuid = user_profile->xuid();
|
||||||
} else {
|
} else {
|
||||||
|
out_setting->xuid = -1;
|
||||||
out_setting->user_index = user_index;
|
out_setting->user_index = user_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -355,24 +356,21 @@ DECLARE_XAM_EXPORT1(XamUserReadProfileSettingsEx, kUserProfiles, kImplemented);
|
||||||
|
|
||||||
dword_result_t XamUserWriteProfileSettings_entry(
|
dword_result_t XamUserWriteProfileSettings_entry(
|
||||||
dword_t title_id, dword_t user_index, dword_t setting_count,
|
dword_t title_id, dword_t user_index, dword_t setting_count,
|
||||||
pointer_t<X_USER_PROFILE_SETTING> settings,
|
pointer_t<X_USER_PROFILE_SETTING> settings, lpvoid_t overlapped) {
|
||||||
pointer_t<XAM_OVERLAPPED> overlapped) {
|
|
||||||
if (!setting_count || !settings) {
|
if (!setting_count || !settings) {
|
||||||
return X_ERROR_INVALID_PARAMETER;
|
return X_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto run = [=](uint32_t& extended_error, uint32_t& length) {
|
||||||
// Update and save settings.
|
// Update and save settings.
|
||||||
const auto& user_profile =
|
const auto& user_profile =
|
||||||
kernel_state()->xam_state()->GetUserProfile(user_index);
|
kernel_state()->xam_state()->GetUserProfile(user_index);
|
||||||
|
|
||||||
// Skip writing data about users with id != 0 they're not supported
|
// Skip writing data about users with id != 0 they're not supported
|
||||||
if (!user_profile) {
|
if (!user_profile) {
|
||||||
if (overlapped) {
|
extended_error = X_HRESULT_FROM_WIN32(X_ERROR_NO_SUCH_USER);
|
||||||
kernel_state()->CompleteOverlappedImmediate(
|
length = 0;
|
||||||
kernel_state()->memory()->HostToGuestVirtual(overlapped),
|
return X_ERROR_NO_SUCH_USER;
|
||||||
X_ERROR_NO_SUCH_USER);
|
|
||||||
return X_ERROR_IO_PENDING;
|
|
||||||
}
|
|
||||||
return X_ERROR_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t n = 0; n < setting_count; ++n) {
|
for (uint32_t n = 0; n < setting_count; ++n) {
|
||||||
|
|
@ -386,11 +384,18 @@ dword_result_t XamUserWriteProfileSettings_entry(
|
||||||
user_profile->xuid(), title_id, &setting);
|
user_profile->xuid(), title_id, &setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlapped) {
|
extended_error = X_HRESULT_FROM_WIN32(X_STATUS_SUCCESS);
|
||||||
kernel_state()->CompleteOverlappedImmediate(overlapped, X_ERROR_SUCCESS);
|
length = 0;
|
||||||
return X_ERROR_IO_PENDING;
|
return X_STATUS_SUCCESS;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!overlapped) {
|
||||||
|
uint32_t extended_error, length;
|
||||||
|
return run(extended_error, length);
|
||||||
}
|
}
|
||||||
return X_ERROR_SUCCESS;
|
|
||||||
|
kernel_state()->CompleteOverlappedDeferredEx(run, overlapped);
|
||||||
|
return X_ERROR_IO_PENDING;
|
||||||
}
|
}
|
||||||
DECLARE_XAM_EXPORT1(XamUserWriteProfileSettings, kUserProfiles, kImplemented);
|
DECLARE_XAM_EXPORT1(XamUserWriteProfileSettings, kUserProfiles, kImplemented);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue