From b5d319834e9830c98ff3ecda6816beaee687300b Mon Sep 17 00:00:00 2001 From: The-Little-Wolf <116989599+The-Little-Wolf@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:49:18 -0800 Subject: [PATCH] [XboxKrnl/xconfig.cc] - Fixes and logging changes - Adding more information in logs for easier debugging - XamSetDashContext correction - XCONFIG_USER_VIDEO_FLAGS reports widescreen when set in config by user - XCONFIG_SECURED_AV_REGION reports proper values when set in config by user - Added missing \n --- src/xenia/gpu/graphics_system.cc | 2 +- src/xenia/kernel/xam/user_profile.cc | 6 ++-- src/xenia/kernel/xam/xam_ui.cc | 2 ++ src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc | 32 +++++++++++++++++-- src/xenia/xbox.h | 8 +---- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index 6d1aebb31..9cf1a048a 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -35,7 +35,7 @@ DEFINE_uint32(internal_display_resolution, 8, "Allow games that support different resolutions to render " "in a specific resolution.\n" "This is not guaranteed to work with all games or improve " - "performance." + "performance.\n" " 0=640x480\n" " 1=640x576\n" " 2=720x480\n" diff --git a/src/xenia/kernel/xam/user_profile.cc b/src/xenia/kernel/xam/user_profile.cc index 513b35943..e69383efa 100644 --- a/src/xenia/kernel/xam/user_profile.cc +++ b/src/xenia/kernel/xam/user_profile.cc @@ -170,7 +170,8 @@ void UserProfile::LoadSetting(UserSetting* setting) { } else { // Unsupported for now. Other settings aren't per-game and need to be // stored some other way. - XELOGW("Attempting to load unsupported profile setting from disk"); + XELOGW("Attempting to load unsupported profile setting 0x{:08X} from disk", + setting->GetSettingId()); } } @@ -204,7 +205,8 @@ void UserProfile::SaveSetting(UserSetting* setting) { } else { // Unsupported for now. Other settings aren't per-game and need to be // stored some other way. - XELOGW("Attempting to save unsupported profile setting to disk"); + XELOGW("Attempting to save unsupported profile setting 0x{:08X} from disk", + setting->GetSettingId()); } } diff --git a/src/xenia/kernel/xam/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc index c96a51f58..9f123675e 100644 --- a/src/xenia/kernel/xam/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -1255,6 +1255,8 @@ DECLARE_XAM_EXPORT1(XamShowCommunitySessionsUI, kNone, kStub); dword_result_t XamSetDashContext_entry(dword_t value, const ppc_context_t& ctx) { ctx->kernel_state->dash_context_ = value; + kernel_state()->BroadcastNotification( + kXNotificationDvdDriveUnknownDashContext, 0); return 0; } diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc index 8c8b009c7..60de87503 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc @@ -37,6 +37,10 @@ DEFINE_int32(user_country, 103, " 102=UA 103=US 104=UY 105=UZ 106=VE 107=VN 108=YE 109=ZA\n", "XConfig"); +DECLARE_bool(widescreen); +DECLARE_bool(use_50Hz_mode); +DECLARE_int32(video_standard); + namespace xe { namespace kernel { namespace xboxkrnl { @@ -56,9 +60,26 @@ X_STATUS xeExGetXConfigSetting(uint16_t category, uint16_t setting, switch (setting) { case 0x0002: // XCONFIG_SECURED_AV_REGION setting_size = 4; - xe::store_and_swap(value, 0x00001000); // USA/Canada + switch (cvars::video_standard) { + case 1: // NTSCM + xe::store_and_swap(value, 0x00400100); + break; + case 2: // NTSCJ + xe::store_and_swap(value, 0x00400200); + break; + case 3: // PAL + xe::store_and_swap( + value, cvars::use_50Hz_mode ? 0x00800300 : 0x00400400); + break; + default: + xe::store_and_swap(value, 0); + break; + } break; default: + XELOGW( + "An unimplemented setting 0x{:04X} in XCONFIG SECURED CATEGORY", + static_cast(setting)); assert_unhandled_case(setting); return X_STATUS_INVALID_PARAMETER_2; } @@ -83,7 +104,10 @@ X_STATUS xeExGetXConfigSetting(uint16_t category, uint16_t setting, break; case 0x000A: // XCONFIG_USER_VIDEO_FLAGS setting_size = 4; - xe::store_and_swap(value, 0x00040000); + // 0x00040000 normal + // 0x00050000 widescreen + xe::store_and_swap( + value, cvars::widescreen ? 0x00050000 : 0x00040000); break; case 0x000C: // XCONFIG_USER_RETAIL_FLAGS setting_size = 4; @@ -95,11 +119,15 @@ X_STATUS xeExGetXConfigSetting(uint16_t category, uint16_t setting, value[0] = static_cast(cvars::user_country); break; default: + XELOGW("An unimplemented setting 0x{:04X} in XCONFIG USER CATEGORY", + static_cast(setting)); assert_unhandled_case(setting); return X_STATUS_INVALID_PARAMETER_2; } break; default: + XELOGW("An unimplemented category 0x{:04X}", + static_cast(category)); assert_unhandled_case(category); return X_STATUS_INVALID_PARAMETER_1; } diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index dfe1c74e7..484bcafe8 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -272,13 +272,6 @@ constexpr uint8_t XUserIndexAny = 0xFF; // https://github.com/ThirteenAG/Ultimate-ASI-Loader/blob/master/source/xlive/xliveless.h typedef uint32_t XNotificationID; enum : XNotificationID { - /* Notes: - - kXNotificationSystemUnknown, kXNotificationLiveUnknown, - kXNotificationCustomGamercard, kXNotificationDvdDriveUnknown, - kXNotificationXmpUnknown, kXNotificationFriendsUnknown, and - kXNotificationMsgrUnknown are all called together by XNotifyBroadcast - */ - // Notification Areas kXNotifySystem = 0x00000001, kXNotifyLive = 0x00000002, @@ -333,6 +326,7 @@ enum : XNotificationID { // XNotification Dvd ? kXNotificationDvdDriveUnknown = 0x80000003, + kXNotificationDvdDriveUnknownDashContext = 0x8000000C, kXNotificationDvdDriveTrayStateChanged = 0x8000000D, // XNotification XMP (13 total)