MSVC compatibility fixes

This commit is contained in:
Twinaphex 2014-04-15 01:59:54 -07:00
parent a5a1a476b1
commit 514448258e
20 changed files with 55 additions and 37 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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]);

View File

@ -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);

View File

@ -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]);
}

View File

@ -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);

View File

@ -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) {

View File

@ -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]);
}

View File

@ -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)

View File

@ -782,14 +782,6 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\..\boards\konami-qtai.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\..\boards\KS7012.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
@ -1174,6 +1166,7 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\..\fceu-memory.c" />
<ClCompile Include="..\..\..\..\fceu.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
@ -1390,14 +1383,6 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\..\memory.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="..\..\..\..\movie.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Win32'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>

View File

@ -413,9 +413,6 @@
<ClCompile Include="..\..\..\..\boards\kof97.c">
<Filter>Source Files\boards</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\boards\konami-qtai.c">
<Filter>Source Files\boards</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\boards\KS7012.c">
<Filter>Source Files\boards</Filter>
</ClCompile>
@ -581,9 +578,6 @@
<ClCompile Include="..\..\..\..\md5.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\memory.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\movie.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -620,6 +614,9 @@
<ClCompile Include="..\..\crc32-zlib.c">
<Filter>Source Files\libretro</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\fceu-memory.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src-fceumm\input\suborkb.h">

View File

@ -22,7 +22,11 @@
#ifndef __FCEU_TYPES_H
#define __FCEU_TYPES_H
#ifdef __LIBRETRO__
#include <stdint.h>
#else
#include <inttypes.h>
#endif
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;

View File

@ -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);

View File

@ -21,7 +21,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include "zlib.h"
#include "unzip.h"

View File

@ -25,7 +25,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include "fceu-types.h"
#include "fceu.h"

View File

@ -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;

View File

@ -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;
}

View File

@ -24,7 +24,11 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <zlib.h>
#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) {

View File

@ -28,7 +28,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include "fceu-types.h"
#include "x6502.h"

View File

@ -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) {