DIRECTOR: Add ability to fake the current date

Required for titles which stop working after a certain date,
e.g. the Hollywood High "Be a Hollywood Hot Shot Contest" promo.
This commit is contained in:
Scott Percival 2023-07-18 19:24:06 +08:00 committed by Eugene Sandulenko
parent dff38babeb
commit 45f5678eab
4 changed files with 29 additions and 1 deletions

View File

@ -98,6 +98,13 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_wmHeight = 768;
_fpsLimit = 0;
_forceDate.tm_sec = -1;
_forceDate.tm_min = -1;
_forceDate.tm_hour = -1;
_forceDate.tm_mday = -1;
_forceDate.tm_mon = -1;
_forceDate.tm_year = -1;
_forceDate.tm_wday = -1;
_wm = nullptr;

View File

@ -273,9 +273,12 @@ public:
uint32 _wmMode;
uint16 _wmWidth;
uint16 _wmHeight;
byte _fpsLimit;
CastMemberID _lastPalette;
// used for quirks
byte _fpsLimit;
TimeDate _forceDate;
private:
byte _currentPalette[768];
uint16 _currentPaletteLength;

View File

@ -93,6 +93,15 @@ static void quirk640x480Desktop() {
g_director->_wmHeight = 480;
}
static void quirkHollywoodHigh() {
// Hollywood High demo has a killswitch that stops playback
// if the year is after 1996.
g_director->_forceDate.tm_year = 1996 - 1900;
g_director->_forceDate.tm_mon = 0;
g_director->_forceDate.tm_mday = 1;
g_director->_forceDate.tm_wday = 0;
}
static void quirkLzone() {
SearchMan.addSubDirectoryMatching(g_director->_gameDataDir, "win_data", 0, 2);
}
@ -180,6 +189,7 @@ struct Quirk {
// It runs in 640x480; clipping it to this size ensures the main
// game window takes up the full screen, and only the splash is windowed.
{ "kidsbox", Common::kPlatformMacintosh, &quirk640x480Desktop },
{ "hollywoodhigh", Common::kPlatformWindows, &quirkHollywoodHigh },
{ "lzone", Common::kPlatformWindows, &quirkLzone },
{ "mamauta1", Common::kPlatformMacintosh, &quirk640x480Desktop },
{ "mamauta1", Common::kPlatformWindows, &quirk640x480Desktop },

View File

@ -2021,6 +2021,14 @@ Datum Lingo::getTheDate(int field) {
TimeDate t;
g_system->getTimeAndDate(t);
if (g_director->_forceDate.tm_year != -1) {
// Override date portion
t.tm_year = g_director->_forceDate.tm_year;
t.tm_mon = g_director->_forceDate.tm_mon;
t.tm_wday = g_director->_forceDate.tm_wday;
t.tm_mday = g_director->_forceDate.tm_mday;
}
Common::String s;
Datum d;