Skip to content

Instantly share code, notes, and snippets.

@oupo
Created September 1, 2014 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oupo/d86f6187f799a3d540d2 to your computer and use it in GitHub Desktop.
Save oupo/d86f6187f799a3d540d2 to your computer and use it in GitHub Desktop.
Index: desmume/src/lua-engine.cpp
===================================================================
--- desmume/src/lua-engine.cpp (リビジョン 5048)
+++ desmume/src/lua-engine.cpp (作業コピー)
@@ -1124,6 +1124,24 @@
}
+extern TimeSpan HIJACK_TIME_DIFF;
+
+DEFINE_LUA_FUNCTION(emu_hijacktime, "year,month,day,hour,minute,second,millisecond")
+{
+ int year = luaL_checkinteger(L,1);
+ int month = luaL_checkinteger(L,2);
+ int day = luaL_checkinteger(L,3);
+ int hour = luaL_checkinteger(L,4);
+ int minute = luaL_checkinteger(L,5);
+ int second = luaL_checkinteger(L,6);
+ int millisecond = luaL_checkinteger(L,7);
+ DateTime now = DateTime::get_Now();
+ DateTime newDate(year,month,day,hour,minute,second,millisecond);
+ HIJACK_TIME_DIFF = newDate.Subtract(now);
+ return 0;
+}
+
+
DEFINE_LUA_FUNCTION(emu_message, "str")
{
const char* str = toCString(L);
@@ -4532,6 +4550,7 @@
{"registerexit", emu_registerexit},
{"persistglobalvariables", emu_persistglobalvariables},
{"message", emu_message},
+ {"hijackttime", emu_hijacktime},
{"print", print}, // sure, why not
{"openscript", emu_openscript},
// {"loadrom", emu_loadrom},
Index: desmume/src/rtc.cpp
===================================================================
--- desmume/src/rtc.cpp (リビジョン 5048)
+++ desmume/src/rtc.cpp (作業コピー)
@@ -93,12 +93,13 @@
}
bool moviemode=false;
+TimeSpan HIJACK_TIME_DIFF(0);
DateTime rtcGetTime(void)
{
DateTime tm;
if(movieMode == MOVIEMODE_INACTIVE) {
- return DateTime::get_Now();
+ return DateTime::get_Now().Add(HIJACK_TIME_DIFF);
}
else {
//now, you might think it is silly to go through all these conniptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment