Fix for the aspect ratio plugin variable. Disable aspect ratio control in stretch mode.

This commit is contained in:
Henrik Rydgård 2022-11-27 21:55:22 +01:00
parent 7c72fa06ee
commit 72ec865f7e
2 changed files with 15 additions and 6 deletions

View file

@ -2046,15 +2046,23 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
return 0;
case EMULATOR_DEVCTL__GET_ASPECT_RATIO:
if (Memory::IsValidAddress(outPtr)) {
float ar = g_Config.fDisplayAspectRatio * (480.0f / 272.0f);
Memory::Write_U32(*(reinterpret_cast<u32*>(&ar)), outPtr);
// TODO: Share code with CenterDisplayOutputRect to take a few more things into account.
// I have a planned further refactoring.
float ar;
if (g_Config.bDisplayStretch) {
ar = (float)dp_xres / (float)dp_yres;
} else {
ar = g_Config.fDisplayAspectRatio * (480.0f / 272.0f);
}
Memory::Write_Float(ar, outPtr);
}
return 0;
case EMULATOR_DEVCTL__GET_SCALE:
if (Memory::IsValidAddress(outPtr)) {
// TODO: Maybe do something more sophisticated taking the longest side and screen rotation
// into account, etc.
Memory::Write_U32(static_cast<float>(dp_xres) * g_Config.fDisplayScale / 480.0f, outPtr);
float scale = float(dp_xres) * g_Config.fDisplayScale / 480.0f;
Memory::Write_Float(scale, outPtr);
}
return 0;
case EMULATOR_DEVCTL__GET_LTRIGGER:

View file

@ -204,12 +204,13 @@ void DisplayLayoutScreen::CreateViews() {
rightScrollView->Add(rightColumn);
root_->Add(rightScrollView);
PopupSliderChoiceFloat *aspectRatio = new PopupSliderChoiceFloat(&g_Config.fDisplayAspectRatio, 0.5f, 2.0f, di->T("Aspect Ratio"), screenManager());
leftColumn->Add(aspectRatio);
auto stretch = new CheckBox(&g_Config.bDisplayStretch, gr->T("Stretch"));
leftColumn->Add(stretch);
PopupSliderChoiceFloat *aspectRatio = new PopupSliderChoiceFloat(&g_Config.fDisplayAspectRatio, 0.5f, 2.0f, di->T("Aspect Ratio"), screenManager());
leftColumn->Add(aspectRatio);
aspectRatio->SetDisabledPtr(&g_Config.bDisplayStretch);
mode_ = new ChoiceStrip(ORIENT_VERTICAL);
mode_->AddChoice(di->T("Move"));
mode_->AddChoice(di->T("Resize"));