Skip to content

Commit 4cd4f4c

Browse files
committed
3rdParty: update mupen64plus-core
1 parent 37839b0 commit 4cd4f4c

File tree

12 files changed

+25
-166
lines changed

12 files changed

+25
-166
lines changed

Source/3rdParty/mupen64plus-core/.gitrepo

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[subrepo]
77
remote = [email protected]:mupen64plus/mupen64plus-core.git
88
branch = master
9-
commit = 312a5befde1b44db8beee7868b929c23d896991f
10-
parent = 6e2d29dc603cb221b7409d2cca646f329073dd03
9+
commit = e170c409fb006aa38fd02031b5eefab6886ec125
10+
parent = 37839b0178b42b57a38a040bbf4e1f410e6952a1
1111
method = merge
1212
cmdver = 0.4.6

Source/3rdParty/mupen64plus-core/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ README Sections
2222

2323
*Binary Package Requirements*
2424

25-
- SDL 1.2 or 2.0
25+
- SDL 2
2626
- libpng
2727
- freetype 2
2828
- zlib

Source/3rdParty/mupen64plus-core/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ as well as a user interface program (called a front-end).
2727

2828
**Binary Package Requirements**
2929

30-
- SDL 1.2 or 2.0
30+
- SDL 2
3131
- libpng
3232
- freetype 2
3333
- zlib

Source/3rdParty/mupen64plus-core/projects/unix/Makefile

100755100644
+11-19
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ SUBDIR = ../../subprojects
159159
# base CFLAGS, LDLIBS, and LDFLAGS
160160
OPTFLAGS ?= -O3 -flto
161161
WARNFLAGS ?= -Wall
162-
CFLAGS += -fno-strict-aliasing -fvisibility=hidden -I$(SRCDIR) -I$(SRCDIR)/asm_defines -DM64P_PARALLEL
162+
CFLAGS += -fvisibility=hidden -I$(SRCDIR) -I$(SRCDIR)/asm_defines -DM64P_PARALLEL
163163
CXXFLAGS += -fvisibility-inlines-hidden
164164
LDLIBS += -lm
165165

@@ -351,26 +351,18 @@ endif
351351

352352
# test for presence of SDL
353353
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
354-
SDL_CONFIG = $(CROSS_COMPILE)sdl2-config
355-
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
356-
SDL_CONFIG = $(CROSS_COMPILE)sdl-config
357-
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
358-
$(error No SDL development libraries found!)
359-
else
360-
ifeq ($(NETPLAY), 1)
361-
SDL_LDLIBS += -lSDL_net
362-
endif
363-
# SDL1 doesn't support vulkan
364-
VULKAN = 0
365-
$(warning Using SDL 1.2 libraries)
366-
endif
367-
else
368-
ifeq ($(NETPLAY), 1)
369-
SDL_LDLIBS += -lSDL2_net
354+
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
355+
$(error No SDL2 development libraries found!)
356+
endif
357+
ifeq ($(NETPLAY), 1)
358+
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
359+
$(error No SDL2_net development libraries found!)
370360
endif
361+
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
362+
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
371363
endif
372-
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
373-
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
364+
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
365+
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
374366
endif
375367
CFLAGS += $(SDL_CFLAGS)
376368
LDLIBS += $(SDL_LDLIBS)

Source/3rdParty/mupen64plus-core/src/api/vidext.c

+4-32
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@
4343
#include "m64p_vidext.h"
4444
#include "vidext.h"
4545

46-
#if SDL_VERSION_ATLEAST(2,0,0)
47-
#ifndef USE_GLES
48-
static int l_ForceCompatibilityContext = 1;
49-
#endif
50-
#include "vidext_sdl2_compat.h"
46+
#ifndef USE_GLES
47+
static int l_ForceCompatibilityContext = 1;
5148
#endif
5249

50+
#include "vidext_sdl2_compat.h"
51+
5352
/* local variables */
5453
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};
5554
static int l_VideoExtensionActive = 0;
@@ -134,13 +133,11 @@ EXPORT m64p_error CALL VidExt_InitWithRenderMode(m64p_render_mode RenderMode)
134133
l_RenderMode = RenderMode;
135134
#endif
136135

137-
#if SDL_VERSION_ATLEAST(2,0,0)
138136
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
139137
/* retrieve default swap interval/VSync */
140138
if (RenderMode == M64P_RENDER_OPENGL) {
141139
l_SwapControl = SDL_GL_GetSwapInterval();
142140
}
143-
#endif
144141

145142
#if SDL_VERSION_ATLEAST(2,24,0)
146143
/* fix DPI scaling issues on Windows */
@@ -188,9 +185,7 @@ EXPORT m64p_error CALL VidExt_Quit(void)
188185
return M64ERR_NOT_INIT;
189186

