From e676dbf8399e5cbfb0c36fe304abc670cd003c82 Mon Sep 17 00:00:00 2001 From: kanjitalk755 Date: Tue, 5 Feb 2019 18:44:24 +0900 Subject: [PATCH] BII/SS pref item "yearofs" --- BasiliskII/src/macos_util.cpp | 3 +++ BasiliskII/src/prefs_items.cpp | 1 + SheepShaver/src/macos_util.cpp | 3 +++ SheepShaver/src/prefs_items.cpp | 1 + 4 files changed, 8 insertions(+) diff --git a/BasiliskII/src/macos_util.cpp b/BasiliskII/src/macos_util.cpp index 6de3877f..85115df7 100644 --- a/BasiliskII/src/macos_util.cpp +++ b/BasiliskII/src/macos_util.cpp @@ -26,6 +26,8 @@ #include "disk.h" #include "cdrom.h" #include "macos_util.h" +#include "prefs.h" +#include #define DEBUG 0 #include "debug.h" @@ -134,6 +136,7 @@ uint32 TimeToMacTime(time_t t) struct tm *local = localtime(&t); const int TM_EPOCH_YEAR = 1900; const int MAC_EPOCH_YEAR = 1904; + local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year - PrefsFindInt32("yearofs")); int a4 = ((local->tm_year + TM_EPOCH_YEAR) >> 2) - !(local->tm_year & 3); int b4 = (MAC_EPOCH_YEAR >> 2) - !(MAC_EPOCH_YEAR & 3); int a100 = a4 / 25 - (a4 % 25 < 0); diff --git a/BasiliskII/src/prefs_items.cpp b/BasiliskII/src/prefs_items.cpp index 0de2f6ee..79eb7230 100644 --- a/BasiliskII/src/prefs_items.cpp +++ b/BasiliskII/src/prefs_items.cpp @@ -75,6 +75,7 @@ prefs_desc common_prefs_items[] = { {"hotkey",TYPE_INT32,false,"hotkey modifier"}, {"scale_nearest",TYPE_BOOLEAN,false,"nearest neighbor scaling"}, {"scale_integer",TYPE_BOOLEAN,false,"integer scaling"}, + {"yearofs", TYPE_INT32, 0, "year offset"}, {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/SheepShaver/src/macos_util.cpp b/SheepShaver/src/macos_util.cpp index 517ab703..9afc2842 100644 --- a/SheepShaver/src/macos_util.cpp +++ b/SheepShaver/src/macos_util.cpp @@ -28,6 +28,8 @@ #include "emul_op.h" #include "macos_util.h" #include "thunks.h" +#include "prefs.h" +#include #define DEBUG 0 #include "debug.h" @@ -333,6 +335,7 @@ uint32 TimeToMacTime(time_t t) #endif const int TM_EPOCH_YEAR = 1900; const int MAC_EPOCH_YEAR = 1904; + local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year - PrefsFindInt32("yearofs")); int a4 = ((local->tm_year + TM_EPOCH_YEAR) >> 2) - !(local->tm_year & 3); int b4 = (MAC_EPOCH_YEAR >> 2) - !(MAC_EPOCH_YEAR & 3); int a100 = a4 / 25 - (a4 % 25 < 0); diff --git a/SheepShaver/src/prefs_items.cpp b/SheepShaver/src/prefs_items.cpp index 5a7f7761..072c6fd9 100644 --- a/SheepShaver/src/prefs_items.cpp +++ b/SheepShaver/src/prefs_items.cpp @@ -63,6 +63,7 @@ prefs_desc common_prefs_items[] = { {"scale_nearest",TYPE_BOOLEAN,false,"nearest neighbor scaling"}, {"scale_integer",TYPE_BOOLEAN,false,"integer scaling"}, {"cpuclock", TYPE_INT32, 0, "CPU clock [MHz] of system info"}, + {"yearofs", TYPE_INT32, 0, "year offset"}, {NULL, TYPE_END, false, NULL} // End of list };