[XConfig] Implementation of XConfig
This commit is contained in:
committed by
Radosław Gliński
parent
f88bfbe41e
commit
99ea6da18a
@@ -23,34 +23,10 @@
|
||||
#include "xenia/ui/window.h"
|
||||
#include "xenia/ui/windowed_app_context.h"
|
||||
|
||||
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.\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"
|
||||
" 17=internal_display_resolution_x/y",
|
||||
"Video");
|
||||
DEFINE_uint32(internal_display_resolution_x, 1280,
|
||||
DEFINE_uint32(custom_internal_display_resolution_x, 0,
|
||||
"Custom width. See internal_display_resolution. Range 1-1920.",
|
||||
"Video");
|
||||
DEFINE_uint32(internal_display_resolution_y, 720,
|
||||
DEFINE_uint32(custom_internal_display_resolution_y, 0,
|
||||
"Custom height. See internal_display_resolution. Range 1-1080.\n",
|
||||
"Video");
|
||||
|
||||
@@ -95,21 +71,6 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
|
||||
scaled_aspect_x_ = 16;
|
||||
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 (with_presentation && provider_) {
|
||||
// Safe if either the UI thread call or the presenter creation fails.
|
||||
if (app_context_) {
|
||||
@@ -175,8 +136,15 @@ X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
|
||||
#endif
|
||||
|
||||
while (frame_limiter_worker_running_) {
|
||||
// If there is no title running then there is no need for guest
|
||||
// frame limiter thread.
|
||||
if (!kernel_state_->title_id()) {
|
||||
xe::threading::Sleep(std::chrono::milliseconds(100));
|
||||
continue;
|
||||
}
|
||||
|
||||
register_file()->values[XE_GPU_REG_D1MODE_V_COUNTER] +=
|
||||
GetInternalDisplayResolution().second;
|
||||
GetResolution().second;
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
if (cvars::vsync) {
|
||||
@@ -454,14 +422,23 @@ bool GraphicsSystem::Restore(ByteStream* stream) {
|
||||
return command_processor_->Restore(stream);
|
||||
}
|
||||
|
||||
std::pair<uint16_t, uint16_t> GraphicsSystem::GetInternalDisplayResolution() {
|
||||
if (cvars::internal_display_resolution >=
|
||||
internal_display_resolution_entries.size()) {
|
||||
return {cvars::internal_display_resolution_x,
|
||||
cvars::internal_display_resolution_y};
|
||||
std::pair<uint32_t, uint32_t> GraphicsSystem::GetResolution() const {
|
||||
if (!kernel_state_) {
|
||||
return {1280, 720};
|
||||
}
|
||||
return internal_display_resolution_entries
|
||||
[cvars::internal_display_resolution];
|
||||
|
||||
if (cvars::custom_internal_display_resolution_x != 0 &&
|
||||
cvars::custom_internal_display_resolution_y != 0) {
|
||||
return {cvars::custom_internal_display_resolution_x,
|
||||
cvars::custom_internal_display_resolution_y};
|
||||
}
|
||||
|
||||
const auto resolution =
|
||||
kernel::Resolution(kernel_state()->xconfig()->ReadSetting<uint32_t>(
|
||||
kernel::XCONFIG_USER_CATEGORY,
|
||||
kernel::XCONFIG_USER_AV_COMPOSITE_SCREENSZ));
|
||||
|
||||
return {resolution.width_, resolution.height_};
|
||||
}
|
||||
|
||||
} // namespace gpu
|
||||
|
||||
@@ -34,28 +34,6 @@ class Emulator;
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
constexpr std::array<std::pair<uint16_t, uint16_t>, 17>
|
||||
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}}};
|
||||
|
||||
constexpr std::array<std::pair<uint16_t, uint16_t>, 3>
|
||||
driver_display_resolution = {{{1440, 900}, {1280, 720}, {1680, 1050}}};
|
||||
|
||||
class CommandProcessor;
|
||||
|
||||
class GraphicsSystem {
|
||||
@@ -109,7 +87,7 @@ class GraphicsSystem {
|
||||
bool Save(ByteStream* stream);
|
||||
bool Restore(ByteStream* stream);
|
||||
|
||||
static std::pair<uint16_t, uint16_t> GetInternalDisplayResolution();
|
||||
std::pair<uint32_t, uint32_t> GetResolution() const;
|
||||
|
||||
std::pair<uint32_t, uint32_t> GetScaledAspectRatio() const {
|
||||
return {scaled_aspect_x_, scaled_aspect_y_};
|
||||
|
||||
Reference in New Issue
Block a user