frontend: minor tweaks
authornotaz <notasas@gmail.com>
Mon, 30 Apr 2012 22:13:15 +0000 (01:13 +0300)
committernotaz <notasas@gmail.com>
Sun, 27 May 2012 17:57:02 +0000 (20:57 +0300)
configure
frontend/common/input.c
frontend/common/input.h
frontend/menu.c
frontend/plat_omap.c
frontend/plat_pandora.c
frontend/plat_sdl.c
plugins/gpulib/test.c

index 4aed26a..4cbcc80 100755 (executable)
--- a/configure
+++ b/configure
@@ -313,4 +313,7 @@ if [ "$drc_cache_base" = "yes" ]; then
   echo "DRC_CACHE_BASE = 1" >> $config_mak
 fi
 
+# use pandora's skin (for now)
+test -e skin || ln -s frontend/pandora/skin skin
+
 # vim:shiftwidth=2:expandtab
index 2f8a867..a683464 100644 (file)
@@ -548,8 +548,10 @@ static int in_set_blocking(int is_blocking)
 
 int in_set_config(int dev_id, int what, const void *val, int size)
 {
+       const char * const *names;
        const int *ival = val;
        in_dev_t *dev;
+       int count;
 
        if (what == IN_CFG_BLOCKING)
                return in_set_blocking(*ival);
@@ -558,9 +560,10 @@ int in_set_config(int dev_id, int what, const void *val, int size)
        if (dev == NULL)
                return -1;
 
-       if (what == IN_CFG_KEY_NAMES) {
-               const char * const *names = val;
-               int count = size / sizeof(names[0]);
+       switch (what) {
+       case IN_CFG_KEY_NAMES:
+               names = val;
+               count = size / sizeof(names[0]);
 
                if (count < dev->key_count) {
                        lprintf("input: set_key_names: not enough keys\n");
@@ -569,6 +572,12 @@ int in_set_config(int dev_id, int what, const void *val, int size)
 
                dev->key_names = names;
                return 0;
+       case IN_CFG_DEFAULT_DEV:
+               /* just set last used dev, for now */
+               menu_last_used_dev = dev_id;
+               return 0;
+       default:
+               break;
        }
 
        if (dev->probed)
index 1f90425..da6349b 100644 (file)
@@ -61,6 +61,7 @@ enum {
        IN_CFG_KEY_NAMES,
        IN_CFG_ABS_DEAD_ZONE,   /* dead zone for analog-digital mapping */
        IN_CFG_ABS_AXIS_COUNT,  /* number of abs axes (ro) */
+       IN_CFG_DEFAULT_DEV,
 };
 
 enum {
index 57156d5..65f7b98 100644 (file)
@@ -1698,11 +1698,14 @@ static void menu_bios_warn(void)
                "The file is usually named SCPH1001.BIN,\n"
                "but other not compressed files can be\n"
                "used too.\n\n"
-               "Press (B) or (X) to continue";
+               "Press %s or %s to continue";
+       char tmp_msg[sizeof(msg) + 64];
 
+       snprintf(tmp_msg, sizeof(tmp_msg), msg,
+               in_get_key_name(-1, -PBTN_MOK), in_get_key_name(-1, -PBTN_MBACK));
        while (1)
        {
-               draw_menu_message(msg, NULL);
+               draw_menu_message(tmp_msg, NULL);
 
                inp = in_menu_wait(PBTN_MOK|PBTN_MBACK, 70);
                if (inp & (PBTN_MBACK|PBTN_MOK))
index 1a725ff..d3ba5c9 100644 (file)
@@ -221,12 +221,9 @@ void plat_init(void)
 
        return;
 
-fail1:
-       vout_fbdev_finish(layer_fb);
 fail0:
        vout_fbdev_finish(main_fb);
        exit(1);
-
 }
 
 void plat_finish(void)
index 2522b0b..20abd68 100644 (file)
@@ -17,6 +17,7 @@
 #include <errno.h>
 
 #include "common/input.h"
+#include "linux/in_evdev.h"
 #include "plugin_lib.h"
 #include "plat.h"
 #include "main.h"
@@ -66,10 +67,14 @@ static const struct in_default_bind in_evdev_defbinds[] = {
 
 int plat_pandora_init(void)
 {
+       int gpiokeys_id;
+
        in_evdev_init(in_evdev_defbinds);
        in_probe();
-       in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES,
+       gpiokeys_id = in_name_to_id("evdev:gpio-keys");
+       in_set_config(gpiokeys_id, IN_CFG_KEY_NAMES,
                      pandora_gpio_keys, sizeof(pandora_gpio_keys));
+       in_set_config(gpiokeys_id, IN_CFG_DEFAULT_DEV, NULL, 0);
        in_adev[0] = in_name_to_id("evdev:nub0");
        in_adev[1] = in_name_to_id("evdev:nub1");
 
index b9a27c3..9be12a5 100644 (file)
 #include "revision.h"
 
 static const struct in_default_bind in_sdl_defbinds[] = {
-       { SDLK_UP,      IN_BINDTYPE_PLAYER12, DKEY_UP },
-       { SDLK_DOWN,    IN_BINDTYPE_PLAYER12, DKEY_DOWN },
-       { SDLK_LEFT,    IN_BINDTYPE_PLAYER12, DKEY_LEFT },
-       { SDLK_RIGHT,   IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
-       { SDLK_d,       IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
-       { SDLK_z,       IN_BINDTYPE_PLAYER12, DKEY_CROSS },
-       { SDLK_x,       IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
-       { SDLK_s,       IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
-       { SDLK_v,       IN_BINDTYPE_PLAYER12, DKEY_START },
-       { SDLK_c,       IN_BINDTYPE_PLAYER12, DKEY_SELECT },
-       { SDLK_w,       IN_BINDTYPE_PLAYER12, DKEY_L1 },
-       { SDLK_r,       IN_BINDTYPE_PLAYER12, DKEY_R1 },
-       { SDLK_e,       IN_BINDTYPE_PLAYER12, DKEY_L2 },
-       { SDLK_t,       IN_BINDTYPE_PLAYER12, DKEY_R2 },
-       { SDLK_ESCAPE,  IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
-       { 0, 0, 0 }
+  { SDLK_UP,     IN_BINDTYPE_PLAYER12, DKEY_UP },
+  { SDLK_DOWN,   IN_BINDTYPE_PLAYER12, DKEY_DOWN },
+  { SDLK_LEFT,   IN_BINDTYPE_PLAYER12, DKEY_LEFT },
+  { SDLK_RIGHT,  IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
+  { SDLK_d,      IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
+  { SDLK_z,      IN_BINDTYPE_PLAYER12, DKEY_CROSS },
+  { SDLK_x,      IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
+  { SDLK_s,      IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
+  { SDLK_v,      IN_BINDTYPE_PLAYER12, DKEY_START },
+  { SDLK_c,      IN_BINDTYPE_PLAYER12, DKEY_SELECT },
+  { SDLK_w,      IN_BINDTYPE_PLAYER12, DKEY_L1 },
+  { SDLK_r,      IN_BINDTYPE_PLAYER12, DKEY_R1 },
+  { SDLK_e,      IN_BINDTYPE_PLAYER12, DKEY_L2 },
+  { SDLK_t,      IN_BINDTYPE_PLAYER12, DKEY_R2 },
+  { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
+  { 0, 0, 0 }
 };
 
 static SDL_Surface *screen;
+static void *menubg_img;
 
 static int change_video_mode(int w, int h)
 {
@@ -78,6 +79,10 @@ void plat_init(void)
   }
   SDL_WM_SetCaption("PCSX-ReARMed " REV, NULL);
 
+  menubg_img = malloc(640 * 512 * 2);
+  if (menubg_img == NULL)
+    goto fail;
+
   in_sdl_init(in_sdl_defbinds);
   in_probe();
   pl_rearmed_cbs.only_16bpp = 1;
@@ -90,6 +95,8 @@ fail:
 
 void plat_finish(void)
 {
+  free(menubg_img);
+  menubg_img = NULL;
   SDL_Quit();
 }
 
@@ -103,6 +110,7 @@ void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
   return screen->pixels;
 }
 
+/* XXX: missing SDL_LockSurface() */
 void *plat_gvideo_flip(void)
 {
   SDL_Flip(screen);
@@ -115,6 +123,10 @@ void plat_gvideo_close(void)
 
 void plat_video_menu_enter(int is_rom_loaded)
 {
+  /* surface will be lost, must adjust pl_vout_buf for menu bg */
+  memcpy(menubg_img, screen->pixels, screen->w * screen->h * 2);
+  pl_vout_buf = menubg_img;
+
   change_video_mode(g_menuscreen_w, g_menuscreen_h);
 }
 
index e523e20..80d0e9e 100644 (file)
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
 {
   unsigned int start_cycles;
   uint32_t *list;
-  int size;
+  int size, dummy;
   FILE *state_file;
   FILE *list_file;
   FILE *out_file;
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
 
   start_cycles = pcnt_get();
 
-  do_cmd_list(list, size / 4);
+  do_cmd_list(list, size / 4, &dummy);
   renderer_flush_queues();
 
   printf("%u\n", pcnt_get() - start_cycles);