From 013a75724f85af383c229c33c4b251b43c954952 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Sun, 10 Mar 2024 08:31:48 +0000 Subject: [PATCH] gamecube-sdl: 1.2.15-15 --- gamecube/SDL/PKGBUILD | 4 +-- gamecube/SDL/SDL-1.2.15.patch | 52 +++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/gamecube/SDL/PKGBUILD b/gamecube/SDL/PKGBUILD index 2f0782fc..d63493de 100644 --- a/gamecube/SDL/PKGBUILD +++ b/gamecube/SDL/PKGBUILD @@ -3,7 +3,7 @@ pkgname=gamecube-sdl pkgver=1.2.15 -pkgrel=13 +pkgrel=15 pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard." arch=('any') url="https://libsdl.org" @@ -38,5 +38,5 @@ package() { } sha256sums=('d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00' - '5aa8e71f31cc8d10fb586f00a79f0765aed047d6573a02e218034a03606eb90e' + '64f191a298233b078277b483145f28caacd9f6e773cbe18a25be279479b2f337' 'eb33978edaeeb22f83d108ea5236e7f749c3fb3d60765e69f624af2365e2b854') diff --git a/gamecube/SDL/SDL-1.2.15.patch b/gamecube/SDL/SDL-1.2.15.patch index 7d22dfee..141e24f7 100644 --- a/gamecube/SDL/SDL-1.2.15.patch +++ b/gamecube/SDL/SDL-1.2.15.patch @@ -202,6 +202,32 @@ index ab50ef1e2..9824c5063 100644 #ifdef __cplusplus #define C_LINKAGE "C" +diff --git a/src/SDL.c b/src/SDL.c +index 87f1b1af2..bcb53f7e0 100644 +--- a/src/SDL.c ++++ b/src/SDL.c +@@ -121,6 +121,10 @@ int SDL_InitSubSystem(Uint32 flags) + if ( SDL_JoystickInit() < 0 ) { + return(-1); + } ++// joystick 0 is used for mouse emulation on wii & cube. ++#if defined (__wii__) || defined (__gamecube__) ++ SDL_JoystickOpen(0); ++#endif + SDL_initialized |= SDL_INIT_JOYSTICK; + } + #else +@@ -155,6 +159,10 @@ int SDL_Init(Uint32 flags) + } + #endif + ++// On Wii & GameCube always initialise joysticks. ++#if defined(__wii__) || defined (__gamecube__) ++ flags |= SDL_INIT_JOYSTICK; ++#endif + /* Clear the error message */ + SDL_ClearError(); + diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index beb26e0b4..fbbeb459f 100644 --- a/src/audio/SDL_audio.c @@ -3006,10 +3032,10 @@ index 000000000..a86ad89b4 +#endif /* _SDL_wiivideo_h */ diff --git a/src/video/wii/SDL_wiievents.c b/src/video/wii/SDL_wiievents.c new file mode 100644 -index 000000000..048f12415 +index 000000000..2688bda3f --- /dev/null +++ b/src/video/wii/SDL_wiievents.c -@@ -0,0 +1,242 @@ +@@ -0,0 +1,264 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga @@ -3065,9 +3091,31 @@ index 000000000..048f12415 + + // this will only work if Joystick 0 has been opened and has been polled + WPADData *wd = WPAD_Data(WPAD_CHAN_0); ++ ++ static Uint8 lastButtonStateA = SDL_RELEASED; ++ static Uint8 lastButtonStateB = SDL_RELEASED; ++ ++ Uint8 stateA = (wd->btns_h & WPAD_BUTTON_A) ? SDL_PRESSED : SDL_RELEASED; ++ Uint8 stateB = (wd->btns_h & WPAD_BUTTON_B) ? SDL_PRESSED : SDL_RELEASED; ++ ++ if (stateA != lastButtonStateA) ++ { ++ lastButtonStateA = stateA; ++ posted += SDL_PrivateMouseButton(stateA, SDL_BUTTON_LEFT, 0, 0); ++ } ++ ++ if (stateB != lastButtonStateB) ++ { ++ lastButtonStateB = stateB; ++ posted += SDL_PrivateMouseButton(stateB, SDL_BUTTON_RIGHT, 0, 0); ++ } ++ ++ + if (wd && wd->exp.type != WPAD_EXP_CLASSIC && wd->ir.valid) { ++ + // use SDL_BUTTON_X2 to signal that this is the wiimote acting as a mouse + Uint8 Buttons = SDL_GetMouseState(NULL, NULL)|SDL_BUTTON_X2MASK; ++ + if (wd->ir.x < vresx/8) + wd->ir.x = vresx/8; + else if (wd->ir.x > (vresx + vresx/8))