mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
SDL UI, fix SDL input and SDL window output mode for osx compile
NB for osx >= 10.14 you need SDL >= rev 13688 (ATM only available from SDL repo)
This commit is contained in:
parent
b74303b1a7
commit
1f49b75032
5 changed files with 19 additions and 7 deletions
4
Makefile
4
Makefile
|
@ -206,6 +206,10 @@ include platform/common/common.mak
|
||||||
OBJS += $(OBJS_COMMON)
|
OBJS += $(OBJS_COMMON)
|
||||||
CFLAGS += $(addprefix -D,$(DEFINES))
|
CFLAGS += $(addprefix -D,$(DEFINES))
|
||||||
|
|
||||||
|
ifneq (,$(findstring sdl,$(OBJS)))
|
||||||
|
CFLAGS += -DUSE_SDL
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(findstring gcc,$(CC)),)
|
ifneq ($(findstring gcc,$(CC)),)
|
||||||
LDFLAGS += -Wl,-Map=$(TARGET).map
|
LDFLAGS += -Wl,-Map=$(TARGET).map
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef PICO_H
|
#ifndef PICO_H
|
||||||
#define PICO_H
|
#define PICO_H
|
||||||
|
|
||||||
|
#include <stdint.h> // [u]int<n>_t
|
||||||
#include <stdlib.h> // size_t
|
#include <stdlib.h> // size_t
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#ifdef USE_SDL
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../libpicofe/input.h"
|
#include "../libpicofe/input.h"
|
||||||
#include "../libpicofe/plat.h"
|
#include "../libpicofe/plat.h"
|
||||||
|
@ -83,12 +86,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
plat_target_init();
|
plat_target_init();
|
||||||
plat_init();
|
plat_init();
|
||||||
|
menu_init();
|
||||||
|
|
||||||
emu_prep_defconfig(); // depends on input
|
emu_prep_defconfig(); // depends on input
|
||||||
emu_read_config(NULL, 0);
|
emu_read_config(NULL, 0);
|
||||||
|
|
||||||
emu_init();
|
emu_init();
|
||||||
menu_init();
|
|
||||||
|
|
||||||
#ifdef GPERF
|
#ifdef GPERF
|
||||||
ProfilerStart("gperf.out");
|
ProfilerStart("gperf.out");
|
||||||
|
|
|
@ -75,15 +75,15 @@ const struct menu_keymap in_sdl_joy_map[] __attribute__((weak)) =
|
||||||
{ SDLK_WORLD_3, PBTN_MA3 },
|
{ SDLK_WORLD_3, PBTN_MA3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char * const in_sdl_key_names[] __attribute__((weak));
|
const char *const *in_sdl_key_names_p __attribute__((weak)) = NULL;
|
||||||
|
|
||||||
static const struct in_pdata in_sdl_platform_data = {
|
|
||||||
|
static struct in_pdata in_sdl_platform_data = {
|
||||||
.defbinds = in_sdl_defbinds,
|
.defbinds = in_sdl_defbinds,
|
||||||
.key_map = in_sdl_key_map,
|
.key_map = in_sdl_key_map,
|
||||||
.kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]),
|
.kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]),
|
||||||
.joy_map = in_sdl_joy_map,
|
.joy_map = in_sdl_joy_map,
|
||||||
.jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]),
|
.jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]),
|
||||||
.key_names = in_sdl_key_names,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YUV stuff */
|
/* YUV stuff */
|
||||||
|
@ -177,8 +177,10 @@ void plat_video_flip(void)
|
||||||
if (SDL_MUSTLOCK(plat_sdl_screen))
|
if (SDL_MUSTLOCK(plat_sdl_screen))
|
||||||
SDL_UnlockSurface(plat_sdl_screen);
|
SDL_UnlockSurface(plat_sdl_screen);
|
||||||
SDL_Flip(plat_sdl_screen);
|
SDL_Flip(plat_sdl_screen);
|
||||||
|
if (g_screen_ptr != shadow_fb) {
|
||||||
g_screen_ptr = plat_sdl_screen->pixels;
|
g_screen_ptr = plat_sdl_screen->pixels;
|
||||||
PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);
|
plat_video_toggle_renderer(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +246,8 @@ void plat_video_loop_prepare(void)
|
||||||
if (SDL_MUSTLOCK(plat_sdl_screen))
|
if (SDL_MUSTLOCK(plat_sdl_screen))
|
||||||
SDL_LockSurface(plat_sdl_screen);
|
SDL_LockSurface(plat_sdl_screen);
|
||||||
g_screen_ptr = plat_sdl_screen->pixels;
|
g_screen_ptr = plat_sdl_screen->pixels;
|
||||||
|
plat_video_toggle_renderer(0, 0);
|
||||||
}
|
}
|
||||||
PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void plat_early_init(void)
|
void plat_early_init(void)
|
||||||
|
@ -292,6 +294,7 @@ void plat_init(void)
|
||||||
g_screen_ppitch = 320;
|
g_screen_ppitch = 320;
|
||||||
g_screen_ptr = shadow_fb;
|
g_screen_ptr = shadow_fb;
|
||||||
|
|
||||||
|
in_sdl_platform_data.key_names = in_sdl_key_names_p;
|
||||||
in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler);
|
in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler);
|
||||||
in_probe();
|
in_probe();
|
||||||
|
|
||||||
|
|
|
@ -83,3 +83,4 @@ const char * const in_sdl_key_names[SDLK_LAST] = {
|
||||||
[SDLK_KP_PERIOD] = "R3",
|
[SDLK_KP_PERIOD] = "R3",
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
const char *const *in_sdl_key_names_p = in_sdl_key_names;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue