Add support for the OpenDingux platform
authorPaul Cercueil <paul@crapouillou.net>
Mon, 7 Oct 2013 19:06:54 +0000 (21:06 +0200)
committernotaz <notasas@gmail.com>
Thu, 10 Oct 2013 00:02:26 +0000 (03:02 +0300)
12 files changed:
.gitignore
Makefile
configure
platform/common/plat_sdl.c
platform/libpicofe
platform/opendingux/data/default.gcw0.desktop [new file with mode: 0644]
platform/opendingux/data/megadrive.png [new file with mode: 0644]
platform/opendingux/data/skin/background.png [new file with mode: 0644]
platform/opendingux/data/skin/font.png [new file with mode: 0644]
platform/opendingux/data/skin/readme.txt [new file with mode: 0644]
platform/opendingux/data/skin/skin.txt [new file with mode: 0644]
platform/opendingux/inputmap.c [new file with mode: 0644]

index 9f71eb9..b7ef852 100644 (file)
@@ -16,3 +16,6 @@ mds/
 cfg/
 libs/
 obj/
+.opk_data
+PicoDrive
+PicoDrive.opk
index 67ba86f..0df793e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,21 @@ asm_cdpico = 0
 asm_cdmemory = 0
 endif
 
-# frontend
+ifeq "$(PLATFORM)" "opendingux"
+opk: $(TARGET).opk
+
+$(TARGET).opk: $(TARGET)
+       $(RM) -rf .opk_data
+       cp -r platform/opendingux/data .opk_data
+       cp $< .opk_data/PicoDrive
+       $(STRIP) .opk_data/PicoDrive
+       mksquashfs .opk_data $@ -all-root -noappend -no-exports -no-xattrs
+
+OBJS += platform/opendingux/inputmap.o
+
+# OpenDingux is a generic platform, really.
+PLATFORM := generic
+endif
 ifeq "$(PLATFORM)" "generic"
 OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
 OBJS += platform/common/plat_sdl.o
@@ -156,6 +170,7 @@ target_: $(TARGET)
 
 clean:
        $(RM) $(TARGET) $(OBJS)
+       $(RM) -r .opk_data
 
 $(TARGET): $(OBJS)
        $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS)
index 453d530..29b45e1 100755 (executable)
--- a/configure
+++ b/configure
@@ -31,7 +31,7 @@ check_define()
 # setting options to "yes" or "no" will make that choice default,
 # "" means "autodetect".
 
-platform_list="generic pandora gp2x"
+platform_list="generic pandora gp2x opendingux"
 platform="generic"
 sound_driver_list="oss alsa sdl"
 sound_drivers=""
@@ -51,6 +51,7 @@ optimize_arm920="no"
 CC="${CC-${CROSS_COMPILE}gcc}"
 CXX="${CXX-${CROSS_COMPILE}g++}"
 AS="${AS-${CROSS_COMPILE}as}"
+STRIP="${STRIP-${CROSS_COMPILE}strip}"
 SDL_CONFIG="`$CC --print-sysroot`/usr/bin/sdl-config"
 MAIN_LDLIBS="$LDLIBS -lm"
 config_mak="config.mak"
@@ -68,6 +69,9 @@ set_platform()
   case "$platform" in
   generic)
     ;;
+  opendingux)
+    sound_drivers="sdl"
+    ;;
   pandora)
     sound_drivers="oss alsa"
     optimize_cortexa8="yes"
@@ -111,7 +115,7 @@ if [ "$show_help" = "yes" ]; then
   echo "  --sound-drivers=LIST     sound output drivers [guessed]"
   echo "                           available: $sound_driver_list"
   echo "influential environment variables:"
-  echo "  CROSS_COMPILE CC CXX AS CFLAGS ASFLAGS LDFLAGS LDLIBS"
+  echo "  CROSS_COMPILE CC CXX AS STRIP CFLAGS ASFLAGS LDFLAGS LDLIBS"
   exit 1
 fi
 
@@ -225,7 +229,7 @@ arm*)
 esac
 
 case "$platform" in
-generic)
+generic | opendingux)
   need_sdl="yes"
   ;;
 esac
@@ -361,6 +365,7 @@ echo >> $config_mak
 echo "CC = $CC" >> $config_mak
 echo "CXX = $CXX" >> $config_mak
 echo "AS = $AS" >> $config_mak
+echo "STRIP = $STRIP" >> $config_mak
 echo "CFLAGS += $CFLAGS" >> $config_mak
 echo "ASFLAGS += $ASFLAGS" >> $config_mak
 echo "LDFLAGS += $LDFLAGS" >> $config_mak
index 63039d4..4404691 100644 (file)
@@ -72,12 +72,15 @@ const struct menu_keymap in_sdl_joy_map[] __attribute__((weak)) =
        { SDLK_WORLD_3, PBTN_MA3 },
 };
 
+extern const char * const in_sdl_key_names[] __attribute__((weak));
+
 static const struct in_pdata in_sdl_platform_data = {
        .defbinds = in_sdl_defbinds,
        .key_map = in_sdl_key_map,
        .kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]),
        .joy_map = in_sdl_joy_map,
        .jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]),
+       .key_names = in_sdl_key_names,
 };
 
 /* YUV stuff */