190187
SDL_ShowCursor(SDL_ENABLE);
191-
#if SDL_VERSION_ATLEAST(2,0,0)
192188
SDL2_DestroyWindow();
193-
#endif
194189
#ifdef VIDEXT_VULKAN
195190
if (l_RenderMode == M64P_RENDER_VULKAN) {
196191
SDL_Vulkan_UnloadLibrary();
@@ -264,7 +259,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
264259
if (l_VideoExtensionActive)
265260
return (*l_ExternalVideoFuncTable.VidExtFuncListRates)(Size, NumRates, Rates);
266261

267-
#if SDL_VERSION_ATLEAST(2,0,0)
268262
if (!SDL_WasInit(SDL_INIT_VIDEO))
269263
return M64ERR_NOT_INIT;
270264

@@ -299,10 +293,6 @@ EXPORT m64p_error CALL VidExt_ListFullscreenRates(m64p_2d_size Size, int *NumRat
299293
*NumRates = rateCount;
300294

301295
return M64ERR_SUCCESS;
302-
#else
303-
// SDL1 doesn't support getting refresh rates
304-
return M64ERR_UNSUPPORTED;
305-
#endif
306296
}
307297

308298
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
377367

378368
SDL_ShowCursor(SDL_DISABLE);
379369

380-
#if SDL_VERSION_ATLEAST(2,0,0)
381370
/* set swap interval/VSync */
382371
if (l_RenderMode == M64P_RENDER_OPENGL &&
383372
SDL_GL_SetSwapInterval(l_SwapControl) != 0)
384373
{
385374
DebugMessage(M64MSG_ERROR, "SDL swap interval (VSync) set failed: %s", SDL_GetError());
386375
}
387-
#endif
388376

389377
l_Fullscreen = (ScreenMode == M64VIDEO_FULLSCREEN);
390378
l_VideoOutputActive = 1;
@@ -409,7 +397,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
409397
return rval;
410398
}
411399

412-
#if SDL_VERSION_ATLEAST(2,0,0)
413400
if (!SDL_WasInit(SDL_INIT_VIDEO) || !SDL_VideoWindow)
414401
return M64ERR_NOT_INIT;
415402

@@ -486,10 +473,6 @@ EXPORT m64p_error CALL VidExt_SetVideoModeWithRate(int Width, int Height, int Re
486473
StateChanged(M64CORE_VIDEO_SIZE, (Width << 16) | Height);
487474

488475
return M64ERR_SUCCESS;
489-
#else
490-
// SDL1 doesn't support setting refresh rates
491-
return M64ERR_UNSUPPORTED;
492-
#endif
493476
}
494477

495478
EXPORT m64p_error CALL VidExt_ResizeWindow(int Width, int Height)
@@ -643,16 +626,11 @@ static const GLAttrMapNode GLAttrMap[] = {
643626
{ M64P_GL_GREEN_SIZE, SDL_GL_GREEN_SIZE },
644627
{ M64P_GL_BLUE_SIZE, SDL_GL_BLUE_SIZE },
645628
{ M64P_GL_ALPHA_SIZE, SDL_GL_ALPHA_SIZE },
646-
#if !SDL_VERSION_ATLEAST(1,3,0)
647-
{ M64P_GL_SWAP_CONTROL, SDL_GL_SWAP_CONTROL },
648-
#endif
649629
{ M64P_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLEBUFFERS },
650630
{ M64P_GL_MULTISAMPLESAMPLES, SDL_GL_MULTISAMPLESAMPLES }
651-
#if SDL_VERSION_ATLEAST(2,0,0)
652631
,{ M64P_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MAJOR_VERSION },
653632
{ M64P_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION },
654633
{ M64P_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_MASK }
655-
#endif
656634
};
657635
static const int mapSize = sizeof(GLAttrMap) / sizeof(GLAttrMapNode);
658636

@@ -677,7 +655,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
677655
}
678656

679657
/* translate the GL context type mask if necessary */
680-
#if SDL_VERSION_ATLEAST(2,0,0)
681658
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK)
682659
{
683660
switch (Value)
@@ -698,7 +675,6 @@ EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr Attr, int Value)
698675
Value = 0;
699676
}
700677
}
701-
#endif
702678

