3rdParty: update mupen64plus-core

This commit is contained in:
Rosalie Wanders
2024-11-03 16:46:38 +01:00
parent 37839b0178
commit 4cd4f4c6ea
12 changed files with 25 additions and 166 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:mupen64plus/mupen64plus-core.git
branch = master
commit = 312a5befde1b44db8beee7868b929c23d896991f
parent = 6e2d29dc603cb221b7409d2cca646f329073dd03
commit = e170c409fb006aa38fd02031b5eefab6886ec125
parent = 37839b0178b42b57a38a040bbf4e1f410e6952a1
method = merge
cmdver = 0.4.6
+1 -1
View File
@@ -22,7 +22,7 @@ README Sections
*Binary Package Requirements*
- SDL 1.2 or 2.0
- SDL 2
- libpng
- freetype 2
- zlib
+1 -1
View File
@@ -27,7 +27,7 @@ as well as a user interface program (called a front-end).
**Binary Package Requirements**
- SDL 1.2 or 2.0
- SDL 2
- libpng
- freetype 2
- zlib
+12 -20
View File
@@ -159,7 +159,7 @@ SUBDIR = ../../subprojects
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall
CFLAGS += -fno-strict-aliasing -fvisibility=hidden -I$(SRCDIR) -I$(SRCDIR)/asm_defines -DM64P_PARALLEL
CFLAGS += -fvisibility=hidden -I$(SRCDIR) -I$(SRCDIR)/asm_defines -DM64P_PARALLEL
CXXFLAGS += -fvisibility-inlines-hidden
LDLIBS += -lm
@@ -351,26 +351,18 @@ endif
# test for presence of SDL
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
SDL_CONFIG = $(CROSS_COMPILE)sdl2-config
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
SDL_CONFIG = $(CROSS_COMPILE)sdl-config
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
$(error No SDL development libraries found!)
else
ifeq ($(NETPLAY), 1)
SDL_LDLIBS += -lSDL_net
endif
# SDL1 doesn't support vulkan
VULKAN = 0
$(warning Using SDL 1.2 libraries)
endif
else
ifeq ($(NETPLAY), 1)
SDL_LDLIBS += -lSDL2_net
endif
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
$(error No SDL2 development libraries found!)
endif
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
ifeq ($(NETPLAY), 1)
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
$(error No SDL2_net development libraries found!)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
endif
CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS)
+4 -32
View File
@@ -43,13 +43,12 @@
#include "m64p_vidext.h"
#include "vidext.h"
#if SDL_VERSION_ATLEAST(2,0,0)
#ifndef USE_GLES
static int l_ForceCompatibilityContext = 1;
#endif
#include "vidext_sdl2_compat.h"
#ifndef USE_GLES
static int l_ForceCompatibilityContext = 1;
#endif
#include "vidext_sdl2_compat.h"
/* local variables */
static m64p_video_extension_functions l_ExternalVideoFuncTable = {17, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static int l_VideoExtensionActive = 0;
@@ -134,13 +133,11 @@ EXPORT m64p_error CALL VidExt_InitWithRenderMode(m64p_render_mode RenderMode)
l_RenderMode = RenderMode;
#endif
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
/* retrieve default swap interval/VSync */
if (RenderMode == M64P_RENDER_OPENGL) {
l_SwapControl = SDL_GL_GetSwapInterval();
}
#endif
#if SDL_VERSION_ATLEAST(2,24,0)
/* fix DPI scaling issues on Windows */
@@ -188,9 +185,7 @@ EXPORT m64p_error CALL VidExt_Quit(void)
return M64ERR_NOT_INIT;
SDL_ShowCursor(SDL_ENABLE);
#if SDL_VERSION_ATLEAST(2,0,0)
SDL2_DestroyWindow();
#endif
#ifdef VIDEXT_VULKAN
if (l_RenderMode == M64P_RENDER_VULKAN) {
SDL_Vulkan_UnloadLibrary();
@@ -264,7 +259,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
if (l_VideoExtensionActive)
return (*l_ExternalVideoFuncTable.VidExtFuncListRates)(Size, NumRates, Rates);
#if SDL_VERSION_ATLEAST(2,0,0)
if (!SDL_WasInit(SDL_INIT_VIDEO))
return M64ERR_NOT_INIT;
@@ -299,10 +293,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
*NumRates = rateCount;
return M64ERR_SUCCESS;
#else
// SDL1 doesn't support getting refresh rates
return M64ERR_UNSUPPORTED;
#endif
}
EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPixel, m64p_video_mode ScreenMode, m64p_video_flags Flags)
@@ -377,14 +367,12 @@ EXPORT m64p_error CALL VidExt_SetVideoMode(int Width, int Height, int BitsPerPix
SDL_ShowCursor(SDL_DISABLE);
#if SDL_VERSION_ATLEAST(2,0,0)
/* set swap interval/VSync */
if (l_RenderMode == M64P_RENDER_OPENGL &&
SDL_GL_SetSwapInterval(l_SwapControl) != 0)
{
DebugMessage(M64MSG_ERROR, "SDL swap interval (VSync) set failed: %s", SDL_GetError());
}
#endif
l_Fullscreen = (ScreenMode == M64VIDEO_FULLSCREEN);
l_VideoOutputActive = 1;
@@ -409,7 +397,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
return rval;
}
#if SDL_VERSION_ATLEAST(2,0,0)
if (!SDL_WasInit(SDL_INIT_VIDEO) || !SDL_VideoWindow)
return M64ERR_NOT_INIT;
@@ -486,10 +473,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
StateChanged(M64CORE_VIDEO_SIZE, (Width << 16) | Height);
return M64ERR_SUCCESS;
#else
// SDL1 doesn't support setting refresh rates
return M64ERR_UNSUPPORTED;
#endif
}
EXPORT m64p_error CALL VidExt_ResizeWindow(int Width, int Height)
@@ -643,16 +626,11 @@ static const GLAttrMapNode GLAttrMap[] = {
{ M64P_GL_GREEN_SIZE, SDL_GL_GREEN_SIZE },
{ M64P_GL_BLUE_SIZE, SDL_GL_BLUE_SIZE },
{ M64P_GL_ALPHA_SIZE, SDL_GL_ALPHA_SIZE },
#if !SDL_VERSION_ATLEAST(1,3,0)
{ M64P_GL_SWAP_CONTROL, SDL_GL_SWAP_CONTROL },
#endif
{ M64P_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLEBUFFERS },
{ M64P_GL_MULTISAMPLESAMPLES, SDL_GL_MULTISAMPLESAMPLES }
#if SDL_VERSION_ATLEAST(2,0,0)
,{ M64P_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MAJOR_VERSION },
{ M64P_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION },
{ M64P_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_MASK }
#endif
};
static const int mapSize = sizeof(GLAttrMap) / sizeof(GLAttrMapNode);
@@ -677,7 +655,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
}
/* translate the GL context type mask if necessary */
#if SDL_VERSION_ATLEAST(2,0,0)
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK)
{
switch (Value)
@@ -698,7 +675,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
Value = 0;
}
}
#endif
for (i = 0; i < mapSize; i++)
{
@@ -727,13 +703,11 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
if (!SDL_WasInit(SDL_INIT_VIDEO))
return M64ERR_NOT_INIT;
#if SDL_VERSION_ATLEAST(2,0,0)
if (Attr == M64P_GL_SWAP_CONTROL)
{
*pValue = SDL_GL_GetSwapInterval();
return M64ERR_SUCCESS;
}
#endif
for (i = 0; i < mapSize; i++)
{
@@ -743,7 +717,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
if (SDL_GL_GetAttribute(GLAttrMap[i].sdlAttr, &NewValue) != 0)
return M64ERR_SYSTEM_FAIL;
/* translate the GL context type mask if necessary */
#if SDL_VERSION_ATLEAST(2,0,0)
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK)
{
switch (NewValue)
@@ -761,7 +734,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
NewValue = 0;
}
}
#endif
*pValue = NewValue;
return M64ERR_SUCCESS;
}
+1 -1
View File
@@ -429,7 +429,7 @@ uint8_t* scan_and_expand_disk_format(uint8_t* data, size_t size,
//IPL Load Address
uint32_t ipl_load_addr = big32(sys_data->ipl_load_addr);
if (ipl_load_addr < 0x80000000 && ipl_load_addr >= 0x80800000) continue;
if (ipl_load_addr < 0x80000000 || ipl_load_addr >= 0x80800000) continue;
//Country Code
uint32_t disk_region = big32(sys_data->region);
+1 -1
View File
@@ -240,7 +240,7 @@ static int write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const u
/* 0x2000-0x3fff: ROM bank select (low 5 bits) */
case (0x2000 >> 13):
bank = value & 0x1f;
gb_cart->rom_bank = (gb_cart->rom_bank & ~UINT8_C(0x1f)) | (bank == 0) ? 1 : bank;
gb_cart->rom_bank = (gb_cart->rom_bank & ~UINT8_C(0x1f)) | ((bank == 0) ? 1 : bank);
DebugMessage(M64MSG_VERBOSE, "MBC1 set rom bank %02x", gb_cart->rom_bank);
break;
+1 -82
View File
@@ -25,43 +25,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if ! SDL_VERSION_ATLEAST(1,3,0)
#define SDL_SCANCODE_ESCAPE SDLK_ESCAPE
#define SDL_NUM_SCANCODES SDLK_LAST
#define SDL_SCANCODE_F5 SDLK_F5
#define SDL_SCANCODE_F7 SDLK_F7
#define SDL_SCANCODE_F9 SDLK_F9
#define SDL_SCANCODE_F10 SDLK_F10
#define SDL_SCANCODE_F11 SDLK_F11
#define SDL_SCANCODE_F12 SDLK_F12
#define SDL_SCANCODE_P SDLK_p
#define SDL_SCANCODE_M SDLK_m
#define SDL_SCANCODE_RIGHTBRACKET SDLK_RIGHTBRACKET
#define SDL_SCANCODE_LEFTBRACKET SDLK_LEFTBRACKET
#define SDL_SCANCODE_F SDLK_f
#define SDL_SCANCODE_Y SDLK_y
#define SDL_SCANCODE_SLASH SDLK_SLASH
#define SDL_SCANCODE_G SDLK_g
#define SDL_SCANCODE_RETURN SDLK_RETURN
#define SDL_SCANCODE_0 SDLK_0
#define SDL_SCANCODE_1 SDLK_1
#define SDL_SCANCODE_2 SDLK_2
#define SDL_SCANCODE_3 SDLK_3
#define SDL_SCANCODE_4 SDLK_4
#define SDL_SCANCODE_5 SDLK_5
#define SDL_SCANCODE_6 SDLK_6
#define SDL_SCANCODE_7 SDLK_7
#define SDL_SCANCODE_8 SDLK_8
#define SDL_SCANCODE_9 SDLK_9
#define SDL_SCANCODE_UNKNOWN SDLK_UNKNOWN
#define SDL_SetEventFilter(func, data) SDL_SetEventFilter(func)
#define event_sdl_filter(userdata, event) event_sdl_filter(const event)
#else
SDL_JoystickID l_iJoyInstanceID[10];
#endif
SDL_JoystickID l_iJoyInstanceID[10];
#define M64P_CORE_PROTOTYPES 1
#include "api/callbacks.h"
@@ -196,9 +161,7 @@ static int MatchJoyCommand(const SDL_Event *event, eJoyCommand cmd)
else if (phrase_str[1] >= '0' && phrase_str[1] <= '9')
{
dev_number = phrase_str[1] - '0';
#if SDL_VERSION_ATLEAST(2,0,0)
dev_number = l_iJoyInstanceID[dev_number];
#endif
}
else
{
@@ -319,24 +282,15 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
break;
case SDL_KEYDOWN:
#if SDL_VERSION_ATLEAST(1,3,0)
if (event->key.repeat)
return 0;
event_sdl_keydown(event->key.keysym.scancode, event->key.keysym.mod);
#else
event_sdl_keydown(event->key.keysym.sym, event->key.keysym.mod);
#endif
return 0;
case SDL_KEYUP:
#if SDL_VERSION_ATLEAST(1,3,0)
event_sdl_keyup(event->key.keysym.scancode, event->key.keysym.mod);
#else
event_sdl_keyup(event->key.keysym.sym, event->key.keysym.mod);
#endif
return 0;
#if SDL_VERSION_ATLEAST(1,3,0)
case SDL_WINDOWEVENT:
switch (event->window.event) {
case SDL_WINDOWEVENT_RESIZED:
@@ -352,22 +306,6 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
break;
}
break;
#else
case SDL_VIDEORESIZE:
// call the video plugin. if the video plugin supports resizing, it will resize its viewport and call
// VidExt_ResizeWindow to update the window manager handling our opengl output window
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
#ifndef NO_KEYBINDINGS
// if joystick action is detected, check if it's mapped to a special function
@@ -491,13 +429,8 @@ void event_initialize(void)
{
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_Joystick *thisJoy = SDL_JoystickOpen(device);
l_iJoyInstanceID[device] = SDL_JoystickInstanceID(thisJoy);
#else
if (!SDL_JoystickOpened(device))
SDL_JoystickOpen(device);
#endif
}
phrase_str = strtok(NULL, ",");
@@ -508,17 +441,7 @@ void event_initialize(void)
/* set up SDL event filter and disable key repeat */
#if !SDL_VERSION_ATLEAST(2,0,0)
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)
@@ -559,11 +482,7 @@ int event_set_core_defaults(void)
int key = SDL_SCANCODE_UNKNOWN;
for (int slot = 0; slot < 10; slot++)
{
#if ! SDL_VERSION_ATLEAST(1,3,0)
key = SDL_SCANCODE_0 + slot;
#else
key = slot == 0 ? SDL_SCANCODE_0 : SDL_SCANCODE_1 + (slot - 1);
#endif
sprintf(kbdSaveSlotStr, "%s%i", kbdSaveSlot, slot);
sprintf(kbdSaveSlotHelpStr, "SDL keysym for save slot %i", slot);
ConfigSetDefaultInt(l_CoreEventsConfig, kbdSaveSlotStr, sdl_native2keysym(key), kbdSaveSlotHelpStr);
+1 -4
View File
@@ -312,11 +312,8 @@ static int netplay_ensure_valid(uint8_t control_id)
if (l_udpChannel == -1)
return 0;
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_Thread* thread = SDL_CreateThread(netplay_require_response, "Netplay key request", &control_id);
#else
SDL_Thread* thread = SDL_CreateThread(netplay_require_response, &control_id);
#endif
while (!check_valid(control_id, l_cin_compats[control_id].netplay_count) && l_udpChannel != -1)
netplay_process();
int success;
@@ -27,8 +27,6 @@
uint16_t sdl_keysym2scancode(uint16_t keysym);
uint16_t sdl_scancode2keysym(uint16_t scancode);
#if SDL_VERSION_ATLEAST(1,3,0)
static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
{
return sdl_keysym2scancode(keysym);
@@ -38,17 +36,3 @@ static osal_inline uint16_t sdl_native2keysym(uint16_t native)
{
return sdl_scancode2keysym(native);
}
#else
static osal_inline uint16_t sdl_keysym2native(uint16_t keysym)
{
return keysym;
}
static osal_inline uint16_t sdl_native2keysym(uint16_t native)
{
return native;
}
#endif
+1 -4
View File
@@ -131,11 +131,8 @@ int workqueue_init(void)
return -1;
}
#if SDL_VERSION_ATLEAST(2,0,0)
thread->thread = SDL_CreateThread(workqueue_thread_handler, "m64pwq", thread);
#else
thread->thread = SDL_CreateThread(workqueue_thread_handler, thread);
#endif
if (!thread->thread) {
DebugMessage(M64MSG_ERROR, "Could not create workqueue thread handler");
SDL_UnlockMutex(workqueue_mgmt.lock);
-2
View File
@@ -234,7 +234,6 @@ void osd_init(int width, int height)
return;
}
#if SDL_VERSION_ATLEAST(2,0,0)
int gl_context;
VidExt_GL_GetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, &gl_context);
if (gl_context == M64P_GL_CONTEXT_PROFILE_CORE)
@@ -242,7 +241,6 @@ void osd_init(int width, int height)
DebugMessage(M64MSG_WARNING, "OSD not compatible with OpenGL core context. OSD deactivated.");
return;
}
#endif
// clear statics
for (i = 0; i < OSD_NUM_CORNERS; i++)