From b7bf0b38cca2551566a73f948ccbd6d004b97574 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 18 Jun 2015 03:09:08 +0000 Subject: [PATCH] bsnes - vs2015 can now be used to build --- libsnes/vs2015/libsnes.sln | 18 +- libsnes/vs2015/libsnes.vcxproj | 235 ++++++++++++--- libsnes/vs2015/libsnes.vcxproj.filters | 12 + libsnes/vs2015/vs2015-support.patch | 402 ------------------------- 4 files changed, 216 insertions(+), 451 deletions(-) delete mode 100644 libsnes/vs2015/vs2015-support.patch diff --git a/libsnes/vs2015/libsnes.sln b/libsnes/vs2015/libsnes.sln index 177357d4c6..cdb4be35b3 100644 --- a/libsnes/vs2015/libsnes.sln +++ b/libsnes/vs2015/libsnes.sln @@ -7,14 +7,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsnes", "libsnes.vcxproj" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 + Debug-Compatibility|x86 = Debug-Compatibility|x86 + Debug-Performance|x86 = Debug-Performance|x86 + Release-Compatibility|x86 = Release-Compatibility|x86 + Release-Performance|x86 = Release-Performance|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {488B77AD-58DF-4E01-9329-67B20D486860}.Debug|x86.ActiveCfg = Debug|Win32 - {488B77AD-58DF-4E01-9329-67B20D486860}.Debug|x86.Build.0 = Debug|Win32 - {488B77AD-58DF-4E01-9329-67B20D486860}.Release|x86.ActiveCfg = Release|Win32 - {488B77AD-58DF-4E01-9329-67B20D486860}.Release|x86.Build.0 = Release|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Debug-Compatibility|x86.ActiveCfg = Debug-Compatibility|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Debug-Compatibility|x86.Build.0 = Debug-Compatibility|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Debug-Performance|x86.ActiveCfg = Debug-Performance|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Debug-Performance|x86.Build.0 = Debug-Performance|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Release-Compatibility|x86.ActiveCfg = Release-Compatibility|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Release-Compatibility|x86.Build.0 = Release-Compatibility|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Release-Performance|x86.ActiveCfg = Release-Performance|Win32 + {488B77AD-58DF-4E01-9329-67B20D486860}.Release-Performance|x86.Build.0 = Release-Performance|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libsnes/vs2015/libsnes.vcxproj b/libsnes/vs2015/libsnes.vcxproj index d67898902c..a87cff74d2 100644 --- a/libsnes/vs2015/libsnes.vcxproj +++ b/libsnes/vs2015/libsnes.vcxproj @@ -1,12 +1,20 @@  - - Debug + + Debug-Compatibility Win32 - - Release + + Debug-Performance + Win32 + + + Release-Compatibility + Win32 + + + Release-Performance Win32 @@ -16,57 +24,141 @@ 8.1 - - DynamicLibrary + + Application true - v140 + v140_xp NotSet - + + Application + true + v140_xp + NotSet + + Application false - v140 + v140_xp true - MultiByte + NotSet + + + Application + false + v140_xp + true + NotSet - + - + + + + + + + - - + + ..\..\output\dll + libsneshawk-32-performance + .obj\$(Configuration)\ + + + ..\..\output\dll + libsneshawk-32-compatibility + .obj\$(Configuration)\ + + + libsneshawk-32-compatibility + ..\..\output\dll + .obj\$(Configuration)\ + + + libsneshawk-32-performance + ..\..\output\dll + .obj\$(Configuration)\ + + Level3 Disabled false $(ProjectDir)../bsnes - HOOKS;PROFILE_PERFORMANCE;GAMEBOY;_MBCS;%(PreprocessorDefinitions) + HOOKS;BIZHAWK;PROFILE_PERFORMANCE;GAMEBOY;%(PreprocessorDefinitions) true + false true + Windows - + Level3 - MaxSpeed - true + Disabled + false + $(ProjectDir)../bsnes + HOOKS;BIZHAWK;PROFILE_COMPATIBILITY;GAMEBOY;%(PreprocessorDefinitions) + true + false + + + true + Windows + + + + + Level3 + Full + false true - true + false + true + $(ProjectDir)../bsnes + HOOKS;BIZHAWK;PROFILE_PERFORMANCE;GAMEBOY;%(PreprocessorDefinitions) + None + AnySuitable + Speed + true + StreamingSIMDExtensions + Fast true true true + Windows + + + + + Level3 + MaxSpeed + true + true + false + true + $(ProjectDir)../bsnes + HOOKS;BIZHAWK;PROFILE_COMPATIBILITY;GAMEBOY;%(PreprocessorDefinitions) + None + + + true + true + true + Windows @@ -91,10 +183,23 @@ - + + true + true + - - + + true + true + + + true + true + + + true + true + @@ -116,18 +221,31 @@ - true + true + false + true + false - true + true + true + true + true - true + true + true + true + true + - true + true + false + true + false @@ -137,25 +255,56 @@ - - + + + + + + + + + + + + + + + (); + foreach( var item in ItemList ) + { + var filename = item.GetMetadata("Filename"); + + //assign reused filenames to increasing numbers + //assign previously unused filenames to 0 + int assignment = 0; + if(assignmentMap.TryGetValue(filename, out assignment)) + assignmentMap[filename] = ++assignment; + else + assignmentMap[filename] = 0; + + var thisFileOutdir = Path.Combine(OutputDir,assignment.ToString()) + "/"; //take care it ends in / so /Fo knows it's a directory and not a filename + item.SetMetadata( "ObjectFileName", thisFileOutdir ); + } + + OutputItemList = ItemList; + ItemList = new Microsoft.Build.Framework.ITaskItem[0]; + + ]]> + + - - - - - - - - + - - - $(IntDir)$([System.Text.RegularExpressions.Regex]::Replace('%(Identity)','[^A-Za-z0-9\\]','').Replace("\","_") ).obj - + + - - + + + - + \ No newline at end of file diff --git a/libsnes/vs2015/libsnes.vcxproj.filters b/libsnes/vs2015/libsnes.vcxproj.filters index 67087b6313..6e53abe88f 100644 --- a/libsnes/vs2015/libsnes.vcxproj.filters +++ b/libsnes/vs2015/libsnes.vcxproj.filters @@ -145,6 +145,12 @@ {be676f5c-dcb3-4a39-911c-4e102dfa25d8} + + {ebb8bc23-969e-4273-bada-413a29d6af3e} + + + {f06ef20e-c749-4f16-81d3-f88d96b659bc} + @@ -308,5 +314,11 @@ snes\cpu\core + + snes\alt\ppu-compatibility + + + snes\smp\core + \ No newline at end of file diff --git a/libsnes/vs2015/vs2015-support.patch b/libsnes/vs2015/vs2015-support.patch deleted file mode 100644 index 4b760d6859..0000000000 --- a/libsnes/vs2015/vs2015-support.patch +++ /dev/null @@ -1,402 +0,0 @@ -Index: gameboy/system/system.hpp -=================================================================== ---- gameboy/system/system.hpp (revision 9394) -+++ gameboy/system/system.hpp (working copy) -@@ -11,9 +11,9 @@ - GameBoyColor, - }; - readonly revision; -- inline bool dmg() const { return revision == Revision::GameBoy; } -- inline bool sgb() const { return revision == Revision::SuperGameBoy; } -- inline bool cgb() const { return revision == Revision::GameBoyColor; } -+ inline bool dmg() const { return (Revision)revision == Revision::GameBoy; } -+ inline bool sgb() const { return (Revision)revision == Revision::SuperGameBoy; } -+ inline bool cgb() const { return (Revision)revision == Revision::GameBoyColor; } - - struct BootROM { - static const uint8 dmg[ 256]; -Index: nall/bit.hpp -=================================================================== ---- nall/bit.hpp (revision 9394) -+++ nall/bit.hpp (working copy) -@@ -10,20 +10,24 @@ - - template - constexpr inline uintmax_t uclip(const uintmax_t x) { -- enum : uintmax_t { b = 1ull << (bits - 1), m = b * 2 - 1 }; -- return (x & m); -+ //enum : uintmax_t { b = 1ull << (bits - 1), m = b * 2 - 1 }; //test -+ //return (x & m); //test -+ return (x & ((uintmax_t)(((uintmax_t)(1ull << (bits - 1))) * 2 - 1))); - } - - template - constexpr inline intmax_t sclamp(const intmax_t x) { -- enum : intmax_t { b = 1ull << (bits - 1), m = b - 1 }; -- return (x > m) ? m : (x < -b) ? -b : x; -+ //enum : intmax_t { b = 1ull << (bits - 1), m = b - 1 }; //test -+ //(intmax_t)(1ull << (bits - 1)) //b -+ //(((intmax_t)(1ull << (bits - 1))) - 1) //m -+ //return (x > m) ? m : (x < -b) ? -b : x; //test -+ return (x > (((intmax_t)(1ull << (bits - 1))) - 1)) ? (((intmax_t)(1ull << (bits - 1))) - 1) : (x < -((intmax_t)(1ull << (bits - 1)))) ? -((intmax_t)(1ull << (bits - 1))) : x; //test - } - - template - constexpr inline intmax_t sclip(const intmax_t x) { -- enum : uintmax_t { b = 1ull << (bits - 1), m = b * 2 - 1 }; -- return ((x & m) ^ b) - b; -+ //enum : uintmax_t { b = 1ull << (bits - 1), m = b * 2 - 1 }; //test -+ return ((x & ((uintmax_t)(((uintmax_t)(1ull << (bits - 1))) * 2 - 1))) ^ ((uintmax_t)(1ull << (bits - 1)))) - ((uintmax_t)(1ull << (bits - 1))); - } - - namespace bit { -Index: nall/dsp/resample/average.hpp -=================================================================== ---- nall/dsp/resample/average.hpp (revision 9394) -+++ nall/dsp/resample/average.hpp (working copy) -@@ -50,7 +50,8 @@ - - void ResampleAverage::sampleLinear() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //test -+ real channel[2]; - - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -1); -Index: nall/dsp/resample/cosine.hpp -=================================================================== ---- nall/dsp/resample/cosine.hpp (revision 9394) -+++ nall/dsp/resample/cosine.hpp (working copy) -@@ -21,8 +21,10 @@ - - void ResampleCosine::sample() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //test -+ real channel[2]; - -+ - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -1); - real b = dsp.buffer.read(n, -0); -Index: nall/dsp/resample/cubic.hpp -=================================================================== ---- nall/dsp/resample/cubic.hpp (revision 9394) -+++ nall/dsp/resample/cubic.hpp (working copy) -@@ -21,7 +21,8 @@ - - void ResampleCubic::sample() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //test -+ real channel[2]; //test - - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -3); -Index: nall/dsp/resample/hermite.hpp -=================================================================== ---- nall/dsp/resample/hermite.hpp (revision 9394) -+++ nall/dsp/resample/hermite.hpp (working copy) -@@ -21,7 +21,8 @@ - - void ResampleHermite::sample() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //test -+ real channel[2]; - - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -3); -Index: nall/dsp/resample/lib/sinc.hpp -=================================================================== ---- nall/dsp/resample/lib/sinc.hpp (revision 9394) -+++ nall/dsp/resample/lib/sinc.hpp (working copy) -@@ -4,6 +4,8 @@ - typedef float resample_coeff_t; // note: sizeof(resample_coeff_t) must be == to a power of 2, and not larger than 16 - typedef float resample_samp_t; - -+#include -+#include - - // ...but don't comment this single RESAMPLE_SSEREGPARM define out when disabling SSE. - #define RESAMPLE_SSEREGPARM -Index: nall/dsp/resample/linear.hpp -=================================================================== ---- nall/dsp/resample/linear.hpp (revision 9394) -+++ nall/dsp/resample/linear.hpp (working copy) -@@ -21,7 +21,8 @@ - - void ResampleLinear::sample() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //TEST -+ real channel[2]; - - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -1); -Index: nall/dsp/resample/nearest.hpp -=================================================================== ---- nall/dsp/resample/nearest.hpp (revision 9394) -+++ nall/dsp/resample/nearest.hpp (working copy) -@@ -21,7 +21,8 @@ - - void ResampleNearest::sample() { - while(fraction <= 1.0) { -- real channel[dsp.settings.channels]; -+ //real channel[dsp.settings.channels]; //test -+ real channel[2]; - - for(unsigned n = 0; n < dsp.settings.channels; n++) { - real a = dsp.buffer.read(n, -1); -Index: nall/file.hpp -=================================================================== ---- nall/file.hpp (revision 9394) -+++ nall/file.hpp (working copy) -@@ -176,7 +176,8 @@ - struct __stat64 data; - _wstat64(utf16_t(filename), &data); - #endif -- return S_ISREG(data.st_mode) ? data.st_size : 0u; -+ //return S_ISREG(data.st_mode) ? data.st_size : 0u; //TEST -+ return data.st_size; - } - - static time_t timestamp(const string &filename, file::time mode = file::time::create) { -Index: nall/platform.hpp -=================================================================== ---- nall/platform.hpp (revision 9394) -+++ nall/platform.hpp (working copy) -@@ -8,6 +8,10 @@ - #include - #endif - -+#ifdef _MSC_VER -+#define _USE_MATH_DEFINES 1 -+#endif -+ - //========================= - //standard platform headers - //========================= -@@ -29,10 +33,13 @@ - #if defined(_WIN32) - #include - #include -- #include -+ //#include //bizhawk chokes? - #include - #undef interface - #define dllexport __declspec(dllexport) -+ //bad things happen without these here -+ #include -+ #include - #else - #include - #include -@@ -100,23 +107,27 @@ - } - - inline char* userpath(char *path) { -- wchar_t fp[_MAX_PATH] = L""; -- SHGetFolderPathW(0, CSIDL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, fp); -- strcpy(path, nall::utf8_t(fp)); -- for(unsigned n = 0; path[n]; n++) if(path[n] == '\\') path[n] = '/'; -- unsigned length = strlen(path); -- if(path[length] != '/') strcpy(path + length, "/"); -- return path; -+ //TODO BIZHAWK -+ return nullptr; -+ //wchar_t fp[_MAX_PATH] = L""; -+ //SHGetFolderPathW(0, CSIDL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, fp); -+ //strcpy(path, nall::utf8_t(fp)); -+ //for(unsigned n = 0; path[n]; n++) if(path[n] == '\\') path[n] = '/'; -+ //unsigned length = strlen(path); -+ //if(path[length] != '/') strcpy(path + length, "/"); -+ //return path; - } - - inline char* getcwd(char *path) { -- wchar_t fp[_MAX_PATH] = L""; -- _wgetcwd(fp, _MAX_PATH); -- strcpy(path, nall::utf8_t(fp)); -- for(unsigned n = 0; path[n]; n++) if(path[n] == '\\') path[n] = '/'; -- unsigned length = strlen(path); -- if(path[length] != '/') strcpy(path + length, "/"); -- return path; -+ //TODO BIZHAWK -+ return nullptr; -+ //wchar_t fp[_MAX_PATH] = L""; -+ //_wgetcwd(fp, _MAX_PATH); -+ //strcpy(path, nall::utf8_t(fp)); -+ //for(unsigned n = 0; path[n]; n++) if(path[n] == '\\') path[n] = '/'; -+ //unsigned length = strlen(path); -+ //if(path[length] != '/') strcpy(path + length, "/"); -+ //return path; - } - #else - //realpath() already exists -Index: nall/property.hpp -=================================================================== ---- nall/property.hpp (revision 9394) -+++ nall/property.hpp (working copy) -@@ -56,17 +56,17 @@ - const T* operator->() const { return &value; } - const T& operator()() const { return value; } - operator const T&() const { return value; } -- private: -+ //private: - T* operator->() { return &value; } - operator T&() { return value; } - const T& operator=(const T& value_) { return value = value_; } - T value; -- friend class traits::type; -+ //friend class traits::type; - }; - - template struct writeonly { - void operator=(const T& value_) { value = value_; } -- private: -+ //private: - const T* operator->() const { return &value; } - const T& operator()() const { return value; } - operator const T&() const { return value; } -@@ -73,7 +73,7 @@ - T* operator->() { return &value; } - operator T&() { return value; } - T value; -- friend class traits::type; -+ //friend class traits::type; - }; - - template struct readwrite { -Index: nall/string/utility.hpp -=================================================================== ---- nall/string/utility.hpp (revision 9394) -+++ nall/string/utility.hpp (working copy) -@@ -1,5 +1,7 @@ - #ifdef NALL_STRING_INTERNAL_HPP - -+#include -+ - namespace nall { - - template -@@ -164,7 +166,7 @@ - buffer[size] = 0; - - unsigned length = (length_ == 0 ? size : length_); -- char result[length + 1]; -+ char* result = (char*)alloca(length + 1); - memset(result, padding, length); - result[length] = 0; - -@@ -209,7 +211,7 @@ - } while(value); - - unsigned length = (length_ == 0 ? size : length_); -- char result[length + 1]; -+ char *result = (char*)alloca(length + 1); - memset(result, padding, length); - result[length] = 0; - -Index: snes/cartridge/markup.cpp -=================================================================== ---- snes/cartridge/markup.cpp (revision 9394) -+++ snes/cartridge/markup.cpp (working copy) -@@ -108,7 +108,7 @@ - void Cartridge::parse_markup_icd2(XML::Node &root) { - #if defined(GAMEBOY) - if(root.exists() == false) return; -- if(mode != Mode::SuperGameBoy) return; -+ if(mode.value != Mode::SuperGameBoy) return; - - icd2.revision = max(1, numeral(root["revision"].data)); - -@@ -241,7 +241,8 @@ - if(!sha256.empty()) { - //XML file specified SHA256 sum for program. Verify file matches the hash. - fp.seek(0); -- uint8_t data[filesize]; -+ //uint8_t data[filesize]; //test -+ uint8_t *data = (uint8_t*)alloca(filesize); - fp.read(data, filesize); - - if(sha256 != nall::sha256(data, filesize)) { -@@ -367,7 +368,7 @@ - - void Cartridge::parse_markup_bsx(XML::Node &root) { - if(root.exists() == false) return; -- if(mode != Mode::BsxSlotted && mode != Mode::Bsx) return; -+ if(mode.value != Mode::BsxSlotted && mode.value != Mode::Bsx) return; - has_bsx_slot = true; - - for(auto &node : root["slot"]) { -@@ -394,7 +395,7 @@ - - void Cartridge::parse_markup_sufamiturbo(XML::Node &root) { - if(root.exists() == false) return; -- if(mode != Mode::SufamiTurbo) return; -+ if(mode.value != Mode::SufamiTurbo) return; - - for(auto &slot : root) { - if(slot.name != "slot") continue; -Index: snes/chip/armdsp/registers.hpp -=================================================================== ---- snes/chip/armdsp/registers.hpp (revision 9394) -+++ snes/chip/armdsp/registers.hpp (working copy) -@@ -93,6 +93,7 @@ - Register& operator=(uint32 n) { - data = n; - if(write) write(); -+ return *this; //test - what? - } - - Register& operator+=(uint32 n) { return operator=(data + n); } -Index: snes/chip/icd2/interface/interface.cpp -=================================================================== ---- snes/chip/icd2/interface/interface.cpp (revision 9394) -+++ snes/chip/icd2/interface/interface.cpp (working copy) -@@ -112,7 +112,7 @@ - return 0; - } - --void* ICD2::allocSharedMemory(const char* memtype, size_t amt, int initialByte) { SNES::interface()->allocSharedMemory(memtype, amt, initialByte); } -+void* ICD2::allocSharedMemory(const char* memtype, size_t amt, int initialByte) { return SNES::interface()->allocSharedMemory(memtype, amt, initialByte); } - void ICD2::freeSharedMemory(void* ptr) { SNES::interface()->freeSharedMemory(ptr); } - - #endif -Index: snes/system/system.cpp -=================================================================== ---- snes/system/system.cpp (revision 9394) -+++ snes/system/system.cpp (working copy) -@@ -155,7 +155,7 @@ - - region = config.region; - expansion = config.expansion_port; -- if(region == Region::Autodetect) { -+ if(region.value == Region::Autodetect) { - region = (cartridge.region() == Cartridge::Region::NTSC ? Region::NTSC : Region::PAL); - } - -Index: target-libsnes/libsnes_pwrap.cpp -=================================================================== ---- target-libsnes/libsnes_pwrap.cpp (revision 9394) -+++ target-libsnes/libsnes_pwrap.cpp (working copy) -@@ -854,6 +854,7 @@ - case eMessage_QUERY_peek_cpu_regs: - { - //watch it! the size of this struct is important! -+ #pragma pack(push,1) - struct { - u32 pc; - u16 a,x,y,z,s,d,vector; //7x -@@ -860,7 +861,8 @@ - u8 p, nothing; - u32 aa,rd; - u8 sp, dp, db, mdr; -- } __attribute__((__packed__)) cpuregs; -+ } cpuregs; -+ #pragma pack(pop) - - cpuregs.pc = (u32)SNES::cpu.regs.pc; - cpuregs.a = SNES::cpu.regs.a;