703679
for (i = 0; i < mapSize; i++)
704680
{
@@ -727,13 +703,11 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
727703
if (!SDL_WasInit(SDL_INIT_VIDEO))
728704
return M64ERR_NOT_INIT;
729705

730-
#if SDL_VERSION_ATLEAST(2,0,0)
731706
if (Attr == M64P_GL_SWAP_CONTROL)
732707
{
733708
*pValue = SDL_GL_GetSwapInterval();
734709
return M64ERR_SUCCESS;
735710
}
736-
#endif
737711

738712
for (i = 0; i < mapSize; i++)
739713
{
@@ -743,7 +717,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
743717
if (SDL_GL_GetAttribute(GLAttrMap[i].sdlAttr, &NewValue) != 0)
744718
return M64ERR_SYSTEM_FAIL;
745719
/* translate the GL context type mask if necessary */
746-
#if SDL_VERSION_ATLEAST(2,0,0)
747720
if (Attr == M64P_GL_CONTEXT_PROFILE_MASK)
748721
{
749722
switch (NewValue)
@@ -761,7 +734,6 @@ EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr Attr, int *pValue)
761734
NewValue = 0;
762735
}
763736
}
764-
#endif
765737
*pValue = NewValue;
766738
return M64ERR_SUCCESS;
767739
}

