wiz port wip
This commit is contained in:
parent
a6c41a382b
commit
4742480dca
2
common.h
2
common.h
|
@ -268,8 +268,6 @@ typedef u32 fixed16_16;
|
||||||
#define vprintf(format, ap) \
|
#define vprintf(format, ap) \
|
||||||
vfprintf(stderr, format, ap) \
|
vfprintf(stderr, format, ap) \
|
||||||
|
|
||||||
void gp2x_overclock(void);
|
|
||||||
|
|
||||||
// #define STDIO_DEBUG
|
// #define STDIO_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4,26 +4,42 @@
|
||||||
|
|
||||||
# Global definitions
|
# Global definitions
|
||||||
|
|
||||||
|
ifeq ($(WIZ),1)
|
||||||
|
PREFIX = /opt/arm-openwiz-linux-gnu
|
||||||
|
CC = $(PREFIX)/bin/arm-openwiz-linux-gnu-gcc
|
||||||
|
STRIP = $(PREFIX)/bin/arm-openwiz-linux-gnu-strip
|
||||||
|
else
|
||||||
PREFIX = /opt/open2x/gcc-4.1.1-glibc-2.3.6
|
PREFIX = /opt/open2x/gcc-4.1.1-glibc-2.3.6
|
||||||
CC = $(PREFIX)/bin/arm-open2x-linux-gcc
|
CC = $(PREFIX)/bin/arm-open2x-linux-gcc
|
||||||
STRIP = $(PREFIX)/bin/arm-open2x-linux-strip
|
STRIP = $(PREFIX)/bin/arm-open2x-linux-strip
|
||||||
|
endif
|
||||||
|
|
||||||
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 cpuctrl_mmsp2.o \
|
cheats.o zip.o cpu_threaded.z arm_stub.o video_blend.o \
|
||||||
arm_stub.o video_blend.o flush_cache.o
|
flush_cache.o warm.o sys_cacheflush.o
|
||||||
BIN = gpsp.gpe
|
BIN = gpsp.gpe
|
||||||
|
|
||||||
# Platform specific definitions
|
# Platform specific definitions
|
||||||
|
|
||||||
VPATH += ..
|
VPATH += ..
|
||||||
CFLAGS += -DARM_ARCH -DGP2X_BUILD
|
CFLAGS += -DARM_ARCH -DGP2X_BUILD
|
||||||
|
ifeq ($(WIZ),1)
|
||||||
|
CFLAGS += -DWIZ_BUILD
|
||||||
|
endif
|
||||||
# NOTE: -funroll-loops will slow down compiling considerably
|
# NOTE: -funroll-loops will slow down compiling considerably
|
||||||
CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \
|
CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \
|
||||||
-fno-builtin \
|
-fno-builtin \
|
||||||
|
|
||||||
INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
|
INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
|
||||||
LIBS = `$(PREFIX)/bin/sdl-config --libs` \
|
LIBS = `$(PREFIX)/bin/sdl-config --libs` \
|
||||||
-lm -ldl -lpthread -lz -static
|
-lm -ldl -lpthread -lz
|
||||||
|
ifneq ($(WIZ),1)
|
||||||
|
OBJS += cpuctrl_mmsp2.o
|
||||||
|
LIBS += -static
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -ggdb
|
||||||
|
LIBS += -ggdb
|
||||||
|
|
||||||
# Compilation:
|
# Compilation:
|
||||||
|
|
||||||
|
@ -43,7 +59,7 @@ LIBS = `$(PREFIX)/bin/sdl-config --libs` \
|
||||||
|
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
$(CC) $(OBJS) $(LIBS) -o $(BIN)
|
$(CC) $(OBJS) $(LIBS) -o $(BIN)
|
||||||
$(STRIP) $(BIN)
|
# $(STRIP) $(BIN)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.u *.z $(BIN)
|
rm -f *.o *.u *.z $(BIN)
|
||||||
|
|
|
@ -996,17 +996,25 @@ step_debug_arm:
|
||||||
restore_flags()
|
restore_flags()
|
||||||
add pc, lr, #4 @ return, skipping PC
|
add pc, lr, #4 @ return, skipping PC
|
||||||
|
|
||||||
invalidate_icache_region:
|
|
||||||
mov r2, #0x0
|
|
||||||
swi 0x9f0002
|
|
||||||
|
|
||||||
bx lr
|
#include "warm.h"
|
||||||
|
|
||||||
|
invalidate_icache_region:
|
||||||
|
mov r2,r1
|
||||||
|
mov r1,r0
|
||||||
|
mov r0,#WOP_I_INVALIDATE
|
||||||
|
b warm_cache_op_range
|
||||||
|
|
||||||
invalidate_cache_region:
|
invalidate_cache_region:
|
||||||
mov r2, #0x1
|
sub r2,r1,r0
|
||||||
swi 0x9f0002
|
mov r1,r0
|
||||||
|
mov r0,#(WOP_D_CLEAN|WOP_I_INVALIDATE)
|
||||||
|
b warm_cache_op_range
|
||||||
|
|
||||||
bx lr
|
@ mov r2, #0
|
||||||
|
@ swi 0x9f0002
|
||||||
|
|
||||||
|
@ bx lr
|
||||||
|
|
||||||
|
|
||||||
.comm memory_map_read 0x8000
|
.comm memory_map_read 0x8000
|
||||||
|
|
61
gp2x/gp2x.c
61
gp2x/gp2x.c
|
@ -24,6 +24,7 @@
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "gp2x.h"
|
#include "gp2x.h"
|
||||||
|
#include "warm.h"
|
||||||
|
|
||||||
extern int main_cpuspeed(int argc, char *argv[]);
|
extern int main_cpuspeed(int argc, char *argv[]);
|
||||||
extern SDL_Surface* screen;
|
extern SDL_Surface* screen;
|
||||||
|
@ -31,9 +32,10 @@ extern SDL_Surface* screen;
|
||||||
u32 gp2x_audio_volume = 74/2;
|
u32 gp2x_audio_volume = 74/2;
|
||||||
u32 gpsp_gp2x_dev_audio = 0;
|
u32 gpsp_gp2x_dev_audio = 0;
|
||||||
u32 gpsp_gp2x_dev = 0;
|
u32 gpsp_gp2x_dev = 0;
|
||||||
|
u32 gpsp_gp2x_gpiodev = 0;
|
||||||
|
|
||||||
volatile u16 *gpsp_gp2x_memregs;
|
static volatile u16 *gpsp_gp2x_memregs;
|
||||||
volatile u32 *gpsp_gp2x_memregl;
|
static volatile u32 *gpsp_gp2x_memregl;
|
||||||
unsigned short *gp2x_memregs;
|
unsigned short *gp2x_memregs;
|
||||||
|
|
||||||
static volatile u16 *MEM_REG;
|
static volatile u16 *MEM_REG;
|
||||||
|
@ -55,7 +57,7 @@ s32 gp2x_load_mmuhack()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_overclock()
|
void gp2x_init()
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@ -63,6 +65,10 @@ void gp2x_overclock()
|
||||||
(unsigned long *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
|
(unsigned long *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
|
||||||
gpsp_gp2x_dev, 0xc0000000);
|
gpsp_gp2x_dev, 0xc0000000);
|
||||||
gpsp_gp2x_memregs = (unsigned short *)gpsp_gp2x_memregl;
|
gpsp_gp2x_memregs = (unsigned short *)gpsp_gp2x_memregl;
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
|
gpsp_gp2x_gpiodev = open("/dev/GPIO", O_RDONLY);
|
||||||
|
#endif
|
||||||
|
warm_init();
|
||||||
|
|
||||||
clear_screen(0);
|
clear_screen(0);
|
||||||
// main_cpuspeed(0, NULL);
|
// main_cpuspeed(0, NULL);
|
||||||
|
@ -76,9 +82,13 @@ void gp2x_quit()
|
||||||
munmap((void *)gpsp_gp2x_memregl, 0x10000);
|
munmap((void *)gpsp_gp2x_memregl, 0x10000);
|
||||||
close(gpsp_gp2x_dev_audio);
|
close(gpsp_gp2x_dev_audio);
|
||||||
close(gpsp_gp2x_dev);
|
close(gpsp_gp2x_dev);
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
|
close(gpsp_gp2x_gpiodev);
|
||||||
|
#endif
|
||||||
|
|
||||||
chdir("/usr/gp2x");
|
//chdir("/usr/gp2x");
|
||||||
execl("gp2xmenu", "gp2xmenu", NULL);
|
//execl("gp2xmenu", "gp2xmenu", NULL);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_sound_volume(u32 volume_up)
|
void gp2x_sound_volume(u32 volume_up)
|
||||||
|
@ -95,3 +105,44 @@ void gp2x_sound_volume(u32 volume_up)
|
||||||
ioctl(gpsp_gp2x_dev_audio, SOUND_MIXER_WRITE_PCM, &volume);
|
ioctl(gpsp_gp2x_dev_audio, SOUND_MIXER_WRITE_PCM, &volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 gpsp_gp2x_joystick_read(void)
|
||||||
|
{
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
|
u32 value = 0;
|
||||||
|
read(gpsp_gp2x_gpiodev, &value, 4);
|
||||||
|
if(value & 0x02)
|
||||||
|
value |= 0x05;
|
||||||
|
if(value & 0x08)
|
||||||
|
value |= 0x14;
|
||||||
|
if(value & 0x20)
|
||||||
|
value |= 0x50;
|
||||||
|
if(value & 0x80)
|
||||||
|
value |= 0x41;
|
||||||
|
return value;
|
||||||
|
#else
|
||||||
|
u32 value = (gpsp_gp2x_memregs[0x1198 >> 1] & 0x00FF);
|
||||||
|
|
||||||
|
if(value == 0xFD)
|
||||||
|
value = 0xFA;
|
||||||
|
if(value == 0xF7)
|
||||||
|
value = 0xEB;
|
||||||
|
if(value == 0xDF)
|
||||||
|
value = 0xAF;
|
||||||
|
if(value == 0x7F)
|
||||||
|
value = 0xBE;
|
||||||
|
|
||||||
|
return ~((gpsp_gp2x_memregs[0x1184 >> 1] & 0xFF00) | value |
|
||||||
|
(gpsp_gp2x_memregs[0x1186 >> 1] << 16));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
|
void cpuctrl_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_FCLK(u32 MHZ)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
10
gp2x/gp2x.h
10
gp2x/gp2x.h
|
@ -15,16 +15,20 @@ enum
|
||||||
GP2X_B = 1 << 13,
|
GP2X_B = 1 << 13,
|
||||||
GP2X_X = 1 << 14,
|
GP2X_X = 1 << 14,
|
||||||
GP2X_Y = 1 << 15,
|
GP2X_Y = 1 << 15,
|
||||||
|
#ifdef WIZ_BUILD
|
||||||
|
GP2X_VOL_UP = 1 << 16,
|
||||||
|
GP2X_VOL_DOWN = 1 << 17,
|
||||||
|
GP2X_PUSH = 1 << 18,
|
||||||
|
#else
|
||||||
GP2X_VOL_DOWN = 1 << 22,
|
GP2X_VOL_DOWN = 1 << 22,
|
||||||
GP2X_VOL_UP = 1 << 23,
|
GP2X_VOL_UP = 1 << 23,
|
||||||
GP2X_PUSH = 1 << 27
|
GP2X_PUSH = 1 << 27,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern u32 gpsp_gp2x_dev_audio;
|
extern u32 gpsp_gp2x_dev_audio;
|
||||||
extern u32 gpsp_gp2x_dev;
|
extern u32 gpsp_gp2x_dev;
|
||||||
extern volatile u16 *gpsp_gp2x_memregs;
|
|
||||||
extern volatile u32 *gpsp_gp2x_memregl;
|
|
||||||
|
|
||||||
void gp2x_sound_volume(u32 volume_up);
|
void gp2x_sound_volume(u32 volume_up);
|
||||||
void gp2x_quit();
|
void gp2x_quit();
|
||||||
|
|
5
gui.c
5
gui.c
|
@ -1281,10 +1281,15 @@ u32 menu(u16 *original_screen)
|
||||||
&audio_buffer_size_number, 10,
|
&audio_buffer_size_number, 10,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PSP_BUILD
|
||||||
"Set the size (in bytes) of the audio buffer. Larger values may result\n"
|
"Set the size (in bytes) of the audio buffer. Larger values may result\n"
|
||||||
"in slightly better performance at the cost of latency; the lowest\n"
|
"in slightly better performance at the cost of latency; the lowest\n"
|
||||||
"value will give the most responsive audio.\n"
|
"value will give the most responsive audio.\n"
|
||||||
"This option requires gpSP to be restarted before it will take effect.",
|
"This option requires gpSP to be restarted before it will take effect.",
|
||||||
|
#else
|
||||||
|
"Set the size (in bytes) of the audio buffer.\n"
|
||||||
|
"This option requires gpSP restart to take effect.",
|
||||||
|
#endif
|
||||||
10),
|
10),
|
||||||
submenu_option(NULL, "Back", "Return to the main menu.", 12)
|
submenu_option(NULL, "Back", "Return to the main menu.", 12)
|
||||||
};
|
};
|
||||||
|
|
18
input.c
18
input.c
|
@ -375,23 +375,7 @@ u32 gamepad_config_map[16] =
|
||||||
};
|
};
|
||||||
|
|
||||||
extern u32 gp2x_fps_debug;
|
extern u32 gp2x_fps_debug;
|
||||||
|
extern u32 gpsp_gp2x_joystick_read(void);
|
||||||
u32 gpsp_gp2x_joystick_read(void)
|
|
||||||
{
|
|
||||||
u32 value = (gpsp_gp2x_memregs[0x1198 >> 1] & 0x00FF);
|
|
||||||
|
|
||||||
if(value == 0xFD)
|
|
||||||
value = 0xFA;
|
|
||||||
if(value == 0xF7)
|
|
||||||
value = 0xEB;
|
|
||||||
if(value == 0xDF)
|
|
||||||
value = 0xAF;
|
|
||||||
if(value == 0x7F)
|
|
||||||
value = 0xBE;
|
|
||||||
|
|
||||||
return ~((gpsp_gp2x_memregs[0x1184 >> 1] & 0xFF00) | value |
|
|
||||||
(gpsp_gp2x_memregs[0x1186 >> 1] << 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
gui_action_type get_gui_input()
|
gui_action_type get_gui_input()
|
||||||
{
|
{
|
||||||
|
|
7
main.c
7
main.c
|
@ -49,6 +49,7 @@ u64 frame_count_initial_timestamp = 0;
|
||||||
u64 last_frame_interval_timestamp;
|
u64 last_frame_interval_timestamp;
|
||||||
u32 gp2x_fps_debug = 0;
|
u32 gp2x_fps_debug = 0;
|
||||||
|
|
||||||
|
void gp2x_init(void);
|
||||||
void gp2x_quit(void);
|
void gp2x_quit(void);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -194,14 +195,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#ifdef GP2X_BUILD
|
#ifdef GP2X_BUILD
|
||||||
if(gp2x_load_mmuhack() == -1)
|
if(gp2x_load_mmuhack() == -1)
|
||||||
delay_us(2500000);
|
;// delay_us(2500000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PSP_BUILD
|
#ifdef PSP_BUILD
|
||||||
sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0,
|
sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0,
|
||||||
vblank_interrupt_handler, NULL);
|
vblank_interrupt_handler, NULL);
|
||||||
sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
|
sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
|
||||||
#else
|
#elif !defined(GP2X_BUILD)
|
||||||
freopen("CON", "wb", stdout);
|
freopen("CON", "wb", stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#ifdef GP2X_BUILD
|
#ifdef GP2X_BUILD
|
||||||
// Overclocking GP2X and MMU patch goes here
|
// Overclocking GP2X and MMU patch goes here
|
||||||
gp2x_overclock();
|
gp2x_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GP2X_BUILD
|
#ifdef GP2X_BUILD
|
||||||
|
|
9
video.c
9
video.c
|
@ -88,8 +88,13 @@ static void Ge_Finish_Callback(int id, void *arg)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef GP2X_BUILD
|
#ifdef GP2X_BUILD
|
||||||
#include "SDL_gp2x.h"
|
#ifdef WIZ_BUILD
|
||||||
SDL_Surface *hw_screen;
|
static void SDL_GP2X_AllowGfxMemory() {}
|
||||||
|
#include <SDL.h>
|
||||||
|
#else
|
||||||
|
#include "SDL_gp2x.h"
|
||||||
|
#endif
|
||||||
|
SDL_Surface *hw_screen;
|
||||||
#endif
|
#endif
|
||||||
SDL_Surface *screen;
|
SDL_Surface *screen;
|
||||||
const u32 video_scale = 1;
|
const u32 video_scale = 1;
|
||||||
|
|
Loading…
Reference in New Issue