Skip to content

Commit

Permalink
core: Update to commit 2d3d2d0.
Browse files Browse the repository at this point in the history
mupen64plus/mupen64plus-core@2d3d2d0

*   2d3d2d0 Merge pull request #144 from Gillou68310/framelimiter
|\
| * 0814daa Framelimiter: Discard frames with excessive execution time
* | 1237768 forgot to make this backwards compatible with SDL 1.2
* | 588d3d5 from mupen64plus-user-issues #666, allow for joystick button events to be recognized even when video window is not in foreground
* |   c145f15 Merge pull request #143 from Gillou68310/fix_movescreen
|\ \
| |/
|/|
| * efe1b91 Fixed gfx moveScreen when SDL_VERSION > 1.2
|/
*   72a6a24 Merge pull request #140 from Gillou68310/movescreen
|\
| * 3ba4c08 Call gfx moveScreen when SDL window moved (Windows only) This is only necessary for angrylion's plugin
|/
* 8eab1d7 Merge pull request #138 from Gillou68310/print
* 6316dd9 new_dynarec: Reverted printing method when warning about a block compiled at bogus memory address This was causing slowdown in CBFD. The assem_debug macro is defined as a null function by default.
  • Loading branch information
fzurita committed Jan 19, 2016
1 parent 9b7ac63 commit 278344c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions jni/mupen64plus-core/src/api/vidext.c
Expand Up @@ -96,6 +96,10 @@ EXPORT m64p_error CALL VidExt_Init(void)
if (l_VideoExtensionActive)
return (*l_ExternalVideoFuncTable.VidExtFuncInit)();

#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
#endif

if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
{
DebugMessage(M64MSG_ERROR, "SDL video subsystem init failed: %s", SDL_GetError());
Expand Down
23 changes: 22 additions & 1 deletion jni/mupen64plus-core/src/main/eventloop.c
Expand Up @@ -21,6 +21,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <SDL.h>
#include <SDL_syswm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -319,7 +320,7 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
#endif
return 0;

#if SDL_VERSION_ATLEAST(2,0,0)
#if SDL_VERSION_ATLEAST(1,3,0)
case SDL_WINDOWEVENT:
switch (event->window.event) {
case SDL_WINDOWEVENT_RESIZED:
Expand All @@ -328,6 +329,11 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
gfx.resizeVideoOutput(event->window.data1, event->window.data2);
return 0; // consumed the event
break;

case SDL_WINDOWEVENT_MOVED:
gfx.moveScreen(event->window.data1, event->window.data2);
return 0; // consumed the event
break;
}
break;
#else
Expand All @@ -337,6 +343,14 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
gfx.resizeVideoOutput(event->resize.w, event->resize.h);
return 0; // consumed the event
break;

#ifdef WIN32
case SDL_SYSWMEVENT:
if(event->syswm.msg->msg == WM_MOVE)
gfx.moveScreen(0,0); // The video plugin is responsible for getting the new window position
return 0; // consumed the event
break;
#endif
#endif

// if joystick action is detected, check if it's mapped to a special function
Expand Down Expand Up @@ -468,6 +482,13 @@ void event_initialize(void)
SDL_EnableKeyRepeat(0, 0);
#endif
SDL_SetEventFilter(event_sdl_filter, NULL);

#if defined(WIN32) && !SDL_VERSION_ATLEAST(1,3,0)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);

if (SDL_EventState(SDL_SYSWMEVENT, SDL_QUERY) != SDL_ENABLE)
DebugMessage(M64MSG_WARNING, "Failed to change event state: %s", SDL_GetError());
#endif
}

int event_set_core_defaults(void)
Expand Down
4 changes: 4 additions & 0 deletions jni/mupen64plus-core/src/main/main.c
Expand Up @@ -782,6 +782,10 @@ static void apply_speed_limiter(void)
}
}

// Discard frames with excessive execution time
if (ThisFrameDelta > AdjustedLimit * 3)
ThisFrameDelta = 0.f;

// update our data structures
LastFPSTime = CurrentFPSTime ;
VITotalDelta += ThisFrameDelta - VIDeltas[VIDeltasIndex];
Expand Down

0 comments on commit 278344c

Please sign in to comment.