summaryrefslogtreecommitdiff
path: root/gp2x
diff options
context:
space:
mode:
authornotaz2009-06-13 22:19:53 +0300
committernotaz2009-06-13 22:19:53 +0300
commit42c8119010bfc48776e8c82e42cceb06d07c0247 (patch)
treeb1b56c057b1b592076f7a38f48a71de65d5cc68e /gp2x
parent73d1a857f28a0fe7f6afaf3ca4c99fca5f50256c (diff)
downloadpicogpsp-42c8119010bfc48776e8c82e42cceb06d07c0247.tar.gz
picogpsp-42c8119010bfc48776e8c82e42cceb06d07c0247.tar.bz2
picogpsp-42c8119010bfc48776e8c82e42cceb06d07c0247.zip
u5 release
Diffstat (limited to 'gp2x')
-rw-r--r--gp2x/gp2x.c88
-rw-r--r--gp2x/gp2x.h5
-rw-r--r--gp2x/readme_gp2x.txt8
3 files changed, 94 insertions, 7 deletions
diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c
index 482eb17..6d9f82e 100644
--- a/gp2x/gp2x.c
+++ b/gp2x/gp2x.c
@@ -46,12 +46,12 @@ static u32 fb_paddr[fb_buf_count];
static void *fb_vaddr[fb_buf_count];
static u32 fb_work_buf;
static int fb_buf_use;
+static int fbdev;
static void fb_video_init()
{
struct fb_fix_screeninfo fbfix;
int i, ret;
- int fbdev;
fbdev = open("/dev/fb0", O_RDWR);
if (fbdev < 0) {
@@ -68,7 +68,6 @@ static void fb_video_init()
printf("framebuffer: \"%s\" @ %08lx\n", fbfix.id, fbfix.smem_start);
fb_paddr[0] = fbfix.smem_start;
- close(fbdev);
fb_vaddr[0] = mmap(0, 320*240*2*fb_buf_count, PROT_READ|PROT_WRITE,
MAP_SHARED, gpsp_gp2x_dev, fb_paddr[0]);
@@ -95,7 +94,6 @@ static void fb_video_init()
void pollux_video_flip()
{
- warm_cache_op_all(WOP_D_CLEAN);
gpsp_gp2x_memregl[0x406C>>2] = fb_paddr[fb_work_buf];
gpsp_gp2x_memregl[0x4058>>2] |= 0x10;
fb_work_buf++;
@@ -114,12 +112,90 @@ void fb_use_buffers(int count)
memset(fb_vaddr[0], 0, 320*240*2*count);
}
+void wiz_lcd_set_portrait(int y)
+{
+ static int old_y = -1;
+ int cmd[2] = { 0, 0 };
+
+ if (old_y == y)
+ return;
+ cmd[0] = y ? 6 : 5;
+ ioctl(fbdev, _IOW('D', 90, int[2]), cmd);
+ gpsp_gp2x_memregl[0x4004>>2] = y ? 0x013f00ef : 0x00ef013f;
+ gpsp_gp2x_memregl[0x4000>>2] |= 1 << 3;
+ old_y = y;
+}
+
static void fb_video_exit()
{
- /* switch to default fb mem */
+ /* switch to default fb mem, turn portrait off */
gpsp_gp2x_memregl[0x406C>>2] = fb_paddr[0];
gpsp_gp2x_memregl[0x4058>>2] |= 0x10;
+ wiz_lcd_set_portrait(0);
+ close(fbdev);
+}
+
+static int wiz_gamepak_fd = -1;
+static u32 wiz_gamepak_size;
+
+static void wiz_gamepak_cleanup()
+{
+ if (wiz_gamepak_size)
+ munmap(gamepak_rom, wiz_gamepak_size);
+ if (wiz_gamepak_fd >= 0)
+ close(wiz_gamepak_fd);
+ gamepak_rom = NULL;
+ wiz_gamepak_size = 0;
+ wiz_gamepak_fd = -1;
}
+
+u32 wiz_load_gamepak(char *name)
+{
+ char *dot_position = strrchr(name, '.');
+ u32 ret;
+
+ if (!strcasecmp(dot_position, ".zip"))
+ {
+ if (wiz_gamepak_fd >= 0)
+ {
+ wiz_gamepak_cleanup();
+ printf("switching to ROM malloc\n");
+ init_gamepak_buffer();
+ }
+ return load_file_zip(name);
+ }
+
+ if (wiz_gamepak_fd < 0)
+ {
+ extern void *gamepak_memory_map;
+ free(gamepak_rom);
+ free(gamepak_memory_map);
+ gamepak_memory_map = NULL;
+ printf("switching to ROM mmap\n");
+ }
+ else
+ wiz_gamepak_cleanup();
+
+ wiz_gamepak_fd = open(name, O_RDONLY|O_NOATIME, S_IRUSR);
+ if (wiz_gamepak_fd < 0)
+ {
+ perror("wiz_load_gamepak: open failed");
+ return -1;
+ }
+
+ ret = lseek(wiz_gamepak_fd, 0, SEEK_END);
+ wiz_gamepak_size = gamepak_ram_buffer_size = ret;
+
+ gamepak_rom = mmap(0, ret, PROT_READ, MAP_SHARED, wiz_gamepak_fd, 0);
+ if (gamepak_rom == MAP_FAILED)
+ {
+ perror("wiz_load_gamepak: mmap failed");
+ return -1;
+ }
+
+ return ret;
+}
+
#endif
static int get_romdir(char *buff, size_t size)
@@ -188,6 +264,7 @@ void gp2x_quit()
#ifdef WIZ_BUILD
close(gpsp_gp2x_gpiodev);
fb_video_exit();
+ wiz_gamepak_cleanup();
#endif
munmap((void *)gpsp_gp2x_memregl, 0x10000);
close(gpsp_gp2x_dev_audio);
@@ -195,8 +272,7 @@ void gp2x_quit()
fcloseall();
sync();
- chdir("/usr/gp2x");
- execl("gp2xmenu", "gp2xmenu", NULL);
+ exit(0);
}
void gp2x_sound_volume(u32 volume_up)
diff --git a/gp2x/gp2x.h b/gp2x/gp2x.h
index a801485..85cdac8 100644
--- a/gp2x/gp2x.h
+++ b/gp2x/gp2x.h
@@ -43,5 +43,10 @@ void upscale_aspect(u16 *dst, u16 *src);
extern void *gpsp_gp2x_screen;
void fb_use_buffers(int count);
void pollux_video_flip();
+void wiz_lcd_set_portrait(int y);
+u32 wiz_load_gamepak(char *name);
+
+void do_rotated_blit(void *dst, void *linesx4, u32 y);
+void upscale_aspect_row(void *dst, void *linesx3, u32 row);
#endif
diff --git a/gp2x/readme_gp2x.txt b/gp2x/readme_gp2x.txt
index 04901a0..9a39fa5 100644
--- a/gp2x/readme_gp2x.txt
+++ b/gp2x/readme_gp2x.txt
@@ -12,6 +12,12 @@ not apply however).
Changelog:
+0.9-2xb u5
+- Added portrait drawing modes. They eliminate tearing but are slightly
+ slower.
+- Added page scrolling in ROM browser with L/R.
+- 32MB ROM support fixed.
+
0.9-2xb u4 (unofficial notaz release, done on Exophase's request)
- Wiz port. No emulation related changes.
- Wiz: dropped SDL for video and hitting hardware directly (GPH SDL can't
@@ -22,7 +28,7 @@ Changelog:
- gpSP now comes with wARM, new kernel module+lib for ARM cache control
(replaces mmuhack).
- gpSP no longer invalidates whole icache after recompilation, might
- case minor speedup.
+ cause minor speedup.
0.9-2xb u3 (unofficial notaz release, released with permission):
- Removed built-in CPU/LCD/RAM-Tweaker.