2 * (C) GraÅžvydas "notaz" Ignotas, 2011,2012
4 * This work is licensed under the terms of any of these licenses
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
13 #include "common/input.h"
14 #include "common/in_sdl.h"
15 #include "common/menu.h"
16 #include "plugin_lib.h"
21 static const struct in_default_bind in_sdl_defbinds[] = {
22 { SDLK_UP, IN_BINDTYPE_PLAYER12, DKEY_UP },
23 { SDLK_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN },
24 { SDLK_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT },
25 { SDLK_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
26 { SDLK_d, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
27 { SDLK_z, IN_BINDTYPE_PLAYER12, DKEY_CROSS },
28 { SDLK_x, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
29 { SDLK_s, IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
30 { SDLK_v, IN_BINDTYPE_PLAYER12, DKEY_START },
31 { SDLK_c, IN_BINDTYPE_PLAYER12, DKEY_SELECT },
32 { SDLK_w, IN_BINDTYPE_PLAYER12, DKEY_L1 },
33 { SDLK_r, IN_BINDTYPE_PLAYER12, DKEY_R1 },
34 { SDLK_e, IN_BINDTYPE_PLAYER12, DKEY_L2 },
35 { SDLK_t, IN_BINDTYPE_PLAYER12, DKEY_R2 },
36 { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
40 static SDL_Surface *screen;
42 static int change_video_mode(int w, int h)
44 screen = SDL_SetVideoMode(w, h, 16, 0);
46 fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
57 ret = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
59 fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
65 ret = change_video_mode(g_menuscreen_w, g_menuscreen_h);
67 ret = change_video_mode(0, 0);
71 if (screen->w < 320 || screen->h < 240) {
72 fprintf(stderr, "resolution %dx%d is too small, sorry.\n",
73 screen->w, screen->h);
76 g_menuscreen_w = screen->w;
77 g_menuscreen_h = screen->h;
79 SDL_WM_SetCaption("PCSX-ReARMed " REV, NULL);
81 in_sdl_init(in_sdl_defbinds);
90 void plat_finish(void)
95 void plat_gvideo_open(void)
99 void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
101 change_video_mode(*w, *h);
102 return screen->pixels;
105 void *plat_gvideo_flip(void)
108 return screen->pixels;
111 void plat_gvideo_close(void)
115 void plat_video_menu_enter(int is_rom_loaded)
117 change_video_mode(g_menuscreen_w, g_menuscreen_h);
120 void plat_video_menu_begin(void)
122 SDL_LockSurface(screen);
123 g_menuscreen_ptr = screen->pixels;
126 void plat_video_menu_end(void)
128 SDL_UnlockSurface(screen);
130 g_menuscreen_ptr = NULL;
133 void plat_video_menu_leave(void)
138 void *plat_prepare_screenshot(int *w, int *h, int *bpp)
143 int plat_cpu_clock_get(void)
148 int plat_cpu_clock_apply(int cpu_clock)
153 int plat_get_bat_capacity(void)
158 void plat_step_volume(int is_up)
162 void plat_trigger_vibrate(int is_strong)
166 void plat_minimize(void)
170 // vim:shiftwidth=2:expandtab