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);
83 pl_rearmed_cbs.only_16bpp = 1;
91 void plat_finish(void)
96 void plat_gvideo_open(void)
100 void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
102 change_video_mode(*w, *h);
103 return screen->pixels;
106 void *plat_gvideo_flip(void)
109 return screen->pixels;
112 void plat_gvideo_close(void)
116 void plat_video_menu_enter(int is_rom_loaded)
118 change_video_mode(g_menuscreen_w, g_menuscreen_h);
121 void plat_video_menu_begin(void)
123 SDL_LockSurface(screen);
124 g_menuscreen_ptr = screen->pixels;
127 void plat_video_menu_end(void)
129 SDL_UnlockSurface(screen);
131 g_menuscreen_ptr = NULL;
134 void plat_video_menu_leave(void)
139 void *plat_prepare_screenshot(int *w, int *h, int *bpp)
144 int plat_cpu_clock_get(void)
149 int plat_cpu_clock_apply(int cpu_clock)
154 int plat_get_bat_capacity(void)
159 void plat_step_volume(int is_up)
163 void plat_trigger_vibrate(int is_strong)
167 void plat_minimize(void)
171 // vim:shiftwidth=2:expandtab