Fix up Windows build errors.

This commit is contained in:
BearOso 2023-01-26 17:06:45 -06:00
parent 65dbcaf2fb
commit 11dd6b1e6d
12 changed files with 109 additions and 76 deletions

View File

@ -745,7 +745,7 @@ void S9xBSXSetStream1 (uint8 count)
path += name; path += name;
BSX.sat_stream1.clear(); BSX.sat_stream1.clear();
BSX.sat_stream1.open(path, std::ios::in | std::ios::binary); BSX.sat_stream1.open(path.c_str(), std::ios::in | std::ios::binary);
if (BSX.sat_stream1.good()) if (BSX.sat_stream1.good())
{ {
BSX.sat_stream1.seekg(0, BSX.sat_stream1.end); BSX.sat_stream1.seekg(0, BSX.sat_stream1.end);
@ -776,7 +776,7 @@ void S9xBSXSetStream2 (uint8 count)
path += name; path += name;
BSX.sat_stream2.clear(); BSX.sat_stream2.clear();
BSX.sat_stream2.open(path, std::ios::in | std::ios::binary); BSX.sat_stream2.open(path.c_str(), std::ios::in | std::ios::binary);
if (BSX.sat_stream2.good()) if (BSX.sat_stream2.good())
{ {
BSX.sat_stream2.seekg(0, BSX.sat_stream2.end); BSX.sat_stream2.seekg(0, BSX.sat_stream2.end);

View File

@ -61,17 +61,17 @@ SplitPath splitpath(string str)
fs::path path(str); fs::path path(str);
if (path.has_root_name()) if (path.has_root_name())
output.drive = path.root_name(); output.drive = path.root_name().string();
if (path.has_filename()) if (path.has_filename())
{ {
output.stem = path.stem(); output.stem = path.stem().string();
output.ext = path.extension(); output.ext = path.extension().string();
path.remove_filename(); path.remove_filename();
} }
if (!path.empty()) if (!path.empty())
output.dir = path; output.dir = path.string();
return output; return output;
} }

10
port.h
View File

@ -114,6 +114,16 @@ typedef size_t pint;
#define START_EXTERN_C extern "C" { #define START_EXTERN_C extern "C" {
#define END_EXTERN_C } #define END_EXTERN_C }
#ifndef __WIN32__
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#else
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH
#endif
#endif
#include "fscompat.h" #include "fscompat.h"
#ifndef __WIN32__ #ifndef __WIN32__

View File

@ -255,8 +255,8 @@ struct SSettings
bool8 BilinearFilter; bool8 BilinearFilter;
bool8 Multi; bool8 Multi;
char CartAName[4097]; char CartAName[PATH_MAX + 1];
char CartBName[4097]; char CartBName[PATH_MAX + 1];
bool8 DisableGameSpecificHacks; bool8 DisableGameSpecificHacks;
bool8 BlockInvalidVRAMAccessMaster; bool8 BlockInvalidVRAMAccessMaster;

View File

@ -208,7 +208,7 @@ void CShaderParamDlg::createContent(HWND hDlg)
for(int i = 0; i < shader.param.size(); i++) { for(int i = 0; i < shader.param.size(); i++) {
GLSLParam &p = shader.param[i]; GLSLParam &p = shader.param[i];
TCHAR desc[270]; TCHAR desc[270];
_stprintf(desc, TEXT("%s [%g-%g]"), (TCHAR*)_tFromChar(p.name), p.min, p.max); _stprintf(desc, TEXT("%s [%g-%g]"), (TCHAR*)_tFromChar(p.name.c_str()), p.min, p.max);
HWND item = CreateWindow(TEXT("STATIC"), desc, SS_LEFTNOWORDWRAP | WS_VISIBLE | WS_CHILD, desc_left, (INT)(top + avgCharHeight * 0.3), desc_width, avgCharHeight, parent, (HMENU)(UINT_PTR)(IDC_PARAMS_START_STATIC + i), GUI.hInstance, NULL); HWND item = CreateWindow(TEXT("STATIC"), desc, SS_LEFTNOWORDWRAP | WS_VISIBLE | WS_CHILD, desc_left, (INT)(top + avgCharHeight * 0.3), desc_width, avgCharHeight, parent, (HMENU)(UINT_PTR)(IDC_PARAMS_START_STATIC + i), GUI.hInstance, NULL);
SendMessage(item, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(FALSE, 0)); SendMessage(item, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(FALSE, 0));
TCHAR val[100]; TCHAR val[100];

View File

@ -74,12 +74,12 @@ namespace std {
class u8nifstream: public std::ifstream class u8nifstream: public std::ifstream
{ {
public: public:
void __CLR_OR_THIS_CALL open(const char *_Filename, ios_base::open_mode _Mode) void __CLR_OR_THIS_CALL open(const char *_Filename, ios_base::openmode _Mode)
{ {
std::ifstream::open(Utf8ToWide(_Filename), (ios_base::openmode)_Mode); std::ifstream::open(Utf8ToWide(_Filename), (ios_base::openmode)_Mode);
} }
void __CLR_OR_THIS_CALL open(const wchar_t *_Filename, ios_base::open_mode _Mode) void __CLR_OR_THIS_CALL open(const wchar_t *_Filename, ios_base::openmode _Mode)
{ {
std::ifstream::open(_Filename, (ios_base::openmode)_Mode); std::ifstream::open(_Filename, (ios_base::openmode)_Mode);
} }

View File

@ -563,6 +563,7 @@
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">%(AdditionalOptions) /Zm300</AdditionalOptions> <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">%(AdditionalOptions) /Zm300</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">%(AdditionalOptions) /Zm300</AdditionalOptions> <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">%(AdditionalOptions) /Zm300</AdditionalOptions>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\external\glslang\glslang\MachineIndependent\SpirvIntrinsics.cpp" />
<ClCompile Include="..\..\..\external\glslang\glslang\MachineIndependent\SymbolTable.cpp"> <ClCompile Include="..\..\..\external\glslang\glslang\MachineIndependent\SymbolTable.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalOptions) /Zm300</AdditionalOptions> <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalOptions) /Zm300</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalOptions) /Zm300</AdditionalOptions> <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalOptions) /Zm300</AdditionalOptions>

View File

@ -31,6 +31,7 @@
<ClCompile Include="..\..\..\external\glslang\glslang\GenericCodeGen\CodeGen.cpp" /> <ClCompile Include="..\..\..\external\glslang\glslang\GenericCodeGen\CodeGen.cpp" />
<ClCompile Include="..\..\..\external\glslang\glslang\GenericCodeGen\Link.cpp" /> <ClCompile Include="..\..\..\external\glslang\glslang\GenericCodeGen\Link.cpp" />
<ClCompile Include="..\..\..\external\glslang\StandAlone\ResourceLimits.cpp" /> <ClCompile Include="..\..\..\external\glslang\StandAlone\ResourceLimits.cpp" />
<ClCompile Include="..\..\..\external\glslang\glslang\MachineIndependent\SpirvIntrinsics.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\external\glslang\glslang\Public\ShaderLang.h" /> <ClInclude Include="..\..\..\external\glslang\glslang\Public\ShaderLang.h" />

View File

@ -117,7 +117,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;;..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -132,6 +132,8 @@
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -166,7 +168,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;;..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
@ -181,6 +183,8 @@
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -220,7 +224,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;%(AdditionalIncludeDirectories);..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -236,6 +240,8 @@
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -273,7 +279,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;%(AdditionalIncludeDirectories);..\external\fmt\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -289,6 +295,8 @@
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <ForcedIncludeFiles>_tfwopen.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:__cplusplus $(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -350,6 +358,7 @@
<CustomBuild Include="..\gfx.h" /> <CustomBuild Include="..\gfx.h" />
<ClInclude Include="..\filter\xbrz_config.h" /> <ClInclude Include="..\filter\xbrz_config.h" />
<ClInclude Include="..\filter\xbrz_tools.h" /> <ClInclude Include="..\filter\xbrz_tools.h" />
<ClInclude Include="..\fscompat.h" />
<ClInclude Include="..\jma\7z.h" /> <ClInclude Include="..\jma\7z.h" />
<ClInclude Include="..\jma\aribitcd.h" /> <ClInclude Include="..\jma\aribitcd.h" />
<ClInclude Include="..\jma\ariconst.h" /> <ClInclude Include="..\jma\ariconst.h" />
@ -486,12 +495,14 @@
<ClCompile Include="..\dsp2.cpp" /> <ClCompile Include="..\dsp2.cpp" />
<ClCompile Include="..\dsp3.cpp" /> <ClCompile Include="..\dsp3.cpp" />
<ClCompile Include="..\dsp4.cpp" /> <ClCompile Include="..\dsp4.cpp" />
<ClCompile Include="..\external\fmt\src\format.cc" />
<ClCompile Include="..\filter\2xsai.cpp" /> <ClCompile Include="..\filter\2xsai.cpp" />
<ClCompile Include="..\filter\blit.cpp" /> <ClCompile Include="..\filter\blit.cpp" />
<ClCompile Include="..\filter\epx.cpp" /> <ClCompile Include="..\filter\epx.cpp" />
<ClCompile Include="..\filter\hq2x.cpp" /> <ClCompile Include="..\filter\hq2x.cpp" />
<ClCompile Include="..\filter\snes_ntsc.c" /> <ClCompile Include="..\filter\snes_ntsc.c" />
<ClCompile Include="..\filter\xbrz.cpp" /> <ClCompile Include="..\filter\xbrz.cpp" />
<ClCompile Include="..\fscompat.cpp" />
<ClCompile Include="..\fxdbg.cpp"> <ClCompile Include="..\fxdbg.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">true</ExcludedFromBuild>

View File

@ -43,6 +43,9 @@
<Filter Include="Shaders"> <Filter Include="Shaders">
<UniqueIdentifier>{31758447-7e76-4af0-8561-a377194049e1}</UniqueIdentifier> <UniqueIdentifier>{31758447-7e76-4af0-8561-a377194049e1}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="fmtlib">
<UniqueIdentifier>{07a3a904-2263-4912-80ea-c31a0e4c78c5}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\statemanager.h"> <ClInclude Include="..\statemanager.h">
@ -288,6 +291,9 @@
<ClInclude Include="CSaveLoadWithPreviewDlg.h"> <ClInclude Include="CSaveLoadWithPreviewDlg.h">
<Filter>GUI</Filter> <Filter>GUI</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\fscompat.h">
<Filter>Emu</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\bsx.cpp"> <ClCompile Include="..\bsx.cpp">
@ -629,6 +635,12 @@
<ClCompile Include="CSaveLoadWithPreviewDlg.cpp"> <ClCompile Include="CSaveLoadWithPreviewDlg.cpp">
<Filter>GUI</Filter> <Filter>GUI</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\external\fmt\src\format.cc">
<Filter>fmtlib</Filter>
</ClCompile>
<ClCompile Include="..\fscompat.cpp">
<Filter>Emu</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="rsrc\nodrop.cur"> <None Include="rsrc\nodrop.cur">

View File

@ -100,9 +100,9 @@ const char *S9xGetFilename (const char *ex, enum s9x_getdirtype dirtype)
char drive [_MAX_DRIVE + 1]; char drive [_MAX_DRIVE + 1];
char fname [_MAX_FNAME + 1]; char fname [_MAX_FNAME + 1];
char ext [_MAX_EXT + 1]; char ext [_MAX_EXT + 1];
_splitpath (Memory.ROMFilename, drive, dir, fname, ext); _splitpath (Memory.ROMFilename.c_str(), drive, dir, fname, ext);
_snprintf(filename, sizeof(filename), "%s" SLASH_STR "%s%s", _snprintf(filename, sizeof(filename), "%s" SLASH_STR "%s%s",
S9xGetDirectory(dirtype), fname, ex); S9xGetDirectory(dirtype).c_str(), fname, ex);
return (filename); return (filename);
} }
@ -172,7 +172,7 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
break; break;
case ROMFILENAME_DIR: { case ROMFILENAME_DIR: {
lstrcpy(filename, _tFromChar(Memory.ROMFilename)); lstrcpy(filename, _tFromChar(Memory.ROMFilename.c_str()));
if(!filename[0]) if(!filename[0])
rv = GUI.RomDir; rv = GUI.RomDir;
for(int i=lstrlen(filename); i>=0; i--){ for(int i=lstrlen(filename); i>=0; i--){
@ -198,7 +198,7 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
return rv; return rv;
} }
const char *S9xGetDirectory (enum s9x_getdirtype dirtype) std::string S9xGetDirectory (enum s9x_getdirtype dirtype)
{ {
static char path[PATH_MAX]={0}; static char path[PATH_MAX]={0};
strncpy(path,_tToChar(S9xGetDirectoryT(dirtype)),PATH_MAX-1); strncpy(path,_tToChar(S9xGetDirectoryT(dirtype)),PATH_MAX-1);
@ -206,7 +206,7 @@ const char *S9xGetDirectory (enum s9x_getdirtype dirtype)
return path; return path;
} }
const char *S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype) std::string S9xGetFilenameInc (std::string e, enum s9x_getdirtype dirtype)
{ {
static char filename [PATH_MAX + 1]; static char filename [PATH_MAX + 1];
char dir [_MAX_DIR + 1]; char dir [_MAX_DIR + 1];
@ -216,10 +216,12 @@ const char *S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype)
unsigned int i=0; unsigned int i=0;
const char *d; const char *d;
_splitpath (Memory.ROMFilename, drive, dir, fname, ext); _splitpath (Memory.ROMFilename.c_str(), drive, dir, fname, ext);
d=S9xGetDirectory(dirtype); std::string directory_string = S9xGetDirectory(dirtype);
d = directory_string.c_str();
do { do {
_snprintf(filename, sizeof(filename), "%s\\%s%03d%s", d, fname, i, e); _snprintf(filename, sizeof(filename), "%s\\%s%03d%s", d, fname, i, e.c_str());
i++; i++;
} while(_taccess (_tFromChar(filename), 0) == 0 && i!=0); } while(_taccess (_tFromChar(filename), 0) == 0 && i!=0);

View File

@ -704,7 +704,7 @@ void S9xRestoreWindowTitle ()
if (Memory.ROMFilename[0]) if (Memory.ROMFilename[0])
{ {
char def[_MAX_FNAME]; char def[_MAX_FNAME];
_splitpath(Memory.ROMFilename, NULL, NULL, def, NULL); _splitpath(Memory.ROMFilename.c_str(), NULL, NULL, def, NULL);
_stprintf(buf, TEXT("%s - %s %s"), (wchar_t *)Utf8ToWide(def), WINDOW_TITLE, TEXT(VERSION)); _stprintf(buf, TEXT("%s - %s %s"), (wchar_t *)Utf8ToWide(def), WINDOW_TITLE, TEXT(VERSION));
} }
else else
@ -1439,10 +1439,10 @@ bool WinMoviePlay(LPCTSTR filename)
return false; return false;
} }
while (info.ROMCRC32 != Memory.ROMCRC32 || strcmp(info.ROMName, Memory.RawROMName) != 0) { while (info.ROMCRC32 != Memory.ROMCRC32) {
TCHAR temp[512]; TCHAR temp[512];
wsprintf(temp, TEXT("Movie's ROM: crc32=%08X, name=%s\nCurrent ROM: crc32=%08X, name=%s\n\nstill want to play the movie?"), wsprintf(temp, TEXT("Movie's ROM: crc32=%08X, name=%s\nCurrent ROM: crc32=%08X\n\nstill want to play the movie?"),
info.ROMCRC32, _tFromMS932(info.ROMName), Memory.ROMCRC32, _tFromMS932(Memory.RawROMName)); info.ROMCRC32, _tFromMS932(info.ROMName), Memory.ROMCRC32);
int sel = MessageBox(GUI.hWnd, temp, SNES9X_INFO, MB_ABORTRETRYIGNORE|MB_ICONQUESTION); int sel = MessageBox(GUI.hWnd, temp, SNES9X_INFO, MB_ABORTRETRYIGNORE|MB_ICONQUESTION);
switch (sel) { switch (sel) {
case IDABORT: case IDABORT:
@ -2137,18 +2137,18 @@ LRESULT CALLBACK WinProc(
S9xMessage(S9X_INFO, 0, INFO_SAVE_SPC); S9xMessage(S9X_INFO, 0, INFO_SAVE_SPC);
break; break;
case ID_FILE_SAVE_SRAM_DATA: { case ID_FILE_SAVE_SRAM_DATA: {
bool8 success = Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); bool8 success = Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR).c_str());
if(!success) if(!success)
S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_INFO, SRM_SAVE_FAILED); S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_INFO, SRM_SAVE_FAILED);
} break; } break;
case ID_SAVEMEMPACK: { case ID_SAVEMEMPACK: {
const char *filename = S9xGetFilenameInc(".bs", SRAM_DIR); std::string filename = S9xGetFilenameInc(".bs", SRAM_DIR);
bool8 success = Memory.SaveMPAK(filename); bool8 success = Memory.SaveMPAK(filename.c_str());
if (!success) if (!success)
S9xMessage(S9X_ERROR, 0, MPAK_SAVE_FAILED); S9xMessage(S9X_ERROR, 0, MPAK_SAVE_FAILED);
else else
{ {
sprintf(String, "Saved Memory Pack %s", filename); sprintf(String, "Saved Memory Pack %s", filename.c_str());
S9xMessage(S9X_INFO, 0, String); S9xMessage(S9X_INFO, 0, String);
} }
} break; } break;
@ -2229,8 +2229,8 @@ LRESULT CALLBACK WinProc(
S9xCheatsEnable (); S9xCheatsEnable ();
bool on = false; bool on = false;
extern struct SCheatData Cheat; extern struct SCheatData Cheat;
for (uint32 i = 0; i < Cheat.g.size() && !on; i++) for (uint32 i = 0; i < Cheat.group.size() && !on; i++)
if (Cheat.g [i].enabled) if (Cheat.group[i].enabled)
on = true; on = true;
S9xMessage (S9X_INFO, S9X_GAME_GENIE_CODE_ERROR, on ? CHEATS_INFO_ENABLED : CHEATS_INFO_ENABLED_NONE); S9xMessage (S9X_INFO, S9X_GAME_GENIE_CODE_ERROR, on ? CHEATS_INFO_ENABLED : CHEATS_INFO_ENABLED_NONE);
} }
@ -2330,7 +2330,7 @@ LRESULT CALLBACK WinProc(
break; break;
case WM_DESTROY: case WM_DESTROY:
Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR)); Memory.SaveSRAM(S9xGetFilename(".srm", SRAM_DIR).c_str());
GUI.hWnd = NULL; GUI.hWnd = NULL;
PostQuitMessage (0); PostQuitMessage (0);
return (0); return (0);
@ -3596,8 +3596,8 @@ loop_exit:
if (!Settings.StopEmulation) if (!Settings.StopEmulation)
{ {
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR).c_str());
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR).c_str());
} }
//if (!VOODOO_MODE && !GUI.FullScreen) //if (!VOODOO_MODE && !GUI.FullScreen)
// GetWindowRect (GUI.hWnd, &GUI.window_size); // GetWindowRect (GUI.hWnd, &GUI.window_size);
@ -3681,7 +3681,7 @@ void GetSlotFilename(int slot, char filename[_MAX_PATH + 1])
strcpy(ext, ".oops"); strcpy(ext, ".oops");
else else
snprintf(ext, _MAX_EXT, ".%03d", slot); snprintf(ext, _MAX_EXT, ".%03d", slot);
strcpy(filename, S9xGetFilename(ext, SNAPSHOT_DIR)); strcpy(filename, S9xGetFilename(ext, SNAPSHOT_DIR).c_str());
} }
void FreezeUnfreezeSlot(int slot, bool8 freeze) void FreezeUnfreezeSlot(int slot, bool8 freeze)
@ -4087,8 +4087,8 @@ static bool LoadROM(const TCHAR *filename, const TCHAR *filename2 /*= NULL*/) {
#endif #endif
if (!Settings.StopEmulation) { if (!Settings.StopEmulation) {
Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM (S9xGetFilename (".srm", SRAM_DIR).c_str());
S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR).c_str());
} }
if(filename2) if(filename2)
@ -4097,12 +4097,12 @@ static bool LoadROM(const TCHAR *filename, const TCHAR *filename2 /*= NULL*/) {
Settings.StopEmulation = !LoadROMPlain(filename); Settings.StopEmulation = !LoadROMPlain(filename);
if (!Settings.StopEmulation) { if (!Settings.StopEmulation) {
bool8 loadedSRAM = Memory.LoadSRAM (S9xGetFilename (".srm", SRAM_DIR)); bool8 loadedSRAM = Memory.LoadSRAM (S9xGetFilename (".srm", SRAM_DIR).c_str());
if(!loadedSRAM) // help migration from earlier Snes9x versions by checking ROM directory for savestates if(!loadedSRAM) // help migration from earlier Snes9x versions by checking ROM directory for savestates
Memory.LoadSRAM (S9xGetFilename (".srm", ROMFILENAME_DIR)); Memory.LoadSRAM (S9xGetFilename (".srm", ROMFILENAME_DIR).c_str());
if(!filename2) // no recent for multi cart if(!filename2) // no recent for multi cart
S9xAddToRecentGames (filename); S9xAddToRecentGames (filename);
CheckDirectoryIsWritable (S9xGetFilename (".---", SNAPSHOT_DIR)); CheckDirectoryIsWritable (S9xGetFilename (".---", SNAPSHOT_DIR).c_str());
#ifdef NETPLAY_SUPPORT #ifdef NETPLAY_SUPPORT
if (NPServer.SendROMImageOnConnect) if (NPServer.SendROMImageOnConnect)
@ -4335,7 +4335,7 @@ void S9xSetRecentGames ()
// append the game title to name, with formatting modifications as necessary // append the game title to name, with formatting modifications as necessary
{ {
TCHAR baseName [256]; TCHAR baseName [256];
lstrcpy (baseName, _tFromChar(S9xBasename (_tToChar(GUI.RecentGames [i])))); lstrcpy (baseName, _tFromChar(S9xBasename (std::string(_tToChar(GUI.RecentGames [i]))).c_str()));
int pos = lstrlen (name), baseNameLen = lstrlen (baseName); int pos = lstrlen (name), baseNameLen = lstrlen (baseName);
for (int j = 0; j < baseNameLen ; j++) for (int j = 0; j < baseNameLen ; j++)
{ {
@ -4771,7 +4771,7 @@ INT_PTR CALLBACK DlgInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
char temp[100]; char temp[100];
char romtext[4096]; char romtext[4096];
sprintf(romtext, "File: %s\r\nName: %s\r\n", Memory.ROMFilename, Memory.RawROMName); sprintf(romtext, "File: %s\r\n", Memory.ROMFilename);
sprintf(temp, "Speed: %02X/%s\r\nROM Map: %s\r\nType: %02x\r\n", Memory.ROMSpeed, ((Memory.ROMSpeed&0x10)!=0)?"FastROM":"SlowROM",(Memory.HiROM)?"HiROM":"LoROM",Memory.ROMType); sprintf(temp, "Speed: %02X/%s\r\nROM Map: %s\r\nType: %02x\r\n", Memory.ROMSpeed, ((Memory.ROMSpeed&0x10)!=0)?"FastROM":"SlowROM",(Memory.HiROM)?"HiROM":"LoROM",Memory.ROMType);
strcat(romtext, temp); strcat(romtext, temp);
strcat(romtext, "Kart contents: "); strcat(romtext, "Kart contents: ");
@ -6453,7 +6453,7 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
memset(&lvfi, 0, sizeof(LVFINDINFO)); memset(&lvfi, 0, sizeof(LVFINDINFO));
TCHAR filename[_MAX_PATH]; TCHAR filename[_MAX_PATH];
TCHAR *tmp, *tmp2; TCHAR *tmp, *tmp2;
lstrcpy(filename,_tFromChar(Memory.ROMFilename)); lstrcpy(filename,_tFromChar(Memory.ROMFilename.c_str()));
tmp = filename; tmp = filename;
while(tmp2=_tcsstr(tmp, TEXT("\\"))) while(tmp2=_tcsstr(tmp, TEXT("\\")))
tmp=tmp2+sizeof(TCHAR); tmp=tmp2+sizeof(TCHAR);
@ -7759,7 +7759,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
GUI.filterMessagFont = (bool)(IsDlgButtonChecked(hDlg, IDC_MESSAGES_SCALE) == BST_CHECKED); GUI.filterMessagFont = (bool)(IsDlgButtonChecked(hDlg, IDC_MESSAGES_SCALE) == BST_CHECKED);
if(Settings.AutoDisplayMessages) if(Settings.AutoDisplayMessages)
{ {
if(!GFX.InfoString || !*GFX.InfoString){ if(GFX.InfoString.empty()) {
GFX.InfoString = "Test message!"; GFX.InfoString = "Test message!";
GFX.InfoStringTimeout = 1; GFX.InfoStringTimeout = 1;
} }
@ -8796,15 +8796,14 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ListView_InsertColumn(GetDlgItem(hDlg,IDC_CHEAT_LIST), 1, &col); ListView_InsertColumn(GetDlgItem(hDlg,IDC_CHEAT_LIST), 1, &col);
ct.state.resize(Cheat.g.size()); ct.state.resize(Cheat.group.size());
for(uint32 counter =0; counter < Cheat.g.size(); counter++) for(uint32 counter =0; counter < Cheat.group.size(); counter++)
{ {
char *code_string; std::string code_string;
int curr_idx = -1; int curr_idx = -1;
code_string = S9xCheatGroupToText(counter); code_string = S9xCheatGroupToText(counter);
Utf8ToWide wstring(code_string); Utf8ToWide wstring(code_string.c_str());
delete[] code_string;
LVITEM lvi; LVITEM lvi;
memset(&lvi, 0, sizeof(LVITEM)); memset(&lvi, 0, sizeof(LVITEM));
@ -8817,7 +8816,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ct.state[counter] = Untouched; ct.state[counter] = Untouched;
Utf8ToWide wstring_name(Cheat.g[counter].name); Utf8ToWide wstring_name(Cheat.group[counter].name.c_str());
memset(&lvi, 0, sizeof(LVITEM)); memset(&lvi, 0, sizeof(LVITEM));
lvi.iItem = curr_idx; lvi.iItem = curr_idx;
lvi.iSubItem = 1; lvi.iSubItem = 1;
@ -8826,7 +8825,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
lvi.pszText = wstring_name; lvi.pszText = wstring_name;
SendDlgItemMessage(hDlg,IDC_CHEAT_LIST, LVM_SETITEM, 0, (LPARAM)&lvi); SendDlgItemMessage(hDlg,IDC_CHEAT_LIST, LVM_SETITEM, 0, (LPARAM)&lvi);
ListView_SetCheckState(GetDlgItem(hDlg,IDC_CHEAT_LIST), curr_idx, Cheat.g[counter].enabled); ListView_SetCheckState(GetDlgItem(hDlg,IDC_CHEAT_LIST), curr_idx, Cheat.group[counter].enabled);
} }
return true; return true;
@ -8910,12 +8909,11 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, temp, CHEAT_SIZE); GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, temp, CHEAT_SIZE);
GetDlgItemText(hDlg, IDC_CHEAT_DESCRIPTION, tempDesc, CHEAT_SIZE); GetDlgItemText(hDlg, IDC_CHEAT_DESCRIPTION, tempDesc, CHEAT_SIZE);
char *valid_cheat = S9xCheatValidate (temp); std::string valid_cheat = S9xCheatValidate(temp);
if(valid_cheat) if(!valid_cheat.empty())
{ {
Utf8ToWide wstring(valid_cheat); Utf8ToWide wstring(valid_cheat.c_str());
delete[] valid_cheat;
int curr_idx = -1; int curr_idx = -1;
@ -8951,12 +8949,10 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
char code[CHEAT_SIZE]; char code[CHEAT_SIZE];
GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, code, CHEAT_SIZE); GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, code, CHEAT_SIZE);
char *valid_cheat = S9xCheatValidate(code); std::string valid_cheat = S9xCheatValidate(code);
if(valid_cheat) if(!valid_cheat.empty())
{ {
delete[] valid_cheat;
Utf8ToWide wstring(code); Utf8ToWide wstring(code);
LVITEM lvi; LVITEM lvi;
@ -9021,7 +9017,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
} }
ListView_DeleteAllItems(GetDlgItem(hDlg, IDC_CHEAT_LIST)); ListView_DeleteAllItems(GetDlgItem(hDlg, IDC_CHEAT_LIST));
for (unsigned int j = 0; j < Cheat.g.size(); j++) for (unsigned int j = 0; j < Cheat.group.size(); j++)
{ {
ct.state[j] = Deleted; ct.state[j] = Deleted;
} }
@ -9062,7 +9058,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
char *valid_cheat = NULL; char *valid_cheat = NULL;
GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, temp, CHEAT_SIZE); GetDlgItemTextA(hDlg, IDC_CHEAT_CODE, temp, CHEAT_SIZE);
if (temp && temp[0] && (valid_cheat = S9xCheatValidate(temp))) if (temp && temp[0] && (!S9xCheatValidate(temp).empty()))
{ {
if (has_sel) if (has_sel)
EnableWindow(GetDlgItem(hDlg, IDC_UPDATE_CHEAT), true); EnableWindow(GetDlgItem(hDlg, IDC_UPDATE_CHEAT), true);
@ -9122,7 +9118,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
WideToUtf8 code(wcode); WideToUtf8 code(wcode);
WideToUtf8 description(wdescription); WideToUtf8 description(wdescription);
S9xModifyCheatGroup(internal_index, description, code); S9xModifyCheatGroup(internal_index, std::string(description), std::string(code));
} }
// set core state according to checkbox // set core state according to checkbox
@ -9155,7 +9151,7 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
WideToUtf8 code(wcode); WideToUtf8 code(wcode);
WideToUtf8 description(wdescription); WideToUtf8 description(wdescription);
int index = S9xAddCheatGroup(description, code); int index = S9xAddCheatGroup(std::string(description), std::string(code));
if (index >= 0) if (index >= 0)
if (ListView_GetCheckState(GetDlgItem(hDlg, IDC_CHEAT_LIST), k)) if (ListView_GetCheckState(GetDlgItem(hDlg, IDC_CHEAT_LIST), k))
@ -10572,7 +10568,7 @@ INT_PTR CALLBACK DlgOpenMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
TCHAR dir [_MAX_DIR + 1]; TCHAR dir [_MAX_DIR + 1];
TCHAR fname [_MAX_FNAME + 1]; TCHAR fname [_MAX_FNAME + 1];
TCHAR ext [_MAX_EXT + 1]; TCHAR ext [_MAX_EXT + 1];
_tsplitpath (_tFromChar(Memory.ROMFilename), drive, dir, fname, ext); _tsplitpath (_tFromChar(Memory.ROMFilename.c_str()), drive, dir, fname, ext);
_tmakepath (filename, TEXT(""), TEXT(""), fname, TEXT("smv")); _tmakepath (filename, TEXT(""), TEXT(""), fname, TEXT("smv"));
SetWindowText(GetDlgItem(hDlg, IDC_MOVIE_PATH), filename); SetWindowText(GetDlgItem(hDlg, IDC_MOVIE_PATH), filename);
set_movieinfo(filename, hDlg); set_movieinfo(filename, hDlg);
@ -10669,7 +10665,7 @@ INT_PTR CALLBACK DlgOpenMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
// checks if the currently loaded ROM has an SRAM file in the saves directory that we have write access to // checks if the currently loaded ROM has an SRAM file in the saves directory that we have write access to
static bool existsSRAM () static bool existsSRAM ()
{ {
return(!access(S9xGetFilename(".srm", SRAM_DIR), R_OK|W_OK)); return(!access(S9xGetFilename(".srm", SRAM_DIR).c_str(), R_OK | W_OK));
} }
INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@ -10689,7 +10685,7 @@ INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
// have to save here or the SRAM file might not exist when we check for it // have to save here or the SRAM file might not exist when we check for it
// (which would cause clear SRAM option to not work) // (which would cause clear SRAM option to not work)
Memory.SaveSRAM(S9xGetFilename (".srm", SRAM_DIR)); Memory.SaveSRAM(S9xGetFilename (".srm", SRAM_DIR).c_str());
op=(OpenMovieParams*)lParam; op=(OpenMovieParams*)lParam;
@ -10711,7 +10707,7 @@ INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
TCHAR dir [_MAX_DIR + 1]; TCHAR dir [_MAX_DIR + 1];
TCHAR fname [_MAX_FNAME + 1]; TCHAR fname [_MAX_FNAME + 1];
TCHAR ext [_MAX_EXT + 1]; TCHAR ext [_MAX_EXT + 1];
_tsplitpath (_tFromChar(Memory.ROMFilename), drive, dir, fname, ext); _tsplitpath (_tFromChar(Memory.ROMFilename.c_str()), drive, dir, fname, ext);
_tmakepath (filename, TEXT(""), TEXT(""), fname, TEXT("smv")); _tmakepath (filename, TEXT(""), TEXT(""), fname, TEXT("smv"));
SetWindowText(GetDlgItem(hDlg, IDC_MOVIE_PATH), filename); SetWindowText(GetDlgItem(hDlg, IDC_MOVIE_PATH), filename);
} }
@ -10799,9 +10795,9 @@ INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
if(IsDlgButtonChecked(hDlg, IDC_CLEARSRAM) && IsDlgButtonChecked(hDlg, IDC_RECORD_RESET) && existsSRAM()) if(IsDlgButtonChecked(hDlg, IDC_CLEARSRAM) && IsDlgButtonChecked(hDlg, IDC_RECORD_RESET) && existsSRAM())
{ {
GUI.MovieClearSRAM = TRUE; GUI.MovieClearSRAM = TRUE;
remove(S9xGetFilename (".srm", SRAM_DIR)); // delete SRAM if it exists (maybe unnecessary?) remove(S9xGetFilename (".srm", SRAM_DIR).c_str()); // delete SRAM if it exists (maybe unnecessary?)
remove(S9xGetFilename (".srm", ROMFILENAME_DIR)); remove(S9xGetFilename (".srm", ROMFILENAME_DIR).c_str());
Memory.LoadSRAM(S9xGetFilename (".srm", SRAM_DIR)); // refresh memory (hard reset) Memory.LoadSRAM(S9xGetFilename (".srm", SRAM_DIR).c_str()); // refresh memory (hard reset)
} }
else if(!IsDlgButtonChecked(hDlg, IDC_CLEARSRAM) && IsDlgButtonChecked(hDlg, IDC_RECORD_RESET) && existsSRAM()) else if(!IsDlgButtonChecked(hDlg, IDC_CLEARSRAM) && IsDlgButtonChecked(hDlg, IDC_RECORD_RESET) && existsSRAM())
{ {
@ -10955,9 +10951,9 @@ void S9xPostRomInit()
{ {
S9xCheatsEnable(); S9xCheatsEnable();
extern struct SCheatData Cheat; extern struct SCheatData Cheat;
for (uint32 i = 0; i < Cheat.g.size(); i++) for (uint32 i = 0; i < Cheat.group.size(); i++)
{ {
if (Cheat.g [i].enabled) if (Cheat.group[i].enabled)
{ {
char String2 [1024]; char String2 [1024];
sprintf(String2, "(CHEATS ARE ON!) %s", String); sprintf(String2, "(CHEATS ARE ON!) %s", String);