diff --git a/src/boards/117.c b/src/boards/117.c index 3a50ce2..a434899 100644 --- a/src/boards/117.c +++ b/src/boards/117.c @@ -35,11 +35,11 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { + int i; setprg8(0x8000, prgreg[0]); setprg8(0xa000, prgreg[1]); setprg8(0xc000, prgreg[2]); setprg8(0xe000, prgreg[3]); - int i; for (i = 0; i < 8; i++) setchr1(i << 10, chrreg[i]); setmirror(mirror ^ 1); diff --git a/src/boards/185.c b/src/boards/185.c index f8ffe64..26aaf08 100644 --- a/src/boards/185.c +++ b/src/boards/185.c @@ -81,12 +81,12 @@ static void MRestore(int version) { } void Mapper185_Init(CartInfo *info) { + int x; Sync = Sync185; info->Power = MPower; info->Close = MClose; GameStateRestore = MRestore; DummyCHR = (uint8*)FCEU_gmalloc(8192); - int x; for (x = 0; x < 8192; x++) DummyCHR[x] = 0xff; SetupCartCHRMapping(0x10, DummyCHR, 8192, 0); @@ -94,12 +94,12 @@ void Mapper185_Init(CartInfo *info) { } void Mapper181_Init(CartInfo *info) { + int x; Sync = Sync181; info->Power = MPower; info->Close = MClose; GameStateRestore = MRestore; DummyCHR = (uint8*)FCEU_gmalloc(8192); - int x; for (x = 0; x < 8192; x++) DummyCHR[x] = 0xff; SetupCartCHRMapping(0x10, DummyCHR, 8192, 0); diff --git a/src/boards/206.c b/src/boards/206.c index d013a8f..bd88f88 100644 --- a/src/boards/206.c +++ b/src/boards/206.c @@ -31,9 +31,9 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { + int x; setchr2(0x0000, DRegs[0]); setchr2(0x0800, DRegs[1]); - int x; for (x = 0; x < 4; x++) setchr1(0x1000 + (x << 10), DRegs[2 + x]); setprg8(0x8000, DRegs[6]); diff --git a/src/boards/222.c b/src/boards/222.c index 6fa7ff7..9361f43 100644 --- a/src/boards/222.c +++ b/src/boards/222.c @@ -50,9 +50,9 @@ static void M222IRQ(void) { } static void Sync(void) { + int i; setprg8(0x8000, prg_reg[0]); setprg8(0xA000, prg_reg[1]); - int i; for (i = 0; i < 8; i++) setchr1(i << 10, chr_reg[i]); setmirror(mirr ^ 1); diff --git a/src/boards/32.c b/src/boards/32.c index ade2d65..12f380a 100644 --- a/src/boards/32.c +++ b/src/boards/32.c @@ -34,6 +34,7 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { + uint8 i; uint16 swap = ((mirr & 2) << 13); setmirror((mirr & 1) ^ 1); setprg8r(0x10, 0x6000, 0); @@ -41,7 +42,6 @@ static void Sync(void) { setprg8(0xA000, preg[1]); setprg8(0xC000 ^ swap, ~1); setprg8(0xE000, ~0); - uint8 i; for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]); } diff --git a/src/boards/ax5705.c b/src/boards/ax5705.c index 780ea4b..0484109 100644 --- a/src/boards/ax5705.c +++ b/src/boards/ax5705.c @@ -50,11 +50,11 @@ static void UNLAX5705IRQ(void) { }*/ static void Sync(void) { + int i; setprg8(0x8000, prg_reg[0]); setprg8(0xA000, prg_reg[1]); setprg8(0xC000, ~1); setprg8(0xE000, ~0); - int i; for (i = 0; i < 8; i++) setchr1(i << 10, chr_reg[i]); setmirror(mirr ^ 1); diff --git a/src/boards/cityfighter.c b/src/boards/cityfighter.c index 3214959..0ae4ef9 100644 --- a/src/boards/cityfighter.c +++ b/src/boards/cityfighter.c @@ -40,10 +40,10 @@ static SFORMAT StateRegs[] = }; static void Sync(void) { + int i; setprg32(0x8000, prg_reg >> 2); if (!prg_mode) setprg8(0xC000, prg_reg); - int i; for (i = 0; i < 8; i++) setchr1(i << 10, chr_reg[i]); switch (mirr) { diff --git a/src/boards/n106.c b/src/boards/n106.c index 4eac0d9..45805f5 100644 --- a/src/boards/n106.c +++ b/src/boards/n106.c @@ -330,10 +330,10 @@ static void DoNamcoSound(int32 *Wave, int Count) { } static void Mapper19_StateRestore(int version) { + int x; SyncPRG(); FixNTAR(); FixCRR(); - int x; for (x = 0x40; x < 0x80; x++) FixCache(x, IRAM[x]); } diff --git a/src/drivers/libretro/libretro.c b/src/drivers/libretro/libretro.c index d489506..150f0b0 100644 --- a/src/drivers/libretro/libretro.c +++ b/src/drivers/libretro/libretro.c @@ -637,6 +637,9 @@ void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count) void retro_run(void) { unsigned width, height, pitch, x, y; +#ifndef PSP + static uint16_t video_out[256 * 240]; +#endif uint8_t *gfx; int32 ssize; bool updated; @@ -673,8 +676,6 @@ void retro_run(void) sceGuClutLoad(32, retro_palette); sceGuFinish(); -#else - static uint16_t video_out[256 * 240]; #endif if (use_overscan) diff --git a/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj b/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj index 498d1fb..e032c0c 100644 --- a/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj +++ b/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj @@ -782,14 +782,6 @@ CompileAsC CompileAsC - - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC CompileAsC @@ -1174,6 +1166,7 @@ CompileAsC CompileAsC + CompileAsC CompileAsC @@ -1390,14 +1383,6 @@ CompileAsC CompileAsC - - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC - CompileAsC CompileAsC diff --git a/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters b/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters index e8680e8..5ff9efc 100644 --- a/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters +++ b/src/drivers/libretro/msvc/msvc-2010/msvc-2010.vcxproj.filters @@ -413,9 +413,6 @@ Source Files\boards - - Source Files\boards - Source Files\boards @@ -581,9 +578,6 @@ Source Files - - Source Files - Source Files @@ -620,6 +614,9 @@ Source Files\libretro + + Source Files + diff --git a/src/fceu-types.h b/src/fceu-types.h index 8283605..2548d64 100644 --- a/src/fceu-types.h +++ b/src/fceu-types.h @@ -22,7 +22,11 @@ #ifndef __FCEU_TYPES_H #define __FCEU_TYPES_H +#ifdef __LIBRETRO__ +#include +#else #include +#endif typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; diff --git a/src/fceu.c b/src/fceu.c index 6ca5d43..1b26ee9 100644 --- a/src/fceu.c +++ b/src/fceu.c @@ -451,6 +451,7 @@ void FCEU_ResetVidSys(void) { FCEUS FSettings; void FCEU_printf(char *format, ...) { + FILE *ofile; char temp[2048]; va_list ap; @@ -459,7 +460,6 @@ void FCEU_printf(char *format, ...) { vsprintf(temp, format, ap); FCEUD_Message(temp); - FILE *ofile; ofile = fopen("stdout.txt", "ab"); fwrite(temp, 1, strlen(temp), ofile); fclose(ofile); diff --git a/src/file.c b/src/file.c index c6f75c9..306e714 100644 --- a/src/file.c +++ b/src/file.c @@ -21,7 +21,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "zlib.h" #include "unzip.h" diff --git a/src/general.c b/src/general.c index 52b9d9f..dcb52d4 100644 --- a/src/general.c +++ b/src/general.c @@ -25,7 +25,11 @@ #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "fceu-types.h" #include "fceu.h" diff --git a/src/ines.c b/src/ines.c index 672be0a..cce884e 100644 --- a/src/ines.c +++ b/src/ines.c @@ -656,6 +656,8 @@ static BMAPPINGLocal bmap[] = { int iNESLoad(const char *name, FCEUFILE *fp) { struct md5_context md5; + char* mappername; + uint32 mappertest; if (FCEU_fread(&head, 1, 16, fp) != 16) return 0; @@ -744,9 +746,8 @@ int iNESLoad(const char *name, FCEUFILE *fp) { FCEU_printf(" CHR ROM: %3d x 8KiB\n", head.VROM_size); FCEU_printf(" ROM CRC32: 0x%08lx\n", iNESGameCRC32); FCEU_printf(" ROM MD5: 0x%s\n", md5_asciistr(iNESCart.MD5)); - char* mappername = "Not Listed"; + mappername = "Not Listed"; - uint32 mappertest; for (mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) { if (bmap[mappertest].number == MapperNo) { mappername = bmap[mappertest].name; diff --git a/src/input.c b/src/input.c index 815e26e..27c340a 100644 --- a/src/input.c +++ b/src/input.c @@ -373,7 +373,15 @@ void FCEU_DoSimpleCommand(int cmd) { case FCEUNPCMD_FDSSELECT: FCEU_FDSSelect(); break; case FCEUNPCMD_FDSEJECT: FCEU_FDSEject(); break; case FCEUNPCMD_VSUNICOIN: FCEU_VSUniCoin(); break; - case FCEUNPCMD_VSUNIDIP0 ... (FCEUNPCMD_VSUNIDIP0 + 7): FCEU_VSUniToggleDIP(cmd - FCEUNPCMD_VSUNIDIP0); break; + case FCEUNPCMD_VSUNIDIP0: + case (FCEUNPCMD_VSUNIDIP0 + 1): + case (FCEUNPCMD_VSUNIDIP0 + 2): + case (FCEUNPCMD_VSUNIDIP0 + 3): + case (FCEUNPCMD_VSUNIDIP0 + 4): + case (FCEUNPCMD_VSUNIDIP0 + 5): + case (FCEUNPCMD_VSUNIDIP0 + 6): + case (FCEUNPCMD_VSUNIDIP0 + 7): + FCEU_VSUniToggleDIP(cmd - FCEUNPCMD_VSUNIDIP0); break; case FCEUNPCMD_POWER: PowerNES(); break; case FCEUNPCMD_RESET: ResetNES(); break; } diff --git a/src/netplay.c b/src/netplay.c index 9542598..bd871e6 100644 --- a/src/netplay.c +++ b/src/netplay.c @@ -24,7 +24,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include #include "fceu-types.h" @@ -76,6 +80,9 @@ int FCEUI_NetplayStart(int nlocal, int divisor) { } int FCEUNET_SendCommand(uint8 cmd, uint32 len) { +#ifdef __LIBRETRO__ + return 0; +#else uint8 buf[numlocal + 1 + 4]; buf[0] = 0xFF; @@ -88,6 +95,7 @@ int FCEUNET_SendCommand(uint8 cmd, uint32 len) { } #endif return(1); +#endif } void FCEUI_NetplayText(uint8 *text) { diff --git a/src/state.c b/src/state.c index df8acbc..037fdd4 100644 --- a/src/state.c +++ b/src/state.c @@ -28,7 +28,11 @@ #include #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include "fceu-types.h" #include "x6502.h" diff --git a/src/wave.c b/src/wave.c index d055f26..8db84f8 100644 --- a/src/wave.c +++ b/src/wave.c @@ -15,6 +15,7 @@ static long wsize; // so). void FCEU_WriteWaveData(int32 *Buffer, int Count) { +#ifndef __LIBRETRO__ int16 temp[Count]; /* Yay. Is this the first use of this "feature" of C in FCE Ultra? */ int16 *dest; int x; @@ -33,6 +34,7 @@ void FCEU_WriteWaveData(int32 *Buffer, int Count) { Buffer++; } wsize += fwrite(temp, 1, Count * sizeof(int16), soundlog); +#endif } int FCEUI_EndWaveRecord(void) {