Merge pull request #18647 from hrydgard/enforce-runbehind-multiplayer

Enforce run-behind-pause-screen if ad-hoc multiplayer active
This commit is contained in:
Henrik Rydgård 2023-12-31 00:14:13 +01:00 committed by GitHub
commit cdc8bc6eae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

View file

@ -41,6 +41,7 @@
#include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/Breakpoints.h"
#include "Core/HW/Display.h" #include "Core/HW/Display.h"
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
#include "Core/HLE/sceNetAdhoc.h"
#include "GPU/Debugger/Stepping.h" #include "GPU/Debugger/Stepping.h"
#ifdef _WIN32 #ifdef _WIN32
@ -102,6 +103,11 @@ void Core_Stop() {
} }
} }
bool Core_ShouldRunBehind() {
// Enforce run-behind if ad-hoc connected
return g_Config.bRunBehindPauseMenu || __NetAdhocConnected();
}
bool Core_IsStepping() { bool Core_IsStepping() {
return coreState == CORE_STEPPING || coreState == CORE_POWERDOWN; return coreState == CORE_STEPPING || coreState == CORE_POWERDOWN;
} }

View file

@ -37,6 +37,8 @@ void Core_SetGraphicsContext(GraphicsContext *ctx);
// called from gui // called from gui
void Core_EnableStepping(bool step, const char *reason = nullptr, u32 relatedAddress = 0); void Core_EnableStepping(bool step, const char *reason = nullptr, u32 relatedAddress = 0);
bool Core_ShouldRunBehind();
bool Core_NextFrame(); bool Core_NextFrame();
void Core_DoSingleStep(); void Core_DoSingleStep();
void Core_UpdateSingleStep(); void Core_UpdateSingleStep();

View file

@ -126,6 +126,9 @@ static int sceNetAdhocPdpCreate(const char* mac, int port, int bufferSize, u32 f
static int sceNetAdhocPdpSend(int id, const char* mac, u32 port, void* data, int len, int timeout, int flag); static int sceNetAdhocPdpSend(int id, const char* mac, u32 port, void* data, int len, int timeout, int flag);
static int sceNetAdhocPdpRecv(int id, void* addr, void* port, void* buf, void* dataLength, u32 timeout, int flag); static int sceNetAdhocPdpRecv(int id, void* addr, void* port, void* buf, void* dataLength, u32 timeout, int flag);
bool __NetAdhocConnected() {
return netAdhocInited && netAdhocctlInited && (adhocctlState == ADHOCCTL_STATE_CONNECTED || adhocctlState == ADHOCCTL_STATE_GAMEMODE);
}
void __NetAdhocShutdown() { void __NetAdhocShutdown() {
// Kill AdhocServer Thread // Kill AdhocServer Thread

View file

@ -104,6 +104,8 @@ void __NetAdhocDoState(PointerWrap &p);
void __UpdateAdhocctlHandlers(u32 flags, u32 error); void __UpdateAdhocctlHandlers(u32 flags, u32 error);
void __UpdateMatchingHandler(const MatchingArgs &params); void __UpdateMatchingHandler(const MatchingArgs &params);
bool __NetAdhocConnected();
// I have to call this from netdialog // I have to call this from netdialog
int sceNetAdhocctlGetState(u32 ptrToStatus); int sceNetAdhocctlGetState(u32 ptrToStatus);
int sceNetAdhocctlCreate(const char * groupName); int sceNetAdhocctlCreate(const char * groupName);

View file

@ -1448,11 +1448,11 @@ static void DrawFPS(UIContext *ctx, const Bounds &bounds) {
bool EmuScreen::canBeBackground(bool isTop) const { bool EmuScreen::canBeBackground(bool isTop) const {
if (g_Config.bSkipBufferEffects) { if (g_Config.bSkipBufferEffects) {
return isTop || (g_Config.bTransparentBackground && g_Config.bRunBehindPauseMenu); return isTop || (g_Config.bTransparentBackground && Core_ShouldRunBehind());
} }
if (!g_Config.bTransparentBackground && !isTop) { if (!g_Config.bTransparentBackground && !isTop) {
if (g_Config.bRunBehindPauseMenu || screenManager()->topScreen()->wantBrightBackground()) if (Core_ShouldRunBehind() || screenManager()->topScreen()->wantBrightBackground())
return true; return true;
return false; return false;
} }
@ -1513,7 +1513,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
if (mode & ScreenRenderMode::TOP) { if (mode & ScreenRenderMode::TOP) {
System_Notify(SystemNotification::KEEP_SCREEN_AWAKE); System_Notify(SystemNotification::KEEP_SCREEN_AWAKE);
} else if (!g_Config.bRunBehindPauseMenu && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) { } else if (!Core_ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
// Not on top. Let's not execute, only draw the image. // Not on top. Let's not execute, only draw the image.
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_Stepping"); draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_Stepping");
// Just to make sure. // Just to make sure.