From 5a01fba679330353ce293b2c744f55b2e51bea7d Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 9 Jun 2009 00:43:01 +0300 Subject: [PATCH] u4 release --- gp2x/gp2x.c | 70 ++++++++++++++++++++++++++------------------ gp2x/readme_gp2x.txt | 26 +++++++++++----- input.c | 4 +-- 3 files changed, 63 insertions(+), 37 deletions(-) diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c index eeefcf6..482eb17 100644 --- a/gp2x/gp2x.c +++ b/gp2x/gp2x.c @@ -122,9 +122,32 @@ static void fb_video_exit() } #endif -void gp2x_init() +static int get_romdir(char *buff, size_t size) { FILE *f; + char *s; + int r = -1; + + f = fopen("romdir.txt", "r"); + if (f == NULL) + return -1; + + s = fgets(buff, size, f); + if (s) + { + r = strlen(s); + while (r > 0 && isspace(buff[r-1])) + buff[--r] = 0; + } + + fclose(f); + return r; +} + +void gp2x_init() +{ + char buff[256]; + gpsp_gp2x_dev = open("/dev/mem", O_RDWR); gpsp_gp2x_dev_audio = open("/dev/mixer", O_RDWR); gpsp_gp2x_memregl = @@ -137,39 +160,28 @@ void gp2x_init() fb_video_init(); #endif - f = fopen("romdir.txt", "r"); - if (f != NULL) - { - char buff[256]; - char *s = fgets(buff, sizeof(buff) - 1, f); - if (s) - { - int r = strlen(s); - while (r > 0 && isspace(buff[r-1])) - buff[--r] = 0; - chdir(buff); - } - fclose(f); - } + if (get_romdir(buff, sizeof(buff)) > 0) + chdir(buff); gp2x_sound_volume(1); } -#include void gp2x_quit() { - char buff[256]; - FILE *f; + char buff1[256], buff2[256]; - getcwd(buff, sizeof(buff)); + getcwd(buff1, sizeof(buff1)); chdir(main_path); - f = fopen("romdir.txt", "r+"); - if (f != NULL) + if (get_romdir(buff2, sizeof(buff2)) >= 0 && + strcmp(buff1, buff2) != 0) { - fprintf(f, "%s", buff); - fclose(f); - truncate("romdir.txt", strlen(buff)); - sync(); + FILE *f = fopen("romdir.txt", "w"); + if (f != NULL) + { + printf("writing romdir: %s\n", buff1); + fprintf(f, "%s", buff1); + fclose(f); + } } warm_finish(); @@ -182,9 +194,9 @@ void gp2x_quit() close(gpsp_gp2x_dev); fcloseall(); - //chdir("/usr/gp2x"); - //execl("gp2xmenu", "gp2xmenu", NULL); - exit(0); + sync(); + chdir("/usr/gp2x"); + execl("gp2xmenu", "gp2xmenu", NULL); } void gp2x_sound_volume(u32 volume_up) @@ -247,6 +259,8 @@ void set_FCLK(u32 MHZ) gpsp_gp2x_memregl[0xf004>>2] = v; gpsp_gp2x_memregl[0xf07c>>2] |= 0x8000; + while (gpsp_gp2x_memregl[0xf07c>>2] & 0x8000) + ; #else #define SYS_CLK_FREQ 7372800 // m = MDIV + 8, p = PDIV + 2, s = SDIV diff --git a/gp2x/readme_gp2x.txt b/gp2x/readme_gp2x.txt index a0af69d..04901a0 100644 --- a/gp2x/readme_gp2x.txt +++ b/gp2x/readme_gp2x.txt @@ -12,13 +12,17 @@ not apply however). Changelog: -0.9-2xb u1 (unofficial notaz release): -- Fixed a problen in thread synchronization which caused deadlock after - some time. - -0.9-2xb u2 (unofficial notaz release): -- Replaced non-working mmuhack.o with proper one, added cache flush calls - to avoid artifacts. +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 + be trusted, it doesn't do double buffering as of firmware 1.0). +- Added new optimized software scaler with interpolation. +- gpSP is now saving ROM dir on exit. Delete romdir.txt if you don't + want that. +- 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. 0.9-2xb u3 (unofficial notaz release, released with permission): - Removed built-in CPU/LCD/RAM-Tweaker. @@ -29,6 +33,14 @@ Changelog: - Fixed centering-on-first-run problem. - 3:2 scaled option now does what it says. +0.9-2xb u2 (unofficial notaz release): +- Replaced non-working mmuhack.o with proper one, added cache flush calls + to avoid artifacts. + +0.9-2xb u1 (unofficial notaz release): +- Fixed a problen in thread synchronization which caused deadlock after + some time. + 0.9-2xb: -- IMPORTANT-- If you're overwriting an old version, be sure to delete the gpsp.cfg file first, or be prepared to have a bunch of weird button diff --git a/input.c b/input.c index cfaff69..153e6ac 100644 --- a/input.c +++ b/input.c @@ -364,10 +364,10 @@ u32 gamepad_config_map[16] = BUTTON_ID_SELECT, // Select BUTTON_ID_L, // Ltrigger BUTTON_ID_R, // Rtrigger - BUTTON_ID_NONE, // A + BUTTON_ID_FPS, // A BUTTON_ID_A, // B BUTTON_ID_B, // X - BUTTON_ID_NONE, // Y + BUTTON_ID_MENU, // Y BUTTON_ID_VOLDOWN, // Vol down BUTTON_ID_VOLUP, // Vol up BUTTON_ID_FPS, // Push -- 2.39.5