Browse Source

make, add legacy dingux and retrofw, make libavcodec optional

kub 3 years ago
parent
commit
5d3b7ae27b
3 changed files with 57 additions and 27 deletions
  1. 5 4
      Makefile
  2. 16 12
      README.md
  3. 36 11
      configure

+ 5 - 4
Makefile

@@ -91,12 +91,13 @@ ifeq "$(PLATFORM)" "opendingux"
 	cp $< .od_data/PicoDrive
 	$(STRIP) .od_data/PicoDrive
 
-ifneq (,$(filter %__OPENDINGUX__, $(CFLAGS)))
-# "legacy" opendingux without opk support
+ifneq (,$(filter %__DINGUX__, $(CFLAGS)))
+# "legacy" dingux without opk support
 $(TARGET)-dge.zip: .od_data
 	rm -f .od_data/default.*.desktop
 	cd .od_data && zip -9 -r ../$@ *
 all: $(TARGET)-dge.zip
+CFLAGS += -DSDL_SURFACE_SW # some legacy dinguces had bugs in HWSURFACE
 else
 $(TARGET).opk: .od_data
 	rm -f .od_data/PicoDrive.dge
@@ -104,8 +105,8 @@ $(TARGET).opk: .od_data
 all: $(TARGET).opk
 endif
 
-ifneq (,$(filter %__GCW0__ %__RG350__, $(CFLAGS)))
-CFLAGS += -DMIPS_USE_SYNCI # mips32r2 clear_cache uses SYNCI instead of syscall
+ifneq (,$(filter %mips32r2, $(CFLAGS)))
+CFLAGS += -DMIPS_USE_SYNCI # mips32r2 clear_cache uses SYNCI instead of a syscall
 endif
 
 OBJS += platform/opendingux/inputmap.o

+ 16 - 12
README.md

@@ -1,14 +1,17 @@
 This is my foray into dynamic recompilation using PicoDrive, a
 Megadrive / Genesis / Sega CD / Mega CD / 32X / SMS emulator.
 
-I added support for MIPS (mips32r1), ARM64 (aarch64) and RISC-V (RV64IM) to the
-SH2 recompiler, as well as spent much effort to optimize the DRC-generated code.
-I also optimized SH2 memory access inside the emulator, and did some work on
-M68K/SH2 CPU synchronization to fix some problems and speed up the emulator.
+I added support for MIPS (mips32r2), ARM64 (armv8), RISC-V (RV64IM) and
+PowerPC (G4/2.03) support to the SH2 recompiler, as well as spent much effort to
+optimize the DRC-generated code. I also optimized SH2 memory access inside the
+emulator, and did some work on M68K/SH2 CPU synchronization to fix some problems
+and speed up the emulator.
 
 It got a bit out of hand. I ended up doing fixes and optimizations all over the
-place, mainly for 32X and CD, 32X graphics handling, and probably some more,
-see the commit history. As a result, 32X emulation speed has improved a lot.
+place, mainly for 32X and CD, graphics handling, sound, and probably some more,
+see the commit history. As a result, 32X emulation speed has improved a lot, a
+lot of bugs were fixed, and some new features (e.g. chd file support) have been
+added.
 
 ### compiling
 
@@ -31,8 +34,9 @@ platform|toolchain|configure command
 --------|---------|-----------------
 gp2x,wiz,caanoo|open2x|CROSS_COMPILE=arm-open2x-linux- CFLAGS="-I$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include" LDFLAGS="--sysroot $TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux -L$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib" ./configure --platform=gp2x
 gp2x,wiz,caanoo|open2x with ubuntu arm gcc 4.7|CROSS_COMPILE=arm-linux-gnueabi- CFLAGS="-I$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include" LDFLAGS="-B$TC/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1 -B$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -L$TC/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib" ./configure --platform=gp2x
-opendingux|opendingux|CROSS_COMPILE=mipsel-linux- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="--sysroot $TC -L$TC/lib" ./configure --platform=opendingux
-opendingux|opendingux with ubuntu mips gcc 5.4|CROSS_COMPILE=mipsel-linux-gnu- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="-B$TC/usr/lib -B$TC/lib -Wl,-rpath-link=$TC/usr/lib -Wl,-rpath-link=$TC/lib" ./configure --platform=opendingux
+dingux|dingux|CROSS_COMPILE=mipsel-linux- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="--sysroot $TC -L$TC/lib" ./configure --platform=dingux
+dingux|dingux with ubuntu mips gcc 5.4|CROSS_COMPILE=mipsel-linux-gnu- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="-B$TC/usr/lib -B$TC/lib -Wl,-rpath-link=$TC/usr/lib -Wl,-rpath-link=$TC/lib" ./configure --platform=dingux
+retrofw|retrofw|CROSS_COMPILE=mipsel-linux- CFLAGS="-I $TC/include -I $TC/include/SDL -Wno-unused-result" LDFLAGS="--sysroot $TC/mipsel-buildroot-linux-uclibc/sysroot" ./configure --platform=retrofw
 gcw0|gcw0|CROSS_COMPILE=mipsel-gcw0-linux-uclibc- CFLAGS="-I$TC/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include -I$TC/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL" LDFLAGS="--sysroot $TC/usr/mipsel-gcw0-linux-uclibc/sysroot" ./configure --platform=gcw0
 rg350|rg350|CROSS_COMPILE=mipsel-linux- CFLAGS="-I$TC/usr/include -I$TC/usr/include/SDL" LDFLAGS="--sysroot $TC -L$TC/lib" ./configure --platform=rg350
 
@@ -42,7 +46,7 @@ After configure, compile with
 
 > make
 
-### helix MP3 decoder
+### helix MP3 decoder for ARM
 
 For 32 bit ARM platforms, there is the possibility to compile the helix MP3
 decoder into a shared library to be able to use MP3 audio files with CD games.
@@ -60,10 +64,10 @@ the PicoDrive binary is.
 ### installing
 
 You need to install the resulting binary onto your device manually.
-For opendingux and gcw0, copy the opk to your SD card.
-For gp2x, wiz and caanoo, the easiest way is to unpack
+For opendingux, gcw0, and rg350, copy the opk to your SD card.
+For gp2x, wiz, and caanoo, the easiest way is to unpack
 [PicoDrive_191.zip](http://notaz.gp2x.de/releases/PicoDrive/PicoDrive_191.zip)
 on your SD card and replace the PicoDrive binary.
+For legacy dingux, unpack the dge zip and copy the files to your SD card.
 
 Send bug reports, fixes etc to <derkub@gmail.com>
-Kai-Uwe Bloem

+ 36 - 11
configure

@@ -39,7 +39,7 @@ check_define()
 # "" means "autodetect".
 
 # TODO this is annoyingly messy. should have platform and device
-platform_list="generic pandora gp2x wiz caanoo opendingux retrofw gcw0 rg350 rpi1 rpi2 psp"
+platform_list="generic pandora gp2x wiz caanoo dingux retrofw gcw0 rg350 opendingux rpi1 rpi2 psp"
 platform="generic"
 sound_driver_list="oss alsa sdl"
 sound_drivers=""
@@ -93,16 +93,32 @@ set_platform()
     ;;
   generic)
     ;;
-  opendingux | retrofw | gcw0 | rg350)
+  dingux)
+    # dingoo a320, ritmix rzx-50, the like. all have ingenic MIPS cpus <= JZ4755
+    sound_drivers="sdl"
+    # uses a predecessor of opendingux
+    CFLAGS="$CFLAGS -D__DINGUX__ -march=mips32 -msoft-float"
+    platform="opendingux"
+    ;;
+  retrofw)
+    # devices using retrofw. AFAIK all have ingenic MIPS cpus JZ4760 with fpu
+    sound_drivers="sdl"
+    # uses it's own modified version of opendingux
+    CFLAGS="$CFLAGS -D__RETROFW__ -march=mips32"
+    platform="opendingux"
+    ;;
+  opendingux | gcw0 | rg350)
+    # more modern devices using opendingux, generally using cpus >= JZ4770
     sound_drivers="sdl"
     # all are more or less based on opendingux. save device type as C define.
-    CFLAGS="$CFLAGS -D__`echo $platform | tr '[a-z]' '[A-Z]'`__"
+    CFLAGS="$CFLAGS -D__`echo $platform | tr '[a-z]' '[A-Z]'`__ -march=mips32r2"
     platform="opendingux"
     ;;
   pandora)
     sound_drivers="oss alsa"
     optimize_cortexa8="yes"
     have_arm_neon="yes"
+    have_libavcodec="yes"
     ;;
   gp2x | wiz | caanoo)
     sound_drivers="oss"
@@ -137,6 +153,8 @@ for opt do
   ;;
   --sound-drivers=*) sound_drivers="$optarg"
   ;;
+  --with-libavcodec=*) have_libavcodec="$optarg"
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -149,6 +167,7 @@ if [ "$show_help" = "yes" ]; then
   echo "                           available: $platform_list"
   echo "  --sound-drivers=LIST     sound output drivers [guessed]"
   echo "                           available: $sound_driver_list"
+  echo "  --with-libavcodec=yes|no use libavcodec for mp3 decoding"
   echo "influential environment variables:"
   echo "  CROSS_COMPILE CC CXX AS STRIP CFLAGS ASFLAGS LDFLAGS LDLIBS"
   exit 1
@@ -363,14 +382,20 @@ check_zlib -lz && MAIN_LDLIBS="$MAIN_LDLIBS -lz" || need_zlib="yes"
 MAIN_LDLIBS="-lpng $MAIN_LDLIBS"
 check_libpng || fail "please install libpng (libpng-dev)"
 
-if check_libavcodec; then
-  have_libavcodec="yes"
-  # add -ldl if needed
-  case "$MAIN_LDLIBS" in
-    *"-ldl"*) ;;
-    *) MAIN_LDLIBS="-ldl $MAIN_LDLIBS" ;;
-  esac
-fi
+case "$have_libavcodec" in
+y|Y|yes)
+  if check_libavcodec; then
+    have_libavcodec="yes"
+    # add -ldl if needed
+    case "$MAIN_LDLIBS" in
+      *"-ldl"*) ;;
+      *) MAIN_LDLIBS="-ldl $MAIN_LDLIBS" ;;
+    esac
+  else
+    have_libavcodec="no"
+  fi ;;
+*) have_libavcodec="no" ;;
+esac
 
 #if check_libchdr; then
 #  have_libchdr="yes"