Source/3rdParty/mupen64plus-core/src/device/dd/disk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ uint8_t* scan_and_expand_disk_format(uint8_t* data, size_t size,
429429

430430
//IPL Load Address
431431
uint32_t ipl_load_addr = big32(sys_data->ipl_load_addr);
432-
if (ipl_load_addr < 0x80000000 && ipl_load_addr >= 0x80800000) continue;
432+
if (ipl_load_addr < 0x80000000 || ipl_load_addr >= 0x80800000) continue;
433433

434434
//Country Code
435435
uint32_t disk_region = big32(sys_data->region);

Source/3rdParty/mupen64plus-core/src/device/gb/gb_cart.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static int write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const u
240240
/* 0x2000-0x3fff: ROM bank select (low 5 bits) */
241241
case (0x2000 >> 13):
242242
bank = value & 0x1f;
243-
gb_cart->rom_bank = (gb_cart->rom_bank & ~UINT8_C(0x1f)) | (bank == 0) ? 1 : bank;
243+
gb_cart->rom_bank = (gb_cart->rom_bank & ~UINT8_C(0x1f)) | ((bank == 0) ? 1 : bank);
244244
DebugMessage(M64MSG_VERBOSE, "MBC1 set rom bank %02x", gb_cart->rom_bank);
245245
break;
246246

Source/3rdParty/mupen64plus-core/src/main/eventloop.c

+2-83
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,8 @@
2525
#include <stdio.h>
2626
#include <stdlib.h>
2727
#include <string.h>
28-
#if ! SDL_VERSION_ATLEAST(1,3,0)
29-
30-
#define SDL_SCANCODE_ESCAPE SDLK_ESCAPE
31-
#define SDL_NUM_SCANCODES SDLK_LAST
32-
#define SDL_SCANCODE_F5 SDLK_F5
33-
#define SDL_SCANCODE_F7 SDLK_F7
34-
#define SDL_SCANCODE_F9 SDLK_F9
35-
#define SDL_SCANCODE_F10 SDLK_F10
36-
#define SDL_SCANCODE_F11 SDLK_F11
37-
#define SDL_SCANCODE_F12 SDLK_F12
38-
#define SDL_SCANCODE_P SDLK_p
39-
#define SDL_SCANCODE_M SDLK_m
40-
#define SDL_SCANCODE_RIGHTBRACKET SDLK_RIGHTBRACKET
41-
#define SDL_SCANCODE_LEFTBRACKET SDLK_LEFTBRACKET
42-
#define SDL_SCANCODE_F SDLK_f
43-
#define SDL_SCANCODE_Y SDLK_y
44-
#define SDL_SCANCODE_SLASH SDLK_SLASH
45-
#define SDL_SCANCODE_G SDLK_g
46-
#define SDL_SCANCODE_RETURN SDLK_RETURN
47-
#define SDL_SCANCODE_0 SDLK_0
48-
#define SDL_SCANCODE_1 SDLK_1
49-
#define SDL_SCANCODE_2 SDLK_2
50-
#define SDL_SCANCODE_3 SDLK_3
51-
#define SDL_SCANCODE_4 SDLK_4
52-
#define SDL_SCANCODE_5 SDLK_5
53-
#define SDL_SCANCODE_6 SDLK_6
54-
#define SDL_SCANCODE_7 SDLK_7
55-
#define SDL_SCANCODE_8 SDLK_8
56-
#define SDL_SCANCODE_9 SDLK_9
57-
#define SDL_SCANCODE_UNKNOWN SDLK_UNKNOWN
58-
59-
#define SDL_SetEventFilter(func, data) SDL_SetEventFilter(func)
60-
#define event_sdl_filter(userdata, event) event_sdl_filter(const event)
61-
62-
#else
63-
SDL_JoystickID l_iJoyInstanceID[10];
64-
#endif
28+
29+
SDL_JoystickID l_iJoyInstanceID[10];
6530

6631
#define M64P_CORE_PROTOTYPES 1
6732
#include "api/callbacks.h"
@@ -196,9 +161,7 @@ static int MatchJoyCommand(const SDL_Event *event, eJoyCommand cmd)
196161
else if (phrase_str[1] >= '0' && phrase_str[1] <= '9')
197162
{
198163
dev_number = phrase_str[1] - '0';
199-
#if SDL_VERSION_ATLEAST(2,0,0)
200164
dev_number = l_iJoyInstanceID[dev_number];
201-
#endif
202165
}
203166
else
204167
{
@@ -319,24 +282,15 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
319282
break;
320283

321284
case SDL_KEYDOWN:
322-
#if SDL_VERSION_ATLEAST(1,3,0)
323285
if (event->key.repeat)
324286
return 0;
325287

326288
event_sdl_keydown(event->key.keysym.scancode, event->key.keysym.mod);
327-
#else
328-
event_sdl_keydown(event->key.keysym.sym, event->key.keysym.mod);
329-
#endif
330289
return 0;
331290
case SDL_KEYUP:
332-
#if SDL_VERSION_ATLEAST(1,3,0)
333291
event_sdl_keyup(event->key.keysym.scancode, event->key.keysym.mod);
334-
#else
335-
event_sdl_keyup(event->key.keysym.sym, event->key.keysym.mod);
336-
#endif
337292
return 0;
338293

339-
#if SDL_VERSION_ATLEAST(1,3,0)
340294
case SDL_WINDOWEVENT:
341295
switch (event->window.event) {
342296
case SDL_WINDOWEVENT_RESIZED:
@@ -352,22 +306,6 @@ static int SDLCALL event_sdl_filter(void *userdata, SDL_Event *event)
352306
break;
353307
}
354308
break;
355-
#else
356-
case SDL_VIDEORESIZE:
357-
// call the video plugin. if the video plugin supports resizing, it will resize its viewport and call
358-
// VidExt_ResizeWindow to update the window manager handling our opengl output window
359-
gfx.resizeVideoOutput(event->resize.w, event->resize.h);
360-
return 0; // consumed the event
361-
break;
362-
363-
#ifdef WIN32
364-
case SDL_SYSWMEVENT:
365-
if(event->syswm.msg->msg == WM_MOVE)
366-
gfx.moveScreen(0,0); // The video plugin is responsible for getting the new window position
367-
return 0; // consumed the event
368-
break;
369-
#endif
370-
#endif
371309

372310
#ifndef NO_KEYBINDINGS
373311
// if joystick action is detected, check if it's mapped to a special function
@@ -491,13 +429,8 @@ void event_initialize(void)
491429
{
492430
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
493431
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
494-
#if SDL_VERSION_ATLEAST(2,0,0)
495432
SDL_Joystick *thisJoy = SDL_JoystickOpen(device);
496433
l_iJoyInstanceID[device] = SDL_JoystickInstanceID(thisJoy);
497-
#else
498-
if (!SDL_JoystickOpened(device))
499-
SDL_JoystickOpen(device);
500-
#endif
501434
}
502435

503436
phrase_str = strtok(NULL, ",");
@@ -508,17 +441,7 @@ void event_initialize(void)
508441

509442

510443
/* set up SDL event filter and disable key repeat */
511-
#if !SDL_VERSION_ATLEAST(2,0,0)
512-
SDL_EnableKeyRepeat(0, 0);
513-
#endif
514444
SDL_SetEventFilter(event_sdl_filter, NULL);
515-
516-
#if defined(WIN32) && !SDL_VERSION_ATLEAST(1,3,0)
517-
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
518-
519-
if (SDL_EventState(SDL_SYSWMEVENT, SDL_QUERY) != SDL_ENABLE)
520-
DebugMessage(M64MSG_WARNING, "Failed to change event state: %s", SDL_GetError());
521-
#endif
522445
}
523446

524447
int event_set_core_defaults(void)
@@ -559,11 +482,7 @@ int event_set_core_defaults(void)
559482
int key = SDL_SCANCODE_UNKNOWN;
560483
for (int slot = 0; slot < 10; slot++)
561484
{
562-
#if ! SDL_VERSION_ATLEAST(1,3,0)
563-
key = SDL_SCANCODE_0 + slot;
564-
#else
565485
key = slot == 0 ? SDL_SCANCODE_0 : SDL_SCANCODE_1 + (slot - 1);
566-
#endif
567486
sprintf(kbdSaveSlotStr, "%s%i", kbdSaveSlot, slot);
568487
sprintf(kbdSaveSlotHelpStr, "SDL keysym for save slot %i", slot);
569488
ConfigSetDefaultInt(l_CoreEventsConfig, kbdSaveSlotStr, sdl_native2keysym(key), kbdSaveSlotHelpStr);

0 commit comments

Comments
 (0)