From a06b7318c0f941eb099a99ce7a8606a584c42b79 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 10 Jun 2015 02:43:06 +0000 Subject: [PATCH] add vcxproj and patch for libsnes vs2015 support, for later use --- libsnes/vs2015/libsnes.sln | 22 ++ libsnes/vs2015/libsnes.vcxproj | 161 ++++++++++ libsnes/vs2015/libsnes.vcxproj.filters | 312 +++++++++++++++++++ libsnes/vs2015/vs2015-support.patch | 402 +++++++++++++++++++++++++ 4 files changed, 897 insertions(+) create mode 100644 libsnes/vs2015/libsnes.sln create mode 100644 libsnes/vs2015/libsnes.vcxproj create mode 100644 libsnes/vs2015/libsnes.vcxproj.filters create mode 100644 libsnes/vs2015/vs2015-support.patch diff --git a/libsnes/vs2015/libsnes.sln b/libsnes/vs2015/libsnes.sln new file mode 100644 index 0000000000..177357d4c6 --- /dev/null +++ b/libsnes/vs2015/libsnes.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.22823.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsnes", "libsnes.vcxproj", "{488B77AD-58DF-4E01-9329-67B20D486860}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libsnes/vs2015/libsnes.vcxproj b/libsnes/vs2015/libsnes.vcxproj new file mode 100644 index 0000000000..d67898902c --- /dev/null +++ b/libsnes/vs2015/libsnes.vcxproj @@ -0,0 +1,161 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {488B77AD-58DF-4E01-9329-67B20D486860} + libsnes + 8.1 + + + + DynamicLibrary + true + v140 + NotSet + + + Application + false + v140 + true + MultiByte + + + + + + + + + + + + + + + + + Level3 + Disabled + false + $(ProjectDir)../bsnes + HOOKS;PROFILE_PERFORMANCE;GAMEBOY;_MBCS;%(PreprocessorDefinitions) + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + $(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 new file mode 100644 index 0000000000..67087b6313 --- /dev/null +++ b/libsnes/vs2015/libsnes.vcxproj.filters @@ -0,0 +1,312 @@ + + + + + {6321d017-eb1b-4c32-8ad6-2a444cd349f6} + + + {b524d91d-4f81-4c11-a85c-b3b4d12ae8cf} + + + {c08353ee-b185-43d3-bbcf-0b6ec3e90320} + + + {408560e5-f6fb-4bb3-a9d5-d4142a1320f0} + + + {a38518d2-1cce-44e8-a3a5-0f861d87493e} + + + {9f9acb28-fdaa-49d0-90be-c1420ab16873} + + + {289226f8-df84-498f-9ae4-aa56bd12b59c} + + + {55ee4b4b-d81c-44a1-9aaa-acd145d22f7a} + + + {2393d351-a00c-4786-ad11-445f1a1f41b1} + + + {7c6789fc-4c2c-4d46-9f37-f0ca1d3b1040} + + + {7f99b945-63a1-4516-8b55-97e752e836f2} + + + {b2c7c754-bd74-4418-948b-2af3c799d015} + + + {17456ecf-3890-4e53-ab34-0e2522355065} + + + {ba2a4779-7d10-43e6-bfc9-132ea211483c} + + + {118fed9b-6135-4bb5-9e24-eea11c4af00c} + + + {82b154b9-d01b-413a-8f8b-dd12999827dd} + + + {a3e5a31b-5b10-40d1-8805-abd490396997} + + + {72824eb5-fe38-4ef8-908a-58c890560e65} + + + {e219cd9c-1e92-4ab1-bf0a-ce3501000807} + + + {613fc7f9-2c45-429f-b23d-6d49079d7891} + + + {2b5e8fde-1d52-4681-a15c-f06b7926fe82} + + + {b4be7383-80a1-4237-8d43-01e15867afc2} + + + {11dfb660-4987-46c8-8972-7342e656c555} + + + {9dd57f5e-1002-48d7-81d3-529c022996bd} + + + {944e3046-20a8-4271-9974-15718a3aa3cd} + + + {b5eedfaf-3238-4e31-814b-f59d2ad6c617} + + + {bb93bc7a-e90a-4e11-a0c0-84e26dc7f42a} + + + {7887aa9a-01a4-4152-a285-bb4ecaa0b716} + + + {009324b7-7605-4e55-b73d-68131f4a8845} + + + {a9b576a3-938b-4e09-86e7-4cda6e5deba5} + + + {4c4832de-b4f0-488d-980b-a77ebce05527} + + + {fb725aa0-6ff3-4b25-bf45-ae28fc3aed4a} + + + {2a37b3c4-7b36-48e5-b201-25b1e81d8751} + + + {574e46b2-63b2-491a-8ae1-0942b01d6cd2} + + + {b4ec7434-0582-4463-8e08-c3e9eb99d005} + + + {34858db2-a967-43a1-ac48-4de7b5db5a6b} + + + {e7a4951f-47f4-44e1-a1ac-c29484c89c33} + + + {da1501bf-c0ce-4e34-a9b5-80b369db33dc} + + + {adbd7da4-de16-44d3-9ba4-15841768d4fe} + + + {9cabccb5-50ec-491e-b48f-ca8b88a546c8} + + + {f008c454-28d4-40c7-9289-b3f2dd19a762} + + + {434d7eb5-d533-4917-8b38-cca08d569ed5} + + + {a6600a1f-d587-4a88-966e-11f7a2ee2e3e} + + + {000a6753-2b90-45fa-845d-c7b364a37c35} + + + {b8ea9101-3f2f-4631-8bfe-4011bebc8e0e} + + + {1d1cf6c9-9e1b-402c-b1cc-7ed8866092e7} + + + {d2cbafd7-caaf-404c-9fdb-4adaaf5c1687} + + + {be676f5c-dcb3-4a39-911c-4e102dfa25d8} + + + + + base + + + gameboy + + + gameboy\apu + + + gameboy\cheat + + + snes + + + snes + + + snes + + + snes + + + target-libsnes + + + + + gameboy\apu + + + gameboy\cartridge + + + gameboy\cheat + + + gameboy\cpu + + + gameboy\interface + + + gameboy\lcd + + + gameboy\memory + + + gameboy\scheduler + + + gameboy\system + + + gameboy\video + + + snes\alt\dsp + + + snes\alt\cpu + + + snes\alt\ppu-performance + + + snes\alt\smp + + + snes\cartridge + + + snes\cheat + + + snes\chip\armdsp + + + snes\chip\bsx + + + snes\chip\hitachidsp + + + snes\chip\icd2 + + + snes\chip\link + + + snes\chip\msu1 + + + snes\necdsp + + + snes\chip\nss + + + snes\chip\obc1 + + + snes\chip\sa1 + + + snes\chip\sdd1 + + + snes\chip\spc7110 + + + snes\chip\srtc + + + snes\chip\sufamiturbo + + + snes\chip\superfx + + + snes\config + + + snes\controller + + + snes\cpu + + + snes\dsp + + + snes\interface + + + snes\memory + + + snes\ppu + + + snes\smp + + + snes\system + + + target-libsnes + + + target-libsnes + + + libco_msvc_win32 + + + snes\cpu\core + + + \ No newline at end of file diff --git a/libsnes/vs2015/vs2015-support.patch b/libsnes/vs2015/vs2015-support.patch new file mode 100644 index 0000000000..4b760d6859 --- /dev/null +++ b/libsnes/vs2015/vs2015-support.patch @@ -0,0 +1,402 @@ +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;