notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
'and A,A' fixed, some reorganization
[picodrive.git]
/
platform
/
linux
/
gp2x.c
diff --git
a/platform/linux/gp2x.c
b/platform/linux/gp2x.c
index
6e44243
..
4a7c556
100644
(file)
--- a/
platform/linux/gp2x.c
+++ b/
platform/linux/gp2x.c
@@
-3,6
+3,7
@@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#include <semaphore.h>
#include <gtk/gtk.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <unistd.h>
@@
-18,6
+19,8
@@
#include "../gp2x/usbjoy.h"
#include "../gp2x/version.h"
#include "../gp2x/usbjoy.h"
#include "../gp2x/version.h"
+#include "log_io.h"
+
void *gp2x_screen;
static int current_bpp = 8;
static int current_pal[256];
void *gp2x_screen;
static int current_bpp = 8;
static int current_pal[256];
@@
-27,6
+30,7
@@
static const char *verstring = "PicoDrive " VERSION;
// dummies
char *ext_menu = 0, *ext_state = 0;
// dummies
char *ext_menu = 0, *ext_state = 0;
+int mix_32_to_16l_level;
/* gtk */
struct gtk_global_struct
/* gtk */
struct gtk_global_struct
@@
-65,6
+69,8
@@
static gint key_press_event (GtkWidget *widget, GdkEventKey *event)
case 0x29: current_keys |= GP2X_PUSH; break; // f
case 0x18: current_keys |= GP2X_VOL_DOWN;break; // q
case 0x19: current_keys |= GP2X_VOL_UP;break; // w
case 0x29: current_keys |= GP2X_PUSH; break; // f
case 0x18: current_keys |= GP2X_VOL_DOWN;break; // q
case 0x19: current_keys |= GP2X_VOL_UP;break; // w
+ case 0x2d: log_io_clear(); break; // k
+ case 0x2e: log_io_dump(); break; // l
}
return 0;
}
return 0;
@@
-94,22
+100,12
@@
static gint key_release_event (GtkWidget *widget, GdkEventKey *event)
return 0;
}
return 0;
}
-static void *gtk_threadf(void *none)
-{
- gtk_main();
-
- printf("linux: gtk thread finishing\n");
- engineState = PGS_Quit;
-
- return NULL;
-}
-
-static void gtk_initf(void)
+static void *gtk_threadf(void *targ)
{
int argc = 0;
char *argv[] = { "" };
GtkWidget *box;
{
int argc = 0;
char *argv[] = { "" };
GtkWidget *box;
-
pthread_t gtk_thread
;
+
sem_t *sem = targ
;
g_thread_init (NULL);
gdk_threads_init ();
g_thread_init (NULL);
gdk_threads_init ();
@@
-145,11
+141,27
@@
static void gtk_initf(void)
gtk_widget_show (gtk_items.window);
gtk_widget_show (gtk_items.window);
- // pthread_mutex_init (&thr_mutex, NULL);
- // pthread_mutex_lock (&thr_mutex);
- // pthread_mutex_init (&scanner_muttex, NULL);
+ sem_post(sem);
+
+ gtk_main();
+
+ printf("linux: gtk thread finishing\n");
+ exit(1);
+
+ return NULL;
+}
+
+static void gtk_initf(void)
+{
+ pthread_t gtk_thread;
+ sem_t sem;
+ sem_init(&sem, 0, 0);
+
+ pthread_create(>k_thread, NULL, gtk_threadf, &sem);
+ pthread_detach(gtk_thread);
- pthread_create(>k_thread, NULL, gtk_threadf, NULL);
+ sem_wait(&sem);
+ sem_close(&sem);
}
void finalize_image(guchar *pixels, gpointer data)
}
void finalize_image(guchar *pixels, gpointer data)
@@
-164,6
+176,7
@@
void gp2x_init(void)
printf("entering init()\n"); fflush(stdout);
gp2x_screen = malloc(320*240*2 + 320*2);
printf("entering init()\n"); fflush(stdout);
gp2x_screen = malloc(320*240*2 + 320*2);
+ memset(gp2x_screen, 0, 320*240*2 + 320*2);
// snd
mixerdev = open("/dev/mixer", O_RDWR);
// snd
mixerdev = open("/dev/mixer", O_RDWR);
@@
-236,18
+249,38
@@
void gp2x_video_flip(void)
gdk_threads_leave();
}
gdk_threads_leave();
}
+void gp2x_video_flip2(void)
+{
+ gp2x_video_flip();
+}
+
void gp2x_video_changemode(int bpp)
{
current_bpp = bpp;
}
void gp2x_video_changemode(int bpp)
{
current_bpp = bpp;
}
+void gp2x_video_changemode2(int bpp)
+{
+ current_bpp = bpp;
+}
+
void gp2x_video_setpalette(int *pal, int len)
{
memcpy(current_pal, pal, len*4);
}
void gp2x_video_setpalette(int *pal, int len)
{
memcpy(current_pal, pal, len*4);
}
-void gp2x_video_RGB_setscaling(int W, int H)
+void gp2x_video_flush_cache(void)
+{
+}
+
+void gp2x_video_RGB_setscaling(int v_offs, int W, int H)
+{
+}
+
+void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)
{
{
+ if ((char *)gp2x_screen + offset != data)
+ memcpy((char *)gp2x_screen + offset, data, len);
}
void gp2x_memcpy_all_buffers(void *data, int offset, int len)
}
void gp2x_memcpy_all_buffers(void *data, int offset, int len)
@@
-261,6
+294,10
@@
void gp2x_memset_all_buffers(int offset, int byte, int len)
memset((char *)gp2x_screen + offset, byte, len);
}
memset((char *)gp2x_screen + offset, byte, len);
}
+void gp2x_pd_clone_buffer2(void)
+{
+ memset(gp2x_screen, 0, 320*240*2);
+}
/* sound */
static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
/* sound */
static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
@@
-361,10
+398,17
@@
void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, in
{
}
{
}
-void set_gamma(int g100)
+void set_gamma(int g100
, int A_SNs_curve
)
{
}
{
}
+void set_LCD_custom_rate(int rate)
+{
+}
+
+void unset_LCD_custom_rate(void)
+{
+}
/* squidgehack.c */
int mmuhack(void)
/* squidgehack.c */
int mmuhack(void)
@@
-382,8
+426,16
@@
int mmuunhack(void)
/* misc */
void spend_cycles(int c)
{
/* misc */
void spend_cycles(int c)
{
- usleep(c/
*/200*/
);
+ usleep(c/
200
);
}
}
+/* lprintf */
+void lprintf(const char *fmt, ...)
+{
+ va_list vl;
+ va_start(vl, fmt);
+ vprintf(fmt, vl);
+ va_end(vl);
+}