MSVC compat.

This commit is contained in:
Themaister 2011-12-25 00:59:46 +01:00
parent 18f407110b
commit eac468ba19
36 changed files with 325 additions and 51 deletions

10
.gitignore vendored
View File

@ -1,7 +1,15 @@
*.o
*.so
*.dll
ssnes
/ssnes
/config.h
/config.mk
/tools/ssnes-joyconfig
*.sdf
*.opensdf
*.suo
Debug
Release
ipch
*.user
*.filters

View File

@ -91,7 +91,7 @@ ifeq ($(HAVE_COREAUDIO), 1)
endif
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl.o gfx/sdlwrap.o input/sdl.o audio/sdl.o fifo_buffer.o
OBJ += gfx/sdl_gfx.o gfx/sdlwrap.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
LIBS += $(SDL_LIBS)
@ -133,7 +133,7 @@ else ifeq ($(HAVE_CG), 1)
endif
ifeq ($(HAVE_DYLIB), 1)
OBJ += gfx/ext.o audio/ext.o
OBJ += gfx/ext_gfx.o audio/ext_audio.o
LIBS += $(DYLIB_LIB)
endif

View File

@ -35,7 +35,7 @@ LDFLAGS = -L. -static-libgcc
LDCXXFLAGS = -static-libstdc++ -s
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl.o gfx/gl.o gfx/sdlwrap.o input/sdl.o audio/sdl.o fifo_buffer.o
OBJ += gfx/sdl_gfx.o gfx/gl.o gfx/sdlwrap.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
LIBS += -lSDL
DEFINES += -ISDL -DHAVE_SDL
endif
@ -112,7 +112,7 @@ ifeq ($(HAVE_FBO), 1)
endif
ifeq ($(HAVE_DYLIB), 1)
OBJ += gfx/ext.o audio/ext.o
OBJ += gfx/ext_gfx.o audio/ext_audio.o
endif
ifeq ($(HAVE_PYTHON), 1)

View File

@ -16,10 +16,10 @@
*/
#include "driver.h"
#include "../driver.h"
#include <stdlib.h>
#include <asoundlib.h>
#include "general.h"
#include "../general.h"
#define TRY_ALSA(x) if (x < 0) { \
goto error; \

View File

