update bsnes from upstream source
includes some reverts to unnecessary source modifications
This commit is contained in:
parent
1231d44afc
commit
117b35f037
Binary file not shown.
|
@ -266,6 +266,13 @@ auto SuperFamicom::board() const -> string {
|
|||
if(headerAddress == 0x40ffb0) mode = "EXHIROM-";
|
||||
}
|
||||
|
||||
//the Sufami Turbo has the non-descriptive label "ADD-ON BASE CASSETE"
|
||||
//(yes, missing a T), and its serial "A9PJ" is shared with
|
||||
//Bishoujo Senshi Sailor Moon SuperS - Fuwafuwa Panic (Japan)
|
||||
//so we identify it with this embedded string
|
||||
string sufamiSignature = "BANDAI SFC-ADX";
|
||||
if (string_view(data.data(), sufamiSignature.length()) == sufamiSignature) board.append("ST-", mode);
|
||||
|
||||
//this game's title ovewrites the map mode with '!' (0x21), but is a LOROM game
|
||||
if(title() == "YUYU NO QUIZ DE GO!GO") mode = "LOROM-";
|
||||
|
||||
|
@ -274,10 +281,7 @@ auto SuperFamicom::board() const -> string {
|
|||
bool epsonRTC = false;
|
||||
bool sharpRTC = false;
|
||||
|
||||
if(serial() == "A9PJ") {
|
||||
//Sufami Turbo (JPN)
|
||||
board.append("ST-", mode);
|
||||
} else if(serial() == "ZBSJ") {
|
||||
if(serial() == "ZBSJ") {
|
||||
//BS-X: Sore wa Namae o Nusumareta Machi no Monogatari (JPN)
|
||||
board.append("BS-MCC-");
|
||||
} else if(serial() == "042J") {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <stdexcept>
|
||||
|
||||
#define ConcatenateType(Size) uint##Size##_t
|
||||
#define DeclareType(Size) ConcatenateType(Size)
|
||||
|
||||
|
|
|
@ -267,6 +267,7 @@ inline auto directory::copy(const string& source, const string& target) -> bool
|
|||
}
|
||||
#else
|
||||
inline auto directoryIsFolder(DIR* dp, struct dirent* ep) -> bool {
|
||||
#if defined(PLATFORM_MACOS) || defined(PLATFORM_LINUX) || defined(PLATFORM_BSD)
|
||||
if(ep->d_type == DT_DIR) return true;
|
||||
if(ep->d_type == DT_LNK || ep->d_type == DT_UNKNOWN) {
|
||||
//symbolic links must be resolved to determine type
|
||||
|
@ -274,6 +275,15 @@ inline auto directory::copy(const string& source, const string& target) -> bool
|
|||
fstatat(dirfd(dp), ep->d_name, &sp, 0);
|
||||
return S_ISDIR(sp.st_mode);
|
||||
}
|
||||
#else // strictly POSIX systems
|
||||
struct stat sp = {0};
|
||||
stat(ep->d_name, &sp);
|
||||
if S_ISDIR(sp.st_mode) return true;
|
||||
if (S_ISLNK(sp.st_mode) || not S_ISREG(sp.st_mode)) {
|
||||
fstatat(dirfd(dp), ep->d_name, &sp, 0);
|
||||
return S_ISDIR(sp.st_mode);
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,12 @@ struct inode {
|
|||
#if defined(PLATFORM_WINDOWS)
|
||||
//on Windows, the last status change time (ctime) holds the file creation time instead
|
||||
case time::create: return data.st_ctime;
|
||||
#elif defined(__OpenBSD__)
|
||||
// OpenBSD is a special case that must be handled separately from other BSDs
|
||||
case time::create: return min((uint)data.__st_birthtime, (uint)data.st_mtime);
|
||||
#elif defined (__DragonFly__)
|
||||
// DragonFly BSD does not support file creation time, use modified time instead
|
||||
case time::create: return data.st_mtime;
|
||||
#elif defined(PLATFORM_BSD) || defined(PLATFORM_MACOS)
|
||||
//st_birthtime may return -1 or st_atime if it is not supported by the file system
|
||||
//the best that can be done in this case is to return st_mtime if it's older
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace nall {
|
|||
using uint = unsigned;
|
||||
|
||||
enum class Compiler : uint { Clang, GCC, Microsoft, Unknown };
|
||||
enum class Platform : uint { Windows, MacOS, Linux, BSD, Android, Unknown };
|
||||
enum class Platform : uint { Windows, MacOS, Linux, BSD, Haiku, Android, Unknown };
|
||||
enum class API : uint { Windows, Posix, Unknown };
|
||||
enum class DisplayServer : uint { Windows, Quartz, Xorg, Unknown };
|
||||
enum class Architecture : uint { x86, amd64, ARM32, ARM64, PPC32, PPC64, Unknown };
|
||||
|
@ -98,13 +98,20 @@ namespace nall {
|
|||
constexpr auto platform() -> Platform { return Platform::Linux; }
|
||||
constexpr auto api() -> API { return API::Posix; }
|
||||
constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; }
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined (__DragonFly__)
|
||||
#define PLATFORM_BSD
|
||||
#define API_POSIX
|
||||
#define DISPLAY_XORG
|
||||
constexpr auto platform() -> Platform { return Platform::BSD; }
|
||||
constexpr auto api() -> API { return API::Posix; }
|
||||
constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; }
|
||||
#elif defined(__HAIKU__)
|
||||
#define PLATFORM_HAIKU
|
||||
#define API_POSIX
|
||||
#define DISPLAY_UNKNOWN
|
||||
constexpr auto platform() -> Platform { return Platform::Haiku; }
|
||||
constexpr auto api() -> API { return API::Posix; }
|
||||
constexpr auto display() -> DisplayServer { return DisplayServer::Unknown; }
|
||||
#else
|
||||
#warning "unable to detect platform"
|
||||
#define PLATFORM_UNKNOWN
|
||||
|
|
|
@ -169,16 +169,6 @@ template<uint Bits> struct stringify<Real<Bits>> {
|
|||
//arrays
|
||||
|
||||
template<> struct stringify<vector<uint8_t>> {
|
||||
stringify(vector<uint8_t> source) {
|
||||
_text.resize(source.size());
|
||||
memory::copy(_text.data(), source.data(), source.size());
|
||||
}
|
||||
auto data() const -> const char* { return _text.data(); }
|
||||
auto size() const -> uint { return _text.size(); }
|
||||
vector<char> _text;
|
||||
};
|
||||
|
||||
template<> struct stringify<const vector<uint8_t>&> {
|
||||
stringify(const vector<uint8_t>& source) {
|
||||
_text.resize(source.size());
|
||||
memory::copy(_text.data(), source.data(), source.size());
|
||||
|
@ -191,7 +181,7 @@ template<> struct stringify<const vector<uint8_t>&> {
|
|||
//char arrays
|
||||
|
||||
template<> struct stringify<char*> {
|
||||
stringify(char* source) : _data(source ? source : "") {}
|
||||
stringify(const char* source) : _data(source ? source : "") {}
|
||||
auto data() const -> const char* { return _data; }
|
||||
auto size() const -> uint { return strlen(_data); }
|
||||
const char* _data;
|
||||
|
@ -213,13 +203,6 @@ template<> struct stringify<string> {
|
|||
const string& _text;
|
||||
};
|
||||
|
||||
template<> struct stringify<const string&> {
|
||||
stringify(const string& source) : _text(source) {}
|
||||
auto data() const -> const char* { return _text.data(); }
|
||||
auto size() const -> uint { return _text.size(); }
|
||||
const string& _text;
|
||||
};
|
||||
|
||||
template<> struct stringify<string_view> {
|
||||
stringify(const string_view& source) : _view(source) {}
|
||||
auto data() const -> const char* { return _view.data(); }
|
||||
|
@ -227,13 +210,6 @@ template<> struct stringify<string_view> {
|
|||
const string_view& _view;
|
||||
};
|
||||
|
||||
template<> struct stringify<const string_view&> {
|
||||
stringify(const string_view& source) : _view(source) {}
|
||||
auto data() const -> const char* { return _view.data(); }
|
||||
auto size() const -> uint { return _view.size(); }
|
||||
const string_view& _view;
|
||||
};
|
||||
|
||||
template<> struct stringify<array_view<uint8_t>> {
|
||||
stringify(const array_view<uint8_t>& source) : _view(source) {}
|
||||
auto data() const -> const char* { return _view.data<const char>(); }
|
||||
|
@ -241,13 +217,6 @@ template<> struct stringify<array_view<uint8_t>> {
|
|||
const array_view<uint8_t>& _view;
|
||||
};
|
||||
|
||||
template<> struct stringify<const array_view<uint8_t>&> {
|
||||
stringify(const array_view<uint8_t>& source) : _view(source) {}
|
||||
auto data() const -> const char* { return _view.data<const char>(); }
|
||||
auto size() const -> uint { return _view.size(); }
|
||||
const array_view<uint8_t>& _view;
|
||||
};
|
||||
|
||||
template<> struct stringify<string_pascal> {
|
||||
stringify(const string_pascal& source) : _text(source) {}
|
||||
auto data() const -> const char* { return _text.data(); }
|
||||
|
@ -255,13 +224,6 @@ template<> struct stringify<string_pascal> {
|
|||
const string_pascal& _text;
|
||||
};
|
||||
|
||||
template<> struct stringify<const string_pascal&> {
|
||||
stringify(const string_pascal& source) : _text(source) {}
|
||||
auto data() const -> const char* { return _text.data(); }
|
||||
auto size() const -> uint { return _text.size(); }
|
||||
const string_pascal& _text;
|
||||
};
|
||||
|
||||
//pointers
|
||||
|
||||
//note: T = char* is matched by stringify<string_view>
|
||||
|
@ -281,8 +243,8 @@ template<typename T> struct stringify<T*> {
|
|||
|
||||
//
|
||||
|
||||
template<typename T> auto make_string(T value) -> stringify<T> {
|
||||
return stringify<T>(forward<T>(value));
|
||||
template<typename T> auto make_string(const T& value) {
|
||||
return stringify<std::decay_t<T>>(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
|
||||
#undef UNICODE
|
||||
#undef WINVER
|
||||
#undef WIN32_LEAN_AND_LEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#undef _WIN32_WINNT
|
||||
#undef _WIN32_IE
|
||||
#undef __MSVCRT_VERSION__
|
||||
#undef NOMINMAX
|
||||
#undef PATH_MAX
|
||||
|
||||
|
@ -17,8 +15,6 @@
|
|||
#define WINVER 0x0601
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _WIN32_WINNT WINVER
|
||||
#define _WIN32_IE WINVER
|
||||
#define __MSVCRT_VERSION__ WINVER
|
||||
#define NOMINMAX
|
||||
#define PATH_MAX 260
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace SameBoy {
|
|||
|
||||
static auto vblank(GB_gameboy_t*, GB_vblank_type_t) -> void {
|
||||
}
|
||||
|
||||
static auto log(GB_gameboy_t *gb, const char *string, GB_log_attributes attributes) -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto ICD::synchronizeCPU() -> void {
|
||||
|
@ -100,6 +103,7 @@ auto ICD::load() -> bool {
|
|||
GB_set_rgb_encode_callback(&sameboy, &SameBoy::rgb_encode);
|
||||
GB_apu_set_sample_callback(&sameboy, &SameBoy::sample);
|
||||
GB_set_vblank_callback(&sameboy, &SameBoy::vblank);
|
||||
GB_set_log_callback(&sameboy, &SameBoy::log);
|
||||
GB_set_pixels_output(&sameboy, &bitmap[0]);
|
||||
if(auto loaded = platform->load(ID::GameBoy, "Game Boy", "gb")) {
|
||||
information.pathID = loaded.pathID;
|
||||
|
|
|
@ -24,6 +24,7 @@ auto SA1::IRAM::readCPU(uint address, uint8 data) -> uint8 {
|
|||
|
||||
auto SA1::IRAM::writeCPU(uint address, uint8 data) -> void {
|
||||
cpu.synchronizeCoprocessors();
|
||||
if(!(sa1.mmio.siwp & 1 << (address >> 8 & 7))) return;
|
||||
return write(address, data);
|
||||
}
|
||||
|
||||
|
@ -32,5 +33,6 @@ auto SA1::IRAM::readSA1(uint address, uint8 data) -> uint8 {
|
|||
}
|
||||
|
||||
auto SA1::IRAM::writeSA1(uint address, uint8 data) -> void {
|
||||
if(!(sa1.mmio.ciwp & 1 << (address >> 8 & 7))) return;
|
||||
return write(address, data);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
struct ProtectableMemory : Memory {
|
||||
inline auto reset() -> void override {
|
||||
//delete[] self.data;
|
||||
//self.data = nullptr;
|
||||
//self.size = 0;
|
||||
delete[] self.data;
|
||||
self.data = nullptr;
|
||||
self.size = 0;
|
||||
}
|
||||
|
||||
inline auto allocate(uint size, uint8 fill = 0xff) -> void override {
|
||||
if (!self.data) {
|
||||
self.data = alloc_plain<uint8>(self.size = size);
|
||||
}
|
||||
if(self.size != size) {
|
||||
//delete[] self.data;
|
||||
//self.data = new uint8[self.size = size];
|
||||
abort();
|
||||
delete[] self.data;
|
||||
self.data = new uint8[self.size = size];
|
||||
}
|
||||
for(uint address : range(size)) {
|
||||
self.data[address] = fill;
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
struct WritableMemory : Memory {
|
||||
inline auto reset() -> void override {
|
||||
//delete[] self.data;
|
||||
//self.data = nullptr;
|
||||
//self.size = 0;
|
||||
delete[] self.data;
|
||||
self.data = nullptr;
|
||||
self.size = 0;
|
||||
}
|
||||
|
||||
inline auto allocate(uint size, uint8 fill = 0xff) -> void override {
|
||||
if (!self.data) {
|
||||
self.data = alloc_plain<uint8>(self.size = size);
|
||||
}
|
||||
if(self.size != size) {
|
||||
//delete[] self.data;
|
||||
//self.data = new uint8[self.size = size];
|
||||
abort();
|
||||
delete[] self.data;
|
||||
self.data = new uint8[self.size = size];
|
||||
}
|
||||
for(uint address : range(size)) {
|
||||
self.data[address] = fill;
|
||||
|
|
|
@ -4,7 +4,7 @@ uint PPU::Line::count = 0;
|
|||
auto PPU::Line::flush() -> void {
|
||||
if(Line::count) {
|
||||
if(ppu.hdScale() > 1) cacheMode7HD();
|
||||
// #pragma omp parallel for if(Line::count >= 8) // we do not have openmp support in waterbox
|
||||
#pragma omp parallel for if(Line::count >= 8)
|
||||
for(uint y = 0; y < Line::count; y++) {
|
||||
if(ppu.deinterlace()) {
|
||||
if(!ppu.interlace()) {
|
||||
|
|
|
@ -15,6 +15,12 @@ auto System::run() -> void {
|
|||
}
|
||||
|
||||
auto System::runToSave() -> void {
|
||||
// Enable coprocessor delayed sync if it is off - this is extremely important
|
||||
// for coprocessor games, as many will not sync correctly for states when the
|
||||
// option is off.
|
||||
bool delay_sync_prev = configuration.hacks.coprocessor.delayedSync;
|
||||
configuration.hacks.coprocessor.delayedSync = true;
|
||||
|
||||
auto method = configuration.system.serialization.method;
|
||||
|
||||
//these games will periodically deadlock when using "Fast" synchronization
|
||||
|
@ -30,6 +36,9 @@ auto System::runToSave() -> void {
|
|||
|
||||
scheduler.mode = Scheduler::Mode::Run;
|
||||
scheduler.active = cpu.thread;
|
||||
|
||||
// Restore coprocessor delayed sync to whatever it was previous to the state save operation
|
||||
configuration.hacks.coprocessor.delayedSync = delay_sync_prev;
|
||||
}
|
||||
|
||||
auto System::runToSaveFast() -> void {
|
||||
|
|
Loading…
Reference in New Issue