| 356 | } |
| 357 | |
| 358 | void cemu_initForGame() |
| 359 | { |
| 360 | gui_updateWindowTitles(false, true, 0.0); |
| 361 | // input manager apply game profile |
| 362 | InputManager::instance().apply_game_profile(); |
| 363 | // log info for launched title |
| 364 | InfoLog_TitleLoaded(); |
| 365 | // determine cycle offset since 1.1.2000 |
| 366 | uint64 secondsSince2000_UTC = (uint64)(time(NULL) - 946684800); |
| 367 | ppcCyclesSince2000_UTC = secondsSince2000_UTC * (uint64)ESPRESSO_CORE_CLOCK; |
| 368 | time_t theTime = (time(NULL) - 946684800); |
| 369 | { |
| 370 | tm* lt = localtime(&theTime); |
| 371 | #if BOOST_OS_WINDOWS |
| 372 | theTime = _mkgmtime(lt); |
| 373 | #else |
| 374 | theTime = timegm(lt); |
| 375 | #endif |
| 376 | } |
| 377 | ppcCyclesSince2000 = theTime * (uint64)ESPRESSO_CORE_CLOCK; |
| 378 | ppcCyclesSince2000TimerClock = ppcCyclesSince2000 / 20ULL; |
| 379 | PPCTimer_start(); |
| 380 | // this must happen after the RPX/RPL files are mapped to memory (coreinit sets up heaps so that they don't overwrite RPX/RPL data) |
| 381 | osLib_load(); |
| 382 | // link all modules |
| 383 | uint32 linkTimeStart = GetTickCount(); |
| 384 | RPLLoader_UpdateDependencies(); |
| 385 | RPLLoader_Link(); |
| 386 | RPLLoader_NotifyControlPassedToApplication(); |
| 387 | uint32 linkTime = GetTickCount() - linkTimeStart; |
| 388 | cemuLog_log(LogType::Force, "RPL link time: {}ms", linkTime); |
| 389 | // for HBL ELF: Setup OS-specifics struct |
| 390 | if (isLaunchTypeELF) |
| 391 | { |
| 392 | memory_writeU32(0x801500, rpl_mapHLEImport(nullptr, "coreinit", "OSDynLoad_Acquire", true)); |
| 393 | memory_writeU32(0x801504, rpl_mapHLEImport(nullptr, "coreinit", "OSDynLoad_FindExport", true)); |
| 394 | } |
| 395 | else |
| 396 | { |
| 397 | // replace any known function signatures with our HLE implementations and patch bugs in the games |
| 398 | GamePatch_scan(); |
| 399 | } |
| 400 | LatteGPUState.isDRCPrimary = ActiveSettings::DisplayDRCEnabled(); |
| 401 | InfoLog_PrintActiveSettings(); |
| 402 | Latte_Start(); |
| 403 | // check for debugger entrypoint bp |
| 404 | if (g_gdbstub) |
| 405 | { |
| 406 | g_gdbstub->HandleEntryStop(_entryPoint); |
| 407 | g_gdbstub->Initialize(); |
| 408 | } |
| 409 | debugger_handleEntryBreakpoint(_entryPoint); |
| 410 | // load graphic packs |
| 411 | cemuLog_log(LogType::Force, "------- Activate graphic packs -------"); |
| 412 | GraphicPack2::ActivateForCurrentTitle(); |
| 413 | // print audio log |
| 414 | IAudioAPI::PrintLogging(); |
| 415 | IAudioInputAPI::PrintLogging(); |
no test coverage detected