use picofe menu, move generic code out of gp2x/
[fceu.git] / drivers / sdl / sdl.c
CommitLineData
4a2a617a 1#include <SDL.h>
2#include "../common/platform.h"
3#include "../common/args.h"
4#include "../common/settings.h"
5#include "../common/input.h"
6#include "../libpicofe/menu.h"
7#include "../libpicofe/input.h"
8#include "../libpicofe/in_sdl.h"
9
10static const struct in_default_bind in_sdl_defbinds[] = {
11 { SDLK_UP, IN_BINDTYPE_PLAYER12, NKEYB_UP },
12 { SDLK_DOWN, IN_BINDTYPE_PLAYER12, NKEYB_DOWN },
13 { SDLK_LEFT, IN_BINDTYPE_PLAYER12, NKEYB_LEFT },
14 { SDLK_RIGHT, IN_BINDTYPE_PLAYER12, NKEYB_RIGHT },
15 { SDLK_z, IN_BINDTYPE_PLAYER12, NKEYB_B },
16 { SDLK_x, IN_BINDTYPE_PLAYER12, NKEYB_A },
17 { SDLK_a, IN_BINDTYPE_PLAYER12, NKEYB_B_TURBO },
18 { SDLK_s, IN_BINDTYPE_PLAYER12, NKEYB_A_TURBO },
19 { SDLK_ESCAPE, IN_BINDTYPE_EMU, EACTB_ENTER_MENU },
20 { 0, 0, 0 }
21};
22
23SDL_Surface *screen;
24
25void platform_init(void)
26{
27 memset(&Settings, 0, sizeof(Settings));
28 Settings.frameskip = -1; // auto
29 Settings.sound_rate = 44100;
30 Settings.turbo_rate_add = (8*2 << 24) / 60 + 1; // 8Hz turbofire
31 Settings.gamma = 100;
32 Settings.sstate_confirm = 1;
33
34 g_menuscreen_w = 320;
35 g_menuscreen_h = 240;
36
37 // tmp
38 {
39 extern void gp2x_init();
40 gp2x_init();
41 }
42}
43
44void platform_late_init(void)
45{
46 in_sdl_init(in_sdl_defbinds);
47}
48
49void platform_apply_config(void)
50{
51}
52
53void platform_set_volume(int val)
54{
55}
56
57void platform_finish(void)
58{
59}
60
61void plat_video_menu_enter(int is_rom_loaded)
62{
63 screen = SDL_SetVideoMode(320, 240, 16, 0);
64}
65
66void plat_video_menu_begin(void)
67{
68 g_menuscreen_ptr = screen->pixels;
69}
70
71void plat_video_menu_end(void)
72{
73 SDL_Flip(screen);
74}
75
76void plat_video_menu_leave(void)
77{
78}
79
80char *DriverUsage="";
81
82ARGPSTRUCT DriverArgs[]={
83 {0,0,0,0}
84};
85
86void DoDriverArgs(void)
87{
88}
89
90void GetBaseDirectory(char *BaseDirectory)
91{
92 strcpy(BaseDirectory, "fceultra");
93}