@@ -57,8 +57,6 @@ static double lastActivity = 0.0;
57
57
static double lastKeepAwake = 0.0 ;
58
58
static GraphicsContext *graphicsContext;
59
59
60
- extern InputState input_state;
61
-
62
60
void Core_SetGraphicsContext (GraphicsContext *ctx) {
63
61
graphicsContext = ctx;
64
62
}
@@ -152,30 +150,30 @@ bool UpdateScreenScale(int width, int height, bool smallWindow) {
152
150
return false ;
153
151
}
154
152
155
- void UpdateRunLoop () {
153
+ void UpdateRunLoop (InputState *input_state ) {
156
154
if (windowHidden && g_Config.bPauseWhenMinimized ) {
157
155
sleep_ms (16 );
158
156
return ;
159
157
}
160
- NativeUpdate (input_state);
158
+ NativeUpdate (* input_state);
161
159
162
160
{
163
- lock_guard guard (input_state. lock );
164
- EndInputState (& input_state);
161
+ lock_guard guard (input_state-> lock );
162
+ EndInputState (input_state);
165
163
}
166
164
167
165
if (GetUIState () != UISTATE_EXIT) {
168
166
NativeRender (graphicsContext);
169
167
}
170
168
}
171
169
172
- void Core_RunLoop (GraphicsContext *ctx) {
170
+ void Core_RunLoop (GraphicsContext *ctx, InputState *input_state ) {
173
171
graphicsContext = ctx;
174
172
while ((GetUIState () != UISTATE_INGAME || !PSP_IsInited ()) && GetUIState () != UISTATE_EXIT) {
175
173
time_update ();
176
174
#if defined(USING_WIN_UI)
177
175
double startTime = time_now_d ();
178
- UpdateRunLoop ();
176
+ UpdateRunLoop (input_state );
179
177
180
178
// Simple throttling to not burn the GPU in the menu.
181
179
time_update ();
@@ -187,13 +185,13 @@ void Core_RunLoop(GraphicsContext *ctx) {
187
185
ctx->SwapBuffers ();
188
186
}
189
187
#else
190
- UpdateRunLoop ();
188
+ UpdateRunLoop (input_state );
191
189
#endif
192
190
}
193
191
194
192
while (!coreState && GetUIState () == UISTATE_INGAME) {
195
193
time_update ();
196
- UpdateRunLoop ();
194
+ UpdateRunLoop (input_state );
197
195
#if defined(USING_WIN_UI)
198
196
if (!windowHidden && !Core_IsStepping ()) {
199
197
ctx->SwapBuffers ();
@@ -234,7 +232,7 @@ static inline void CoreStateProcessed() {
234
232
}
235
233
236
234
// Some platforms, like Android, do not call this function but handle things on their own.
237
- void Core_Run (GraphicsContext *ctx)
235
+ void Core_Run (GraphicsContext *ctx, InputState *input_state )
238
236
{
239
237
#if defined(_DEBUG)
240
238
host->UpdateDisassembly ();
@@ -249,7 +247,7 @@ void Core_Run(GraphicsContext *ctx)
249
247
if (GetUIState () == UISTATE_EXIT) {
250
248
return ;
251
249
}
252
- Core_RunLoop (ctx);
250
+ Core_RunLoop (ctx, input_state );
253
251
#if defined(USING_QT_UI) && !defined(MOBILE_DEVICE)
254
252
return ;
255
253
#else
@@ -261,7 +259,7 @@ void Core_Run(GraphicsContext *ctx)
261
259
{
262
260
case CORE_RUNNING:
263
261
// enter a fast runloop
264
- Core_RunLoop (ctx);
262
+ Core_RunLoop (ctx, input_state );
265
263
break ;
266
264
267
265
// We should never get here on Android.
0 commit comments