From: notaz Date: Sun, 28 Jul 2013 00:05:10 +0000 (+0300) Subject: get rid of port_config.h X-Git-Tag: v1.85~33 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c9cda8c3;p=picodrive.git get rid of port_config.h --- diff --git a/Makefile b/Makefile index 72896e05..17d04b8c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ TARGET ?= PicoDrive CFLAGS += -Wall -ggdb -falign-functions=2 CFLAGS += -I. -# FIXME -CFLAGS += -Iplatform/linux/ ifndef DEBUG CFLAGS += -O2 -DNDEBUG endif diff --git a/jni/Android.mk b/jni/Android.mk index 8389f7eb..72a81634 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -71,7 +71,7 @@ LOCAL_SRC_FILES += $(R)zlib/gzio.c $(R)zlib/inffast.c $(R)zlib/inflate.c \ 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 diff --git a/pico/carthw/svp/svp.c b/pico/carthw/svp/svp.c index 66449192..8be4e551 100644 --- a/pico/carthw/svp/svp.c +++ b/pico/carthw/svp/svp.c @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../pico_int.h" -#include "../../cpu/drc/cmn.h" +#include +#include #include "compiler.h" svp_t *svp = NULL; diff --git a/pico/cd/buffering.c b/pico/cd/buffering.c index a79172d3..25f54ffc 100644 --- a/pico/cd/buffering.c +++ b/pico/cd/buffering.c @@ -14,6 +14,8 @@ static int prev_lba = 0x80000000; static int hits, reads; +#undef dprintf +#define dprintf(...) void PicoCDBufferInit(void) { @@ -114,7 +116,7 @@ PICO_INTERNAL void PicoCDBufferRead(void *dest, int lba) 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++) diff --git a/pico/cd/cd_file.c b/pico/cd/cd_file.c index 31efd0e4..4e2446c4 100644 --- a/pico/cd/cd_file.c +++ b/pico/cd/cd_file.c @@ -13,6 +13,16 @@ //#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; @@ -27,7 +37,7 @@ static int audio_track_mp3(const char *fname, int index) 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); @@ -38,10 +48,10 @@ static int audio_track_mp3(const char *fname, int index) 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; } @@ -62,15 +72,12 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type) { 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) @@ -187,19 +194,32 @@ PICO_INTERNAL int Load_CD_Image(const char *cd_img_name, cd_img_type type) 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) @@ -248,7 +268,7 @@ PICO_INTERNAL void Unload_ISO(void) 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); diff --git a/pico/cd/gfx_cd.c b/pico/cd/gfx_cd.c index 69d4a001..0623a27e 100644 --- a/pico/cd/gfx_cd.c +++ b/pico/cd/gfx_cd.c @@ -7,6 +7,9 @@ #include "../pico_int.h" +#undef dprintf +#define dprintf(...) + #define _rot_comp Pico_mcd->rot_comp static const int Table_Rot_Time[] = diff --git a/pico/draw.c b/pico/draw.c index 11cd8204..d24d5d79 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -1505,18 +1505,14 @@ void PicoDrawSync(int to, int blank_last_line) for (line = DrawScanline; line < to; line++) { -#if !CAN_HANDLE_240_LINES if (line >= 224) break; -#endif PicoLine(line, offs, sh, bgc); } -#if !CAN_HANDLE_240_LINES if (line >= 224) { DrawScanline = 240; return; } -#endif // last line if (line <= to) diff --git a/pico/draw2.c b/pico/draw2.c index ae69b52d..5730d7b6 100644 --- a/pico/draw2.c +++ b/pico/draw2.c @@ -8,10 +8,8 @@ #include "pico_int.h" -// port_config.h include must define these 2 defines: -// #define START_ROW 1 // which row of tiles to start rendering at? -// #define END_ROW 27 // ..end -// one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered. +#define START_ROW 0 // which row of tiles to start rendering at? +#define END_ROW 28 // ..end #define TILE_ROWS END_ROW-START_ROW diff --git a/pico/pico.h b/pico/pico.h index 4a99ef57..0422dfd9 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -12,9 +12,6 @@ #include // size_t -// port-specific compile-time settings -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/pico/pico_int.h b/pico/pico_int.h index c350fa2c..5fe8d942 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -802,7 +802,11 @@ static __inline int isspace_(int c) // emulation event logging #ifndef EL_LOGMASK -#define EL_LOGMASK 0 +# ifdef __x86_64__ // HACK +# define EL_LOGMASK (EL_STATUS|EL_IDLE|EL_ANOMALY) +# else +# define EL_LOGMASK (EL_STATUS|EL_IDLE) +# endif #endif #define EL_HVCNT 0x00000001 /* hv counter reads */ diff --git a/pico/sound/sound.c b/pico/sound/sound.c index 1f23e1aa..ede33f11 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -14,6 +14,8 @@ #include "../cd/pcm.h" #include "mix.h" +#define SIMPLE_WRITE_SOUND 0 + void (*PsndMix_32_to_16l)(short *dest, int *src, int count) = mix_32_to_16l_stereo; // master int buffer to mix to diff --git a/platform/common/emu.c b/platform/common/emu.c index 22da55c8..b828595f 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -10,7 +10,7 @@ #include #include #include -#ifndef NO_SYNC +#ifdef __GP2X__ #include #endif @@ -28,15 +28,20 @@ #include #include +#ifndef _WIN32 +#define PATH_SEP "/" +#define PATH_SEP_C '/' +#else +#define PATH_SEP "\\" +#define PATH_SEP_C '\\' +#endif #define STATUS_MSG_TIMEOUT 2000 void *g_screen_ptr; -#if !SCREEN_SIZE_FIXED -int g_screen_width = SCREEN_WIDTH; -int g_screen_height = SCREEN_HEIGHT; -#endif +int g_screen_width = 320; +int g_screen_height = 240; char *PicoConfigFile = "config.cfg"; currentConfig_t currentConfig, defaultConfig; @@ -649,7 +654,7 @@ int emu_write_config(int is_game) lprintf("emu_write_config: %s ", cfg); ret = config_write(cfg); if (write_lrom) config_writelrom(cfg); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif lprintf((ret == 0) ? "(ok)\n" : "(failed)\n"); @@ -859,7 +864,7 @@ int emu_save_load_game(int load, int sram) ret = fwrite(sram_data, 1, sram_size, sramFile); ret = (ret != sram_size) ? -1 : 0; fclose(sramFile); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif } @@ -870,7 +875,7 @@ int emu_save_load_game(int load, int sram) { ret = PicoState(saveFname, !load); if (!ret) { -#ifndef NO_SYNC +#ifdef __GP2X__ if (!load) sync(); #endif emu_status_msg(load ? "STATE LOADED" : "STATE SAVED"); @@ -1198,7 +1203,7 @@ void emu_finish(void) char cfg[512]; make_config_cfg(cfg); config_writelrom(cfg); -#ifndef NO_SYNC +#ifdef __GP2X__ sync(); #endif } diff --git a/platform/common/emu.h b/platform/common/emu.h index 89c886f7..d721f94a 100644 --- a/platform/common/emu.h +++ b/platform/common/emu.h @@ -6,8 +6,6 @@ * See COPYING file in the top-level directory. */ -#include "port_config.h" - #ifdef __cplusplus extern "C" { #endif @@ -16,14 +14,8 @@ extern "C" { 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) diff --git a/platform/gizmondo/port_config.h b/platform/gizmondo/port_config.h deleted file mode 100644 index 58a04759..00000000 --- a/platform/gizmondo/port_config.h +++ /dev/null @@ -1,36 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -#define CASE_SENSITIVE_FS 0 -#define DONT_OPEN_MANY_FILES 0 -#define REDUCE_IO_CALLS 0 -#define SIMPLE_WRITE_SOUND 0 - -#define SCREEN_SIZE_FIXED 1 -#define SCREEN_WIDTH 321 -#define SCREEN_HEIGHT 240 -#define MSCREEN_SIZE_FIXED 1 -#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 - -// logging emu events -#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff - -//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) -#define dprintf(x...) - -// platform -#define PATH_SEP "/" // because of cegcc -#define PATH_SEP_C '/' -#define MENU_X2 0 - -#endif //PORT_CONFIG_H diff --git a/platform/gp2x/port_config.h b/platform/gp2x/port_config.h deleted file mode 100644 index a4eef7ba..00000000 --- a/platform/gp2x/port_config.h +++ /dev/null @@ -1,37 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -#define CASE_SENSITIVE_FS 1 // CS filesystem -#define DONT_OPEN_MANY_FILES 0 -#define REDUCE_IO_CALLS 0 -#define SIMPLE_WRITE_SOUND 0 - -#define SCREEN_SIZE_FIXED 1 -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 -#define MSCREEN_SIZE_FIXED 1 -#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 - -// logging emu events -#define EL_LOGMASK (EL_STATUS) -// (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL|EL_IDLE) - -//#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 diff --git a/platform/libpicofe b/platform/libpicofe index 8ef1ad32..ebf0e111 160000 --- a/platform/libpicofe +++ b/platform/libpicofe @@ -1 +1 @@ -Subproject commit 8ef1ad3218d7677f3dbf279095cd2fc58966547f +Subproject commit ebf0e111a84cbd73511cc2b935c7bd688638cf5e diff --git a/platform/linux/io.c b/platform/linux/io.c index 13d6d9ab..edc5f6eb 100644 --- a/platform/linux/io.c +++ b/platform/linux/io.c @@ -31,7 +31,7 @@ int current_keys; 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, diff --git a/platform/linux/port_config.h b/platform/linux/port_config.h deleted file mode 100644 index e69c6297..00000000 --- a/platform/linux/port_config.h +++ /dev/null @@ -1,40 +0,0 @@ -// 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 - diff --git a/platform/pandora/port_config.h b/platform/pandora/port_config.h deleted file mode 100644 index fa485eac..00000000 --- a/platform/pandora/port_config.h +++ /dev/null @@ -1,37 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -#define CASE_SENSITIVE_FS 1 // CS filesystem -#define DONT_OPEN_MANY_FILES 0 -#define REDUCE_IO_CALLS 0 - -#define SCREEN_SIZE_FIXED 1 -#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 - -// logging emu events -#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff - -//#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 1 - -#endif //PORT_CONFIG_H diff --git a/platform/psp/port_config.h b/platform/psp/port_config.h deleted file mode 100644 index e60c2ea6..00000000 --- a/platform/psp/port_config.h +++ /dev/null @@ -1,42 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -#define CASE_SENSITIVE_FS 0 -#define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP ~10 open file limit -#define REDUCE_IO_CALLS 1 // another workaround -#define SIMPLE_WRITE_SOUND 0 - -#define SCREEN_SIZE_FIXED 1 -#define SCREEN_WIDTH 512 -#define SCREEN_HEIGHT 272 -#define MSCREEN_SIZE_FIXED 1 -#define MSCREEN_WIDTH SCREEN_WIDTH -#define MSCREEN_HEIGHT SCREEN_HEIGHT - -// draw.c -#define USE_BGR555 1 - -// draw2.c -#define START_ROW 0 // which row of tiles to start rendering at? -#define END_ROW 28 // ..end -#define DRAW2_OVERRIDE_LINE_WIDTH 512 - -// pico.c -extern void blit1(void); -#define DRAW_FINISH_FUNC blit1 -#define CAN_HANDLE_240_LINES 1 - -// logging emu events -#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff - -//#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 diff --git a/platform/win32/port_config.h b/platform/win32/port_config.h deleted file mode 100644 index faae904c..00000000 --- a/platform/win32/port_config.h +++ /dev/null @@ -1,40 +0,0 @@ -// 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 -