mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Move the rest of input initialization to the input thread. Speeds up startup.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Input/InputState.h"
|
||||
#include "Common/Input/InputState.h"
|
||||
#include "Windows/InputDevice.h"
|
||||
#include <set>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Windows/InputDevice.h"
|
||||
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
#include "Windows/DinputDevice.h"
|
||||
#include "Windows/HidInputDevice.h"
|
||||
#include "Windows/XinputDevice.h"
|
||||
#endif
|
||||
|
||||
InputManager g_InputManager;
|
||||
|
||||
void InputManager::InputThread() {
|
||||
@@ -64,6 +70,14 @@ void InputManager::InputThread() {
|
||||
void InputManager::BeginPolling() {
|
||||
runThread_.store(true, std::memory_order_relaxed);
|
||||
inputThread_ = std::thread([this]() {
|
||||
// In UWP, we add the devices from the main thread, before launching the thread.
|
||||
// This is a bit awkward but worth the startup speed boost on non-UWP until we refactor it.
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
//add first XInput device to respond
|
||||
AddDevice(new XinputDevice());
|
||||
AddDevice(new DInputMetaDevice());
|
||||
AddDevice(new HidInputDevice());
|
||||
#endif
|
||||
InputThread();
|
||||
});
|
||||
}
|
||||
|
||||
+1
-7
@@ -66,9 +66,7 @@
|
||||
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "Windows/resource.h"
|
||||
#include "Windows/DinputDevice.h"
|
||||
#include "Windows/XinputDevice.h"
|
||||
#include "Windows/HidInputDevice.h"
|
||||
#include "Windows/InputDevice.h"
|
||||
#include "Windows/MainWindow.h"
|
||||
#include "Windows/Debugger/Debugger_Disasm.h"
|
||||
#include "Windows/Debugger/Debugger_MemoryDlg.h"
|
||||
@@ -1140,10 +1138,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
MainWindow::Minimize();
|
||||
}
|
||||
|
||||
//add first XInput device to respond
|
||||
g_InputManager.AddDevice(new XinputDevice());
|
||||
g_InputManager.AddDevice(new DInputMetaDevice());
|
||||
g_InputManager.AddDevice(new HidInputDevice());
|
||||
// Emu thread (and render thread, if any) is always running!
|
||||
// Only OpenGL uses an externally managed render thread (due to GL's single-threaded context design). Vulkan
|
||||
// manages its own render thread.
|
||||
|
||||
Reference in New Issue
Block a user