linux port fixed; some cleanups
authornotaz <notasas@gmail.com>
Tue, 21 Jul 2009 15:15:18 +0000 (15:15 +0000)
committernotaz <notasas@gmail.com>
Tue, 21 Jul 2009 15:15:18 +0000 (15:15 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@706 be3aeb3a-fb24-0410-a615-afba39da0efa

18 files changed:
common/main.c [moved from gp2x/main.c with 89% similarity]
common/menu.c
common/plat.h
gp2x/940ctl.c
gp2x/Makefile
gp2x/emu.c
gp2x/emu.h [deleted file]
gp2x/port_config.h
linux/940ctl_ym2612.c [deleted file]
linux/Makefile
linux/gp2x.c
linux/port_config.h
linux/version.h [new file with mode: 0644]
pandora/Makefile
pandora/emu.c
pandora/main.c [deleted file]
pandora/port_config.h
psp/emu.h

similarity index 89%
rename from gp2x/main.c
rename to common/main.c
index 6ac16b8..00cbac7 100644 (file)
@@ -8,13 +8,12 @@
 #include <string.h>\r
 #include <strings.h>\r
 \r
-#include "../common/menu.h"\r
-#include "../common/emu.h"\r
-#include "../common/config.h"\r
-#include "../common/input.h"\r
-#include "../common/plat.h"\r
+#include "menu.h"\r
 #include "emu.h"\r
-#include "version.h"\r
+#include "config.h"\r
+#include "input.h"\r
+#include "plat.h"\r
+#include <version.h>\r
 \r
 \r
 extern char *PicoConfigFile;\r
index b5c3495..32bf12f 100644 (file)
@@ -16,6 +16,7 @@
 #include "emu.h"\r
 #include "plat.h"\r
 #include "posix.h"\r
+#include <version.h>\r
 \r
 #include <pico/pico_int.h>\r
 #include <pico/patch.h>\r
index 607b811..aa58422 100644 (file)
@@ -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);
index 4624822..11890bd 100644 (file)
@@ -13,7 +13,6 @@
 #include "code940/940shared.h"\r
 #include "soc_mmsp2.h"\r
 #include "soc.h"\r
-#include "emu.h"\r
 #include "../common/mp3.h"\r
 #include "../common/arm_utils.h"\r
 #include "../common/menu.h"\r
index 00fdb78..df19772 100644 (file)
@@ -55,14 +55,14 @@ LD = $(CROSS)ld
 OBJCOPY = $(CROSS)objcopy\r
 \r
 # frontend\r
-OBJS += main.o soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o\r
+OBJS += soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o\r
 # 940 core control\r
 OBJS += 940ctl.o\r
 \r
 # common\r
 OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
        platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \\r
-       platform/common/mp3_helix.o platform/common/input.o \\r
+       platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \\r
        platform/linux/sndout_oss.o platform/linux/plat.o\r
 \r
 # Pico\r
index c78b706..46dc3aa 100644 (file)
@@ -1,4 +1,4 @@
-// (c) Copyright 2006-2007 notaz, All rights reserved.\r
+// (c) Copyright 2006-2009 notaz, All rights reserved.\r
 // Free for non-commercial use.\r
 \r
 // For commercial use, separate licencing terms must be obtained.\r
@@ -8,15 +8,11 @@
 #include <sys/time.h>\r
 #include <sys/stat.h>\r
 #include <sys/types.h>\r
-#include <linux/limits.h>\r
-#include <ctype.h>\r
-#include <unistd.h>\r
-\r
 #include <stdarg.h>\r
 \r
-#include "emu.h"\r
 #include "plat_gp2x.h"\r
 #include "soc.h"\r
+#include "../common/plat.h"\r
 #include "../common/menu.h"\r
 #include "../common/arm_utils.h"\r
 #include "../common/fonts.h"\r
