Adding XamUserContentRestriction* functions.

This commit is contained in:
Ben Vanik 2015-08-30 15:00:04 -07:00
parent 7711568af9
commit 87094b8257
3 changed files with 63 additions and 1 deletions

View File

@ -434,7 +434,6 @@ bool XexModule::SetupLibraryImports(const char* name,
import_name.GetString());
handler = UndefinedImport;
}
static_cast<GuestFunction*>(function)->SetupExtern(handler);
} else if (user_export_addr) {
// Rewrite PPC code to set r11 to the target address

View File

@ -962,6 +962,9 @@ XE_EXPORT(xam, 0x00000497, XamVoiceIsActiveProcess,
XE_EXPORT(xam, 0x0000049E, XGetVideoCapabilities, kFunction),
XE_EXPORT(xam, 0x000004A5, XamUserGetAgeGroup, kFunction),
XE_EXPORT(xam, 0x000004B0, XMPRegisterCodec, kFunction),
XE_EXPORT(xam, 0x000004B6, XamUserContentRestrictionGetFlags, kFunction),
XE_EXPORT(xam, 0x000004B7, XamUserContentRestrictionGetRating, kFunction),
XE_EXPORT(xam, 0x000004B8, XamUserContentRestrictionCheckAccess, kFunction),
XE_EXPORT(xam, 0x000004BC, XampXAuthStartup, kFunction),
XE_EXPORT(xam, 0x000004BD, XampXAuthShutdown, kFunction),
XE_EXPORT(xam, 0x000004BE, XamGetToken, kFunction),

View File

@ -312,6 +312,63 @@ SHIM_CALL XamUserCheckPrivilege_shim(PPCContext* ppc_context,
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
SHIM_CALL XamUserContentRestrictionGetFlags_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
uint32_t user_index = SHIM_GET_ARG_32(0);
uint32_t out_flags_ptr = SHIM_GET_ARG_32(1);
XELOGD("XamUserContentRestrictionGetFlags(%d, %.8X)", user_index,
out_flags_ptr);
// No restrictions?
SHIM_SET_MEM_32(out_flags_ptr, 0);
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
SHIM_CALL XamUserContentRestrictionGetRating_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
uint32_t user_index = SHIM_GET_ARG_32(0);
uint32_t unk1 = SHIM_GET_ARG_32(1);
uint32_t out_unk2_ptr = SHIM_GET_ARG_32(2);
uint32_t out_unk3_ptr = SHIM_GET_ARG_32(3);
XELOGD("XamUserContentRestrictionGetRating(%d, %.8X, %.8X, %.8X)", user_index,
unk1, out_unk2_ptr, out_unk3_ptr);
// Some games have special case paths for 3F that differ from the failure
// path, so my guess is that's 'don't care'.
SHIM_SET_MEM_32(out_unk2_ptr, 0x3F);
SHIM_SET_MEM_32(out_unk3_ptr, 0);
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
SHIM_CALL XamUserContentRestrictionCheckAccess_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
uint32_t user_index = SHIM_GET_ARG_32(0);
uint32_t unk1 = SHIM_GET_ARG_32(1);
uint32_t unk2 = SHIM_GET_ARG_32(2);
uint32_t unk3 = SHIM_GET_ARG_32(3);
uint32_t unk4 = SHIM_GET_ARG_32(4);
uint32_t out_unk5_ptr = SHIM_GET_ARG_32(5);
uint32_t overlapped_ptr = SHIM_GET_ARG_32(6);
XELOGD(
"XamUserContentRestrictionCheckAccess(%d, %.8X, %.8X, %.8X, %.8X, %.8X, "
"%.8X)",
user_index, unk1, unk2, unk3, unk4, out_unk5_ptr, overlapped_ptr);
SHIM_SET_MEM_32(out_unk5_ptr, 1);
if (overlapped_ptr) {
// TODO(benvanik): does this need the access arg on it?
kernel_state->CompleteOverlappedImmediate(overlapped_ptr, X_ERROR_SUCCESS);
}
SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}
SHIM_CALL XamUserAreUsersFriends_shim(PPCContext* ppc_context,
KernelState* kernel_state) {
uint32_t user_index = SHIM_GET_ARG_32(0);
@ -493,6 +550,9 @@ void xe::kernel::xam::RegisterUserExports(
SHIM_SET_MAPPING("xam.xex", XamUserReadProfileSettings, state);
SHIM_SET_MAPPING("xam.xex", XamUserWriteProfileSettings, state);
SHIM_SET_MAPPING("xam.xex", XamUserCheckPrivilege, state);
SHIM_SET_MAPPING("xam.xex", XamUserContentRestrictionGetFlags, state);
SHIM_SET_MAPPING("xam.xex", XamUserContentRestrictionGetRating, state);
SHIM_SET_MAPPING("xam.xex", XamUserContentRestrictionCheckAccess, state);
SHIM_SET_MAPPING("xam.xex", XamUserAreUsersFriends, state);
SHIM_SET_MAPPING("xam.xex", XamShowSigninUI, state);
SHIM_SET_MAPPING("xam.xex", XamUserCreateAchievementEnumerator, state);