Skip to content

Commit

Permalink
build, odbeta and opendingux cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Dec 12, 2023
1 parent 85174a6 commit 58fc34b
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 77 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
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
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
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
Expand All @@ -230,7 +230,7 @@ jobs:
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
Expand All @@ -250,7 +250,7 @@ jobs:
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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ifneq ($(call chkCCflag, -fipa-ra),) # gcc >= 5
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
Expand Down Expand Up @@ -172,7 +172,7 @@ 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"
Expand All @@ -189,7 +189,7 @@ else
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"
Expand Down
11 changes: 7 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ check_define()
# "" 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=""
Expand Down Expand Up @@ -73,7 +73,7 @@ fail()
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"
Expand Down Expand Up @@ -102,11 +102,12 @@ set_platform()
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"
;;
Expand All @@ -117,9 +118,11 @@ set_platform()
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"
;;
Expand Down
1 change: 1 addition & 0 deletions platform/common/emu.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void pemu_finalize_frame(const char *fps, const char *notice_msg);

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);
Expand Down
17 changes: 12 additions & 5 deletions platform/common/inputmap_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "../libpicofe/input.h"
#include "../libpicofe/in_sdl.h"
#include "../libpicofe/plat.h"
#include "../common/input_pico.h"
#include "../common/plat_sdl.h"

Expand Down Expand Up @@ -33,7 +34,7 @@ const struct in_default_bind in_sdl_defbinds[] = {
{ 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 },
Expand All @@ -45,9 +46,10 @@ const struct menu_keymap in_sdl_key_map[] = {
{ 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 },
Expand All @@ -58,6 +60,11 @@ const struct menu_keymap in_sdl_joy_map[] = {
{ 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)
{
}
11 changes: 3 additions & 8 deletions platform/common/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void parse_cmd_line(int argc, char *argv[])
{
int x, unrecognized = 0;

for (x = 1; x < argc; x++)
for (x = 1; x < argc && !unrecognized; x++)
{
if (argv[x][0] == '-')
{
Expand All @@ -47,15 +47,13 @@ void parse_cmd_line(int argc, char *argv[])
if (x+2 < argc) { pdb_net_connect(argv[x+1], argv[x+2]); x += 2; }
}
else {
unrecognized = 1;
break;
unrecognized = plat_parse_arg(argc, argv, &x);
}
} else {
FILE *f = fopen(argv[x], "rb");
if (f) {
fclose(f);
rom_fname_reload = argv[x];
engineState = PGS_ReloadRom;
}
else
unrecognized = 1;
Expand Down Expand Up @@ -95,12 +93,9 @@ int main(int argc, char *argv[])

emu_init();

engineState = PGS_Menu;
engineState = rom_fname_reload ? PGS_ReloadRom : PGS_Menu;
plat_video_menu_enter(0);

if (argc > 1)
parse_cmd_line(argc, argv);

if (engineState == PGS_ReloadRom)
{
plat_video_menu_begin();
Expand Down
61 changes: 54 additions & 7 deletions platform/common/plat_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,58 @@ static struct area { int w, h; } area;

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];
Expand Down Expand Up @@ -323,10 +371,6 @@ void plat_video_loop_prepare(void)
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
Expand Down Expand Up @@ -392,9 +436,12 @@ void plat_init(void)
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();

Expand Down
7 changes: 4 additions & 3 deletions platform/common/plat_sdl.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

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);
5 changes: 5 additions & 0 deletions platform/gp2x/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ void *plat_mem_get_for_drc(size_t size)
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()
Expand Down
Loading

0 comments on commit 58fc34b

Please sign in to comment.