run: |
git config --global --add safe.directory $PWD
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
- ./configure --platform=gcw0
+ ./configure --platform=opendingux-gcw0
make -j2
mv PicoDrive.opk PicoDrive-gcw0-$ver.opk
- name: artifacts
run: |
git config --global --add safe.directory $PWD
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
- ./configure --platform=gcw0 --platform=odbeta
+ ./configure --platform=odbeta
make -j2
mv PicoDrive.opk PicoDrive-odbeta-gcw0-$ver.opk
- name: artifacts
run: |
git config --global --add safe.directory $PWD
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
- ./configure --platform=opendingux --platform=odbeta
+ ./configure --platform=odbeta
make -j2
mv PicoDrive.opk PicoDrive-odbeta-lepus-$ver.opk
- name: artifacts
run: |
git config --global --add safe.directory $PWD
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
- ./configure --platform=opendingux --platform=odbeta
+ ./configure --platform=odbeta
make -j2
mv PicoDrive.opk PicoDrive-odbeta-rg99-$ver.opk
- name: artifacts
CFLAGS += $(call chkCCflag, -flto -fipa-pta -fipa-ra)
else
# these improve execution speed on 32bit arm/mips with gcc pre-5 toolchains
-CFLAGS += -fno-caller-saves -fno-guess-branch-probability -fno-regmove
+CFLAGS += $(call chkCCflag, -fno-caller-saves -fno-guess-branch-probability -fno-regmove)
# very old gcc toolchains may not have these options
CFLAGS += $(call chkCCflag, -fno-tree-loop-if-convert -fipa-pta -fno-ipa-cp)
endif
OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
OBJS += platform/common/plat_sdl.o platform/common/input_sdlkbd.o
OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
-OBJS += platform/libpicofe/plat_dummy.o platform/libpicofe/linux/plat.o
+OBJS += platform/libpicofe/linux/plat.o
USE_FRONTEND = 1
endif
ifeq "$(PLATFORM)" "generic"
OBJS += platform/common/plat_sdl.o platform/common/inputmap_kbd.o
endif
OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
-OBJS += platform/libpicofe/plat_dummy.o platform/libpicofe/linux/plat.o
+OBJS += platform/libpicofe/linux/plat.o
USE_FRONTEND = 1
endif
ifeq "$(PLATFORM)" "pandora"
# "" means "autodetect".
# TODO this is annoyingly messy. should have platform and device
-platform_list="generic pandora gph dingux retrofw gcw0 opendingux odbeta miyoo rpi1 rpi2 psp"
+platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 psp"
platform="generic"
sound_driver_list="oss alsa sdl"
sound_drivers=""
set_platform()
{
platform=$1
- CFLAGS="$CFLAGS -D__`echo $platform | tr '[a-z]' '[A-Z]'`__"
+ CFLAGS="$CFLAGS -D__`echo ${platform%-*} | tr '[a-z]' '[A-Z]'`__"
case "$platform" in
rpi1)
MFLAGS="-mcpu=arm1176jzf-s -mfpu=vfp"
MFLAGS="-march=mips32"
platform="opendingux"
;;
- opendingux | gcw0)
+ opendingux | opendingux-gcw0)
# more modern devices using opendingux, with Ingenic MIPS JZ4770 or newer
sound_drivers="sdl"
# mostly based on opendingux for gcw0
CFLAGS="$CFLAGS -D__OPENDINGUX__"
+ [ "${platform#*gcw0}" = "" ] && CFLAGS="$CFLAGS -D__GCW0__"
MFLAGS="-march=mips32r2"
platform="opendingux"
;;
MFLAGS="-mcpu=arm926ej-s -marm"
platform="opendingux"
;;
- odbeta)
+ odbeta | odbeta-gcw0)
# various devices with opendingux beta, arch flags from toolchain default
+ sound_drivers="sdl"
CFLAGS="$CFLAGS -D__OPENDINGUX__"
+ [ "${platform#*gcw0}" = "" ] && CFLAGS="$CFLAGS -D__GCW0__"
MFLAGS="" # toolchains are arch specific
platform="opendingux"
;;
void pemu_sound_start(void);
+int plat_parse_arg(int argc, char *argv[], int *x);
void plat_early_init(void);
void plat_init(void);
void plat_finish(void);
#include "../libpicofe/input.h"
#include "../libpicofe/in_sdl.h"
+#include "../libpicofe/plat.h"
#include "../common/input_pico.h"
#include "../common/plat_sdl.h"
{ 0, 0, 0 }
};
-const struct menu_keymap in_sdl_key_map[] = {
+const struct menu_keymap _in_sdl_key_map[] = {
{ SDLK_UP, PBTN_UP },
{ SDLK_DOWN, PBTN_DOWN },
{ SDLK_LEFT, PBTN_LEFT },
{ SDLK_TAB, PBTN_R },
{ SDLK_BACKSPACE, PBTN_L },
};
-const int in_sdl_key_map_sz = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]);
+const int in_sdl_key_map_sz = sizeof(_in_sdl_key_map) / sizeof(_in_sdl_key_map[0]);
+const struct menu_keymap *in_sdl_key_map = _in_sdl_key_map;
-const struct menu_keymap in_sdl_joy_map[] = {
+const struct menu_keymap _in_sdl_joy_map[] = {
{ SDLK_UP, PBTN_UP },
{ SDLK_DOWN, PBTN_DOWN },
{ SDLK_LEFT, PBTN_LEFT },
{ SDLK_WORLD_2, PBTN_MA2 },
{ SDLK_WORLD_3, PBTN_MA3 },
};
-const int in_sdl_joy_map_sz = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]);
+const int in_sdl_joy_map_sz = sizeof(_in_sdl_joy_map) / sizeof(_in_sdl_joy_map[0]);
+const struct menu_keymap *in_sdl_joy_map = _in_sdl_joy_map;
-const char * const (*in_sdl_key_names)[SDLK_LAST] = NULL;
+const char * const *in_sdl_key_names = NULL;
+
+void plat_target_setup_input(void)
+{
+}
{\r
int x, unrecognized = 0;\r
\r
- for (x = 1; x < argc; x++)\r
+ for (x = 1; x < argc && !unrecognized; x++)\r
{\r
if (argv[x][0] == '-')\r
{\r
if (x+2 < argc) { pdb_net_connect(argv[x+1], argv[x+2]); x += 2; }\r
}\r
else {\r
- unrecognized = 1;\r
- break;\r
+ unrecognized = plat_parse_arg(argc, argv, &x);\r
}\r
} else {\r
FILE *f = fopen(argv[x], "rb");\r
if (f) {\r
fclose(f);\r
rom_fname_reload = argv[x];\r
- engineState = PGS_ReloadRom;\r
}\r
else\r
unrecognized = 1;\r
\r
emu_init();\r
\r
- engineState = PGS_Menu;\r
+ engineState = rom_fname_reload ? PGS_ReloadRom : PGS_Menu;\r
plat_video_menu_enter(0);\r
\r
- if (argc > 1)\r
- parse_cmd_line(argc, argv);\r
-\r
if (engineState == PGS_ReloadRom)\r
{\r
plat_video_menu_begin();\r
static struct in_pdata in_sdl_platform_data = {
.defbinds = in_sdl_defbinds,
- .key_map = in_sdl_key_map,
- .joy_map = in_sdl_joy_map,
};
+struct plat_target plat_target;
+
+#if defined __MIYOO__
+const char *plat_device = "miyoo";
+#elif defined __GCW0__
+const char *plat_device = "gcw0";
+#elif defined __RETROFW__
+const char *plat_device = "retrofw";
+#elif defined __DINGUX__
+const char *plat_device = "dingux";
+#else
+const char *plat_device = "";
+#endif
+
+int plat_parse_arg(int argc, char *argv[], int *x)
+{
+#if defined __OPENDINGUX__
+ if (*plat_device == '\0' && strcasecmp(argv[*x], "-device") == 0) {
+ plat_device = argv[++(*x)];
+ return 0;
+ }
+#endif
+ return 1;
+}
+
+void plat_early_init(void)
+{
+}
+
+int plat_target_init(void)
+{
+#if defined __ODBETA__
+ if (*plat_device == '\0') {
+ /* ODbeta should always have a device tree, get the model info from there */
+ FILE *f = fopen("/proc/device-tree/compatible", "r");
+ if (f) {
+ char buf[10];
+ int c = fread(buf, 1, sizeof(buf), f);
+ if (strncmp(buf, "gcw,", 4) == 0)
+ plat_device = "gcw0";
+ }
+ }
+#endif
+ return 0;
+}
+
+void plat_target_finish(void)
+{
+}
+
/* YUV stuff */
static int yuv_ry[32], yuv_gy[32], yuv_by[32];
static unsigned char yuv_u[32 * 2], yuv_v[32 * 2];
plat_video_set_buffer(g_screen_ptr);
}
-void plat_early_init(void)
-{
-}
-
static void plat_sdl_resize(int w, int h)
{
// take over new settings
g_screen_ppitch = 320;
g_screen_ptr = shadow_fb;
+ plat_target_setup_input();
in_sdl_platform_data.kmap_size = in_sdl_key_map_sz,
+ in_sdl_platform_data.key_map = in_sdl_key_map,
in_sdl_platform_data.jmap_size = in_sdl_joy_map_sz,
- in_sdl_platform_data.key_names = *in_sdl_key_names,
+ in_sdl_platform_data.joy_map = in_sdl_joy_map,
+ in_sdl_platform_data.key_names = in_sdl_key_names,
in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler);
in_probe();
extern const struct in_default_bind in_sdl_defbinds[];
-extern const struct menu_keymap in_sdl_key_map[];
+extern const struct menu_keymap *in_sdl_key_map;
extern const int in_sdl_key_map_sz;
-extern const struct menu_keymap in_sdl_joy_map[];
+extern const struct menu_keymap *in_sdl_joy_map;
extern const int in_sdl_joy_map_sz;
-extern const char * const (*in_sdl_key_names)[SDLK_LAST];
+extern const char * const *in_sdl_key_names;
+extern const char *plat_device;
void linux_menu_init(void);
return NULL;
}
+int plat_parse_arg(int argc, char *argv[], int *x)
+{
+ return 1;
+}
+
void plat_early_init(void)
{
// just use gettimeofday until plat_init()
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <SDL_keysym.h>
#include "../libpicofe/input.h"
#include "../libpicofe/in_sdl.h"
+#include "../libpicofe/plat.h"
#include "../common/input_pico.h"
#include "../common/plat_sdl.h"
+#include "../common/emu.h"
const struct in_default_bind in_sdl_defbinds[] = {
{ SDLK_UP, IN_BINDTYPE_PLAYER12, GBTN_UP },
{ 0, 0, 0 }
};
-const struct menu_keymap in_sdl_key_map[] = {
+struct menu_keymap _in_sdl_key_map[] = {
{ SDLK_UP, PBTN_UP },
{ SDLK_DOWN, PBTN_DOWN },
{ SDLK_LEFT, PBTN_LEFT },
{ SDLK_RIGHT, PBTN_RIGHT },
-#if defined(__MIYOO__)
- { SDLK_LALT, PBTN_MOK },
- { SDLK_LCTRL, PBTN_MBACK },
-#else
{ SDLK_LCTRL, PBTN_MOK },
{ SDLK_LALT, PBTN_MBACK },
-#endif
{ SDLK_SPACE, PBTN_MA2 },
{ SDLK_LSHIFT, PBTN_MA3 },
{ SDLK_TAB, PBTN_L },
{ SDLK_BACKSPACE, PBTN_R },
};
-const int in_sdl_key_map_sz = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]);
+const int in_sdl_key_map_sz = sizeof(_in_sdl_key_map) / sizeof(_in_sdl_key_map[0]);
+const struct menu_keymap *in_sdl_key_map = _in_sdl_key_map;
-const struct menu_keymap in_sdl_joy_map[] = {
+const struct menu_keymap _in_sdl_joy_map[] = {
{ SDLK_UP, PBTN_UP },
{ SDLK_DOWN, PBTN_DOWN },
{ SDLK_LEFT, PBTN_LEFT },
{ SDLK_WORLD_2, PBTN_MA2 },
{ SDLK_WORLD_3, PBTN_MA3 },
};
-const int in_sdl_joy_map_sz = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]);
+const int in_sdl_joy_map_sz = sizeof(_in_sdl_joy_map) / sizeof(_in_sdl_joy_map[0]);
+const struct menu_keymap *in_sdl_joy_map = _in_sdl_joy_map;
-const char * const _in_sdl_key_names[SDLK_LAST] = {
+const char * _in_sdl_key_names[SDLK_LAST] = {
+ /* common */
[SDLK_UP] = "UP",
[SDLK_DOWN] = "DOWN",
[SDLK_LEFT] = "LEFT",
[SDLK_RIGHT] = "RIGHT",
-#if defined(__MIYOO__)
- [SDLK_LALT] = "A",
- [SDLK_LCTRL] = "B",
-#else
[SDLK_LCTRL] = "A",
[SDLK_LALT] = "B",
-#endif
-#if defined(__GCW0__) || defined(__MIYOO__)
- [SDLK_LSHIFT] = "X",
- [SDLK_SPACE] = "Y",
-#else
[SDLK_LSHIFT] = "Y",
[SDLK_SPACE] = "X",
-#endif
[SDLK_RETURN] = "START",
[SDLK_ESCAPE] = "SELECT",
-
-#if defined(__MIYOO__)
- [SDLK_TAB] = "L1",
- [SDLK_BACKSPACE] = "R1",
- [SDLK_RALT] = "L2",
- [SDLK_RSHIFT] = "R2",
- [SDLK_RCTRL] = "RESET",
-#elif defined(__GCW0__) || defined(__DINGUX__) || defined(__RETROFW__)
- [SDLK_TAB] = "L",
- [SDLK_BACKSPACE] = "R",
- [SDLK_POWER] = "POWER",
- [SDLK_PAUSE] = "LOCK",
-#else
[SDLK_TAB] = "L1",
[SDLK_BACKSPACE] = "R1",
+
+ /* opendingux rg, gkd etc */
[SDLK_PAGEUP] = "L2",
[SDLK_PAGEDOWN] = "R2",
[SDLK_KP_DIVIDE] = "L3",
[SDLK_KP_PERIOD] = "R3",
[SDLK_HOME] = "POWER",
-#endif
+ /* gcw0 */
+ [SDLK_POWER] = "POWER",
+ [SDLK_PAUSE] = "LOCK",
+ /* miyoo */
+ [SDLK_RALT] = "L2",
+ [SDLK_RSHIFT] = "R2",
+ [SDLK_RCTRL] = "RESET",
};
-const char * const (*in_sdl_key_names)[SDLK_LAST] = &_in_sdl_key_names;
+const char * const *in_sdl_key_names = _in_sdl_key_names;
+
+
+static void nameset(int x1, const char *name)
+{
+ _in_sdl_key_names[x1] = name;
+}
+
+static void nameswap(int x1, int x2)
+{
+ const char **p = &_in_sdl_key_names[x1];
+ const char **q = &_in_sdl_key_names[x2];
+ const char *t = *p; *p = *q; *q = t;
+}
+
+static void keyswap(int k1, int k2)
+{
+ int x1, x2, t;
+
+ for (x1 = in_sdl_key_map_sz-1; x1 >= 0; x1--)
+ if (_in_sdl_key_map[x1].key == k1) break;
+ for (x2 = in_sdl_key_map_sz-1; x2 >= 0; x2--)
+ if (_in_sdl_key_map[x2].key == k2) break;
+ if (x1 >= 0 && x2 >= 0) {
+ struct menu_keymap *p = &_in_sdl_key_map[x1];
+ struct menu_keymap *q = &_in_sdl_key_map[x2];
+ t = p->pbtn; p->pbtn = q->pbtn; q->pbtn = t;
+ }
+}
+
+void plat_target_setup_input(void)
+{
+ if (strcmp(plat_device, "miyoo") == 0) {
+ /* swapped A/B and X/Y keys */
+ keyswap(SDLK_LALT, SDLK_LCTRL);
+ nameswap(SDLK_LALT, SDLK_LCTRL);
+ nameswap(SDLK_SPACE, SDLK_LSHIFT);
+ } else if (strcmp(plat_device, "gcw0") == 0) {
+ /* swapped X/Y keys, single L/R keys */
+ nameswap(SDLK_SPACE, SDLK_LSHIFT);
+ nameset(SDLK_TAB, "L"); nameset(SDLK_BACKSPACE, "R");
+ } else if (strcmp(plat_device, "retrofw") == 0 || strcmp(plat_device, "dingux") == 0) {
+ /* single L/R keys */
+ nameset(SDLK_TAB, "L"); nameset(SDLK_BACKSPACE, "R");
+ }
+}
return NULL;\r
}\r
\r
+int plat_parse_arg(int argc, char *argv[], int *x)\r
+{\r
+ return 1;\r
+}\r
+\r
void plat_early_init(void)\r
{\r
}\r
plat_video_set_buffer(g_screen_ptr);
}
+/* check arg at index x */
+int plat_parse_arg(int argc, char *argv[], int *x)
+{
+ return 1;
+}
+
/* Preliminary initialization needed at program start */
void plat_early_init(void)
{
const char *renderer_names[] = { NULL };
const char *renderer_names32x[] = { NULL };
+int plat_parse_arg(int argc, char *argv[], int *x)
+{
+ return 1;
+}
+
void plat_init(void)
{
g_screen_ptr = (void *)screen_buff;
# gph: ghcr.io/irixxxx/toolchain-gp2x
# dingux: ghcr.io/irixxxx/toolchain-dingux
# retrofw: ghcr.io/irixxxx/toolchain-retrofw
-# gcw0, rg350: ghcr.io/irixxxx/toolchain-opendingux
+# gcw0,opendingux:ghcr.io/irixxxx/toolchain-opendingux
# miyoo: ghcr.io/irixxxx/toolchain-miyoo
# psp: docker.io/pspdev/pspdev
# pandora: ghcr.io/irixxxx/toolchain-pandora
# gcw0: JZ4770 (mips32r2 with fpu), swapped X/Y buttons
docker pull ghcr.io/irixxxx/toolchain-opendingux
echo " git config --global --add safe.directory /home/picodrive &&\
- ./configure --platform=gcw0 &&\
+ ./configure --platform=opendingux-gcw0 &&\
make clean && make -j2 all "\
| docker run -i -v$PWD:/home/picodrive -w/home/picodrive --rm ghcr.io/irixxxx/toolchain-opendingux sh &&
mv PicoDrive.opk release-$rel/PicoDrive-gcw0_$rel.opk
}
[ -z "${plat##* odbeta-gcw0 *}" ] && {
-# gcw0 (untested): JZ4770 (mips32r2 with fpu), swapped X/Y buttons
+# gcw0, rg350 and similar devices: JZ4770 (mips32r2 with fpu)
docker pull ghcr.io/irixxxx/toolchain-odbeta-gcw0
echo " git config --global --add safe.directory /home/picodrive &&\
- ./configure --platform=gcw0 --platform=odbeta &&\
+ ./configure --platform=odbeta &&\
make clean && make -j2 all "\
| docker run -i -v$PWD:/home/picodrive -w/home/picodrive --rm ghcr.io/irixxxx/toolchain-odbeta-gcw0 sh &&
mv PicoDrive.opk release-$rel/PicoDrive-odbeta-gcw0_$rel.opk
}
[ -z "${plat##* odbeta-lepus *}" ] && {
-# rg300 and other Ingenic lepus based (untested): JZ4760 (mips32r1 with fpu)
+# rg300 and other Ingenic lepus based: JZ4760 (mips32r1 with fpu)
docker pull ghcr.io/irixxxx/toolchain-odbeta-lepus
echo " git config --global --add safe.directory /home/picodrive &&\
- ./configure --platform=opendingux --platform=odbeta &&\
+ ./configure --platform=odbeta &&\
make clean && make -j2 all "\
| docker run -i -v$PWD:/home/picodrive -w/home/picodrive --rm ghcr.io/irixxxx/toolchain-odbeta-lepus sh &&
mv PicoDrive.opk release-$rel/PicoDrive-odbeta-lepus_$rel.opk
}
[ -z "${plat##* odbeta-rg99 *}" ] && {
-# rg99 and other JZ4725B based (untested): JZ4760 (mips32r1 w/o fpu)
+# rg99 and similar devices: JZ4725B (mips32r1 w/o fpu)
docker pull ghcr.io/irixxxx/toolchain-odbeta-rs90
echo " git config --global --add safe.directory /home/picodrive &&\
- ./configure --platform=opendingux --platform=odbeta &&\
+ ./configure --platform=odbeta &&\
make clean && make -j2 all "\
| docker run -i -v$PWD:/home/picodrive -w/home/picodrive --rm ghcr.io/irixxxx/toolchain-odbeta-rs90 sh &&
mv PicoDrive.opk release-$rel/PicoDrive-odbeta-rg99_$rel.opk