[GPU] Added janky(?) support for register: D1MODE_V_COUNTER

Put internal_display_resolution into graphics_system

Thanks Beeanyew for initial implementation
This commit is contained in:
Gliniak
2024-08-31 23:37:21 +02:00
parent 4452e300ac
commit ed843f35f8
6 changed files with 50 additions and 42 deletions

View File

@@ -20,28 +20,6 @@
#include "xenia/kernel/xboxkrnl/xboxkrnl_rtl.h"
#include "xenia/xbox.h"
DEFINE_int32(internal_display_resolution, 8,
"Allow game that support different resolutions to be rendered "
"in specific resolution.\n"
" 0=640x480\n"
" 1=640x576\n"
" 2=720x480\n"
" 3=720x576\n"
" 4=800x600\n"
" 5=848x480\n"
" 6=1024x768\n"
" 7=1152x864\n"
" 8=1280x720 (Default)\n"
" 9=1280x768\n"
" 10=1280x960\n"
" 11=1280x1024\n"
" 12=1360x768\n"
" 13=1440x900\n"
" 14=1680x1050\n"
" 15=1920x540\n"
" 16=1920x1080\n",
"Video");
DEFINE_int32(
video_standard, 1,
"Enables switching between different video signals.\n 1=NTSC\n "
@@ -66,22 +44,6 @@ DEFINE_double(kernel_display_gamma_power, 2.22222233,
"Display gamma to use with kernel_display_gamma_type 3.",
"Kernel");
static const std::vector<std::pair<uint16_t, uint16_t>>
internal_display_resolution_entries = {
{640, 480}, {640, 576}, {720, 480}, {720, 576}, {800, 600},
{848, 480}, {1024, 768}, {1152, 864}, {1280, 720}, {1280, 768},
{1280, 960}, {1280, 1024}, {1360, 768}, {1440, 900}, {1680, 1050},
{1920, 540}, {1920, 1080}};
std::pair<uint16_t, uint16_t> GetInternalDisplayResolution() {
if (cvars::internal_display_resolution >
internal_display_resolution_entries.size()) {
return internal_display_resolution_entries[8];
}
return internal_display_resolution_entries
[cvars::internal_display_resolution];
}
inline constexpr static uint32_t GetVideoStandard() {
if (cvars::video_standard < 1 || cvars::video_standard > 3) {
return 1;
@@ -110,7 +72,7 @@ static std::pair<uint32_t, uint32_t> CalculateScaledAspectRatio(uint32_t fb_x,
uint32_t display_x = dar.first;
uint32_t display_y = dar.second;
auto res = GetInternalDisplayResolution();
auto res = xe::gpu::GraphicsSystem::GetInternalDisplayResolution();
uint32_t res_x = res.first;
uint32_t res_y = res.second;
@@ -244,7 +206,7 @@ void VdQueryVideoMode(X_VIDEO_MODE* video_mode) {
// TODO(benvanik): get info from actual display.
std::memset(video_mode, 0, sizeof(X_VIDEO_MODE));
auto display_res = GetInternalDisplayResolution();
auto display_res = gpu::GraphicsSystem::GetInternalDisplayResolution();
video_mode->display_width = display_res.first;
video_mode->display_height = display_res.second;