parent
40a392b00d
commit
108c704a36
|
@ -4,17 +4,22 @@
|
||||||
|
|
||||||
# Global definitions
|
# Global definitions
|
||||||
|
|
||||||
PREFIX ?= /opt/open2x/gcc-4.1.1-glibc-2.3.6
|
CC = $(CROSS_COMPILE)gcc
|
||||||
CC = $(PREFIX)/bin/arm-open2x-linux-gcc
|
|
||||||
STRIP = $(PREFIX)/bin/arm-open2x-linux-strip
|
|
||||||
|
|
||||||
OBJS = main.o cpu.o memory.u video.o input.o sound.o gp2x.o gui.o \
|
OBJS = main.o cpu.o memory.u video.o input.o sound.o gp2x.o gui.o \
|
||||||
cheats.o zip.o cpu_threaded.z arm_stub.o video_blend.o \
|
cheats.o zip.o cpu_threaded.z arm_stub.o video_blend.o \
|
||||||
warm.o upscale_aspect.o
|
warm.o upscale_aspect.o
|
||||||
ifeq ($(WIZ),1)
|
ifeq ($(WIZ),1)
|
||||||
|
POLLUX = 1
|
||||||
OBJS += pollux_dpc_set.o
|
OBJS += pollux_dpc_set.o
|
||||||
BIN = gpsp_wiz
|
BIN = gpsp_wiz
|
||||||
else
|
endif
|
||||||
|
ifeq ($(CAANOO),1)
|
||||||
|
POLLUX = 1
|
||||||
|
OBJS += pollux_dpc_set.o
|
||||||
|
BIN = gpsp_caanoo
|
||||||
|
endif
|
||||||
|
ifeq ($(BIN),)
|
||||||
BIN = gpsp_gp2x
|
BIN = gpsp_gp2x
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -27,14 +32,18 @@ CFLAGS += -DARM_ARCH -DGP2X_BUILD
|
||||||
ifeq ($(WIZ),1)
|
ifeq ($(WIZ),1)
|
||||||
CFLAGS += -DWIZ_BUILD
|
CFLAGS += -DWIZ_BUILD
|
||||||
endif
|
endif
|
||||||
# NOTE: -funroll-loops will slow down compiling considerably
|
ifeq ($(POLLUX),1)
|
||||||
CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \
|
CFLAGS += -DPOLLUX_BUILD
|
||||||
-fno-builtin -Wall \
|
endif
|
||||||
|
CFLAGS += -std=c99 -msoft-float -funsigned-char -Wall -ggdb
|
||||||
|
ifndef DEBUG
|
||||||
|
CFLAGS += -O2
|
||||||
|
endif
|
||||||
|
|
||||||
INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
|
INCLUDES = `sdl-config --cflags`
|
||||||
LIBS = `$(PREFIX)/bin/sdl-config --libs` \
|
LIBS = `sdl-config --libs` \
|
||||||
-lm -ldl -lpthread -lz
|
-lm -ldl -lpthread -lz
|
||||||
ifneq ($(WIZ),1)
|
ifeq ($(WIZ)$(CAANOO),)
|
||||||
LIBS += -static
|
LIBS += -static
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -63,7 +72,6 @@ cpu.o cpu_threaded.z: CFLAGS += -Wno-unused-variable -Wno-unused-label
|
||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
$(CC) $(OBJS) $(LIBS) -o $(BIN)
|
$(CC) $(OBJS) $(LIBS) -o $(BIN)
|
||||||
$(STRIP) $(BIN)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.u *.z $(BIN)
|
rm -f *.o *.u *.z $(BIN)
|
||||||
|
|
198
gp2x/gp2x.c
198
gp2x/gp2x.c
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE 1
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
@ -27,13 +27,15 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <linux/input.h>
|
||||||
#include "gp2x.h"
|
#include "gp2x.h"
|
||||||
#include "pollux_dpc_set.h"
|
#include "pollux_dpc_set.h"
|
||||||
|
|
||||||
static u32 gpsp_gp2x_dev_audio;
|
static u32 gpsp_gp2x_dev_audio;
|
||||||
static u32 gpsp_gp2x_dev;
|
static u32 gpsp_gp2x_dev;
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
static u32 gpsp_gp2x_gpiodev;
|
static u32 gpsp_gp2x_indev;
|
||||||
|
static u32 saved_405c, saved_4060, saved_4058;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static u32 gp2x_audio_volume = 74/2;
|
static u32 gp2x_audio_volume = 74/2;
|
||||||
|
@ -55,10 +57,17 @@ u32 button_plat_mask_to_config[PLAT_BUTTON_COUNT] =
|
||||||
GP2X_B,
|
GP2X_B,
|
||||||
GP2X_X,
|
GP2X_X,
|
||||||
GP2X_Y,
|
GP2X_Y,
|
||||||
|
#if defined(POLLUX_BUILD) && !defined(WIZ_BUILD)
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
GP2X_PUSH,
|
||||||
|
GP2X_HOME,
|
||||||
|
#else
|
||||||
GP2X_VOL_DOWN,
|
GP2X_VOL_DOWN,
|
||||||
GP2X_VOL_UP,
|
GP2X_VOL_UP,
|
||||||
GP2X_PUSH,
|
GP2X_PUSH,
|
||||||
GP2X_VOL_MIDDLE
|
GP2X_VOL_MIDDLE
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 gamepad_config_map[PLAT_BUTTON_COUNT] =
|
u32 gamepad_config_map[PLAT_BUTTON_COUNT] =
|
||||||
|
@ -78,10 +87,10 @@ u32 gamepad_config_map[PLAT_BUTTON_COUNT] =
|
||||||
BUTTON_ID_VOLDOWN, // Vol down
|
BUTTON_ID_VOLDOWN, // Vol down
|
||||||
BUTTON_ID_VOLUP, // Vol up
|
BUTTON_ID_VOLUP, // Vol up
|
||||||
BUTTON_ID_FPS, // Push
|
BUTTON_ID_FPS, // Push
|
||||||
BUTTON_ID_MENU // Vol middle
|
BUTTON_ID_MENU // Vol middle / Home
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
#include <linux/fb.h>
|
#include <linux/fb.h>
|
||||||
void *gpsp_gp2x_screen;
|
void *gpsp_gp2x_screen;
|
||||||
#define fb_buf_count 4
|
#define fb_buf_count 4
|
||||||
|
@ -94,6 +103,7 @@ static int fbdev;
|
||||||
static void fb_video_init()
|
static void fb_video_init()
|
||||||
{
|
{
|
||||||
struct fb_fix_screeninfo fbfix;
|
struct fb_fix_screeninfo fbfix;
|
||||||
|
unsigned int r;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
fbdev = open("/dev/fb0", O_RDWR);
|
fbdev = open("/dev/fb0", O_RDWR);
|
||||||
|
@ -131,14 +141,32 @@ static void fb_video_init()
|
||||||
fb_work_buf = 0;
|
fb_work_buf = 0;
|
||||||
fb_buf_use = fb_buf_count;
|
fb_buf_use = fb_buf_count;
|
||||||
|
|
||||||
|
saved_405c = gpsp_gp2x_memregl[0x405c>>2];
|
||||||
|
saved_4060 = gpsp_gp2x_memregl[0x4060>>2];
|
||||||
|
saved_4058 = gpsp_gp2x_memregl[0x4058>>2];
|
||||||
|
|
||||||
|
// set mode; program both MLCs so that TV-out works
|
||||||
|
gpsp_gp2x_memregl[0x405c>>2] = gpsp_gp2x_memregl[0x445c>>2] = 2;
|
||||||
|
gpsp_gp2x_memregl[0x4060>>2] = gpsp_gp2x_memregl[0x4460>>2] = 320 * 2;
|
||||||
|
|
||||||
|
r = gpsp_gp2x_memregl[0x4058>>2];
|
||||||
|
r = (r & 0xffff) | (0x4432 << 16) | 0x10;
|
||||||
|
gpsp_gp2x_memregl[0x4058>>2] = r;
|
||||||
|
|
||||||
|
r = gpsp_gp2x_memregl[0x4458>>2];
|
||||||
|
r = (r & 0xffff) | (0x4432 << 16) | 0x10;
|
||||||
|
gpsp_gp2x_memregl[0x4458>>2] = r;
|
||||||
|
|
||||||
pollux_video_flip();
|
pollux_video_flip();
|
||||||
warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
|
warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pollux_video_flip()
|
void pollux_video_flip()
|
||||||
{
|
{
|
||||||
gpsp_gp2x_memregl[0x406C>>2] = fb_paddr[fb_work_buf];
|
gpsp_gp2x_memregl[0x406C>>2] =
|
||||||
|
gpsp_gp2x_memregl[0x446C>>2] = fb_paddr[fb_work_buf];
|
||||||
gpsp_gp2x_memregl[0x4058>>2] |= 0x10;
|
gpsp_gp2x_memregl[0x4058>>2] |= 0x10;
|
||||||
|
gpsp_gp2x_memregl[0x4458>>2] |= 0x10;
|
||||||
fb_work_buf++;
|
fb_work_buf++;
|
||||||
if (fb_work_buf >= fb_buf_use)
|
if (fb_work_buf >= fb_buf_use)
|
||||||
fb_work_buf = 0;
|
fb_work_buf = 0;
|
||||||
|
@ -157,6 +185,8 @@ void fb_use_buffers(int count)
|
||||||
|
|
||||||
void wiz_lcd_set_portrait(int y)
|
void wiz_lcd_set_portrait(int y)
|
||||||
{
|
{
|
||||||
|
char *dpc_settings;
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
static int old_y = -1;
|
static int old_y = -1;
|
||||||
int cmd[2] = { 0, 0 };
|
int cmd[2] = { 0, 0 };
|
||||||
|
|
||||||
|
@ -169,14 +199,20 @@ void wiz_lcd_set_portrait(int y)
|
||||||
old_y = y;
|
old_y = y;
|
||||||
|
|
||||||
/* the above ioctl resets LCD timings, so set them here */
|
/* the above ioctl resets LCD timings, so set them here */
|
||||||
pollux_dpc_set(gpsp_gp2x_memregs, getenv("pollux_dpc_set"));
|
#endif
|
||||||
|
|
||||||
|
dpc_settings = getenv("pollux_dpc_set");
|
||||||
|
if (dpc_settings != NULL)
|
||||||
|
pollux_dpc_set(gpsp_gp2x_memregs, dpc_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fb_video_exit()
|
static void fb_video_exit()
|
||||||
{
|
{
|
||||||
/* switch to default fb mem, turn portrait off */
|
/* switch to default fb mem, turn portrait off */
|
||||||
gpsp_gp2x_memregl[0x406C>>2] = fb_paddr[0];
|
gpsp_gp2x_memregl[0x406c>>2] = fb_paddr[0];
|
||||||
gpsp_gp2x_memregl[0x4058>>2] |= 0x10;
|
gpsp_gp2x_memregl[0x405c>>2] = saved_405c;
|
||||||
|
gpsp_gp2x_memregl[0x4060>>2] = saved_4060;
|
||||||
|
gpsp_gp2x_memregl[0x4058>>2] = saved_4058 | 0x10;
|
||||||
wiz_lcd_set_portrait(0);
|
wiz_lcd_set_portrait(0);
|
||||||
close(fbdev);
|
close(fbdev);
|
||||||
}
|
}
|
||||||
|
@ -242,21 +278,94 @@ u32 wiz_load_gamepak(char *name)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#define KEYBITS_BIT(x) (keybits[(x)/sizeof(keybits[0])/8] & \
|
||||||
|
(1 << ((x) & (sizeof(keybits[0])*8-1))))
|
||||||
|
|
||||||
|
static int abs_min, abs_max, lzone_step;
|
||||||
|
|
||||||
|
static int open_caanoo_pad(void)
|
||||||
|
{
|
||||||
|
long keybits[KEY_CNT / sizeof(long) / 8];
|
||||||
|
long absbits[(ABS_MAX+1) / sizeof(long) / 8];
|
||||||
|
struct input_absinfo ainfo;
|
||||||
|
int fd = -1, i;
|
||||||
|
|
||||||
|
memset(keybits, 0, sizeof(keybits));
|
||||||
|
memset(absbits, 0, sizeof(absbits));
|
||||||
|
|
||||||
|
for (i = 0;; i++)
|
||||||
|
{
|
||||||
|
int support = 0, need;
|
||||||
|
int ret;
|
||||||
|
char name[64];
|
||||||
|
|
||||||
|
snprintf(name, sizeof(name), "/dev/input/event%d", i);
|
||||||
|
fd = open(name, O_RDONLY|O_NONBLOCK);
|
||||||
|
if (fd == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* check supported events */
|
||||||
|
ret = ioctl(fd, EVIOCGBIT(0, sizeof(support)), &support);
|
||||||
|
if (ret == -1) {
|
||||||
|
printf("in_evdev: ioctl failed on %s\n", name);
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
need = (1 << EV_KEY) | (1 << EV_ABS);
|
||||||
|
if ((support & need) != need)
|
||||||
|
goto skip;
|
||||||
|
|
||||||
|
ret = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits);
|
||||||
|
if (ret == -1) {
|
||||||
|
printf("in_evdev: ioctl failed on %s\n", name);
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!KEYBITS_BIT(BTN_JOYSTICK))
|
||||||
|
goto skip;
|
||||||
|
|
||||||
|
ret = ioctl(fd, EVIOCGABS(ABS_X), &ainfo);
|
||||||
|
if (ret == -1)
|
||||||
|
goto skip;
|
||||||
|
|
||||||
|
abs_min = ainfo.minimum;
|
||||||
|
abs_max = ainfo.maximum;
|
||||||
|
lzone_step = (abs_max - abs_min) / 2 / 9;
|
||||||
|
|
||||||
|
ioctl(fd, EVIOCGNAME(sizeof(name)), name);
|
||||||
|
printf("using \"%s\" (type %08x)\n", name, support);
|
||||||
|
break;
|
||||||
|
|
||||||
|
skip:
|
||||||
|
close(fd);
|
||||||
|
fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd == -1) {
|
||||||
|
printf("missing input device\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
#endif // POLLUX_BUILD
|
||||||
|
|
||||||
void gpsp_plat_init(void)
|
void gpsp_plat_init(void)
|
||||||
{
|
{
|
||||||
char buff[256];
|
|
||||||
|
|
||||||
gpsp_gp2x_dev = open("/dev/mem", O_RDWR);
|
gpsp_gp2x_dev = open("/dev/mem", O_RDWR);
|
||||||
gpsp_gp2x_dev_audio = open("/dev/mixer", O_RDWR);
|
gpsp_gp2x_dev_audio = open("/dev/mixer", O_RDWR);
|
||||||
gpsp_gp2x_memregl = (u32 *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
|
gpsp_gp2x_memregl = (u32 *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||||
gpsp_gp2x_dev, 0xc0000000);
|
gpsp_gp2x_dev, 0xc0000000);
|
||||||
gpsp_gp2x_memregs = (u16 *)gpsp_gp2x_memregl;
|
gpsp_gp2x_memregs = (u16 *)gpsp_gp2x_memregl;
|
||||||
warm_init();
|
warm_init();
|
||||||
|
#ifdef POLLUX_BUILD
|
||||||
#ifdef WIZ_BUILD
|
#ifdef WIZ_BUILD
|
||||||
gpsp_gp2x_gpiodev = open("/dev/GPIO", O_RDONLY);
|
gpsp_gp2x_indev = open("/dev/GPIO", O_RDONLY);
|
||||||
|
#else
|
||||||
|
gpsp_gp2x_indev = open_caanoo_pad();
|
||||||
|
#endif
|
||||||
fb_video_init();
|
fb_video_init();
|
||||||
|
(void)open_caanoo_pad;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gp2x_sound_volume(1);
|
gp2x_sound_volume(1);
|
||||||
|
@ -264,16 +373,13 @@ void gpsp_plat_init(void)
|
||||||
|
|
||||||
void gpsp_plat_quit(void)
|
void gpsp_plat_quit(void)
|
||||||
{
|
{
|
||||||
char buff1[256], buff2[256];
|
|
||||||
|
|
||||||
getcwd(buff1, sizeof(buff1));
|
|
||||||
chdir(main_path);
|
chdir(main_path);
|
||||||
|
|
||||||
warm_finish();
|
warm_finish();
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
close(gpsp_gp2x_gpiodev);
|
|
||||||
fb_video_exit();
|
|
||||||
wiz_gamepak_cleanup();
|
wiz_gamepak_cleanup();
|
||||||
|
close(gpsp_gp2x_indev);
|
||||||
|
fb_video_exit();
|
||||||
#endif
|
#endif
|
||||||
munmap((void *)gpsp_gp2x_memregl, 0x10000);
|
munmap((void *)gpsp_gp2x_memregl, 0x10000);
|
||||||
close(gpsp_gp2x_dev_audio);
|
close(gpsp_gp2x_dev_audio);
|
||||||
|
@ -302,7 +408,7 @@ u32 gpsp_plat_joystick_read(void)
|
||||||
{
|
{
|
||||||
#ifdef WIZ_BUILD
|
#ifdef WIZ_BUILD
|
||||||
u32 value = 0;
|
u32 value = 0;
|
||||||
read(gpsp_gp2x_gpiodev, &value, 4);
|
read(gpsp_gp2x_indev, &value, 4);
|
||||||
if(value & 0x02)
|
if(value & 0x02)
|
||||||
value |= 0x05;
|
value |= 0x05;
|
||||||
if(value & 0x08)
|
if(value & 0x08)
|
||||||
|
@ -312,7 +418,47 @@ u32 gpsp_plat_joystick_read(void)
|
||||||
if(value & 0x80)
|
if(value & 0x80)
|
||||||
value |= 0x41;
|
value |= 0x41;
|
||||||
return value;
|
return value;
|
||||||
|
#elif defined(POLLUX_BUILD)
|
||||||
|
// caanoo
|
||||||
|
static const int evdev_to_gp2x[] = {
|
||||||
|
GP2X_A, GP2X_X, GP2X_B, GP2X_Y, GP2X_L, GP2X_R,
|
||||||
|
GP2X_HOME, 0, GP2X_START, GP2X_SELECT, GP2X_PUSH
|
||||||
|
};
|
||||||
|
int keybits[KEY_CNT / sizeof(int)];
|
||||||
|
struct input_absinfo ainfo;
|
||||||
|
int lzone = analog_sensitivity_level * lzone_step;
|
||||||
|
u32 retval = 0;
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
|
ret = ioctl(gpsp_gp2x_indev, EVIOCGKEY(sizeof(keybits)), keybits);
|
||||||
|
if (ret == -1) {
|
||||||
|
perror("EVIOCGKEY ioctl failed");
|
||||||
|
sleep(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(evdev_to_gp2x) / sizeof(evdev_to_gp2x[0]); i++) {
|
||||||
|
if (KEYBITS_BIT(BTN_TRIGGER + i))
|
||||||
|
retval |= evdev_to_gp2x[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lzone != 0)
|
||||||
|
lzone--;
|
||||||
|
|
||||||
|
ret = ioctl(gpsp_gp2x_indev, EVIOCGABS(ABS_X), &ainfo);
|
||||||
|
if (ret != -1) {
|
||||||
|
if (ainfo.value <= abs_min + lzone) retval |= GP2X_LEFT;
|
||||||
|
else if (ainfo.value >= abs_max - lzone) retval |= GP2X_RIGHT;
|
||||||
|
}
|
||||||
|
ret = ioctl(gpsp_gp2x_indev, EVIOCGABS(ABS_Y), &ainfo);
|
||||||
|
if (ret != -1) {
|
||||||
|
if (ainfo.value <= abs_min + lzone) retval |= GP2X_UP;
|
||||||
|
else if (ainfo.value >= abs_max - lzone) retval |= GP2X_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
#else
|
#else
|
||||||
|
// GP2X
|
||||||
u32 value = (gpsp_gp2x_memregs[0x1198 >> 1] & 0x00FF);
|
u32 value = (gpsp_gp2x_memregs[0x1198 >> 1] & 0x00FF);
|
||||||
|
|
||||||
if(value == 0xFD)
|
if(value == 0xFD)
|
||||||
|
@ -368,18 +514,24 @@ void set_FCLK(u32 MHZ)
|
||||||
{
|
{
|
||||||
u32 v;
|
u32 v;
|
||||||
u32 mdiv, pdiv, sdiv = 0;
|
u32 mdiv, pdiv, sdiv = 0;
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
|
int i;
|
||||||
#define SYS_CLK_FREQ 27
|
#define SYS_CLK_FREQ 27
|
||||||
// m = MDIV, p = PDIV, s = SDIV
|
// m = MDIV, p = PDIV, s = SDIV
|
||||||
pdiv = 9;
|
pdiv = 9;
|
||||||
mdiv = (MHZ * pdiv) / SYS_CLK_FREQ;
|
mdiv = (MHZ * pdiv) / SYS_CLK_FREQ;
|
||||||
mdiv &= 0x3ff;
|
if (mdiv & ~0x3ff)
|
||||||
|
return;
|
||||||
v = (pdiv<<18) | (mdiv<<8) | sdiv;
|
v = (pdiv<<18) | (mdiv<<8) | sdiv;
|
||||||
|
|
||||||
gpsp_gp2x_memregl[0xf004>>2] = v;
|
gpsp_gp2x_memregl[0xf004>>2] = v;
|
||||||
gpsp_gp2x_memregl[0xf07c>>2] |= 0x8000;
|
gpsp_gp2x_memregl[0xf07c>>2] |= 0x8000;
|
||||||
while (gpsp_gp2x_memregl[0xf07c>>2] & 0x8000)
|
for (i = 0; (gpsp_gp2x_memregl[0xf07c>>2] & 0x8000) && i < 0x100000; i++)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
// must restart sound as it's PLL is shared with CPU one
|
||||||
|
sound_exit();
|
||||||
|
init_sound(0);
|
||||||
#else
|
#else
|
||||||
#define SYS_CLK_FREQ 7372800
|
#define SYS_CLK_FREQ 7372800
|
||||||
// m = MDIV + 8, p = PDIV + 2, s = SDIV
|
// m = MDIV + 8, p = PDIV + 2, s = SDIV
|
||||||
|
|
|
@ -7,8 +7,8 @@ enum
|
||||||
GP2X_LEFT = 1 << 2,
|
GP2X_LEFT = 1 << 2,
|
||||||
GP2X_DOWN = 1 << 4,
|
GP2X_DOWN = 1 << 4,
|
||||||
GP2X_RIGHT = 1 << 6,
|
GP2X_RIGHT = 1 << 6,
|
||||||
GP2X_START = 1 << 8,
|
GP2X_START = 1 << 8, // Wiz: Menu, Caanoo: I
|
||||||
GP2X_SELECT = 1 << 9,
|
GP2X_SELECT = 1 << 9, // Caanoo: II
|
||||||
GP2X_L = 1 << 10,
|
GP2X_L = 1 << 10,
|
||||||
GP2X_R = 1 << 11,
|
GP2X_R = 1 << 11,
|
||||||
GP2X_A = 1 << 12,
|
GP2X_A = 1 << 12,
|
||||||
|
@ -19,6 +19,11 @@ enum
|
||||||
GP2X_VOL_UP = 1 << 16,
|
GP2X_VOL_UP = 1 << 16,
|
||||||
GP2X_VOL_DOWN = 1 << 17,
|
GP2X_VOL_DOWN = 1 << 17,
|
||||||
GP2X_PUSH = 1 << 18,
|
GP2X_PUSH = 1 << 18,
|
||||||
|
#elif defined(POLLUX_BUILD)
|
||||||
|
GP2X_HOME = 1 << 16,
|
||||||
|
GP2X_PUSH = 1 << 17,
|
||||||
|
GP2X_VOL_UP = 1 << 30, // dummy
|
||||||
|
GP2X_VOL_DOWN = 1 << 29,
|
||||||
#else
|
#else
|
||||||
GP2X_VOL_DOWN = 1 << 22,
|
GP2X_VOL_DOWN = 1 << 22,
|
||||||
GP2X_VOL_UP = 1 << 23,
|
GP2X_VOL_UP = 1 << 23,
|
||||||
|
|
41
gui.c
41
gui.c
|
@ -78,7 +78,7 @@
|
||||||
clock_speed = (clock_speed_number + 1) * 33
|
clock_speed = (clock_speed_number + 1) * 33
|
||||||
#define get_clock_speed_number() \
|
#define get_clock_speed_number() \
|
||||||
clock_speed_number = (clock_speed / 33) - 1
|
clock_speed_number = (clock_speed / 33) - 1
|
||||||
#elif defined(WIZ_BUILD)
|
#elif defined(POLLUX_BUILD)
|
||||||
static const char *clock_speed_options[] =
|
static const char *clock_speed_options[] =
|
||||||
{
|
{
|
||||||
"300MHz", "333MHz", "366MHz", "400MHz", "433MHz",
|
"300MHz", "333MHz", "366MHz", "400MHz", "433MHz",
|
||||||
|
@ -735,7 +735,7 @@ u32 gamepad_config_line_to_button[] =
|
||||||
#ifdef GP2X_BUILD
|
#ifdef GP2X_BUILD
|
||||||
|
|
||||||
u32 gamepad_config_line_to_button[] =
|
u32 gamepad_config_line_to_button[] =
|
||||||
{ 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 14 };
|
{ 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 14, 15 };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -753,6 +753,8 @@ static const char *scale_options[] =
|
||||||
#elif defined(WIZ_BUILD)
|
#elif defined(WIZ_BUILD)
|
||||||
"unscaled 3:2", "scaled 3:2 (slower)",
|
"unscaled 3:2", "scaled 3:2 (slower)",
|
||||||
"unscaled 3:2 (anti-tear)", "scaled 3:2 (anti-tear)"
|
"unscaled 3:2 (anti-tear)", "scaled 3:2 (anti-tear)"
|
||||||
|
#elif defined(POLLUX_BUILD)
|
||||||
|
"unscaled 3:2", "scaled 3:2 (slower)"
|
||||||
#elif defined(PND_BUILD)
|
#elif defined(PND_BUILD)
|
||||||
"unscaled", "2x", "3x", "fullscreen"
|
"unscaled", "2x", "3x", "fullscreen"
|
||||||
#elif defined(GP2X_BUILD)
|
#elif defined(GP2X_BUILD)
|
||||||
|
@ -807,7 +809,7 @@ s32 load_game_config_file()
|
||||||
random_skip = file_options[2] % 2;
|
random_skip = file_options[2] % 2;
|
||||||
clock_speed = file_options[3];
|
clock_speed = file_options[3];
|
||||||
|
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
if(clock_speed > 900)
|
if(clock_speed > 900)
|
||||||
clock_speed = 533;
|
clock_speed = 533;
|
||||||
#elif defined(GP2X_BUILD)
|
#elif defined(GP2X_BUILD)
|
||||||
|
@ -843,7 +845,7 @@ s32 load_game_config_file()
|
||||||
|
|
||||||
current_frameskip_type = auto_frameskip;
|
current_frameskip_type = auto_frameskip;
|
||||||
frameskip_value = 4;
|
frameskip_value = 4;
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
frameskip_value = 1;
|
frameskip_value = 1;
|
||||||
#endif
|
#endif
|
||||||
random_skip = 0;
|
random_skip = 0;
|
||||||
|
@ -1531,18 +1533,25 @@ u32 menu(u16 *original_screen)
|
||||||
gamepad_config_option("Right Trigger", 9),
|
gamepad_config_option("Right Trigger", 9),
|
||||||
#ifdef WIZ_BUILD
|
#ifdef WIZ_BUILD
|
||||||
gamepad_config_option("Menu ", 10),
|
gamepad_config_option("Menu ", 10),
|
||||||
#else
|
|
||||||
gamepad_config_option("Start ", 10),
|
|
||||||
#endif
|
|
||||||
gamepad_config_option("Select ", 11),
|
gamepad_config_option("Select ", 11),
|
||||||
#if !defined(WIZ_BUILD) && !defined(PND_BUILD)
|
#elif defined(POLLUX_BUILD)
|
||||||
gamepad_config_option("Stick Push ", 12),
|
gamepad_config_option("I ", 10),
|
||||||
#endif
|
gamepad_config_option("II ", 11),
|
||||||
#ifdef PND_BUILD
|
gamepad_config_option("Push ", 12),
|
||||||
|
gamepad_config_option("Home ", 13),
|
||||||
|
#elif defined(PND_BUILD)
|
||||||
|
gamepad_config_option("Start ", 10),
|
||||||
|
gamepad_config_option("Select ", 11),
|
||||||
gamepad_config_option("1 ", 12),
|
gamepad_config_option("1 ", 12),
|
||||||
gamepad_config_option("2 ", 13),
|
gamepad_config_option("2 ", 13),
|
||||||
gamepad_config_option("3 ", 14),
|
gamepad_config_option("3 ", 14),
|
||||||
gamepad_config_option("4 ", 15),
|
gamepad_config_option("4 ", 15),
|
||||||
|
#else // GP2X
|
||||||
|
gamepad_config_option("Start ", 10),
|
||||||
|
gamepad_config_option("Select ", 11),
|
||||||
|
gamepad_config_option("Stick Push ", 12),
|
||||||
|
#endif
|
||||||
|
#ifdef PND_BUILD
|
||||||
submenu_option(NULL, "Back", "Return to the main menu.", 16)
|
submenu_option(NULL, "Back", "Return to the main menu.", 16)
|
||||||
#else
|
#else
|
||||||
submenu_option(NULL, "Back", "Return to the main menu.", 14)
|
submenu_option(NULL, "Back", "Return to the main menu.", 14)
|
||||||
|
@ -1552,6 +1561,12 @@ u32 menu(u16 *original_screen)
|
||||||
|
|
||||||
menu_option_type analog_config_options[] =
|
menu_option_type analog_config_options[] =
|
||||||
{
|
{
|
||||||
|
#if defined(POLLUX_BUILD)
|
||||||
|
numeric_selection_option(NULL, "Analog sensitivity",
|
||||||
|
&analog_sensitivity_level, 10,
|
||||||
|
"Determine sensitivity/responsiveness of the analog input.\n"
|
||||||
|
"Lower numbers are less sensitive.", 8),
|
||||||
|
#endif
|
||||||
submenu_option(NULL, "Back", "Return to the main menu.", 11)
|
submenu_option(NULL, "Back", "Return to the main menu.", 11)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1596,9 +1611,9 @@ u32 menu(u16 *original_screen)
|
||||||
submenu_option(&gamepad_config_menu, "Configure gamepad input",
|
submenu_option(&gamepad_config_menu, "Configure gamepad input",
|
||||||
"Select to change the in-game behavior of buttons\n"
|
"Select to change the in-game behavior of buttons\n"
|
||||||
"and d-pad.", 6),
|
"and d-pad.", 6),
|
||||||
#ifndef GP2X_BUILD
|
#ifndef WIZ_BUILD
|
||||||
submenu_option(&analog_config_menu, "Configure analog input",
|
submenu_option(&analog_config_menu, "Configure analog input",
|
||||||
"Select to change the in-game behavior of the PSP analog nub.", 7),
|
"Select to change the in-game behavior of the analog nub.", 7),
|
||||||
#endif
|
#endif
|
||||||
submenu_option(&cheats_misc_menu, "Cheats and Miscellaneous options",
|
submenu_option(&cheats_misc_menu, "Cheats and Miscellaneous options",
|
||||||
"Select to manage cheats, set backup behavior,\n"
|
"Select to manage cheats, set backup behavior,\n"
|
||||||
|
|
2
gui.h
2
gui.h
|
@ -36,7 +36,7 @@ void get_savestate_filename_noshot(u32 slot, char *name_buffer);
|
||||||
void get_savestate_filename(u32 slot, char *name_buffer);
|
void get_savestate_filename(u32 slot, char *name_buffer);
|
||||||
void get_savestate_snapshot(char *savestate_filename);
|
void get_savestate_snapshot(char *savestate_filename);
|
||||||
|
|
||||||
#ifdef WIZ_BUILD
|
#ifdef POLLUX_BUILD
|
||||||
#define default_clock_speed 533
|
#define default_clock_speed 533
|
||||||
#elif defined(GP2X_BUILD)
|
#elif defined(GP2X_BUILD)
|
||||||
#define default_clock_speed 200
|
#define default_clock_speed 200
|
||||||
|
|
1
main.c
1
main.c
|
@ -260,6 +260,7 @@ int main(int argc, char *argv[])
|
||||||
gui_action_type gui_action = CURSOR_NONE;
|
gui_action_type gui_action = CURSOR_NONE;
|
||||||
|
|
||||||
debug_screen_start();
|
debug_screen_start();
|
||||||
|
debug_screen_printl(" ");
|
||||||
debug_screen_printl("Sorry, but gpSP requires a Gameboy Advance BIOS ");
|
debug_screen_printl("Sorry, but gpSP requires a Gameboy Advance BIOS ");
|
||||||
debug_screen_printl("image to run correctly. Make sure to get an ");
|
debug_screen_printl("image to run correctly. Make sure to get an ");
|
||||||
debug_screen_printl("authentic one, it'll be exactly 16384 bytes large ");
|
debug_screen_printl("authentic one, it'll be exactly 16384 bytes large ");
|
||||||
|
|
2
sound.h
2
sound.h
|
@ -25,7 +25,7 @@
|
||||||
#define GBA_XTAL 16777216.0f
|
#define GBA_XTAL 16777216.0f
|
||||||
#define GBA_60HZ_RATE 16853760.0f /* 228*(272+960)*60 */
|
#define GBA_60HZ_RATE 16853760.0f /* 228*(272+960)*60 */
|
||||||
|
|
||||||
#if !defined(PSP_BUILD) && !defined(WIZ_BUILD)
|
#if !defined(PSP_BUILD) && !defined(POLLUX_BUILD)
|
||||||
// run GBA at 60Hz (~0.5% faster) to better match host display
|
// run GBA at 60Hz (~0.5% faster) to better match host display
|
||||||
#define GBC_BASE_RATE GBA_60HZ_RATE
|
#define GBC_BASE_RATE GBA_60HZ_RATE
|
||||||
#else
|
#else
|
||||||
|
|
10
video.c
10
video.c
|
@ -86,12 +86,14 @@ static void Ge_Finish_Callback(int id, void *arg)
|
||||||
#define get_screen_pitch() \
|
#define get_screen_pitch() \
|
||||||
screen_pitch \
|
screen_pitch \
|
||||||
|
|
||||||
#elif defined(WIZ_BUILD)
|
#elif defined(POLLUX_BUILD)
|
||||||
|
|
||||||
static u16 rot_buffer[240*4];
|
static u16 rot_buffer[240*4];
|
||||||
static u32 rot_lines_total = 4;
|
static u32 rot_lines_total = 4;
|
||||||
static u32 rot_line_count = 0;
|
static u32 rot_line_count = 0;
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
static char rot_msg_buff[64];
|
static char rot_msg_buff[64];
|
||||||
|
#endif
|
||||||
|
|
||||||
static u32 screen_offset = 0;
|
static u32 screen_offset = 0;
|
||||||
static u16 *screen_pixels = NULL;
|
static u16 *screen_pixels = NULL;
|
||||||
|
@ -3356,7 +3358,7 @@ void flip_screen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIZ_BUILD)
|
#elif defined(POLLUX_BUILD)
|
||||||
|
|
||||||
void flip_screen()
|
void flip_screen()
|
||||||
{
|
{
|
||||||
|
@ -3602,7 +3604,7 @@ void init_video()
|
||||||
GE_CMD(NOP, 0);
|
GE_CMD(NOP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIZ_BUILD) || defined(PND_BUILD)
|
#elif defined(POLLUX_BUILD) || defined(PND_BUILD)
|
||||||
|
|
||||||
void init_video()
|
void init_video()
|
||||||
{
|
{
|
||||||
|
@ -3737,7 +3739,7 @@ void clear_screen(u16 color)
|
||||||
sceGuSync(0, 0); */
|
sceGuSync(0, 0); */
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIZ_BUILD)
|
#elif defined(POLLUX_BUILD)
|
||||||
|
|
||||||
void video_resolution_large()
|
void video_resolution_large()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue