From: notaz Date: Tue, 21 Jul 2009 15:15:18 +0000 (+0000) Subject: linux port fixed; some cleanups X-Git-Tag: v1.85~342 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcd94522e8afb8d4b266f241adfd2e9aea111904;p=picodrive.git linux port fixed; some cleanups git-svn-id: file:///home/notaz/opt/svn/PicoDrive@706 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/pico/carthw/svp/svp.c b/pico/carthw/svp/svp.c index be9414e2..46f7ece8 100644 --- a/pico/carthw/svp/svp.c +++ b/pico/carthw/svp/svp.c @@ -8,7 +8,7 @@ #include "../../pico_int.h" #include "compiler.h" -#ifdef __GP2X__ +#ifdef __linux__ #include #endif @@ -100,7 +100,7 @@ static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsig void PicoSVPInit(void) { -#ifdef __GP2X__ +#ifdef __linux__ int ret; ret = munmap(tcache, SSP_DRC_SIZE); printf("munmap tcache: %i\n", ret); @@ -110,7 +110,7 @@ void PicoSVPInit(void) static void PicoSVPShutdown(void) { -#ifdef __GP2X__ +#ifdef __linux__ // also unmap tcache PicoSVPInit(); #endif @@ -135,7 +135,7 @@ void PicoSVPStartup(void) svp = (void *) ((char *)tmp + 0x200000); memset(svp, 0, sizeof(*svp)); -#ifdef __GP2X__ +#ifdef __linux__ tmp = mmap(tcache, SSP_DRC_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0); printf("mmap tcache: %p, asked %p\n", tmp, tcache); #endif diff --git a/platform/gp2x/main.c b/platform/common/main.c similarity index 89% rename from platform/gp2x/main.c rename to platform/common/main.c index 6ac16b8f..00cbac71 100644 --- a/platform/gp2x/main.c +++ b/platform/common/main.c @@ -8,13 +8,12 @@ #include #include -#include "../common/menu.h" -#include "../common/emu.h" -#include "../common/config.h" -#include "../common/input.h" -#include "../common/plat.h" +#include "menu.h" #include "emu.h" -#include "version.h" +#include "config.h" +#include "input.h" +#include "plat.h" +#include extern char *PicoConfigFile; diff --git a/platform/common/menu.c b/platform/common/menu.c index b5c34953..32bf12fd 100644 --- a/platform/common/menu.c +++ b/platform/common/menu.c @@ -16,6 +16,7 @@ #include "emu.h" #include "plat.h" #include "posix.h" +#include #include #include diff --git a/platform/common/plat.h b/platform/common/plat.h index 607b8112..aa584222 100644 --- a/platform/common/plat.h +++ b/platform/common/plat.h @@ -13,6 +13,9 @@ void emu_startSound(void); void emu_endSound(void); void emu_waitSound(void); void emu_ResetGame(void); // TODO mv rm? +void emu_Init(void); +void emu_Deinit(void); +void emu_Loop(void); void emu_noticeMsgUpdated(void); int emu_getMainDir(char *dst, int len); diff --git a/platform/gizmondo/emu.h b/platform/gizmondo/emu.h index 6f0322a8..9aa6c507 100644 --- a/platform/gizmondo/emu.h +++ b/platform/gizmondo/emu.h @@ -5,10 +5,5 @@ extern unsigned char gfx_buffer[321*240*2*2]; -void emu_Init(void); -void emu_Deinit(void); -void emu_Loop(void); -void emu_ResetGame(void); - void emu_stateCb(const char *str); diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index 46248224..11890bd5 100644 --- a/platform/gp2x/940ctl.c +++ b/platform/gp2x/940ctl.c @@ -13,7 +13,6 @@ #include "code940/940shared.h" #include "soc_mmsp2.h" #include "soc.h" -#include "emu.h" #include "../common/mp3.h" #include "../common/arm_utils.h" #include "../common/menu.h" diff --git a/platform/gp2x/Makefile b/platform/gp2x/Makefile index 00fdb789..df197729 100644 --- a/platform/gp2x/Makefile +++ b/platform/gp2x/Makefile @@ -55,14 +55,14 @@ LD = $(CROSS)ld OBJCOPY = $(CROSS)objcopy # frontend -OBJS += main.o soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o +OBJS += soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o # 940 core control OBJS += 940ctl.o # common OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \ platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \ - platform/common/mp3_helix.o platform/common/input.o \ + platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \ platform/linux/sndout_oss.o platform/linux/plat.o # Pico diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index c78b706d..46dc3aa0 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -1,4 +1,4 @@ -// (c) Copyright 2006-2007 notaz, All rights reserved. +// (c) Copyright 2006-2009 notaz, All rights reserved. // Free for non-commercial use. // For commercial use, separate licencing terms must be obtained. @@ -8,15 +8,11 @@ #include #include #include -#include -#include -#include - #include -#include "emu.h" #include "plat_gp2x.h" #include "soc.h" +#include "../common/plat.h" #include "../common/menu.h" #include "../common/arm_utils.h" #include "../common/fonts.h" @@ -158,7 +154,7 @@ void emu_prepareDefaultConfig(void) defaultConfig.s_PicoOpt |= POPT_EXT_FM; } -void osd_text(int x, int y, const char *text) +static void osd_text(int x, int y, const char *text) { int len = strlen(text)*8; int *p, i, h, offs; diff --git a/platform/gp2x/emu.h b/platform/gp2x/emu.h deleted file mode 100644 index 20342d1b..00000000 --- a/platform/gp2x/emu.h +++ /dev/null @@ -1,12 +0,0 @@ -// (c) Copyright 2006-2007 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - - -void emu_Init(void); -void emu_Deinit(void); -void emu_Loop(void); - -void osd_text(int x, int y, const char *text); - diff --git a/platform/gp2x/port_config.h b/platform/gp2x/port_config.h index d6113494..5480ae83 100644 --- a/platform/gp2x/port_config.h +++ b/platform/gp2x/port_config.h @@ -3,8 +3,6 @@ #ifndef PORT_CONFIG_H #define PORT_CONFIG_H -#include "version.h" - #define CASE_SENSITIVE_FS 1 // CS filesystem #define DONT_OPEN_MANY_FILES 0 #define REDUCE_IO_CALLS 0 diff --git a/platform/linux/940ctl_ym2612.c b/platform/linux/940ctl_ym2612.c deleted file mode 100644 index 50b32e3b..00000000 --- a/platform/linux/940ctl_ym2612.c +++ /dev/null @@ -1,213 +0,0 @@ -/* faked 940 code just uses local copy of ym2612 */ -/* TODO: rm this */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../pico/sound/ym2612.h" -//#include "../gp2x/gp2x.h" -#include "../gp2x/emu.h" -#include "../gp2x/code940/940shared.h" -#include "../common/helix/pub/mp3dec.h" -#include "../../pico/pico_int.h" - - -// static _940_data_t shared_data_; -static _940_ctl_t shared_ctl_; -// static _940_data_t *shared_data = &shared_data_; -_940_ctl_t *shared_ctl = &shared_ctl_; - -unsigned char *mp3_mem = 0; - -#define MP3_SIZE_MAX (0x1000000 - 4*640*480) - -/***********************************************************/ - - -int YM2612Write_940(unsigned int a, unsigned int v, int scanline) -{ - YM2612Write_(a, v); - - return 0; // cause the engine to do updates once per frame only -} - - -void YM2612PicoStateLoad_940(void) -{ - int i; - - YM2612PicoStateLoad_(); - - for(i = 0; i < 0x100; i++) { - YM2612Write_(0, i); - YM2612Write_(1, ym2612.REGS[i]); - } - for(i = 0; i < 0x100; i++) { - YM2612Write_(2, i); - YM2612Write_(3, ym2612.REGS[i|0x100]); - } -} - -void YM2612PicoStateSave2_940(int tat, int tbt) -{ - YM2612PicoStateSave2(tat, tbt); -} - -int YM2612PicoStateLoad2_940(int *tat, int *tbt) -{ - return YM2612PicoStateLoad2(tat, tbt); -} - - -void sharedmem_init(void) -{ - mp3_mem = malloc(MP3_SIZE_MAX); -} - -void sharedmem_deinit(void) -{ - free(mp3_mem); -} - -void YM2612Init_940(int baseclock, int rate) -{ - YM2612Init_(baseclock, rate); -} - - -void YM2612ResetChip_940(void) -{ - YM2612ResetChip_(); -} - - -#if 0 -static void local_decode(void) -{ - int mp3_offs = shared_ctl->mp3_offs; - unsigned char *readPtr = mp3_mem + mp3_offs; - int bytesLeft = shared_ctl->mp3_len - mp3_offs; - int offset; // frame offset from readPtr - int err = 0; - - if (bytesLeft <= 0) return; // EOF, nothing to do - - offset = MP3FindSyncWord(readPtr, bytesLeft); - if (offset < 0) { - shared_ctl->mp3_offs = shared_ctl->mp3_len; - return; // EOF - } - readPtr += offset; - bytesLeft -= offset; - - err = MP3Decode(shared_data->mp3dec, &readPtr, &bytesLeft, - shared_data->mp3_buffer[shared_ctl->mp3_buffsel], 0); - if (err) { - if (err == ERR_MP3_INDATA_UNDERFLOW) { - shared_ctl->mp3_offs = shared_ctl->mp3_len; // EOF - return; - } else if (err <= -6 && err >= -12) { - // ERR_MP3_INVALID_FRAMEHEADER, ERR_MP3_INVALID_* - // just try to skip the offending frame.. - readPtr++; - } - shared_ctl->mp3_errors++; - shared_ctl->mp3_lasterr = err; - } - shared_ctl->mp3_offs = readPtr - mp3_mem; -} -#endif - - - - -static FILE *loaded_mp3 = 0; - -int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty) -{ -#if 0 - int cdda_on, *ym_buffer = mix_buffer; - static int mp3_samples_ready = 0, mp3_buffer_offs = 0; - static int mp3_play_bufsel = 1; - - - YM2612UpdateOne_(buffer, length, stereo); // really writes to mix_buffer - - // emulatind MCD, not data track, CDC is reading, playback was started, track not ended - cdda_on = (PicoMCD & 1) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1) - && loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len; - - /* mix data from previous go */ - if (cdda_on && mp3_samples_ready >= length) - { - if (1152 - mp3_buffer_offs >= length) { - mix_samples(buffer, ym_buffer, shared_data->mp3_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, length, stereo); - - mp3_buffer_offs += length; - } else { - // collect from both buffers.. - int left = 1152 - mp3_buffer_offs; - mix_samples(buffer, ym_buffer, shared_data->mp3_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, left, stereo); - mp3_play_bufsel ^= 1; - mp3_buffer_offs = length - left; - mix_samples(buffer + left * 2, ym_buffer + left * 2, - shared_data->mp3_buffer[mp3_play_bufsel], mp3_buffer_offs, stereo); - } - mp3_samples_ready -= length; - } else { - mix_samples(buffer, ym_buffer, 0, length, stereo); - } - - // make sure we will have enough mp3 samples next frame - if (cdda_on && mp3_samples_ready < length) - { - shared_ctl->mp3_buffsel ^= 1; - local_decode(); - mp3_samples_ready += 1152; - } -#else - return YM2612UpdateOne_(buffer, length, stereo, is_buf_empty); -#endif -} - - -void mp3_update(int *buffer, int length, int stereo) -{ - // nothing.. -} - - -/***********************************************************/ - -void mp3_start_play(FILE *f, int pos) // pos is 0-1023 -{ - int byte_offs = 0; - - if (loaded_mp3 != f) - { - printf("loading mp3... "); fflush(stdout); - fseek(f, 0, SEEK_SET); - fread(mp3_mem, 1, MP3_SIZE_MAX, f); - if (feof(f)) printf("done.\n"); - else printf("done. mp3 too large, not all data loaded.\n"); - shared_ctl->mp3_len = ftell(f); - loaded_mp3 = f; - } - - // seek.. - if (pos) { - byte_offs = (shared_ctl->mp3_len << 6) >> 10; - byte_offs *= pos; - byte_offs >>= 6; - } - printf("mp3 pos1024: %i, byte_offs %i/%i\n", pos, byte_offs, shared_ctl->mp3_len); - - shared_ctl->mp3_offs = byte_offs; -} - - diff --git a/platform/linux/Makefile b/platform/linux/Makefile index 9edc7ff5..bd612d6d 100644 --- a/platform/linux/Makefile +++ b/platform/linux/Makefile @@ -14,7 +14,7 @@ CFLAGS += -fprofile-generate else CFLAGS = -ggdb -Wall endif -DEFINES = __GP2X__ _UNZIP_SUPPORT IO_STATS IN_EVDEV +DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV CFLAGS += -I../.. -I. # gtk @@ -24,12 +24,12 @@ CFLAGS += `pkg-config --cflags gthread-2.0` LDFLAGS += `pkg-config --libs gthread-2.0` # frontend -OBJS += platform/gp2x/main.o platform/gp2x/emu.o platform/gp2x/plat.o blit.o \ - in_evdev.o plat.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o +OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o # common -OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \ - platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o +OBJS += platform/common/main.o platform/common/emu.o platform/common/menu.o \ + platform/common/config.o platform/common/fonts.o platform/common/readpng.o \ + platform/common/input.o ifeq "$(fake_in_gp2x)" "1" DEFINES += IN_GP2X FAKE_IN_GP2X @@ -38,18 +38,18 @@ endif # Pico OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \ - pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o + pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o # Pico - CD OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ - pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ - pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o + pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ + pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o # Pico - Pico OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o # Pico - sound OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o # Pico - carthw OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ - pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o + pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o # zlib OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o diff --git a/platform/linux/gp2x.c b/platform/linux/gp2x.c index ca915bc1..daf18fe2 100644 --- a/platform/linux/gp2x.c +++ b/platform/linux/gp2x.c @@ -12,10 +12,10 @@ #include #include -#include "../gp2x/emu.h" -//#include "../gp2x/gp2x.h" #include "../gp2x/version.h" #include "../common/emu.h" +#include "../common/menu.h" +#include "../common/readpng.h" #include "sndout_oss.h" #include "log_io.h" @@ -28,6 +28,8 @@ static int scr_changed = 0, scr_w = SCREEN_WIDTH, scr_h = SCREEN_HEIGHT; // dummies int mix_32_to_16l_level; +int crashed_940 = 0; +int default_cpu_clock = 123; /* gtk */ struct gtk_global_struct @@ -210,29 +212,8 @@ static void realloc_screen(void) scr_changed = 0; } -void plat_init(void) -{ - printf("entering init()\n"); fflush(stdout); - - realloc_screen(); - memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); - - // snd - sndout_oss_init(); - - gtk_initf(); - - printf("exitting init()\n"); fflush(stdout); -} - -void plat_finish(void) -{ - free(g_screen_ptr); - sndout_oss_exit(); -} - -/* video */ -void gp2x_video_flip(void) +/* gp2x/emu.c stuff, most to be rm'd */ +static void gp2x_video_flip_(void) { GdkPixbuf *pixbuf; unsigned char *image; @@ -288,65 +269,124 @@ void gp2x_video_flip(void) realloc_screen(); } -void gp2x_video_flip2(void) +static void gp2x_video_changemode_ll_(int bpp) +{ + current_bpp = bpp; +} + +static void gp2x_video_setpalette_(int *pal, int len) { - gp2x_video_flip(); + 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) { - current_bpp = bpp; + gp2x_video_changemode_ll_(bpp); } -void gp2x_video_changemode2(int bpp) +void gp2x_make_fb_bufferable(int yes) { - current_bpp = bpp; } -void gp2x_video_setpalette(int *pal, int len) +int soc_detect(void) { - memcpy(current_pal, pal, len*4); + return 0; } -void gp2x_video_RGB_setscaling(int v_offs, int W, int H) +/* 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 + { + // should really only happen once, on startup.. + readpng(g_screen_ptr, "skin/background.png", READPNG_BG); + } + + memcpy(menu_bg_buffer, g_screen_ptr, 320*240*2); + + // switch to 16bpp + gp2x_video_changemode_ll_(16); + gp2x_video_flip_(); } -void gp2x_memset_all_buffers(int offset, int byte, int len) +void plat_video_menu_begin(void) { - memset((char *)g_screen_ptr + offset, byte, len); + memcpy(g_screen_ptr, menu_bg_buffer, 320*240*2); } -/* joy */ -int gp2x_touchpad_read(int *x, int *y) +void plat_video_menu_end(void) { - return -1; + gp2x_video_flip_(); } -/* 940 */ -int crashed_940 = 0; -void pause940(int yes) +void plat_validate_config(void) { +// PicoOpt &= ~POPT_EXT_FM; } -void reset940(int yes, int bank) +void plat_early_init(void) { } -void gp2x_video_wait_vsync(void) +void plat_init(void) { + realloc_screen(); + memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); + + // snd + sndout_oss_init(); + + gtk_initf(); } -void set_gamma(int g100, int A_SNs_curve) +void plat_finish(void) { + free(g_screen_ptr); + sndout_oss_exit(); } -void set_lcd_custom_rate(int rate) +/* nasty */ +static void do_nothing() { } -void unset_lcd_custom_rate(void) +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 *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 */ @@ -355,6 +395,19 @@ void spend_cycles(int c) usleep(c/200); } +int mp3_get_bitrate(FILE *f, int size) +{ + return 128; +} + +void mp3_start_play(FILE *f, int pos) +{ +} + +void mp3_update(int *buffer, int length, int stereo) +{ +} + /* lprintf */ void lprintf(const char *fmt, ...) { diff --git a/platform/linux/port_config.h b/platform/linux/port_config.h index c75406d9..283dc08a 100644 --- a/platform/linux/port_config.h +++ b/platform/linux/port_config.h @@ -3,8 +3,6 @@ #ifndef PORT_CONFIG_H #define PORT_CONFIG_H -#include "../gp2x/version.h" /* FIXME */ - #define NO_SYNC #define CASE_SENSITIVE_FS 1 // CS filesystem diff --git a/platform/linux/version.h b/platform/linux/version.h new file mode 100644 index 00000000..4b339efb --- /dev/null +++ b/platform/linux/version.h @@ -0,0 +1,2 @@ +#include "../gp2x/version.h" + diff --git a/platform/pandora/Makefile b/platform/pandora/Makefile index 02ef6091..cde55c16 100644 --- a/platform/pandora/Makefile +++ b/platform/pandora/Makefile @@ -52,13 +52,13 @@ LD = $(CROSS)ld OBJCOPY = $(CROSS)objcopy # frontend -OBJS += pandora.o main.o emu.o asm_utils.o plat.o +OBJS += pandora.o emu.o asm_utils.o plat.o # common OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \ platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \ - platform/common/readpng.o platform/common/input.o platform/linux/in_evdev.o \ - platform/linux/sndout_oss.o platform/linux/plat.o + platform/common/readpng.o platform/common/input.o platform/common/main.o \ + platform/linux/in_evdev.o platform/linux/sndout_oss.o platform/linux/plat.o # Pico ifeq "$(amalgamate)" "1" diff --git a/platform/pandora/emu.c b/platform/pandora/emu.c index a6f990ae..85c634fe 100644 --- a/platform/pandora/emu.c +++ b/platform/pandora/emu.c @@ -168,7 +168,7 @@ static void textOut16(int x, int y, const char *text) } -void osd_text(int x, int y, const char *text) +static void osd_text(int x, int y, const char *text) { int len = strlen(text)*8; diff --git a/platform/pandora/main.c b/platform/pandora/main.c deleted file mode 100644 index 37a69feb..00000000 --- a/platform/pandora/main.c +++ /dev/null @@ -1,138 +0,0 @@ -// (c) Copyright 2006 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - -#include -#include -#include -#include -#include -#include - -#include "../gp2x/emu.h" // TODO rm -#include "../common/menu.h" -#include "../common/emu.h" -#include "../common/config.h" -#include "../common/input.h" -#include "../gp2x/version.h" -#include "pandora.h" - - -extern char *PicoConfigFile; -static int load_state_slot = -1; -char **g_argv; - -void parse_cmd_line(int argc, char *argv[]) -{ - int x, unrecognized = 0; - - for(x = 1; x < argc; x++) - { - if(argv[x][0] == '-') - { - if(strcasecmp(argv[x], "-config") == 0) { - if(x+1 < argc) { ++x; PicoConfigFile = argv[x]; } - } - else if(strcasecmp(argv[x], "-loadstate") == 0) { - if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); } - } - else { - unrecognized = 1; - break; - } - } else { - /* External Frontend: ROM Name */ - FILE *f; - strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload)); - rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0; - f = fopen(rom_fname_reload, "rb"); - if (f) fclose(f); - else unrecognized = 1; - engineState = PGS_ReloadRom; - break; - } - } - - if (unrecognized) { - printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n"); - printf("usage: %s [options] [romfile]\n", argv[0]); - printf( "options:\n" - "-config use specified config file instead of default 'picoconfig.bin'\n" - " see currentConfig_t structure in emu.h for the file format\n" - "-loadstate if ROM is specified, try loading slot \n"); - } -} - - -int main(int argc, char *argv[]) -{ - g_argv = argv; - - in_init(); - emu_prepareDefaultConfig(); - emu_ReadConfig(0, 0); - config_readlrom(PicoConfigFile); - - in_probe(); - in_debug_dump(); - pnd_init(); - emu_Init(); - menu_init(); - - engineState = PGS_Menu; - - if (argc > 1) - parse_cmd_line(argc, argv); - - if (engineState == PGS_ReloadRom) - { - if (emu_ReloadRom(rom_fname_reload)) { - engineState = PGS_Running; - if (load_state_slot >= 0) { - state_slot = load_state_slot; - emu_SaveLoadGame(1, 0); - } - } - } - - for (;;) - { - switch (engineState) - { - case PGS_Menu: - menu_loop(); - break; - - case PGS_ReloadRom: - if (emu_ReloadRom(rom_fname_reload)) - engineState = PGS_Running; - else { - printf("PGS_ReloadRom == 0\n"); - engineState = PGS_Menu; - } - break; - - case PGS_RestartRun: - engineState = PGS_Running; - - case PGS_Running: - emu_Loop(); - break; - - case PGS_Quit: - goto endloop; - - default: - printf("engine got into unknown state (%i), exitting\n", engineState); - goto endloop; - } - } - - endloop: - - emu_Deinit(); - pnd_exit(); - - return 0; -} diff --git a/platform/pandora/port_config.h b/platform/pandora/port_config.h index 58a8eea5..506c52ac 100644 --- a/platform/pandora/port_config.h +++ b/platform/pandora/port_config.h @@ -3,8 +3,6 @@ #ifndef PORT_CONFIG_H #define PORT_CONFIG_H -#include "../gp2x/version.h" /* FIXME */ - #define CASE_SENSITIVE_FS 1 // CS filesystem #define DONT_OPEN_MANY_FILES 0 #define REDUCE_IO_CALLS 0 diff --git a/platform/psp/emu.h b/platform/psp/emu.h index dc53ac15..aa98251a 100644 --- a/platform/psp/emu.h +++ b/platform/psp/emu.h @@ -6,10 +6,6 @@ extern int engineStateSuspend; -void emu_Init(void); -void emu_Deinit(void); -void emu_Loop(void); -void emu_ResetGame(void); void emu_HandleResume(void); void emu_msg_cb(const char *msg); diff --git a/platform/uiq3/emu.h b/platform/uiq3/emu.h deleted file mode 100644 index c5710f2c..00000000 --- a/platform/uiq3/emu.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -void emu_Init(void); -void emu_Deinit(void); - -#ifdef __cplusplus -} // extern "C" -#endif -