Move out two more functions from Core.cpp. Clean up Windows includes

This commit is contained in:
Henrik Rydgård 2024-12-08 12:12:02 +01:00
parent 83af54950f
commit 080798b5dd
20 changed files with 33 additions and 35 deletions

View file

@ -13,9 +13,8 @@
*/
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#undef min
#undef max
#endif
#include <cstdlib>

View file

@ -2,7 +2,7 @@
#if PPSSPP_PLATFORM(WINDOWS)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "Common/CommonWindows.h"
#include <direct.h>
#if PPSSPP_PLATFORM(UWP)
#include <fileapifromapp.h>

View file

@ -1,6 +1,6 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "Common/CommonWindows.h"
#include <sys/stat.h>
#else
#include <dirent.h>

View file

@ -53,7 +53,6 @@
#ifdef _WIN32
#include "Common/CommonWindows.h"
#include <sys/utime.h>
#include <Windows.h>
#include <shlobj.h> // for SHGetFolderPath
#include <shellapi.h>
#include <commdlg.h> // for GetSaveFileName

View file

@ -3,7 +3,7 @@
#include "ppsspp_config.h"
// Standard Windows includes
#include <windows.h>
#include "Common/CommonWindows.h"
#include <initguid.h>
#include <dxgi.h>
#include <d3d11.h>

View file

@ -1,7 +1,7 @@
#pragma once
#include "ppsspp_config.h"
#include <Windows.h>
#include "Common/CommonWindows.h"
#include <D3Dcompiler.h>
bool LoadD3DCompilerDynamic();

View file

@ -11,7 +11,8 @@
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
#include <windows.h>
#include "Common/CommonWindows.h"
typedef CONTEXT SContext;
#if defined(__LIBRETRO__)

View file

@ -7,9 +7,6 @@
#if defined(_WIN32) && !defined(USING_QT_UI) && !PPSSPP_PLATFORM(UWP)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
struct TextDrawerContext;
// Internal struct but all details in .cpp file (pimpl to avoid pulling in excessive headers here)
class TextDrawerFontContext;

View file

@ -20,9 +20,7 @@
#include "ppsspp_config.h"
#ifdef _WIN32
#include <windows.h>
#undef min
#undef max
#include "Common/CommonWindows.h"
#endif
#if PPSSPP_PLATFORM(SWITCH)

View file

@ -91,3 +91,4 @@ bool Native_IsWindowHidden();
// TODO: Feels like this belongs elsewhere.
bool Native_UpdateScreenScale(int width, int height);

View file

@ -2,7 +2,7 @@
#if PPSSPP_PLATFORM(WINDOWS)
#include <windows.h>
#include "Common/CommonWindows.h"
#ifdef __MINGW32__
#include <excpt.h>

View file

@ -120,15 +120,6 @@ void Core_Stop() {
}
}
bool Core_ShouldRunBehind() {
// Enforce run-behind if ad-hoc connected
return g_Config.bRunBehindPauseMenu || Core_MustRunBehind();
}
bool Core_MustRunBehind() {
return __NetAdhocConnected();
}
void Core_UpdateState(CoreState newState) {
if ((coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME) && newState != CORE_RUNNING_CPU)
coreStatePending = true;

View file

@ -54,9 +54,6 @@ void Core_Resume();
// Can fail if another step type was requested this frame.
bool Core_RequestCPUStep(CPUStepType stepType, int stepSize);
bool Core_ShouldRunBehind();
bool Core_MustRunBehind();
bool Core_NextFrame();
void Core_SwitchToGe(); // Switches from CPU emulation to GE display list execution.

View file

@ -19,6 +19,8 @@
// Net stuff
#if defined(_WIN32)
#include "Common/CommonWindows.h"
#include <WS2tcpip.h>
#else
#include <unistd.h>

View file

@ -70,6 +70,7 @@ using namespace std::placeholders;
#include "Core/MIPS/MIPS.h"
#include "Core/HLE/sceCtrl.h"
#include "Core/HLE/sceSas.h"
#include "Core/HLE/sceNetAdhoc.h"
#include "Core/Debugger/SymbolMap.h"
#include "Core/RetroAchievements.h"
#include "Core/SaveState.h"
@ -1380,11 +1381,11 @@ bool EmuScreen::checkPowerDown() {
ScreenRenderRole EmuScreen::renderRole(bool isTop) const {
auto CanBeBackground = [&]() -> bool {
if (g_Config.bSkipBufferEffects) {
return isTop || (g_Config.bTransparentBackground && Core_ShouldRunBehind());
return isTop || (g_Config.bTransparentBackground && ShouldRunBehind());
}
if (!g_Config.bTransparentBackground && !isTop) {
if (Core_ShouldRunBehind() || screenManager()->topScreen()->wantBrightBackground())
if (ShouldRunBehind() || screenManager()->topScreen()->wantBrightBackground())
return true;
return false;
}
@ -1462,7 +1463,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
if (mode & ScreenRenderMode::TOP) {
System_Notify(SystemNotification::KEEP_SCREEN_AWAKE);
} else if (!Core_ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
} else if (!ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
// NOTE: The strcmp is != 0 - so all popped-over screens EXCEPT DevMenu
// Just to make sure.
if (PSP_IsInited() && !skipBufferEffects) {
@ -1814,3 +1815,12 @@ void EmuScreen::autoLoad() {
void EmuScreen::resized() {
RecreateViews();
}
bool MustRunBehind() {
return __NetAdhocConnected();
}
bool ShouldRunBehind() {
// Enforce run-behind if ad-hoc connected
return g_Config.bRunBehindPauseMenu || MustRunBehind();
}

View file

@ -142,3 +142,6 @@ private:
bool keyAltLeft_ = false;
bool keyAltRight_ = false;
};
bool MustRunBehind();
bool ShouldRunBehind();

View file

@ -46,6 +46,7 @@
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
#include "UI/EmuScreen.h"
#include "UI/PauseScreen.h"
#include "UI/GameSettingsScreen.h"
#include "UI/ReportScreen.h"
@ -446,7 +447,7 @@ void GamePauseScreen::CreateViews() {
rightColumnItems->Add(new Choice(pa->T("Exit to menu")))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu);
}
if (!Core_MustRunBehind()) {
if (!MustRunBehind()) {
playButton_ = middleColumn->Add(new Button("", g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"), new LinearLayoutParams(64, 64)));
playButton_->OnClick.Add([=](UI::EventParams &e) {
g_Config.bRunBehindPauseMenu = !g_Config.bRunBehindPauseMenu;

View file

@ -1,5 +1,5 @@
#include "stdafx.h"
#include <Windows.h>
#include "Common/CommonWindows.h"
#include "Windows/TouchInputHandler.h"
#include <algorithm>
@ -7,7 +7,6 @@
#include "Common/System/Display.h"
#include "Common/System/NativeApp.h"
#include "Common/CommonWindows.h"
#include "Common/CommonFuncs.h"
#include "Common/Input/InputState.h"
#include "Common/Log.h"

View file

@ -1,5 +1,5 @@
#include "ppsspp_config.h"
#include "CommonWindows.h"
#include "Common/CommonWindows.h"
#include <WinUser.h>
#include <shellapi.h>

View file

@ -2,7 +2,7 @@
#include <vector>
#include "CommonWindows.h"
#include "Common/CommonWindows.h"
class Dialog;