From 6ebb52227096f9ab3f6b37efd49037ba21068a5b Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 20 May 2024 20:08:52 +0200 Subject: [PATCH] [Kernel] Added option to use PAL-50 mode --- src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc index 5999a09c2..883091a7c 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc @@ -42,6 +42,13 @@ DEFINE_int32(internal_display_resolution, 8, " 16=1920x1080\n", "Display"); +DEFINE_int32( + video_standard, 1, + "Enables switching between different video signals.\n 1=NTSC\n " + "2=NTSC-J\n 3=PAL\n", + "Video"); + +DEFINE_bool(use_50Hz_mode, false, "Enables usage of PAL-50 mode.", "Video"); // BT.709 on modern monitors and TVs looks the closest to the Xbox 360 connected // to an HDTV. DEFINE_uint32(kernel_display_gamma_type, 2, @@ -69,6 +76,18 @@ std::pair GetInternalDisplayResolution() { [cvars::internal_display_resolution]; } +inline constexpr static uint32_t GetVideoStandard() { + if (cvars::video_standard < 1 || cvars::video_standard > 3) { + return 1; + } + + return cvars::video_standard; +} + +inline constexpr static float GetVideoRefreshRate() { + return cvars::use_50Hz_mode ? 50.0f : 60.0f; +} + namespace xe { namespace kernel { namespace xboxkrnl { @@ -181,8 +200,8 @@ void VdQueryVideoMode(X_VIDEO_MODE* video_mode) { video_mode->is_widescreen = ((video_mode->display_width / 4) > (video_mode->display_height / 3)); video_mode->is_hi_def = video_mode->display_width >= 0x400; - video_mode->refresh_rate = 60.0f; - video_mode->video_standard = 1; // NTSC + video_mode->refresh_rate = GetVideoRefreshRate(); + video_mode->video_standard = GetVideoStandard(); video_mode->unknown_0x8a = 0x4A; video_mode->unknown_0x01 = 0x01; }