[GPU] Custom resolution

Does not work without patches.
This commit is contained in:
Margen67 2024-10-19 02:04:02 -07:00
parent 6c0f026824
commit 8af296a200
1 changed files with 28 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include "xenia/base/math.h" #include "xenia/base/math.h"
#include "xenia/base/profiling.h" #include "xenia/base/profiling.h"
#include "xenia/base/threading.h" #include "xenia/base/threading.h"
#include "xenia/config.h"
#include "xenia/gpu/command_processor.h" #include "xenia/gpu/command_processor.h"
#include "xenia/gpu/gpu_flags.h" #include "xenia/gpu/gpu_flags.h"
#include "xenia/kernel/kernel_state.h" #include "xenia/kernel/kernel_state.h"
@ -33,6 +34,8 @@
DEFINE_uint32(internal_display_resolution, 8, DEFINE_uint32(internal_display_resolution, 8,
"Allow games that support different resolutions to render " "Allow games that support different resolutions to render "
"in a specific resolution.\n" "in a specific resolution.\n"
"This is not guaranteed to work with all games or improve "
"performance."
" 0=640x480\n" " 0=640x480\n"
" 1=640x576\n" " 1=640x576\n"
" 2=720x480\n" " 2=720x480\n"
@ -49,7 +52,14 @@ DEFINE_uint32(internal_display_resolution, 8,
" 13=1440x900\n" " 13=1440x900\n"
" 14=1680x1050\n" " 14=1680x1050\n"
" 15=1920x540\n" " 15=1920x540\n"
" 16=1920x1080\n", " 16=1920x1080\n"
" 17=internal_display_resolution_x/y",
"Video");
DEFINE_uint32(internal_display_resolution_x, 1280,
"Custom width. See internal_display_resolution. Range 1-1920.",
"Video");
DEFINE_uint32(internal_display_resolution_y, 720,
"Custom height. See internal_display_resolution. Range 1-1080.\n",
"Video"); "Video");
DEFINE_bool( DEFINE_bool(
@ -93,6 +103,21 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
scaled_aspect_x_ = 16; scaled_aspect_x_ = 16;
scaled_aspect_y_ = 9; scaled_aspect_y_ = 9;
auto custom_res_x = cvars::internal_display_resolution_x;
auto custom_res_y = cvars::internal_display_resolution_y;
if (!custom_res_x || custom_res_x > 1920 || !custom_res_y ||
custom_res_y > 1080) {
OVERRIDE_uint32(internal_display_resolution_x,
internal_display_resolution_entries[8].first);
OVERRIDE_uint32(internal_display_resolution_y,
internal_display_resolution_entries[8].second);
config::SaveConfig();
xe::FatalError(fmt::format(
"Invalid custom resolution specified: {}x{}\n"
"Width must be between 1-1920.\nHeight must be between 1-1080.",
custom_res_x, custom_res_y));
}
if (provider_) { if (provider_) {
// Safe if either the UI thread call or the presenter creation fails. // Safe if either the UI thread call or the presenter creation fails.
if (app_context_) { if (app_context_) {
@ -408,7 +433,8 @@ bool GraphicsSystem::Restore(ByteStream* stream) {
std::pair<uint16_t, uint16_t> GraphicsSystem::GetInternalDisplayResolution() { std::pair<uint16_t, uint16_t> GraphicsSystem::GetInternalDisplayResolution() {
if (cvars::internal_display_resolution >= if (cvars::internal_display_resolution >=
internal_display_resolution_entries.size()) { internal_display_resolution_entries.size()) {
return internal_display_resolution_entries[8]; return {cvars::internal_display_resolution_x,
cvars::internal_display_resolution_y};
} }
return internal_display_resolution_entries return internal_display_resolution_entries
[cvars::internal_display_resolution]; [cvars::internal_display_resolution];