aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rwxr-xr-xconfigure97
-rw-r--r--frontend/320240/ui_gp2x.h2
m---------frontend/libpicofe0
-rw-r--r--frontend/main.c2
-rw-r--r--frontend/menu.c27
-rw-r--r--frontend/menu.h3
-rw-r--r--frontend/pandora/ui_feat.h2
-rw-r--r--frontend/plat_pandora.c2
-rw-r--r--frontend/plat_sdl.c254
-rw-r--r--libpcsxcore/cdriso.c1
-rw-r--r--libpcsxcore/new_dynarec/assem_arm.c15
-rw-r--r--plugins/dfsound/pulseaudio.c16
-rw-r--r--plugins/gpu-gles/Makefile3
-rw-r--r--plugins/gpulib/cspace.c30
-rw-r--r--plugins/gpulib/cspace.h1
16 files changed, 243 insertions, 224 deletions
diff --git a/Makefile b/Makefile
index 2ca2fdd..0d72dea 100644
--- a/Makefile
+++ b/Makefile
@@ -132,9 +132,19 @@ OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
# frontend/gui
ifeq "$(PLATFORM)" "generic"
-OBJS += frontend/libpicofe/in_sdl.o frontend/plat_sdl.o
+OBJS += frontend/libpicofe/in_sdl.o
+OBJS += frontend/libpicofe/plat_sdl.o
OBJS += frontend/libpicofe/plat_dummy.o
OBJS += frontend/libpicofe/linux/in_evdev.o
+OBJS += frontend/plat_sdl.o
+ifeq "$(HAVE_GLES)" "1"
+OBJS += frontend/libpicofe/gl.o frontend/libpicofe/gl_platform.o
+LDLIBS += $(LDLIBS_GLES)
+frontend/libpicofe/plat_sdl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
+frontend/libpicofe/gl_platform.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
+frontend/libpicofe/gl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
+frontend/plat_sdl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
+endif
USE_PLUGIN_LIB = 1
USE_FRONTEND = 1
endif
diff --git a/configure b/configure
index e8e5b2a..c03d41f 100755
--- a/configure
+++ b/configure
@@ -24,8 +24,7 @@ compile_binary()
check_define()
{
- echo "" > $TMPC
- $CC -E -dD $CFLAGS $TMPC | grep -q $1 || return 1
+ $CC -E -dD $CFLAGS include/arm_features.h | grep -q $1 || return 1
return 0
}
@@ -36,20 +35,24 @@ platform_list="generic pandora maemo caanoo libretro"
platform="generic"
builtin_gpu_list="peops unai neon"
builtin_gpu=""
-sound_driver_list="oss alsa sdl pulseaudio libretro"
+sound_driver_list="oss alsa pulseaudio sdl libretro"
sound_drivers=""
plugins="plugins/spunull/spunull.so \
plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so"
ram_fixed="no"
drc_cache_base="no"
+have_armv5=""
have_armv6=""
have_armv7=""
have_arm_neon=""
have_tslib=""
+have_gles=""
enable_dynarec="yes"
need_sdl="no"
need_libpicofe="yes"
need_warm="no"
+CFLAGS_GLES=""
+LDLIBS_GLES=""
# these are for known platforms
optimize_cortexa8="no"
optimize_arm926ej="no"
@@ -172,6 +175,15 @@ if [ "$need_warm" = "yes" ]; then
fi
fi
+# basic compiler test
+cat > $TMPC <<EOF
+#include <zlib.h>
+int main(void) { return 0; }
+EOF
+if ! compile_binary; then
+ fail "basic compiler test failed, please check config.log"
+fi
+
if [ -z "$ARCH" ]; then
ARCH=`$CC -v 2>&1 | grep -i 'target:' | awk '{print $2}' \
| awk -F '-' '{print $1}'`
@@ -192,15 +204,22 @@ if [ "$ARCH" = "arm" ]; 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_armv6" = "x" ]; then
- have_armv6=`check_define __ARM_ARCH_6 && echo yes` || true
- fi
if [ "x$have_armv7" = "x" ]; then
- if check_define __ARM_ARCH_7A__; then
- have_armv6="yes"
+ 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
if [ "x$builtin_gpu" = "x" ]; then
if [ "$have_arm_neon" = "yes" ]; then
@@ -233,6 +252,20 @@ if [ "$ARCH" = "arm" ]; then
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
else
# dynarec only available on ARM
enable_dynarec="no"
@@ -305,6 +338,15 @@ EOF
compile_binary "$@"
}
+check_pulseaudio()
+{
+ cat > $TMPC <<EOF
+ #include <pulse/pulseaudio.h>
+ void main() { pa_threaded_mainloop_new(); }
+EOF
+ compile_binary "$@"
+}
+
check_sdl()
{
cat > $TMPC <<EOF
@@ -327,6 +369,10 @@ if [ "x$sound_drivers" = "x" ]; then
sound_drivers="$sound_drivers alsa"
MAIN_LDLIBS="-lasound $MAIN_LDLIBS"
fi
+ if check_pulseaudio -lpulse; then
+ sound_drivers="$sound_drivers pulseaudio"
+ MAIN_LDLIBS="-lpulse $MAIN_LDLIBS"
+ fi
if [ "$need_sdl" = "yes" ] || check_sdl `sdl-config --cflags --libs`; then
sound_drivers="$sound_drivers sdl"
need_sdl="yes"
@@ -339,6 +385,10 @@ else
MAIN_LDLIBS="-lasound $MAIN_LDLIBS"
check_alsa || fail "please install libasound2-dev"
fi
+ if echo $sound_drivers | grep -q "\<pulseaudio\>"; then
+ MAIN_LDLIBS="-lpulse $MAIN_LDLIBS"
+ check_pulseaudio || fail "pulseaudio support is missing"
+ fi
fi
if [ "$need_sdl" = "yes" ]; then
@@ -362,19 +412,31 @@ EOF
fi
fi
+# check for VideoCore stuff for Raspberry Pi
+if [ -d /opt/vc/include -a -d /opt/vc/lib ]; then
+ CFLAGS_GLES="$CFLAGS_GLES -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads"
+ LDLIBS_GLES="$LDLIBS_GLES -L/opt/vc/lib"
+fi
+
# check for GLES headers
cat > $TMPC <<EOF
#include <GLES/gl.h>
-#include <GLES/glext.h>
#include <EGL/egl.h>
-void *test(void) {
- return eglGetDisplay( (EGLNativeDisplayType)0 );
+int main(void) {
+ return (int)eglGetDisplay( (EGLNativeDisplayType)0 );
}
EOF
-if compile_object; then
- plugins="$plugins plugins/gpu-gles/gpu_gles.so"
+if compile_binary $CFLAGS_GLES -lEGL -lGLES_CM $LDLIBS_GLES; then
+ have_gles="yes"
+ LDLIBS_GLES="-lEGL -lGLES_CM $LDLIBS_GLES"
+elif compile_binary $CFLAGS_GLES -lEGL -lGLESv1_CM $LDLIBS_GLES; then
+ have_gles="yes"
+ LDLIBS_GLES="-lEGL -lGLESv1_CM $LDLIBS_GLES"
fi
+if [ "$have_gles" = "yes" ]; then
+ plugins="$plugins plugins/gpu-gles/gpu_gles.so"
+fi
if [ "$have_arm_neon" = "yes" -a "$builtin_gpu" != "neon" ]; then
plugins="$plugins plugins/gpu_neon/gpu_neon.so"
fi
@@ -396,6 +458,7 @@ done
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"
+test "x$have_gles" != "x" || have_gles="no"
echo "architecture $ARCH"
echo "platform $platform"
@@ -410,6 +473,9 @@ echo "enable dynarec $enable_dynarec"
echo "ARMv7 optimizations $have_armv7"
echo "enable ARM NEON $have_arm_neon"
echo "tslib support $have_tslib"
+if [ "$platform" = "generic" ]; then
+ echo "OpenGL ES output $have_gles"
+fi
echo "# Automatically generated by configure" > $config_mak
printf "# Configured with:" >> $config_mak
@@ -441,6 +507,11 @@ fi
if [ "$have_tslib" = "yes" ]; then
echo "HAVE_TSLIB = 1" >> $config_mak
fi
+if [ "$have_gles" = "yes" ]; then
+ echo "HAVE_GLES = 1" >> $config_mak
+ echo "CFLAGS_GLES = $CFLAGS_GLES" >> $config_mak
+ echo "LDLIBS_GLES = $LDLIBS_GLES" >> $config_mak
+fi
if [ "$enable_dynarec" = "yes" ]; then
echo "USE_DYNAREC = 1" >> $config_mak
fi
diff --git a/frontend/320240/ui_gp2x.h b/frontend/320240/ui_gp2x.h
index 0fef431..a9c4413 100644
--- a/frontend/320240/ui_gp2x.h
+++ b/frontend/320240/ui_gp2x.h
@@ -3,7 +3,7 @@
#define MENU_BIOS_PATH "pcsx_rearmed/bios/"
#define MENU_SHOW_VARSCALER 0
-#define MENU_SHOW_VIDOVERLAY 0
+#define MENU_SHOW_VOUTMODE 0
#define MENU_SHOW_SCALER2 1
#define MENU_SHOW_NUBS_BTNS 0
#define MENU_SHOW_VIBRATION 1
diff --git a/frontend/libpicofe b/frontend/libpicofe
-Subproject 14fa485ef29d946407fe79f8d7c65afa6ae1fb0
+Subproject 0d645bc539fdc073f20c4dea9f4a4e218cebec0
diff --git a/frontend/main.c b/frontend/main.c
index 762d753..d46e536 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -262,7 +262,7 @@ do_state_slot:
g_opts |= OPT_SHOWFPS;
break;
case SACTION_TOGGLE_FULLSCREEN:
- g_fullscreen = !g_fullscreen;
+ plat_target.vout_fullscreen = !plat_target.vout_fullscreen;
if (GPU_open != NULL && GPU_close != NULL) {
GPU_close();
GPU_open(&gpuDisp, "PCSX", NULL);
diff --git a/frontend/menu.c b/frontend/menu.c
index 7af718e..9cfa171 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -79,7 +79,7 @@ typedef enum
MA_OPT_HWFILTER,
MA_OPT_SWFILTER,
MA_OPT_GAMMA,
- MA_OPT_VIDOVERLAY,
+ MA_OPT_VOUT_MODE,
} menu_id;
static int last_vout_w, last_vout_h, last_vout_bpp;
@@ -91,8 +91,7 @@ static int psx_clock;
static int memcard1_sel, memcard2_sel;
int g_opts, g_scaler, g_gamma = 100;
int soft_scaling, analog_deadzone; // for Caanoo
-int g_use_overlay, g_fullscreen;
-int filter, soft_filter;
+int soft_filter;
#ifdef __ARM_ARCH_7A__
#define DEFAULT_PSX_CLOCK 57
@@ -117,7 +116,7 @@ static int bios_sel, gpu_plugsel, spu_plugsel;
#ifndef UI_FEATURES_H
#define MENU_BIOS_PATH "bios/"
#define MENU_SHOW_VARSCALER 0
-#define MENU_SHOW_VIDOVERLAY 1
+#define MENU_SHOW_VOUTMODE 1
#define MENU_SHOW_SCALER2 0
#define MENU_SHOW_NUBS_BTNS 0
#define MENU_SHOW_VIBRATION 0
@@ -231,8 +230,7 @@ static void menu_set_defconfig(void)
analog_deadzone = 50;
soft_scaling = 1;
soft_filter = 0;
- g_use_overlay = 1;
- g_fullscreen = 0;
+ plat_target.vout_fullscreen = 0;
psx_clock = DEFAULT_PSX_CLOCK;
region = 0;
@@ -296,10 +294,10 @@ static const struct {
CE_INTVAL(g_layer_y),
CE_INTVAL(g_layer_w),
CE_INTVAL(g_layer_h),
- CE_INTVAL(filter),
CE_INTVAL(soft_filter),
- CE_INTVAL(g_use_overlay),
- CE_INTVAL(g_fullscreen),
+ CE_INTVAL(plat_target.vout_method),
+ CE_INTVAL(plat_target.hwfilter),
+ CE_INTVAL(plat_target.vout_fullscreen),
CE_INTVAL(state_slot),
CE_INTVAL(cpu_clock),
CE_INTVAL(g_opts),
@@ -1144,9 +1142,9 @@ static int menu_loop_cscaler(int id, int keys)
static menu_entry e_menu_gfx_options[] =
{
mee_enum ("Scaler", MA_OPT_VARSCALER, g_scaler, men_scaler),
- mee_onoff_h ("Use video overlay", MA_OPT_VIDOVERLAY, g_use_overlay, 1, h_overlay),
+ mee_enum ("Video output mode", MA_OPT_VOUT_MODE, plat_target.vout_method, men_dummy),
mee_onoff ("Software Scaling", MA_OPT_SCALER2, soft_scaling, 1),
- mee_enum ("Hardware Filter", MA_OPT_HWFILTER, filter, men_dummy),
+ mee_enum ("Hardware Filter", MA_OPT_HWFILTER, plat_target.hwfilter, men_dummy),
mee_enum_h ("Software Filter", MA_OPT_SWFILTER, soft_filter, men_soft_filter, h_soft_filter),
mee_range_h ("Gamma adjustment", MA_OPT_GAMMA, g_gamma, 1, 200, h_gamma),
// mee_onoff ("Vsync", 0, vsync, 1),
@@ -2312,6 +2310,11 @@ void menu_init(void)
&& plat_target.cpu_clock_get != NULL && cpu_clock_st > 0;
me_enable(e_menu_gfx_options, MA_OPT_CPU_CLOCKS, i);
+ i = me_id2offset(e_menu_gfx_options, MA_OPT_VOUT_MODE);
+ 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_OPT_HWFILTER);
e_menu_gfx_options[i].data = plat_target.hwfilters;
me_enable(e_menu_gfx_options, MA_OPT_HWFILTER,
@@ -2324,7 +2327,7 @@ void menu_init(void)
me_enable(e_menu_gfx_options, MA_OPT_SWFILTER, 0);
#endif
me_enable(e_menu_gfx_options, MA_OPT_VARSCALER, MENU_SHOW_VARSCALER);
- me_enable(e_menu_gfx_options, MA_OPT_VIDOVERLAY, MENU_SHOW_VIDOVERLAY);
+ me_enable(e_menu_gfx_options, MA_OPT_VOUT_MODE, MENU_SHOW_VOUTMODE);
me_enable(e_menu_gfx_options, MA_OPT_VARSCALER_C, MENU_SHOW_VARSCALER);
me_enable(e_menu_gfx_options, MA_OPT_SCALER2, MENU_SHOW_SCALER2);
me_enable(e_menu_keyconfig, MA_CTRL_NUBS_BTNS, MENU_SHOW_NUBS_BTNS);
diff --git a/frontend/menu.h b/frontend/menu.h
index c6c1ab1..0d68469 100644
--- a/frontend/menu.h
+++ b/frontend/menu.h
@@ -29,8 +29,7 @@ enum g_soft_filter_opts {
extern int g_opts, g_scaler, g_gamma;
extern int soft_scaling, analog_deadzone;
-extern int g_use_overlay, g_fullscreen;
-extern int filter, soft_filter;
+extern int soft_filter;
extern int g_menuscreen_w;
extern int g_menuscreen_h;
diff --git a/frontend/pandora/ui_feat.h b/frontend/pandora/ui_feat.h
index 7564e17..3bb808a 100644
--- a/frontend/pandora/ui_feat.h
+++ b/frontend/pandora/ui_feat.h
@@ -4,7 +4,7 @@
#define MENU_BIOS_PATH "<SD card>/pandora/appdata/pcsx_rearmed/bios/"
#define BOOT_MSG "Booting up... (press SPACE for menu)"
#define MENU_SHOW_VARSCALER 1
-#define MENU_SHOW_VIDOVERLAY 0
+#define MENU_SHOW_VOUTMODE 0
#define MENU_SHOW_SCALER2 0
#define MENU_SHOW_NUBS_BTNS 1
#define MENU_SHOW_VIBRATION 0
diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c
index cdd94c6..d44513c 100644
--- a/frontend/plat_pandora.c
+++ b/frontend/plat_pandora.c
@@ -70,7 +70,7 @@ void plat_finish(void)
void plat_gvideo_open(int is_pal)
{
plat_target_lcdrate_set(is_pal);
- plat_target_hwfilter_set(filter);
+ plat_target_hwfilter_set(plat_target.hwfilter);
plat_target_gamma_set(g_gamma, 0);
plat_omap_gvideo_open();
diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c
index 9862e2b..5b85375 100644
--- a/frontend/plat_sdl.c
+++ b/frontend/plat_sdl.c
@@ -15,10 +15,11 @@
#include "libpicofe/in_sdl.h"
#include "libpicofe/menu.h"
#include "libpicofe/fonts.h"
+#include "libpicofe/plat_sdl.h"
+#include "libpicofe/gl.h"
#include "../plugins/gpulib/cspace.h"
#include "plugin_lib.h"
#include "main.h"
-#include "menu.h"
#include "plat.h"
#include "revision.h"
@@ -51,169 +52,58 @@ static const struct in_default_bind in_sdl_defbinds[] = {
{ 0, 0, 0 }
};
-// XXX: maybe determine this instead..
-#define WM_DECORATION_H 32
-
-static SDL_Surface *screen;
-static SDL_Overlay *overlay;
-static int window_w, window_h;
-static int fs_w, fs_h;
static int psx_w, psx_h;
-static void *menubg_img;
-static int in_menu, old_fullscreen;
-
-static void overlay_clear(void);
+static void *shadow_fb, *menubg_img;
+static int in_menu;
-static int change_video_mode(int w, int h)
+static int change_video_mode(void)
{
- psx_w = w;
- psx_h = h;
+ int w, h;
- if (overlay != NULL) {
- SDL_FreeYUVOverlay(overlay);
- overlay = NULL;
+ if (in_menu) {
+ w = g_menuscreen_w;
+ h = g_menuscreen_h;
}
-
- if (g_use_overlay && !in_menu) {
- Uint32 flags = SDL_RESIZABLE;
- int win_w = window_w;
- int win_h = window_h;
-
- if (g_fullscreen) {
- flags |= SDL_FULLSCREEN;
- win_w = fs_w;
- win_h = fs_h;
- }
-
- screen = SDL_SetVideoMode(win_w, win_h, 0, flags);
- if (screen == NULL) {
- fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
- return -1;
- }
-
- overlay = SDL_CreateYUVOverlay(w, h, SDL_UYVY_OVERLAY, screen);
- if (overlay != NULL) {
- /*printf("overlay: fmt %x, planes: %d, pitch: %d, hw: %d\n",
- overlay->format, overlay->planes, *overlay->pitches,
- overlay->hw_overlay);*/
-
- if ((long)overlay->pixels[0] & 3)
- fprintf(stderr, "warning: overlay pointer is unaligned\n");
-
- if (!overlay->hw_overlay) {
- fprintf(stderr, "warning: video overlay is not hardware accelerated, "
- "disabling it.\n");
- g_use_overlay = 0;
- SDL_FreeYUVOverlay(overlay);
- overlay = NULL;
- }
- else
- overlay_clear();
- }
- else {
- fprintf(stderr, "warning: could not create overlay.\n");
- }
- }
-
- if (overlay == NULL) {
- screen = SDL_SetVideoMode(w, h, 16, 0);
- if (screen == NULL) {
- fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError());
- return -1;
- }
-
- if (!in_menu) {
- window_w = screen->w;
- window_h = screen->h;
- }
+ else {
+ w = psx_w;
+ h = psx_h;
}
- old_fullscreen = g_fullscreen;
- return 0;
-}
-
-static void event_handler(void *event_)
-{
- SDL_Event *event = event_;
-
- if (event->type == SDL_VIDEORESIZE) {
- //printf("%dx%d\n", event->resize.w, event->resize.h);
- if (overlay != NULL && !g_fullscreen && !old_fullscreen) {
- window_w = event->resize.w;
- window_h = event->resize.h;
- change_video_mode(psx_w, psx_h);
- }
- }
+ return plat_sdl_change_video_mode(w, h, 0);
}
void plat_init(void)
{
- const SDL_VideoInfo *info;
- int ret, h;
+ int ret;
- ret = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
- if (ret != 0) {
- fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
+ ret = plat_sdl_init();
+ if (ret != 0)
exit(1);
- }
-
- info = SDL_GetVideoInfo();
- if (info != NULL) {
- fs_w = info->current_w;
- fs_h = info->current_h;
- }
in_menu = 1;
- g_menuscreen_w = 640;
- if (fs_w != 0 && g_menuscreen_w > fs_w)
- g_menuscreen_w = fs_w;
- g_menuscreen_h = 480;
- if (fs_h != 0) {
- h = fs_h;
- if (info && info->wm_available && h > WM_DECORATION_H)
- h -= WM_DECORATION_H;
- if (g_menuscreen_h > h)
- g_menuscreen_h = h;
- }
-
- ret = change_video_mode(g_menuscreen_w, g_menuscreen_h);
- if (ret != 0) {
- ret = change_video_mode(0, 0);
- if (ret != 0)
- goto fail;
-
- if (screen->w < 320 || screen->h < 240) {
- fprintf(stderr, "resolution %dx%d is too small, sorry.\n",
- screen->w, screen->h);
- goto fail;
- }
- }
- g_menuscreen_w = window_w = screen->w;
- g_menuscreen_h = window_h = screen->h;
-
SDL_WM_SetCaption("PCSX-ReARMed " REV, NULL);
+ shadow_fb = malloc(640 * 512 * 2);
menubg_img = malloc(640 * 512 * 2);
- if (menubg_img == NULL)
- goto fail;
+ if (shadow_fb == NULL || menubg_img == NULL) {
+ fprintf(stderr, "OOM\n");
+ exit(1);
+ }
- in_sdl_init(in_sdl_defbinds, event_handler);
+ in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler);
in_probe();
pl_rearmed_cbs.only_16bpp = 1;
bgr_to_uyvy_init();
- return;
-
-fail:
- SDL_Quit();
- exit(1);
}
void plat_finish(void)
{
+ free(shadow_fb);
+ shadow_fb = NULL;
free(menubg_img);
menubg_img = NULL;
- SDL_Quit();
+ plat_sdl_finish();
}
void plat_gvideo_open(int is_pal)
@@ -238,28 +128,15 @@ static void uyvy_to_rgb565(void *d, const void *s, int pixels)
}
}
-static void overlay_clear(void)
-{
- int pixels = overlay->w * overlay->h;
- int *dst = (int *)overlay->pixels[0];
- int v = 0x10801080;
-
- for (; pixels > 0; dst += 4, pixels -= 2 * 4)
- dst[0] = dst[1] = dst[2] = dst[3] = v;
-
- for (; pixels > 0; dst++, pixels -= 2)
- *dst = v;
-}
-
static void overlay_blit(int doffs, const void *src_, int w, int h,
int sstride, int bgr24)
{
const unsigned short *src = src_;
unsigned short *dst;
- int dstride = overlay->w;
+ int dstride = plat_sdl_overlay->w;
- SDL_LockYUVOverlay(overlay);
- dst = (void *)overlay->pixels[0];
+ SDL_LockYUVOverlay(plat_sdl_overlay);
+ dst = (void *)plat_sdl_overlay->pixels[0];
dst += doffs;
if (bgr24) {
@@ -271,21 +148,23 @@ static void overlay_blit(int doffs, const void *src_, int w, int h,
bgr555_to_uyvy(dst, src, w);
}
- SDL_UnlockYUVOverlay(overlay);
+ SDL_UnlockYUVOverlay(plat_sdl_overlay);
}
static void overlay_hud_print(int x, int y, const char *str, int bpp)
{
- SDL_LockYUVOverlay(overlay);
- basic_text_out_uyvy_nf(overlay->pixels[0], overlay->w, x, y, str);
- SDL_UnlockYUVOverlay(overlay);
+ SDL_LockYUVOverlay(plat_sdl_overlay);
+ basic_text_out_uyvy_nf(plat_sdl_overlay->pixels[0], plat_sdl_overlay->w, x, y, str);
+ SDL_UnlockYUVOverlay(plat_sdl_overlay);
}
void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
{
- change_video_mode(*w, *h);
- if (overlay != NULL) {
- pl_plat_clear = overlay_clear;
+ psx_w = *w;
+ psx_h = *h;
+ change_video_mode();
+ if (plat_sdl_overlay != NULL) {
+ pl_plat_clear = plat_sdl_overlay_clear;
pl_plat_blit = overlay_blit;
pl_plat_hud_print = overlay_hud_print;
return NULL;
@@ -294,21 +173,28 @@ void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
pl_plat_clear = NULL;
pl_plat_blit = NULL;
pl_plat_hud_print = NULL;
- return screen->pixels;
+ if (plat_sdl_gl_active)
+ return shadow_fb;
+ else
+ return plat_sdl_screen->pixels;
}
}
void *plat_gvideo_flip(void)
{
- if (!in_menu && overlay != NULL) {
- SDL_Rect dstrect = { 0, 0, screen->w, screen->h };
- SDL_DisplayYUVOverlay(overlay, &dstrect);
+ if (plat_sdl_overlay != NULL) {
+ SDL_Rect dstrect = { 0, 0, plat_sdl_screen->w, plat_sdl_screen->h };
+ SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect);
return NULL;
}
+ else if (plat_sdl_gl_active) {
+ gl_flip(shadow_fb, psx_w, psx_h);
+ return shadow_fb;
+ }
else {
- // XXX: missing SDL_LockSurface()
- SDL_Flip(screen);
- return screen->pixels;
+ // XXX: no locking, but should be fine with SDL_SWSURFACE?
+ SDL_Flip(plat_sdl_screen);
+ return plat_sdl_screen->pixels;
}
}
@@ -321,25 +207,47 @@ void plat_video_menu_enter(int is_rom_loaded)
in_menu = 1;
/* surface will be lost, must adjust pl_vout_buf for menu bg */
- if (overlay != NULL)
- uyvy_to_rgb565(menubg_img, overlay->pixels[0], psx_w * psx_h);
+ if (plat_sdl_overlay != NULL)
+ uyvy_to_rgb565(menubg_img, plat_sdl_overlay->pixels[0], psx_w * psx_h);
+ else if (plat_sdl_gl_active)
+ memcpy(menubg_img, shadow_fb, psx_w * psx_h * 2);
else
- memcpy(menubg_img, screen->pixels, psx_w * psx_h * 2);
+ memcpy(menubg_img, plat_sdl_screen->pixels, psx_w * psx_h * 2);
pl_vout_buf = menubg_img;
- change_video_mode(g_menuscreen_w, g_menuscreen_h);
+ change_video_mode();
}
void plat_video_menu_begin(void)
{
- SDL_LockSurface(screen);
- g_menuscreen_ptr = screen->pixels;
+ if (plat_sdl_overlay != NULL || plat_sdl_gl_active) {
+ g_menuscreen_ptr = shadow_fb;
+ }
+ else {
+ SDL_LockSurface(plat_sdl_screen);
+ g_menuscreen_ptr = plat_sdl_screen->pixels;
+ }
}
void plat_video_menu_end(void)
{
- SDL_UnlockSurface(screen);
- SDL_Flip(screen);
+ if (plat_sdl_overlay != NULL) {
+ SDL_Rect dstrect = { 0, 0, plat_sdl_screen->w, plat_sdl_screen->h };
+
+ SDL_LockYUVOverlay(plat_sdl_overlay);
+ rgb565_to_uyvy(plat_sdl_overlay->pixels[0], shadow_fb,
+ g_menuscreen_w * g_menuscreen_h);
+ SDL_UnlockYUVOverlay(plat_sdl_overlay);
+
+ SDL_DisplayYUVOverlay(plat_sdl_overlay, &dstrect);
+ }
+ else if (plat_sdl_gl_active) {
+ gl_flip(g_menuscreen_ptr, g_menuscreen_w, g_menuscreen_h);
+ }
+ else {
+ SDL_UnlockSurface(plat_sdl_screen);
+ SDL_Flip(plat_sdl_screen);
+ }
g_menuscreen_ptr = NULL;
}
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index 28bb3df..f2886b0 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -30,6 +30,7 @@
#else
#include <pthread.h>
#include <sys/time.h>
+#include <unistd.h>
#endif
#include <zlib.h>
diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c
index 51cceec..1d944c2 100644
--- a/libpcsxcore/new_dynarec/assem_arm.c
+++ b/libpcsxcore/new_dynarec/assem_arm.c
@@ -4531,8 +4531,8 @@ static void c2op_assemble(int i,struct regstat *i_regs)
int lm = (source[i] >> 10) & 1;
switch(c2op) {
#ifndef DRC_DBG
-#ifdef HAVE_ARMV5
case GTE_MVMVA: {
+#ifdef HAVE_ARMV5
int v = (source[i] >> 15) & 3;
int cv = (source[i] >> 13) & 3;
int mx = (source[i] >> 17) & 3;
@@ -4572,9 +4572,14 @@ static void c2op_assemble(int i,struct regstat *i_regs)
if(need_flags||need_ir)
c2op_call_MACtoIR(lm,need_flags);
#endif
+#else /* if not HAVE_ARMV5 */
+ c2op_prologue(c2op,reglist);
+ emit_movimm(source[i],1); // opcode
+ emit_writeword(1,(int)&psxRegs.code);
+ emit_call((int)(need_flags?gte_handlers[c2op]:gte_handlers_nf[c2op]));
+#endif
break;
}
-#endif /* HAVE_ARMV5 */
case GTE_OP:
c2op_prologue(c2op,reglist);
emit_call((int)(shift?gteOP_part_shift:gteOP_part_noshift));
@@ -5312,7 +5317,7 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs)
emit_negmi(remainder,remainder); // .. remainder for div0 case (will be negated back after jump)
emit_movs(d2,HOST_TEMPREG);
emit_jeq((int)out+52); // Division by zero
- emit_negmi(HOST_TEMPREG,HOST_TEMPREG);
+ emit_negsmi(HOST_TEMPREG,HOST_TEMPREG);
#ifdef HAVE_ARMV5
emit_clz(HOST_TEMPREG,quotient);
emit_shl(HOST_TEMPREG,quotient,HOST_TEMPREG);
@@ -5354,8 +5359,8 @@ void multdiv_assemble_arm(int i,struct regstat *i_regs)
emit_shl(d2,HOST_TEMPREG,d2);
#else
emit_movimm(0,HOST_TEMPREG);
- emit_addpl_imm(d2,1,d2);
- emit_lslpls_imm(HOST_TEMPREG,1,HOST_TEMPREG);
+ emit_addpl_imm(HOST_TEMPREG,1,HOST_TEMPREG);
+ emit_lslpls_imm(d2,1,d2);
emit_jns((int)out-2*4);
emit_movimm(1<<31,quotient);
#endif
diff --git a/plugins/dfsound/pulseaudio.c b/plugins/dfsound/pulseaudio.c
index 057c2c4..8ffd58f 100644
--- a/plugins/dfsound/pulseaudio.c
+++ b/plugins/dfsound/pulseaudio.c
@@ -17,12 +17,10 @@ comment : Much of this was taken from simple.c, in the pulseaudio
* *
***************************************************************************/
-#include "stdafx.h"
+#include <stdio.h>
-#define _IN_OSS
-
-#include "externals.h"
#include <pulse/pulseaudio.h>
+#include "out.h"
////////////////////////////////////////////////////////////////////////
// pulseaudio structs
@@ -134,7 +132,7 @@ static void stream_request_cb (pa_stream *stream, size_t length, void *userdata)
// SETUP SOUND
////////////////////////////////////////////////////////////////////////
-static void pulse_init(void)
+static int pulse_init(void)
{
int error_number;
@@ -227,7 +225,7 @@ static void pulse_init(void)
//pa_stream_flags_t flags = (pa_stream_flags_t) (PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_EARLY_REQUESTS);
if (pa_stream_connect_playback (device.stream, NULL, &buffer_attributes, flags, NULL, NULL) < 0)
{
- pa_context_errno (device.context);
+ error_number = pa_context_errno (device.context);
fprintf (stderr, "Could not connect for playback: %s\n", pa_strerror (error_number));
return -1;
}
@@ -296,9 +294,6 @@ static void pulse_finish(void)
static int pulse_busy(void)
{
int free_space;
- int error_code;
- long latency;
- int playing = 0;
if ((device.mainloop == NULL) || (device.api == NULL) || ( device.context == NULL) || (device.stream == NULL))
return 1;
@@ -329,9 +324,6 @@ static int pulse_busy(void)
static void pulse_feed(void *pSound, int lBytes)
{
- int error_code;
- int size;
-
if (device.mainloop != NULL)
{
pa_threaded_mainloop_lock (device.mainloop);
diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile
index 421a6e7..769a68b 100644
--- a/plugins/gpu-gles/Makefile
+++ b/plugins/gpu-gles/Makefile
@@ -12,7 +12,8 @@ ifeq "$(PLATFORM)" "caanoo"
CFLAGS += -DFAKE_WINDOW
LDLIBS += -lopengles_lite -lstdc++
else
-LDLIBS += -lGLES_CM
+CFLAGS += $(CFLAGS_GLES)
+LDLIBS += $(LDLIBS_GLES)
endif
BIN_STANDLALONE = gpuGLES.so
diff --git a/plugins/gpulib/cspace.c b/plugins/gpulib/cspace.c
index 8e3bee9..f0c4912 100644
--- a/plugins/gpulib/cspace.c
+++ b/plugins/gpulib/cspace.c
@@ -91,6 +91,35 @@ void bgr_to_uyvy_init(void)
}
}
+void rgb565_to_uyvy(void *d, const void *s, int pixels)
+{
+ unsigned int *dst = d;
+ const unsigned short *src = s;
+ const unsigned char *yu = yuv_u + 32;
+ const unsigned char *yv = yuv_v + 32;
+ int r0, g0, b0, r1, g1, b1;
+ int y0, y1, u, v;
+
+ for (; pixels > 0; src += 2, dst++, pixels -= 2)
+ {
+ r0 = (src[0] >> 11) & 0x1f;
+ g0 = (src[0] >> 6) & 0x1f;
+ b0 = src[0] & 0x1f;
+ r1 = (src[1] >> 11) & 0x1f;
+ g1 = (src[1] >> 6) & 0x1f;
+ b1 = src[1] & 0x1f;
+ y0 = (yuv_ry[r0] + yuv_gy[g0] + yuv_by[b0]) >> 16;
+ y1 = (yuv_ry[r1] + yuv_gy[g1] + yuv_by[b1]) >> 16;
+ u = yu[b0 - y0];
+ v = yv[r0 - y0];
+ // valid Y range seems to be 16..235
+ y0 = 16 + 219 * y0 / 31;
+ y1 = 16 + 219 * y1 / 31;
+
+ *dst = (y1 << 24) | (v << 16) | (y0 << 8) | u;
+ }
+}
+
void bgr555_to_uyvy(void *d, const void *s, int pixels)
{
unsigned int *dst = d;
@@ -112,7 +141,6 @@ void bgr555_to_uyvy(void *d, const void *s, int pixels)
y1 = (yuv_ry[r1] + yuv_gy[g1] + yuv_by[b1]) >> 16;
u = yu[b0 - y0];
v = yv[r0 - y0];
- // valid Y range seems to be 16..235
y0 = 16 + 219 * y0 / 31;
y1 = 16 + 219 * y1 / 31;
diff --git a/plugins/gpulib/cspace.h b/plugins/gpulib/cspace.h
index 95eae85..1a9e339 100644
--- a/plugins/gpulib/cspace.h
+++ b/plugins/gpulib/cspace.h
@@ -9,6 +9,7 @@ void bgr888_to_rgb565(void *dst, const void *src, int bytes);
void rgb888_to_rgb565(void *dst, const void *src, int bytes);
void bgr_to_uyvy_init(void);
+void rgb565_to_uyvy(void *d, const void *s, int pixels);
void bgr555_to_uyvy(void *d, const void *s, int pixels);
void bgr888_to_uyvy(void *d, const void *s, int pixels);