mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-31 10:32:30 +00:00
commit
2bdae5b338
@ -699,8 +699,8 @@ elseif(USING_QT_UI)
|
||||
qt5_wrap_ui(QT_UI_GEN ${Qt_UI})
|
||||
list(APPEND NativeAppSource
|
||||
${QT_UI_GEN}
|
||||
ext/native/base/QtMain.cpp
|
||||
ext/native/base/QtMain.h
|
||||
Qt/QtMain.cpp
|
||||
Qt/QtMain.h
|
||||
Qt/mainwindow.cpp
|
||||
Qt/mainwindow.h
|
||||
Qt/Debugger/ctrldisasmview.cpp
|
||||
@ -745,7 +745,7 @@ elseif(TARGET SDL2::SDL2)
|
||||
set(nativeExtra ${nativeExtra}
|
||||
SDL/SDLJoystick.h
|
||||
SDL/SDLJoystick.cpp
|
||||
ext/native/base/PCMain.cpp)
|
||||
SDL/SDLMain.cpp)
|
||||
set(nativeExtraLibs ${nativeExtraLibs} SDL2::SDL2)
|
||||
if(APPLE)
|
||||
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm)
|
||||
|
@ -525,12 +525,9 @@ static ConfigSetting graphicsSettings[] = {
|
||||
#endif
|
||||
ReportedConfigSetting("ForceMaxEmulatedFPS", &g_Config.iForceMaxEmulatedFPS, 60, true, true),
|
||||
|
||||
// TODO: Hm, on fast mobile GPUs we should definitely default to at least 4 (setting = 2)...
|
||||
#ifdef MOBILE_DEVICE
|
||||
ConfigSetting("AnisotropyLevel", &g_Config.iAnisotropyLevel, 0, true, true),
|
||||
#else
|
||||
// Most low-performance (and many high performance) mobile GPUs do not support aniso anyway so defaulting to 4 is fine.
|
||||
ConfigSetting("AnisotropyLevel", &g_Config.iAnisotropyLevel, 4, true, true),
|
||||
#endif
|
||||
|
||||
ReportedConfigSetting("VertexDecCache", &g_Config.bVertexCache, &DefaultVertexCache, true, true),
|
||||
ReportedConfigSetting("TextureBackoffCache", &g_Config.bTextureBackoffCache, false, true, true),
|
||||
ReportedConfigSetting("TextureSecondaryCache", &g_Config.bTextureSecondaryCache, false, true, true),
|
||||
|
@ -18,7 +18,9 @@
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include <set>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "base/NativeApp.h"
|
||||
#include "base/display.h"
|
||||
@ -46,9 +48,9 @@
|
||||
// Should this be configurable? 2 hours currently.
|
||||
static const double ACTIVITY_IDLE_TIMEOUT = 2.0 * 3600.0;
|
||||
|
||||
static event m_hStepEvent;
|
||||
static std::condition_variable m_StepCond;
|
||||
static std::mutex m_hStepMutex;
|
||||
static event m_hInactiveEvent;
|
||||
static std::condition_variable m_InactiveCond;
|
||||
static std::mutex m_hInactiveMutex;
|
||||
static bool singleStepPending = false;
|
||||
static std::set<Core_ShutdownFunc> shutdownFuncs;
|
||||
@ -95,7 +97,7 @@ void Core_Halt(const char *msg) {
|
||||
void Core_Stop() {
|
||||
Core_UpdateState(CORE_POWERDOWN);
|
||||
Core_NotifyShutdown();
|
||||
m_hStepEvent.notify_one();
|
||||
m_StepCond.notify_one();
|
||||
}
|
||||
|
||||
bool Core_IsStepping() {
|
||||
@ -112,13 +114,15 @@ bool Core_IsInactive() {
|
||||
|
||||
void Core_WaitInactive() {
|
||||
while (Core_IsActive()) {
|
||||
m_hInactiveEvent.wait(m_hInactiveMutex);
|
||||
std::unique_lock<std::mutex> guard(m_hInactiveMutex);
|
||||
m_InactiveCond.wait(guard);
|
||||
}
|
||||
}
|
||||
|
||||
void Core_WaitInactive(int milliseconds) {
|
||||
if (Core_IsActive()) {
|
||||
m_hInactiveEvent.wait_for(m_hInactiveMutex, milliseconds);
|
||||
std::unique_lock<std::mutex> guard(m_hInactiveMutex);
|
||||
m_InactiveCond.wait_for(guard, std::chrono::milliseconds(milliseconds));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,11 +195,16 @@ void UpdateRunLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
void KeepScreenAwake() {
|
||||
#ifdef _WIN32
|
||||
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Core_RunLoop(GraphicsContext *ctx) {
|
||||
graphicsContext = ctx;
|
||||
while ((GetUIState() != UISTATE_INGAME || !PSP_IsInited()) && GetUIState() != UISTATE_EXIT) {
|
||||
time_update();
|
||||
#if defined(USING_WIN_UI)
|
||||
double startTime = time_now_d();
|
||||
UpdateRunLoop();
|
||||
|
||||
@ -204,19 +213,15 @@ void Core_RunLoop(GraphicsContext *ctx) {
|
||||
double diffTime = time_now_d() - startTime;
|
||||
int sleepTime = (int)(1000.0 / 60.0) - (int)(diffTime * 1000.0);
|
||||
if (sleepTime > 0)
|
||||
Sleep(sleepTime);
|
||||
sleep_ms(sleepTime);
|
||||
if (!windowHidden) {
|
||||
ctx->SwapBuffers();
|
||||
}
|
||||
#else
|
||||
UpdateRunLoop();
|
||||
#endif
|
||||
}
|
||||
|
||||
while (!coreState && GetUIState() == UISTATE_INGAME) {
|
||||
time_update();
|
||||
UpdateRunLoop();
|
||||
#if defined(USING_WIN_UI)
|
||||
if (!windowHidden && !Core_IsStepping()) {
|
||||
ctx->SwapBuffers();
|
||||
|
||||
@ -226,22 +231,21 @@ void Core_RunLoop(GraphicsContext *ctx) {
|
||||
// Only resetting it ever prime number seconds in case the call is expensive.
|
||||
// Using a prime number to ensure there's no interaction with other periodic events.
|
||||
if (now - lastKeepAwake > 89.0 || now < lastKeepAwake) {
|
||||
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||
KeepScreenAwake();
|
||||
lastKeepAwake = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Core_DoSingleStep() {
|
||||
singleStepPending = true;
|
||||
m_hStepEvent.notify_one();
|
||||
m_StepCond.notify_one();
|
||||
}
|
||||
|
||||
void Core_UpdateSingleStep() {
|
||||
m_hStepEvent.notify_one();
|
||||
m_StepCond.notify_one();
|
||||
}
|
||||
|
||||
void Core_SingleStep() {
|
||||
@ -251,20 +255,15 @@ void Core_SingleStep() {
|
||||
static inline void CoreStateProcessed() {
|
||||
if (coreStatePending) {
|
||||
coreStatePending = false;
|
||||
m_hInactiveEvent.notify_one();
|
||||
m_InactiveCond.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
// Some platforms, like Android, do not call this function but handle things on their own.
|
||||
void Core_Run(GraphicsContext *ctx)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
// Many platforms, like Android, do not call this function but handle things on their own.
|
||||
// Instead they simply call NativeRender and NativeUpdate directly.
|
||||
void Core_Run(GraphicsContext *ctx) {
|
||||
host->UpdateDisassembly();
|
||||
#endif
|
||||
#if !defined(USING_QT_UI) || defined(MOBILE_DEVICE)
|
||||
while (true)
|
||||
#endif
|
||||
{
|
||||
while (true) {
|
||||
reswitch:
|
||||
if (GetUIState() != UISTATE_INGAME) {
|
||||
CoreStateProcessed();
|
||||
@ -272,15 +271,10 @@ reswitch:
|
||||
return;
|
||||
}
|
||||
Core_RunLoop(ctx);
|
||||
#if defined(USING_QT_UI) && !defined(MOBILE_DEVICE)
|
||||
return;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (coreState)
|
||||
{
|
||||
switch (coreState) {
|
||||
case CORE_RUNNING:
|
||||
// enter a fast runloop
|
||||
Core_RunLoop(ctx);
|
||||
@ -298,21 +292,16 @@ reswitch:
|
||||
}
|
||||
|
||||
// wait for step command..
|
||||
#if defined(USING_QT_UI) || defined(_DEBUG)
|
||||
host->UpdateDisassembly();
|
||||
host->UpdateMemView();
|
||||
host->SendCoreWait(true);
|
||||
#endif
|
||||
|
||||
m_hStepEvent.wait(m_hStepMutex);
|
||||
{
|
||||
std::unique_lock<std::mutex> guard(m_hStepMutex);
|
||||
m_StepCond.wait(guard);
|
||||
}
|
||||
|
||||
#if defined(USING_QT_UI) || defined(_DEBUG)
|
||||
host->SendCoreWait(false);
|
||||
#endif
|
||||
#if defined(USING_QT_UI) && !defined(MOBILE_DEVICE)
|
||||
if (coreState != CORE_STEPPING)
|
||||
return;
|
||||
#endif
|
||||
// No step pending? Let's go back to the wait.
|
||||
if (!singleStepPending || coreState != CORE_STEPPING) {
|
||||
if (coreState == CORE_POWERDOWN) {
|
||||
@ -323,10 +312,8 @@ reswitch:
|
||||
|
||||
Core_SingleStep();
|
||||
// update disasm dialog
|
||||
#if defined(USING_QT_UI) || defined(_DEBUG)
|
||||
host->UpdateDisassembly();
|
||||
host->UpdateMemView();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case CORE_POWERUP:
|
||||
@ -346,17 +333,12 @@ reswitch:
|
||||
void Core_EnableStepping(bool step) {
|
||||
if (step) {
|
||||
sleep_ms(1);
|
||||
#if defined(_DEBUG)
|
||||
host->SetDebugMode(true);
|
||||
#endif
|
||||
m_hStepEvent.reset();
|
||||
Core_UpdateState(CORE_STEPPING);
|
||||
} else {
|
||||
#if defined(_DEBUG)
|
||||
host->SetDebugMode(false);
|
||||
#endif
|
||||
coreState = CORE_RUNNING;
|
||||
coreStatePending = false;
|
||||
m_hStepEvent.notify_one();
|
||||
m_StepCond.notify_one();
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "profiler/profiler.h"
|
||||
|
@ -16,6 +16,8 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
|
@ -24,8 +24,10 @@
|
||||
#include <string>
|
||||
#include <codecvt>
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "math/math_util.h"
|
||||
#include "thread/threadutil.h"
|
||||
|
@ -910,12 +910,7 @@ void TextureCacheCommon::NotifyConfigChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
// Mobile devices don't get the higher scale factors, too expensive. Very rough way to decide though...
|
||||
if (!gstate_c.Supports(GPU_IS_MOBILE)) {
|
||||
scaleFactor = std::min(5, scaleFactor);
|
||||
} else {
|
||||
scaleFactor = std::min(3, scaleFactor);
|
||||
}
|
||||
scaleFactor = std::min(5, scaleFactor);
|
||||
} else {
|
||||
scaleFactor = g_Config.iTexScalingLevel;
|
||||
}
|
||||
|
@ -342,11 +342,6 @@ void GPU_GLES::CheckGPUFeatures() {
|
||||
features |= GPU_USE_CLEAR_RAM_HACK;
|
||||
}
|
||||
|
||||
#ifdef MOBILE_DEVICE
|
||||
// Arguably, we should turn off GPU_IS_MOBILE on like modern Tegras, etc.
|
||||
features |= GPU_IS_MOBILE;
|
||||
#endif
|
||||
|
||||
gstate_c.featureFlags = features;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,6 @@ enum {
|
||||
GPU_SUPPORTS_ARB_FRAMEBUFFER_BLIT = FLAG_BIT(26),
|
||||
GPU_SUPPORTS_NV_FRAMEBUFFER_BLIT = FLAG_BIT(27),
|
||||
GPU_SUPPORTS_OES_TEXTURE_NPOT = FLAG_BIT(28),
|
||||
GPU_IS_MOBILE = FLAG_BIT(29),
|
||||
GPU_PREFER_CPU_DOWNLOAD = FLAG_BIT(30),
|
||||
GPU_PREFER_REVERSE_COLOR_ORDER = FLAG_BIT(31),
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "Debugger/debugger_memory.h"
|
||||
#include "Debugger/debugger_memorytex.h"
|
||||
#include "Debugger/debugger_displaylist.h"
|
||||
#include "base/QtMain.h"
|
||||
#include "Qt/QtMain.h"
|
||||
|
||||
extern bool g_TakeScreenshot;
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "base/timeutil.h"
|
||||
#include "ext/vjson/json.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "input/input_state.h"
|
||||
#include "thread/threadutil.h"
|
||||
|
@ -111,7 +111,7 @@ void NativeSaveState(); // onDestroy
|
||||
void NativePermissionStatus(SystemPermission permission, PermissionStatus status);
|
||||
|
||||
// Calls back into Java / SDL
|
||||
// These APIs must be implemented by every port (for example app-android.cpp, PCMain.cpp).
|
||||
// These APIs must be implemented by every port (for example app-android.cpp, SDLMain.cpp).
|
||||
// You are free to call these.
|
||||
void SystemToast(const char *text);
|
||||
void ShowKeyboard();
|
||||
|
@ -299,13 +299,13 @@
|
||||
<ClCompile Include="base\colorutil.cpp" />
|
||||
<ClCompile Include="base\display.cpp" />
|
||||
<ClCompile Include="base\logging.cpp" />
|
||||
<ClCompile Include="base\PCMain.cpp">
|
||||
<ClCompile Include="..\..\SDL\SDLMain.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\QtMain.cpp">
|
||||
<ClCompile Include="..\..\Qt\QtMain.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
@ -761,4 +761,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -739,10 +739,10 @@
|
||||
<ClCompile Include="thread\executor.cpp">
|
||||
<Filter>thread</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\PCMain.cpp">
|
||||
<ClCompile Include="..\..\SDL\SDLMain.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\QtMain.cpp">
|
||||
<ClCompile Include="..\..\Qt\QtMain.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="file\free.cpp">
|
||||
@ -868,4 +868,4 @@
|
||||
<UniqueIdentifier>{06c6305a-a646-485b-85b9-645a24dd6553}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "thread/threadutil.h"
|
||||
|
@ -1,33 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
// Note that name must be a global string that lives until the end of the process,
|
||||
// for assertThreadName to work.
|
||||
void setCurrentThreadName(const char *threadName);
|
||||
void AssertCurrentThreadName(const char *threadName);
|
||||
|
||||
class event {
|
||||
public:
|
||||
void notify_one() {
|
||||
cond_.notify_one();
|
||||
}
|
||||
|
||||
void wait(std::mutex &mtx) {
|
||||
// broken logic
|
||||
std::unique_lock<std::mutex> guard(mtx);
|
||||
cond_.wait(guard);
|
||||
}
|
||||
|
||||
void wait_for(std::mutex &mtx, int milliseconds) {
|
||||
std::unique_lock<std::mutex> guard(mtx);
|
||||
cond_.wait_for(guard, std::chrono::milliseconds(milliseconds));
|
||||
}
|
||||
|
||||
void reset() {
|
||||
}
|
||||
private:
|
||||
std::condition_variable cond_;
|
||||
};
|
||||
void AssertCurrentThreadName(const char *threadName);
|
Loading…
x
Reference in New Issue
Block a user