diff options
author | twinaphex | 2013-03-18 01:16:31 +0100 |
---|---|---|
committer | twinaphex | 2013-03-18 01:16:31 +0100 |
commit | 22dade5ca95efa7fb3530023dbab77f8516bfed7 (patch) | |
tree | 40a660c1e7a806abe03b2c9f2e6389073894877b | |
parent | 24f4865eff11beb6348d9e0e310d593477359afe (diff) | |
parent | 101e053c72e9299bfbd1cbf6a8de9ba6cff11e4c (diff) | |
download | pcsx_rearmed-22dade5ca95efa7fb3530023dbab77f8516bfed7.tar.gz pcsx_rearmed-22dade5ca95efa7fb3530023dbab77f8516bfed7.tar.bz2 pcsx_rearmed-22dade5ca95efa7fb3530023dbab77f8516bfed7.zip |
Merge git://github.com/notaz/pcsx_rearmed
37 files changed, 1771 insertions, 170 deletions
@@ -171,9 +171,13 @@ USE_PLUGIN_LIB = 1 USE_FRONTEND = 1 endif ifeq "$(PLATFORM)" "maemo" -OBJS += maemo/hildon.o maemo/main.o +OBJS += maemo/hildon.o maemo/main.o maemo/maemo_xkb.o frontend/pl_gun_ts.o maemo/%.o: maemo/%.c USE_PLUGIN_LIB = 1 +LDFLAGS += $(shell pkg-config --libs hildon-1 libpulse) +CFLAGS += $(shell pkg-config --cflags hildon-1) -DHAVE_TSLIB +CFLAGS += `pkg-config --cflags glib-2.0 libosso dbus-1 hildon-fm-2` +LDFLAGS += `pkg-config --libs glib-2.0 libosso dbus-1 hildon-fm-2` endif ifeq "$(PLATFORM)" "libretro" OBJS += frontend/libretro.o @@ -295,10 +295,7 @@ generic) need_sdl="yes" ;; maemo) - maemo_cflags=`pkg-config --cflags hildon-1` - maemo_ldlibs=`pkg-config --libs hildon-1` - CFLAGS="$CFLAGS -DMAEMO -DMAEMO_CHANGES $maemo_cflags" - MAIN_LDLIBS="$MAIN_LDLIBS $maemo_ldlibs" + CFLAGS="$CFLAGS -DMAEMO -DMAEMO_CHANGES" ;; libretro) CFLAGS="$CFLAGS -fPIC" diff --git a/debian_maemo/buildpkg b/debian_maemo/buildpkg new file mode 100644 index 0000000..4c34f94 --- /dev/null +++ b/debian_maemo/buildpkg @@ -0,0 +1,13 @@ +#!/bin/bash -e + +NAME=`head debian/changelog -n1 | sed -n 's/^\(.*\) (\(.*\)) .*/\1-\2/p'` +[[ -z $NAME ]] && { echo "Could not extract package name and version from debian/changelog" 2>&1; exit 1; } + +rm -rf ../$NAME +cp -r ../`basename $PWD` ../$NAME +cd ../$NAME +rm -rf .git* +find . -depth -name .svn -type d -exec rm -r {} \; +find . -name '*~' -exec rm {} \; + +LD_LIBRARY_PATH=/usr/lib dpkg-buildpackage -rfakeroot $* diff --git a/debian_maemo/changelog b/debian_maemo/changelog new file mode 100644 index 0000000..e3395de --- /dev/null +++ b/debian_maemo/changelog @@ -0,0 +1,112 @@ +pcsxrearmed (0.4.0.14.13) unstable; urgency=low + + * Updated source to notaz git version + + -- sakya <sakya_tg@yahoo.it> Fri, 15 Feb 2013 12:50:28 +0200 + +pcsxrearmed (0.4.0.14.12) unstable; urgency=low + + * Fixed a problem with controller and vibration (Gran Turismo 2, Wipeout 3) + * Added dependency to libts + + -- sakya <sakya_tg@yahoo.it> Wed, 16 May 2012 17:09:33 +0200 + +pcsxrearmed (0.4.0.14.11) unstable; urgency=low + + * Added option -guncon and -gunnotrigger to activate guncon controller type + + -- sakya <sakya_tg@yahoo.it> Wed, 16 May 2012 09:37:12 +0200 + +pcsxrearmed (0.4.0.14.10) unstable; urgency=low + + * Added option -corners to set action to execute when clicking on display corners + * Fixed problem with notification using gles plugin + * Fixed controller problem with game "Heart Of Darkness" (maybe others?) + + -- sakya <sakya_tg@yahoo.it> Fri, 11 May 2012 16:38:29 +0200 + +pcsxrearmed (0.4.0.14.9) unstable; urgency=low + + * Added support to .mdf extension + * Added option -vibration to activate vibration + + -- sakya <sakya_tg@yahoo.it> Tue, 1 May 2012 12:19:49 +0200 + +pcsxrearmed (0.4.0.14.8) unstable; urgency=low + + * Added option -disc to set the initial disc in multi discs images (used when loading a savestate with -load) + * Added option -autosave + * Fixed disc change for multi discs images (PBP) + * Merged commits from Notaz git + * drc: inv: fix ram ofset and mirror handling + * support emulated RAM mapped at offset + + -- sakya <sakya_tg@yahoo.it> Fri, 20 Apr 2012 20:27:19 +0200 + +pcsxrearmed (0.4.0.14.7) unstable; urgency=low + + * Fixed -displayon + + -- sakya <sakya_tg@yahoo.it> Sun, 15 Apr 2012 17:22:08 +0200 + +pcsxrearmed (0.4.0.14.6) unstable; urgency=low + + * Added option -keys to set the keys config file + * Fixed L1/L2/R1/R2 + * Added autopause on incoming call + + -- sakya <sakya_tg@yahoo.it> Wed, 13 Apr 2012 12:51:35 +0200 + +pcsxrearmed (0.4.0.14.5) unstable; urgency=low + + * Fixed accelerometer using gles + * Added -analog option to use the accelerometer as the analog pad + * Added options to set accelerometer sens, max value, y_def + * Added -displayon option to keep the display on (useful when playing using the accelerometer) + + -- sakya <sakya_tg@yahoo.it> Tue, 10 Apr 2012 15:34:11 +0200 + +pcsxrearmed (0.4.0.14.4) unstable; urgency=low + + * Fixed -load option + * Added disc change (configured a new key) + + -- sakya <sakya_tg@yahoo.it> Fri, 06 Apr 2012 13:54:56 +0200 + +pcsxrearmed (0.4.0.14.3) unstable; urgency=low + + * Added options to set various gles settings + * Fixed save state slot selection + * Added notification on save state slot change + + -- sakya <sakya_tg@yahoo.it> Wed, 04 Apr 2012 10:20:18 +0200 + +pcsxrearmed (0.4.0.14.2) unstable; urgency=low + + * Fixed fullscreen using gpu-gles + * Fixed crash when saving savestate using gpu-gles + * Added options to set spu reverb and interpolation (disabled by default) + + -- sakya <sakya_tg@yahoo.it> Sun, 01 Apr 2012 11:42:20 +0200 + +pcsxrearmed (0.4.0.14.1) unstable; urgency=low + + * Added option to set psx region (NTSC/PAL/Auto) + * Use PulseAudio (better audio) + + -- sakya <sakya_tg@yahoo.it> Wed, 30 Mar 2012 09:44:51 +0200 + +pcsxrearmed (0.4.0.14) unstable; urgency=low + + * Updated to r14 + * Added --help + * PCSX4All + + -- sakya <sakya_tg@yahoo.it> Sun, 27 Dec 2011 00:02:27 +0200 + +pcsxrearmed (0.4.0.12.2) unstable; urgency=low + + * gpu-gles + + + -- Bonapart <bonapart@programist.ru> Sun, 27 Dec 2011 00:02:27 +0200 diff --git a/debian_maemo/compat b/debian_maemo/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian_maemo/compat @@ -0,0 +1 @@ +5 diff --git a/debian_maemo/control b/debian_maemo/control new file mode 100644 index 0000000..4469ed8 --- /dev/null +++ b/debian_maemo/control @@ -0,0 +1,115 @@ +Source: pcsxrearmed +Section: user/games +Priority: extra +Maintainer: Bonapart <bonapart@programist.ru> +Build-Depends: debhelper (>= 5), zlib1g-dev, libhildon1-dev, libpulse-dev, libasound2-dev, libbz2-dev, libgles1-sgx-img-dev, opengles-sgx-img-common-dev, libosso-dev, libdbus-1-dev, libhildonfm2-dev, libts-dev +Standards-Version: 3.7.3 + +Package: pcsxrearmed +Architecture: armel +Depends: ${shlibs:Depends}, libts-0.0-0 +Description: Sony PlayStation emulator +XSBC-Homepage: http://notaz.gp2x.de/pcsx_rearmed.php +XSBC-Bugtracker: http://notaz.gp2x.de/pcsx_rearmed.php +XB-Maemo-Display-Name: PCSX-ReArmed +XB-Maemo-Icon-26: + iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c + 6QAAEStJREFUaN7Fmn+wXVV1xz9r733uufe+e9+DJIRESEICEQghAUQBI8Uo + ik7jrxm1o+3ooB2RkWrtONqZlhn7Y8bRUVudqVZsoTjFH2CrSKsVEFIQIr8C + JARC0CDkBwkkIcl7L7n3nLP36h97n3Pvo07/7c2cOfeenB9rr/Vd3/Vd6zxh + 7DM52b9isj+5YcGC+a9bunTpOVNTU91WK5Msy1ECIgYRMGKxzmGtQQBrHSZ9 + R8C5DOcc1hiMtTjrsM4hAtZYWq1W/H9nyZzDZVk6x9LKWmSteH2rlZNlLhw/ + fnzXszt3fmHjxo13bH74oReBwbbtO6r0ODht5UpnfXXdytOXX+m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FKWJbMzszozOxt27tw5e9111z1w4MCBO4H7gKeBlwWg3c5b + 3of5VVWtUNVzgfMvvvji80477bQFS5Ys6VprTd301IaNG2iMaWBR9wKNwa/Y + 69j8sqoqQhpeeR8Nr+V22sKePXuO7969+6WHHnroseT1x4GdwCGgbFzU7XSy + wXDYDyGcDKwAlgOLgUmgzf/PZwgcAV4Ank2G7wemgRLgfwDIFWZCNtkwCgAA + AABJRU5ErkJggg== diff --git a/debian_maemo/copyright b/debian_maemo/copyright new file mode 100644 index 0000000..75a6b06 --- /dev/null +++ b/debian_maemo/copyright @@ -0,0 +1,2 @@ +this package was maemonized by Roman Deninberg <bonapart@programist.ru> +Mon, 10 Jan 2011 02:00:13 +0100 diff --git a/debian_maemo/dirs b/debian_maemo/dirs new file mode 100644 index 0000000..33359b8 --- /dev/null +++ b/debian_maemo/dirs @@ -0,0 +1 @@ +usr/games diff --git a/debian_maemo/docs b/debian_maemo/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian_maemo/docs @@ -0,0 +1 @@ +README diff --git a/debian_maemo/files b/debian_maemo/files new file mode 100644 index 0000000..0cc57dd --- /dev/null +++ b/debian_maemo/files @@ -0,0 +1 @@ +pcsxrearmed_0.4.0.14.13_armel.deb user/games extra diff --git a/debian_maemo/install b/debian_maemo/install new file mode 100644 index 0000000..a260186 --- /dev/null +++ b/debian_maemo/install @@ -0,0 +1,6 @@ +pcsx opt/maemo/usr/games/ +plugins/spunull/spunull.so opt/maemo/usr/games/plugins +plugins/gpu_unai/gpu_unai.so opt/maemo/usr/games/plugins +#plugins/gpu_unai/gpuPCSX4ALL.so opt/maemo/usr/games/plugins +plugins/dfxvideo/gpu_peops.so opt/maemo/usr/games/plugins +plugins/gpu-gles/gpu_gles.so opt/maemo/usr/games/plugins diff --git a/debian_maemo/rules b/debian_maemo/rules new file mode 100644 index 0000000..5230bf7 --- /dev/null +++ b/debian_maemo/rules @@ -0,0 +1,68 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +#export DH_VERBOSE=1 + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) + +#GAME_VERSION := $(shell head debian/changelog -n1 | sed -n 's/.* (\(.*\)) .*/\1/p') +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +build: build-stamp + +build-stamp: + dh_testdir + ./configure --platform=maemo --gpu=neon --sound-drivers=pulseaudio --enable-neon + $(MAKE) + strip pcsx + strip plugins/gpu_unai/gpu_unai.so + strip plugins/gpu-gles/gpu_gles.so + strip plugins/spunull/spunull.so + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + dh_clean + $(MAKE) clean clean_plugins + +install: build + dh_testdir + dh_testroot + dh_installdirs + mkdir -p "$(CURDIR)"/debian/pcsxrearmed/opt/maemo/usr/games/screenshots + chmod 777 "$(CURDIR)"/debian/pcsxrearmed/opt/maemo/usr/games/screenshots + chown user "$(CURDIR)"/debian/pcsxrearmed/opt/maemo/usr/games/screenshots + dh_install + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + #dh_installmenu + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_makeshlibs + dh_shlibdeps + dh_gencontrol + #maemo-optify + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/frontend/libpicofe b/frontend/libpicofe -Subproject cceadf4cd4f1fa7e7f12b3765bba31bfcef6b1e +Subproject da0cc55643353ab15725194be64a3d8460fe48b diff --git a/frontend/libretro.c b/frontend/libretro.c index c6d113f..e22ef5b 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -13,6 +13,8 @@ #include "../libpcsxcore/psxcounters.h" #include "../libpcsxcore/psxmem_map.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" +#include "../libpcsxcore/cdrom.h" +#include "../libpcsxcore/cdriso.h" #include "../libpcsxcore/cheat.h" #include "../plugins/dfsound/out.h" #include "cspace.h" @@ -363,6 +365,7 @@ bool retro_unserialize(const void *data, size_t size) return ret == 0 ? true : false; } +/* cheats */ void retro_cheat_reset(void) { ClearAllCheats(); @@ -388,8 +391,132 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) Cheats[index].Enabled = enabled; } +/* multidisk support */ +static bool disk_ejected; +static unsigned int disk_current_index; +static struct disks_state { + char *fname; + int internal_index; // for multidisk eboots +} disks[8]; + +static bool disk_set_eject_state(bool ejected) +{ + // weird PCSX API.. + SetCdOpenCaseTime(ejected ? -1 : (time(NULL) + 2)); + LidInterrupt(); + + disk_ejected = ejected; + return true; +} + +static bool disk_get_eject_state(void) +{ + /* can't be controlled by emulated software */ + return disk_ejected; +} + +static unsigned int disk_get_image_index(void) +{ + return disk_current_index; +} + +static bool disk_set_image_index(unsigned int index) +{ + if (index >= sizeof(disks) / sizeof(disks[0])) + return false; + + CdromId[0] = '\0'; + CdromLabel[0] = '\0'; + + if (disks[index].fname == NULL) { + SysPrintf("missing disk #%u\n", index); + CDR_shutdown(); + + // RetroArch specifies "no disk" with index == count, + // so don't fail here.. + disk_current_index = index; + return true; + } + + SysPrintf("switching to disk %u: \"%s\" #%d\n", index, + disks[index].fname, disks[index].internal_index); + + cdrIsoMultidiskSelect = disks[index].internal_index; + set_cd_image(disks[index].fname); + if (ReloadCdromPlugin() < 0) { + SysPrintf("failed to load cdr plugin\n"); + return false; + } + if (CDR_open() < 0) { + SysPrintf("failed to open cdr plugin\n"); + return false; + } + + if (!disk_ejected) { + SetCdOpenCaseTime(time(NULL) + 2); + LidInterrupt(); + } + + disk_current_index = index; + return true; +} + +static unsigned int disk_get_num_images(void) +{ + unsigned int count = 0; + size_t i; + + for (i = 0; i < sizeof(disks) / sizeof(disks[0]); i++) + if (disks[i].fname != NULL) + count++; + + return count; +} + +static bool disk_replace_image_index(unsigned index, + const struct retro_game_info *info) +{ + char *old_fname; + bool ret = true; + + if (index >= sizeof(disks) / sizeof(disks[0])) + return false; + + old_fname = disks[index].fname; + disks[index].fname = NULL; + disks[index].internal_index = 0; + + if (info != NULL) { + disks[index].fname = strdup(info->path); + if (index == disk_current_index) + ret = disk_set_image_index(index); + } + + if (old_fname != NULL) + free(old_fname); + + return ret; +} + +static bool disk_add_image_index(void) +{ + // TODO?? + return true; +} + +static struct retro_disk_control_callback disk_control = { + .set_eject_state = disk_set_eject_state, + .get_eject_state = disk_get_eject_state, + .get_image_index = disk_get_image_index, + .set_image_index = disk_set_image_index, + .get_num_images = disk_get_num_images, + .replace_image_index = disk_replace_image_index, + .add_image_index = disk_add_image_index, +}; + bool retro_load_game(const struct retro_game_info *info) { + size_t i; #ifdef FRONTEND_SUPPORTS_RGB565 enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565; if (environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { @@ -397,12 +524,28 @@ bool retro_load_game(const struct retro_game_info *info) } #endif + if (info == NULL || info->path == NULL) { + SysPrintf("info->path required\n"); + return false; + } + if (plugins_opened) { ClosePlugins(); plugins_opened = 0; } - set_cd_image(info->path); + for (i = 0; i < sizeof(disks) / sizeof(disks[0]); i++) { + if (disks[i].fname != NULL) { + free(disks[i].fname); + disks[i].fname = NULL; + } + disks[i].internal_index = 0; + } + + disk_current_index = 0; + disks[0].fname = strdup(info->path); + + set_cd_image(disks[0].fname); /* have to reload after set_cd_image for correct cdr plugin */ if (LoadPlugins() == -1) { @@ -434,6 +577,12 @@ bool retro_load_game(const struct retro_game_info *info) } emu_on_new_cd(0); + // multidisk images + for (i = 1; i < sizeof(disks) / sizeof(disks[0]) && i < cdrIsoMultidiskCount; i++) { + disks[i].fname = strdup(info->path); + disks[i].internal_index = i; + } + return true; } @@ -551,6 +700,7 @@ void retro_init(void) environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); environ_cb(RETRO_ENVIRONMENT_GET_CAN_DUPE, &vout_can_dupe); + environ_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_control); /* Set how much slower PSX CPU runs * 100 (so that 200 is 2 times) * we have to do this because cache misses and some IO penalties diff --git a/frontend/libretro.h b/frontend/libretro.h index 3eef758..0c39e6e 100644 --- a/frontend/libretro.h +++ b/frontend/libretro.h @@ -19,7 +19,7 @@ extern "C" { #endif // Used for checking API/ABI mismatches that can break libretro implementations. -// It is not incremented for compatible changes. +// It is not incremented for compatible changes to the API. #define RETRO_API_VERSION 1 // Libretro's fundamental device abstractions. @@ -50,6 +50,28 @@ extern "C" { // Only use ANALOG type when polling for analog values of the axes. #define RETRO_DEVICE_ANALOG 5 +// Abstracts the concept of a pointing mechanism, e.g. touch. +// This allows libretro to query in absolute coordinates where on the screen a mouse (or something similar) is being placed. +// For a touch centric device, coordinates reported are the coordinates of the press. +// +// Coordinates in X and Y are reported as: +// [-0x7fff, 0x7fff]: -0x7fff corresponds to the far left/top of the screen, +// and 0x7fff corresponds to the far right/bottom of the screen. +// The "screen" is here defined as area that is passed to the frontend and later displayed on the monitor. +// The frontend is free to scale/resize this screen as it sees fit, however, +// (X, Y) = (-0x7fff, -0x7fff) will correspond to the top-left pixel of the game image, etc. +// +// To check if the pointer coordinates are valid (e.g. a touch display actually being touched), +// PRESSED returns 1 or 0. +// If using a mouse, PRESSED will usually correspond to the left mouse button. +// PRESSED will only return 1 if the pointer is inside the game screen. +// +// For multi-touch, the index variable can be used to successively query more presses. +// If index = 0 returns true for _PRESSED, coordinates can be extracted +// with _X, _Y for index = 0. One can then query _PRESSED, _X, _Y with index = 1, and so on. +// Eventually _PRESSED will return false for an index. No further presses are registered at this point. +#define RETRO_DEVICE_POINTER 6 + // These device types are specializations of the base types above. // They should only be used in retro_set_controller_type() to inform libretro implementations // about use of a very specific device type. @@ -101,6 +123,11 @@ extern "C" { #define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5 #define RETRO_DEVICE_ID_LIGHTGUN_START 6 +// Id values for POINTER. +#define RETRO_DEVICE_ID_POINTER_X 0 +#define RETRO_DEVICE_ID_POINTER_Y 1 +#define RETRO_DEVICE_ID_POINTER_PRESSED 2 + // Returned from retro_get_region(). #define RETRO_REGION_NTSC 0 #define RETRO_REGION_PAL 1 @@ -285,9 +312,28 @@ enum retro_key RETROK_EURO = 321, RETROK_UNDO = 322, - RETROK_LAST + RETROK_LAST, + + RETROK_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) +}; + +enum retro_mod +{ + RETROKMOD_NONE = 0x0000, + + RETROKMOD_SHIFT = 0x01, + RETROKMOD_CTRL = 0x02, + RETROKMOD_ALT = 0x04, + RETROKMOD_META = 0x08, + + RETROKMOD_NUMLOCK = 0x10, + RETROKMOD_CAPSLOCK = 0x20, + RETROKMOD_SCROLLOCK = 0x40, + + RETROKMOD_DUMMY = INT_MAX // Ensure sizeof(enum) == sizeof(int) }; + // Environment commands. #define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * -- // Sets screen rotation of graphics. @@ -331,7 +377,7 @@ enum retro_key // // It can be used by the frontend to potentially warn // about too demanding implementations. - // + // // The levels are "floating", but roughly defined as: // 0: Low-powered embedded devices such as Raspberry Pi // 1: 6th generation consoles, such as Wii/Xbox 1, and phones, tablets, etc. @@ -366,7 +412,78 @@ enum retro_key // It is up to the frontend to present this in a usable way. // The array is terminated by retro_input_descriptor::description being set to NULL. // This function can be called at any time, but it is recommended to call it as early as possible. +#define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12 + // const struct retro_keyboard_callback * -- + // Sets a callback function used to notify core about keyboard events. + // +#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13 + // const struct retro_disk_control_callback * -- + // Sets an interface which frontend can use to eject and insert disk images. + // This is used for games which consist of multiple images and must be manually + // swapped out by the user (e.g. PSX). + +// Callback type passed in RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK. Called by the frontend in response to keyboard events. +// down is set if the key is being pressed, or false if it is being released. +// keycode is the RETROK value of the char. +// character is the text character of the pressed key. (UTF-32). +// key_modifiers is a set of RETROKMOD values or'ed together. +typedef void (*retro_keyboard_event_t)(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers); + +struct retro_keyboard_callback +{ + retro_keyboard_event_t callback; +}; + +// Callbacks for RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE. +// Should be set for implementations which can swap out multiple disk images in runtime. +// If the implementation can do this automatically, it should strive to do so. +// However, there are cases where the user must manually do so. +// +// Overview: To swap a disk image, eject the disk image with set_eject_state(true). +// Set the disk index with set_image_index(index). Insert the disk again with set_eject_state(false). + +// If ejected is true, "ejects" the virtual disk tray. +// When ejected, the disk image index can be set. +typedef bool (*retro_set_eject_state_t)(bool ejected); +// Gets current eject state. The initial state is 'not ejected'. +typedef bool (*retro_get_eject_state_t)(void); +// Gets current disk index. First disk is index 0. +// If return value is >= get_num_images(), no disk is currently inserted. +typedef unsigned (*retro_get_image_index_t)(void); +// Sets image index. Can only be called when disk is ejected. +// The implementation supports setting "no disk" by using an index >= get_num_images(). +typedef bool (*retro_set_image_index_t)(unsigned index); +// Gets total number of images which are available to use. +typedef unsigned (*retro_get_num_images_t)(void); +// +// Replaces the disk image associated with index. +// Arguments to pass in info have same requirements as retro_load_game(). +// Virtual disk tray must be ejected when calling this. +// Replacing a disk image with info = NULL will remove the disk image from the internal list. +// As a result, calls to get_image_index() can change. +// +// E.g. replace_image_index(1, NULL), and previous get_image_index() returned 4 before. +// Index 1 will be removed, and the new index is 3. +struct retro_game_info; +typedef bool (*retro_replace_image_index_t)(unsigned index, const struct retro_game_info *info); +// Adds a new valid index (get_num_images()) to the internal disk list. +// This will increment subsequent return values from get_num_images() by 1. +// This image index cannot be used until a disk image has been set with replace_image_index. +typedef bool (*retro_add_image_index_t)(void); + +struct retro_disk_control_callback +{ + retro_set_eject_state_t set_eject_state; + retro_get_eject_state_t get_eject_state; + + retro_get_image_index_t get_image_index; + retro_set_image_index_t set_image_index; + retro_get_num_images_t get_num_images; + + retro_replace_image_index_t replace_image_index; + retro_add_image_index_t add_image_index; +}; enum retro_pixel_format { diff --git a/frontend/main.c b/frontend/main.c index df2af8f..09f6a1c 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -680,6 +680,12 @@ static void toggle_fast_forward(int force_off) snprintf(hud_msg, sizeof(hud_msg), "FAST FORWARD %s", fast_forward ? "ON" : "OFF"); } + +static void SignalExit(int sig) { + // only to restore framebuffer/resolution on some devices + plat_finish(); + exit(1); +} #endif void SysRunGui() { @@ -813,10 +819,6 @@ void SysMessage(const char *fmt, ...) { SysPrintf("%s\n", msg); } -static void SignalExit(int sig) { - emu_core_ask_exit(); -} - #define PARSEPATH(dst, src) \ ptr = src + strlen(src); \ while (*ptr != '\\' && ptr != src) ptr--; \ @@ -827,8 +829,10 @@ static void SignalExit(int sig) { static int _OpenPlugins(void) { int ret; +#ifndef NO_FRONTEND signal(SIGINT, SignalExit); signal(SIGPIPE, SignalExit); +#endif GPU_clearDynarec(clearDynarec); @@ -919,8 +923,11 @@ int OpenPlugins() { void ClosePlugins() { int ret; +#ifndef NO_FRONTEND signal(SIGINT, SIG_DFL); signal(SIGPIPE, SIG_DFL); +#endif + ret = CDR_close(); if (ret < 0) { SysMessage(_("Error closing CD-ROM plugin!")); return; } ret = SPU_close(); diff --git a/frontend/menu.c b/frontend/menu.c index 46e4298..199020d 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -2080,12 +2080,12 @@ static int swap_cd_multidisk(void) static void load_pcsx_cht(void) { - const char *exts[] = { "cht", NULL }; + static const char *exts[] = { "cht", NULL }; const char *fname; - char path[256]; + char msg[64]; - path[0] = 0; - fname = menu_loop_romsel(path, sizeof(path), exts, NULL); + fname = menu_loop_romsel(last_selected_fname, + sizeof(last_selected_fname), exts, NULL); if (fname == NULL) return; @@ -2095,8 +2095,8 @@ static void load_pcsx_cht(void) if (NumCheats == 0 && NumCodes == 0) menu_update_msg("failed to load cheats"); else { - snprintf(path, sizeof(path), "%d cheat(s) loaded", NumCheats + NumCodes); - menu_update_msg(path); + snprintf(msg, sizeof(msg), "%d cheat(s) loaded", NumCheats + NumCodes); + menu_update_msg(msg); } me_enable(e_menu_main, MA_MAIN_CHEATS, ready_to_go && NumCheats); } diff --git a/frontend/pl_gun_ts.c b/frontend/pl_gun_ts.c index 661792c..315c70c 100644 --- a/frontend/pl_gun_ts.c +++ b/frontend/pl_gun_ts.c @@ -16,6 +16,14 @@ #include "pl_gun_ts.h" #include "menu.h" #include "../plugins/dfinput/externals.h" +#include "../plugins/dfinput/main.h" + +#ifdef MAEMO +#define N900_TSMAX_X 4096 +#define N900_TSOFFSET_X 0 +#define N900_TSMAX_Y 4096 +#define N900_TSOFFSET_Y 0 +#endif static int gun_x, gun_y, gun_in; static int ts_multiplier_x, ts_multiplier_y, ts_offs_x, ts_offs_y; @@ -34,7 +42,11 @@ int pl_gun_ts_update_raw(struct tsdev *ts, int *x, int *y, int *p) if (ts != NULL) { while (pts_read(ts, &sample, 1) > 0) { sx = sample.x; +#ifdef MAEMO + sy = N900_TSMAX_Y - sample.y; +#else sy = sample.y; +#endif sp = sample.pressure; updated = 1; } @@ -96,9 +108,13 @@ struct tsdev *pl_gun_ts_init(void) struct tsdev *ts; void *ltsh; +#ifdef MAEMO + tsdevname = "/dev/input/ts"; +#else tsdevname = getenv("TSLIB_TSDEVICE"); if (tsdevname == NULL) tsdevname = "/dev/input/touchscreen0"; +#endif // avoid hard dep on tslib ltsh = dlopen("/usr/lib/libts-1.0.so.0", RTLD_NOW|RTLD_GLOBAL); @@ -123,18 +139,27 @@ struct tsdev *pl_gun_ts_init(void) } ts = pts_open(tsdevname, 1); - if (ts == NULL) + if (ts == NULL){ + printf("Failed pts_open, check permission on %s\n", tsdevname); goto fail_open; - if (pts_config(ts) != 0) + } + if (pts_config(ts) != 0){ + printf("Failed pts_config\n"); goto fail_config; + } // FIXME: we should be able to get this somewhere // the problem is this doesn't always match resolution due to different display modes +#ifdef MAEMO + pl_set_gun_rect(N900_TSOFFSET_X, N900_TSOFFSET_Y, N900_TSMAX_X, N900_TSMAX_Y); +#else #ifdef __ARM_ARCH_7A__ pl_set_gun_rect(0, 0, 800, 480); #else pl_set_gun_rect(0, 0, 320, 240); #endif +#endif + printf("Touchscreen configured, device=%s\n", tsdevname); return ts; fail_config: diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c index dacf584..247437e 100644 --- a/frontend/plat_sdl.c +++ b/frontend/plat_sdl.c @@ -98,6 +98,7 @@ static void get_layer_pos(int *x, int *y, int *w, int *h) void plat_init(void) { + int shadow_size; int ret; plat_sdl_quit_cb = quit_cb; @@ -110,8 +111,12 @@ void plat_init(void) in_menu = 1; SDL_WM_SetCaption("PCSX-ReARMed " REV, NULL); - shadow_fb = malloc(640 * 512 * 2); - menubg_img = malloc(640 * 512 * 2); + shadow_size = g_menuscreen_w * g_menuscreen_h * 2; + if (shadow_size < 640 * 512 * 2) + shadow_size = 640 * 512 * 2; + + shadow_fb = malloc(shadow_size); + menubg_img = malloc(shadow_size); if (shadow_fb == NULL || menubg_img == NULL) { fprintf(stderr, "OOM\n"); exit(1); diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index a3dcbab..72b3395 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -582,9 +582,7 @@ static void update_input(void) in_keystate = actions[IN_BINDTYPE_PLAYER12]; } #else /* MAEMO */ -static void update_input(void) -{ -} +extern void update_input(void); #endif void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in) diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 21203da..dde21bc 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -1316,8 +1316,12 @@ static long CALLBACK ISOclose(void) { } } numtracks = 0; + ti[1].type = 0; UnloadSBI(); + memset(cdbuffer, 0, sizeof(cdbuffer)); + CDR_getBuffer = ISOgetBuffer; + return 0; } @@ -1400,6 +1404,7 @@ static void DecodeRawSubData(void) { // uses bcd format static long CALLBACK ISOreadTrack(unsigned char *time) { int sector = MSF2SECT(btoi(time[0]), btoi(time[1]), btoi(time[2])); + long ret; if (cdHandle == NULL) { return -1; @@ -1414,7 +1419,9 @@ static long CALLBACK ISOreadTrack(unsigned char *time) { } } - cdimg_read_func(cdHandle, 0, cdbuffer, sector); + ret = cdimg_read_func(cdHandle, 0, cdbuffer, sector); + if (ret < 0) + return -1; if (subHandle != NULL) { fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET); diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 966bb70..38fecf7 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -205,7 +205,7 @@ static void sec2msf(unsigned int s, u8 *msf) { cdr.Reading = 0; \ psxRegs.interrupt &= ~(1 << PSXINT_CDREAD); \ } \ - cdr.StatP &= ~STATUS_READ;\ + cdr.StatP &= ~(STATUS_READ|STATUS_SEEK);\ } #define StopCdda() { \ @@ -492,7 +492,10 @@ void cdrPlayInterrupt() setIrq(); } - memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); + if (cdr.SetlocPending) { + memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); + cdr.SetlocPending = 0; + } Find_CurTrack(cdr.SetSectorPlay); ReadTrack(cdr.SetSectorPlay); cdr.TrackChanged = FALSE; @@ -574,13 +577,17 @@ void cdrInterrupt() { case CdlSetloc: break; + do_CdlPlay: case CdlPlay: StopCdda(); if (cdr.Seeked == SEEK_PENDING) { // XXX: wrong, should seek instead.. - memcpy( cdr.SetSectorPlay, cdr.SetSector, 4 ); cdr.Seeked = SEEK_DONE; } + if (cdr.SetlocPending) { + memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); + cdr.SetlocPending = 0; + } // BIOS CD Player // - Pause player, hit Track 01/02/../xx (Setloc issued!!) @@ -900,13 +907,22 @@ void cdrInterrupt() { case CdlReadN: case CdlReadS: + if (cdr.SetlocPending) { + memcpy(cdr.SetSectorPlay, cdr.SetSector, 4); + cdr.SetlocPending = 0; + } + Find_CurTrack(cdr.SetSectorPlay); + + if ((cdr.Mode & MODE_CDDA) && cdr.CurTrack > 1) + // Read* acts as play for cdda tracks in cdda mode + goto do_CdlPlay; + cdr.Reading = 1; cdr.FirstSector = 1; // Fighting Force 2 - update subq time immediately // - fixes new game - Find_CurTrack(cdr.SetSector); - ReadTrack(cdr.SetSector); + ReadTrack(cdr.SetSectorPlay); // Crusaders of Might and Magic - update getlocl now @@ -1057,7 +1073,7 @@ void cdrReadInterrupt() { cdr.Result[0] = cdr.StatP; cdr.Seeked = SEEK_DONE; - ReadTrack(cdr.SetSector); + ReadTrack(cdr.SetSectorPlay); buf = CDR_getBuffer(); if (buf == NULL) @@ -1098,13 +1114,13 @@ void cdrReadInterrupt() { } } - cdr.SetSector[2]++; - if (cdr.SetSector[2] == 75) { - cdr.SetSector[2] = 0; - cdr.SetSector[1]++; - if (cdr.SetSector[1] == 60) { - cdr.SetSector[1] = 0; - cdr.SetSector[0]++; + cdr.SetSectorPlay[2]++; + if (cdr.SetSectorPlay[2] == 75) { + cdr.SetSectorPlay[2] = 0; + cdr.SetSectorPlay[1]++; + if (cdr.SetSectorPlay[1] == 60) { + cdr.SetSectorPlay[1] = 0; + cdr.SetSectorPlay[0]++; } } @@ -1124,7 +1140,7 @@ void cdrReadInterrupt() { } // update for CdlGetlocP - ReadTrack(cdr.SetSector); + ReadTrack(cdr.SetSectorPlay); } /* @@ -1218,18 +1234,14 @@ void cdrWrite1(unsigned char rt) { for (i = 0; i < 3; i++) set_loc[i] = btoi(cdr.Param[i]); - // FIXME: clean up this SetSector/SetSectorPlay mess, - // there should be single var tracking current sector pos - if (cdr.Play) - i = msf2sec(cdr.SetSectorPlay); - else - i = msf2sec(cdr.SetSector); + i = msf2sec(cdr.SetSectorPlay); i = abs(i - msf2sec(set_loc)); if (i > 16) cdr.Seeked = SEEK_PENDING; memcpy(cdr.SetSector, set_loc, 3); cdr.SetSector[3] = 0; + cdr.SetlocPending = 1; break; case CdlReadN: @@ -1467,7 +1479,7 @@ int cdrFreeze(void *f, int Mode) { if (Mode == 0 && !Config.Cdda) CDR_stop(); - cdr.freeze_ver = 0x63647201; + cdr.freeze_ver = 0x63647202; gzfreeze(&cdr, sizeof(cdr)); if (Mode == 1) { @@ -1488,6 +1500,9 @@ int cdrFreeze(void *f, int Mode) { ReadTrack(tmpp); if (cdr.Play) { + if (cdr.freeze_ver < 0x63647202) + memcpy(cdr.SetSectorPlay, cdr.SetSector, 3); + Find_CurTrack(cdr.SetSectorPlay); if (!Config.Cdda) CDR_play(cdr.SetSectorPlay); diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h index 5d7c358..543c619 100644 --- a/libpcsxcore/cdrom.h +++ b/libpcsxcore/cdrom.h @@ -73,13 +73,14 @@ typedef struct { unsigned char ResultReady; unsigned char Cmd; unsigned char Readed; + unsigned char SetlocPending; u32 Reading; unsigned char ResultTN[6]; unsigned char ResultTD[4]; - unsigned char SetSector[4]; - unsigned char SetSectorEnd[4]; unsigned char SetSectorPlay[4]; + unsigned char SetSectorEnd[4]; + unsigned char SetSector[4]; unsigned char Track; boolean Play, Muted; int CurTrack; diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index bab5ec8..21c9669 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -279,6 +279,8 @@ int tracedebug=0; //#define DEBUG_CYCLE_COUNT 1 +#define NO_CYCLE_PENALTY_THR 12 + int cycle_multiplier; // 100 for 1.0 static int CLOCK_ADJUST(int x) @@ -4981,6 +4983,7 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) int count; int jaddr; int idle=0; + int t=0; if(itype[i]==RJUMP) { *adj=0; @@ -4988,7 +4991,7 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) //if(ba[i]>=start && ba[i]<(start+slen*4)) if(internal_branch(branch_regs[i].is32,ba[i])) { - int t=(ba[i]-start)>>2; + t=(ba[i]-start)>>2; if(is_ds[t]) *adj=-1; // Branch into delay slot adds an extra cycle else *adj=ccadj[t]; } @@ -5007,7 +5010,14 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) emit_jmp(0); } else if(*adj==0||invert) { - emit_addimm_and_set_flags(CLOCK_ADJUST(count+2),HOST_CCREG); + int cycles=CLOCK_ADJUST(count+2); + // faster loop HACK + if (t&&*adj) { + int rel=t-i; + if(-NO_CYCLE_PENALTY_THR<rel&&rel<0) + cycles=CLOCK_ADJUST(*adj)+count+2-*adj; + } + emit_addimm_and_set_flags(cycles,HOST_CCREG); jaddr=(int)out; emit_jns(0); } @@ -9853,7 +9863,7 @@ int new_recompile_block(int addr) // GTE runs in parallel until accessed, divide by 2 for a rough guess cc+=gte_cycletab[source[i]&0x3f]/2; } - else if(/*itype[i]==LOAD||*/itype[i]==STORE||itype[i]==C1LS) // load causes weird timing issues + else if(/*itype[i]==LOAD||itype[i]==STORE||*/itype[i]==C1LS) // load,store causes weird timing issues { cc+=2; // 2 cycle penalty (after CLOCK_DIVIDER) } diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c index a42852a..3d14904 100644 --- a/libpcsxcore/new_dynarec/pcsxmem.c +++ b/libpcsxcore/new_dynarec/pcsxmem.c @@ -338,11 +338,17 @@ void new_dyna_pcsx_mem_init(void) // scratchpad map_l1_mem(mem_readtab, 0, 0x1f800000, 0x1000, psxH); + map_l1_mem(mem_readtab, 0, 0x9f800000, 0x1000, psxH); map_l1_mem(mem_writetab, 0, 0x1f800000, 0x1000, psxH); + map_l1_mem(mem_writetab, 0, 0x9f800000, 0x1000, psxH); // I/O map_item(&mem_readtab[0x1f801000 >> 12], mem_iortab, 1); + map_item(&mem_readtab[0x9f801000 >> 12], mem_iortab, 1); + map_item(&mem_readtab[0xbf801000 >> 12], mem_iortab, 1); map_item(&mem_writetab[0x1f801000 >> 12], mem_iowtab, 1); + map_item(&mem_writetab[0x9f801000 >> 12], mem_iowtab, 1); + map_item(&mem_writetab[0xbf801000 >> 12], mem_iowtab, 1); // L2 // unmapped tables diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index b3435ad..12c17ef 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -1837,7 +1837,8 @@ int nfile; if ((*ptr & 0xF0) != 0x50) continue; \ ptr+= 0xa; \ if (pfile[0] == 0) { \ - strcpy(dir->name, ptr); \ + strncpy(dir->name, ptr, sizeof(dir->name)); \ + dir->name[sizeof(dir->name) - 1] = '\0'; \ } else for (i=0; i<20; i++) { \ if (pfile[i] == ptr[i]) { \ dir->name[i] = ptr[i]; \ diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index 9e44267..f12a981 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -198,7 +198,7 @@ void psxMemReset() { void psxMemShutdown() { psxUnmap(psxM, 0x00210000, MAP_TAG_RAM); - psxUnmap(psxH, 0x1f800000, MAP_TAG_OTHER); + psxUnmap(psxH, 0x10000, MAP_TAG_OTHER); psxUnmap(psxR, 0x80000, MAP_TAG_OTHER); free(psxMemRLUT); @@ -212,8 +212,8 @@ u8 psxMemRead8(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu8(mem); else return psxHwRead8(mem); @@ -237,8 +237,8 @@ u16 psxMemRead16(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu16(mem); else return psxHwRead16(mem); @@ -262,8 +262,8 @@ u32 psxMemRead32(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return psxHu32(mem); else return psxHwRead32(mem); @@ -287,8 +287,8 @@ void psxMemWrite8(u32 mem, u8 value) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu8(mem) = value; else psxHwWrite8(mem, value); @@ -314,8 +314,8 @@ void psxMemWrite16(u32 mem, u16 value) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu16ref(mem) = SWAPu16(value); else psxHwWrite16(mem, value); @@ -342,8 +342,8 @@ void psxMemWrite32(u32 mem, u32 value) { // if ((mem&0x1fffff) == 0x71E18 || value == 0x48088800) SysPrintf("t2fix!!\n"); t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) psxHu32ref(mem) = SWAPu32(value); else psxHwWrite32(mem, value); @@ -400,8 +400,8 @@ void *psxMemPointer(u32 mem) { u32 t; t = mem >> 16; - if (t == 0x1f80) { - if (mem < 0x1f801000) + if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) { + if ((mem & 0xffff) < 0x400) return (void *)&psxH[mem]; else return NULL; diff --git a/maemo/hildon.c b/maemo/hildon.c index 43e3e15..bd895c9 100644 --- a/maemo/hildon.c +++ b/maemo/hildon.c @@ -4,26 +4,52 @@ #include <stdint.h> #include <unistd.h> #include <hildon/hildon.h> - -#include "plugin_lib.h" -#include "main.h" -#include "plat.h" -#include "../libpcsxcore/psemu_plugin_defs.h" -#include "libpicofe/readpng.h" +#include <string.h> +#include <pthread.h> + +#include "../frontend/plugin_lib.h" +#include "../frontend/main.h" +#include "../libpcsxcore/misc.h" +#include "../include/psemu_plugin_defs.h" +#include "../libpcsxcore/cdrom.h" +#include "../libpcsxcore/cdriso.h" +#include "../plugins/dfinput/main.h" +#include "../frontend/libpicofe/readpng.h" #include "maemo_common.h" +#include <libosso.h> +#include <dbus/dbus.h> #define X_RES 800 #define Y_RES 480 #define D_WIDTH 640 #define D_HEIGHT 480 +#define CALL_SIGNAL_IF "com.nokia.csd.Call" +#define CALL_SIGNAL_PATH "/com/nokia/csd/call" +#define CALL_INCOMING_SIG "Coming" + +#define DBUS_RULE_CALL_INCOMING "type='signal',interface='" CALL_SIGNAL_IF \ + "',path='" CALL_SIGNAL_PATH \ + "',member='" CALL_INCOMING_SIG "'" + +osso_context_t* osso = NULL; +int bRunning = TRUE; +extern int bKeepDisplayOn; +extern int bAutosaveOnExit; +extern int cornerActions[4]; +extern char keys_config_file[MAXPATHLEN]; +static pthread_t display_thread = (pthread_t)0; +int g_layer_x = (X_RES - D_WIDTH) / 2; +int g_layer_y = (Y_RES - D_HEIGHT) / 2; +int g_layer_w = D_WIDTH, g_layer_h = D_HEIGHT; + static GdkImage *image; static HildonAnimationActor *actor; -static GtkWidget *window, *drawing; +static GtkWidget *window, *drawing = NULL; static int pl_buf_w, pl_buf_h; -static int sens, y_def; -static int keymap[65536]; +int keymap[65536]; +int direction_keys[4]; // map psx4m compatible keymap to PSX keys static const unsigned char keymap2[14] = { @@ -37,34 +63,379 @@ static const unsigned char keymap2[14] = { DKEY_SQUARE, DKEY_SELECT, DKEY_START, - DKEY_L2, // 10 - DKEY_R2, - DKEY_L1, + DKEY_L1, // 10 DKEY_R1, + DKEY_L2, + DKEY_R2, }; void hildon_quit() { + maemo_finish(); gtk_main_quit(); exit(0); } +gdouble press_x = -1; +gdouble press_y = -1; + +int maemo_x11_update_keys(); +void show_notification(char* text); + +void change_slot(int delta) +{ + state_slot += delta; + if (state_slot > 9) + state_slot = 0; + else if (state_slot < 0) + state_slot = 9; + char message[50]; + sprintf(message,"Savestate slot: %i",state_slot + 1); + show_notification(message); +} + +void save(int state_slot) +{ + emu_save_state(state_slot); + char buf[MAXPATHLEN]; + if (image && image->mem){ + sprintf (buf,"/opt/maemo/usr/games/screenshots%s.%3.3d",file_name,state_slot); + writepng(buf, image->mem, pl_buf_w,pl_buf_h); + } + char message[50]; + sprintf(message,"Saved savestate slot: %i",state_slot + 1); + show_notification(message); +} + +void quit() +{ + if (bAutosaveOnExit){ + show_notification("Autosaving"); + emu_save_state(99); + char buf[MAXPATHLEN]; + if (image && image->mem){ + sprintf (buf,"/opt/maemo/usr/games/screenshots%s.%3.3d",file_name,99); + writepng(buf, image->mem, pl_buf_w,pl_buf_h); + } + } + hildon_quit(); +} + +int show_confirmbox(char* text) +{ + if (!window) + return TRUE; + + GtkWidget *dialog; + dialog = gtk_message_dialog_new (GTK_WINDOW(window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + text); + gint result = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + if (result == GTK_RESPONSE_YES) + return TRUE; + return FALSE; +} + +static void +window_button_proxy(GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + int corner = -1; + int sens = 100; + + switch (event->type){ + case GDK_BUTTON_PRESS: + //printf("GDK_BUTTON_PRESS: x=%f y=%f\n", event->x, event->y); + press_x = event->x; + press_y = event->y; + break; + case GDK_BUTTON_RELEASE: + //printf("GDK_BUTTON_RELEASE: x=%f y=%f\n", event->x, event->y); + if (press_x < sens && press_y < sens && event->x < sens && event->y < sens) + corner = 0; + else if (press_x > 800 - sens && press_y < sens && event->x > 800 - sens && event->y < sens) + corner = 1; + else if (press_x > 800 - sens && press_y > 480 - sens && event->x > 800 - sens && event->y > 480 - sens) + corner = 2; + else if (press_x < sens && press_y > 480 - sens && event->x < sens && event->y > 480 - sens) + corner = 3; + + press_x = -1; + press_y = -1; + break; + default: + break; + } + + if (corner >= 0){ + switch (cornerActions[corner]){ + case 1: + if (show_confirmbox("Save savestate?")) + save(state_slot); + break; + case 2: + if (show_confirmbox("Load savestate?")) + emu_load_state(state_slot); + break; + case 3: + change_slot(1); + break; + case 4: + change_slot(-1); + break; + case 5: + if (show_confirmbox("Quit?")) + quit(); + break; + } + } +} + +static void *displayThread(void *arg) +{ + DBusConnection* system_bus = (DBusConnection*)osso_get_sys_dbus_connection(osso); + DBusMessage* msg = dbus_message_new_method_call("com.nokia.mce", + "/com/nokia/mce/request", + "com.nokia.mce.request", + "req_display_blanking_pause"); + if (msg && system_bus) { + bRunning = TRUE; + while (bRunning) { + dbus_connection_send(system_bus, msg, NULL); + dbus_connection_flush(system_bus); + int i = 0; + for (i=0; i<8; i++){ + usleep(500000); + if (!bRunning) + break; + } + } + dbus_message_unref(msg); + } + + pthread_exit(0); + return NULL; +} + +void show_notification(char* text) +{ + if (window){ + GtkWidget* banner = hildon_banner_show_information(GTK_WIDGET(window), NULL, text); + hildon_banner_set_timeout(HILDON_BANNER(banner), 3000); + }else{ + DBusConnection* session_bus = (DBusConnection*)osso_get_dbus_connection(osso); + DBusMessageIter args; + DBusMessage*msg = dbus_message_new_method_call("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + "SystemNoteInfoprint"); + if (msg) { + dbus_message_iter_init_append(msg, &args); + char* param = text; + if (dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, ¶m)) { + dbus_connection_send(session_bus, msg, NULL); + dbus_connection_flush(session_bus); + } + dbus_message_unref(msg); + } + } +} + +void show_messagebox(char* text) +{ + if (!window) + return; + + GtkWidget *dialog; + dialog = gtk_message_dialog_new (GTK_WINDOW(window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + text); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +} + +#include <hildon/hildon-file-chooser-dialog.h> +void change_disc() +{ + GtkWidget *dialog; + dialog = hildon_file_chooser_dialog_new (GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN); + gtk_window_set_title (GTK_WINDOW (dialog), "Change disc"); + + char currentFile[MAXPATHLEN]; + strcpy(currentFile, GetIsoFile()); + if (strlen(currentFile)) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(dialog), currentFile); + else + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), "/home/user/MyDocs/"); + + GtkFileFilter *filter=gtk_file_filter_new(); + gtk_file_filter_add_pattern (filter,"*.bin"); + gtk_file_filter_add_pattern (filter,"*.BIN"); + gtk_file_filter_add_pattern (filter,"*.iso"); + gtk_file_filter_add_pattern (filter,"*.ISO"); + gtk_file_filter_add_pattern (filter,"*.img"); + gtk_file_filter_add_pattern (filter,"*.IMG"); + gtk_file_filter_add_pattern (filter,"*.z"); + gtk_file_filter_add_pattern (filter,"*.Z"); + gtk_file_filter_add_pattern (filter,"*.znx"); + gtk_file_filter_add_pattern (filter,"*.ZNX"); + gtk_file_filter_add_pattern (filter,"*.pbp"); + gtk_file_filter_add_pattern (filter,"*.PBP"); + gtk_file_filter_add_pattern (filter,"*.mdf"); + gtk_file_filter_add_pattern (filter,"*.MDF"); + gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog),filter); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { + char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + + //if (strcmp(filename, currentFile)) { + CdromId[0] = '\0'; + CdromLabel[0] = '\0'; + + set_cd_image(filename); + if (ReloadCdromPlugin() < 0) + printf("Failed to load cdr plugin\n"); + + if (CDR_open() < 0) + printf("Failed to open cdr plugin\n"); + + strcpy(file_name, strrchr(filename,'/')); + + SetCdOpenCaseTime(time(NULL) + 3); + LidInterrupt(); + //} + g_free (filename); + } + + gtk_widget_destroy (dialog); +} + +void change_multi_disc() +{ + HildonDialog* window = HILDON_DIALOG(hildon_dialog_new()); + gtk_window_set_title (GTK_WINDOW (window), "Change disc"); + gtk_window_set_default_size(GTK_WINDOW (window), 480, 300); + + GtkWidget* sw = hildon_pannable_area_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(window)->vbox), sw, TRUE, TRUE, 0); + + GtkWidget* tree_view = hildon_gtk_tree_view_new (HILDON_UI_MODE_EDIT); + gtk_widget_set_name (tree_view, "fremantle-widget"); + + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE); + + int i; + GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); + for (i = 0; i < cdrIsoMultidiskCount; i++) { + gchar *str; + + str = g_strdup_printf ("Disc %d", i+1); + gtk_list_store_insert_with_values (store, NULL, i, 0, str, -1); + g_free (str); + } + GtkTreeModel* model = GTK_TREE_MODEL (store); + + gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model); + g_object_unref (model); + + GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + + GtkCellRenderer* renderer = gtk_cell_renderer_text_new (); + g_object_set (renderer, + "xalign", 0.5, + "weight", PANGO_WEIGHT_NORMAL, + NULL); + + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), + 0, "Column 0", + renderer, + "text", 0, + NULL); + + char current[5]; + sprintf(current, "%i", cdrIsoMultidiskSelect); + GtkTreePath* path = gtk_tree_path_new_from_string(current); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free(path); + + gtk_widget_set_size_request (tree_view, 480, 800); + gtk_container_add (GTK_CONTAINER (sw), tree_view); + + hildon_dialog_add_button (HILDON_DIALOG(window), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); + + gtk_widget_show_all (GTK_WIDGET(window)); + gint result = gtk_dialog_run (GTK_DIALOG (window)); + if (result == GTK_RESPONSE_ACCEPT) { + GtkTreeModel* model; + GtkTreeIter iter; + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); + if (gtk_tree_selection_get_selected(selection, &model, &iter)){ + GtkTreePath* path = gtk_tree_model_get_path(model , &iter); + int* i = gtk_tree_path_get_indices(path) ; + + cdrIsoMultidiskSelect = *i; + CdromId[0] = '\0'; + CdromLabel[0] = '\0'; + + CDR_close(); + if (CDR_open() < 0) { + printf("Failed to load cdr plugin\n"); + return; + } + + SetCdOpenCaseTime(time(NULL) + 3); + LidInterrupt(); + } + } + gtk_widget_destroy(GTK_WIDGET(window)); +} + +static DBusHandlerResult on_msg_recieved(DBusConnection* connection G_GNUC_UNUSED, DBusMessage* message, void* data) +{ + const char* path = dbus_message_get_path(message); + if (path && g_str_equal(path, CALL_SIGNAL_PATH)){ + const char* mbr = dbus_message_get_member(message); + if (mbr && g_str_equal(mbr, CALL_INCOMING_SIG)) + show_messagebox("Paused"); + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + static void window_key_proxy(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { - int key, psxkey1 = -1, psxkey2 = -1; + key_press_event(event->hardware_keycode, event->type == GDK_KEY_PRESS ? 1 : (event->type == GDK_KEY_RELEASE ? 2 : 0) ); +} + +int last_key_pressed = 0; +inline void key_press_event(int key2,int type) +{ + int psxkey1 = -1, psxkey2 = -1; + int key=keymap[key2]; - key = keymap[event->hardware_keycode]; if (key < 0) return; - if (key < ARRAY_SIZE(keymap2)) + if (type == 1 && key2 == last_key_pressed) + return; + last_key_pressed = type == 1 ? key2 : 0; + + //printf("Key: %i %s\n", key2, type == 1 ? "Pressed" : (type == 2 ? "Released" : "Unknown")); + if (key < ARRAY_SIZE(keymap2)){ psxkey1 = keymap2[key]; - else switch (key) { + }else switch (key) { case 14: - hildon_quit(); + quit(); break; case 15: psxkey1 = DKEY_UP; @@ -83,42 +454,108 @@ window_key_proxy(GtkWidget *widget, psxkey2 = DKEY_RIGHT; break; case 19: - if (event->type == GDK_KEY_PRESS) - { - emu_save_state(state_slot); - char buf[MAXPATHLEN]; - sprintf (buf,"/opt/maemo/usr/games/screenshots%s.%3.3d",file_name,state_slot); - writepng(buf, image->mem, pl_buf_w,pl_buf_h); - } + if (type == 1) + save(state_slot); return; case 20: - if (event->type == GDK_KEY_PRESS) + if (type == 1) emu_load_state(state_slot); return; case 21: - if (event->type == GDK_KEY_PRESS) - state_slot=(state_slot<9)?state_slot+1:0; + if (type == 1) + change_slot(1); return; case 22: - if (event->type == GDK_KEY_PRESS) - state_slot=(state_slot>0)?state_slot-1:8; + if (type == 1) + change_slot(-1); + return; + case 23: + if (type == 1){ + if (cdrIsoMultidiskCount > 1) + change_multi_disc(); + else + change_disc(); + } return; } - if (event->type == GDK_KEY_PRESS) { + if (in_type1 == PSE_PAD_TYPE_GUNCON){ + if (type == 1) { + switch (psxkey1){ + case DKEY_CROSS: + in_state_gun |= SACTION_GUN_A; + break; + case DKEY_CIRCLE: + in_state_gun |= SACTION_GUN_B; + break; + case DKEY_TRIANGLE: + in_state_gun |= SACTION_GUN_TRIGGER2; + break; + case DKEY_SQUARE: + in_state_gun |= SACTION_GUN_TRIGGER; + break; + } + }else if (type == 2) { + switch (psxkey1){ + case DKEY_CROSS: + in_state_gun &= ~SACTION_GUN_A; + break; + case DKEY_CIRCLE: + in_state_gun &= ~SACTION_GUN_B; + break; + case DKEY_TRIANGLE: + in_state_gun &= ~SACTION_GUN_TRIGGER2; + break; + case DKEY_SQUARE: + in_state_gun &= ~SACTION_GUN_TRIGGER; + break; + } + } + }else{ + if (type == 1) { if (psxkey1 >= 0) in_keystate |= 1 << psxkey1; if (psxkey2 >= 0) in_keystate |= 1 << psxkey2; + + if (in_type1 == PSE_PAD_TYPE_ANALOGPAD){ + switch(psxkey1){ + case DKEY_LEFT: + in_a1[0] = 0; + break; + case DKEY_RIGHT: + in_a1[0] = 255; + break; + case DKEY_UP: + in_a1[1] = 0; + break; + case DKEY_DOWN: + in_a1[1] = 255; + break; + } } - else if (event->type == GDK_KEY_RELEASE) { + } + else if (type == 2) { if (psxkey1 >= 0) in_keystate &= ~(1 << psxkey1); if (psxkey2 >= 0) in_keystate &= ~(1 << psxkey2); + if (in_type1 == PSE_PAD_TYPE_ANALOGPAD){ + switch(psxkey1){ + case DKEY_LEFT: + case DKEY_RIGHT: + in_a1[0] = 127; + break; + case DKEY_UP: + case DKEY_DOWN: + in_a1[1] = 127; + break; + } + } emu_set_action(SACTION_NONE); } + } } void plat_finish() @@ -126,36 +563,73 @@ void plat_finish() hildon_quit(); } -void maemo_init(int *argc, char ***argv) +void set_accel_multipliers() +{ + accelOptions.xMultiplier = 255.0 / ( (accelOptions.maxValue - accelOptions.sens) * 2.0); + accelOptions.yMultiplier = 255.0 / ( (accelOptions.maxValue - accelOptions.sens) * 2.0); +} + +#include <gdk/gdkx.h> +int maemo_init(int *argc, char ***argv) { + osso = osso_initialize("pcsxrearmed", PACKAGE_VERSION, FALSE, NULL); + + DBusConnection* system_bus = (DBusConnection*)osso_get_sys_dbus_connection(osso); + dbus_bus_add_match(system_bus, DBUS_RULE_CALL_INCOMING, NULL); + dbus_connection_add_filter(system_bus, on_msg_recieved, NULL, NULL); + FILE* pFile; - pFile = fopen("/opt/psx4m/keys", "r"); // assume the file exists and has data + pFile = fopen(keys_config_file, "r"); + if (pFile == NULL){ + fprintf(stderr, "Error opening keys config file %s\n", keys_config_file); + return 1; + } + printf("Keys config read from %s\n", keys_config_file); + int ch; int i=0; for (i=0;i<65536;i++) - keymap[i]=164; + keymap[i]=-1; if (NULL != pFile) { - for(i=0;i<21;i++){ + for(i=0;i<24;i++){ fscanf(pFile, "%i",&ch); keymap[ch]=i; + if (i < 4) + direction_keys[i] = ch; } fclose(pFile); } - pFile = fopen("/opt/psx4m/config", "r"); - if (NULL != pFile) { - fscanf(pFile, "%d %d",&sens,&y_def); - fclose(pFile); - } else { - sens=150; - y_def=500; //near 45 degrees =) + switch (in_type1){ + case PSE_PAD_TYPE_GUNCON: + memset(cornerActions, 0, sizeof(cornerActions)); + printf("Controller set to GUNCON (SLPH-00034)\n"); + break; + case PSE_PAD_TYPE_STANDARD: + printf("Controller set to standard (SCPH-1080)\n"); + break; + case PSE_PAD_TYPE_ANALOGPAD: + printf("Controller set to analog (SCPH-1150)\n"); + break; } + if (in_enable_vibration) + printf("Vibration enabled\n"); + + if (!(g_maemo_opts&8)){ gtk_init (argc, argv); window = hildon_stackable_window_new (); gtk_widget_realize (window); gtk_window_fullscreen (GTK_WINDOW(window)); + + if (cornerActions[0] + cornerActions[1] + cornerActions[2] + cornerActions[3] > 0){ + g_signal_connect (G_OBJECT (window), "button_release_event", + G_CALLBACK (window_button_proxy), NULL); + g_signal_connect (G_OBJECT (window), "button_press_event", + G_CALLBACK (window_button_proxy), NULL); + } + g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK (window_key_proxy), NULL); g_signal_connect (G_OBJECT (window), "key-release-event", @@ -178,18 +652,50 @@ void maemo_init(int *argc, char ***argv) gtk_widget_show_all (GTK_WIDGET (actor)); gtk_widget_show_all (GTK_WIDGET (window)); + }else{ + gtk_init (argc, argv); + /*GdkScreen* scr = gdk_screen_get_default(); + window = GTK_WIDGET(gdk_screen_get_root_window(scr)); + if (!window) + window = GTK_WIDGET(gdk_get_default_root_window());*/ + } - g_layer_x = (X_RES - D_WIDTH) / 2; - g_layer_y = (Y_RES - D_HEIGHT) / 2; - g_layer_w = D_WIDTH, g_layer_h = D_HEIGHT; + set_accel_multipliers(); + + if (bKeepDisplayOn){ + if (pthread_create(&display_thread, NULL, displayThread, NULL)) + printf("Failed to create display thread.\n"); + } pl_rearmed_cbs.only_16bpp = 1; + return 0; +} + +void maemo_finish() +{ + if (display_thread > 0){ + bRunning = FALSE; + pthread_join(display_thread, NULL); + } + + if (osso){ + osso_deinitialize(osso); + osso = NULL; + } + printf("Exiting\n"); +} + +void menu_loop(void) +{ } void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_) { int w = *w_, h = *h_; + if (g_maemo_opts&8) return pl_vout_buf; + //printf("Setting video mode %ix%i\n", w, h); + if (w <= 0 || h <= 0) return pl_vout_buf; @@ -217,39 +723,76 @@ void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_) void *plat_gvideo_flip(void) { - gtk_widget_queue_draw (drawing); + if (!(g_maemo_opts&8)) + gtk_widget_queue_draw(drawing); // process accelometer if (g_maemo_opts & 4) { - int x, y, z; + float x, y, z; FILE* f = fopen( "/sys/class/i2c-adapter/i2c-3/3-001d/coord", "r" ); if( !f ) {printf ("err in accel"); exit(1);} - fscanf( f, "%d %d %d", &x, &y, &z ); + fscanf( f, "%f %f %f", &x, &y, &z ); fclose( f ); - if( x > sens ) in_keystate |= 1 << DKEY_LEFT; - else if( x < -sens ) in_keystate |= 1 << DKEY_RIGHT; + if (in_type1 == PSE_PAD_TYPE_ANALOGPAD){ + if (x > accelOptions.maxValue) x = accelOptions.maxValue; + else if (x < -accelOptions.maxValue) x = -accelOptions.maxValue; + + const int maxValue = accelOptions.maxValue - accelOptions.sens; + if(x > accelOptions.sens){ + x -= accelOptions.sens; + in_a1[0] = (-x + maxValue ) * accelOptions.xMultiplier; + }else if (x < -accelOptions.sens){ + x += accelOptions.sens; + in_a1[0] = (-x + maxValue ) * accelOptions.xMultiplier; + }else in_a1[0] = 127; + + y += accelOptions.y_def; + if (y > accelOptions.maxValue) y = accelOptions.maxValue; + else if (y < -accelOptions.maxValue) y = -accelOptions.maxValue; + + if(y > accelOptions.sens){ + y -= accelOptions.sens; + in_a1[1] = (-y + maxValue ) * accelOptions.yMultiplier; + }else if (y < -accelOptions.sens){ + y += accelOptions.sens; + in_a1[1] = (-y + maxValue ) * accelOptions.yMultiplier; + }else in_a1[1] = 127; + + //printf("x: %i y: %i\n", in_a1[0], in_a1[1]); + }else{ + if( x > accelOptions.sens ) in_keystate |= 1 << DKEY_LEFT; + else if( x < -accelOptions.sens ) in_keystate |= 1 << DKEY_RIGHT; else {in_keystate &= ~(1 << DKEY_LEFT);in_keystate &= ~(1 << DKEY_RIGHT);} - y+=y_def; - if( y > sens )in_keystate |= 1 << DKEY_UP; - else if( y < -sens ) in_keystate |= 1 << DKEY_DOWN; + y += accelOptions.y_def; + if( y > accelOptions.sens )in_keystate |= 1 << DKEY_UP; + else if( y < -accelOptions.sens ) in_keystate |= 1 << DKEY_DOWN; else {in_keystate &= ~(1 << DKEY_DOWN);in_keystate &= ~(1 << DKEY_UP);} - + } } - /* process GTK+ events */ - while (gtk_events_pending()) - gtk_main_iteration(); - return pl_vout_buf; } -void plat_gvideo_open(int is_pal) +// for frontend/plugin_lib.c +void update_input(void) { + if (g_maemo_opts & 8) + maemo_x11_update_keys(); + else { + /* process GTK+ events */ + while (gtk_events_pending()) + gtk_main_iteration(); + } } -void plat_gvideo_close(void) +int omap_enable_layer(int enabled) +{ + return 0; +} + +void menu_notify_mode_change(int w, int h, int bpp) { } @@ -258,10 +801,42 @@ void *plat_prepare_screenshot(int *w, int *h, int *bpp) return NULL; } +void plat_step_volume(int is_up) +{ +} + void plat_trigger_vibrate(int is_strong) { + const int vDuration = 10; + + DBusConnection* system_bus = (DBusConnection*)osso_get_sys_dbus_connection(osso); + DBusMessageIter args; + DBusMessage*msg = dbus_message_new_method_call("com.nokia.mce", + "/com/nokia/mce/request", + "com.nokia.mce.request", + "req_start_manual_vibration"); + if (msg) { + dbus_message_iter_init_append(msg, &args); + int speed = is_strong ? 200 : 150; + int duration = vDuration; + if (dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &speed)) { + if (dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &duration)) { + dbus_connection_send(system_bus, msg, NULL); + //dbus_connection_flush(system_bus); + } + } + dbus_message_unref(msg); + } } -void menu_notify_mode_change(int w, int h, int bpp) +void plat_minimize(void) +{ +} + +void plat_gvideo_close(void) +{ +} + +void plat_gvideo_open(int is_pal) { } diff --git a/maemo/maemo_common.h b/maemo/maemo_common.h index 757b6f6..ace0bfd 100644 --- a/maemo/maemo_common.h +++ b/maemo/maemo_common.h @@ -1,4 +1,18 @@ -void maemo_init(int *argc, char ***argv); +int maemo_init(int *argc, char ***argv); +void maemo_finish(); extern char file_name[MAXPATHLEN]; extern int g_maemo_opts; + +extern inline void key_press_event(int key,int type); + +typedef struct +{ + int sens; + int y_def; + float maxValue; + float xMultiplier; + float yMultiplier; +} accel_option; + +extern accel_option accelOptions; diff --git a/maemo/maemo_xkb.c b/maemo/maemo_xkb.c new file mode 100644 index 0000000..52af2ca --- /dev/null +++ b/maemo/maemo_xkb.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, Wei Mingzhi <whistler@openoffice.org>. + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses>. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> +#include <X11/XKBlib.h> + +#include "../frontend/main.h" +#include "../frontend/plugin_lib.h" + +static Atom wmprotocols, wmdelwindow; +static int initialized; + + + +static void InitKeyboard(void) { + Display *disp = (Display *)gpuDisp; + if (disp){ + wmprotocols = XInternAtom(disp, "WM_PROTOCOLS", 0); + wmdelwindow = XInternAtom(disp, "WM_DELETE_WINDOW", 0); + XkbSetDetectableAutoRepeat(disp, 1, NULL); + } +} + +static void DestroyKeyboard(void) { + Display *disp = (Display *)gpuDisp; + if (disp) + XkbSetDetectableAutoRepeat(disp, 0, NULL); +} +#include "maemo_common.h" + +int maemo_x11_update_keys() { + + XEvent evt; + XClientMessageEvent *xce; + int leave = 0; + Display *disp = (Display *)gpuDisp; + + if (!disp) + return 0; + + if (!initialized) { + initialized++; + InitKeyboard(); + } + + while (XPending(disp)>0) { + XNextEvent(disp, &evt); + switch (evt.type) { + case KeyPress: + case KeyRelease: + key_press_event(evt.xkey.keycode, evt.type==KeyPress ? 1 : (evt.type==KeyRelease ? 2 : 0) ); + break; + + case ClientMessage: + xce = (XClientMessageEvent *)&evt; + if (xce->message_type == wmprotocols && (Atom)xce->data.l[0] == wmdelwindow) + leave = 1; + break; + } + } + + if (leave) { + DestroyKeyboard(); + exit(1); + } + + return 0; +} diff --git a/maemo/main.c b/maemo/main.c index 24db87a..87e0e2c 100644 --- a/maemo/main.c +++ b/maemo/main.c @@ -10,21 +10,35 @@ #include <stdint.h> #include <unistd.h> -#include "main.h" -#include "menu.h" -#include "plugin.h" -#include "plugin_lib.h" +#include "../frontend/main.h" +#include "../frontend/menu.h" +#include "../frontend/plugin.h" +#include "../frontend/plugin_lib.h" #include "../libpcsxcore/misc.h" +#include "../libpcsxcore/cdriso.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" -#include "../plugins/dfinput/externals.h" +#include "../plugins/dfinput/main.h" #include "maemo_common.h" -int g_opts = OPT_SHOWFPS; -int g_maemo_opts; -int g_scaler, soft_filter; -int g_menuscreen_w, g_menuscreen_h; +extern int in_enable_vibration; +extern int cycle_multiplier; +extern int in_type1, in_type2; + +// sound plugin +extern int iUseReverb; +extern int iUseInterpolation; +accel_option accelOptions; +int ready_to_go, g_emu_want_quit, g_emu_resetting; +int g_menuscreen_w, g_menuscreen_h; +int g_scaler, soft_filter; +int g_opts = 0; +int g_maemo_opts; +int cornerActions[4] = {0,0,0,0}; +int bKeepDisplayOn = FALSE; +int bAutosaveOnExit = FALSE; char file_name[MAXPATHLEN]; +char keys_config_file[MAXPATHLEN] = "/opt/psx4m/keys"; enum sched_action emu_action; void do_emu_action(void); @@ -41,28 +55,158 @@ static void ChangeWorkingDirectory(char *exe) } } +void PrintHelp() +{ + printf("PCSX-ReARMed version %s for Maemo\n\n", PACKAGE_VERSION); + + printf("Usage:\n"); + printf(" pcsx [options] -cdfile FILE\n\n"); + + printf("Options:\n"); + printf(" -help : This help\n"); + printf(" -disc VALUE : Disc number for multi discs images\n"); + printf(" -fullscreen : Run fullscreen\n"); + printf(" -frameskip : Frameskip\n"); + printf(" -1=Auto (Default)\n"); + printf(" 0=Disabled\n"); + printf(" 1=Set to 1\n"); + printf(" ...\n"); + printf(" -autosave : Enable auto save on exit\n"); + printf(" -accel : Enable accelerometer\n"); + printf(" -analog : Use analog pad for accel\n"); + printf(" -vibration : Activate vibration\n"); + printf(" -sens VALUE : Set accelerometer sens [0-1000]\n"); + printf(" (Default 150)\n"); + printf(" -ydef VALUE : Set accelerometer y zero [0-1000]\n"); + printf(" (Default 500)\n"); + printf(" -max VALUE : Set accelerometer max value[0-1000]\n"); + printf(" (Default 500)\n"); + printf(" -nosound : No sound output\n"); + printf(" -bdir PATH : Set the bios path\n"); + printf(" -pdir PATH : Set the plugins path\n"); + printf(" -bios : Set the bios\n"); + printf(" -cdda : Disable CD Audio for a performance boost\n"); + printf(" -xa : Disables XA sound, which can sometimes\n"); + printf(" improve performance\n"); + printf(" -sio : SIO IRQ Always Enabled\n"); + printf(" -spuirq : SPU IRQ Always Enabled\n"); + printf(" -fps : Show fps\n"); + printf(" -cpu : Show CPU load\n"); + printf(" -spu : Show SPU channels\n"); + printf(" -nofl : Disable Frame Limiter\n"); + printf(" -mcd1 FILE : Set memory card 1 file\n"); + printf(" -mcd2 FILE : Set memory card 2 file\n"); + printf(" -region VALUE : Set PSX region\n"); + printf(" -1=Auto (Default)\n"); + printf(" 0=NTSC\n"); + printf(" 1=PAL\n"); + printf(" -cpuclock VALUE: PSX CPU clock %% [1-500]\n"); + printf(" (Default 50)\n"); + printf(" -displayon : Prevent display from blanking\n"); + printf(" (Default disabled)\n"); + printf(" -keys FILE : File with keys configuration\n"); + printf(" (Default /opt/psx4m/keys)\n"); + printf(" -corners VALUE : Define actions for click on the\n"); + printf(" display corners\n"); + printf(" VALUE is a four digit number, each number\n"); + printf(" represent a corner (topleft, topright,\n"); + printf(" bottomright and bottomleft\n"); + printf(" Actions:\n"); + printf(" 0=No action\n"); + printf(" 1=Save\n"); + printf(" 2=Load\n"); + printf(" 3=Change slot (+1)\n"); + printf(" 4=Change slot (-1)\n"); + printf(" 5=Quit\n"); + printf(" -guncon : Set the controller to guncon\n"); + printf(" -gunnotrigger : Don't trigger (shoot) when touching screen\n"); + printf(" 0=Auto (Default)\n"); + printf(" 1=On\n"); + printf(" 2=Off\n"); + + + printf("\nGPU Options:\n"); + printf(" -gles : Use the GLES plugin (gpu_gles.so)\n"); + printf(" -oldgpu : Use the peops plugin (gpu_peops.so)\n"); + printf(" -unai : Use the unai plugin (gpu_unai.so)\n"); + + printf("\nSound Options:\n"); + printf(" -spu_reverb VALUE : Enable/disable reverb [0/1]\n"); + printf(" (Default disabled)\n"); + printf(" -spu_interpolation VALUE : Set interpolation mode\n"); + printf(" 0=None (Default)\n"); + printf(" 1=Simple\n"); + printf(" 2=Gaussian\n"); + printf(" 3=Cubic\n"); + + printf("\nNeon Options (default GPU):\n"); + printf(" -enhance : Enable graphic enhancement\n"); + + printf("\nGles Options:\n"); + printf(" -gles_dithering VALUE : Enable/disable dithering [0/1]\n"); + printf(" (Default disabled)\n"); + printf(" -gles_mask VALUE : Enable/disable mask detect [0/1]\n"); + printf(" (Default disabled)\n"); + printf(" -gles_filtering VALUE : Texture Filtering\n"); + printf(" 0=None (Default)\n"); + printf(" 1=Standard\n"); + printf(" 2=Extended\n"); + printf(" 3=Standard-sprites\n"); + printf(" 4=Extended-sprites\n"); + printf(" 5=Standard+sprites\n"); + printf(" 6=Extended+sprites\n"); + printf(" -gles_fbtex VALUE : Framebuffer Textures\n"); + printf(" 0=Emulated VRam (Default)\n"); + printf(" 1=Black\n"); + printf(" 2=Card\n"); + printf(" 3=Card+soft\n"); + printf(" -gles_vram VALUE : Texture RAM size in MB [4-128]\n"); + printf(" (Default 64)\n"); + printf(" -gles_fastmdec VALUE : Enable/disable Fast Mdec [0/1]\n"); + printf(" (Default disabled)\n"); + printf(" -gles_advblend VALUE : Enable/disable Adv. Blend [0/1]\n"); + printf(" (Default disabled)\n"); + printf(" -gles_opaque VALUE : Enable/disable Opaque Pass [0/1]\n"); + printf(" (Default disabled)\n"); +} + int main(int argc, char **argv) { + if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "-h")))) { + PrintHelp(); + return 0; + } + + emu_core_preinit(); + ChangeWorkingDirectory("c"); char file[MAXPATHLEN] = ""; char path[MAXPATHLEN]; const char *cdfile = NULL; int loadst = 0; int i; + int getst = -1; + int discNumber = 0; - emu_core_preinit(); - ChangeWorkingDirectory("c"); + g_menuscreen_w = 800; + g_menuscreen_h = 480; + strcpy(Config.Gpu, "builtin_gpu"); + strcpy(Config.Spu, "builtin_spu"); strcpy(Config.BiosDir, "/home/user/MyDocs"); strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins"); snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR); Config.PsxAuto = 1; + pl_rearmed_cbs.frameskip = -1; + strcpy(Config.Bios, "HLE"); + iUseReverb = 0; + iUseInterpolation = 0; - g_menuscreen_w = 800; - g_menuscreen_h = 480; + in_type1 = PSE_PAD_TYPE_STANDARD; + in_type2 = PSE_PAD_TYPE_STANDARD; - pl_init(); - - emu_core_init(); + accelOptions.sens = 150; + accelOptions.y_def = 500; + accelOptions.maxValue = 500.0; // read command line options for (i = 1; i < argc; i++) { @@ -85,24 +229,89 @@ int main(int argc, char **argv) } else if (!strcmp(argv[i],"-frameskip")) { int tv_reg = atol(argv[++i]); - if (tv_reg > 0) + if (tv_reg < -1) pl_rearmed_cbs.frameskip = -1; + else + pl_rearmed_cbs.frameskip = tv_reg; + } + else if (!strcmp(argv[i],"-region")) { + int psx_reg = atol(argv[++i]); + if (psx_reg == 0 || psx_reg == 1){ + Config.PsxAuto = 0; + Config.PsxType = psx_reg; + } } - else if (!strcmp(argv[i],"-fullscreen")) g_maemo_opts |= 2; - else if (!strcmp(argv[i],"-accel")) g_maemo_opts |= 4; - else if (!strcmp(argv[i],"-nosound")) strcpy(Config.Spu, "spunull.so"); + + else if (!strcmp(argv[i],"-get_sstatename")) getst = atol(argv[++i]); + + else if (!strcmp(argv[i], "-fullscreen")) g_maemo_opts |= 2; + else if (!strcmp(argv[i], "-accel")) g_maemo_opts |= 4; + else if (!strcmp(argv[i], "-nosound")) strcpy(Config.Spu, "spunull.so"); else if (!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]); + else if (!strcmp(argv[i], "-pdir")) sprintf(Config.PluginsDir, "%s", argv[++i]); else if (!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]); - else if (!strcmp(argv[i], "-gles")) strcpy(Config.Gpu, "gpuGLES.so"); + else if (!strcmp(argv[i], "-gles")) { strcpy(Config.Gpu, "gpu_gles.so"); g_maemo_opts |= 8 ;} + else if (!strcmp(argv[i], "-oldgpu")) strcpy(Config.Gpu, "gpu_peops.so"); + else if (!strcmp(argv[i], "-unai")) strcpy(Config.Gpu, "gpu_unai.so"); else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1; else if (!strcmp(argv[i], "-xa")) Config.Xa = 1; else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ; else if (!strcmp(argv[i], "-sio")) Config.Sio = 1; else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1; else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1; + else if (!strcmp(argv[i], "-fps")) g_opts |=OPT_SHOWFPS; + else if (!strcmp(argv[i], "-cpu")) g_opts |=OPT_SHOWCPU; + else if (!strcmp(argv[i], "-spu")) g_opts |=OPT_SHOWSPU; + else if (!strcmp(argv[i], "-nofl")) g_opts |=OPT_NO_FRAMELIM; + else if (!strcmp(argv[i], "-mcd1")) sprintf(Config.Mcd1, "%s", argv[++i]); + else if (!strcmp(argv[i], "-mcd2")) sprintf(Config.Mcd2, "%s", argv[++i]); + + else if (!strcmp(argv[i], "-cpuclock")) cycle_multiplier = 10000 / atol(argv[++i]); + else if (!strcmp(argv[i], "-guncon")) in_type1 = PSE_PAD_TYPE_GUNCON; + else if (!strcmp(argv[i], "-gunnotrigger")) g_opts |= OPT_TSGUN_NOTRIGGER; + else if (!strcmp(argv[i], "-analog")) in_type1 = PSE_PAD_TYPE_ANALOGPAD; + else if (!strcmp(argv[i], "-vibration")) { in_type1 = PSE_PAD_TYPE_ANALOGPAD; in_enable_vibration = 1; } + else if (!strcmp(argv[i], "-sens")) accelOptions.sens = atol(argv[++i]); + else if (!strcmp(argv[i], "-ydef")) accelOptions.y_def = atol(argv[++i]); + else if (!strcmp(argv[i], "-max")) accelOptions.maxValue = atol(argv[++i]); + else if (!strcmp(argv[i], "-displayon")) bKeepDisplayOn = TRUE; + else if (!strcmp(argv[i], "-keys")) sprintf(keys_config_file, "%s", argv[++i]); + else if (!strcmp(argv[i], "-autosave")) bAutosaveOnExit = TRUE; + else if (!strcmp(argv[i], "-disc")) discNumber = atol(argv[++i]); + else if (!strcmp(argv[i], "-corners")){ + int j = 0; + i++; + char num[2]; + for (j=0; j<strlen(argv[i]); j++){ + strncpy(num, argv[i] + j, 1); + cornerActions[j] = atoi(num); + } } - hildon_init(&argc, &argv); + else if (!strcmp(argv[i], "-spu_reverb")) { if (atol(argv[++i]) > 0) iUseReverb = 2; } + else if (!strcmp(argv[i], "-spu_interpolation")) iUseInterpolation = atol(argv[++i]); + + else if (!strcmp(argv[i], "-enhance")) pl_rearmed_cbs.gpu_neon.enhancement_enable = 1; + else if (!strcmp(argv[i], "-enhancehack")) pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1; + + else if (!strcmp(argv[i], "-gles_dithering")) pl_rearmed_cbs.gpu_peopsgl.bDrawDither = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_mask")) pl_rearmed_cbs.gpu_peopsgl.iUseMask = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_filtering")) pl_rearmed_cbs.gpu_peopsgl.iFilterType = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_fbtex")) pl_rearmed_cbs.gpu_peopsgl.iFrameTexType = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_vram")) pl_rearmed_cbs.gpu_peopsgl.iVRamSize = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_fastmdec")) pl_rearmed_cbs.gpu_peopsgl.bUseFastMdec = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_advblend")) pl_rearmed_cbs.gpu_peopsgl.bAdvancedBlend = atol(argv[++i]); + else if (!strcmp(argv[i], "-gles_opaque")) pl_rearmed_cbs.gpu_peopsgl.bOpaquePass = atol(argv[++i]); + + else { + fprintf(stderr, "Unknown option: %s\n", argv[i]); + return 1; + } + } + + pl_init(); + if (emu_core_init() == -1) + return 1; if (cdfile) { set_cd_image(cdfile); @@ -114,12 +323,39 @@ int main(int argc, char **argv) return 1; } + if (discNumber > 0) + cdrIsoMultidiskSelect = discNumber - 1; + if (OpenPlugins() == -1) { return 1; } plugin_call_rearmed_cbs(); CheckCdrom(); + + if (getst >= 0){ + char fname[MAXPATHLEN]; + + get_state_filename(fname, sizeof(fname), getst); + printf("SAVESTATE: %s\n", fname); + if (cdrIsoMultidiskCount > 1){ + int i = 0; + for (i=1; i<cdrIsoMultidiskCount; i++){ + cdrIsoMultidiskSelect = i; + CdromId[0] = '\0'; + CdromLabel[0] = '\0'; + + CDR_close(); + if (CDR_open() == 0){ + CheckCdrom(); + get_state_filename(fname, sizeof(fname), getst); + printf("SAVESTATE: %s\n", fname); + } + } + } + return 0; + } + SysReset(); if (file[0] != '\0') { @@ -142,20 +378,30 @@ int main(int argc, char **argv) return 1; } + if (cdrIsoMultidiskCount > 1) + printf ("Loaded a multidisc image: %i discs.\n", cdrIsoMultidiskCount); + // If a state has been specified, then load that if (loadst) { int ret = emu_load_state(loadst - 1); - printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst); + printf("%s state %d\n", ret ? "Failed to load" : "Loaded", loadst); + state_slot = loadst - 1; } - maemo_init(&argc, &argv); + if (maemo_init(&argc, &argv)) + return 1; if (GPU_open != NULL) { int ret = GPU_open(&gpuDisp, "PCSX", NULL); - if (ret) + if (ret){ fprintf(stderr, "Warning: GPU_open returned %d\n", ret); + gpuDisp=ret; + } } + if (Config.HLE) + printf("Note: running without BIOS, expect compatibility problems\n"); + dfinput_activate(); pl_timing_prepare(Config.PsxType); @@ -169,6 +415,7 @@ int main(int argc, char **argv) do_emu_action(); } + maemo_finish(); return 0; } diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index b89ab1a..6cefd11 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -707,8 +707,6 @@ static int do_samples(int forced_updates) while(!bIRQReturn) { - cycles_since_update = 0; - ns_from=0; ns_to=NSSIZE; ch=0; @@ -837,6 +835,8 @@ static int do_samples(int forced_updates) ns++; } + cycles_since_update -= PSXCLK / 44100 * NSSIZE; + ////////////////////////////////////////////////////// // special irq handling in the decode buffers (0x0000-0x1000) // we know: @@ -888,8 +888,15 @@ static int do_samples(int forced_updates) if(forced_updates == 0 && out_current->busy()) break; } + + if(cycles_since_update <= -PSXCLK/60 / 4) + break; } + // this may cause desync, but help audio when the emu can't keep up.. + if(cycles_since_update < 0) + cycles_since_update = 0; + return 0; } @@ -900,7 +907,6 @@ static int do_samples(int forced_updates) void CALLBACK SPUasync(unsigned long cycle) { - static int old_ctrl; int forced_updates = 0; int do_update = 0; @@ -915,16 +921,8 @@ void CALLBACK SPUasync(unsigned long cycle) had_dma = 0; } - if((spuCtrl&CTRL_IRQ) && (((spuCtrl^old_ctrl)&CTRL_IRQ) // irq was enabled - || cycles_since_update > PSXCLK/60 / 4)) { + if(cycles_since_update > PSXCLK/60 * 5/4) do_update = 1; - forced_updates = cycles_since_update / (PSXCLK/44100) / NSSIZE; - } - // with no irqs, once per frame should be fine (using a bit more because of BIAS) - else if(cycles_since_update > PSXCLK/60 * 5/4) - do_update = 1; - - old_ctrl = spuCtrl; if(do_update) do_samples(forced_updates); diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c index 396d274..f52e842 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c @@ -4344,7 +4344,7 @@ void render_sprite(psx_gpu_struct *psx_gpu, s32 x, s32 y, u32 u, u32 v, } #define draw_pixel_line_mask_evaluate_yes() \ - if(*vram_ptr & 0x8000) \ + if((*vram_ptr & 0x8000) == 0) \ #define draw_pixel_line_mask_evaluate_no() \ diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S index 344331d..d8fb153 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S @@ -4280,6 +4280,7 @@ function(blend_blocks_textured_unblended_on) beq 1f 0: + vorr.u16 pixels, pixels, msb_mask vorr.u16 draw_mask, draw_mask, write_mask vbif.u16 fb_pixels, pixels, draw_mask vst1.u16 { fb_pixels }, [ fb_ptr ] @@ -4294,6 +4295,7 @@ function(blend_blocks_textured_unblended_on) bne 0b 1: + vorr.u16 pixels, pixels, msb_mask vorr.u16 draw_mask, draw_mask, write_mask vbif.u16 fb_pixels, pixels, draw_mask vst1.u16 { fb_pixels }, [ fb_ptr ] diff --git a/plugins/gpu_neon/psx_gpu/tests/Makefile b/plugins/gpu_neon/psx_gpu/tests/Makefile index 58cca29..bb91a5a 100644 --- a/plugins/gpu_neon/psx_gpu/tests/Makefile +++ b/plugins/gpu_neon/psx_gpu/tests/Makefile @@ -1,6 +1,7 @@ CC = $(CROSS_COMPILE)gcc CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP CFLAGS += -Wall -ggdb +CFLAGS += -fno-strict-aliasing CFLAGS += `sdl-config --cflags` LDFLAGS += `sdl-config --libs` @@ -13,7 +14,7 @@ ASFLAGS = $(CFLAGS) OBJ += psx_gpu_arm_neon.o endif ifndef DEBUG -CFLAGS += -O2 -DNDEBUG -fno-strict-aliasing +CFLAGS += -O2 -DNDEBUG endif OBJ += psx_gpu.o psx_gpu_parse.o psx_gpu_main.o diff --git a/plugins/gpu_neon/psx_gpu/tests/psx_dump_check.sh b/plugins/gpu_neon/psx_gpu/tests/psx_dump_check.sh index 25d0725..58427b1 100755 --- a/plugins/gpu_neon/psx_gpu/tests/psx_dump_check.sh +++ b/plugins/gpu_neon/psx_gpu/tests/psx_dump_check.sh @@ -1,3 +1,8 @@ +if test -z "$1"; then + echo "$0 <logfile>" + exit 1 +fi + truncate --size 0 $1 for dump in gpu_dumps_all/* do @@ -109,6 +109,14 @@ the main menu where it is possible to enable/disable individual cheats. Changelog --------- +r19 (2013-03-17) ++ libretro: added region, multidisk support +* more work on cdrom code +* changed sound sync code +* fixed masking bugs in NEON GPU (in collaboration with Exophase) +* fixed some compatibility issues +* various other tweaks and fixes + r18 (2013-01-06) * cdrom code greatly cleaned up + new GLES output mode for ARM Linux/R-Pi |