From: notaz <notasas@gmail.com>
Date: Sun, 2 Dec 2007 21:12:48 +0000 (+0000)
Subject: Cyclone poll detection problem fixed
X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6245d5a03dba96b93c7cc0a247d17ff3d9e08325;p=libpicofe.git

Cyclone poll detection problem fixed

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@307 be3aeb3a-fb24-0410-a615-afba39da0efa
---

diff --git a/common/lprintf.h b/common/lprintf.h
index 1d30472..34ec6b7 100644
--- a/common/lprintf.h
+++ b/common/lprintf.h
@@ -1,9 +1,2 @@
-#if defined(__GP2X__)
- #include <stdio.h>
- #define lprintf printf
-#elif defined(PSP)
- extern void lprintf(const char *fmt, ...);
-#else
- #include "giz.h"
-#endif
+extern void lprintf(const char *fmt, ...);
 
diff --git a/gp2x/Makefile b/gp2x/Makefile
index eeb37c7..7c083c1 100644
--- a/gp2x/Makefile
+++ b/gp2x/Makefile
@@ -34,7 +34,7 @@ endif
 DEFINC = -I../.. -I. -DARM -D__GP2X__ # -DBENCHMARK
 COPT_COMMON = -static -Wall -Winline
 ifeq ($(DEBUG),)
-COPT_COMMON += -O2 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
+COPT_COMMON += -O3 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
 else
 COPT_COMMON += -ggdb
 endif
diff --git a/gp2x/emu.c b/gp2x/emu.c
index 701bcd8..3f2ed3f 100644
--- a/gp2x/emu.c
+++ b/gp2x/emu.c
@@ -43,7 +43,7 @@ char romFileName[PATH_MAX];
 
 extern int crashed_940;
 
-static short sndBuffer[2*44100/50];
+static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
 static struct timeval noticeMsgTime = { 0, 0 };	// when started showing
 static int osd_fps_x;
 static int combo_keys = 0, combo_acts = 0;	// keys and actions which need button combos
diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c
index 4995f08..3ed64fb 100644
--- a/gp2x/gp2x.c
+++ b/gp2x/gp2x.c
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
@@ -375,4 +376,13 @@ void gp2x_deinit(void)
 	}
 }
 
+/* lprintf */
+void lprintf(const char *fmt, ...)
+{
+	va_list vl;
+
+	va_start(vl, fmt);
+	vprintf(fmt, vl);
+	va_end(vl);
+}
 
diff --git a/gp2x/menu.c b/gp2x/menu.c
index 8b4968c..ddb9d2e 100644
--- a/gp2x/menu.c
+++ b/gp2x/menu.c
@@ -155,11 +155,12 @@ static void cdload_progress_cb(int percent)
 
 	smalltext_out16(1, 3*10, "Processing CD image / MP3s", 0xffff);
 	smalltext_out16_lim(1, 4*10, romFileName, 0xffff, 80);
-	dst += 30;
+	dst += 320*30;
 
 	if (len > 320) len = 320;
 	for (ln = 8; ln > 0; ln--, dst += 320)
 		memset(dst, 0xff, len*2);
+	menu_flip();
 	cdload_called = 1;
 }
 
@@ -182,7 +183,7 @@ void menu_romload_prepare(const char *rom_name)
 
 void menu_romload_end(void)
 {
-	PicoCartLoadProgressCB = NULL;
+	PicoCartLoadProgressCB = PicoCDLoadProgressCB = NULL;
 	smalltext_out16(1, cdload_called ? 60 : 30, "Starting emulation...", 0xffff);
 	menu_flip();
 }
diff --git a/gp2x/port_config.h b/gp2x/port_config.h
index 5d9bf04..1503593 100644
--- a/gp2x/port_config.h
+++ b/gp2x/port_config.h
@@ -18,7 +18,7 @@
 #define CAN_HANDLE_240_LINES	1
 
 // logging emu events
-#define EL_LOGMASK 0 // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff
+#define EL_LOGMASK EL_STATUS // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff
 
 //#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
 #define dprintf(x...)
diff --git a/linux/gp2x.c b/linux/gp2x.c
index 3b43c3d..b89990b 100644
--- a/linux/gp2x.c
+++ b/linux/gp2x.c
@@ -428,5 +428,13 @@ void spend_cycles(int c)
 	usleep(c/200);
 }
 
+/* lprintf */
+void lprintf(const char *fmt, ...)
+{
+	va_list vl;
 
+	va_start(vl, fmt);
+	vprintf(fmt, vl);
+	va_end(vl);
+}