[Kernel] - time fix for darksouls

This commit is contained in:
Cancerous 2019-12-19 17:31:13 -05:00 committed by illusion
parent 8807229fe8
commit b8d0b730bd
1 changed files with 9 additions and 1 deletions

View File

@ -512,7 +512,14 @@ static_assert(sizeof(X_TIME_FIELDS) == 16, "Must be LARGEINTEGER");
// https://support.microsoft.com/en-us/kb/167296 // https://support.microsoft.com/en-us/kb/167296
void RtlTimeToTimeFields(lpqword_t time_ptr, void RtlTimeToTimeFields(lpqword_t time_ptr,
pointer_t<X_TIME_FIELDS> time_fields_ptr) { pointer_t<X_TIME_FIELDS> time_fields_ptr) {
int64_t time_ms = time_ptr.value() / 10000 - 11644473600000LL; // int64_t time_ms = time_ptr.value() / 10000 - 11644473600000LL;
// TEST
long long inttime = 11644473600000;
long long timeptrval = time_ptr.value();
if (timeptrval) {
inttime = timeptrval;
}
int64_t time_ms = (short)((inttime % 10000000) / 10000);
time_t timet = time_ms / 1000; time_t timet = time_ms / 1000;
struct tm* tm = gmtime(&timet); struct tm* tm = gmtime(&timet);
@ -524,6 +531,7 @@ void RtlTimeToTimeFields(lpqword_t time_ptr,
time_fields_ptr->second = tm->tm_sec; time_fields_ptr->second = tm->tm_sec;
time_fields_ptr->milliseconds = time_ms % 1000; time_fields_ptr->milliseconds = time_ms % 1000;
time_fields_ptr->weekday = tm->tm_wday; time_fields_ptr->weekday = tm->tm_wday;
} }
DECLARE_XBOXKRNL_EXPORT1(RtlTimeToTimeFields, kNone, kImplemented); DECLARE_XBOXKRNL_EXPORT1(RtlTimeToTimeFields, kNone, kImplemented);