mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
pandora: tripplebuffer fbdev out, refactoring
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@845 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
fbe111032e
commit
b188c2b6d0
17 changed files with 404 additions and 171 deletions
62
linux/io.c
62
linux/io.c
|
@ -2,13 +2,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "../common/emu.h"
|
||||
#include "../common/menu.h"
|
||||
|
@ -17,15 +10,23 @@
|
|||
|
||||
#include "log_io.h"
|
||||
|
||||
unsigned long current_keys = 0;
|
||||
int current_keys;
|
||||
unsigned char *PicoDraw2FB;
|
||||
|
||||
#ifdef FBDEV
|
||||
|
||||
#include "fbdev.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
static int current_bpp = 16;
|
||||
static int current_pal[256];
|
||||
static const char *verstring = "PicoDrive " VERSION;
|
||||
static int scr_changed = 0, scr_w = SCREEN_WIDTH, scr_h = SCREEN_HEIGHT;
|
||||
|
||||
/* ifndef is for qemu build without video out */
|
||||
#ifndef ARM
|
||||
|
||||
/* faking GP2X pad */
|
||||
enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40,
|
||||
GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11,
|
||||
|
@ -245,23 +246,24 @@ static void xlib_init(void)
|
|||
sem_wait(&xlib_sem);
|
||||
sem_destroy(&xlib_sem);
|
||||
}
|
||||
#endif // !ARM
|
||||
|
||||
/* --- */
|
||||
|
||||
static void realloc_screen(void)
|
||||
{
|
||||
void *old = g_screen_ptr;
|
||||
int size = scr_w * scr_h * 2;
|
||||
g_screen_width = scr_w;
|
||||
g_screen_height = scr_h;
|
||||
g_screen_ptr = calloc(g_screen_width * g_screen_height * 2, 1);
|
||||
free(old);
|
||||
g_screen_ptr = realloc(g_screen_ptr, size);
|
||||
g_menubg_ptr = realloc(g_menubg_ptr, size);
|
||||
memset(g_screen_ptr, 0, size);
|
||||
memset(g_menubg_ptr, 0, size);
|
||||
PicoDraw2FB = g_menubg_ptr;
|
||||
scr_changed = 0;
|
||||
}
|
||||
|
||||
void update_screen(void)
|
||||
void plat_video_flip(void)
|
||||
{
|
||||
#ifndef ARM
|
||||
unsigned int *image;
|
||||
int pixel_count, i;
|
||||
|
||||
|
@ -301,29 +303,45 @@ void update_screen(void)
|
|||
realloc_screen();
|
||||
ximage_realloc(xlib_display, DefaultVisual(xlib_display, 0));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void plat_video_wait_vsync(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // !FBDEV
|
||||
|
||||
void plat_early_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void plat_init(void)
|
||||
{
|
||||
#ifdef FBDEV
|
||||
int ret, w, h;
|
||||
ret = vout_fbdev_init(&w, &h);
|
||||
if (ret != 0)
|
||||
exit(1);
|
||||
g_screen_width = w;
|
||||
g_menubg_ptr = realloc(g_menubg_ptr, w * g_screen_height * 2);
|
||||
PicoDraw2FB = g_menubg_ptr;
|
||||
#else
|
||||
realloc_screen();
|
||||
memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
|
||||
xlib_init();
|
||||
#endif
|
||||
|
||||
// snd
|
||||
sndout_oss_init();
|
||||
|
||||
#ifndef ARM
|
||||
xlib_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void plat_finish(void)
|
||||
{
|
||||
#ifdef FBDEV
|
||||
vout_fbdev_finish();
|
||||
#else
|
||||
free(g_screen_ptr);
|
||||
#endif
|
||||
sndout_oss_exit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue