Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blind workaround for Shining Ark circle button problem #16449

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "SecondaryTextureCache", &flags_.SecondaryTextureCache);
CheckSetting(iniFile, gameID, "EnglishOrJapaneseOnly", &flags_.EnglishOrJapaneseOnly);
CheckSetting(iniFile, gameID, "OldAdrenoPixelDepthRoundingGL", &flags_.OldAdrenoPixelDepthRoundingGL);
CheckSetting(iniFile, gameID, "ForceCircleButtonConfirm", &flags_.ForceCircleButtonConfirm);
}

void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct CompatFlags {
bool SecondaryTextureCache;
bool EnglishOrJapaneseOnly;
bool OldAdrenoPixelDepthRoundingGL;
bool ForceCircleButtonConfirm;
};

struct VRCompat {
Expand Down
16 changes: 16 additions & 0 deletions Core/Dialog/PSPDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/StringUtils.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "Core/CoreTiming.h"
#include "Core/Dialog/PSPDialog.h"
#include "Core/HLE/sceCtrl.h"
Expand Down Expand Up @@ -305,3 +307,17 @@ void PSPDialog::DisplayButtons(int flags, const char *caption)
PPGeDrawText(text, x1 + 14.5f, 252, textStyle);
}
}

int PSPDialog::GetConfirmButton() {
if (PSP_CoreParameter().compat.flags().ForceCircleButtonConfirm) {
return CTRL_CIRCLE;
}
return g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CIRCLE : CTRL_CROSS;
}

int PSPDialog::GetCancelButton() {
if (PSP_CoreParameter().compat.flags().ForceCircleButtonConfirm) {
return CTRL_CROSS;
}
return g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CROSS : CTRL_CIRCLE;
}
3 changes: 3 additions & 0 deletions Core/Dialog/PSPDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class PSPDialog
// TODO: Remove this once all dialogs are updated.
virtual bool UseAutoStatus() = 0;

static int GetConfirmButton();
static int GetCancelButton();

void StartFade(bool fadeIn_);
void UpdateFade(int animSpeed);
virtual void FinishFadeOut();
Expand Down
4 changes: 2 additions & 2 deletions Core/Dialog/PSPNetconfDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ int PSPNetconfDialog::Update(int animSpeed) {
if (!hideNotice) {
const float WRAP_WIDTH = 254.0f;
const ImageID confirmBtnImage = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? ImageID("I_CROSS") : ImageID("I_CIRCLE");
const int confirmBtn = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CROSS : CTRL_CIRCLE;
const int confirmBtn = GetConfirmButton();
const ImageID cancelBtnImage = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? ImageID("I_CIRCLE") : ImageID("I_CROSS");
const int cancelBtn = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CIRCLE : CTRL_CROSS;
const int cancelBtn = GetCancelButton();

PPGeStyle textStyle = FadedStyle(PPGeAlign::BOX_CENTER, 0.5f);
PPGeStyle buttonStyle = FadedStyle(PPGeAlign::BOX_LEFT, 0.5f);
Expand Down
7 changes: 4 additions & 3 deletions Core/Dialog/PSPOskDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,9 @@ int PSPOskDialog::Update(int animSpeed) {
return SCE_ERROR_UTILITY_INVALID_STATUS;
}

int cancelButton = g_Config.iButtonPreference == PSP_SYSTEMPARAM_BUTTON_CROSS ? CTRL_CIRCLE : CTRL_CROSS;
int confirmButton = cancelButton == CTRL_CROSS ? CTRL_CIRCLE : CTRL_CROSS;
int cancelButton = GetCancelButton();
int confirmButton = GetConfirmButton();

static int cancelBtnFramesHeld = 0;
static int confirmBtnFramesHeld = 0;
static int leftBtnFramesHeld = 0;
Expand Down Expand Up @@ -979,7 +980,7 @@ int PSPOskDialog::Update(int animSpeed) {
PPGeDrawImage(ImageID("I_SQUARE"), 365, 222, 16, 16, guideStyle);
PPGeDrawText(di->T("Space"), 390, 222, actionStyle);

if (g_Config.iButtonPreference != PSP_SYSTEMPARAM_BUTTON_CIRCLE) {
if (GetConfirmButton() != PSP_SYSTEMPARAM_BUTTON_CIRCLE) {
PPGeDrawImage(ImageID("I_CROSS"), 45, 222, 16, 16, guideStyle);
PPGeDrawImage(ImageID("I_CIRCLE"), 45, 247, 16, 16, guideStyle);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/sceImpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void __ImposeInit()
language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
}
}
buttonValue = g_Config.iButtonPreference;
buttonValue = PSP_CoreParameter().compat.flags().ForceCircleButtonConfirm ? PSP_SYSTEMPARAM_BUTTON_CIRCLE : g_Config.iButtonPreference;
umdPopup = PSP_UMD_POPUP_DISABLE;
backlightOffTime = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/sceUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr)
}
break;
case PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE:
param = g_Config.iButtonPreference;
param = PSP_CoreParameter().compat.flags().ForceCircleButtonConfirm ? PSP_SYSTEMPARAM_BUTTON_CIRCLE : g_Config.iButtonPreference;
break;
case PSP_SYSTEMPARAM_ID_INT_LOCK_PARENTAL_LEVEL:
param = g_Config.iLockParentalLevel;
Expand Down
5 changes: 5 additions & 0 deletions assets/compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1348,3 +1348,8 @@ UCAS40306 = true
UCJS10112 = true
NPJG00116 = true
NPUG70097 = true # Demo

[ForceCircleButtonConfirm]
# Shining Ark, issue #15663
NPJH50717 = true
ULJM06223 = true