From 709244ad9e4f51ccb7adeab288f4cfee264eb95e Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Thu, 30 Nov 2017 14:26:58 +0100 Subject: [PATCH] Fixes for SDL2 after merge from sdl1-dev branch --- VisualGDB/guisan/guisan.vcxproj | 4 ++-- src/cia.cpp | 2 +- src/guisan/include/guisan/sdl/sdlgraphics.hpp | 2 +- src/guisan/include/guisan/sdl/sdlimage.hpp | 2 +- .../include/guisan/sdl/sdlimageloader.hpp | 2 +- src/guisan/include/guisan/sdl/sdlinput.hpp | 2 +- src/guisan/include/guisan/sdl/sdlpixel.hpp | 2 +- .../include/guisan/sdl/sdltruetypefont.hpp | 2 +- src/inputdevice.cpp | 8 +++----- src/osdep/amiberry_input.cpp | 14 +++++++------- src/osdep/gui/InGameMessage.cpp | 4 ++-- src/osdep/gui/Navigation.cpp | 4 ++-- src/osdep/gui/PanelCustom.cpp | 10 +++++----- src/osdep/gui/PanelInput.cpp | 18 +++++++++--------- src/osdep/gui/gui_handling.h | 2 +- src/osdep/keyboard.cpp | 1 - src/threaddep/thread.h | 8 ++++---- 17 files changed, 42 insertions(+), 45 deletions(-) diff --git a/VisualGDB/guisan/guisan.vcxproj b/VisualGDB/guisan/guisan.vcxproj index c40ed261..5cb784af 100644 --- a/VisualGDB/guisan/guisan.vcxproj +++ b/VisualGDB/guisan/guisan.vcxproj @@ -40,7 +40,7 @@ GNUPP14 - ..\..\src\guisan\include;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/local/include;=/usr/local/include/SDL2;%(ClCompile.AdditionalIncludeDirectories) + ..\..\src\guisan\include;C:/SysGCC/raspberry/arm-linux-gnueabihf/include/c++/6.3.0/include;C:/SysGCC/raspberry/arm-linux-gnueabihf/include/c++/6.3.0;C:/SysGCC/raspberry/arm-linux-gnueabihf/include;=/usr/include;=/usr/include/SDL2;=/usr/local/include;=/usr/local/include/SDL2;%(ClCompile.AdditionalIncludeDirectories) DEBUG=1;%(ClCompile.PreprocessorDefinitions) @@ -53,7 +53,7 @@ GNUPP14 - ..\..\src\guisan\include;C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/local/include;=/usr/local/include/SDL2;%(ClCompile.AdditionalIncludeDirectories) + ..\..\src\guisan\include;C:/SysGCC/raspberry/arm-linux-gnueabihf/include/c++/6.3.0/include;C:/SysGCC/raspberry/arm-linux-gnueabihf/include/c++/6.3.0;C:/SysGCC/raspberry/arm-linux-gnueabihf/include;=/usr/include;=/usr/include/SDL2;=/usr/local/include;=/usr/local/include/SDL2;%(ClCompile.AdditionalIncludeDirectories) NDEBUG=1;RELEASE=1;%(ClCompile.PreprocessorDefinitions) diff --git a/src/cia.cpp b/src/cia.cpp index 0aba3d06..35823ead 100644 --- a/src/cia.cpp +++ b/src/cia.cpp @@ -613,7 +613,7 @@ static uae_u8 ReadCIAA (unsigned int addr) return v; } case 1: -#if defined(INPUTDEVICE_SIMPLE) && !defined(RASPBERRY) +#if defined(INPUTDEVICE_SIMPLE) && !defined(AMIBERRY) tmp = (ciaaprb & ciaadrb) | (ciaadrb ^ 0xff); #else tmp = handle_parport_joystick (0, ciaaprb, ciaadrb); diff --git a/src/guisan/include/guisan/sdl/sdlgraphics.hpp b/src/guisan/include/guisan/sdl/sdlgraphics.hpp index 9614d9ad..8bd1231e 100644 --- a/src/guisan/include/guisan/sdl/sdlgraphics.hpp +++ b/src/guisan/include/guisan/sdl/sdlgraphics.hpp @@ -57,7 +57,7 @@ #ifndef GCN_SDLGRAPHICS_HPP #define GCN_SDLGRAPHICS_HPP -#include "SDL2/SDL.h" +#include "SDL.h" #include "guisan/color.hpp" #include "guisan/graphics.hpp" diff --git a/src/guisan/include/guisan/sdl/sdlimage.hpp b/src/guisan/include/guisan/sdl/sdlimage.hpp index c63246ba..e6654701 100644 --- a/src/guisan/include/guisan/sdl/sdlimage.hpp +++ b/src/guisan/include/guisan/sdl/sdlimage.hpp @@ -57,7 +57,7 @@ #ifndef GCN_SDLIMAGE_HPP #define GCN_SDLIMAGE_HPP -#include "SDL2/SDL.h" +#include "SDL.h" #include diff --git a/src/guisan/include/guisan/sdl/sdlimageloader.hpp b/src/guisan/include/guisan/sdl/sdlimageloader.hpp index 8ecbafb9..5d4455f1 100644 --- a/src/guisan/include/guisan/sdl/sdlimageloader.hpp +++ b/src/guisan/include/guisan/sdl/sdlimageloader.hpp @@ -60,7 +60,7 @@ #include "guisan/imageloader.hpp" #include "guisan/platform.hpp" -#include "SDL2/SDL.h" +#include "SDL.h" namespace gcn { diff --git a/src/guisan/include/guisan/sdl/sdlinput.hpp b/src/guisan/include/guisan/sdl/sdlinput.hpp index c92d66df..007fb908 100644 --- a/src/guisan/include/guisan/sdl/sdlinput.hpp +++ b/src/guisan/include/guisan/sdl/sdlinput.hpp @@ -59,7 +59,7 @@ #include -#include "SDL2/SDL.h" +#include "SDL.h" #include "guisan/input.hpp" #include "guisan/keyinput.hpp" diff --git a/src/guisan/include/guisan/sdl/sdlpixel.hpp b/src/guisan/include/guisan/sdl/sdlpixel.hpp index d7e89b8f..0812bc0a 100644 --- a/src/guisan/include/guisan/sdl/sdlpixel.hpp +++ b/src/guisan/include/guisan/sdl/sdlpixel.hpp @@ -57,7 +57,7 @@ #ifndef GCN_SDLPIXEL_HPP #define GCN_SDLPIXEL_HPP -#include "SDL2/SDL.h" +#include "SDL.h" #include "guisan/color.hpp" namespace gcn diff --git a/src/guisan/include/guisan/sdl/sdltruetypefont.hpp b/src/guisan/include/guisan/sdl/sdltruetypefont.hpp index c2061028..d92349ea 100644 --- a/src/guisan/include/guisan/sdl/sdltruetypefont.hpp +++ b/src/guisan/include/guisan/sdl/sdltruetypefont.hpp @@ -47,7 +47,7 @@ #include #include -#include +#include #include "guisan/font.hpp" #include "guisan/platform.hpp" diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp index 02b91292..f05706e4 100644 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -2029,7 +2029,7 @@ void JOYTEST (uae_u16 v) mouse_frame_y[1] = mouse_y[1]; } -#if !defined(INPUTDEVICE_SIMPLE) || defined(RASPBERRY) +#if !defined(INPUTDEVICE_SIMPLE) || defined(AMIBERRY) static uae_u8 parconvert (uae_u8 v, int jd, int shift) { if (jd & DIR_UP) @@ -5557,10 +5557,8 @@ void inputdevice_copyconfig (struct uae_prefs *src, struct uae_prefs *dst) dst->input_joymouse_speed = src->input_joymouse_speed; dst->input_mouse_speed = src->input_mouse_speed; dst->input_autofire_linecnt = src->input_autofire_linecnt; - dst->key_for_menu = src->key_for_menu; - dst->key_for_quit = src->key_for_quit; - //dst->button_for_menu = src->button_for_menu; - //dst->button_for_quit = src->button_for_quit; + strcpy(dst->open_gui,src->open_gui); + strcpy(dst->quit_amiberry,src->quit_amiberry); dst->amiberry_use_retroarch_quit = src->amiberry_use_retroarch_quit; dst->amiberry_use_retroarch_menu = src->amiberry_use_retroarch_menu; dst->amiberry_use_retroarch_reset = src->amiberry_use_retroarch_reset; diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp index bca12dbb..7c800905 100644 --- a/src/osdep/amiberry_input.cpp +++ b/src/osdep/amiberry_input.cpp @@ -184,11 +184,11 @@ const int RemapKeyMapList[] = { SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12, SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_PAGEUP, SDLK_PAGEDOWN, - SDLK_KP0, SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4, - SDLK_KP5, SDLK_KP6, SDLK_KP7, SDLK_KP8, SDLK_KP9, - SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCK, SDLK_BACKSPACE, + SDLK_KP_0, SDLK_KP_1, SDLK_KP_2, SDLK_KP_3, SDLK_KP_4, + SDLK_KP_5, SDLK_KP_6, SDLK_KP_7, SDLK_KP_8, SDLK_KP_9, + SDLK_PERIOD, SDLK_CAPSLOCK, SDLK_NUMLOCKCLEAR, SDLK_BACKSPACE, // divide - SDLK_ASTERISK, -1, SDLK_PRINT, SDLK_SCROLLOCK, + SDLK_ASTERISK, -1, SDLK_PRINTSCREEN, SDLK_SCROLLLOCK, // tilde -1, SDLK_BACKQUOTE,SDLK_PAUSE, SDLK_QUOTE, SDLK_COMMA, SDLK_MINUS, SDLK_SLASH, SDLK_SEMICOLON,SDLK_EQUALS, SDLK_LEFTPAREN, @@ -687,8 +687,8 @@ static int init_joystick(void) if (Joysticktable[cpt] != nullptr) { - if (SDL_JoystickName(cpt) != nullptr) - strncpy(JoystickName[cpt], SDL_JoystickName(cpt), sizeof JoystickName[cpt] - 1); + if (SDL_JoystickNameForIndex(cpt) != nullptr) + strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), sizeof JoystickName[cpt] - 1); else sprintf(JoystickName[cpt], "Joystick%d", cpt); @@ -923,7 +923,7 @@ static void read_joystick(void) int hostkeyid = currprefs.jports[joyid].id - JSEM_JOYS; - Uint8* keystate = SDL_GetKeyState(nullptr); + const Uint8* keystate = SDL_GetKeyboardState(nullptr); // cd32 red, blue, green, yellow setjoybuttonstate(0, 0, keystate[host_keyboard_buttons[hostkeyid].south_button]); // b diff --git a/src/osdep/gui/InGameMessage.cpp b/src/osdep/gui/InGameMessage.cpp index f03434d7..c9e05a31 100644 --- a/src/osdep/gui/InGameMessage.cpp +++ b/src/osdep/gui/InGameMessage.cpp @@ -94,7 +94,7 @@ void checkInput() break; } } - else if (event.type == SDL_JOYBUTTONDOWN) + else if (msg_event.type == SDL_JOYBUTTONDOWN) { if (SDL_JoystickGetButton(GUIjoy,host_input_buttons[0].east_button) || @@ -111,7 +111,7 @@ void checkInput() #ifdef ANDROIDSDL androidsdl_event(event, msg_input); #else - msg_input->pushInput(event); + msg_input->pushInput(msg_event); #endif } } diff --git a/src/osdep/gui/Navigation.cpp b/src/osdep/gui/Navigation.cpp index 59e3fffc..bc008947 100644 --- a/src/osdep/gui/Navigation.cpp +++ b/src/osdep/gui/Navigation.cpp @@ -222,7 +222,7 @@ static NavigationMap navMap[] = // active move left move right move up move down // PanelInput -#ifdef RASPBERRY +#ifdef AMIBERRY { "cboPort0", "Input", "cboPort0mode", "cboAutofire", "cboPort1" }, { "cboPort0mode", "cboPort0", "Input", "cboTapDelay", "cboPort1mode" }, { "cboPort1", "Input", "cboPort1mode", "cboPort0", "cboPort2" }, @@ -465,7 +465,7 @@ bool HandleNavigation(int direction) return focusTarget != nullptr; } -void PushFakeKey(SDLKey inKey) +void PushFakeKey(SDL_Keycode inKey) { SDL_Event nuevent; nuevent.type = SDL_KEYDOWN; // and the key up diff --git a/src/osdep/gui/PanelCustom.cpp b/src/osdep/gui/PanelCustom.cpp index ca8deee7..09548092 100644 --- a/src/osdep/gui/PanelCustom.cpp +++ b/src/osdep/gui/PanelCustom.cpp @@ -1,7 +1,7 @@ -#include +#include #include -#include -#include "sdltruetypefont.hpp" +#include +#include #include "SelectorEntry.hpp" #include "UaeRadioButton.hpp" #include "UaeDropDown.hpp" @@ -38,7 +38,7 @@ static gcn::Label* lblCustomAction[14]; static gcn::UaeDropDown* cboCustomAction[14]; static gcn::Label* lblPortInput; -static gcn::TextField *txtPortInput; +static gcn::TextField* txtPortInput; static gcn::Label* lblRetroarch; static int SelectedPort = 1; @@ -518,7 +518,7 @@ void RefreshPanelCustom(void) if (changed_prefs.jports[SelectedPort].id > JSEM_JOYS && changed_prefs.jports[SelectedPort].id < JSEM_MICE - 1) { hostjoyid = changed_prefs.jports[SelectedPort].id - JSEM_JOYS - 1; - strncpy(tmp, SDL_JoystickName(hostjoyid), 255); + strncpy(tmp, SDL_JoystickNameForIndex(hostjoyid), 255); for (int n=0 ; n < 14 ; ++n) { diff --git a/src/osdep/gui/PanelInput.cpp b/src/osdep/gui/PanelInput.cpp index 7be8b0f0..95bf8567 100644 --- a/src/osdep/gui/PanelInput.cpp +++ b/src/osdep/gui/PanelInput.cpp @@ -343,7 +343,7 @@ public: RefreshPanelInput(); } -#ifdef RASPBERRY +#ifdef AMIBERRY // mousemap drop-down change else if (actionEvent.getSource() == cboPort0mousemode) { @@ -374,7 +374,7 @@ public: changed_prefs.input_joymouse_multiplier = mousespeed_values[int(sldMouseSpeed->getValue())]; RefreshPanelInput(); } - +#ifdef PANDORA else if (actionEvent.getSource() == cboTapDelay) { if(cboTapDelay->getSelected() == 0) @@ -384,7 +384,7 @@ public: else changed_prefs.pandora_tapDelay = 2; } - +#endif else if (actionEvent.getSource() == chkMouseHack) { #ifdef ANDROIDSDL @@ -919,7 +919,7 @@ void RefreshPanelInput() // Set current device in port 0 int idx = 0; - for (i = 0; i < ctrlPortList.getNumberOfElements(); ++i) + for (int i = 0; i < ctrlPortList.getNumberOfElements(); ++i) { if (changed_prefs.jports[0].id == portListIDs[i]) { @@ -931,7 +931,7 @@ void RefreshPanelInput() // Set current device in port 1 idx = 0; - for (i = 0; i < ctrlPortList.getNumberOfElements(); ++i) + for (int i = 0; i < ctrlPortList.getNumberOfElements(); ++i) { if (changed_prefs.jports[1].id == portListIDs[i]) { @@ -946,7 +946,7 @@ void RefreshPanelInput() // Set current device in port 2 idx = 0; - for (i = 0; i < ctrlPortList.getNumberOfElements(); ++i) + for (int i = 0; i < ctrlPortList.getNumberOfElements(); ++i) { if (changed_prefs.jports[2].id == portListIDs[i]) { @@ -958,7 +958,7 @@ void RefreshPanelInput() // Set current device in port 3 idx = 0; - for (i = 0; i < ctrlPortList.getNumberOfElements(); ++i) + for (int i = 0; i < ctrlPortList.getNumberOfElements(); ++i) { if (changed_prefs.jports[3].id == portListIDs[i]) { @@ -1033,14 +1033,14 @@ void RefreshPanelInput() break; } } - +#ifdef PANDORA if (changed_prefs.pandora_tapDelay == 10) cboTapDelay->setSelected(0); else if (changed_prefs.pandora_tapDelay == 5) cboTapDelay->setSelected(1); else cboTapDelay->setSelected(2); - +#endif chkMouseHack->setSelected(changed_prefs.input_tablet == TABLET_MOUSEHACK); chkCustomCtrl->setSelected(changed_prefs.customControls); diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h index 029cecbc..0660c3f0 100644 --- a/src/osdep/gui/gui_handling.h +++ b/src/osdep/gui/gui_handling.h @@ -173,7 +173,7 @@ enum }; bool HandleNavigation(int direction); -void PushFakeKey(SDLKey inKey); +void PushFakeKey(SDL_Keycode inKey); #define MAX_HD_DEVICES 5 extern void CreateDefaultDevicename(char* name); diff --git a/src/osdep/keyboard.cpp b/src/osdep/keyboard.cpp index 2ed94390..15a9fa10 100644 --- a/src/osdep/keyboard.cpp +++ b/src/osdep/keyboard.cpp @@ -125,7 +125,6 @@ static struct uae_input_device_kbr_default keytrans_amiga[] = { { SDLK_COMMA, INPUTEVENT_KEY_COMMA }, { SDLK_PERIOD, INPUTEVENT_KEY_PERIOD }, { SDLK_SLASH, INPUTEVENT_KEY_DIV }, - { SDLK_SYSREQ, INPUTEVENT_SPC_SCREENSHOT_CLIPBOARD }, {SDLK_END, INPUTEVENT_SPC_QUALIFIER_SPECIAL }, {SDLK_PAUSE, INPUTEVENT_SPC_PAUSE }, diff --git a/src/threaddep/thread.h b/src/threaddep/thread.h index 05246bbf..2b7b33a9 100644 --- a/src/threaddep/thread.h +++ b/src/threaddep/thread.h @@ -39,20 +39,20 @@ STATIC_INLINE void uae_end_thread (uae_thread_id *tid) { } -STATIC_INLINE int uae_start_thread (const TCHAR *name, void *(*f) (void *), void *arg, uae_thread_id *foo) +STATIC_INLINE uae_thread_id uae_start_thread(const TCHAR* name, void*(*f)(void*), void* arg, uae_thread_id* foo) { uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThread", arg); if(foo != NULL) *foo = id; - return (int)id; + return id; } -STATIC_INLINE int uae_start_thread_fast (void *(*f) (void *), void *arg, uae_thread_id *foo) +STATIC_INLINE uae_thread_id uae_start_thread_fast(void*(*f)(void*), void* arg, uae_thread_id* foo) { uae_thread_id id = SDL_CreateThread ((int (*)(void *))f, "StartThreadFast", arg); if(foo != NULL) *foo = id; - return (int)id; + return id; } STATIC_INLINE void uae_wait_thread (uae_thread_id thread)