mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-11 02:48:01 -05:00
Settings: Add resolution scaling to settings.
This commit is contained in:
@ -106,6 +106,57 @@ float Volume() {
|
||||
return values.volume.GetValue() / 100.0f;
|
||||
}
|
||||
|
||||
void UpdateRescalingInfo() {
|
||||
auto setup = values.resolution_setup.GetValue();
|
||||
auto& info = values.resolution_info;
|
||||
switch (setup) {
|
||||
case ResolutionSetup::Res1_2X: {
|
||||
info.up_scale = 1;
|
||||
info.down_shift = 1;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res3_4X: {
|
||||
info.up_scale = 3;
|
||||
info.down_shift = 2;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res1X: {
|
||||
info.up_scale = 1;
|
||||
info.down_shift = 0;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res3_2X: {
|
||||
info.up_scale = 3;
|
||||
info.down_shift = 1;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res2X: {
|
||||
info.up_scale = 2;
|
||||
info.down_shift = 0;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res3X: {
|
||||
info.up_scale = 3;
|
||||
info.down_shift = 0;
|
||||
break;
|
||||
}
|
||||
case ResolutionSetup::Res4X: {
|
||||
info.up_scale = 4;
|
||||
info.down_shift = 0;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
UNREACHABLE();
|
||||
info.up_scale = 1;
|
||||
info.down_shift = 0;
|
||||
}
|
||||
}
|
||||
info.up_factor = static_cast<f32>(info.up_scale) / (1U << info.down_shift);
|
||||
info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale;
|
||||
info.size_up = info.up_scale * info.up_scale;
|
||||
info.size_shift = info.down_shift * 2;
|
||||
}
|
||||
|
||||
void RestoreGlobalState(bool is_powered_on) {
|
||||
// If a game is running, DO NOT restore the global settings state
|
||||
if (is_powered_on) {
|
||||
|
@ -56,16 +56,19 @@ enum class ResolutionSetup : u32 {
|
||||
Res1_2X = 0,
|
||||
Res3_4X = 1,
|
||||
Res1X = 2,
|
||||
Res3_2K = 3,
|
||||
Res3_2X = 3,
|
||||
Res2X = 4,
|
||||
Res3X = 5,
|
||||
Res4X = 6,
|
||||
};
|
||||
|
||||
struct ResolutionScalingInfo {
|
||||
u32 up_scale{2};
|
||||
u32 up_scale{1};
|
||||
u32 down_shift{0};
|
||||
f32 up_factor{2.0f};
|
||||
f32 down_factor{0.5f};
|
||||
f32 up_factor{1.0f};
|
||||
f32 down_factor{1.0f};
|
||||
u32 size_up{1};
|
||||
u32 size_shift{0};
|
||||
};
|
||||
|
||||
/** The BasicSetting class is a simple resource manager. It defines a label and default value
|
||||
@ -613,6 +616,8 @@ std::string GetTimeZoneString();
|
||||
|
||||
void LogSettings();
|
||||
|
||||
void UpdateRescalingInfo();
|
||||
|
||||
// Restore the global state of all applicable settings in the Values struct
|
||||
void RestoreGlobalState(bool is_powered_on);
|
||||
|
||||
|
Reference in New Issue
Block a user