diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0d5f69da9..6882811733 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1885,6 +1885,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/HW/BufferQueue.h
Core/HW/Camera.cpp
Core/HW/Camera.h
+ Core/HW/Display.cpp
+ Core/HW/Display.h
Core/HW/MediaEngine.cpp
Core/HW/MediaEngine.h
Core/HW/MpegDemux.cpp
diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index 6533787460..bac27ba59e 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -540,6 +540,7 @@
+
@@ -1099,6 +1100,7 @@
+
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index bbb85cbeb5..4a4ec1cf44 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -1184,6 +1184,9 @@
Debugger\WebSocket
+
+ HW
+
@@ -1910,6 +1913,9 @@
Debugger\WebSocket
+
+ HW
+
diff --git a/Core/Debugger/WebSocket/GPUStatsSubscriber.cpp b/Core/Debugger/WebSocket/GPUStatsSubscriber.cpp
index 11ee4dca8d..489ef4efc8 100644
--- a/Core/Debugger/WebSocket/GPUStatsSubscriber.cpp
+++ b/Core/Debugger/WebSocket/GPUStatsSubscriber.cpp
@@ -19,6 +19,7 @@
#include
#include "Core/Debugger/WebSocket/GPUStatsSubscriber.h"
#include "Core/HLE/sceDisplay.h"
+#include "Core/HW/Display.h"
#include "Core/System.h"
struct CollectedStats {
diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp
index 78dee49bda..ab9d15bf9d 100644
--- a/Core/HLE/sceCtrl.cpp
+++ b/Core/HLE/sceCtrl.cpp
@@ -20,18 +20,18 @@
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
+#include "Core/CoreTiming.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
-#include "Core/MIPS/MIPS.h"
-#include "Core/CoreTiming.h"
-#include "Core/MemMapHelpers.h"
-#include "Core/Replay.h"
-#include "Core/Util/AudioFormat.h" // for clamp_u8
#include "Core/HLE/sceCtrl.h"
-#include "Core/HLE/sceDisplay.h"
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceKernelThread.h"
#include "Core/HLE/sceKernelInterrupt.h"
+#include "Core/HW/Display.h"
+#include "Core/MemMapHelpers.h"
+#include "Core/MIPS/MIPS.h"
+#include "Core/Replay.h"
+#include "Core/Util/AudioFormat.h" // for clamp_u8
/* Index for the two analog directions */
#define CTRL_ANALOG_X 0
diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp
index 7c8b7099e3..8528562204 100644
--- a/Core/HLE/sceDisplay.cpp
+++ b/Core/HLE/sceDisplay.cpp
@@ -47,6 +47,7 @@
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceKernelThread.h"
#include "Core/HLE/sceKernelInterrupt.h"
+#include "Core/HW/Display.h"
#include "Core/Util/PPGeDraw.h"
#include "GPU/GPU.h"
@@ -130,12 +131,6 @@ std::map vblankPausedWaits;
// STATE END
-// Called when vblank happens (like an internal interrupt.) Not part of state, should be static.
-static std::mutex listenersLock;
-static std::vector vblankListeners;
-typedef std::pair FlipListener;
-static std::vector flipListeners;
-
// The vblank period is 731.5 us (0.7315 ms)
const double vblankMs = 0.7315;
// These are guesses based on tests.
@@ -198,6 +193,7 @@ static void ScheduleLagSync(int over = 0) {
}
void __DisplayInit() {
+ DisplayHWInit();
hasSetMode = false;
mode = 0;
resumeMode = 0;
@@ -347,51 +343,10 @@ void __DisplayDoState(PointerWrap &p) {
}
void __DisplayShutdown() {
- std::lock_guard guard(listenersLock);
- vblankListeners.clear();
- flipListeners.clear();
+ DisplayHWShutdown();
vblankWaitingThreads.clear();
}
-void __DisplayListenVblank(VblankCallback callback) {
- std::lock_guard guard(listenersLock);
- vblankListeners.push_back(callback);
-}
-
-void __DisplayListenFlip(FlipCallback callback, void *userdata) {
- std::lock_guard guard(listenersLock);
- flipListeners.push_back(std::make_pair(callback, userdata));
-}
-
-void __DisplayForgetFlip(FlipCallback callback, void *userdata) {
- std::lock_guard guard(listenersLock);
- flipListeners.erase(std::remove_if(flipListeners.begin(), flipListeners.end(), [&](FlipListener item) {
- return item.first == callback && item.second == userdata;
- }), flipListeners.end());
-}
-
-static void DisplayFireVblank() {
- std::vector toCall = []{
- std::lock_guard guard(listenersLock);
- return vblankListeners;
- }();
-
- for (VblankCallback cb : toCall) {
- cb();
- }
-}
-
-static void DisplayFireFlip() {
- std::vector toCall = [] {
- std::lock_guard guard(listenersLock);
- return flipListeners;
- }();
-
- for (FlipListener cb : toCall) {
- cb.first(cb.second);
- }
-}
-
void __DisplayVblankBeginCallback(SceUID threadID, SceUID prevCallbackId) {
SceUID pauseKey = prevCallbackId == 0 ? threadID : prevCallbackId;
diff --git a/Core/HLE/sceDisplay.h b/Core/HLE/sceDisplay.h
index ab0871894e..b4d79e425a 100644
--- a/Core/HLE/sceDisplay.h
+++ b/Core/HLE/sceDisplay.h
@@ -29,13 +29,6 @@ void Register_sceDisplay();
bool __DisplayGetFramebuf(PSPPointer *topaddr, u32 *linesize, u32 *pixelFormat, int mode);
void __DisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync);
-typedef void (*VblankCallback)();
-// Listen for vblank events.
-void __DisplayListenVblank(VblankCallback callback);
-typedef void (*FlipCallback)(void *userdata);
-void __DisplayListenFlip(FlipCallback callback, void *userdata);
-void __DisplayForgetFlip(FlipCallback callback, void *userdata);
-
void __DisplayGetDebugStats(char stats[], size_t bufsize);
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps);
void __DisplayGetVPS(float *out_vps);
diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp
index cc3c3b655a..7ce98cc2ff 100644
--- a/Core/HLE/sceIo.cpp
+++ b/Core/HLE/sceIo.cpp
@@ -42,9 +42,9 @@
#include "Core/HLE/HLE.h"
#include "Core/HLE/HLEHelperThread.h"
#include "Core/HLE/FunctionWrappers.h"
-#include "Core/HLE/sceDisplay.h"
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceUmd.h"
+#include "Core/HW/Display.h"
#include "Core/MIPS/MIPS.h"
#include "Core/HW/MemoryStick.h"
#include "Core/HW/AsyncIOManager.h"
diff --git a/Core/HW/Display.cpp b/Core/HW/Display.cpp
new file mode 100644
index 0000000000..2c1136e6d9
--- /dev/null
+++ b/Core/HW/Display.cpp
@@ -0,0 +1,76 @@
+// Copyright (c) 2012- PPSSPP Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0 or later versions.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official git repository and contact information can be found at
+// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
+
+#include
+#include
+#include
+#include "Core/HW/Display.h"
+
+// Called when vblank happens (like an internal interrupt.) Not part of state, should be static.
+static std::mutex listenersLock;
+static std::vector vblankListeners;
+typedef std::pair FlipListener;
+static std::vector flipListeners;
+
+void DisplayFireVblank() {
+ std::vector toCall = [] {
+ std::lock_guard guard(listenersLock);
+ return vblankListeners;
+ }();
+
+ for (VblankCallback cb : toCall) {
+ cb();
+ }
+}
+
+void DisplayFireFlip() {
+ std::vector toCall = [] {
+ std::lock_guard guard(listenersLock);
+ return flipListeners;
+ }();
+
+ for (FlipListener cb : toCall) {
+ cb.first(cb.second);
+ }
+}
+
+void __DisplayListenVblank(VblankCallback callback) {
+ std::lock_guard guard(listenersLock);
+ vblankListeners.push_back(callback);
+}
+
+void __DisplayListenFlip(FlipCallback callback, void *userdata) {
+ std::lock_guard guard(listenersLock);
+ flipListeners.push_back(std::make_pair(callback, userdata));
+}
+
+void __DisplayForgetFlip(FlipCallback callback, void *userdata) {
+ std::lock_guard guard(listenersLock);
+ flipListeners.erase(std::remove_if(flipListeners.begin(), flipListeners.end(), [&](FlipListener item) {
+ return item.first == callback && item.second == userdata;
+ }), flipListeners.end());
+}
+
+void DisplayHWInit() {
+
+}
+
+void DisplayHWShutdown() {
+ std::lock_guard guard(listenersLock);
+ vblankListeners.clear();
+ flipListeners.clear();
+}
diff --git a/Core/HW/Display.h b/Core/HW/Display.h
new file mode 100644
index 0000000000..e8e9161d82
--- /dev/null
+++ b/Core/HW/Display.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2012- PPSSPP Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0 or later versions.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official git repository and contact information can be found at
+// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
+
+#pragma once
+
+typedef void (*VblankCallback)();
+// Listen for vblank events.
+void __DisplayListenVblank(VblankCallback callback);
+typedef void (*FlipCallback)(void *userdata);
+void __DisplayListenFlip(FlipCallback callback, void *userdata);
+void __DisplayForgetFlip(FlipCallback callback, void *userdata);
+
+void DisplayFireVblank();
+void DisplayFireFlip();
+
+void DisplayHWInit();
+void DisplayHWShutdown();
diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp
index e92547f9fa..09ef3f434f 100644
--- a/UI/EmuScreen.cpp
+++ b/UI/EmuScreen.cpp
@@ -71,6 +71,7 @@ using namespace std::placeholders;
#include "Core/HLE/__sceAudio.h"
#include "Core/HLE/proAdhoc.h"
#include "Core/HLE/Plugins.h"
+#include "Core/HW/Display.h"
#include "UI/BackgroundAudio.h"
#include "UI/OnScreenDisplay.h"
diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj
index e44da3fb91..8c1be3ec8f 100644
--- a/UWP/CoreUWP/CoreUWP.vcxproj
+++ b/UWP/CoreUWP/CoreUWP.vcxproj
@@ -520,6 +520,7 @@
+
@@ -752,6 +753,7 @@
+
diff --git a/UWP/CoreUWP/CoreUWP.vcxproj.filters b/UWP/CoreUWP/CoreUWP.vcxproj.filters
index 753ecb296d..9e0f8ab7ed 100644
--- a/UWP/CoreUWP/CoreUWP.vcxproj.filters
+++ b/UWP/CoreUWP/CoreUWP.vcxproj.filters
@@ -751,6 +751,9 @@
HW
+
+ HW
+
Util
@@ -1733,6 +1736,9 @@
HW
+
+ HW
+
Util
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 0ace3176d5..b83f0223d9 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -383,6 +383,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Core/HW/AsyncIOManager.cpp \
$(SRC)/Core/HW/BufferQueue.cpp \
$(SRC)/Core/HW/Camera.cpp \
+ $(SRC)/Core/HW/Display.cpp \
$(SRC)/Core/HW/MemoryStick.cpp \
$(SRC)/Core/HW/MpegDemux.cpp.arm \
$(SRC)/Core/HW/MediaEngine.cpp.arm \
diff --git a/libretro/Makefile.common b/libretro/Makefile.common
index a0e60371c4..f00325a8ea 100644
--- a/libretro/Makefile.common
+++ b/libretro/Makefile.common
@@ -550,6 +550,7 @@ SOURCES_CXX += \
$(COREDIR)/HLE/sceUsbGps.cpp \
$(COREDIR)/HW/BufferQueue.cpp \
$(COREDIR)/HW/Camera.cpp \
+ $(COREDIR)/HW/Display.cpp \
$(COREDIR)/HW/SimpleAudioDec.cpp \
$(COREDIR)/HW/AsyncIOManager.cpp \
$(COREDIR)/HW/MediaEngine.cpp \