@@ -158,7 +154,7 @@ void emu_prepareDefaultConfig(void)
                defaultConfig.s_PicoOpt |= POPT_EXT_FM;\r
 }\r
 \r
-void osd_text(int x, int y, const char *text)\r
+static void osd_text(int x, int y, const char *text)\r
 {\r
        int len = strlen(text)*8;\r
        int *p, i, h, offs;\r
diff --git a/gp2x/emu.h b/gp2x/emu.h
deleted file mode 100644 (file)
index 20342d1..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// (c) Copyright 2006-2007 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
-\r
-\r
-void emu_Init(void);\r
-void emu_Deinit(void);\r
-void emu_Loop(void);\r
-\r
-void osd_text(int x, int y, const char *text);\r
-\r
index d611349..5480ae8 100644 (file)
@@ -3,8 +3,6 @@
 #ifndef PORT_CONFIG_H\r
 #define PORT_CONFIG_H\r
 \r
-#include "version.h"\r
-\r
 #define CASE_SENSITIVE_FS 1 // CS filesystem\r
 #define DONT_OPEN_MANY_FILES 0\r
 #define REDUCE_IO_CALLS 0\r
diff --git a/linux/940ctl_ym2612.c b/linux/940ctl_ym2612.c
deleted file mode 100644 (file)
index 50b32e3..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/* faked 940 code just uses local copy of ym2612 */
-/* TODO: rm this */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#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;
-}
-
-
index 9edc7ff..bd612d6 100644 (file)
@@ -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
index ca915bc..daf18fe 100644 (file)
 #include <fcntl.h>
 #include <errno.h>
 
-#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, ...)
 {
index c75406d..283dc08 100644 (file)
@@ -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/linux/version.h b/linux/version.h
new file mode 100644 (file)
index 0000000..4b339ef
--- /dev/null
@@ -0,0 +1,2 @@
+#include "../gp2x/version.h"
+
index 02ef609..cde55c1 100644 (file)
@@ -52,13 +52,13 @@ LD = $(CROSS)ld
 OBJCOPY = $(CROSS)objcopy\r
 \r
 # frontend\r
-OBJS += pandora.o main.o emu.o asm_utils.o plat.o\r
+OBJS += pandora.o emu.o asm_utils.o plat.o\r
 \r
 # common\r
 OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
        platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \\r
-       platform/common/readpng.o platform/common/input.o platform/linux/in_evdev.o \\r
-       platform/linux/sndout_oss.o platform/linux/plat.o\r
+       platform/common/readpng.o platform/common/input.o platform/common/main.o \\r
+       platform/linux/in_evdev.o platform/linux/sndout_oss.o platform/linux/plat.o\r
 \r
 # Pico\r
 ifeq "$(amalgamate)" "1"\r
index a6f990a..85c634f 100644 (file)
@@ -168,7 +168,7 @@ static void textOut16(int x, int y, const char *text)
 }\r
 \r
 \r
