#define vprintf(format, ap) \
vfprintf(stderr, format, ap) \
- void gp2x_overclock(void);
-
// #define STDIO_DEBUG
#endif
# 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
CC = $(PREFIX)/bin/arm-open2x-linux-gcc
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 \
- cheats.o zip.o cpu_threaded.z cpuctrl_mmsp2.o \
- arm_stub.o video_blend.o flush_cache.o
+ cheats.o zip.o cpu_threaded.z arm_stub.o video_blend.o \
+ flush_cache.o warm.o sys_cacheflush.o
BIN = gpsp.gpe
# Platform specific definitions
VPATH += ..
CFLAGS += -DARM_ARCH -DGP2X_BUILD
+ifeq ($(WIZ),1)
+CFLAGS += -DWIZ_BUILD
+endif
# NOTE: -funroll-loops will slow down compiling considerably
CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \
-fno-builtin \
INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
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:
all: $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $(BIN)
- $(STRIP) $(BIN)
+# $(STRIP) $(BIN)
clean:
rm -f *.o *.u *.z $(BIN)
restore_flags()
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:
- mov r2, #0x1
- swi 0x9f0002
+ sub r2,r1,r0
+ 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
#include <sys/soundcard.h>
#include "../common.h"
#include "gp2x.h"
+#include "warm.h"
extern int main_cpuspeed(int argc, char *argv[]);
extern SDL_Surface* screen;
u32 gp2x_audio_volume = 74/2;
u32 gpsp_gp2x_dev_audio = 0;
u32 gpsp_gp2x_dev = 0;
+u32 gpsp_gp2x_gpiodev = 0;
-volatile u16 *gpsp_gp2x_memregs;
-volatile u32 *gpsp_gp2x_memregl;
+static volatile u16 *gpsp_gp2x_memregs;
+static volatile u32 *gpsp_gp2x_memregl;
unsigned short *gp2x_memregs;
static volatile u16 *MEM_REG;
return 0;
}
-void gp2x_overclock()
+void gp2x_init()
{
gpsp_gp2x_dev = open("/dev/mem", O_RDWR);
gpsp_gp2x_dev_audio = open("/dev/mixer", O_RDWR);
(unsigned long *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
gpsp_gp2x_dev, 0xc0000000);
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);
// main_cpuspeed(0, NULL);
munmap((void *)gpsp_gp2x_memregl, 0x10000);
close(gpsp_gp2x_dev_audio);
close(gpsp_gp2x_dev);
+#ifdef WIZ_BUILD
+ close(gpsp_gp2x_gpiodev);
+#endif
- chdir("/usr/gp2x");
- execl("gp2xmenu", "gp2xmenu", NULL);
+ //chdir("/usr/gp2x");
+ //execl("gp2xmenu", "gp2xmenu", NULL);
+ exit(0);
}
void gp2x_sound_volume(u32 volume_up)
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
+
GP2X_B = 1 << 13,
GP2X_X = 1 << 14,
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_UP = 1 << 23,
- GP2X_PUSH = 1 << 27
+ GP2X_PUSH = 1 << 27,
+#endif
};
extern u32 gpsp_gp2x_dev_audio;
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_quit();
&audio_buffer_size_number, 10,
#endif
+#ifdef PSP_BUILD
"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"
"value will give the most responsive audio.\n"
"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),
submenu_option(NULL, "Back", "Return to the main menu.", 12)
};
};
extern u32 gp2x_fps_debug;
-
-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));
-}
+extern u32 gpsp_gp2x_joystick_read(void);
gui_action_type get_gui_input()
{
u64 last_frame_interval_timestamp;
u32 gp2x_fps_debug = 0;
+void gp2x_init(void);
void gp2x_quit(void);
#else
#ifdef GP2X_BUILD
if(gp2x_load_mmuhack() == -1)
- delay_us(2500000);
+;// delay_us(2500000);
#endif
#ifdef PSP_BUILD
sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0,
vblank_interrupt_handler, NULL);
sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
-#else
+#elif !defined(GP2X_BUILD)
freopen("CON", "wb", stdout);
#endif
#ifdef GP2X_BUILD
// Overclocking GP2X and MMU patch goes here
- gp2x_overclock();
+ gp2x_init();
#endif
#ifdef GP2X_BUILD
#else
#ifdef GP2X_BUILD
-#include "SDL_gp2x.h"
-SDL_Surface *hw_screen;
+ #ifdef WIZ_BUILD
+ static void SDL_GP2X_AllowGfxMemory() {}
+ #include <SDL.h>
+ #else
+ #include "SDL_gp2x.h"
+ #endif
+ SDL_Surface *hw_screen;
#endif
SDL_Surface *screen;
const u32 video_scale = 1;