From dca310c413517d278898b967cfe610574310acd8 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 27 Jan 2008 23:04:29 +0000 Subject: [PATCH] fixed some portability issues git-svn-id: file:///home/notaz/opt/svn/PicoDrive@336 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Draw.c | 2 +- Pico/Memory.c | 2 ++ Pico/PicoInt.h | 18 +++++++++++++----- Pico/cd/LC89510.c | 3 --- Pico/cd/Memory.c | 8 +++++++- Pico/cd/cd_file.c | 1 - Pico/cd/cd_sys.c | 1 - Pico/sound/ym2612.c | 2 +- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Pico/Draw.c b/Pico/Draw.c index 989d9bdb..6f60a03a 100644 --- a/Pico/Draw.c +++ b/Pico/Draw.c @@ -610,8 +610,8 @@ static void DrawTilesFromCacheShPrep(void) { // as some layer has covered whole line with hi priority tiles, // we can process whole line and then act as if sh/hi mode was off. - rendstatus|=0x80; int c = 320/4, *zb = (int *)(HighCol+8); + rendstatus|=0x80; while (c--) { int tmp = *zb; diff --git a/Pico/Memory.c b/Pico/Memory.c index 48c32a65..847d1bd0 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -37,6 +37,8 @@ extern unsigned int ppop; #ifdef IO_STATS void log_io(unsigned int addr, int bits, int rw); +#elif defined(_MSC_VER) +#define log_io #else #define log_io(...) #endif diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index e2ce1ad1..dab9fe25 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -169,7 +169,7 @@ extern int SekCycleAimS68k; // ----------------------- Z80 CPU ----------------------- #if defined(_USE_MZ80) -#include "../../cpu/mz80/mz80.h" +#include "../cpu/mz80/mz80.h" #define z80_run(cycles) mz80_run(cycles) #define z80_run_nr(cycles) mz80_run(cycles) @@ -177,7 +177,7 @@ extern int SekCycleAimS68k; #define z80_resetCycles() mz80GetElapsedTicks(1) #elif defined(_USE_DRZ80) -#include "../../cpu/DrZ80/drz80.h" +#include "../cpu/DrZ80/drz80.h" extern struct DrZ80 drZ80; @@ -190,7 +190,7 @@ extern struct DrZ80 drZ80; #define z80_resetCycles() #elif defined(_USE_CZ80) -#include "../../cpu/cz80/cz80.h" +#include "../cpu/cz80/cz80.h" #define z80_run(cycles) Cz80_Exec(&CZ80, cycles) #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles) @@ -335,10 +335,10 @@ typedef struct union { // 0a0000: 256K struct { unsigned char word_ram2M[0x40000]; - unsigned char unused[0x20000]; + unsigned char unused0[0x20000]; }; struct { - unsigned char unused[0x20000]; + unsigned char unused1[0x20000]; unsigned char word_ram1M[2][0x20000]; }; }; @@ -503,9 +503,17 @@ extern void lprintf(const char *fmt, ...); if ((w) & EL_LOGMASK) \ lprintf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__); \ } +#elif defined(_MSC_VER) +#define elprintf #else #define elprintf(w,f,...) #endif +#ifdef _MSC_VER +#define cdprintf +#else +#define cdprintf(x...) +#endif + #endif // PICO_INTERNAL_INCLUDED diff --git a/Pico/cd/LC89510.c b/Pico/cd/LC89510.c index 05ac5d1a..efad0055 100644 --- a/Pico/cd/LC89510.c +++ b/Pico/cd/LC89510.c @@ -9,9 +9,6 @@ #include "../PicoInt.h" -#define cdprintf(x...) - - #define CDC_DMA_SPEED 256 diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index 2d08fd46..b1faacdf 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -18,10 +18,15 @@ typedef unsigned int u32; #define UTYPES_DEFINED #endif +#ifdef _MSC_VER +#define rdprintf +#define wrdprintf +#else //#define rdprintf dprintf #define rdprintf(...) //#define wrdprintf dprintf #define wrdprintf(...) +#endif #ifdef EMU_CORE_DEBUG extern u32 lastread_a, lastread_d[16], lastwrite_cyc_d[16]; @@ -1158,11 +1163,12 @@ static u32 PicoReadS68k32(u32 a) // word RAM (1M area) if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff int bank; + u16 *pm; wrdprintf("s68k_wram1M r32: [%06x] @%06x", a, SekPcS68k); // if (!(Pico_mcd->s68k_regs[3]&4)) // dprintf("s68k_wram1M FIXME: wrong mode"); bank = (Pico_mcd->s68k_regs[3]&1)^1; - u16 *pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; + pm=(u16 *)(Pico_mcd->word_ram1M[bank]+(a&0x1fffe)); d = (pm[0]<<16)|pm[1]; wrdprintf("ret = %08x", d); goto end; } diff --git a/Pico/cd/cd_file.c b/Pico/cd/cd_file.c index 9c898a92..838d8d75 100644 --- a/Pico/cd/cd_file.c +++ b/Pico/cd/cd_file.c @@ -10,7 +10,6 @@ #include "../PicoInt.h" #include "cd_file.h" -#define cdprintf(x...) //#define cdprintf(f,...) printf(f "\n",##__VA_ARGS__) // tmp #define DEBUG_CD diff --git a/Pico/cd/cd_sys.c b/Pico/cd/cd_sys.c index 713b995a..581583b8 100644 --- a/Pico/cd/cd_sys.c +++ b/Pico/cd/cd_sys.c @@ -13,7 +13,6 @@ #include "cd_sys.h" #include "cd_file.h" -#define cdprintf(x...) #define DEBUG_CD #define TRAY_OPEN 0x0500 // TRAY OPEN CDD status diff --git a/Pico/sound/ym2612.c b/Pico/sound/ym2612.c index 8e081b4f..144c334f 100644 --- a/Pico/sound/ym2612.c +++ b/Pico/sound/ym2612.c @@ -1085,7 +1085,7 @@ static void chan_render_loop(chan_rend_context *ct, int *buffer, int length) void chan_render_loop(chan_rend_context *ct, int *buffer, unsigned short length); #endif -static chan_rend_context __attribute__((aligned(64))) crct; +static chan_rend_context crct; static int chan_render(int *buffer, int length, int c, UINT32 flags) // flags: stereo, ?, disabled, ?, pan_r, pan_l { -- 2.39.5