-void osd_text(int x, int y, const char *text)\r
+static void osd_text(int x, int y, const char *text)\r
 {\r
        int len = strlen(text)*8;\r
 \r
diff --git a/pandora/main.c b/pandora/main.c
deleted file mode 100644 (file)
index 37a69fe..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-// (c) Copyright 2006 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <unistd.h>\r
-#include <strings.h>\r
-#include <linux/limits.h>\r
-\r
-#include "../gp2x/emu.h" // TODO rm\r
-#include "../common/menu.h"\r
-#include "../common/emu.h"\r
-#include "../common/config.h"\r
-#include "../common/input.h"\r
-#include "../gp2x/version.h"\r
-#include "pandora.h"\r
-\r
-\r
-extern char *PicoConfigFile;\r
-static int load_state_slot = -1;\r
-char **g_argv;\r
-\r
-void parse_cmd_line(int argc, char *argv[])\r
-{\r
-       int x, unrecognized = 0;\r
-\r
-       for(x = 1; x < argc; x++)\r
-       {\r
-               if(argv[x][0] == '-')\r
-               {\r
-                       if(strcasecmp(argv[x], "-config") == 0) {\r
-                               if(x+1 < argc) { ++x; PicoConfigFile = argv[x]; }\r
-                       }\r
-                       else if(strcasecmp(argv[x], "-loadstate") == 0) {\r
-                               if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); }\r
-                       }\r
-                       else {\r
-                               unrecognized = 1;\r
-                               break;\r
-                       }\r
-               } else {\r
-                       /* External Frontend: ROM Name */\r
-                       FILE *f;\r
-                       strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload));\r
-                       rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0;\r
-                       f = fopen(rom_fname_reload, "rb");\r
-                       if (f) fclose(f);\r
-                       else unrecognized = 1;\r
-                       engineState = PGS_ReloadRom;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (unrecognized) {\r
-               printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n");\r
-               printf("usage: %s [options] [romfile]\n", argv[0]);\r
-               printf( "options:\n"\r
-                               "-config <file>    use specified config file instead of default 'picoconfig.bin'\n"\r
-                               "                  see currentConfig_t structure in emu.h for the file format\n"\r
-                               "-loadstate <num>  if ROM is specified, try loading slot <num>\n");\r
-       }\r
-}\r
-\r
-\r
-int main(int argc, char *argv[])\r
-{\r
-       g_argv = argv;\r
-\r
-       in_init();\r
-       emu_prepareDefaultConfig();\r
-       emu_ReadConfig(0, 0);\r
-       config_readlrom(PicoConfigFile);\r
-\r
-       in_probe();\r
-       in_debug_dump();\r
-       pnd_init();\r
-       emu_Init();\r
-       menu_init();\r
-\r
-       engineState = PGS_Menu;\r
-\r
-       if (argc > 1)\r
-               parse_cmd_line(argc, argv);\r
-\r
-       if (engineState == PGS_ReloadRom)\r
-       {\r
-               if (emu_ReloadRom(rom_fname_reload)) {\r
-                       engineState = PGS_Running;\r
-                       if (load_state_slot >= 0) {\r
-                               state_slot = load_state_slot;\r
-                               emu_SaveLoadGame(1, 0);\r
-                       }\r
-               }\r
-       }\r
-\r
-       for (;;)\r
-       {\r
-               switch (engineState)\r
-               {\r
-                       case PGS_Menu:\r
-                               menu_loop();\r
-                               break;\r
-\r
-                       case PGS_ReloadRom:\r
-                               if (emu_ReloadRom(rom_fname_reload))\r
-                                       engineState = PGS_Running;\r
-                               else {\r
-                                       printf("PGS_ReloadRom == 0\n");\r
-                                       engineState = PGS_Menu;\r
-                               }\r
-                               break;\r
-\r
-                       case PGS_RestartRun:\r
-                               engineState = PGS_Running;\r
-\r
-                       case PGS_Running:\r
-                               emu_Loop();\r
-                               break;\r
-\r
-                       case PGS_Quit:\r
-                               goto endloop;\r
-\r
-                       default:\r
-                               printf("engine got into unknown state (%i), exitting\n", engineState);\r
-                               goto endloop;\r
-               }\r
-       }\r
-\r
-       endloop:\r
-\r
-       emu_Deinit();\r
-       pnd_exit();\r
-\r
-       return 0;\r
-}\r
index 58a8eea..506c52a 100644 (file)
@@ -3,8 +3,6 @@
 #ifndef PORT_CONFIG_H\r
 #define PORT_CONFIG_H\r
 \r
-#include "../gp2x/version.h" /* FIXME */\r
-\r
 #define CASE_SENSITIVE_FS 1 // CS filesystem\r
 #define DONT_OPEN_MANY_FILES 0\r
 #define REDUCE_IO_CALLS 0\r
index dc53ac1..aa98251 100644 (file)
--- a/psp/emu.h
+++ b/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);