skin
config.cfg
srm/
+brm/
+mds/
-# settings
-#use_fbdev = 1
-#fake_in_gp2x = 1
+TARGET ?= PicoDrive
+CFLAGS += -Wall -ggdb -falign-functions=2
+CFLAGS += -I.
+# FIXME
+CFLAGS += -Iplatform/linux/
+ifndef DEBUG
+CFLAGS += -O2 -DNDEBUG
+endif
-use_musashi = 1
-#use_fame = 1
-use_cz80 = 1
-#use_sh2drc = 1
-use_sh2mame = 1
+all: config.mak target_
+
+ifndef NO_CONFIG_MAK
+ifneq ($(wildcard config.mak),)
+config.mak: ./configure
+ @echo $@ is out-of-date, running configure
+ @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
+include config.mak
+else
+config.mak:
+ @echo "Please run ./configure before running make!"
+ @exit 1
+endif
+else # NO_CONFIG_MAK
+config.mak:
+endif
+
+# default settings
+ifeq "$(ARCH)" "arm"
+use_cyclone ?= 1
+use_drz80 ?= 1
+use_sh2drc ?= 1
+
+asm_memory = 1
+#asm_render = 1
+asm_ym2612 = 1
+asm_misc = 1
+asm_cdpico = 1
+asm_cdmemory = 1
+else # if not arm
+ifneq "$(ARCH)" "x86_64"
+# no 64bit support
+use_fame ?= 1
+else
+use_musashi ?= 1
+endif
+use_cz80 ?= 1
+use_sh2mame ?= 1
+endif
#drc_debug = 3
#drc_debug_interp = 1
-include Makefile.local
-ifndef ARCH
-ARCH = x86
+ifeq "$(use_musashi)" "1"
+# due to CPU stop flag acces
+asm_cdpico = 0
+asm_cdmemory = 0
endif
-CC ?= $(CROSS_COMPILE)gcc
-
-DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV
-CFLAGS += -ggdb -Wall -falign-functions=2
-CFLAGS += -I.
-CFLAGS += -Iplatform/linux/
-LDLIBS += -lm -lpng
-
-# tmp
-CFLAGS += `sdl-config --cflags` -DHAVE_SDL
-LDLIBS += `sdl-config --libs`
-
-all: PicoDrive
-
-# frontend
-OBJS += platform/linux/emu.o platform/linux/blit.o \
- platform/linux/log_io.o
-
# common
-OBJS += platform/common/main.o platform/common/emu.o platform/common/menu_pico.o \
- platform/common/config_file.o platform/common/plat_sdl.o \
- platform/common/mp3_dummy.o
+OBJS += platform/common/main.o platform/common/emu.o \
+ platform/common/menu_pico.o platform/common/config_file.o
# libpicofe
OBJS += platform/libpicofe/input.o platform/libpicofe/readpng.o \
platform/libpicofe/fonts.o platform/libpicofe/linux/in_evdev.o \
- platform/libpicofe/linux/plat.o platform/libpicofe/linux/sndout_oss.o \
- platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o \
- platform/libpicofe/sndout.o platform/libpicofe/sndout_sdl.o
+ platform/libpicofe/linux/plat.o
-OBJS += platform/libpicofe/plat_dummy.o
+# libpicofe - sound
+OBJS += platform/libpicofe/sndout.o
+ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
+platform/libpicofe/sndout.o: CFLAGS += -DHAVE_OSS
+OBJS += platform/libpicofe/linux/sndout_oss.o
+endif
+ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
+platform/libpicofe/sndout.o: CFLAGS += -DHAVE_ALSA
+OBJS += platform/libpicofe/linux/sndout_alsa.o
+endif
+ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
+platform/libpicofe/sndout.o: CFLAGS += -DHAVE_SDL
+OBJS += platform/libpicofe/sndout_sdl.o
+endif
-ifeq "$(use_fbdev)" "1"
-DEFINES += FBDEV
-OBJS += fbdev.o
-else
-LDLIBS += -lpthread
-LDLIBS += -lX11
+# frontend
+OBJS += platform/common/mp3_dummy.o
+ifeq "$(PLATFORM)" "generic"
+OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
+OBJS += platform/common/plat_sdl.o
+OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
+OBJS += platform/libpicofe/plat_dummy.o
+endif
+ifeq "$(PLATFORM)" "pandora"
+platform/common/menu_pico.o: CFLAGS += -DPANDORA
+OBJS += platform/pandora/plat.o
+OBJS += platform/pandora/asm_utils.o
+OBJS += platform/common/arm_utils.o
+OBJS += platform/libpicofe/linux/fbdev.o
+OBJS += platform/libpicofe/linux/xenv.o
+OBJS += platform/libpicofe/pandora/plat.o
endif
ifeq "$(ARCH)" "arm"
-OBJS += pico/carthw/svp/stub_arm.o
-endif
+OBJS += platform/libpicofe/arm_linux.o
+OBJS += pico/sound/mix_arm.o
+else
OBJS += pico/sound/mix.o
-OBJS += pico/carthw/svp/compiler.o
+endif
# zlib
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
# unzip
OBJS += unzip/unzip.o unzip/unzip_stream.o
+
include platform/common/common.mak
-CFLAGS += $(addprefix -D,$(DEFINES))
+target_: $(TARGET)
clean:
- $(RM) PicoDrive $(OBJS)
+ $(RM) $(TARGET) $(OBJS)
-PicoDrive : $(OBJS)
- $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=PicoDrive.map -o $@
+$(TARGET): $(OBJS)
+ $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$(TARGET).map
pprof: platform/linux/pprof.c
$(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@
+
+# ----------- release -----------
+
+VER ?= $(shell head -n 1 platform/common/version.h | \
+ sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')
+
+ifeq "$(PLATFORM)" "pandora"
+
+PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
+
+/tmp/readme.txt: tools/textfilter platform/base_readme.txt
+ tools/textfilter platform/base_readme.txt $@ PANDORA
+
+/tmp/PicoDrive.pxml: platform/pandora/PicoDrive.pxml.template
+ platform/pandora/make_pxml.sh $^ $@
+
+rel: PicoDrive platform/pandora/PicoDrive.run platform/pandora/picorestore \
+ pico/carthw.cfg /tmp/readme.txt platform/pandora/skin \
+ platform/pandora/PicoDrive.png platform/pandora/PicoDrive_p.png \
+ /tmp/PicoDrive.pxml
+ rm -rf out
+ mkdir out
+ cp -r $^ out/
+ $(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x out/PicoDrive.pxml -i out/PicoDrive.png -c
+
+endif
--- /dev/null
+#!/bin/sh
+# some elements originated from qemu configure
+set -e
+
+TMPC="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.c"
+TMPO="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.o"
+TMPB="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}"
+trap "rm -f $TMPC $TMPO $TMPB" EXIT INT QUIT TERM
+rm -f config.log
+
+compile_object()
+{
+ c="$CC $CFLAGS -c $TMPC -o $TMPO $@"
+ echo $c >> config.log
+ $c >> config.log 2>&1
+}
+
+compile_binary()
+{
+ c="$CC $CFLAGS $TMPC -o $TMPB $LDFLAGS $MAIN_LDLIBS $@"
+ echo $c >> config.log
+ $c >> config.log 2>&1
+}
+
+check_define()
+{
+ $CC -E -dD $CFLAGS pico/arm_features.h | grep -q $1 || return 1
+ return 0
+}
+
+# setting options to "yes" or "no" will make that choice default,
+# "" means "autodetect".
+
+platform_list="generic pandora"
+platform="generic"
+sound_driver_list="oss alsa sdl"
+sound_drivers=""
+have_armv5=""
+have_armv6=""
+have_armv7=""
+have_arm_neon=""
+have_tslib=""
+enable_dynarec="yes"
+need_sdl="no"
+need_xlib="no"
+# these are for known platforms
+optimize_cortexa8="no"
+optimize_arm926ej="no"
+
+# hardcoded stuff
+CC="${CC-${CROSS_COMPILE}gcc}"
+CXX="${CXX-${CROSS_COMPILE}g++}"
+AS="${AS-${CROSS_COMPILE}as}"
+MAIN_LDLIBS="$LDLIBS -lm"
+config_mak="config.mak"
+
+fail()
+{
+ echo "$@"
+ exit 1
+}
+
+# call during arg parsing, so that cmd line can override platform defaults
+set_platform()
+{
+ platform=$1
+ case "$platform" in
+ generic)
+ ;;
+ pandora)
+ sound_drivers="oss alsa"
+ optimize_cortexa8="yes"
+ have_arm_neon="yes"
+ ;;
+ *)
+ fail "unsupported platform: $platform"
+ ;;
+ esac
+}
+
+for opt do
+ optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` || true
+ case "$opt" in
+ --help|-h) show_help="yes"
+ ;;
+ --platform=*) set_platform "$optarg"
+ ;;
+ --sound-drivers=*) sound_drivers="$optarg"
+ ;;
+ --enable-neon) have_arm_neon="yes"
+ ;;
+ --disable-neon) have_arm_neon="no"
+ ;;
+ --disable-dynarec) enable_dynarec="no"
+ ;;
+ *) echo "ERROR: unknown option $opt"; show_help="yes"
+ ;;
+ esac
+done
+
+if [ "$show_help" = "yes" ]; then
+ echo "options:"
+ echo " --help print this message"
+ echo " --platform=NAME target platform [$platform]"
+ echo " available: $platform_list"
+ echo " --sound-drivers=LIST sound output drivers [guessed]"
+ echo " available: $sound_driver_list"
+ echo " --enable-neon"
+ echo " --disable-neon enable/disable ARM NEON optimizations [guessed]"
+ echo " --disable-dynarec disable dynamic recompiler"
+ echo " (dynarec is only available and enabled on ARM)"
+ echo "influential environment variables:"
+ echo " CROSS_COMPILE CC CXX AS CFLAGS ASFLAGS LDFLAGS LDLIBS"
+ exit 1
+fi
+
+# validate selections
+if [ "x$sound_drivers" != "x" ]; then
+ for d in $sound_drivers; do
+ if ! echo $sound_driver_list | grep -q "\<$d\>"; then
+ fail "unsupported sound driver: $sound_driver"
+ fi
+ done
+fi
+
+if [ "$need_libpicofe" = "yes" ]; then
+ if ! test -f "frontend/libpicofe/README"; then
+ fail "libpicofe is missing, please run 'git submodule init && git submodule update'"
+ fi
+fi
+
+#if [ "$need_warm" = "yes" ]; then
+# if ! test -f "frontend/warm/README"; then
+# fail "wARM is missing, please run 'git submodule init && git submodule update'"
+# fi
+#fi
+
+# basic compiler test
+cat > $TMPC <<EOF
+int main(void) { return 0; }
+EOF
+if ! compile_binary; then
+ fail "compiler test failed, please check config.log"
+fi
+
+if [ -z "$ARCH" ]; then
+ ARCH=`$CC -dumpmachine | awk -F '-' '{print $1}'`
+fi
+
+case "$ARCH" in
+arm*)
+ # ARM stuff
+ ARCH="arm"
+
+ if [ "$optimize_cortexa8" = "yes" ]; then
+ CFLAGS="$CFLAGS -mcpu=cortex-a8 -mtune=cortex-a8"
+ ASFLAGS="$ASFLAGS -mcpu=cortex-a8"
+ fi
+ if [ "$optimize_arm926ej" = "yes" ]; then
+ CFLAGS="$CFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
+ ASFLAGS="$ASFLAGS -mcpu=arm926ej-s -mfloat-abi=softfp"
+ fi
+
+ if [ "x$have_arm_neon" = "x" ]; then
+ # detect NEON from user-supplied cflags to enable asm code
+ have_arm_neon=`check_define __ARM_NEON__ && echo yes` || true
+ fi
+ if [ "x$have_armv7" = "x" ]; then
+ if check_define HAVE_ARMV7; then
+ have_armv7="yes"
+ have_armv6="yes"
+ have_armv5="yes"
+ fi
+ fi
+ if [ "x$have_armv6" = "x" ]; then
+ if check_define HAVE_ARMV6; then
+ have_armv6="yes"
+ have_armv5="yes"
+ fi
+ fi
+ if [ "x$have_armv5" = "x" ]; then
+ have_armv5=`check_define HAVE_ARMV5 && echo yes` || true
+ fi
+
+ # automatically set mfpu and mfloat-abi if they are not set
+ if [ "$have_arm_neon" = "yes" ]; then
+ fpu="neon"
+ elif [ "$have_armv6" = "yes" ]; then
+ fpu="vfp"
+ fi
+ if [ "x$fpu" != "x" ]; then
+ echo "$CFLAGS" | grep -q -- '-mfpu=' || CFLAGS="$CFLAGS -mfpu=$fpu"
+ echo "$ASFLAGS" | grep -q -- '-mfpu=' || ASFLAGS="$ASFLAGS -mfpu=$fpu"
+ floatabi_set_by_gcc=`$CC -v 2>&1 | grep -q -- --with-float= && echo yes` || true
+ if [ "$floatabi_set_by_gcc" != "yes" ]; then
+ echo "$CFLAGS" | grep -q -- '-mfloat-abi=' || CFLAGS="$CFLAGS -mfloat-abi=softfp"
+ echo "$ASFLAGS" | grep -q -- '-mfloat-abi=' || ASFLAGS="$ASFLAGS -mfloat-abi=softfp"
+ fi
+ fi
+
+ # must disable thumb as recompiler can't handle it
+ if check_define __thumb__; then
+ CFLAGS="$CFLAGS -marm"
+ fi
+
+ # warn about common mistakes
+ if [ "$have_armv5" != "yes" ]; then
+ if ! echo "$CFLAGS" | grep -q -- '-mcpu=\|-march='; then
+ echo "Warning: compiling for ARMv4, is that really what you want?"
+ echo "You probably should specify -mcpu= or -march= like this:"
+ echo " CFLAGS=-march=armv6 ./configure ..."
+ fi
+ fi
+ if [ "$have_arm_neon" = "yes" -a "$have_armv7" != "yes" ]; then
+ echo "Warning: compiling for NEON, but not ARMv7?"
+ echo "You probably want to specify -mcpu= or -march= like this:"
+ echo " CFLAGS=-march=armv7-a ./configure ..."
+ fi
+ ;;
+*)
+ # dynarec only available on ARM
+ enable_dynarec="no"
+ ;;
+esac
+
+case "$platform" in
+generic)
+ need_sdl="yes"
+ ;;
+esac
+
+# header/library presence tests
+check_zlib()
+{
+ cat > $TMPC <<EOF
+ #include <zlib.h>
+ int main(void) { uncompress(0, 0, 0, 0); }
+EOF
+ compile_binary
+}
+
+check_libpng()
+{
+ cat > $TMPC <<EOF
+ #include <png.h>
+ void main() { png_init_io(0, 0); }
+EOF
+ compile_binary
+}
+
+check_oss()
+{
+ cat > $TMPC <<EOF
+ #include <sys/soundcard.h>
+ #include <sys/ioctl.h>
+ void main() { int a=0; ioctl(0, SNDCTL_DSP_SETFMT, &a); }
+EOF
+ compile_binary
+}
+
+check_alsa()
+{
+ cat > $TMPC <<EOF
+ #include <alsa/asoundlib.h>
+ void main() { snd_pcm_open(0, 0, 0, 0); }
+EOF
+ compile_binary "$@"
+}
+
+check_sdl()
+{
+ cat > $TMPC <<EOF
+ #include <SDL.h>
+ void main() { SDL_OpenAudio(0, 0); }
+EOF
+ compile_binary "$@"
+}
+
+#MAIN_LDLIBS="$MAIN_LDLIBS -lz"
+#check_zlib || fail "please install zlib (libz-dev)"
+
+MAIN_LDLIBS="-lpng $MAIN_LDLIBS"
+check_libpng || fail "please install libpng (libpng-dev)"
+
+# find what audio support we can compile
+if [ "x$sound_drivers" = "x" ]; then
+ if check_oss; then sound_drivers="$sound_drivers oss"; fi
+ if check_alsa -lasound; then
+ sound_drivers="$sound_drivers alsa"
+ MAIN_LDLIBS="-lasound $MAIN_LDLIBS"
+ fi
+ if [ "$need_sdl" = "yes" ] || check_sdl `sdl-config --cflags --libs`; then
+ sound_drivers="$sound_drivers sdl"
+ need_sdl="yes"
+ fi
+else
+ if echo $sound_drivers | grep -q "\<oss\>"; then
+ check_oss || fail "oss support is missing"
+ fi
+ if echo $sound_drivers | grep -q "\<alsa\>"; then
+ MAIN_LDLIBS="-lasound $MAIN_LDLIBS"
+ check_alsa || fail "please install libasound2-dev"
+ fi
+fi
+
+if [ "$need_sdl" = "yes" ]; then
+ which sdl-config > /dev/null || \
+ fail "sdl-config is missing; please install libsdl (libsdl1.2-dev)"
+ CFLAGS="$CFLAGS `sdl-config --cflags`"
+ MAIN_LDLIBS="`sdl-config --libs` $MAIN_LDLIBS"
+ check_sdl || fail "please install libsdl (libsdl1.2-dev)"
+fi
+
+cat > $TMPC <<EOF
+void test(void *f, void *d) { fread(d, 1, 1, f); }
+EOF
+if compile_object -Wno-unused-result; then
+ CFLAGS="$CFLAGS -Wno-unused-result"
+fi
+
+# set things that failed to autodetect to "no"
+test "x$have_armv6" != "x" || have_armv6="no"
+test "x$have_armv7" != "x" || have_armv7="no"
+test "x$have_arm_neon" != "x" || have_arm_neon="no"
+
+echo "architecture $ARCH"
+echo "platform $platform"
+echo "sound drivers $sound_drivers"
+echo "C compiler $CC"
+echo "C compiler flags $CFLAGS"
+echo "libraries $MAIN_LDLIBS"
+echo "linker flags $LDFLAGS"
+echo "enable dynarec $enable_dynarec"
+# echo "ARMv7 optimizations $have_armv7"
+# echo "enable ARM NEON $have_arm_neon"
+
+echo "# Automatically generated by configure" > $config_mak
+printf "# Configured with:" >> $config_mak
+printf " '%s'" "$0" "$@" >> $config_mak
+echo >> $config_mak
+
+echo "CC = $CC" >> $config_mak
+echo "CXX = $CXX" >> $config_mak
+echo "AS = $AS" >> $config_mak
+echo "CFLAGS += $CFLAGS" >> $config_mak
+echo "ASFLAGS += $ASFLAGS" >> $config_mak
+echo "LDFLAGS += $LDFLAGS" >> $config_mak
+echo "LDLIBS += $MAIN_LDLIBS" >> $config_mak
+echo >> $config_mak
+
+echo "ARCH = $ARCH" >> $config_mak
+echo "PLATFORM = $platform" >> $config_mak
+echo "SOUND_DRIVERS = $sound_drivers" >> $config_mak
+if [ "$have_arm_neon" = "yes" ]; then
+ echo "HAVE_NEON = 1" >> $config_mak
+fi
+if [ "$enable_dynarec" = "yes" ]; then
+ echo "USE_DYNAREC = 1" >> $config_mak
+fi
+
+# use pandora's skin (for now)
+test -e skin || ln -s platform/pandora/skin skin
+
+# vim:shiftwidth=2:expandtab
-Subproject commit a6905b4de17f4d772c7742065f2863b77ddf0b31
+Subproject commit 194104e334f7c26015b99c862486a73be0d80162
// note: reg_temp[] must have at least the amount of
// registers used by handlers in worst case (currently 4)
-#ifdef ARM
+#ifdef __arm__
#include "../drc/emit_arm.c"
static const int reg_map_g2h[] = {
--- /dev/null
+#ifndef __ARM_FEATURES_H__
+#define __ARM_FEATURES_H__
+
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+ || defined(__ARM_ARCH_7EM__)
+
+#define HAVE_ARMV7
+#define HAVE_ARMV6
+#define HAVE_ARMV5
+
+#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
+
+#define HAVE_ARMV6
+#define HAVE_ARMV5
+
+#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__)
+
+#define HAVE_ARMV5
+
+#endif
+
+/* no need for HAVE_NEON - GCC defines __ARM_NEON__ consistently */
+
+/* global function/external symbol */
+#ifndef __MACH__
+#define ESYM(name) name
+
+#define FUNCTION(name) \
+ .globl name; \
+ .type name, %function; \
+ name
+
+#define EXTRA_UNSAVED_REGS
+
+#else
+#define ESYM(name) _##name
+
+#define FUNCTION(name) \
+ .globl ESYM(name); \
+ name: \
+ ESYM(name)
+
+// r7 is preserved, but add it for EABI alignment..
+#define EXTRA_UNSAVED_REGS r7, r9,
+
+#endif
+
+#endif /* __ARM_FEATURES_H__ */
#define SSP_FLAG_Z (1<<0xd)
#define SSP_FLAG_N (1<<0xf)
-#ifndef ARM
+#ifndef __arm__
//#define DUMP_BLOCK 0x0c9a
void ssp_drc_next(void){}
void ssp_drc_next_patch(void){}
exit(0);
#endif
-#ifdef ARM
+#ifdef __arm__
cache_flush_d_inval_i(tcache, tcache_ptr);
#endif
PicoLoadStateHook = ssp1601_state_load;
n_in_ops = 0;
-#ifdef ARM
+#ifdef __arm__
// hle'd blocks
ssp_block_table[0x800/2] = (void *) ssp_hle_800;
ssp_block_table[0x902/2] = (void *) ssp_hle_902;
#ifdef DUMP_BLOCK
ssp_translate_block(DUMP_BLOCK >> 1);
#endif
-#ifdef ARM
+#ifdef __arm__
ssp_drc_entry(cycles);
#endif
}
memcpy(svp->iram_rom + 0x800, Pico.rom + 0x800, 0x20000 - 0x800);
ssp1601_reset(&svp->ssp1601);
-#ifndef PSP
+#ifdef __arm__
if ((PicoOpt&POPT_EN_SVP_DRC) && svp_dyn_ready)
ssp1601_dyn_reset(&svp->ssp1601);
#endif
static void PicoSVPLine(void)
{
int count = 1;
-#if defined(ARM) || defined(PSP)
+#if defined(__arm__) || defined(PSP)
// performance hack
static int delay_lines = 0;
delay_lines++;
delay_lines = 0;
#endif
-#ifndef PSP
+#ifdef __arm__
if ((PicoOpt&POPT_EN_SVP_DRC) && svp_dyn_ready)
ssp1601_dyn_run(PicoSVPCycles * count);
else
void PicoSVPInit(void)
{
-#ifndef PSP
+#ifdef __arm__
// this is to unmap tcache and make
// mem available for large ROMs, MCD, etc.
drc_cmn_cleanup();
static void PicoSVPExit(void)
{
-#ifndef PSP
+#ifdef __arm__
ssp1601_dyn_exit();
#endif
}
// init SVP compiler
svp_dyn_ready = 0;
-#ifndef PSP
+#ifdef __arm__
if (PicoOpt & POPT_EN_SVP_DRC) {
if (ssp1601_dyn_startup())
return;
\r
// ----------------------- 68000 CPU -----------------------\r
#ifdef EMU_C68K\r
-#include "../cpu/Cyclone/Cyclone.h"\r
+#include "../cpu/cyclone/Cyclone.h"\r
extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k;\r
#define SekCyclesLeftNoMCD PicoCpuCM68k.cycles // cycles left for this run\r
#define SekCyclesLeft \\r
#define SekEndTimesliceS68k(after) PicoCpuCS68k.cycles=after\r
#define SekPc (PicoCpuCM68k.pc-PicoCpuCM68k.membase)\r
#define SekPcS68k (PicoCpuCS68k.pc-PicoCpuCS68k.membase)\r
-#define SekDar(x) PicoCpuCM68k.d[x]\r
+#define SekDar(x) (x < 8 ? PicoCpuCM68k.d[x] : PicoCpuCM68k.a[x - 8])\r
#define SekSr CycloneGetSr(&PicoCpuCM68k)\r
#define SekSetStop(x) { PicoCpuCM68k.state_flags&=~1; if (x) { PicoCpuCM68k.state_flags|=1; PicoCpuCM68k.cycles=0; } }\r
#define SekSetStopS68k(x) { PicoCpuCS68k.state_flags&=~1; if (x) { PicoCpuCS68k.state_flags|=1; PicoCpuCS68k.cycles=0; } }\r
#define SekEndTimesliceS68k(after) PicoCpuFS68k.io_cycle_counter=after\r
#define SekPc fm68k_get_pc(&PicoCpuFM68k)\r
#define SekPcS68k fm68k_get_pc(&PicoCpuFS68k)\r
-#define SekDar(x) PicoCpuFM68k.dreg[x].D\r
+#define SekDar(x) (x < 8 ? PicoCpuFM68k.dreg[x].D : PicoCpuFM68k.areg[x - 8].D)\r
#define SekSr PicoCpuFM68k.sr\r
#define SekSetStop(x) { \\r
PicoCpuFM68k.execinfo &= ~FM68K_HALTED; \\r
\r
/* idle loop detection, not to be used in CD mode */\r
#ifdef EMU_C68K\r
-#include "cpu/Cyclone/tools/idle.h"\r
+#include "cpu/cyclone/tools/idle.h"\r
#endif\r
\r
static unsigned short **idledet_ptrs = NULL;\r
OBJS += platform/linux/pprof.o
endif
+# asm stuff
+ifeq "$(asm_render)" "1"
+DEFINES += _ASM_DRAW_C
+OBJS += pico/draw_arm.o pico/draw2_arm.o
+endif
+ifeq "$(asm_memory)" "1"
+DEFINES += _ASM_MEMORY_C
+OBJS += pico/memory_arm.o
+endif
+ifeq "$(asm_ym2612)" "1"
+DEFINES += _ASM_YM2612_C
+OBJS += pico/sound/ym2612_arm.o
+endif
+ifeq "$(asm_misc)" "1"
+DEFINES += _ASM_MISC_C
+OBJS += pico/misc_arm.o
+OBJS += pico/cd/misc_arm.o
+endif
+ifeq "$(asm_cdpico)" "1"
+DEFINES += _ASM_CD_PICO_C
+OBJS += pico/cd/pico_arm.o
+endif
+ifeq "$(asm_cdmemory)" "1"
+DEFINES += _ASM_CD_MEMORY_C
+OBJS += pico/cd/memory_arm.o
+endif
+ifeq "$(asm_32xdraw)" "1"
+DEFINES += _ASM_32X_DRAW
+OBJS += pico/32x/draw_arm.o
+endif
+
# === Pico core ===
# Pico
OBJS += pico/state.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \
# SVP
OBJS += pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
pico/carthw/svp/ssp16.o
+ifeq "$(ARCH)" "arm"
+OBJS += pico/carthw/svp/stub_arm.o
+OBJS += pico/carthw/svp/compiler.o
+endif
# sound
OBJS += pico/sound/sound.o
OBJS += pico/sound/sn76496.o pico/sound/ym2612.o
endif
ifeq "$(use_cyclone)" "1"
DEFINES += EMU_C68K
-OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o
+OBJS += pico/m68kif_cyclone.o cpu/cyclone/Cyclone.o cpu/cyclone/tools/idle.o
endif
ifeq "$(use_fame)" "1"
DEFINES += EMU_F68K
endif
endif # !no_32x
-
-DIRS += platform platform/common pico pico/cd pico/pico pico/32x pico/sound pico/carthw/svp \
- cpu cpu/musashi cpu/cz80 cpu/fame cpu/sh2/mame cpu/drc
-
+CFLAGS += $(addprefix -D,$(DEFINES))
# common rules
-.c.o:
- @echo ">>>" $<
- $(CC) $(CFLAGS) -c $< -o $@
.s.o:
@echo ">>>" $<
$(CC) $(CFLAGS) -c $< -o $@
-mkdirs:
- mkdir -p $(DIRS)
-
tools/textfilter: tools/textfilter.c
make -C tools/ textfilter
@echo ">>>" $<
$(CC) $(CFLAGS) -Wno-unused -c $< -o $@
-cpu/Cyclone/proj/Cyclone.s:
+cpu/cyclone/Cyclone.s:
@echo building Cyclone...
- @make -C cpu/Cyclone/proj CONFIG_FILE=config_pico.h
+ @make -C cpu/cyclone CONFIG_FILE='\"../cyclone_config.h\"'
+++ /dev/null
-# asm stuff
-ifeq "$(asm_render)" "1"
-DEFINES += _ASM_DRAW_C
-OBJS += pico/draw_arm.o pico/draw2_arm.o
-endif
-ifeq "$(asm_memory)" "1"
-DEFINES += _ASM_MEMORY_C
-OBJS += pico/memory_arm.o
-endif
-ifeq "$(asm_ym2612)" "1"
-DEFINES += _ASM_YM2612_C
-OBJS += pico/sound/ym2612_arm.o
-endif
-ifeq "$(asm_misc)" "1"
-DEFINES += _ASM_MISC_C
-OBJS += pico/misc_arm.o
-OBJS += pico/cd/misc_arm.o
-endif
-ifeq "$(asm_cdpico)" "1"
-DEFINES += _ASM_CD_PICO_C
-OBJS += pico/cd/pico_arm.o
-endif
-ifeq "$(asm_cdmemory)" "1"
-DEFINES += _ASM_CD_MEMORY_C
-OBJS += pico/cd/memory_arm.o
-endif
-ifeq "$(asm_32xdraw)" "1"
-DEFINES += _ASM_32X_DRAW
-OBJS += pico/32x/draw_arm.o
-endif
-
-
-DIRS += cpu/Cyclone cpu/Cyclone/proj cpu/Cyclone/tools cpu/DrZ80
-
-
-# build helix libs
-../common/helix/$(CROSS)helix-mp3.a:
- make -C ../common/helix CROSS=$(CROSS) clean all
-
sndout_wait();\r
}\r
\r
+static void emu_loop_prep(void)\r
+{\r
+ static int pal_old = -1;\r
+ static int filter_old = -1;\r
+\r
+ if (currentConfig.CPUclock != plat_target_cpu_clock_get())\r
+ plat_target_cpu_clock_set(currentConfig.CPUclock);\r
+\r
+ if (Pico.m.pal != pal_old) {\r
+ plat_target_lcdrate_set(Pico.m.pal);\r
+ pal_old = Pico.m.pal;\r
+ }\r
+\r
+ if (currentConfig.filter != filter_old) {\r
+ plat_target_hwfilter_set(currentConfig.filter);\r
+ filter_old = currentConfig.filter;\r
+ }\r
+\r
+ plat_target_gamma_set(currentConfig.gamma, 0);\r
+\r
+ pemu_loop_prep();\r
+}\r
+\r
static void skip_frame(int do_audio)\r
{\r
PicoSkipFrame = do_audio ? 1 : 2;\r
PicoCDBufferInit();\r
\r
plat_video_loop_prepare();\r
- pemu_loop_prep();\r
+ emu_loop_prep();\r
pemu_sound_start();\r
\r
/* number of ticks per frame */\r
* This work is licensed under the terms of MAME license.
* See COPYING file in the top-level directory.
*/
+#include <stdio.h>
#include <string.h>
#include "emu.h"
#include <pico/pico.h>
#include <pico/patch.h>
+#ifdef PANDORA
+#define MENU_X2 1
+#else
+#define MENU_X2 0
+#endif
+
// FIXME
#define REVISION "0"
#include "../libpicofe/menu.c"
+static const char *men_dummy[] = { NULL };
+
/* platform specific options and handlers */
#if defined(__GP2X__)
#include "../gp2x/menu.c"
#define menu_main_plat_draw NULL
#endif
+static void make_bg(int no_scale)
+{
+ unsigned short *src = (void *)g_menubg_src_ptr;
+ int w = g_screen_width, h = g_screen_height;
+ short *dst;
+ int x, y;
+
+ if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2)
+ {
+ unsigned int t, *d = g_menubg_ptr;
+ d += (g_menuscreen_h / 2 - h * 2 / 2)
+ * g_menuscreen_w / 2;
+ d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;
+ for (y = 0; y < h; y++, src += w, d += g_menuscreen_w*2/2) {
+ for (x = 0; x < w; x++) {
+ t = src[x];
+ t = ((t & 0xf79e)>>1) - ((t & 0xc618)>>3);
+ t |= t << 16;
+ d[x] = d[x + g_menuscreen_w / 2] = t;
+ }
+ }
+ return;
+ }
+
+ if (w > g_menuscreen_w)
+ w = g_menuscreen_w;
+ if (h > g_menuscreen_h)
+ h = g_menuscreen_h;
+ dst = (short *)g_menubg_ptr +
+ (g_menuscreen_h / 2 - h / 2) * g_menuscreen_w +
+ (g_menuscreen_w / 2 - w / 2);
+
+ // darken the active framebuffer
+ for (; h > 0; dst += g_menuscreen_w, src += g_screen_width, h--)
+ menu_darken_bg(dst, src, w, 1);
+}
+
static void menu_enter(int is_rom_loaded)
{
if (is_rom_loaded)
{
- int w = g_screen_width, h = g_screen_height;
- short *src, *dst;
-
- if (w > g_menuscreen_w)
- w = g_menuscreen_w;
- if (h > g_menuscreen_h)
- h = g_menuscreen_h;
- src = (short *)g_menubg_src_ptr;
- dst = (short *)g_menubg_ptr +
- (g_menuscreen_h / 2 - h / 2) * g_menuscreen_w +
- (g_menuscreen_w / 2 - w / 2);
-
- // darken the active framebuffer
- for (; h > 0; dst += g_menuscreen_w, src += g_screen_width, h--)
- menu_darken_bg(dst, src, w, 1);
+ make_bg(0);
}
else
{
/* do a frame and fetch menu bg */
pemu_forced_frame(0, 0);
- menu_darken_bg(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 1);
+ make_bg(0);
PicoTmpStateRestore(tmp_state);
}
// ------------ gfx options menu ------------
-static const char *men_dummy[] = { NULL };
+static const char h_gamma[] = "Gamma/brightness adjustment (default 100)";
static menu_entry e_menu_gfx_options[] =
{
- mee_enum("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
- mee_enum("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
+ mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
+ mee_enum ("Renderer", MA_OPT_RENDERER, currentConfig.renderer, renderer_names),
+ mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy),
+ mee_range_h("Gamma adjustment", MA_OPT3_GAMMA, currentConfig.gamma, 1, 200, h_gamma),
MENU_OPTIONS_GFX
mee_end,
};
if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4);
pemu_forced_frame(1, 0);
- memcpy(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2);
+ make_bg(1);
+
smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff);
smalltext_out16(4, g_menuscreen_h - me_sfont_h, layer_str, 0xffff);
}
case 1: draw_frame_debug();
break;
case 2: pemu_forced_frame(1, 0);
- menu_darken_bg(g_menuscreen_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h, 0);
+ make_bg(1);
PDebugShowSpriteStats((unsigned short *)g_menuscreen_ptr + (g_menuscreen_h/2 - 240/2)*g_menuscreen_w +
g_menuscreen_w/2 - 320/2, g_menuscreen_w);
break;
e_menu_gfx_options[i].data = plat_target.vout_methods;
me_enable(e_menu_gfx_options, MA_OPT_VOUT_MODE,
plat_target.vout_methods != NULL);
+
+ i = me_id2offset(e_menu_gfx_options, MA_OPT3_FILTERING);
+ e_menu_gfx_options[i].data = plat_target.hwfilters;
+ me_enable(e_menu_gfx_options, MA_OPT3_FILTERING,
+ plat_target.hwfilters != NULL);
+
+ me_enable(e_menu_gfx_options, MA_OPT3_GAMMA,
+ plat_target.gamma_set != NULL);
}
MA_OPT3_PRES_FULLSCR,
MA_OPT3_FILTERING,
MA_OPT3_VSYNC,
- MA_OPT3_GAMMAA,
+ MA_OPT3_GAMMA,
MA_OPT3_BLACKLVL,
MA_OPT3_LAYER_X,
MA_OPT3_LAYER_Y,
-Subproject commit 26d3ca0d29e87a14943d29fcafc93da753df60cd
+Subproject commit b57ed12e39ff8b0b678d18e5a729ea54ffb0542a
static struct disassemble_info di;
-#ifdef ARM
+#ifdef __arm__
#define print_insn_func print_insn_little_arm
#define BFD_ARCH bfd_arch_arm
#define BFD_MACH bfd_mach_arm_4T
// platform
#define PATH_SEP "/"
#define PATH_SEP_C '/'
-#define MENU_X2 0
#endif //PORT_CONFIG_H
+++ /dev/null
-#export CROSS = arm-none-linux-gnueabi-\r
-CROSS ?= $(CROSS_COMPILE)\r
-LIBROOT = /home/notaz/dev/pnd/libroot\r
-PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh\r
-\r
-# settings\r
-use_cyclone = 1\r
-#use_musashi = 1\r
-use_drz80 = 1\r
-use_sh2drc = 1\r
-#use_sh2mame = 1\r
-\r
-asm_memory = 1\r
-asm_render = 1\r
-asm_ym2612 = 1\r
-asm_misc = 1\r
-asm_cdpico = 1\r
-asm_cdmemory = 1\r
-#profile = 1\r
-#drc_debug = 3\r
-\r
--include Makefile.local\r
-\r
-ifeq "$(use_musashi)" "1"\r
-# due to CPU stop flag acces\r
-asm_cdpico = 0\r
-asm_cdmemory = 0\r
-endif\r
-\r
-ARCH = arm\r
-DEFINES += ARM PANDORA IN_EVDEV\r
-CFLAGS += -I../.. -I. -I$(LIBROOT)/include\r
-CFLAGS += -Wall -Winline -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a\r
-ifeq ($(DEBUG),)\r
-CFLAGS += -O2 -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
-endif\r
-LDFLAGS += -L$(LIBROOT)/lib -Wl,-Bstatic -lpng -Wl,-Bdynamic -lm -lpthread -ldl\r
-ASFLAGS = -mcpu=cortex-a8\r
-CC = $(CROSS)gcc\r
-STRIP = $(CROSS)strip\r
-AS = $(CROSS)as\r
-LD = $(CROSS)ld\r
-OBJCOPY = $(CROSS)objcopy\r
-\r
-# frontend\r
-OBJS += plat.o asm_utils.o\r
-\r
-# common\r
-OBJS += platform/common/emu.o platform/common/menu_pico.o platform/common/fonts.o platform/common/config.o \\r
- platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \\r
- platform/common/readpng.o platform/common/input.o platform/common/main.o platform/common/mp3.o \\r
- platform/linux/fbdev.o platform/linux/in_evdev.o platform/linux/sndout_oss.o \\r
- platform/linux/plat.o platform/linux/xenv.o\r
-\r
-# ARM stuff\r
-OBJS += pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o\r
-OBJS += pico/sound/mix_arm.o\r
-\r
-# zlib\r
-OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \\r
- zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o\r
-# unzip\r
-OBJS += unzip/unzip.o unzip/unzip_stream.o\r
-\r
-vpath %.c = ../..\r
-vpath %.s = ../..\r
-vpath %.S = ../..\r
-DIRS += platform/linux zlib unzip\r
-\r
-all: mkdirs PicoDrive picorestore\r
-\r
-include ../common/common.mak\r
-include ../common/common_arm.mak\r
-include ../common/revision.mak\r
-\r
-CFLAGS += $(addprefix -D,$(DEFINES))\r
-\r
-PicoDrive : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a\r
- @echo ">>>" $@\r
- $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map\r
-ifeq ($(DEBUG),)\r
- $(STRIP) $@\r
-endif\r
-\r
-clean: tidy\r
- $(RM) PicoDrive\r
-tidy:\r
- $(RM) $(OBJS)\r
-\r
-readme.txt: ../../tools/textfilter ../base_readme.txt\r
- ../../tools/textfilter ../base_readme.txt $@ PANDORA\r
-\r
-PicoDrive.pxml: PicoDrive.pxml.template\r
- ./make_pxml.sh PicoDrive.pxml.template PicoDrive.pxml\r
-\r
-platform/common/menu_pico.o: platform/common/menu.c menu.c\r
-\r
-# ----------- release -----------\r
-\r
-VER ?= $(shell head -n 1 version.h | sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')\r
-\r
-rel: PicoDrive PicoDrive.run picorestore ../../pico/carthw.cfg readme.txt \\r
- skin PicoDrive.png PicoDrive_p.png PicoDrive.pxml\r
- rm -rf out\r
- mkdir out\r
- cp -r $^ out/\r
- $(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x PicoDrive.pxml -i PicoDrive.png -c\r
"(320 and 256 pixel wide horizontal)";
static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n"
"using d-pad or move it using R+d-pad";
-static const char *men_dummy[] = { NULL };
-char **pnd_filter_list;
static int menu_loop_cscaler(int id, int keys)
{
for (;;)
{
- menu_draw_begin(0);
+ menu_draw_begin(0, 1);
memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);
text_out16(2, 480 - 18, "%dx%d | d-pad to resize, R+d-pad to move", g_layer_cw, g_layer_ch);
menu_draw_end();
- inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_R|PBTN_MOK|PBTN_MBACK, 40);
+ inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT
+ |PBTN_R|PBTN_MOK|PBTN_MBACK, NULL, 40);
if (inp & PBTN_UP) g_layer_cy--;
if (inp & PBTN_DOWN) g_layer_cy++;
if (inp & PBTN_LEFT) g_layer_cx--;
#define MENU_OPTIONS_GFX \
mee_enum_h ("Scaler", MA_OPT_SCALING, currentConfig.scaling, \
men_scaler, h_scaler), \
- mee_enum ("Filter", MA_OPT3_FILTERING, currentConfig.filter, men_dummy), \
mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \
mee_cust_h ("Setup custom scaler", MA_NONE, menu_loop_cscaler, NULL, h_cscaler), \
mee_range_hide("layer_x", MA_OPT3_LAYER_X, g_layer_cx, 0, 640), \
#define menu_main_plat_draw NULL
-#include <dirent.h>
-#include <errno.h>
-
static menu_entry e_menu_gfx_options[];
static menu_entry e_menu_options[];
static menu_entry e_menu_keyconfig[];
void pnd_menu_init(void)
{
- struct dirent *ent;
- int i, count = 0;
- char **mfilters;
- char buff[64], *p;
- DIR *dir;
-
- dir = opendir("/etc/pandora/conf/dss_fir");
- if (dir == NULL) {
- perror("filter opendir");
- return;
- }
-
- while (1) {
- errno = 0;
- ent = readdir(dir);
- if (ent == NULL) {
- if (errno != 0)
- perror("readdir");
- break;
- }
- p = strstr(ent->d_name, "_up");
- if (p != NULL && (p[3] == 0 || !strcmp(p + 3, "_h")))
- count++;
- }
-
- if (count == 0)
- return;
-
- mfilters = calloc(count + 1, sizeof(mfilters[0]));
- if (mfilters == NULL)
- return;
-
- rewinddir(dir);
- for (i = 0; (ent = readdir(dir)); ) {
- size_t len;
-
- p = strstr(ent->d_name, "_up");
- if (p == NULL || (p[3] != 0 && strcmp(p + 3, "_h")))
- continue;
-
- len = p - ent->d_name;
- if (len > sizeof(buff) - 1)
- continue;
-
- strncpy(buff, ent->d_name, len);
- buff[len] = 0;
- mfilters[i] = strdup(buff);
- if (mfilters[i] != NULL)
- i++;
- }
- closedir(dir);
-
- i = me_id2offset(e_menu_gfx_options, MA_OPT3_FILTERING);
- e_menu_gfx_options[i].data = (void *)mfilters;
- pnd_filter_list = mfilters;
+ int i;
i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS);
e_menu_options[i].name = "Max CPU clock";
#include <unistd.h>\r
#include <linux/fb.h>\r
#include <linux/omapfb.h>\r
+#include <linux/input.h>\r
\r
#include "../common/emu.h"\r
-#include "../common/menu.h"\r
-#include "../common/plat.h"\r
#include "../common/arm_utils.h"\r
-#include "../common/input.h"\r
-#include "../linux/sndout_oss.h"\r
-#include "../linux/fbdev.h"\r
-#include "../linux/xenv.h"\r
+#include "../common/input_pico.h"\r
+#include "../common/version.h"\r
+#include "../libpicofe/input.h"\r
+#include "../libpicofe/menu.h"\r
+#include "../libpicofe/plat.h"\r
+#include "../libpicofe/linux/in_evdev.h"\r
+#include "../libpicofe/linux/sndout_oss.h"\r
+#include "../libpicofe/linux/fbdev.h"\r
+#include "../libpicofe/linux/xenv.h"\r
#include "plat.h"\r
#include "asm_utils.h"\r
-#include "version.h"\r
\r
#include <pico/pico_int.h>\r
\r
-#include <linux/input.h>\r
-\r
static struct vout_fbdev *main_fb, *layer_fb;\r
// g_layer_* - in use, g_layer_c* - configured custom\r
int g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch;\r
static int g_osd_fps_x, g_osd_y, doing_bg_frame;\r
\r
static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";\r
-static short __attribute__((aligned(4))) sndBuffer[2*44100/50];\r
-static unsigned char __attribute__((aligned(4))) fb_copy[g_screen_width * g_screen_height * 2];\r
+static unsigned char __attribute__((aligned(4))) fb_copy[320 * 240 * 2];\r
static void *temp_frame;\r
unsigned char *PicoDraw2FB;\r
const char *renderer_names[] = { NULL };\r
[KEY_MENU] = "Pandora",\r
};\r
\r
-struct in_default_bind in_evdev_defbinds[] =\r
-{\r
- /* MXYZ SACB RLDU */\r
- { KEY_UP, IN_BINDTYPE_PLAYER12, 0 },\r
- { KEY_DOWN, IN_BINDTYPE_PLAYER12, 1 },\r
- { KEY_LEFT, IN_BINDTYPE_PLAYER12, 2 },\r
- { KEY_RIGHT, IN_BINDTYPE_PLAYER12, 3 },\r
- { KEY_S, IN_BINDTYPE_PLAYER12, 4 }, /* B */\r
- { KEY_D, IN_BINDTYPE_PLAYER12, 5 }, /* C */\r
- { KEY_A, IN_BINDTYPE_PLAYER12, 6 }, /* A */\r
- { KEY_ENTER, IN_BINDTYPE_PLAYER12, 7 },\r
+static struct in_default_bind in_evdev_defbinds[] =\r
+{\r
+ { KEY_UP, IN_BINDTYPE_PLAYER12, GBTN_UP },\r
+ { KEY_DOWN, IN_BINDTYPE_PLAYER12, GBTN_DOWN },\r
+ { KEY_LEFT, IN_BINDTYPE_PLAYER12, GBTN_LEFT },\r
+ { KEY_RIGHT, IN_BINDTYPE_PLAYER12, GBTN_RIGHT },\r
+ { KEY_A, IN_BINDTYPE_PLAYER12, GBTN_A },\r
+ { KEY_S, IN_BINDTYPE_PLAYER12, GBTN_B },\r
+ { KEY_D, IN_BINDTYPE_PLAYER12, GBTN_C },\r
+ { KEY_ENTER, IN_BINDTYPE_PLAYER12, GBTN_START },\r
{ KEY_BACKSLASH, IN_BINDTYPE_EMU, PEVB_MENU },\r
{ KEY_SPACE, IN_BINDTYPE_EMU, PEVB_MENU },\r
/* Pandora */\r
- { KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, 4 },\r
- { KEY_END, IN_BINDTYPE_PLAYER12, 5 },\r
- { KEY_HOME, IN_BINDTYPE_PLAYER12, 6 },\r
- { KEY_LEFTALT, IN_BINDTYPE_PLAYER12, 7 },\r
+ { KEY_HOME, IN_BINDTYPE_PLAYER12, GBTN_A },\r
+ { KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, GBTN_B },\r
+ { KEY_END, IN_BINDTYPE_PLAYER12, GBTN_C },\r
+ { KEY_LEFTALT, IN_BINDTYPE_PLAYER12, GBTN_START },\r
{ KEY_RIGHTSHIFT,IN_BINDTYPE_EMU, PEVB_STATE_SAVE },\r
{ KEY_RIGHTCTRL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },\r
{ KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },\r
{ 0, 0, 0 }\r
};\r
\r
-static int get_cpu_clock(void)\r
-{\r
- FILE *f;\r
- int ret = 0;\r
- f = fopen("/proc/pandora/cpu_mhz_max", "r");\r
- if (f) {\r
- fscanf(f, "%d", &ret);\r
- fclose(f);\r
- }\r
- return ret;\r
-}\r
-\r
void pemu_prep_defconfig(void)\r
{\r
defaultConfig.EmuOpt |= EOPT_VSYNC|EOPT_16BPP;\r
\r
void pemu_validate_config(void)\r
{\r
- currentConfig.CPUclock = get_cpu_clock();\r
+ currentConfig.CPUclock = plat_target_cpu_clock_get();\r
}\r
\r
static void osd_text(int x, int y, const char *text)\r
g_screen_ptr = vout_fbdev_flip(layer_fb);\r
\r
// XXX: drain OS event queue here, maybe we'll actually use it someday..\r
- int dummy;\r
- xenv_update(&dummy);\r
+ xenv_update(NULL, NULL, NULL, NULL);\r
}\r
\r
void plat_video_toggle_renderer(int change, int is_menu)\r
g_menuscreen_ptr = vout_fbdev_flip(main_fb);\r
}\r
\r
+void plat_video_menu_leave(void)\r
+{\r
+}\r
+\r
void plat_video_wait_vsync(void)\r
{\r
vout_fbdev_wait_vsync(main_fb);\r
\r
void plat_update_volume(int has_changed, int is_up)\r
{\r
- static int prev_frame = 0, wait_frames = 0;\r
- int vol = currentConfig.volume;\r
-\r
- if (has_changed)\r
- {\r
- if (is_up) {\r
- if (vol < 99) vol++;\r
- } else {\r
- if (vol > 0) vol--;\r
- }\r
- wait_frames = 0;\r
- sndout_oss_setvol(vol, vol);\r
- currentConfig.volume = vol;\r
- emu_status_msg("VOL: %02i", vol);\r
- prev_frame = Pico.m.frame_count;\r
- }\r
-}\r
-\r
-static void make_bg(int no_scale)\r
-{\r
- unsigned short *s = (void *)fb_copy;\r
- int x, y;\r
-\r
- memset32(g_menubg_src_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2 / 4);\r
-\r
- if (!no_scale && g_menuscreen_w >= 640 && g_menuscreen_h >= 480) {\r
- unsigned int t, *d = g_menubg_src_ptr;\r
- d += (g_menuscreen_h / 2 - 480 / 2) * g_menuscreen_w / 2;\r
- d += (g_menuscreen_w / 2 - 640 / 2) / 2;\r
- for (y = 0; y < 240; y++, s += 320, d += g_menuscreen_w*2/2) {\r
- for (x = 0; x < 320; x++) {\r
- t = s[x];\r
- t |= t << 16;\r
- d[x] = d[x + g_menuscreen_w / 2] = t;\r
- }\r
- }\r
- return;\r
- }\r
-\r
- if (g_menuscreen_w >= 320 && g_menuscreen_h >= 240) {\r
- unsigned short *d = g_menubg_src_ptr;\r
- d += (g_menuscreen_h / 2 - 240 / 2) * g_menuscreen_w;\r
- d += (g_menuscreen_w / 2 - 320 / 2);\r
- for (y = 0; y < 240; y++, s += 320, d += g_menuscreen_w)\r
- memcpy(d, s, 320*2);\r
- return;\r
- }\r
}\r
\r
void pemu_forced_frame(int no_scale, int do_emu)\r
doing_bg_frame = 0;\r
\r
// making a copy because enabling the layer clears it's mem\r
- memcpy32((void *)fb_copy, g_screen_ptr, sizeof(fb_copy) / 4);\r
- make_bg(no_scale);\r
-}\r
-\r
-static void oss_write_nonblocking(int len)\r
-{\r
- // sndout_oss_can_write() is not reliable, only use with no_frmlimit\r
- if ((currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) && !sndout_oss_can_write(len))\r
- return;\r
-\r
- sndout_oss_write_nb(PsndOut, len);\r
+ memcpy((void *)fb_copy, g_screen_ptr, sizeof(fb_copy));\r
+ g_menubg_src_ptr = fb_copy;\r
}\r
\r
void pemu_sound_start(void)\r
{\r
- PsndOut = NULL;\r
-\r
- if (currentConfig.EmuOpt & EOPT_EN_SOUND)\r
- {\r
- int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;\r
-\r
- PsndRerate(Pico.m.frame_count ? 1 : 0);\r
-\r
- /*\r
- * for 44k stereo, we do 1470 samples/emu_frame\r
- * OMAP driver does power of 2 buffers, so we need at least 4K buffer.\r
- * The most we can lag is 1K samples, size of OMAP's McBSP FIFO,\r
- * with 2K sample buffer we might sometimes lag more than that,\r
- * thus causing underflows.\r
- */\r
- printf("starting audio: %i len: %i stereo: %i, pal: %i\n",\r
- PsndRate, PsndLen, is_stereo, Pico.m.pal);\r
- sndout_oss_start(PsndRate, is_stereo, 2);\r
- //sndout_oss_setvol(currentConfig.volume, currentConfig.volume);\r
- PicoWriteSound = oss_write_nonblocking;\r
- plat_update_volume(0, 0);\r
- memset(sndBuffer, 0, sizeof(sndBuffer));\r
- PsndOut = sndBuffer;\r
- }\r
-}\r
-\r
-void pemu_sound_stop(void)\r
-{\r
- sndout_oss_stop();\r
-}\r
-\r
-void pemu_sound_wait(void)\r
-{\r
- // don't need to do anything, writes will block by themselves\r
+ emu_sound_start();\r
}\r
\r
void plat_debug_cat(char *str)\r
if ((t[0] | t[5] | t[13]) == 0)\r
memset32((void *)fb_copy, 0x07000700, sizeof(fb_copy) / 4);\r
\r
- memcpy32(g_screen_ptr, (void *)fb_copy, 320*240*2 / 4);\r
+ memcpy(g_screen_ptr, (void *)fb_copy, 320*240*2);\r
plat_video_flip();\r
}\r
\r
-static void apply_filter(int which)\r
-{\r
- char buf[128];\r
- int i;\r
-\r
- if (pnd_filter_list == NULL)\r
- return;\r
-\r
- for (i = 0; i < which; i++)\r
- if (pnd_filter_list[i] == NULL)\r
- return;\r
-\r
- if (pnd_filter_list[i] == NULL)\r
- return;\r
-\r
- snprintf(buf, sizeof(buf), "%s/op_videofir.sh %s", pnd_script_base, pnd_filter_list[i]);\r
- system(buf);\r
-}\r
-\r
void emu_video_mode_change(int start_line, int line_count, int is_32cols)\r
{\r
int fb_w = 320, fb_h = 240, fb_left = 0, fb_right = 0, fb_top = 0, fb_bottom = 0;\r
plat_video_flip();\r
}\r
\r
-void pemu_loop_prep(void)\r
+void plat_video_loop_prepare(void)\r
{\r
- static int pal_old = -1;\r
- static int filter_old = -1;\r
- char buf[128];\r
-\r
- if (currentConfig.CPUclock != get_cpu_clock()) {\r
- snprintf(buf, sizeof(buf), "unset DISPLAY; echo y | %s/op_cpuspeed.sh %d",\r
- pnd_script_base, currentConfig.CPUclock);\r
- system(buf);\r
- }\r
-\r
- if (Pico.m.pal != pal_old) {\r
- snprintf(buf, sizeof(buf), "%s/op_lcdrate.sh %d",\r
- pnd_script_base, Pico.m.pal ? 50 : 60);\r
- system(buf);\r
- pal_old = Pico.m.pal;\r
- }\r
-\r
- if (currentConfig.filter != filter_old) {\r
- apply_filter(currentConfig.filter);\r
- filter_old = currentConfig.filter;\r
- }\r
-\r
// make sure there is no junk left behind the layer\r
- memset32(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2 / 4);\r
+ memset(g_menuscreen_ptr, 0, g_menuscreen_w * g_menuscreen_h * 2);\r
g_menuscreen_ptr = vout_fbdev_flip(main_fb);\r
\r
// emu_video_mode_change will call pnd_setup_layer()\r
+}\r
\r
+void pemu_loop_prep(void)\r
+{\r
// dirty buffers better go now than during gameplay\r
sync();\r
sleep(0);\r
-\r
- pemu_sound_start();\r
}\r
\r
void pemu_loop_end(void)\r
{\r
- pemu_sound_stop();\r
-\r
/* do one more frame for menu bg */\r
pemu_forced_frame(0, 1);\r
\r
exit(1);\r
}\r
\r
- xenv_init();\r
+ xenv_init(NULL, "PicoDrive " VERSION);\r
\r
w = h = 0;\r
main_fb = vout_fbdev_init(main_fb_name, &w, &h, 16, 2);\r
g_menubg_src_ptr = temp_frame;\r
PicoDraw2FB = temp_frame;\r
\r
- sndout_oss_init();\r
pnd_menu_init();\r
\r
- in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES,\r
- pandora_gpio_keys, sizeof(pandora_gpio_keys));\r
+ in_evdev_init(in_evdev_defbinds);\r
+ in_probe();\r
+ plat_target_setup_input();\r
+\r
+ sndout_oss_frag_frames = 2;\r
+\r
return;\r
\r
fail1:\r
\r
void plat_finish(void)\r
{\r
- sndout_oss_exit();\r
vout_fbdev_finish(main_fb);\r
xenv_finish();\r
\r
-extern char **pnd_filter_list;
extern int g_layer_cx, g_layer_cy;
extern int g_layer_cw, g_layer_ch;