@ -15,7 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "driver.h"
#include "../driver.h"
#include <stdlib.h>
#include "../boolean.h"
#include <stddef.h>
@ -23,8 +23,8 @@
#include <string.h>
#include <dsound.h>
#include "fifo_buffer.h"
#include "general.h"
#include "../fifo_buffer.h"
#include "../general.h"
typedef struct dsound
{

View File

@ -19,9 +19,9 @@
#include "../boolean.h"
#include <stdlib.h>
#include <stdint.h>
#include "driver.h"
#include "dynamic.h"
#include "general.h"
#include "../driver.h"
#include "../dynamic.h"
#include "../general.h"
#include <sys/types.h>
typedef struct audio_ext

View File

@ -35,8 +35,8 @@ static inline float hermite_kernel(float mu1, float a, float b, float c, float d
mu2 = mu1 * mu1;
mu3 = mu2 * mu1;
m0 = (c - a) * 0.5;
m1 = (d - b) * 0.5;
m0 = (c - a) * 0.5f;
m1 = (d - b) * 0.5f;
a0 = +2 * mu3 - 3 * mu2 + 1;
a1 = mu3 - 2 * mu2 + mu1;
@ -71,7 +71,7 @@ void hermite_process(hermite_resampler_t *re, struct hermite_data *data)
re->r_frac += r_step;
for (unsigned i = 0; i < CHANNELS; i++)
{
float res = hermite_kernel(re->r_frac,
float res = hermite_kernel((float)re->r_frac,
re->chan_data[i][0], re->chan_data[i][1], re->chan_data[i][2], re->chan_data[i][3]);
*out_data++ = res;
}

View File

@ -16,9 +16,9 @@
*/
#include "driver.h"
#include "../driver.h"
#include <stdlib.h>
#include "general.h"
#include "../general.h"
#include <jack/jack.h>
#include <jack/types.h>

View File

@ -15,8 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "driver.h"
#include "../driver.h"
#ifdef __APPLE__
#include <OpenAL/al.h>

View File

@ -16,7 +16,7 @@
*/
#include "driver.h"
#include "../driver.h"
#include <stdlib.h>
#include "../boolean.h"
#include <stddef.h>
@ -26,8 +26,8 @@
#include "SDL.h"
#include "SDL_audio.h"
#include "SDL_thread.h"
#include "general.h"
#include "fifo_buffer.h"
#include "../general.h"
#include "../fifo_buffer.h"
typedef struct sdl_audio
{

View File

@ -18,7 +18,7 @@ void audio_convert_float_to_s16_C(int16_t *out,
{
for (size_t i = 0; i < samples; i++)
{
int32_t val = in[i] * 0x8000;
int32_t val = (int32_t)(in[i] * 0x8000);
out[i] = (val > 0x7FFF) ? 0x7FFF : (val < -0x8000 ? -0x8000 : (int16_t)val);
}
}

View File

@ -210,7 +210,11 @@ static inline HRESULT XAudio2Create(IXAudio2 **ppXAudio2)
{
IXAudio2 *pXAudio2;
#ifdef __cplusplus
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
#else
HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
#endif
if (SUCCEEDED(hr))
{

View File

@ -15,10 +15,10 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "driver.h"
#include "../driver.h"
#include <stdlib.h>
#include "xaudio-c/xaudio-c.h"
#include "general.h"
#include "../general.h"
typedef struct
{

1
bps.c
View File

@ -19,6 +19,7 @@
#include "movie.h"
#include <stdint.h>
#include "boolean.h"
#include "msvc/msvc_compat.h"
enum bps_mode
{

View File

@ -24,6 +24,7 @@
#include <errno.h>
#include "../strl.h"
#include "../posix_string.h"
#include "../msvc/msvc_compat.h"
#if !defined(_WIN32) && !defined(__CELLOS_LV2__)
#include <sys/param.h> // MAXPATHLEN

View File

@ -196,7 +196,7 @@ static void init_dsp_plugin(void)
return;
}
const ssnes_dsp_plugin_t* (*SSNES_API_CALLTYPE plugin_init)(void) =
const ssnes_dsp_plugin_t* (SSNES_API_CALLTYPE *plugin_init)(void) =
(const ssnes_dsp_plugin_t *(SSNES_API_CALLTYPE*)(void))dylib_proc(g_extern.audio_data.dsp_lib, "ssnes_dsp_plugin_init");
if (!plugin_init)
{
@ -404,8 +404,8 @@ static void init_filter(void)
unsigned height = g_extern.system.geom.max_height;
g_extern.filter.psize(&width, &height);
unsigned pow2_x = next_pow2(ceil(width));
unsigned pow2_y = next_pow2(ceil(height));
unsigned pow2_x = next_pow2(width);
unsigned pow2_y = next_pow2(height);
unsigned maxsize = pow2_x > pow2_y ? pow2_x : pow2_y;
g_extern.filter.scale = maxsize / SSNES_SCALE_BASE;

View File

@ -23,7 +23,8 @@
#include "boolean.h"
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
//#include <unistd.h>
#include "msvc/msvc_compat.h"
#include "input/keysym.h"
#define AUDIO_CHUNK_SIZE_BLOCKING 64

3
file.c
View File

@ -38,6 +38,9 @@
#include <fcntl.h>
#include <windows.h>
#include <shlwapi.h>
#ifdef _MSC_VER
#define setmode _setmode
#endif
#else
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -55,6 +55,7 @@
#elif defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "msvc/msvc_compat.h"
#endif
#ifndef MAXPATHLEN

View File

@ -23,6 +23,8 @@
#include "boolean.h"
#include <stddef.h>
#include <assert.h>
#include <stdlib.h>
#include "msvc/msvc_compat.h"
char *optarg;
int optind, opterr, optopt;
@ -131,10 +133,14 @@ static int parse_long(const struct option *longopts, char * const *argv)
static void shuffle_block(char **begin, char **last, char **end)
{
ptrdiff_t len = last - begin;
const char *tmp[len];
const char **tmp = (const char**)calloc(len, sizeof(const char*));
assert(tmp);
memcpy(tmp, begin, sizeof(tmp));
memmove(begin, last, (end - last) * sizeof(char*));
memcpy(end - len, tmp, sizeof(tmp));
free(tmp);
}
int getopt_long(int argc, char *argv[],

View File

@ -22,8 +22,8 @@
#include "../boolean.h"
#include <stdlib.h>
#include <stdint.h>
#include "dynamic.h"
#include "general.h"
#include "../dynamic.h"
#include "../general.h"
#include "sdlwrap.h"
#include "gfx_common.h"

View File

@ -17,7 +17,21 @@
#include "gfx_common.h"
#include "../general.h"
#ifndef _MSC_VER
#include <sys/time.h>
#else
#include <winsock2.h>
#include <mmsystem.h>
static void gettimeofday(struct timeval *val, void *dummy)
{
(void)dummy;
DWORD msec = timeGetTime();
uint64_t usec = msec * 1000;
val->tv_sec = usec / 1000000;
val->tv_usec = usec % 1000000;
}
#endif
static float tv_to_fps(const struct timeval *tv, const struct timeval *new_tv, int frames)
{
@ -73,7 +87,7 @@ bool gfx_window_title(char *buf, size_t size)
#ifdef _WIN32
#include <windows.h>
#include "dynamic.h"
#include "../dynamic.h"
// We only load this library once, so we let it be unloaded at application shutdown,
// since unloading it early seems to cause issues on some systems.

View File

@ -21,7 +21,6 @@
#include <stdint.h>
#include "../libsnes.hpp"
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include "../general.h"
#include <assert.h>
@ -39,7 +38,7 @@
#define NO_SDL_GLEXT
#include "SDL.h"
#include "SDL_opengl.h"
#include "input/ssnes_sdl_input.h"
#include "../input/ssnes_sdl_input.h"
#ifdef HAVE_CG
#include "shader_cg.h"
@ -85,6 +84,7 @@ static const GLfloat white_color[] = {
1, 1, 1, 1,
};
#define LOAD_SYM(sym) if (!p##sym) { SDL_SYM_WRAP(p##sym, #sym) }
#ifdef HAVE_FBO
#ifdef _WIN32
@ -94,7 +94,6 @@ static PFNGLFRAMEBUFFERTEXTURE2DPROC pglFramebufferTexture2D = NULL;
static PFNGLCHECKFRAMEBUFFERSTATUSPROC pglCheckFramebufferStatus = NULL;
static PFNGLDELETEFRAMEBUFFERSPROC pglDeleteFramebuffers = NULL;
#define LOAD_SYM(sym) if (!p##sym) { SDL_SYM_WRAP(p##sym, #sym) }
static bool load_fbo_proc(void)
{
LOAD_SYM(glGenFramebuffers);

View File

@ -16,12 +16,12 @@
*/
#include "SDL.h"
#include "driver.h"
#include "../driver.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "general.h"
#include "input/ssnes_sdl_input.h"
#include "../general.h"
#include "../input/ssnes_sdl_input.h"
#include "gfx_common.h"
#ifdef HAVE_CONFIG_H

View File

@ -17,7 +17,7 @@
#include "sdlwrap.h"
#include "SDL_syswm.h"
#include "general.h"
#include "../general.h"
#include <assert.h>
#ifdef __APPLE__

View File

@ -15,11 +15,11 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "driver.h"
#include "../driver.h"
#include "../gfx/sdlwrap.h"
#include "../boolean.h"
#include "general.h"
#include "../general.h"
#include <stdint.h>
#include <stdlib.h>
#include "../libsnes.hpp"

View File

@ -23,7 +23,7 @@
#include <dinput.h>
#include "../boolean.h"
#include "general.h"
#include "../general.h"
// Piggyback joypad driver for SDL.

View File

@ -19,7 +19,7 @@
#define __SSNES_SDL_INPUT_H
#include "SDL.h"
#include "general.h"
#include "../general.h"
#ifdef HAVE_DINPUT
#include "ssnes_dinput.h"

20
msvc/SSNES/SSNES.sln Normal file
View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SSNES", "SSNES\SSNES.vcxproj", "{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}.Debug|Win32.ActiveCfg = Debug|Win32
{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}.Debug|Win32.Build.0 = Debug|Win32
{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}.Release|Win32.ActiveCfg = Release|Win32
{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{032D1FA7-7AA5-47BB-B51B-68B75ADE729D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>SSNES</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>ssnes</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>ssnes</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<FloatingPointModel>Precise</FloatingPointModel>
<CompileAs>CompileAsCpp</CompileAs>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>SDL.lib;opengl32.lib;ws2_32.lib;dxguid.lib;dinput8.lib;cg.lib;cgGL.lib;winmm.lib;shlwapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE %(AdditionalOptions)</AdditionalOptions>
<CompileAs>CompileAsCpp</CompileAs>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>SDL.lib;opengl32.lib;ws2_32.lib;dxguid.lib;dinput8.lib;cg.lib;cgGL.lib;winmm.lib;shlwapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\audio\dsound.c" />
<ClCompile Include="..\..\..\audio\ext_audio.c" />
<ClCompile Include="..\..\..\audio\hermite.c" />
<ClCompile Include="..\..\..\audio\sdl_audio.c" />
<ClCompile Include="..\..\..\audio\utils.c" />
<ClCompile Include="..\..\..\audio\xaudio-c\xaudio-c.c" />
<ClCompile Include="..\..\..\audio\xaudio.c" />
<ClCompile Include="..\..\..\autosave.c" />
<ClCompile Include="..\..\..\bps.c" />
<ClCompile Include="..\..\..\conf\config_file.c" />
<ClCompile Include="..\..\..\driver.c" />
<ClCompile Include="..\..\..\dynamic.c" />
<ClCompile Include="..\..\..\fifo_buffer.c" />
<ClCompile Include="..\..\..\file.c" />
<ClCompile Include="..\..\..\getopt.c" />
<ClCompile Include="..\..\..\gfx\ext_gfx.c" />
<ClCompile Include="..\..\..\gfx\gfx_common.c" />
<ClCompile Include="..\..\..\gfx\gl.c" />
<ClCompile Include="..\..\..\gfx\image.c" />
<ClCompile Include="..\..\..\gfx\sdl_gfx.c" />
<ClCompile Include="..\..\..\gfx\sdlwrap.c" />
<ClCompile Include="..\..\..\gfx\shader_cg.c" />
<ClCompile Include="..\..\..\gfx\snes_state.c" />
<ClCompile Include="..\..\..\input\dinput.c" />
<ClCompile Include="..\..\..\input\sdl_input.c" />
<ClCompile Include="..\..\..\message.c" />
<ClCompile Include="..\..\..\movie.c" />
<ClCompile Include="..\..\..\netplay.c" />
<ClCompile Include="..\..\..\posix_string.c" />
<ClCompile Include="..\..\..\rewind.c" />
<ClCompile Include="..\..\..\screenshot.c" />
<ClCompile Include="..\..\..\settings.c" />
<ClCompile Include="..\..\..\sha256.c" />
<ClCompile Include="..\..\..\ssnes.c" />
<ClCompile Include="..\..\..\strl.c" />
<ClCompile Include="..\..\..\thread.c" />
<ClCompile Include="..\..\..\ups.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\audio\ext\ssnes_audio.h" />
<ClInclude Include="..\..\..\audio\ext\ssnes_dsp.h" />
<ClInclude Include="..\..\..\audio\hermite.h" />
<ClInclude Include="..\..\..\audio\utils.h" />
<ClInclude Include="..\..\..\audio\xaudio-c\xaudio-c.h" />
<ClInclude Include="..\..\..\audio\xaudio-c\xaudio.h" />
<ClInclude Include="..\..\..\autosave.h" />
<ClInclude Include="..\..\..\boolean.h" />
<ClInclude Include="..\..\..\bps.h" />
<ClInclude Include="..\..\..\cheats.h" />
<ClInclude Include="..\..\..\config.def.h" />
<ClInclude Include="..\..\..\config.features.h" />
<ClInclude Include="..\..\..\conf\config_file.h" />
<ClInclude Include="..\..\..\driver.h" />
<ClInclude Include="..\..\..\dynamic.h" />
<ClInclude Include="..\..\..\fifo_buffer.h" />
<ClInclude Include="..\..\..\file.h" />
<ClInclude Include="..\..\..\general.h" />
<ClInclude Include="..\..\..\getopt_ssnes.h" />
<ClInclude Include="..\..\..\gfx\ext\ssnes_video.h" />
<ClInclude Include="..\..\..\gfx\gfx_common.h" />
<ClInclude Include="..\..\..\gfx\gl_common.h" />
<ClInclude Include="..\..\..\gfx\image.h" />
<ClInclude Include="..\..\..\gfx\sdlwrap.h" />
<ClInclude Include="..\..\..\gfx\shader_cg.h" />
<ClInclude Include="..\..\..\gfx\snes_state.h" />
<ClInclude Include="..\..\..\input\keysym.h" />
<ClInclude Include="..\..\..\input\ssnes_dinput.h" />
<ClInclude Include="..\..\..\input\ssnes_sdl_input.h" />
<ClInclude Include="..\..\..\libsnes.hpp" />
<ClInclude Include="..\..\..\message.h" />
<ClInclude Include="..\..\..\movie.h" />
<ClInclude Include="..\..\..\netplay.h" />
<ClInclude Include="..\..\..\posix_string.h" />
<ClInclude Include="..\..\..\rewind.h" />
<ClInclude Include="..\..\..\screenshot.h" />
<ClInclude Include="..\..\..\sha256.h" />
<ClInclude Include="..\..\..\strl.h" />
<ClInclude Include="..\..\..\thread.h" />
<ClInclude Include="..\..\..\ups.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

44
msvc/msvc_compat.h Normal file
View File

@ -0,0 +1,44 @@
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
* Copyright (C) 2010-2011 - Hans-Kristian Arntzen
*
* Some code herein may be based on code found in BSNES.
*
* SSNES is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with SSNES.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SSNES_MSVC_COMPAT_H
#define __SSNES_MSVC_COMPAT_H
#ifdef _MSC_VER
#undef UNICODE
#include <stddef.h>
#include <math.h>
#if defined(_WIN32)
typedef signed long ssize_t;
#elif defined(_WIN64)
typedef signed long long ssize_t;
#endif
#define snprintf _snprintf
#pragma warning(disable : 4800)
#pragma warning(disable : 4244)
#pragma warning(disable : 4305)
#pragma warning(disable : 4146)
static inline float roundf(float in)
{
return in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f);
}
#endif
#endif

View File

@ -41,9 +41,8 @@
#include "message.h"
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <assert.h>
#include <assert.h>
#ifdef _WIN32
// Woohoo, Winsock has headers from the STONE AGE! :D
@ -53,6 +52,7 @@
#else
#define CONST_CAST
#define NONCONST_CAST
#include <sys/time.h>
#endif
#define PREV_PTR(x) ((x) == 0 ? handle->buffer_size - 1 : (x) - 1)

View File

@ -43,13 +43,13 @@ static inline size_t nearest_pow2_size(size_t v)
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
#if SIZE_MAX >= 0xffffu
#if SIZE_MAX >= UINT16_C(0xffff)
v |= v >> 8;
#endif
#if SIZE_MAX >= 0xfffffffflu
#if SIZE_MAX >= UINT32_C(0xffffffff)
v |= v >> 16;
#endif
#if SIZE_MAX >= 0xffffffffffffffffllu
#if SIZE_MAX >= UINT64_C(0xffffffffffffffff)
v |= v >> 32;
#endif
v++;

View File

@ -433,7 +433,7 @@ static void parse_config_file(void)
CONFIG_GET_BOOL(rewind_enable, "rewind_enable");
if (config_get_int(conf, "rewind_buffer_size", &tmp_int))
g_settings.rewind_buffer_size = tmp_int * 1000000LLU;
g_settings.rewind_buffer_size = tmp_int * UINT64_C(1000000);
CONFIG_GET_INT(rewind_granularity, "rewind_granularity");

View File

@ -39,6 +39,7 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "msvc/msvc_compat.h"
#endif
#ifdef __APPLE__

1
ups.c
View File

@ -17,6 +17,7 @@
#include "ups.h"
#include "movie.h"
#include "msvc/msvc_compat.h"
struct ups_data
{