From af5f38f00f49ab0c60425270502a09a9fee5fd23 Mon Sep 17 00:00:00 2001 From: neonloop Date: Sun, 28 Nov 2021 21:08:17 +0000 Subject: Adds fMSX core and builds trimui picoarch.zip --- .gitignore | 1 + Makefile | 23 ++++++++++-- README.trimui.md | 66 +++++++++++++++++++++++++++++++++ core.c | 5 +++ overrides.c | 2 + overrides/fmsx.h | 53 ++++++++++++++++++++++++++ patches/bluemsx/1000-trimui-build.patch | 6 +-- patches/fmsx/1000-trimui-build.patch | 48 ++++++++++++++++++++++++ 8 files changed, 198 insertions(+), 6 deletions(-) create mode 100644 README.trimui.md create mode 100644 overrides/fmsx.h create mode 100644 patches/fmsx/1000-trimui-build.patch diff --git a/.gitignore b/.gitignore index be4722c..2c7810f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ picoarch /bluemsx /fbalpha2012 /fceumm +/fmsx /gambatte /gme /gpsp diff --git a/Makefile b/Makefile index 873e460..42f18e4 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ LDFLAGS = -lc -ldl -lgcc -lm -lSDL -lasound -lpng -lz -Wl,--gc-sections -flto # Unpolished or slow cores that build # EXTRA_CORES += fbalpha2012 # EXTRA_CORES += mame2003_plus -CORES = beetle-pce-fast bluemsx fceumm gambatte gme gpsp mame2000 pcsx_rearmed picodrive quicknes smsplus-gx snes9x2002 snes9x2005 $(EXTRA_CORES) +CORES = beetle-pce-fast bluemsx fceumm fmsx gambatte gme gpsp mame2000 pcsx_rearmed picodrive quicknes smsplus-gx snes9x2002 snes9x2005 $(EXTRA_CORES) beetle-pce-fast_REPO = https://github.com/libretro/beetle-pce-fast-libretro beetle-pce-fast_CORE = mednafen_pce_fast_libretro.so @@ -32,6 +32,8 @@ fbalpha2012_MAKEFILE = makefile.libretro fceumm_REPO = https://github.com/libretro/libretro-fceumm fceumm_MAKEFILE = Makefile.libretro +fmsx_REPO = https://github.com/libretro/fmsx-libretro + gambatte_REPO = https://github.com/libretro/gambatte-libretro gme_REPO = https://github.com/libretro/libretro-gme @@ -76,7 +78,7 @@ else ifeq ($(PROFILE), GENERATE) CFLAGS += -fprofile-generate=./profile/picoarch LDFLAGS += -lgcov else ifeq ($(PROFILE), APPLY) - CFLAGS += -fprofile-use -fprofile-dir=./profile/picoarch -fbranch-probabilities # -Wno-error=coverage-mismatch + CFLAGS += -fprofile-use -fprofile-dir=./profile/picoarch -fbranch-probabilities endif ifeq ($(MINUI), 1) @@ -89,6 +91,8 @@ ifeq ($(MMENU), 1) LDFLAGS += -lSDL_image -lSDL_ttf -ldl endif +CFLAGS += $(EXTRA_CFLAGS) + SOFILES = $(foreach core,$(CORES),$(core)_libretro.so) print-%: @@ -153,7 +157,7 @@ beetle-pce-fast_PAK_NAME = TurboGrafx-16 bluemsx_NAME = blueMSX bluemsx_ROM_DIR = MSX bluemsx_TYPES = rom,ri,mx1,mx2,dsk,col,sg,sc,cas,m3u -bluemsx_PAK_NAME = MSX +bluemsx_PAK_NAME = MSX (blueMSX) fbalpha2012_NAME = fba2012 fbalpha2012_ROM_DIR = ARCADE @@ -164,6 +168,11 @@ fceumm_ROM_DIR = FC fceumm_TYPES = fds,nes,unf,unif fceumm_PAK_NAME = Nintendo (fceumm) +fmsx_NAME = fMSX +fmsx_ROM_DIR = MSX +fmsx_TYPES = rom,mx1,mx2,dsk,cas +fmsx_PAK_NAME = MSX + gambatte_ROM_DIR = GB gambatte_TYPES = gb,gbc,dmg,zip gambatte_PAK_NAME = Game Boy @@ -257,6 +266,7 @@ exec=/mnt/SDCARD/Apps/picoarch/picoarch endef dist-gmenu: $(foreach core, $(CORES), dist-gmenu-$(core)) dist-gmenu-picoarch + cp README.trimui.md pkg/ # -- MinUI @@ -311,7 +321,14 @@ dist-minui-picoarch: $(BIN) cores $(foreach core, $(CORES),$(eval $(call CORE_pak_template,$(core)))) dist-minui: $(foreach core, $(CORES), dist-minui-$(core)) dist-minui-picoarch + cp README.trimui.md pkg/ endif # MINUI=1 +picoarch.zip: + make platform=trimui PROFILE=APPLY clean-all dist-gmenu + rm -f $(OBJS) $(BIN) + make platform=trimui PROFILE=APPLY EXTRA_CFLAGS=-Wno-error=coverage-mismatch MINUI=1 dist-minui + cd pkg && zip -r ../picoarch.zip * + endif # platform=trimui diff --git a/README.trimui.md b/README.trimui.md new file mode 100644 index 0000000..e2bae7c --- /dev/null +++ b/README.trimui.md @@ -0,0 +1,66 @@ +# picoarch - a libretro frontend designed for small screens and low power + +picoarch runs libretro cores (emulators) for various systems with low overhead and UI designed for small screen, low-powered devices like the Trimui Model S (PowKiddy A66). + +It supports: + +- **Arcade** (mame2000) +- **Colecovision** (blueMSX, smsplus) +- **Game Boy / Game Boy Color** (gambatte) +- **Game Boy Advance** (gpsp) +- **Game Gear** (picodrive, smsplus) +- **Genesis** (picodrive) +- **MSX** (fMSX, blueMSX) +- **NES** (quicknes, fceumm) +- **Sega Master System** (picodrive, smsplus) +- **Super NES** (snes9x2002, snes9x2005) +- **PCE / TurboGrafx-16** (beetle-pce-fast) +- **PlayStation** (pcsx_rearmed) +- more to come + +picoarch can also play game music (gme). + +All emulators have: + +- fast-forward +- soft scaling options +- menu+button combo keybindings +- per-game config +- screenshots + +Most have: +- cheat support +- IPS/BPS softpatching +- auto-frameskip for smooth audio + +## Install + +### gmenunx + +Extract the contents of the `gmenunx/` directory onto the SD card. You will have a `libretro` section with launchers for all of the emulators. You will also have `picoarch` in the emulators section where you can run any core in `/Apps/picoarch/`. + +### MinUI + +If you want to replace built-in .paks, simply extract `MinUI/` onto the SD card. + +If you want to replace individual emulators, overwrite the existing MinUI .pak with the picoarch version. + +If you want to use picoarch as a single application instead of replacing .paks, copy `MinUI/Games` onto the SD card. + +## Notes / extra features + +### Bios + +Some emulators require bios files. For gmenunx, bios files are placed into `/Apps/picoarch/system`. For MinUI, they are placed in the save directory, similar to other .paks. + +The libretro documentation specifies which bios is required for each core. For example, needed fMSX bios files are listed here: + +### Cheats + +Cheats use RetroArch .cht file format. Many cheat files are here + +Cheat file name needs to match ROM name, and go underneath save directory. For example, `/Apps/.picoarch-gambatte/cheats/Super Mario Land (World).cht`. When a cheat file is detected, a "cheats" menu item will appear. Not all cheats work with all cores, may want to clean up files to just the cheats you want. + +### IPS / BPS soft-patching + +Many cores can apply patches when loading. For example, loading `/roms/game.gba` will apply patches named `/roms/game.ips`, `/roms/game.ips1`, `/roms/game.IPS2`, `/roms/game.bps`, etc. Patching is temporary, original files are unmodified. Patches are loaded in case-insensitive alphabetical order. Note that `.ips12` loads before `.ips2`, but after `.ips02`. diff --git a/core.c b/core.c index 9122695..4e6c1dc 100644 --- a/core.c +++ b/core.c @@ -613,6 +613,11 @@ int core_load_content(struct content *content) { sram_read(); + if (!strcmp(core_name, "fmsx") && current_core.retro_set_controller_port_device) { + /* fMSX works best with joypad + keyboard */ + current_core.retro_set_controller_port_device(0, RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0)); + } + current_core.retro_get_system_av_info(&av_info); PA_INFO("Screen: %dx%d\n", av_info.geometry.base_width, av_info.geometry.base_height); diff --git a/overrides.c b/overrides.c index e5670f1..bbadb62 100644 --- a/overrides.c +++ b/overrides.c @@ -2,6 +2,7 @@ #include "overrides/beetle-pce-fast.h" #include "overrides/bluemsx.h" #include "overrides/fceumm.h" +#include "overrides/fmsx.h" #include "overrides/gambatte.h" #include "overrides/gme.h" #include "overrides/gpsp.h" @@ -18,6 +19,7 @@ static const struct core_override overrides[] = { beetle_pce_fast_overrides, bluemsx_overrides, fceumm_overrides, + fmsx_overrides, gambatte_overrides, gme_overrides, gpsp_overrides, diff --git a/overrides/fmsx.h b/overrides/fmsx.h new file mode 100644 index 0000000..5365c83 --- /dev/null +++ b/overrides/fmsx.h @@ -0,0 +1,53 @@ +#include "overrides.h" + +static const struct core_override_option fmsx_core_option_overrides[] = { + { + .key = "fmsx_mapper_type_mode", + .retro_var_value = "Mapper Type; " + "Guess Mapper Type A|" + "Guess Mapper Type B|" + "Generic 8kB|" + "Generic 16kB|" + "Konami5 8kB|" + "Konami4 8kB|" + "ASCII 8kB|" + "ASCII 16kB|" + "GameMaster2|" + "FMPAC" + }, + { + .key = "fmsx_simbdos", + .retro_var_value = "DiskROM calls; Disabled|Enabled" + }, + { + .key = "fmsx_autospace", + .retro_var_value = "Autofire SPACE; No|Yes" + }, + { NULL } +}; + +me_bind_action fmsx_ctrl_actions[] = +{ + { "UP ", 1 << RETRO_DEVICE_ID_JOYPAD_UP}, + { "DOWN ", 1 << RETRO_DEVICE_ID_JOYPAD_DOWN }, + { "LEFT ", 1 << RETRO_DEVICE_ID_JOYPAD_LEFT }, + { "RIGHT ", 1 << RETRO_DEVICE_ID_JOYPAD_RIGHT }, + { "A ", 1 << RETRO_DEVICE_ID_JOYPAD_A }, + { "B ", 1 << RETRO_DEVICE_ID_JOYPAD_B }, + { "SPACE ", 1 << RETRO_DEVICE_ID_JOYPAD_Y }, + { "F1 ", 1 << RETRO_DEVICE_ID_JOYPAD_START }, + { "F2 ", 1 << RETRO_DEVICE_ID_JOYPAD_SELECT }, + { "F3 ", 1 << RETRO_DEVICE_ID_JOYPAD_X }, + { "F4 ", 1 << RETRO_DEVICE_ID_JOYPAD_L }, + { "F5 ", 1 << RETRO_DEVICE_ID_JOYPAD_R }, + { "GRAPH ", 1 << RETRO_DEVICE_ID_JOYPAD_L2 }, + { "CTRL ", 1 << RETRO_DEVICE_ID_JOYPAD_R2 }, + { NULL, 0 } +}; + +#define fmsx_overrides { \ + .core_name = "fmsx", \ + .actions = fmsx_ctrl_actions, \ + .action_size = array_size(fmsx_ctrl_actions), \ + .options = fmsx_core_option_overrides \ +} diff --git a/patches/bluemsx/1000-trimui-build.patch b/patches/bluemsx/1000-trimui-build.patch index d4026df..b140866 100644 --- a/patches/bluemsx/1000-trimui-build.patch +++ b/patches/bluemsx/1000-trimui-build.patch @@ -1,5 +1,5 @@ diff --git a/Makefile.libretro b/Makefile.libretro -index 0e8b073..040e734 100644 +index 0e8b073..aec4ea2 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -428,6 +428,20 @@ else ifneq (,$(findstring armv,$(platform))) @@ -38,10 +38,10 @@ index 0e8b073..040e734 100644 endif +ifeq ($(PROFILE), GENERATE) -+ CFLAGS += -fprofile-generate=./profile/fceumm ++ CFLAGS += -fprofile-generate=./profile/$(TARGET_NAME) + LDFLAGS += -lgcov +else ifeq ($(PROFILE), APPLY) -+ CFLAGS += -fprofile-use -fprofile-dir=../profile/fceumm -fbranch-probabilities ++ CFLAGS += -fprofile-use -fprofile-dir=../profile/$(TARGET_NAME) -fbranch-probabilities +endif + include Makefile.common diff --git a/patches/fmsx/1000-trimui-build.patch b/patches/fmsx/1000-trimui-build.patch new file mode 100644 index 0000000..d2d7f3a --- /dev/null +++ b/patches/fmsx/1000-trimui-build.patch @@ -0,0 +1,48 @@ +diff --git a/Makefile b/Makefile +index 6b4eb85..7281477 100644 +--- a/Makefile ++++ b/Makefile +@@ -103,6 +103,20 @@ else ifeq ($(platform), miyoo) + CFLAGS += -march=armv5te -mtune=arm926ej-s + CFLAGS += -fomit-frame-pointer -ffast-math + ++# trimui ++else ifeq ($(platform), trimui) ++ TARGET := $(TARGET_NAME)_libretro.so ++ CC = $(CROSS_COMPILE)gcc ++ CXX = $(CROSS_COMPILE)g++ ++ AR = $(CROSS_COMPILE)ar ++ SHARED := -shared -Wl,-version-script=link.T -Wl,-no-undefined ++ LDFLAGS += -fno-PIC -flto ++ CFLAGS += -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s -mtune=arm926ej-s -fno-PIC -flto ++ OPTIMIZE := -Ofast -DNDEBUG ++ ifeq (,$(DEBUG)) ++ LDFLAGS += -s ++ endif ++ + # iOS + else ifneq (,$(findstring ios,$(platform))) + +@@ -532,6 +546,8 @@ endif + + ifeq ($(DEBUG), 1) + CFLAGS += -O0 -g ++else ifneq (,$(OPTIMIZE)) ++ CFLAGS += $(OPTIMIZE) + else + CFLAGS += -O2 -DNDEBUG + endif +@@ -546,6 +562,13 @@ else + endif + endif + ++ifeq ($(PROFILE), GENERATE) ++ CFLAGS += -fprofile-generate=./profile/$(TARGET_NAME) ++ LDFLAGS += -lgcov ++else ifeq ($(PROFILE), APPLY) ++ CFLAGS += -fprofile-use -fprofile-dir=../profile/$(TARGET_NAME) -fbranch-probabilities ++endif ++ + DEFINES += -D__LIBRETRO__ $(PLATFORM_DEFINES) + + CFLAGS += $(fpic) $(DEFINES) -- cgit v1.2.3