#include <errno.h>\r
\r
#include "gp2x.h"\r
-#include "../linux/usbjoy.h"\r
#include "../linux/sndout_oss.h"\r
#include "../common/arm_utils.h"\r
#include "../common/arm_linux.h"\r
+#include "../common/emu.h"\r
\r
volatile unsigned short *gp2x_memregs;\r
//static\r
static int touchdev = -1;\r
static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };\r
\r
-void *gp2x_screen;\r
-\r
#define FRAMEBUFF_WHOLESIZE (0x30000*4) // 320*240*2 + some more\r
#define FRAMEBUFF_ADDR0 (0x4000000-FRAMEBUFF_WHOLESIZE)\r
#define FRAMEBUFF_ADDR1 (FRAMEBUFF_ADDR0+0x30000)\r
gp2x_memregs[0x2912>>1] = lsw;\r
\r
// jump to other buffer:\r
- gp2x_screen = gp2x_screens[++screensel&3];\r
+ g_screen_ptr = gp2x_screens[++screensel&3];\r
}\r
\r
/* doulblebuffered flip */\r
gp2x_memregs[0x2912>>1] = 0;\r
\r
// jump to other buffer:\r
- gp2x_screen = gp2x_screens[++screensel&1];\r
+ g_screen_ptr = gp2x_screens[++screensel&1];\r
}\r
\r
\r
void gp2x_video_flush_cache(void)\r
{\r
// since we are using the mmu hack, we must flush the cache first\r
- cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2);\r
+ cache_flush_d_inval_i(g_screen_ptr, (char *)g_screen_ptr + 320*240*2);\r
}\r
\r
\r
\r
void gp2x_pd_clone_buffer2(void)\r
{\r
- memcpy(gp2x_screen, gp2x_screens[2], 320*240*2);\r
+ memcpy(g_screen_ptr, gp2x_screens[2], 320*240*2);\r
}\r
\r
\r
-unsigned long gp2x_joystick_read(int allow_usb_joy)\r
-{\r
- int i;\r
- unsigned long value=(gp2x_memregs[0x1198>>1] & 0x00FF); // GPIO M\r
- if(value==0xFD) value=0xFA;\r
- if(value==0xF7) value=0xEB;\r
- if(value==0xDF) value=0xAF;\r
- if(value==0x7F) value=0xBE;\r
- value = ~((gp2x_memregs[0x1184>>1] & 0xFF00) | value | (gp2x_memregs[0x1186>>1] << 16)); // C D\r
-\r
- if (allow_usb_joy && num_of_joys > 0) {\r
- // check the usb joy as well..\r
- usbjoy_update();\r
- for (i = 0; i < num_of_joys; i++)\r
- value |= usbjoy_check(i);\r
- }\r
-\r
- return value;\r
-}\r
-\r
typedef struct ucb1x00_ts_event\r
{\r
unsigned short pressure;\r
gp2x_screens[0] = mmap(0, FRAMEBUFF_WHOLESIZE, PROT_WRITE, MAP_SHARED, memdev, FRAMEBUFF_ADDR0);\r
if(gp2x_screens[0] == MAP_FAILED)\r
{\r
- perror("mmap(gp2x_screen)");\r
+ perror("mmap(g_screen_ptr)");\r
exit(1);\r
}\r
printf("framebuffers point to %p\n", gp2x_screens[0]);\r
gp2x_screens[2] = (char *) gp2x_screens[1]+0x30000;\r
gp2x_screens[3] = (char *) gp2x_screens[2]+0x30000;\r
\r
- gp2x_screen = gp2x_screens[0];\r
+ g_screen_ptr = gp2x_screens[0];\r
screensel = 0;\r
\r
gp2x_screenaddr_old[0] = gp2x_memregs[0x290E>>1];\r
// snd\r
sndout_oss_init();\r
\r
- /* init usb joys -GnoStiC */\r
- usbjoy_init();\r
-\r
// touchscreen\r
touchdev = open("/dev/touchscreen/wm97xx", O_RDONLY);\r
if (touchdev >= 0) {\r
if (touchdev >= 0) close(touchdev);\r
\r
sndout_oss_exit();\r
- usbjoy_deinit();\r
\r
printf("all done, running ");\r
\r