index c19e28f..d685ce4 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c19e28f62660cdaed26698234cff9c084517b34c
+Subproject commit d685ce4625e9f3b25b0852d31960cb429da06a9d
diff --git a/platform/opendingux/data/default.gcw0.desktop b/platform/opendingux/data/default.gcw0.desktop
new file mode 100644 (file)
index 0000000..80458bd
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Picodrive
+Comment=A megadrive/genesis emulator
+Exec=PicoDrive
+Terminal=false
+Type=Application
+StartupNotify=true
+Icon=megadrive
+Categories=emulators;
diff --git a/platform/opendingux/data/megadrive.png b/platform/opendingux/data/megadrive.png
new file mode 100644 (file)
index 0000000..e1bc5f8
Binary files /dev/null and b/platform/opendingux/data/megadrive.png differ
diff --git a/platform/opendingux/data/skin/background.png b/platform/opendingux/data/skin/background.png
new file mode 100644 (file)
index 0000000..5dc2bb6
Binary files /dev/null and b/platform/opendingux/data/skin/background.png differ
diff --git a/platform/opendingux/data/skin/font.png b/platform/opendingux/data/skin/font.png
new file mode 100644 (file)
index 0000000..707a5b4
Binary files /dev/null and b/platform/opendingux/data/skin/font.png differ
diff --git a/platform/opendingux/data/skin/readme.txt b/platform/opendingux/data/skin/readme.txt
new file mode 100644 (file)
index 0000000..0f9e415
--- /dev/null
@@ -0,0 +1,7 @@
+The skin images can be customized, but there are several limitations:
+
+background.png - must be 320x240 image with 24bit RGB colors.
+font.png       - must be 128x160 8bit grayscale image.
+selector.png   - must be 8x10 8bit grayscale image.
+
+Font and selector colors can be changed by editing skin.txt.
diff --git a/platform/opendingux/data/skin/skin.txt b/platform/opendingux/data/skin/skin.txt
new file mode 100644 (file)
index 0000000..7f5bdb4
--- /dev/null
@@ -0,0 +1,3 @@
+// html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc.
+text_color=ffffff
+selection_color=0000c0
diff --git a/platform/opendingux/inputmap.c b/platform/opendingux/inputmap.c
new file mode 100644 (file)
index 0000000..0398fc6
--- /dev/null
@@ -0,0 +1,55 @@
+#include <stdlib.h>
+#include <SDL_keysym.h>
+
+#include "../libpicofe/input.h"
+#include "../libpicofe/in_sdl.h"
+#include "../common/input_pico.h"
+
+const struct in_default_bind in_sdl_defbinds[] = {
+       { SDLK_UP,              IN_BINDTYPE_PLAYER12, GBTN_UP },
+       { SDLK_DOWN,    IN_BINDTYPE_PLAYER12, GBTN_DOWN },
+       { SDLK_LEFT,    IN_BINDTYPE_PLAYER12, GBTN_LEFT },
+       { SDLK_RIGHT,   IN_BINDTYPE_PLAYER12, GBTN_RIGHT },
+       { SDLK_LSHIFT,  IN_BINDTYPE_PLAYER12, GBTN_A },
+       { SDLK_LALT,    IN_BINDTYPE_PLAYER12, GBTN_B },
+       { SDLK_LCTRL,   IN_BINDTYPE_PLAYER12, GBTN_C },
+       { SDLK_RETURN,  IN_BINDTYPE_PLAYER12, GBTN_START },
+       { SDLK_ESCAPE,  IN_BINDTYPE_EMU, PEVB_MENU },
+       { SDLK_TAB,             IN_BINDTYPE_EMU, PEVB_PICO_PPREV },
+       { SDLK_BACKSPACE,       IN_BINDTYPE_EMU, PEVB_PICO_PNEXT },
+       { SDLK_BACKSPACE,       IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
+       { SDLK_TAB,             IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
+       { SDLK_SPACE,   IN_BINDTYPE_EMU, PEVB_FF },
+       { 0, 0, 0 }
+};
+
+const struct menu_keymap in_sdl_key_map[] =
+{
+       { SDLK_UP,      PBTN_UP },
+       { SDLK_DOWN,    PBTN_DOWN },
+       { SDLK_LEFT,    PBTN_LEFT },
+       { SDLK_RIGHT,   PBTN_RIGHT },
+       { SDLK_LCTRL,   PBTN_MOK },
+       { SDLK_LALT,    PBTN_MBACK },
+       { SDLK_SPACE,   PBTN_MA2 },
+       { SDLK_LSHIFT,  PBTN_MA3 },
+       { SDLK_TAB,     PBTN_L },
+       { SDLK_BACKSPACE,       PBTN_R },
+};
+
+const char * const in_sdl_key_names[SDLK_LAST] = {
+       [SDLK_UP] = "UP",
+       [SDLK_DOWN] = "DOWN",
+       [SDLK_LEFT] = "LEFT",
+       [SDLK_RIGHT] = "RIGHT",
+       [SDLK_LCTRL] = "A",
+       [SDLK_LALT] = "B",
+       [SDLK_LSHIFT] = "X",
+       [SDLK_SPACE] = "Y",
+       [SDLK_TAB] = "L",
+       [SDLK_BACKSPACE] = "R",
+       [SDLK_RETURN] = "START",
+       [SDLK_ESCAPE] = "SELECT",
+       [SDLK_POWER] = "POWER",
+       [SDLK_PAUSE] = "LOCK",
+};