TARGET ?= PicoDrive
CFLAGS += -Wall -ggdb -falign-functions=2
CFLAGS += -I.
-# FIXME
-CFLAGS += -Iplatform/linux/
ifndef DEBUG
CFLAGS += -O2 -DNDEBUG
endif
LOCAL_SRC_FILES += $(R)unzip/unzip.c $(R)unzip/unzip_stream.c
-LOCAL_C_INCLUDES += $(R) $(R)platform/linux
+LOCAL_C_INCLUDES += $(R)
LOCAL_CFLAGS += $(addprefix -D,$(DEFINES))
LOCAL_CFLAGS += -Wall -O3 -ffast-math -DNDEBUG
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../../pico_int.h"
-#include "../../cpu/drc/cmn.h"
+#include <pico/pico_int.h>
+#include <cpu/drc/cmn.h>
#include "compiler.h"
svp_t *svp = NULL;
static int hits, reads;
+#undef dprintf
+#define dprintf(...)
void PicoCDBufferInit(void)
{
if (is_bin)
{
int i = 0;
-#if REDUCE_IO_CALLS
+#ifdef _PSP_FW_VERSION
int bufs = (read_len*2048) / (2048+304);
pm_read(cd_buffer, bufs*(2048+304), Pico_mcd->TOC.Tracks[0].F);
for (i = 1; i < bufs; i++)
//#define cdprintf(f,...) printf(f "\n",##__VA_ARGS__) // tmp
+static void to_upper(char *d, const char *s)
+{
+ for (; *s != 0; d++, s++) {
+ if ('a' <= *s && *s <= 'z')
+ *d = *s - 'a' + 'A';
+ else
+ *d = *s;
+ }
+}
+
static int audio_track_mp3(const char *fname, int index)
{
_scd_track *Tracks = Pico_mcd->TOC.Tracks;
fs = ftell(tmp_file); // used to calculate length
fseek(tmp_file, 0, SEEK_SET);
-#if DONT_OPEN_MANY_FILES
+#ifdef _PSP_FW_VERSION
// some systems (like PSP) can't have many open files at a time,
// so we work with their names instead.
fclose(tmp_file);
if (ret != 0 || Tracks[index].KBtps <= 0)
{
elprintf(EL_STATUS, "track %2i: mp3 bitrate %i", index+1, Tracks[index].KBtps);
-#if !DONT_OPEN_MANY_FILES
- fclose(tmp_file);
-#else
+#ifdef _PSP_FW_VERSION
free(tmp_file);
+#else
+ fclose(tmp_file);
#endif
return -1;
}
{
int i, j, num_track, Cur_LBA, index, ret, iso_name_len, missed, cd_img_sectors;
_scd_track *Tracks = Pico_mcd->TOC.Tracks;
- char tmp_name[1024], tmp_ext[10];
+ char tmp_name[1024], tmp_ext[10], tmp_ext_u[10];
cue_data_t *cue_data = NULL;
pm_file *pmf;
- static char *exts[] = {
+ static const char *exts[] = {
"%02d.mp3", " %02d.mp3", "-%02d.mp3", "_%02d.mp3", " - %02d.mp3",
"%d.mp3", " %d.mp3", "-%d.mp3", "_%d.mp3", " - %d.mp3",
-#if CASE_SENSITIVE_FS
- "%02d.MP3", " %02d.MP3", "-%02d.MP3", "_%02d.MP3", " - %02d.MP3",
-#endif
};
if (PicoCDLoadProgressCB != NULL)
for (j = 0; j < sizeof(exts)/sizeof(char *); j++)
{
int ext_len;
+ char *p;
+
+ index = num_track - 1;
+
sprintf(tmp_ext, exts[j], i);
ext_len = strlen(tmp_ext);
+ to_upper(tmp_ext_u, tmp_ext);
memcpy(tmp_name, cd_img_name, iso_name_len + 1);
- tmp_name[iso_name_len - 4] = 0;
- strcat(tmp_name, tmp_ext);
+ p = tmp_name + iso_name_len - 4;
- index = num_track - 1;
+ strcpy(p, tmp_ext);
ret = audio_track_mp3(tmp_name, index);
+ if (ret != 0) {
+ strcpy(p, tmp_ext_u);
+ ret = audio_track_mp3(tmp_name, index);
+ }
+
if (ret != 0 && i > 1 && iso_name_len > ext_len) {
- tmp_name[iso_name_len - ext_len] = 0;
- strcat(tmp_name, tmp_ext);
+ p = tmp_name + iso_name_len - ext_len;
+ strcpy(p, tmp_ext);
ret = audio_track_mp3(tmp_name, index);
+ if (ret != 0) {
+ strcpy(p, tmp_ext_u);
+ ret = audio_track_mp3(tmp_name, index);
+ }
}
if (ret == 0)
if (Pico_mcd->TOC.Tracks[i].F != NULL)
{
if (Pico_mcd->TOC.Tracks[i].ftype == TYPE_MP3)
-#if DONT_OPEN_MANY_FILES
+#ifdef _PSP_FW_VERSION
free(Pico_mcd->TOC.Tracks[i].F);
#else
fclose(Pico_mcd->TOC.Tracks[i].F);
#include "../pico_int.h"
+#undef dprintf
+#define dprintf(...)
+
#define _rot_comp Pico_mcd->rot_comp
static const int Table_Rot_Time[] =
\r
for (line = DrawScanline; line < to; line++)\r
{\r
-#if !CAN_HANDLE_240_LINES\r
if (line >= 224) break;\r
-#endif\r
PicoLine(line, offs, sh, bgc);\r
}\r
\r
-#if !CAN_HANDLE_240_LINES\r
if (line >= 224) {\r
DrawScanline = 240;\r
return;\r
}\r
-#endif\r
\r
// last line\r
if (line <= to)\r
\r
#include "pico_int.h"\r
\r
-// port_config.h include must define these 2 defines:\r
-// #define START_ROW 1 // which row of tiles to start rendering at?\r
-// #define END_ROW 27 // ..end\r
-// one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered.\r
+#define START_ROW 0 // which row of tiles to start rendering at?\r
+#define END_ROW 28 // ..end\r
\r
#define TILE_ROWS END_ROW-START_ROW\r
\r
\r
#include <stdlib.h> // size_t\r
\r
-// port-specific compile-time settings\r
-#include <port_config.h>\r
-\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
\r
// emulation event logging\r
#ifndef EL_LOGMASK\r
-#define EL_LOGMASK 0\r
+# ifdef __x86_64__ // HACK\r
+# define EL_LOGMASK (EL_STATUS|EL_IDLE|EL_ANOMALY)\r
+# else\r
+# define EL_LOGMASK (EL_STATUS|EL_IDLE)\r
+# endif\r
#endif\r
\r
#define EL_HVCNT 0x00000001 /* hv counter reads */\r
#include "../cd/pcm.h"\r
#include "mix.h"\r
\r
+#define SIMPLE_WRITE_SOUND 0\r
+\r
void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo;\r
\r
// master int buffer to mix to\r
#include <stdlib.h>\r
#include <string.h>\r
#include <stdarg.h>\r
-#ifndef NO_SYNC\r
+#ifdef __GP2X__\r
#include <unistd.h>\r
#endif\r
\r
#include <pico/pico_int.h>\r
#include <pico/patch.h>\r
\r
+#ifndef _WIN32\r
+#define PATH_SEP "/"\r
+#define PATH_SEP_C '/'\r
+#else\r
+#define PATH_SEP "\\"\r
+#define PATH_SEP_C '\\'\r
+#endif\r
\r
#define STATUS_MSG_TIMEOUT 2000\r
\r
void *g_screen_ptr;\r
\r
-#if !SCREEN_SIZE_FIXED\r
-int g_screen_width = SCREEN_WIDTH;\r
-int g_screen_height = SCREEN_HEIGHT;\r
-#endif\r
+int g_screen_width = 320;\r
+int g_screen_height = 240;\r
\r
char *PicoConfigFile = "config.cfg";\r
currentConfig_t currentConfig, defaultConfig;\r
lprintf("emu_write_config: %s ", cfg);\r
ret = config_write(cfg);\r
if (write_lrom) config_writelrom(cfg);\r
-#ifndef NO_SYNC\r
+#ifdef __GP2X__\r
sync();\r
#endif\r
lprintf((ret == 0) ? "(ok)\n" : "(failed)\n");\r
ret = fwrite(sram_data, 1, sram_size, sramFile);\r
ret = (ret != sram_size) ? -1 : 0;\r
fclose(sramFile);\r
-#ifndef NO_SYNC\r
+#ifdef __GP2X__\r
sync();\r
#endif\r
}\r
{\r
ret = PicoState(saveFname, !load);\r
if (!ret) {\r
-#ifndef NO_SYNC\r
+#ifdef __GP2X__\r
if (!load) sync();\r
#endif\r
emu_status_msg(load ? "STATE LOADED" : "STATE SAVED");\r
char cfg[512];\r
make_config_cfg(cfg);\r
config_writelrom(cfg);\r
-#ifndef NO_SYNC\r
+#ifdef __GP2X__\r
sync();\r
#endif\r
}\r
* See COPYING file in the top-level directory.
*/
-#include "port_config.h"
-
#ifdef __cplusplus
extern "C" {
#endif
extern void *g_screen_ptr;
-#if SCREEN_SIZE_FIXED
-#define g_screen_width SCREEN_WIDTH
-#define g_screen_height SCREEN_HEIGHT
-#else
extern int g_screen_width;
extern int g_screen_height;
-#endif
-
#define EOPT_EN_SRAM (1<<0)
#define EOPT_SHOW_FPS (1<<1)
+++ /dev/null
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-#define CASE_SENSITIVE_FS 0\r
-#define DONT_OPEN_MANY_FILES 0\r
-#define REDUCE_IO_CALLS 0\r
-#define SIMPLE_WRITE_SOUND 0\r
-\r
-#define SCREEN_SIZE_FIXED 1\r
-#define SCREEN_WIDTH 321\r
-#define SCREEN_HEIGHT 240\r
-#define MSCREEN_SIZE_FIXED 1\r
-#define MSCREEN_WIDTH SCREEN_WIDTH\r
-#define MSCREEN_HEIGHT SCREEN_HEIGHT\r
-\r
-// draw2.c\r
-#define START_ROW 0 // which row of tiles to start rendering at?\r
-#define END_ROW 28 // ..end\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES 1\r
-\r
-// logging emu events\r
-#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff\r
-\r
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
-#define dprintf(x...)\r
-\r
-// platform\r
-#define PATH_SEP "/" // because of cegcc\r
-#define PATH_SEP_C '/'\r
-#define MENU_X2 0\r
-\r
-#endif //PORT_CONFIG_H\r
+++ /dev/null
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-#define CASE_SENSITIVE_FS 1 // CS filesystem\r
-#define DONT_OPEN_MANY_FILES 0\r
-#define REDUCE_IO_CALLS 0\r
-#define SIMPLE_WRITE_SOUND 0\r
-\r
-#define SCREEN_SIZE_FIXED 1\r
-#define SCREEN_WIDTH 320\r
-#define SCREEN_HEIGHT 240\r
-#define MSCREEN_SIZE_FIXED 1\r
-#define MSCREEN_WIDTH SCREEN_WIDTH\r
-#define MSCREEN_HEIGHT SCREEN_HEIGHT\r
-\r
-// draw2.c\r
-#define START_ROW 0 // which row of tiles to start rendering at?\r
-#define END_ROW 28 // ..end\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES 1\r
-\r
-// logging emu events\r
-#define EL_LOGMASK (EL_STATUS)\r
-// (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL|EL_IDLE)\r
-\r
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
-#define dprintf(x...)\r
-\r
-// platform\r
-#define PATH_SEP "/"\r
-#define PATH_SEP_C '/'\r
-#define MENU_X2 0\r
-\r
-#endif //PORT_CONFIG_H\r
-Subproject commit 8ef1ad3218d7677f3dbf279095cd2fc58966547f
+Subproject commit ebf0e111a84cbd73511cc2b935c7bd688638cf5e
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;
+static int scr_changed = 0, scr_w = 320, scr_h = 240;
/* faking GP2X pad */
enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40,
+++ /dev/null
-// port specific settings
-
-#ifndef PORT_CONFIG_H
-#define PORT_CONFIG_H
-
-#define NO_SYNC
-
-#define CASE_SENSITIVE_FS 1 // CS filesystem
-#define DONT_OPEN_MANY_FILES 0
-#define REDUCE_IO_CALLS 0
-
-#define SCREEN_SIZE_FIXED 0
-#define SCREEN_WIDTH 320
-#define SCREEN_HEIGHT 240
-#define MSCREEN_SIZE_FIXED 0
-#define MSCREEN_WIDTH SCREEN_WIDTH
-#define MSCREEN_HEIGHT SCREEN_HEIGHT
-
-// draw2.c
-#define START_ROW 0 // which row of tiles to start rendering at?
-#define END_ROW 28 // ..end
-
-// pico.c
-#define CAN_HANDLE_240_LINES 1
-
-#define SIMPLE_WRITE_SOUND 0
-#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo
-
-#define EL_LOGMASK (EL_STATUS|EL_ANOMALY|EL_UIO)
-// EL_VDPDMA|EL_ASVDP|EL_SR | EL_IDLE | EL_BUSREQ|EL_Z80BNK | EL_32X)
-
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
-#define dprintf(x...)
-
-// platform
-#define PATH_SEP "/"
-#define PATH_SEP_C '/'
-
-#endif //PORT_CONFIG_H
-
+++ /dev/null
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-#define CASE_SENSITIVE_FS 1 // CS filesystem\r
-#define DONT_OPEN_MANY_FILES 0\r
-#define REDUCE_IO_CALLS 0\r
-\r
-#define SCREEN_SIZE_FIXED 1\r
-#define SCREEN_WIDTH 320\r
-#define SCREEN_HEIGHT 240\r
-#define MSCREEN_SIZE_FIXED 0\r
-#define MSCREEN_WIDTH SCREEN_WIDTH\r
-#define MSCREEN_HEIGHT SCREEN_HEIGHT\r
-\r
-// draw2.c\r
-#define START_ROW 0 // which row of tiles to start rendering at?\r
-#define END_ROW 28 // ..end\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES 1\r
-\r
-#define SIMPLE_WRITE_SOUND 0\r
-\r
-// logging emu events\r
-#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff\r
-\r
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
-#define dprintf(x...)\r
-\r
-// platform\r
-#define PATH_SEP "/"\r
-#define PATH_SEP_C '/'\r
-#define MENU_X2 1\r
-\r
-#endif //PORT_CONFIG_H\r
+++ /dev/null
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-#define CASE_SENSITIVE_FS 0\r
-#define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP ~10 open file limit\r
-#define REDUCE_IO_CALLS 1 // another workaround\r
-#define SIMPLE_WRITE_SOUND 0\r
-\r
-#define SCREEN_SIZE_FIXED 1\r
-#define SCREEN_WIDTH 512\r
-#define SCREEN_HEIGHT 272\r
-#define MSCREEN_SIZE_FIXED 1\r
-#define MSCREEN_WIDTH SCREEN_WIDTH\r
-#define MSCREEN_HEIGHT SCREEN_HEIGHT\r
-\r
-// draw.c\r
-#define USE_BGR555 1\r
-\r
-// draw2.c\r
-#define START_ROW 0 // which row of tiles to start rendering at?\r
-#define END_ROW 28 // ..end\r
-#define DRAW2_OVERRIDE_LINE_WIDTH 512\r
-\r
-// pico.c\r
-extern void blit1(void);\r
-#define DRAW_FINISH_FUNC blit1\r
-#define CAN_HANDLE_240_LINES 1\r
-\r
-// logging emu events\r
-#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff\r
-\r
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
-#define dprintf(x...)\r
-\r
-// platform\r
-#define PATH_SEP "/"\r
-#define PATH_SEP_C '/'\r
-#define MENU_X2 0\r
-\r
-#endif //PORT_CONFIG_H\r
+++ /dev/null
-// port specific settings
-
-#ifndef PORT_CONFIG_H
-#define PORT_CONFIG_H
-
-#define NO_SYNC
-
-#define CASE_SENSITIVE_FS 0 // CS filesystem
-#define DONT_OPEN_MANY_FILES 0
-#define REDUCE_IO_CALLS 0
-
-#define SCREEN_SIZE_FIXED 0
-#define SCREEN_WIDTH 320
-#define SCREEN_HEIGHT 240
-#define MSCREEN_SIZE_FIXED 0
-#define MSCREEN_WIDTH SCREEN_WIDTH
-#define MSCREEN_HEIGHT SCREEN_HEIGHT
-
-// draw2.c
-#define START_ROW 0 // which row of tiles to start rendering at?
-#define END_ROW 28 // ..end
-
-// pico.c
-#define CAN_HANDLE_240_LINES 1
-
-#define SIMPLE_WRITE_SOUND 1
-#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo
-
-#define EL_LOGMASK (EL_STATUS)
-
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
-#define dprintf(x...)
-
-// platform
-#define PATH_SEP "\\"
-#define PATH_SEP_C '\\'
-#define MENU_X2 0
-
-#endif //PORT_CONFIG_H
-