Fixed deterministic serialization on Windows.
This commit is contained in:
byuu 2019-10-17 21:42:42 +09:00
parent 9f86a3be26
commit 30d7fa1923
13 changed files with 41 additions and 45 deletions

View File

@ -29,7 +29,7 @@ using namespace nall;
namespace Emulator {
static const string Name = "bsnes";
static const string Version = "111.9";
static const string Version = "111.10";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "https://byuu.org";

View File

@ -93,7 +93,7 @@ auto PPU::Line::renderBackground(PPU::IO::Background& self, uint8 source) -> voi
tileNumber = (tileNumber & 0x03ff) + tiledataIndex & tileMask;
uint16 address;
address = (tileNumber << colorShift) + (voffset & 7 ^ mirrorY);
address = (tileNumber << colorShift) + (voffset & 7 ^ mirrorY) & 0x7fff;
uint64 data;
data = (uint64)ppu.vram[address + 0] << 0;

View File

@ -1,10 +1,6 @@
auto System::serialize(bool synchronize) -> serializer {
//deterministic serialization (synchronize=false) is only possible with select libco methods.
if(co_method() != "x86"
&& co_method() != "amd64"
&& co_method() != "arm"
&& co_method() != "aarch64"
) synchronize = true;
//deterministic serialization (synchronize=false) is only possible with select libco methods
if(!co_serializable()) synchronize = true;
if(!information.serializeSize[synchronize]) return {}; //should never occur
if(synchronize) runToSave();

View File

@ -59,10 +59,6 @@ static void co_init() {
#endif
}
const char* co_method() {
return "aarch64";
}
cothread_t co_active() {
if(!co_active_handle) co_active_handle = &co_active_buffer;
return co_active_handle;
@ -102,6 +98,10 @@ void co_switch(cothread_t handle) {
co_swap(co_active_handle = handle, co_previous_handle);
}
int co_serializable() {
return 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -115,10 +115,6 @@ static void crash() {
assert(0); /* called only if cothread_t entrypoint returns */
}
const char* co_method() {
return "amd64";
}
cothread_t co_active() {
if(!co_active_handle) co_active_handle = &co_active_buffer;
return co_active_handle;
@ -158,6 +154,10 @@ void co_switch(cothread_t handle) {
co_swap(co_active_handle = handle, co_previous_handle);
}
int co_serializable() {
return 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -35,10 +35,6 @@ static void co_init() {
#endif
}
const char* co_method() {
return "arm";
}
cothread_t co_active() {
if(!co_active_handle) co_active_handle = &co_active_buffer;
return co_active_handle;
@ -77,6 +73,10 @@ void co_switch(cothread_t handle) {
co_swap(co_active_handle = handle, co_previous_handle);
}
int co_serializable() {
return 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -16,10 +16,6 @@ static void __stdcall co_thunk(void* coentry) {
((void (*)(void))coentry)();
}
const char* co_method() {
return "fiber";
}
cothread_t co_active() {
if(!co_active_) {
ConvertThreadToFiber(0);
@ -50,6 +46,10 @@ void co_switch(cothread_t cothread) {
SwitchToFiber(cothread);
}
int co_serializable() {
return 0;
}
#ifdef __cplusplus
}
#endif

View File

@ -13,12 +13,12 @@ extern "C" {
typedef void* cothread_t;
const char* co_method();
cothread_t co_active();
cothread_t co_derive(void*, unsigned int, void (*)(void));
cothread_t co_create(unsigned int, void (*)(void));
void co_delete(cothread_t);
void co_switch(cothread_t);
int co_serializable();
#ifdef __cplusplus
}

View File

@ -413,10 +413,6 @@ static void co_init_(void) {
co_active_handle = co_create_(state_size, (uintptr_t)&co_switch);
}
const char* co_method() {
return "ppc";
}
cothread_t co_active() {
if(!co_active_handle) co_init_();
@ -429,3 +425,7 @@ void co_switch(cothread_t t) {
CO_SWAP_ASM(t, old);
}
int co_serializable() {
return 0;
}

View File

@ -221,10 +221,6 @@ __asm__(
".size swap_context, .-swap_context\n"
);
const char* co_method() {
return "ppc64v2";
}
cothread_t co_active() {
if(!co_active_handle) {
co_active_handle = (struct ppc64_context*)malloc(MIN_STACK + sizeof(struct ppc64_context));
@ -274,6 +270,10 @@ void co_switch(cothread_t to) {
swap_context((struct ppc64_context*)to, from);
}
int co_serializable() {
return 1;
}
#ifdef __cplusplus
}
#endif

View File

@ -33,10 +33,6 @@ static void springboard(int ignored) {
}
}
const char* co_method() {
return "sjlj";
}
cothread_t co_active() {
if(!co_running) co_running = &co_primary;
return (cothread_t)co_running;
@ -140,6 +136,10 @@ void co_switch(cothread_t cothread) {
}
}
int co_serializable() {
return 0;
}
#ifdef __cplusplus
}
#endif

View File

@ -26,10 +26,6 @@ extern "C" {
static thread_local ucontext_t co_primary;
static thread_local ucontext_t* co_running = 0;
const char* co_module() {
return "ucontext";
}
cothread_t co_active() {
if(!co_running) co_running = &co_primary;
return (cothread_t)co_running;
@ -81,6 +77,10 @@ void co_switch(cothread_t cothread) {
swapcontext(old_thread, co_running);
}
int co_serializable() {
return 0;
}
#ifdef __cplusplus
}
#endif

View File

@ -69,10 +69,6 @@ static void crash() {
assert(0); /* called only if cothread_t entrypoint returns */
}
const char* co_method() {
return "x86";
}
cothread_t co_active() {
if(!co_active_handle) co_active_handle = &co_active_buffer;
return co_active_handle;
@ -112,6 +108,10 @@ void co_switch(cothread_t handle) {
co_swap(co_active_handle = handle, co_previous_handle);
}
int co_serializable() {
return 1;
}
#ifdef __cplusplus
}
#endif