xenia-project / xenia

Xbox 360 Emulator Research Project
https://xenia.jp
Other
8.26k stars 1.14k forks source link

RtlTimeToTimeFields - gmtime returns nullptr #630

Closed wellerallergy closed 7 years ago

wellerallergy commented 7 years ago

Trying to run Scott Pilgrim I get this error:

"The thread 0xf98 has exited with code 0 (0x0). Unhandled exception thrown: read access violation. tm was nullptr."

Call stack: xenia.exe!xe::kernel::xboxkrnl::RtlTimeToTimeFields(const xe::kernel::shim::PrimitivePointerParam & time_ptr, const xe::kernel::shim::TypedPointerParam & time_fields_ptr) Line 451 C++

and:

xenia.exe!xe::kernel::shim::RegisterExport<0,320,xe::kernel::shim::PrimitivePointerParam<unsigned __int64> const ,xe::kernel::shim::TypedPointerParam<xe::kernel::xboxkrnl::X_TIME_FIELDS> const >'::2'::X::Trampoline(xe::cpu::ppc::PPCContext_s * ppc_context) Line 503 C++

Margen67 commented 7 years ago

https://github.com/xenia-project/game-compatibility/issues/114

DrChat commented 7 years ago

Thanks for the useful information :)

MSDN says gmtime can return nullptr if the time is before Jan 1, 1970.

inckie commented 7 years ago

For some ISOs, time_ptr in RtlTimeToTimeFields already holds epoch time or something close to that. Trying to convert it makes it negative thus returning null from gmtime. The time seems to be originated from ISO file system.

inckie commented 7 years ago

I've traced it down. See #655.

inckie commented 7 years ago

I think this one can be closed. The game still only draws proper on OpenGL, and crashes under debugger, but this crash should no longer occur.