BII/SS pref item "yearofs"

This commit is contained in:
kanjitalk755 2019-02-05 18:44:24 +09:00
parent e3c8cd9ffb
commit e676dbf839
4 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,8 @@
#include "disk.h"
#include "cdrom.h"
#include "macos_util.h"
#include "prefs.h"
#include <algorithm>
#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);

View File

@ -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
};

View File

@ -28,6 +28,8 @@
#include "emul_op.h"
#include "macos_util.h"
#include "thunks.h"
#include "prefs.h"
#include <algorithm>
#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);

View File

@ -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
};