GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — UnleashedRecomp-Android/UnleashedRecomp/app.cpp at main · SansNope/UnleashedRecomp-Android Expand file tree/ Copy pathapp.cppMore file actions 143 lines (117 loc) · 4.53 KB / Copy pathapp.cppFile metadata and controls143 lines (117 loc) · 4.53 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 #include "app.h" #include <api/SWA.h> #include <gpu/video.h> #include <install/installer.h> #include <kernel/function.h> #include <os/process.h> #include <patches/audio_patches.h> #include <patches/inspire_patches.h> #include <ui/game_window.h> #include <user/config.h> #include <user/paths.h> #include <user/registry.h> #include <os/logger.h> #include <chrono> #include <thread> void App::Restart(std::vector<std::string> restartArgs) { os::process::StartProcess(os::process::GetExecutablePath(), restartArgs, os::process::GetWorkingDirectory()); Exit(); } void App::Exit() { Config::Save(); #ifdef _WIN32 timeEndPeriod(1); #endif std::_Exit(0); } // SWA::CApplication::CApplication PPC_FUNC_IMPL(__imp__sub_824EB490); PPC_FUNC(sub_824EB490) { App::s_isInit = true; App::s_isMissingDLC = !Installer::checkAllDLC(GetGamePath()); App::s_language = Config::Language; SWA::SGlobals::Init(); Registry::Save(); __imp__sub_824EB490(ctx, base); } static std::thread::id g_mainThreadId = std::this_thread::get_id(); // SWA::CApplication::Update PPC_FUNC_IMPL(__imp__sub_822C1130); PPC_FUNC(sub_822C1130) { #ifdef __ANDROID__ // Freeze the game tick while backgrounded. The flag is driven by the native-window // watcher thread in sdl2_driver.cpp (AndroidWindowWatcherThread): the OS destroys // the ANativeWindow on background and recreates it on restore - the only lifecycle // signal that proved reliable here. SDL's pause/resume events are informational only. // NOTE: Audio is paused/resumed by the same watcher via Unleashed_AppSetPaused. const bool isMainThread = std::this_thread::get_id() == g_mainThreadId; bool wasPaused = App::s_androidPaused.load(std::memory_order_acquire); while (App::s_androidPaused.load(std::memory_order_acquire)) { // Non-blocking on Android (SDL_HINT_ANDROID_BLOCK_ON_PAUSE=0), so SDL cannot // park this thread inside its resume semaphore. if (isMainThread) SDL_PumpEvents(); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } if (isMainThread && wasPaused) { os::logger::Log("game tick resumed from background - triggering video swapchain check", os::logger::ELogType::Utility, "android"); Video::OnAndroidResume(); // will invalidate/recreate swapchain if needed } #endif Video::WaitOnSwapChain(); // Correct small delta time errors. if (Config::FPS >= FPS_MIN && Config::FPS < FPS_MAX) { double targetDeltaTime = 1.0 / Config::FPS; if (abs(ctx.f1.f64 - targetDeltaTime) < 0.00001) ctx.f1.f64 = targetDeltaTime; } App::s_deltaTime = ctx.f1.f64; App::s_time += App::s_deltaTime; #ifdef __ANDROID__ // Publish the actual internal stage name into log.txt. Empty names cover the // title screen, menus, world map and transitions where no playable stage exists. const char* testLocation = "front_end_or_loading"; if (auto pGameDocument = SWA::CGameDocument::GetInstance()) { if (pGameDocument->m_pMember) { const char* stageName = pGameDocument->m_pMember->m_StageName.c_str(); if (stageName != nullptr && stageName[0] != '\0') testLocation = stageName; } } os::logger::SetTestLocation(testLocation); #endif // This function can also be called by the loading thread, // which SDL does not like. To prevent the OS from thinking // the process is unresponsive, we will flush while waiting // for the pipelines to finish compiling in video.cpp. if (std::this_thread::get_id() == g_mainThreadId) { SDL_PumpEvents(); // Do not SDL_FlushEvents here: it discards SDL_APP_DIDENTERBACKGROUND before SDL's // Android pause machinery can finish, and the game loop would keep running in background. GameWindow::Update(); } AudioPatches::Update(App::s_deltaTime); InspirePatches::Update(); // Apply subtitles option. if (auto pApplicationDocument = SWA::CApplicationDocument::GetInstance()) pApplicationDocument->m_InspireSubtitles = Config::Subtitles; if (Config::EnableEventCollisionDebugView) *SWA::SGlobals::ms_IsTriggerRender = true; if (Config::EnableGIMipLevelDebugView) *SWA::SGlobals::ms_VisualizeLoadedLevel = true; if (Config::EnableObjectCollisionDebugView) *SWA::SGlobals::ms_IsObjectCollisionRender = true; if (Config::EnableStageCollisionDebugView) *SWA::SGlobals::ms_IsCollisionRender = true; __imp__sub_822C1130(ctx, base); } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |