X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Fio.c;fp=linux%2Fgp2x.c;h=b16cf08d9e286a32a653223ec240c3ba8273ec23;hb=d2f29611d1379a249c8f3f955ed16a336f9290cd;hp=6eb252b89047cb0e99eddf31f9506d7bd6ceeff6;hpb=a96477bb5e1623dc132d632ac51a22cf7bdabfa7;p=libpicofe.git diff --git a/linux/gp2x.c b/linux/io.c similarity index 74% rename from linux/gp2x.c rename to linux/io.c index 6eb252b..b16cf08 100644 --- a/linux/gp2x.c +++ b/linux/io.c @@ -1,4 +1,3 @@ -/* faking/emulating gp2x by using xlib */ #include #include #include @@ -10,28 +9,19 @@ #include #include #include -#include -#include "../gp2x/version.h" #include "../common/emu.h" #include "../common/menu.h" -#include "../common/readpng.h" #include "sndout_oss.h" +#include "version.h" #include "log_io.h" unsigned long current_keys = 0; -static int current_bpp = 8; +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; -void *gp2x_screens[4]; - -// dummies -int mix_32_to_16l_level; -int crashed_940 = 0; -int default_cpu_clock = 123; -void *gp2x_memregs = NULL; /* ifndef is for qemu build without video out */ #ifndef ARM @@ -262,19 +252,14 @@ static void xlib_init(void) static void realloc_screen(void) { void *old = g_screen_ptr; - int i; g_screen_width = scr_w; g_screen_height = scr_h; g_screen_ptr = calloc(g_screen_width * g_screen_height * 2, 1); free(old); scr_changed = 0; - - for (i = 0; i < 4; i++) - gp2x_screens[i] = g_screen_ptr; } -/* gp2x/emu.c stuff, most to be rm'd */ -static void gp2x_video_flip_(void) +void update_screen(void) { #ifndef ARM unsigned int *image; @@ -319,86 +304,6 @@ static void gp2x_video_flip_(void) #endif } -static void gp2x_video_changemode_ll_(int bpp) -{ - current_bpp = bpp; -} - -static void gp2x_video_setpalette_(int *pal, int len) -{ - memcpy(current_pal, pal, len*4); -} - -void gp2x_memcpy_all_buffers(void *data, int offset, int len) -{ -} - -void gp2x_memset_all_buffers(int offset, int byte, int len) -{ - memset((char *)g_screen_ptr + offset, byte, len); -} - -void gp2x_video_changemode(int bpp) -{ - gp2x_video_changemode_ll_(bpp); -} - -void gp2x_make_fb_bufferable(int yes) -{ -} - -int soc_detect(void) -{ - return 0; -} - -/* plat */ -static char menu_bg_buffer[320*240*2]; -char cpu_clk_name[16] = "GP2X CPU clocks"; - -void plat_video_menu_enter(int is_rom_loaded) -{ - if (is_rom_loaded) - { - // darken the active framebuffer - memset(g_screen_ptr, 0, 320*8*2); - menu_darken_bg((char *)g_screen_ptr + 320*8*2, 320*224, 1); - memset((char *)g_screen_ptr + 320*232*2, 0, 320*8*2); - } - else - { - char buff[256]; - - // should really only happen once, on startup.. - emu_make_path(buff, "skin/background.png", sizeof(buff)); - if (readpng(g_screen_ptr, buff, READPNG_BG) < 0) - memset(g_screen_ptr, 0, 320*240*2); - } - - memcpy(menu_bg_buffer, g_screen_ptr, 320*240*2); - - // switch to 16bpp - gp2x_video_changemode_ll_(16); - gp2x_video_flip_(); -} - -void plat_video_menu_begin(void) -{ - memcpy(g_screen_ptr, menu_bg_buffer, 320*240*2); -} - -void plat_video_menu_end(void) -{ - gp2x_video_flip_(); -} - -void plat_validate_config(void) -{ - extern int PicoOpt; -// PicoOpt &= ~POPT_EXT_FM; - PicoOpt &= ~(1<<17); // POPT_EN_SVP_DRC -} - void plat_early_init(void) { } @@ -422,38 +327,7 @@ void plat_finish(void) sndout_oss_exit(); } -/* nasty */ -static void do_nothing() -{ -} - -void *gp2x_video_flip = gp2x_video_flip_; -void *gp2x_video_flip2 = gp2x_video_flip_; -void *gp2x_video_changemode_ll = gp2x_video_changemode_ll_; -void *gp2x_video_setpalette = gp2x_video_setpalette_; - -void *gp2x_video_RGB_setscaling = do_nothing; -void *gp2x_video_wait_vsync = do_nothing; -void *gp2x_set_cpuclk = do_nothing; -void *gp2x_read_battery = do_nothing; -void *set_lcd_custom_rate = do_nothing; -void *unset_lcd_custom_rate = do_nothing; -void *set_lcd_gamma = do_nothing; -void *set_ram_timings = do_nothing; -void *unset_ram_timings = do_nothing; - -/* joy */ -int gp2x_touchpad_read(int *x, int *y) -{ - return -1; -} - /* misc */ -void spend_cycles(int c) -{ - usleep(c/200); -} - int mp3_get_bitrate(FILE *f, int size) { return 128; @@ -467,10 +341,6 @@ void mp3_update(int *buffer, int length, int stereo) { } -void cache_flush_d_inval_i() -{ -} - /* lprintf */ void lprintf(const char *fmt, ...) {