Get rid of the input_state global linkage.
This commit is contained in:
parent
fd0af5b271
commit
95d912c378
8 changed files with 18 additions and 23 deletions
|
@ -57,8 +57,6 @@ static double lastActivity = 0.0;
|
|||
static double lastKeepAwake = 0.0;
|
||||
static GraphicsContext *graphicsContext;
|
||||
|
||||
extern InputState input_state;
|
||||
|
||||
void Core_SetGraphicsContext(GraphicsContext *ctx) {
|
||||
graphicsContext = ctx;
|
||||
}
|
||||
|
@ -152,16 +150,16 @@ bool UpdateScreenScale(int width, int height, bool smallWindow) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void UpdateRunLoop() {
|
||||
void UpdateRunLoop(InputState *input_state) {
|
||||
if (windowHidden && g_Config.bPauseWhenMinimized) {
|
||||
sleep_ms(16);
|
||||
return;
|
||||
}
|
||||
NativeUpdate(input_state);
|
||||
NativeUpdate(*input_state);
|
||||
|
||||
{
|
||||
lock_guard guard(input_state.lock);
|
||||
EndInputState(&input_state);
|
||||
lock_guard guard(input_state->lock);
|
||||
EndInputState(input_state);
|
||||
}
|
||||
|
||||
if (GetUIState() != UISTATE_EXIT) {
|
||||
|
@ -169,13 +167,13 @@ void UpdateRunLoop() {
|
|||
}
|
||||
}
|
||||
|
||||
void Core_RunLoop(GraphicsContext *ctx) {
|
||||
void Core_RunLoop(GraphicsContext *ctx, InputState *input_state) {
|
||||
graphicsContext = ctx;
|
||||
while ((GetUIState() != UISTATE_INGAME || !PSP_IsInited()) && GetUIState() != UISTATE_EXIT) {
|
||||
time_update();
|
||||
#if defined(USING_WIN_UI)
|
||||
double startTime = time_now_d();
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(input_state);
|
||||
|
||||
// Simple throttling to not burn the GPU in the menu.
|
||||
time_update();
|
||||
|
@ -187,13 +185,13 @@ void Core_RunLoop(GraphicsContext *ctx) {
|
|||
ctx->SwapBuffers();
|
||||
}
|
||||
#else
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(input_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
while (!coreState && GetUIState() == UISTATE_INGAME) {
|
||||
time_update();
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(input_state);
|
||||
#if defined(USING_WIN_UI)
|
||||
if (!windowHidden && !Core_IsStepping()) {
|
||||
ctx->SwapBuffers();
|
||||
|
@ -234,7 +232,7 @@ static inline void CoreStateProcessed() {
|
|||
}
|
||||
|
||||
// Some platforms, like Android, do not call this function but handle things on their own.
|
||||
void Core_Run(GraphicsContext *ctx)
|
||||
void Core_Run(GraphicsContext *ctx, InputState *input_state)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
host->UpdateDisassembly();
|
||||
|
@ -249,7 +247,7 @@ reswitch:
|
|||
if (GetUIState() == UISTATE_EXIT) {
|
||||
return;
|
||||
}
|
||||
Core_RunLoop(ctx);
|
||||
Core_RunLoop(ctx, input_state);
|
||||
#if defined(USING_QT_UI) && !defined(MOBILE_DEVICE)
|
||||
return;
|
||||
#else
|
||||
|
@ -261,7 +259,7 @@ reswitch:
|
|||
{
|
||||
case CORE_RUNNING:
|
||||
// enter a fast runloop
|
||||
Core_RunLoop(ctx);
|
||||
Core_RunLoop(ctx, input_state);
|
||||
break;
|
||||
|
||||
// We should never get here on Android.
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
#include "Core/CoreParameter.h"
|
||||
|
||||
class GraphicsContext;
|
||||
struct InputState;
|
||||
|
||||
// called from emu thread
|
||||
void UpdateRunLoop();
|
||||
void Core_Run(GraphicsContext *ctx);
|
||||
void UpdateRunLoop(GraphicsContext *input_state);
|
||||
void Core_Run(GraphicsContext *ctx, InputState *input_state);
|
||||
void Core_Stop();
|
||||
void Core_ErrorPause();
|
||||
// For platforms that don't call Core_Run
|
||||
|
|
|
@ -192,7 +192,7 @@ unsigned int WINAPI TheThread(void *)
|
|||
if (!Core_IsActive())
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
|
||||
Core_Run(graphicsContext);
|
||||
Core_Run(graphicsContext, &input_state);
|
||||
}
|
||||
|
||||
shutdown:
|
||||
|
|
|
@ -348,7 +348,7 @@ void BlackberryMain::runMain() {
|
|||
switchDisplay(screen_ui);
|
||||
}
|
||||
time_update();
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(&input_state);
|
||||
// This handles VSync
|
||||
if (emulating)
|
||||
eglSwapBuffers(egl_disp[screen_emu], egl_surf[screen_emu]);
|
||||
|
|
|
@ -859,7 +859,7 @@ int main(int argc, char *argv[]) {
|
|||
SimulateGamepad(keys, &input_state);
|
||||
input_state.pad_buttons = pad_buttons;
|
||||
UpdateInputState(&input_state, true);
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(&input_state);
|
||||
if (g_QuitRequested)
|
||||
break;
|
||||
#if defined(PPSSPP) && !defined(MOBILE_DEVICE)
|
||||
|
|
|
@ -360,7 +360,7 @@ void MainUI::paintGL()
|
|||
updateAccelerometer();
|
||||
UpdateInputState(&input_state);
|
||||
time_update();
|
||||
UpdateRunLoop();
|
||||
UpdateRunLoop(&input_state);
|
||||
}
|
||||
|
||||
void MainUI::updateAccelerometer()
|
||||
|
|
|
@ -82,8 +82,6 @@ bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &default
|
|||
void System_AskForPermission(SystemPermission permission) {}
|
||||
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
|
||||
|
||||
InputState input_state;
|
||||
|
||||
int printUsage(const char *progname, const char *reason)
|
||||
{
|
||||
if (reason != NULL)
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "unittest/TestVertexJit.h"
|
||||
#include "unittest/UnitTest.h"
|
||||
|
||||
InputState input_state;
|
||||
|
||||
std::string System_GetProperty(SystemProperty prop) { return ""; }
|
||||
int System_GetPropertyInt(SystemProperty prop) { return -1; }
|
||||
void NativeMessageReceived(const char *message, const char *value) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue