Fixed SDL2 references
Fixed remaining SDL2 references, now compiles without errors
This commit is contained in:
parent
8983c0c5a3
commit
4dc41447f0
7 changed files with 136 additions and 101 deletions
|
@ -32,7 +32,7 @@
|
|||
#include "calc.h"
|
||||
#include "gfxboard.h"
|
||||
|
||||
#include "SDL_keysym.h"
|
||||
//#include "SDL_keysym.h"
|
||||
|
||||
static int config_newfilesystem;
|
||||
static struct strlist *temp_lines;
|
||||
|
|
43
src/main.cpp
43
src/main.cpp
|
@ -41,7 +41,12 @@
|
|||
#include "jit/compemu.h"
|
||||
#endif
|
||||
#ifdef USE_SDL
|
||||
#include "SDL.h"
|
||||
#include <SDL.h>
|
||||
#include <iostream>
|
||||
#include "pandora_gfx.h"
|
||||
SDL_Window* sdlWindow;
|
||||
SDL_Renderer* renderer;
|
||||
SDL_Texture *texture;
|
||||
#endif
|
||||
|
||||
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
|
||||
|
@ -620,21 +625,47 @@ void virtualdevice_init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
// In case of error, print the error code and close the application
|
||||
void check_error_sdl(bool check, const char* message) {
|
||||
if (check) {
|
||||
std::cout << message << " " << SDL_GetError() << std::endl;
|
||||
SDL_Quit();
|
||||
std::exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
static int real_main2 (int argc, TCHAR **argv)
|
||||
{
|
||||
printf("Uae4arm v0.5 for Raspberry Pi by Dimitris (MiDWaN) Panokostas\n");
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO);
|
||||
#else
|
||||
#ifdef USE_SDL
|
||||
if (SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
||||
abort();
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sdlWindow = SDL_CreateWindow("Amiberry v2",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
0,
|
||||
0,
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
check_error_sdl(sdlWindow == nullptr, "Unable to create window");
|
||||
|
||||
renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
check_error_sdl(renderer == nullptr, "Unable to create a renderer");
|
||||
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother.
|
||||
SDL_RenderSetLogicalSize(renderer, 800, 480);
|
||||
|
||||
texture = SDL_CreateTexture(renderer,
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING,
|
||||
800,
|
||||
480);
|
||||
check_error_sdl(texture == nullptr, "Unable to create texture");
|
||||
|
||||
keyboard_settrans();
|
||||
|
||||
if (restart_config[0]) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <guisan.hpp>
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
#include <guisan/sdl.hpp>
|
||||
#include "guisan/sdl/sdltruetypefont.hpp"
|
||||
|
|
|
@ -355,33 +355,33 @@ static int *kbmaps[] = { kb_none, kb_none, kb_none, kb_none, kb_none,
|
|||
|
||||
void keyboard_settrans (void)
|
||||
{
|
||||
char vid_drv_name[32];
|
||||
// get display type...
|
||||
SDL_VideoDriverName(vid_drv_name, sizeof(vid_drv_name));
|
||||
if (strcmp(vid_drv_name, "x11") == 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Will use keycode from x11 mapping.\n");
|
||||
#endif
|
||||
keyboard_type = KEYCODE_X11;
|
||||
inputdevice_setkeytranslation (keytrans_x11, kbmaps);
|
||||
}
|
||||
else if (strcmp(vid_drv_name, "fbcon") == 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Will use keycode from fbcon mapping.\n");
|
||||
#endif
|
||||
keyboard_type = KEYCODE_FBCON;
|
||||
inputdevice_setkeytranslation (keytrans_fbcon, kbmaps);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Unknown keycode to use, will use keysym\n");
|
||||
#endif
|
||||
// char vid_drv_name[32];
|
||||
// // get display type...
|
||||
// SDL_VideoDriverName(vid_drv_name, sizeof(vid_drv_name));
|
||||
// if (strcmp(vid_drv_name, "x11") == 0)
|
||||
// {
|
||||
//#ifdef DEBUG
|
||||
// printf("Will use keycode from x11 mapping.\n");
|
||||
//#endif
|
||||
// keyboard_type = KEYCODE_X11;
|
||||
// inputdevice_setkeytranslation (keytrans_x11, kbmaps);
|
||||
// }
|
||||
// else if (strcmp(vid_drv_name, "fbcon") == 0)
|
||||
// {
|
||||
//#ifdef DEBUG
|
||||
// printf("Will use keycode from fbcon mapping.\n");
|
||||
//#endif
|
||||
// keyboard_type = KEYCODE_FBCON;
|
||||
// inputdevice_setkeytranslation (keytrans_fbcon, kbmaps);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//#ifdef DEBUG
|
||||
// printf("Unknown keycode to use, will use keysym\n");
|
||||
//#endif
|
||||
keyboard_type = KEYCODE_UNK;
|
||||
inputdevice_setkeytranslation (keytrans, kbmaps);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
int translate_pandora_keys(int symbol, int *modifier)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "disk.h"
|
||||
#include "SDL.h"
|
||||
|
||||
extern int customControlMap[SDLK_LAST];
|
||||
//extern int customControlMap[SDLK_LAST];
|
||||
|
||||
static int kickstart;
|
||||
|
||||
|
@ -486,16 +486,16 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
|
|||
fscanf(f, "cutRight=%d\n", &dummy);
|
||||
fscanf(f, "customControls=%d\n", &p->pandora_customControls);
|
||||
fscanf(f, "custom_dpad=%d\n", &dummy);
|
||||
fscanf(f, "custom_up=%d\n", &customControlMap[VK_UP]);
|
||||
fscanf(f, "custom_down=%d\n", &customControlMap[VK_DOWN]);
|
||||
fscanf(f, "custom_left=%d\n", &customControlMap[VK_LEFT]);
|
||||
fscanf(f, "custom_right=%d\n", &customControlMap[VK_RIGHT]);
|
||||
fscanf(f, "custom_A=%d\n", &customControlMap[VK_A]);
|
||||
fscanf(f, "custom_B=%d\n", &customControlMap[VK_B]);
|
||||
fscanf(f, "custom_X=%d\n", &customControlMap[VK_X]);
|
||||
fscanf(f, "custom_Y=%d\n", &customControlMap[VK_Y]);
|
||||
fscanf(f, "custom_L=%d\n", &customControlMap[VK_L]);
|
||||
fscanf(f, "custom_R=%d\n", &customControlMap[VK_R]);
|
||||
// fscanf(f, "custom_up=%d\n", &customControlMap[VK_UP]);
|
||||
// fscanf(f, "custom_down=%d\n", &customControlMap[VK_DOWN]);
|
||||
// fscanf(f, "custom_left=%d\n", &customControlMap[VK_LEFT]);
|
||||
// fscanf(f, "custom_right=%d\n", &customControlMap[VK_RIGHT]);
|
||||
// fscanf(f, "custom_A=%d\n", &customControlMap[VK_A]);
|
||||
// fscanf(f, "custom_B=%d\n", &customControlMap[VK_B]);
|
||||
// fscanf(f, "custom_X=%d\n", &customControlMap[VK_X]);
|
||||
// fscanf(f, "custom_Y=%d\n", &customControlMap[VK_Y]);
|
||||
// fscanf(f, "custom_L=%d\n", &customControlMap[VK_L]);
|
||||
// fscanf(f, "custom_R=%d\n", &customControlMap[VK_R]);
|
||||
fscanf(f, "cpu=%d\n", &cpu_level);
|
||||
if (cpu_level > 0) // M68000
|
||||
// Was old format
|
||||
|
|
|
@ -54,7 +54,7 @@ extern int loadconfig_old(struct uae_prefs *p, const char *orgpath);
|
|||
extern void SetLastActiveConfig(const char *filename);
|
||||
|
||||
/* Keyboard */
|
||||
int customControlMap[SDLK_LAST];
|
||||
//int customControlMap[SDLK_LAST];
|
||||
|
||||
char start_path_data[MAX_DPATH];
|
||||
char currentDir[MAX_DPATH];
|
||||
|
@ -263,7 +263,7 @@ void target_default_options (struct uae_prefs *p, int type)
|
|||
|
||||
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8;
|
||||
|
||||
memset(customControlMap, 0, sizeof(customControlMap));
|
||||
// memset(customControlMap, 0, sizeof(customControlMap));
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,16 +273,16 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
|
|||
cfgfile_write (f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led);
|
||||
cfgfile_write (f, "pandora.tap_delay", "%d", p->pandora_tapDelay);
|
||||
cfgfile_write (f, "pandora.custom_controls", "%d", p->pandora_customControls);
|
||||
cfgfile_write (f, "pandora.custom_up", "%d", customControlMap[VK_UP]);
|
||||
cfgfile_write (f, "pandora.custom_down", "%d", customControlMap[VK_DOWN]);
|
||||
cfgfile_write (f, "pandora.custom_left", "%d", customControlMap[VK_LEFT]);
|
||||
cfgfile_write (f, "pandora.custom_right", "%d", customControlMap[VK_RIGHT]);
|
||||
cfgfile_write (f, "pandora.custom_a", "%d", customControlMap[VK_A]);
|
||||
cfgfile_write (f, "pandora.custom_b", "%d", customControlMap[VK_B]);
|
||||
cfgfile_write (f, "pandora.custom_x", "%d", customControlMap[VK_X]);
|
||||
cfgfile_write (f, "pandora.custom_y", "%d", customControlMap[VK_Y]);
|
||||
cfgfile_write (f, "pandora.custom_l", "%d", customControlMap[VK_L]);
|
||||
cfgfile_write (f, "pandora.custom_r", "%d", customControlMap[VK_R]);
|
||||
// cfgfile_write (f, "pandora.custom_up", "%d", customControlMap[VK_UP]);
|
||||
// cfgfile_write (f, "pandora.custom_down", "%d", customControlMap[VK_DOWN]);
|
||||
// cfgfile_write (f, "pandora.custom_left", "%d", customControlMap[VK_LEFT]);
|
||||
// cfgfile_write (f, "pandora.custom_right", "%d", customControlMap[VK_RIGHT]);
|
||||
// cfgfile_write (f, "pandora.custom_a", "%d", customControlMap[VK_A]);
|
||||
// cfgfile_write (f, "pandora.custom_b", "%d", customControlMap[VK_B]);
|
||||
// cfgfile_write (f, "pandora.custom_x", "%d", customControlMap[VK_X]);
|
||||
// cfgfile_write (f, "pandora.custom_y", "%d", customControlMap[VK_Y]);
|
||||
// cfgfile_write (f, "pandora.custom_l", "%d", customControlMap[VK_L]);
|
||||
// cfgfile_write (f, "pandora.custom_r", "%d", customControlMap[VK_R]);
|
||||
cfgfile_write (f, "pandora.move_x", "%d", p->pandora_horizontal_offset);
|
||||
cfgfile_write (f, "pandora.move_y", "%d", p->pandora_vertical_offset);
|
||||
}
|
||||
|
@ -304,16 +304,16 @@ int target_parse_option (struct uae_prefs *p, const char *option, const char *va
|
|||
|| cfgfile_intval (option, value, "hide_idle_led", &p->pandora_hide_idle_led, 1)
|
||||
|| cfgfile_intval (option, value, "tap_delay", &p->pandora_tapDelay, 1)
|
||||
|| cfgfile_intval (option, value, "custom_controls", &p->pandora_customControls, 1)
|
||||
|| cfgfile_intval (option, value, "custom_up", &customControlMap[VK_UP], 1)
|
||||
|| cfgfile_intval (option, value, "custom_down", &customControlMap[VK_DOWN], 1)
|
||||
|| cfgfile_intval (option, value, "custom_left", &customControlMap[VK_LEFT], 1)
|
||||
|| cfgfile_intval (option, value, "custom_right", &customControlMap[VK_RIGHT], 1)
|
||||
|| cfgfile_intval (option, value, "custom_a", &customControlMap[VK_A], 1)
|
||||
|| cfgfile_intval (option, value, "custom_b", &customControlMap[VK_B], 1)
|
||||
|| cfgfile_intval (option, value, "custom_x", &customControlMap[VK_X], 1)
|
||||
|| cfgfile_intval (option, value, "custom_y", &customControlMap[VK_Y], 1)
|
||||
|| cfgfile_intval (option, value, "custom_l", &customControlMap[VK_L], 1)
|
||||
|| cfgfile_intval (option, value, "custom_r", &customControlMap[VK_R], 1)
|
||||
// || cfgfile_intval (option, value, "custom_up", &customControlMap[VK_UP], 1)
|
||||
// || cfgfile_intval (option, value, "custom_down", &customControlMap[VK_DOWN], 1)
|
||||
// || cfgfile_intval (option, value, "custom_left", &customControlMap[VK_LEFT], 1)
|
||||
// || cfgfile_intval (option, value, "custom_right", &customControlMap[VK_RIGHT], 1)
|
||||
// || cfgfile_intval (option, value, "custom_a", &customControlMap[VK_A], 1)
|
||||
// || cfgfile_intval (option, value, "custom_b", &customControlMap[VK_B], 1)
|
||||
// || cfgfile_intval (option, value, "custom_x", &customControlMap[VK_X], 1)
|
||||
// || cfgfile_intval (option, value, "custom_y", &customControlMap[VK_Y], 1)
|
||||
// || cfgfile_intval (option, value, "custom_l", &customControlMap[VK_L], 1)
|
||||
// || cfgfile_intval (option, value, "custom_r", &customControlMap[VK_R], 1)
|
||||
|| cfgfile_intval (option, value, "move_x", &p->pandora_horizontal_offset, 1)
|
||||
|| cfgfile_intval (option, value, "move_y", &p->pandora_vertical_offset, 1)
|
||||
);
|
||||
|
@ -925,23 +925,23 @@ int handle_msgpump (void)
|
|||
// Fall through...
|
||||
|
||||
default:
|
||||
if(currprefs.pandora_customControls)
|
||||
{
|
||||
keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
if(keycode < 0)
|
||||
{
|
||||
// Simulate mouse or joystick
|
||||
SimulateMouseOrJoy(keycode, 1);
|
||||
break;
|
||||
}
|
||||
else if(keycode > 0)
|
||||
{
|
||||
// Send mapped key press
|
||||
inputdevice_do_keyboard(keycode, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
// if(currprefs.pandora_customControls)
|
||||
// {
|
||||
// keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
// if(keycode < 0)
|
||||
// {
|
||||
// // Simulate mouse or joystick
|
||||
// SimulateMouseOrJoy(keycode, 1);
|
||||
// break;
|
||||
// }
|
||||
// else if(keycode > 0)
|
||||
// {
|
||||
// // Send mapped key press
|
||||
// inputdevice_do_keyboard(keycode, 1);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
|
||||
modifier = rEvent.key.keysym.mod;
|
||||
keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier);
|
||||
|
@ -1004,22 +1004,22 @@ int handle_msgpump (void)
|
|||
// Fall through...
|
||||
|
||||
default:
|
||||
if(currprefs.pandora_customControls)
|
||||
{
|
||||
keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
if(keycode < 0)
|
||||
{
|
||||
// Simulate mouse or joystick
|
||||
SimulateMouseOrJoy(keycode, 0);
|
||||
break;
|
||||
}
|
||||
else if(keycode > 0)
|
||||
{
|
||||
// Send mapped key release
|
||||
inputdevice_do_keyboard(keycode, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if(currprefs.pandora_customControls)
|
||||
// {
|
||||
// keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
// if(keycode < 0)
|
||||
// {
|
||||
// // Simulate mouse or joystick
|
||||
// SimulateMouseOrJoy(keycode, 0);
|
||||
// break;
|
||||
// }
|
||||
// else if(keycode > 0)
|
||||
// {
|
||||
// // Send mapped key release
|
||||
// inputdevice_do_keyboard(keycode, 0);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
modifier = rEvent.key.keysym.mod;
|
||||
keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier);
|
||||
|
|
|
@ -109,7 +109,8 @@ static void read_mouse (void)
|
|||
|
||||
if(currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1) {
|
||||
// dPad is mouse
|
||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
// Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
||||
int mouseScale = currprefs.input_joymouse_multiplier / 4;
|
||||
|
||||
if(keystate[VK_LEFT])
|
||||
|
@ -281,7 +282,8 @@ static int init_joystick (void)
|
|||
for (int cpt; cpt < nr_joysticks; cpt++)
|
||||
{
|
||||
Joysticktable[cpt] = SDL_JoystickOpen (cpt);
|
||||
strncpy(JoystickName[cpt],SDL_JoystickName(cpt),80);
|
||||
// strncpy(JoystickName[cpt],SDL_JoystickName(cpt),80);
|
||||
strncpy(JoystickName[cpt], SDL_JoystickNameForIndex(cpt), 80);
|
||||
printf("Joystick %i : %s\n",cpt,JoystickName[cpt]);
|
||||
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(Joysticktable[cpt]),SDL_JoystickNumAxes(Joysticktable[cpt]),SDL_JoystickNumHats(Joysticktable[cpt]));
|
||||
|
||||
|
@ -420,7 +422,8 @@ static void read_joystick (void)
|
|||
// First handle fake joystick from pandora...
|
||||
if(currprefs.jports[joyid].id == JSEM_JOYS)
|
||||
{
|
||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
// Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
|
||||
|
||||
if(!keystate[VK_R])
|
||||
{ // Right shoulder + dPad -> cursor keys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue