Merge pull request #22006 from hrydgard/assorted-ui-fixes

UI event processing fixes
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-07-30 21:45:31 +02:00
commit d90fdee8fc
5 files changed
+31 -45

No files matched your search

+7 -7
View File
@@ -127,14 +127,7 @@ void ScreenManager::update() {
overlayScreen_->update();
}
// Only the front screen gets update().
if (!stack_.empty()) {
stack_.back().screen->update();
passInputToMapper_ = stack_.back().screen->PassInputToMapper();
}
// Process queued events.
std::deque<QueuedEvent> events;
{
std::lock_guard<std::mutex> eventGuard(eventQueueLock_);
@@ -192,6 +185,13 @@ void ScreenManager::update() {
break;
}
}
// Only the front screen gets update().
if (!stack_.empty()) {
Screen *backScreen = stack_.back().screen;
backScreen->update();
passInputToMapper_ = backScreen->PassInputToMapper();
}
}
void ScreenManager::switchToNext() {
+10 -19
View File
@@ -1429,7 +1429,7 @@ static int sceUtilityGameSharingUpdate(int animSpeed) {
return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
}
return hleLogError(Log::sceUtility, 0, "UNIMPL sceUtilityGameSharingUpdate(%i)", animSpeed);
return hleLogError(Log::sceUtility, 0, "UNIMPL");
}
static int sceUtilityGameSharingGetStatus() {
@@ -1441,30 +1441,21 @@ static int sceUtilityGameSharingGetStatus() {
return hleLogError(Log::sceUtility, 0, "UNIMPL");
}
static u32 sceUtilityLoadUsbModule(u32 module)
{
if (module < 1 || module > 5)
{
ERROR_LOG(Log::sceUtility, "sceUtilityLoadUsbModule(%i): invalid module id", module);
static u32 sceUtilityLoadUsbModule(u32 module) {
if (module < 1 || module > 5) {
return hleLogError(Log::sceUtility, 0, "invalid module id");
}
ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityLoadUsbModule(%i)", module);
return hleNoLog(0);
return hleLogWarning(Log::sceUtility, 0, "UNIMPL");
}
static u32 sceUtilityUnloadUsbModule(u32 module)
{
if (module < 1 || module > 5)
{
ERROR_LOG(Log::sceUtility, "sceUtilityUnloadUsbModule(%i): invalid module id", module);
static u32 sceUtilityUnloadUsbModule(u32 module) {
if (module < 1 || module > 5) {
return hleLogError(Log::sceUtility, 0, "invalid module id");
}
ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityUnloadUsbModule(%i)", module);
return hleNoLog(0);
return hleLogWarning(Log::sceUtility, 0, "UNIMPL");
}
const HLEFunction sceUtility[] =
{
const HLEFunction sceUtility[] = {
{0X1579A159, &WrapU_U<sceUtilityLoadNetModule>, "sceUtilityLoadNetModule", 'x', "x" },
{0X64D50C56, &WrapU_U<sceUtilityUnloadNetModule>, "sceUtilityUnloadNetModule", 'x', "x" },
-14
View File
@@ -191,7 +191,6 @@ static Draw::DrawContext *g_draw;
static Draw::Pipeline *colorPipeline;
static Draw::Pipeline *texColorPipeline;
static UIContext *uiContext;
static int g_restartGraphics;
static bool g_windowHidden = false;
static std::string g_achievementsHostOverride;
static std::string g_savedAchievementsHost;
@@ -1024,18 +1023,6 @@ void NativeFrame(GraphicsContext *graphicsContext) {
}
}
// This can only be accessed from Windows currently, and causes linking errors with headless etc.
if (g_restartGraphics == 1) {
// Used for debugging only.
NativeShutdownGraphics(graphicsContext);
g_restartGraphics++;
return;
}
else if (g_restartGraphics == 2) {
NativeInitGraphics(graphicsContext);
g_restartGraphics = 0;
}
double startTime = time_now_d();
ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_UP, startTime, false);
@@ -1210,7 +1197,6 @@ void NativeFrame(GraphicsContext *graphicsContext) {
bool HandleGlobalMessage(UIMessage message, const std::string &value) {
if (message == UIMessage::RESTART_GRAPHICS) {
g_restartGraphics = 1;
return true;
} else if (message == UIMessage::SAVESTATE_DISPLAY_SLOT) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
+7 -5
View File
@@ -334,18 +334,19 @@ void SaveSlotView::OnSaveState(UI::EventParams &e) {
void GamePauseScreen::update() {
UpdateUIState(UISTATE_PAUSEMENU);
if (!firstFrame_ && g_controlMapper.PollPauseTrigger()) {
TriggerFinish(DR_BACK);
}
UIBaseDialogScreen::update();
firstFrame_ = false;
{
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
if (!firstFrame_ && g_controlMapper.PollPauseTrigger()) {
finishNextFrame_ = true;
finishNextFrameResult_ = DR_BACK;
}
firstFrame_ = false;
if (finishNextFrame_) {
TriggerFinish(finishNextFrameResult_);
finishNextFrame_ = false;
finishNextFrameResult_ = DR_BACK;
}
}
@@ -828,6 +829,7 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
if (dr == DR_OK) {
std::lock_guard<std::mutex> lock(finishNextFrameMutex_);
finishNextFrame_ = true;
finishNextFrameResult_ = DR_BACK;
} else if (dr != DR_CANCEL && dr != DR_BACK) {
// Just go back to the pause menu, but refresh the savestate thumbnails in case something changed.
SaveState::Rescan(saveStatePrefix_);
@@ -1111,15 +1111,19 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
joinRenderLoopThread();
Log.i(TAG, "Joined render thread");
} else if (mGLSurfaceView != null) {
Log.i(TAG, "mGLSurfaceView.onPause...");
mGLSurfaceView.onPause();
}
Log.i(TAG, "mSensorManager.unregisterListener...");
mSensorManager.unregisterListener(this);
loseAudioFocus(this.audioManager, this.audioFocusChangeListener);
sizeManager.onPause();
Log.i(TAG, "Calling NativeApp.pause...");
NativeApp.pause();
if (mCameraHelper != null) {
Log.i(TAG, "Calling mCameraHelper.pause");
mCameraHelper.pause();
}
Log.i(TAG, "onPause end");
@@ -1203,9 +1207,11 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
}
if (NativeApp.queryConfig("audioMixWithOthers").equals("0")) {
// Shouldn't mix with others - take over.
Log.i(TAG, "Taking audio focus");
audioManager.requestAudioFocus(focusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
} else {
// Mix with others - abandon focus so we don't kick others out.
Log.i(TAG, "Abandoning audio focus");
audioManager.abandonAudioFocus(focusChangeListener);
}
}
@@ -1214,6 +1220,7 @@ public class PpssppActivity extends AppCompatActivity implements SensorEventList
// instantiate NativeAudioPlayer
public static void loseAudioFocus(AudioManager audioManager, AudioFocusChangeListener focusChangeListener) {
if (audioManager != null) {
Log.i(TAG, "Abandoning audio focus");
audioManager.abandonAudioFocus(focusChangeListener);
}
}