CD Code Digest Hub /GTA V · v2

gameSkeleton 与主循环:系统装配总表

191 分钟阅读 12 个章节 4 张图

本页是全 Wiki 的“系统装配总表”。GTAV 的数百个游戏子系统并不由某个巨大的 Init() 手写调用,而是由 CGame::Register*Functions 把“名字 + 回调”登记到框架类 gameSkeleton 的若干初始化/关闭模式与更新模式中,再由 CGame::Init/InitLevel/InitSession/Update 按模式批量执行。理解这张表,就能回答“某个系统何时初始化、何时关闭、每帧在什么位置更新、在哪种游戏状态下不更新”。

本页还覆盖 CGame 的生命周期函数(PreLoadingScreensInit/Init/InitLevel/InitSession/Shutdown*)、CGame::Update/Render 的逐步流程、ShouldDoFullUpdateRender 以及一帧的完整时序。

背景与相关页面#

相关源码文件#

文件作用
src/dev_ng/rage/framework/src/fwsys/gameskeleton.h/.cppgameSkeleton:模式掩码、注册与执行、更新组与计时条
src/dev_ng/rage/framework/src/fwsys/game.h/.cppfwGame/fwGameInterface:框架级流式模块注册
src/dev_ng/game/Core/game.h/.cppCGame:全部注册函数、生命周期函数、Update/Render、ShouldDoFullUpdateRender
src/dev_ng/game/Core/app.cppCApp::RunGame:每帧调用 CGame::Update/Render 的外层骨架
src/dev_ng/game/system/system.cppCSystem::BeginUpdate/EndUpdate/AddDrawList_BeginRender/EndRender
src/dev_ng/game/scene/scene.cppCScene::Update(FULL_MAIN_UPDATE 中的场景/世界更新入口)

1. gameSkeleton 机制#

1.1 模式掩码#

初始化/关闭模式与更新模式都是位掩码常量:

常量值证据
INIT_CORE / SHUTDOWN_COREBIT(0)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:18-19
INIT_BEFORE_MAP_LOADEDBIT(1)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:20
INIT_AFTER_MAP_LOADED / SHUTDOWN_WITH_MAP_LOADEDBIT(2)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:21-22
INIT_SESSION / SHUTDOWN_SESSIONBIT(3)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:23-24
COMMON_MAIN_UPDATE / FULL_MAIN_UPDATE / SIMPLE_MAIN_UPDATEBIT(0) / BIT(1) / BIT(2)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:26-28
COMMERCE_MAIN_UPDATEBIT(3)(仅 COMMERCE_CONTAINER,即 PS3)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:30-32、src/dev_ng/rage/base/src/system/memory.h:20
LANDING_PAGE_PRE_INIT_UPDATE / LANDING_PAGE_UPDATEBIT(4) / BIT(5)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:34-35

初始化与关闭共用同一套位值(例如 INIT_CORE == SHUTDOWN_CORE == 1),回调签名都是 void(unsigned mode),许多系统的 Init/Shutdown 内部用 if (mode == INIT_CORE) ... else if (mode == INIT_SESSION) ... 区分阶段——例如 CGame::ViewportSystemInit/Shutdown 在 CORE 模式创建/销毁视口管理器,在 SESSION 模式只做会话级初始化/关闭 src/dev_ng/game/Core/game.cpp:3614-3639。

1.2 数据结构#

图中证据:

  • systemData(init/shutdown 函数、两个依赖级别字段、init/shutdown 类型掩码、名字):src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:146-193
  • dependency(级别、atArray<unsigned> sysData、next)与 mode(类型、依赖链表头、next):src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:198-228
  • updateBase/updateElement/updateGroup/updateMode:src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:233-417
  • 成员:当前依赖级别/各类型、m_RegisteredSystemData、更新组栈、三个模式链表头:src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:461-477

1.3 注册语义#

操作实现要点证据
SetCurrentInitType/ShutdownType/DependencyLevel仅记录“当前”值,后续注册沿用src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:53-56
SetCurrentUpdateType断言更新组栈为空(Push/Pop 必须配对)src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:41-48
RegisterInitSystem(fn, name)断言级别 < MAX_DEPENDENCY_LEVELS;按名字哈希线性查找已有 systemData:存在则断言函数一致且该 init 类型未注册过,再 OR 进类型掩码;否则追加新项。最后把索引加入“当前 init 类型”模式的“当前级别”桶src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:50-82、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:484-505
RegisterShutdownSystem同上,作用于关闭函数与 m_ShutdownModessrc/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:84-113
AddSysDataForMode在模式链表中查找/追加该模式;在其依赖链表中按级别升序查找/插入桶;把索引 PushAndGrow 到桶尾src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:166-240
RegisterUpdateSystem(fn, name, addTimebar, budget)新建 updateElement;若更新组栈非空,追加到栈顶组的子链表尾,否则追加到当前更新模式链表尾src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:115-134、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:290-367
PushUpdateGroup / PopUpdateGroup组本身作为元素加入当前位置,然后压栈(上限 32 层)src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:136-164

两个容易误解的细节:

  1. 依赖级别属于“(模式, 注册)”而非系统。排序用的是注册时的 m_CurrentDependencyLevel;systemData::m_InitDependencyLevel/m_ShutdownDependencyLevel 只在首次创建时赋值,执行路径从不读取它们 src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:71、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:104、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:369-467。同一个系统可以在 INIT_CORE 的级别 1、INIT_SESSION 的级别 2 分别注册。
  2. 同名即同一系统。不同模式下用同一个 atHashString 名注册时,回调必须相同(断言);因此 GTAV 偶尔用不同名字注册同一函数的不同阶段(如 "CModelInfo" 与 "CModelInfo::Init"、"ViewportSystemInit" 与 "ViewportSystemInitLevel")。

1.4 Init(mode) / Shutdown(mode) 的执行#

src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:369-467

  • 找到模式后,按依赖级别从低到高遍历,每个级别内按注册顺序调用 fn(mode)。
  • 关闭不会自动反序:Shutdown() 与 Init() 一样从低级别到高级别、按注册顺序执行。游戏通过把“必须最后关闭”的系统放到更高级别来表达依赖(例如 CStreaming::Shutdown 在会话关闭中位于级别 5,fwTxdStoreWrapper::Shutdown 位于级别 6,注释写明“dependent on streaming being shutdown”)src/dev_ng/game/Core/game.cpp:2616-2630。
  • __DEV 下 SetTestDependencies(true) 会把每个级别内的顺序反过来,用于检验同级系统之间是否存在未声明的依赖 src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:58-60、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:386-392。
  • 每个 init 回调前推入同名启动计时条(PF_START_STARTUPBAR)与 profiler 事件,回调后调用 strStreamingEngine::GetLoader().CallKeepAliveCallbackIfNecessary();该函数在距上次回调超过 0.5 秒时调用游戏的 keep-alive 回调,避免长时间初始化导致网络超时或加载画面卡死 src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:398-411、src/dev_ng/rage/framework/src/streaming/streamingloader.cpp:2900-2904。关闭路径没有 keep-alive 调用。
  • 非 __NO_OUTPUT 时以 gsysDebug1 记录每个系统的耗时。

1.5 Update(mode) 的执行#

  • 线性查找更新模式,依次调用元素的 Update();未注册的模式直接无操作 src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:469-482。
  • updateElement::Update:若 m_AddTimebar,预算 > 0 时推 PF_PUSH_TIMEBAR_BUDGETED,否则 PF_PUSH_TIMEBAR_DETAIL;调用函数;非 final 下调用 scrThread::CheckIfMonitoredScriptArraySizeHasChanged(name) 检测脚本数组被意外改写 src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:281-311。
  • updateGroup::Update:可选计时条后依次调用子元素(可嵌套)src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:342-370。

1.6 容量常量#

DEFAULT_MAX_SYSTEMS_REGISTERED = 128(只是 Reserve 的初始容量,PushAndGrow 会扩容)、MAX_DEPENDENCY_LEVELS = 32、MAX_NESTED_UPDATE_GROUPS = 32 src/dev_ng/rage/framework/src/fwsys/gameskeleton.h:138-140、src/dev_ng/rage/framework/src/fwsys/gameskeleton.cpp:25。GTAV 实际使用级别 1–6(常量 MAP_LOADED_DEPENDENCY_LEVEL_1..8 中 7、8 未用)src/dev_ng/game/Core/game.cpp:499-506。

2. CGame 生命周期与 g_loadStatus#

CGame 全是静态成员,持有唯一的 gameSkeleton m_GameSkeleton 与 CGameSessionStateMachine m_GameSessionStateMachine src/dev_ng/game/Core/game.h:37-42、src/dev_ng/game/Core/game.cpp:509-510。加载深度由文件静态 g_loadStatus ∈ {GAME_INIT, GAME_INITLEVEL, GAME_INITSESSION} 记录 src/dev_ng/game/Core/game.cpp:522-528。

图中证据:InitLevel 末尾 g_loadStatus = GAME_INITLEVEL src/dev_ng/game/Core/game.cpp:1380;InitSession 末尾 = GAME_INITSESSION src/dev_ng/game/Core/game.cpp:1577;ShutdownSession 开头 = GAME_INITLEVEL src/dev_ng/game/Core/game.cpp:1595;ShutdownLevel 开头 = GAME_INIT src/dev_ng/game/Core/game.cpp:1457;CGame::Shutdown 按当前状态补关会话/关卡 src/dev_ng/game/Core/game.cpp:1204-1209。

函数执行的 skeleton 模式调用者证据
CGame::PreLoadingScreensInit无(直接调用)CApp::InitGamesrc/dev_ng/game/Core/game.cpp:944-1093
CGame::InitINIT_CORECApp::InitGamesrc/dev_ng/game/Core/game.cpp:1099-1182
CGame::InitLevel(level)INIT_BEFORE_MAP_LOADED → CScene::LoadMap → INIT_AFTER_MAP_LOADED会话状态机src/dev_ng/game/Core/game.cpp:1311-1385
CGame::InitSession(level, bLoadingSave)INIT_SESSION会话状态机src/dev_ng/game/Core/game.cpp:1507-1578
CGame::ShutdownSessionSHUTDOWN_SESSION会话状态机、CGame::Shutdownsrc/dev_ng/game/Core/game.cpp:1590-1636
CGame::ShutdownLevelSHUTDOWN_WITH_MAP_LOADED会话状态机、CGame::Shutdownsrc/dev_ng/game/Core/game.cpp:1453-1481
CGame::ShutdownSHUTDOWN_CORECApp::ShutdownGamesrc/dev_ng/game/Core/game.cpp:1187-1237
CGame::Update / RenderCOMMON/FULL/SIMPLE/LANDING_PAGE* 更新模式CApp::RunGame 每帧src/dev_ng/game/Core/game.cpp:3315-3607

注意没有 INIT_LEVEL 式的“关闭关卡前”模式:关卡级系统要么注册在 INIT_BEFORE/AFTER_MAP_LOADED,要么注册在 INIT_SESSION(每次新游戏/读档都会重跑),对应的关闭则落在 SHUTDOWN_WITH_MAP_LOADED 或 SHUTDOWN_SESSION。

3. CGame::PreLoadingScreensInit#

在任何 skeleton 模式执行之前,必须先让加载画面能显示文字。按调用顺序 src/dev_ng/game/Core/game.cpp:944-1093:

  1. g_movieMgr.Init(INIT_CORE)、CRenderer::PreLoadingScreensInit();PC D3D11 临时注销 drawlist 纹理更新函数以规避 Bink 片头的崩溃(注释称“Temp fix”)src/dev_ng/game/Core/game.cpp:946-955。
  2. Orbis 提前加载 NP 公共对话框/派对/NP 库,避免片头视频期间音频破音 src/dev_ng/game/Core/game.cpp:957-962。
  3. CLoadingScreens::Init(LOADINGSCREEN_CONTEXT_INTRO_MOVIE);“渲染线程与片头视频此时已就绪,可以安全加载剩余着色器”→ CShaderLib::Init();恢复纹理更新函数 src/dev_ng/game/Core/game.cpp:964-973。
  4. __BANK 挂接异常/OOM 显示回调;ASSERT_ONLY(sysMemVerifyMainThread = CGame::VerifyMainThread) src/dev_ng/game/Core/game.cpp:975-985。
  5. fwGame::InitClass(rage_new CGtaGameInterface)、INIT_DATAFILEMGR、fwGame::Init()——后者注册框架流式模块(Dwd/Drawable/Txd/Fragment/Cloth/MetaData/MapTypes/MapData 存储),再由 CGtaGameInterface::RegisterStreamingModules 注册游戏模块(PoseMatcher、BlendShape、ClipDictionary、CutScene、Expression、Scaleform、StaticBounds、StreamedScripts、PtFx 资源、NetworkDef、FrameFilter、WaypointRecording、VehicleRecording、ModelInfo、PathFind、PathServer)src/dev_ng/game/Core/game.cpp:987-990、src/dev_ng/rage/framework/src/fwsys/game.cpp:27-58、src/dev_ng/game/Core/game.cpp:558-583。
  6. fwScan::InitClass、脏话过滤器、CStreaming::Init(INIT_CORE)、CMapFileMgr::Init(INIT_CORE) src/dev_ng/game/Core/game.cpp:992-998。
  7. 载入启动数据:DATAFILEMGR.Load("platformcrc:/data/startup") → CFileLoader::AddAllRpfFiles(true) → CFileLoader::InitClass → 可选 contentpatch、update:/content → platformcrc:/data/default;strStreamingEngine::InitLive(-previewfolder) src/dev_ng/game/Core/game.cpp:1000-1026。
  8. CLiveManager::Init(INIT_CORE)、CGenericGameStorage::Init(INIT_CORE)、CProfileSettings::InitClass、CExtraContentWrapper::Init(INIT_CORE);执行标题更新数据补丁组、加载关卡包;CStreaming::LoadStreamingMetaFile/RegisterStreamingFiles、DATAFILEMGR.SnapshotFiles() src/dev_ng/game/Core/game.cpp:1033-1054。
  9. Scaleform 预分配信息与纹理依赖;登记档案变更回调(CGame::InitProfile/ShutdownProfile)并刷新档案;CPauseMenu::SetDefaultValues 按系统语言设默认;CScaleformMgr::Init(INIT_CORE)、CMessages::Init、TheText.Load()、文本补丁;PC CEntitlementManager::Init(0) src/dev_ng/game/Core/game.cpp:1058-1092。

4. CGame::Init 与 CGame::Shutdown#

CGame::Init src/dev_ng/game/Core/game.cpp:1099-1182:

  1. AutoIdInit();RegisterGameSkeletonFunctions()——一次性登记全部模式(第 6、8 节)src/dev_ng/game/Core/game.cpp:1104-1107、src/dev_ng/game/Core/game.cpp:1663-1694。落地页两个更新模式只在 GEN9_LANDING_PAGE_ENABLED && Gen9LandingPageEnabled() 时注册,商城模式只在 COMMERCE_CONTAINER 时注册。
  2. m_GameSessionStateMachine.Init()、rlPresence::AddDelegate(登录状态事件)src/dev_ng/game/Core/game.cpp:1110-1113。
  3. CStreaming::SetKeepAliveCallback(KeepAliveCallback, 50) 并立即调用一次 src/dev_ng/game/Core/game.cpp:1115-1116。KeepAliveCallback 依次做 PC 设备状态检查、CNetwork::Update(true)、CLoadingScreens::KeepAliveUpdate()、g_SysService.UpdateClass();Bank 构建在初始加载阶段若两次调用间隔超过 1 秒会打印上次与本次调用栈 src/dev_ng/game/Core/game.cpp:891-938。50 ms 间隔用于流式加载器的阻塞加载循环,gameSkeleton::Init 中则使用 0.5 s 阈值 src/dev_ng/rage/framework/src/streaming/streamingloader.cpp:2879-2904。
  4. CreateFactories():Ped、Vehicle、PedIntelligence、VehicleIntelligence 工厂(工厂构造函数里初始化 CPed/CVehicle 等池)src/dev_ng/game/Core/game.cpp:588-594。
  5. SAVEGAME.InitClass()、Orbis SaveGameSetup()、fwDecoratorInterface::InitClass、可选马匹系统 src/dev_ng/game/Core/game.cpp:1120-1132。
  6. 在接触任何骨骼之前创建碎片缓存分配器:fragManager::CreateAllocator(),并把 CGameTempAllocator 设为 sysMemManager 的 FragCache 分配器 src/dev_ng/game/Core/game.cpp:1134-1140(见 memory-and-pools.md)。
  7. m_GameSkeleton.Init(INIT_CORE)(启动条 “Init Core”)src/dev_ng/game/Core/game.cpp:1142-1145。
  8. 档案再刷新、SPlayerCardXMLDataManager、Bank 资源可视化与控件、断言构建的字符串 hack、TelemetryInit/CTelemetry::Init src/dev_ng/game/Core/game.cpp:1147-1181。

CGame::Shutdown src/dev_ng/game/Core/game.cpp:1187-1237:遥测与装饰器关闭 → 强制“Loading”渲染函数 → 按 g_loadStatus 补调 ShutdownSession/ShutdownLevel → 完成未决存档、立即写档案 → gRenderThreadInterface.Shutdown()(停止渲染线程,设备回到主线程)→ SHUTDOWN_CORE → 销毁工厂、fwQuadTreeNode 池、SAVEGAME、AutoIdShutdown、fwScan、fwGame。

5. InitLevel / InitSession / ShutdownSession / ShutdownLevel#

5.1 CGame::InitLevel(level)#

src/dev_ng/game/Core/game.cpp:1311-1385

  1. 推进加载进度;随机种子取 sysTimer::GetTicks()(非 final 可 -randomseed),同时设置 fwRandom、CRandomScripts,以及用 seed ^ reverseBits(seed) 设置 CRandomMWCScripts src/dev_ng/game/Core/game.cpp:1314-1327。
  2. NP:设置奖杯启用与存档归属 src/dev_ng/game/Core/game.cpp:1329-1333。
  3. m_GameSkeleton.Init(INIT_BEFORE_MAP_LOADED) → PC CApp::CheckExit() → CScene::LoadMap(level)(非 final 可 -map=<file>)→ CModelIndex::MatchAllModelStrings() → CheckExit → m_GameSkeleton.Init(INIT_AFTER_MAP_LOADED) → CheckExit src/dev_ng/game/Core/game.cpp:1335-1371。
  4. Bank 关卡控件;CLODLightManager::CreateLODLightImapIDXCache();g_loadStatus = GAME_INITLEVEL;Xenon/PS3 的 scratch 分配器置就绪 src/dev_ng/game/Core/game.cpp:1373-1384。

5.2 CGame::InitSession(level, bLoadingAPreviouslySavedGame)#

src/dev_ng/game/Core/game.cpp:1507-1578

  1. m_GameSkeleton.Init(INIT_SESSION) → CStreaming::MarkFirstInitComplete() → CheckExit → 结束启动序列录制(非 final)。
  2. 为动态导航网格设置载具模型索引(注释“no longer necessary”但仍调用)。
  3. 若无主玩家:按 CFileMgr::IsGameInstalled() 选择 gameconfig 中的 m_defaultPlayerName 或 m_defaultProloguePlayerName 在原点创建玩家 src/dev_ng/game/Core/game.cpp:1539-1544。
  4. CNetwork::GetAssetVerifier().Init();在初始化期间跑一次脚本:SetProcessingTheScriptsDuringGameInit(true) → CTheScripts::Process() → 关闭标志 → 强制 keep-alive src/dev_ng/game/Core/game.cpp:1548-1555。
  5. 非读档:DiskCacheSchedule()(函数体在 #if 0 // KS fixme 内,实际为空 src/dev_ng/game/Core/game.cpp:3674-3718)、非 final 读取玩家坐标文件、InitLevelAfterLoadingFromMemoryCard(level)、CNetworkTelemetry::NewGame()。读档时后两步由会话状态机在反序列化后调用 src/dev_ng/game/Core/game.cpp:1557-1569。
  6. g_loadStatus = GAME_INITSESSION。

InitLevelAfterLoadingFromMemoryCard 设置当前关卡索引、Bank 控件、CGenericGameStorage::Init(INIT_AFTER_MAP_LOADED)、清除“开局自动读档”标志;Orbis 上可能在此执行新游戏存档空间检查(阻塞轮询 CGenericGameStorage::Update 并排空 CloudCache/pgStreamer)src/dev_ng/game/Core/game.cpp:1387-1448。

5.3 CGame::ShutdownSession 与 ShutdownLevel#

ShutdownSession src/dev_ng/game/Core/game.cpp:1590-1636:在执行 SHUTDOWN_SESSION 之前先把所有“仍在飞行中”的东西排空——清成就进度、gStreamingRequestList.Finish()、停手柄震动、清空游戏流队列、gRenderThreadInterface.Flush()、pgStreamer::Drain()、中止碎片整理、清输入历史、关航点、中止脚本对话、写档案;最后 StreamingInstall::ClearInstalledThisSession()。

ShutdownLevel src/dev_ng/game/Core/game.cpp:1453-1481:SHUTDOWN_WITH_MAP_LOADED 后断言 CVehicle/CPed/CObject/CDummyObject/CBuilding/CEntityBatch/CGrassBatch/CInteriorInst/CInteriorProxy/CPortalInst 池全部为空;g_uniqueObjectIDGenerator.Reset() 故意不注册到 skeleton,“这样其他系统关闭时 DLC 设备仍然可用”。

6. 系统装配总表:初始化与关闭#

6.1 注册宏#

REGISTER_INIT_CALL / REGISTER_SHUTDOWN_CALL / REGISTER_UPDATE_CALL[_TIMED][_BUDGETTED][_WITH_CATEGORY] / PUSH_UPDATE_GROUP[_BUDGETTED] / POP_UPDATE_GROUP / SET_*_TYPE / SET_CURRENT_DEPENDENCY_LEVEL 是对 m_GameSkeleton 方法的薄封装;USE_PROFILER 时额外为每个回调创建 Profiler::EventDescription(带文件/行号与分类颜色)src/dev_ng/game/Core/game.cpp:1696-1721。_TIMED 系列给单个元素加独立计时条;PUSH_UPDATE_GROUP* 总是带计时条。

6.2 总览矩阵(注册条目数,含条件编译项)#

模式L1L2L3L4L5L6合计执行时机
INIT_CORE671227–––106进程启动一次(CGame::Init)
SHUTDOWN_CORE828131––104进程关闭(CGame::Shutdown,PC 正常退出不执行)
INIT_BEFORE_MAP_LOADED32–––––32每次 InitLevel,加载地图前
INIT_AFTER_MAP_LOADED303––––33每次 InitLevel,加载地图后
SHUTDOWN_WITH_MAP_LOADED30339––45每次 ShutdownLevel
INIT_SESSION590181––114每次新游戏/读档/换关(InitSession)
SHUTDOWN_SESSION137726426128每次 ShutdownSession

计数方法:按下方明细表统计,USE_RAGESEC 的 final/非 final 两种注册只计一次;被 /* */ 或 // 注释掉的注册不计。证据为第 6.4 节各表所附的行号区间。

6.3 跨模式观察#

  • 同一系统在多个模式重复初始化是常态:fwClipSetManager、audNorthAudioEngine、CGtaAnimManager、CNetwork、CVehiclePopulation、CVisualEffects 等在 CORE、地图前/后、SESSION 中多次注册,各自的 Init(mode) 内部按模式分派(见下表行号)。
  • 流式系统的初始化不在 INIT_CORE 里:INIT_CORE 中 CStreaming::Init 的注册被注释掉(src/dev_ng/game/Core/game.cpp:1731),改为 PreLoadingScreensInit 直接调用 CStreaming::Init(INIT_CORE);INIT_SESSION 级别 1 再以 CStreaming::Init 打头,注释“streaming has to be done first since lots of systems depend on it”,且 CVehicleRecordingMgr::Init 必须更早(要在流式注册录像文件之前)src/dev_ng/game/Core/game.cpp:2283-2290。
  • CStreaming::Shutdown 在三个关闭模式中都位于高级别:SHUTDOWN_CORE L4、SHUTDOWN_WITH_MAP_LOADED L4、SHUTDOWN_SESSION L5(注释“systems at a lower dependency need to use the streaming system to shutdown”),其后才释放 Txd/Cloth 存储 src/dev_ng/game/Core/game.cpp:2091-2094、src/dev_ng/game/Core/game.cpp:2263-2276、src/dev_ng/game/Core/game.cpp:2616-2630。
  • 世界实体的拆除分三段:CGameWorld::Shutdown1(会话关闭 L2,删除 ped 等;CPickupManager::Shutdown 紧随其后)、Shutdown2(关卡关闭 L2)、Shutdown3(关卡关闭 L4)src/dev_ng/game/Core/game.cpp:2532-2533、src/dev_ng/game/Core/game.cpp:2253、src/dev_ng/game/Core/game.cpp:2274。
  • 安全模块:USE_RAGESEC 时 rageSecEngine/rageSecGamePluginManager 在 INIT_CORE L3 注册、rageSecEngine::Shutdown 在 SHUTDOWN_CORE L3,TamperActions 在 INIT_CORE L3 与 COMMON_MAIN_UPDATE;其内部逻辑见 ../23-debug-security/security-overview.md。
  • 疑似笔误:GEN9_STANDALONE_ENABLED 下,SHUTDOWN_CORE 用 REGISTER_SHUTDOWN_CALL(CLandingPage::Init, ...) 注册了 Init 而不是关闭函数 src/dev_ng/game/Core/game.cpp:2038。由于 SHUTDOWN_CORE == INIT_CORE == 1,关闭时 CLandingPage::Init 会收到与核心初始化相同的模式值。这表明此处可能是复制粘贴错误(没有运行验证)。

6.4 逐模式明细#

下表由源码逐行整理:“系统名”是传给 atHashString 的名字(gameSkeleton 用它去重),“回调”是被调用的函数,“条件编译”为包裹该行的 #if 条件或 NOTFINAL_ONLY/FINAL_DISPLAY_BAR_ONLY 宏,“行”是 src/dev_ng/game/Core/game.cpp 中的行号(每个级别块的引用链接覆盖该块所有行)。同一级别内的顺序即执行顺序。

INIT_CORE(CGame::RegisterCoreInitFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:1723-1910。

依赖级别 1(src/dev_ng/game/Core/game.cpp:1728-1824)

#系统名回调条件编译行
1InitSystemCDebug::InitSystem1730
2CShaderLibCShaderLib::InitTxd1732
3PostFXPostFX::Init1733
4CGtaAnimManagerCGtaAnimManager::Init1734
5fwClipSetManagerfwClipSetManager::Init1735
6fwExpressionSetManagerfwExpressionSetManager::Init1736
7fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Init1737
8audNorthAudioEngineaudNorthAudioEngine::Init1738
9CCheatCCheat::Init1739
10CClockCClock::Init1740
11CCullZonesCCullZones::Init1741
12CExpensiveProcessDistributerCExpensiveProcessDistributer::Init1742
13CGameLogicCGameLogic::Init1743
14CGen9ExclusiveAssetsCGen9ExclusiveAssets::Init1744
15CutSceneManagerWrapperCutSceneManagerWrapper::Init1746
16CAnimSceneManagerCAnimSceneManager::Init1747
17CNodeViewerCNodeViewer::Init__BANK1749
18CStreamGraphCStreamGraph::Init__BANK1750
19CPortalTrackerCPortalTracker::Init1752
20CNetworkCNetwork::Init1753
21CObjectPopulationNYCObjectPopulationNY::Init1755
22COcclusionCOcclusion::Init1756
23CPickerg_PickerManager.StaticInit__BANK1758
24CPlantMgrCPlantMgr::Init1760
25CShaderHairSortCShaderHairSort::Init1761
26CNetworkTelemetryCNetworkTelemetry::Init1762
27CNetworkDebugTelemetryCNetworkDebugTelemetry::Init!__FINAL1763
28CPopulationStreamingWrapperCPopulationStreamingWrapper::Init1764
29CRendererCRenderer::Init1765
30CReplayMgrCReplayMgr::InitSessionGTA_REPLAY1767
31CContentExportCContentExport::InitRSG_ORBIS1771
32CContentSearchCContentSearch::InitRSG_ORBIS1772
33CContentDeleteCContentDelete::InitRSG_ORBIS1773
34VideoRecordingVideoRecording::InitVIDEO_RECORDING_ENABLED1777
35fwGreatestMomentsfwGreatestMoment::InitGREATEST_MOMENTS_ENABLED1781
36VideoPlaybackVideoPlayback::Initdefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED1785
37VideoPlaybackThumbnailManagerVideoPlaybackThumbnailManager::Initdefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED1786
38CSectorToolsCSectorTools::Init(SECTOR_TOOLS_EXPORT)1790
39CSaveMigrationCSaveMigration::Init1792
40CStatsMgrCStatsMgr::Init1793
41CFrontendStatsMgrCFrontendStatsMgr::Init1794
42CControllerLabelMgrCControllerLabelMgr::Init1795
43CStuntJumpManagerCStuntJumpManager::Init1796
44CTheScriptsCTheScripts::Init1797
45CScriptAreasCScriptAreas::Init1798
46CScriptDebugCScriptDebug::Init1799
47CScriptHudCScriptHud::Init1800
48CScriptPedAIBlipsCScriptPedAIBlips::Init1801
49CTrainCTrain::Init1802
50CWaypointRecordingCWaypointRecording::Init1803
51CVehicleDeformationCVehicleDeformation::TexCacheInit!GPU_DAMAGE_WRITE_ENABLED1805
52CVehicleRecordingMgrCVehicleRecordingMgr::Init1807
53CTaskClassInfoManagerCTaskClassInfoManager::Init1808
54CTuningManagerCTuningManager::Init1809
55CAppDataMgrCAppDataMgr::Init1810
56CNetRespawnMgrCNetRespawnMgr::Init1811
57CAgitatedManagerCAgitatedManager::Init1812
58CScenarioActionManagerCScenarioActionManager::Init1813
59CVehiclePopulationCVehiclePopulation::Init1814
60CPostScanCPostScan::Init1815
61CExtraMetadataMgrCExtraMetadataMgr::ClassInit1816
62BackgroundScriptsBackgroundScripts::InitClass1817
63CIplCullBoxCIplCullBox::Initialise1818
64perfClearingHouseperfClearingHouse::Initialize1819
65CLandingPageCLandingPage::InitGEN9_STANDALONE_ENABLED1821
66CCriminalCareerServiceWrapperCCriminalCareerServiceWrapper::InitGEN9_STANDALONE_ENABLED1823
67CUserEntitlementServiceWrapperCUserEntitlementServiceWrapper::InitGEN9_STANDALONE_ENABLED1824

依赖级别 2(src/dev_ng/game/Core/game.cpp:1828-1844)

#系统名回调条件编译行
1CSceneCScene::Init1831
2MeshBlendManagerMeshBlendManager::Init1832
3CVisualEffectsCVisualEffects::Init1833
4ViewportSystemInitViewportSystemInit1834
5CPhoneMgrCPhoneMgr::Init1835
6CPhotoManagerCPhotoManager::Init1836
7CVolumeManagerCVolumeManager::InitVOLUME_SUPPORT1838
8CLODLightManagerCLODLightManager::Init1840
9CLODLightsCLODLights::Init1841
10AmbientLightsAmbientLights::Init1842
11CGpsCGps::Init1843
12CPedAILodManagerCPedAILodManager::Init1844

依赖级别 3(src/dev_ng/game/Core/game.cpp:1847-1906)

#系统名回调条件编译行
1CPauseMenuCPauseMenu::Init1849
2cStoreScreenMgrcStoreScreenMgr::Init1850
3CVideoEditorUiCVideoEditorUi::InitGTA_REPLAY1852
4WatermarkRendererWatermarkRenderer::InitGTA_REPLAY1853
5CMousePointerCMousePointer::InitRSG_PC1856
6CTextInputBoxCTextInputBox::InitRSG_PC1857
7TamperActionsTamperActions::InitTAMPERACTIONS_ENABLED1860
8CMiniMapCMiniMap::Init1863
9CNewHudCNewHud::Init1864
10CHudMarkerManagerCHudMarkerManager::Init1865
11WarningScreenCWarningScreen::Init1866
12CBusySpinnerCBusySpinner::Init1867
13camManagercamManager::Init1868
14CDLCScriptCDLCScript::Init1869
15CGameStreamMgrCGameStreamMgr::Init1874
16CDebugCDebug::Init!__FINAL1877
17CDebugProfilerCDebug::InitProfiler!__FINAL1878
18CDebugBarCDebugBar::InitFINAL_DISPLAY_BAR1880
19EndUserBenchmarksEndUserBenchmarks::InitCOLLECT_END_USER_BENCHMARKS1883
20Marketing ToolsCMarketingTools::Init__BANK1887
21fwMetaDataStorefwMetaDataStore::Init1889
22CDebugVideoEditorScreenCDebugVideoEditorScreen::InitGTA_REPLAY && __BANK1893
23CReplayCoordinatorCReplayCoordinator::InitGTA_REPLAY1895
24CVideoEditorInterfaceCVideoEditorInterface::InitGTA_REPLAY1896
25UI3DDrawManagerUI3DDrawManager::ClassInit1899
26(安全模块)rageSecEngine::InitUSE_RAGESEC1905
27(安全模块)rageSecGamePluginManager::InitUSE_RAGESEC1906

SHUTDOWN_CORE(CGame::RegisterCoreShutdownFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:1912-2095。

依赖级别 1(src/dev_ng/game/Core/game.cpp:1917-2040)

#系统名回调条件编译行
1CExtraContentWrapper::ShutdownStartCExtraContentWrapper::ShutdownStart1919
2BackgroundScriptsBackgroundScripts::ShutdownClass1920
3CExtraMetadataMgrCExtraMetadataMgr::ClassShutdown1921
4CPostScanCPostScan::Shutdown1922
5CVehiclePopulationCVehiclePopulation::Shutdown1923
6CSectorToolsCSectorTools::Shutdown(SECTOR_TOOLS_EXPORT)1925
7fwClipSetManagerfwClipSetManager::Shutdown1927
8fwExpressionSetManagerfwExpressionSetManager::Shutdown1928
9fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Shutdown1929
10CGen9ExclusiveAssetsCGen9ExclusiveAssets::Shutdown1930
11CAnimSceneManagerCAnimSceneManager::Shutdown1931
12camManagercamManager::Shutdown1932
13CutSceneManagerCutSceneManagerWrapper::Shutdown1933
14CCreditsCCredits::Shutdown1934
15CExplosionManagerCExplosionManager::Shutdown1935
16CGenericGameStorageCGenericGameStorage::Shutdown1936
17CLoadingScreensCLoadingScreens::Shutdown1937
18CMessagesCMessages::Shutdown1938
19CNetworkCNetwork::Shutdown1939
20CNodeViewerCNodeViewer::Shutdown__BANK1941
21CStreamGraphCStreamGraph::Shutdown__BANK1942
22CPortalTrackerCPortalTracker::ShutDown1944
23CMovieMeshManagerCMovieMeshManager::Shutdown1945
24CObjectPopulationNYCObjectPopulationNY::Shutdown1946
25COcclusionCOcclusion::Shutdown1947
26CPhoneMgrCPhoneMgr::Shutdown1948
27CPhotoManagerCPhotoManager::Shutdown1949
28CPlantMgrCPlantMgr::Shutdown1950
29CNetworkTelemetryCNetworkTelemetry::Shutdown1951
30CNetworkDebugTelemetryCNetworkDebugTelemetry::Shutdown!__FINAL1952
31CSprite2dCSprite2d::Shutdown1953
32CSaveMigrationCSaveMigration::Shutdown1954
33CStatsMgrCStatsMgr::Shutdown1955
34CFrontendStatsMgrCFrontendStatsMgr::Shutdown1956
35CStuntJumpManagerCStuntJumpManager::Shutdown1957
36CTheScriptsCTheScripts::Shutdown1958
37CScriptAreasCScriptAreas::Shutdown1959
38CScriptDebugCScriptDebug::Shutdown1960
39CScriptHudCScriptHud::Shutdown1961
40CScriptPedAIBlipsCScriptPedAIBlips::Shutdown1962
41CVehicleDeformationCVehicleDeformation::TexCacheShutdown!GPU_DAMAGE_WRITE_ENABLED1966
42CVisualEffectsCVisualEffects::Shutdown1968
43VideoRecordingVideoRecording::ShutdownVIDEO_RECORDING_ENABLED1971
44fwGreatestMomentsfwGreatestMoment::ShutdownGREATEST_MOMENTS_ENABLED1975
45VideoPlaybackVideoPlayback::Shutdowndefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED1979
46VideoPlaybackThumbnailManagerVideoPlaybackThumbnailManager::Shutdowndefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED1980
47CContentExportCContentExport::ShutdownRSG_ORBIS1984
48CContentSearchCContentSearch::ShutdownRSG_ORBIS1985
49CContentDeleteCContentDelete::ShutdownRSG_ORBIS1986
50CReplayMgrCReplayMgr::ShutdownSessionGTA_REPLAY1989
51CVolumeManagerCVolumeManager::ShutdownVOLUME_SUPPORT1993
52ViewportSystemShutdownViewportSystemShutdown1995
53CRendererCRenderer::Shutdown1996
54CBusySpinnerCBusySpinner::Shutdown1997
55CNewHudCNewHud::Shutdown1998
56CMiniMapCMiniMap::Shutdown1999
57CHudMarkerManagerCHudMarkerManager::Shutdown2000
58CGameStreamMgrCGameStreamMgr::Shutdown2001
59CMultiplayerChatCMultiplayerChat::ShutdownRSG_PC2003
60CMousePointerCMousePointer::ShutdownRSG_PC2004
61CTextInputBoxCTextInputBox::ShutdownRSG_PC2005
62CVideoEditorUiCVideoEditorUi::ShutdownGTA_REPLAY2008
63WatermarkRendererWatermarkRenderer::ShutdownGTA_REPLAY2009
64CPauseMenuCPauseMenu::Shutdown2011
65cStoreScreenMgrcStoreScreenMgr::Shutdown2012
66CVehicleRecordingMgrCVehicleRecordingMgr::Shutdown2013
67CWaypointRecordingCWaypointRecording::Shutdown2014
68CTaskClassInfoManagerCTaskClassInfoManager::Shutdown2015
69CTuningManagerCTuningManager::Shutdown2016
70CAppDataMgrCAppDataMgr::Shutdown2017
71CNetRespawnMgrCNetRespawnMgr::Shutdown2018
72CAgitatedManagerCAgitatedManager::Shutdown2019
73CScenarioActionManagerCScenarioActionManager::Shutdown2020
74CDebugVideoEditorScreenCDebugVideoEditorScreen::ShutdownGTA_REPLAY && __BANK2024
75CReplayCoordinatorCReplayCoordinator::ShutdownGTA_REPLAY2026
76CVideoEditorInterfaceCVideoEditorInterface::ShutdownGTA_REPLAY2027
77UI3DDrawManagerUI3DDrawManager::ClassShutdown2030
78audNorthAudioEngineaudNorthAudioEngine::Shutdown2032
79CEntitlementManagerCEntitlementManager::ShutdownRSG_ENTITLEMENT_ENABLED2035
80CLandingPageCLandingPage::InitGEN9_STANDALONE_ENABLED2038
81CCriminalCareerServiceWrapperCCriminalCareerServiceWrapper::ShutdownGEN9_STANDALONE_ENABLED2039
82CUserEntitlementServiceWrapperCUserEntitlementServiceWrapper::ShutdownGEN9_STANDALONE_ENABLED2040

依赖级别 2(src/dev_ng/game/Core/game.cpp:2044-2055)

#系统名回调条件编译行
1CGameWorldHeightMapCGameWorldHeightMap::Shutdown2046
2CGameWorldWaterHeightCGameWorldWaterHeight::Shutdown2047
3CTextCText::Shutdown2049
4CSceneCScene::Shutdown2050
5MeshBlendManagerMeshBlendManager::Shutdown2051
6CStreamingRequestListCStreamingRequestList::Shutdown2052
7CGpsCGps::Shutdown2054
8CPedAILodManagerCPedAILodManager::Shutdown2055

依赖级别 3(src/dev_ng/game/Core/game.cpp:2060-2088)

#系统名回调条件编译行
1CTextTemplateCTextTemplate::CoreShutdownGTA_REPLAY2063
2CScaleformMgrCScaleformMgr::Shutdown2065
3EndUserBenchmarksEndUserBenchmarks::ShutdownCOLLECT_END_USER_BENCHMARKS2068
4(安全模块)rageSecEngine::ShutdownUSE_RAGESEC2075
5CDebugCDebug::Shutdown!__FINAL2079
6fwMetaDataStorefwMetaDataStore::ShutdownSystem2081
7CGtaAnimManagerCGtaAnimManager::Shutdown2082
8fwDwdStoreWrapperfwDwdStoreWrapper::Shutdown2083
9fwDrawawableStoreWrapperfwDrawableStoreWrapper::Shutdown2084
10fwFragmentStoreWrapperfwFragmentStoreWrapper::Shutdown2085
11fwTxdStorefwTxdStoreWrapper::Shutdown2086
12fwClothStorefwClothStoreWrapper::Shutdown2087
13CExtraContentWrapper::ShutdownCExtraContentWrapper::Shutdown2088

依赖级别 4(src/dev_ng/game/Core/game.cpp:2091-2093)

#系统名回调条件编译行
1CStreamingCStreaming::Shutdown2093

INIT_BEFORE_MAP_LOADED(CGame::RegisterBeforeMapLoadedInitFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2097-2144。

依赖级别 1(src/dev_ng/game/Core/game.cpp:2101-2142)

#系统名回调条件编译行
1CBlockViewCBlockView::Init!__FINAL2104
2CGtaAnimManagerCGtaAnimManager::Init2107
3CGameWorldCGameWorld::Init2108
4CGaragesCGarages::Init2109
5CHandlingDataMgrCHandlingDataMgr::Init2110
6INSTANCESTORECInstanceStoreWrapper::Init2111
7CMapAreasCMapAreas::Init2112
8fwMapTypesStoreCMapTypesStoreWrapper::Init2113
9CModelInfoCModelInfo::Init2114
10CPatrolRoutesCPatrolRoutes::Init2115
11CPopZonesCPopZones::Init2116
12CMapZoneManagerCMapZoneManager::Init2117
13CPhysicsCPhysics::Init2118
14CTrainCTrain::Init2119
15WaterWater::Init2120
16COcclusionCOcclusion::Init2121
17fwClipSetManagerfwClipSetManager::Init2122
18fwExpressionSetManagerfwExpressionSetManager::Init2123
19fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Init2124
20CTVPlaylistManagerCTVPlaylistManager::Init2126
21CAmbientModelSetManagerCAmbientModelSetManager::InitClass2128
22CLadderMetadataManagerCLadderMetadataManager::Init2129
23CScenarioManagerCScenarioManager::Init2130
24CConditionalAnimManagerCConditionalAnimManager::Init2131
25CVehicleMetadataMgrCVehicleMetadataMgr::Init2132
26CRandomEventManagerCRandomEventManager::Init2134
27CCrimeInformationManagerCCrimeInformationManager::Init2135
28CWitnessInformationManagerCWitnessInformationManager::Init2136
29CPortalCPortal::Init2138
30LightEntityMgrLightEntityMgr::Init2139
31AnimBlackboardCAnimBlackboard::Init2140
32CPathServer::InitBeforeMapLoadedCPathServer::InitBeforeMapLoaded2142

INIT_AFTER_MAP_LOADED(CGame::RegisterAfterMapLoadedInitFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2146-2200。

依赖级别 1(src/dev_ng/game/Core/game.cpp:2150-2189)

#系统名回调条件编译行
1audNorthAudioEngineaudNorthAudioEngine::Init2152
2CClockCClock::Init2153
3CEventDataManagerCEventDataManager::Init2154
4CHandlingDataMgrCHandlingDataMgr::Init2155
5CMapAreasCMapAreas::Init2156
6CPedCPed::Init2157
7CPopCycleCPopCycle::Init2158
8CPopZonesCPopZones::Init2159
9CMapZoneManagerCMapZoneManager::Init2160
10CPopulationStreamingWrapperCPopulationStreamingWrapper::Init2161
11CStatsMgrCStatsMgr::Init2165
12CStreamingRequestListCStreamingRequestList::Init2166
13CTaskCTask::Init2167
14CTrainCTrain::Init2168
15CVehicleModelInfoCVehicleModelInfo::InitClass2169
16CVehiclePopulationCVehiclePopulation::Init2170
17WaterWater::Init2171
18CGameWorldHeightMapCGameWorldHeightMap::Init2172
19CGameWorldWaterHeightCGameWorldWaterHeight::Init2173
20CAmbientAnimationManagerCAmbientAnimationManager::Init2174
21CAmbientAudioManagerCAmbientAudioManager::Init2175
22CNetworkCNetwork::Init2176
23fwClipSetManagerfwClipSetManager::Init2177
24fwAnimDirectorfwAnimDirector::InitStatic2178
25fwExpressionSetManagerfwExpressionSetManager::Init2179
26fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Init2180
27CThePopMultiplierAreasCThePopMultiplierAreas::Init2181
28MeshBlendManagerMeshBlendManager::Init2182
29CPlantTuningCPlantTuning::InitNORTH_CLOTHS2186
30CProceduralInfoCProceduralInfoWrapper::Init2189

依赖级别 2(src/dev_ng/game/Core/game.cpp:2192-2198)

#系统名回调条件编译行
1CVisualEffectsCVisualEffects::Init2194
2CVolumeManagerCVolumeManager::InitVOLUME_SUPPORT2196
3CPedModelInfoCPedModelInfo::InitClass2198

SHUTDOWN_WITH_MAP_LOADED(CGame::RegisterAfterMapLoadedShutdownFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2202-2277。

依赖级别 1(src/dev_ng/game/Core/game.cpp:2206-2246)

#系统名回调条件编译行
1CDLCScriptCDLCScript::Shutdown2208
2CStatsMgrCStatsMgr::Shutdown2209
3CNetworkCNetwork::Shutdown2210
4CPhysicsCPhysics::Shutdown2211
5fwClipSetManagerfwClipSetManager::Shutdown2213
6fwAnimDirectorfwAnimDirector::ShutdownStatic2214
7CVisualEffectsCVisualEffects::Shutdown2215
8CVolumeManagerCVolumeManager::ShutdownVOLUME_SUPPORT2217
9CVehiclePopulationCVehiclePopulation::Shutdown2219
10CTrainCTrain::Shutdown2220
11CReplayMgrCReplayMgr::ShutdownSessionGTA_REPLAY2222
12CPedVariationPackCPedVariationPack::Shutdown2227
13CPedModelInfoCPedModelInfo::ShutdownClass2228
14CHandlingDataMgrCHandlingDataMgr::Shutdown2230
15CEventDataManagerCEventDataManager::Shutdown2231
16CGtaAnimManagerCGtaAnimManager::Shutdown2232
17CAmbientAudioManagerCAmbientAudioManager::Shutdown2233
18CAmbientAnimationManagerCAmbientAnimationManager::Shutdown2234
19CWitnessInformationManagerCWitnessInformationManager::Shutdown2235
20CCrimeInformationManagerCCrimeInformationManager::Shutdown2236
21CRandomEventManagerCRandomEventManager::Shutdown2237
22CAmbientModelSetManagerCAmbientModelSetManager::ShutdownClass2238
23CLadderMetadataManagerCLadderMetadataManager::Shutdown2239
24CConditionalAnimManagerCConditionalAnimManager::Shutdown2240
25camManagercamManager::Shutdown2241
26audNorthAudioEngineaudNorthAudioEngine::Shutdown2242
27WaterWater::Shutdown2243
28CVehicleRecordingMgrCVehicleRecordingMgr::Shutdown2244
29CPopulationStreamingWrapperCPopulationStreamingWrapper::Shutdown2245
30CAnimBlackboardCAnimBlackboard::Shutdown2246

依赖级别 2(src/dev_ng/game/Core/game.cpp:2249-2253)

#系统名回调条件编译行
1CVehicleMetadataMgrCVehicleMetadataMgr::Shutdown2251
2CVehicleModelInfoCVehicleModelInfo::ShutdownClass2252
3CGameWorld 2CGameWorld::Shutdown22253

依赖级别 3(src/dev_ng/game/Core/game.cpp:2256-2260)

#系统名回调条件编译行
1CModelInfoCModelInfo::Shutdown2258
2CScenarioManagerCScenarioManager::Shutdown2259
3CTaskCTask::Shutdown2260

依赖级别 4(src/dev_ng/game/Core/game.cpp:2263-2275)

#系统名回调条件编译行
1INSTANCESTORE 2CInstanceStoreWrapper::Shutdown22265
2fwMapTypesStore 2CMapTypesStoreWrapper::Shutdown22266
3fwDrawawableStoreWrapperfwDrawableStoreWrapper::Shutdown2267
4fwFragmentStoreWrapperfwFragmentStoreWrapper::Shutdown2268
5fwDwdStorefwDwdStoreWrapper::Shutdown2269
6CBlockViewCBlockView::Shutdown!__FINAL2271
7fwTxdStorefwTxdStoreWrapper::Shutdown2273
8CGameWorld 3CGameWorld::Shutdown32274
9CStreamingCStreaming::Shutdown2275

INIT_SESSION(CGame::RegisterSessionInitFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2279-2437。

依赖级别 1(src/dev_ng/game/Core/game.cpp:2283-2289)

#系统名回调条件编译行
1CVehicleRecordingMgrCVehicleRecordingMgr::Init2285
2CStreamingCStreaming::Init2286
3CFocusEntityMgrCFocusEntityMgr::Init2287
4audNorthAudioEngineaudNorthAudioEngine::Init2288
5CGtaAnimManagerCGtaAnimManager::Init2289

依赖级别 2(src/dev_ng/game/Core/game.cpp:2292-2402)

#系统名回调条件编译行
1CModelInfo::InitCModelInfo::Init2294
2CInstanceListAssetLoader::InitCInstanceListAssetLoader::InitKEEP_INSTANCELIST_ASSETS_RESIDENT2297
3CTaskCTask::Init2300
4CScenarioPointManagerInitSessionCScenarioPointManager::InitSession2301
5CRenderPhaseCascadeShadowsInterfaceCRenderPhaseCascadeShadowsInterface::Init_2302
6fwAnimDirectorfwAnimDirector::InitStatic2303
7fwClipSetManagerfwClipSetManager::Init2304
8fwExpressionSetManagerfwExpressionSetManager::Init2305
9fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Init2306
10CTaskRecoverCTaskGetUp::InitMetadata2307
11CTargetSequenceManagerCTargetSequenceManager::InitMetadataUSE_TARGET_SEQUENCES2309
12camManagercamManager::Init2311
13CAssistedMovementRouteStoreCAssistedMovementRouteStore::Init2312
14CBusesCBuses::Init2313
15CCheatCCheat::Init2314
16CControlMgrCControlMgr::Init2315
17CGameLogicCGameLogic::Init2316
18CGameWorldCGameWorld::Init2317
19CGaragesCGarages::Init2318
20CGpsCGps::Init2319
21CJunctionsCJunctions::Init2320
22CPathZoneManagerCPathZoneManager::Init2321
23CMessagesCMessages::Init2322
24CNetworkCNetwork::Init2323
25CObjectPopulationNYCObjectPopulationNY::Init2324
26CPathFindCPathFindWrapper::Init2325
27CPedCPed::Init2326
28CPedModelInfoCPedModelInfo::InitClass2327
29CPedPopulationCPedPopulation::Init2328
30CPerformanceCPerformance::Init2329
31CPedAILodManagerCPedAILodManager::Init2330
32CVehicleAILodManagerCVehicleAILodManager::Init2331
33CPhoneMgrCPhoneMgr::Init2332
34CPhotoManagerCPhotoManager::Init2333
35CPhysicsCPhysics::Init2334
36CPickerg_PickerManager.StaticInit__BANK2336
37CPickupManagerCPickupManager::Init2338
38CNetworkTelemetryCNetworkTelemetry::Init2339
39CNetworkDebugTelemetryCNetworkDebugTelemetry::Init!__FINAL2340
40CPopCycleCPopCycle::Init2341
41CProcObjectManCProcObjectManWrapper::Init2342
42CReplayMgrCReplayMgr::InitSessionGTA_REPLAY2347
43CRestartCRestart::Init2349
44CScaleformMgrCScaleformMgr::Init2350
45CSlownessZonesManagerCSlownessZoneManager::Init2351
46CStreamingRequestListCStreamingRequestList::Init2352
47CStuntJumpManagerCStuntJumpManager::Init2353
48CActionManagerCActionManager::Init2354
49CRenderTargetMgrCRenderTargetMgr::InitClass2355
50CTheScriptsCTheScripts::Init2356
51CScriptAreasCScriptAreas::Init2357
52CScriptCarsCScriptCars::Init2358
53CScriptPedsCScriptPeds::Init2359
54CScriptEntitiesCScriptEntities::Init2360
55CScriptDebugCScriptDebug::Init2361
56CScriptHudCScriptHud::Init2362
57CScriptPedAIBlipsCScriptPedAIBlips::Init2363
58CStatsMgrCStatsMgr::Init2364
59CTrainCTrain::Init2365
60CUserDisplayCUserDisplay::Init2366
61CVehiclePopulationCVehiclePopulation::Init2367
62CVisualEffectsCVisualEffects::Init2368
63CVolumeManagerCVolumeManager::InitVOLUME_SUPPORT2370
64CDispatchDataCDispatchData::Init2372
65CRoadBlockCRoadBlock::Init2373
66CWeaponManagerCWeaponManager::Init2374
67CScriptedGunTaskMetadataMgrCScriptedGunTaskMetadataMgr::Init2375
68CVehicleCombatAvoidanceAreaCVehicleCombatAvoidanceArea::Init2376
69CCombatInfoMgrCCombatInfoMgr::Init2377
70CCombatDirectorCCombatDirector::Init2378
71CVehicleChaseDirectorCVehicleChaseDirector::Init2379
72CBoatChaseDirectorCBoatChaseDirector::Init2380
73CTacticalAnalysisCTacticalAnalysis::Init2381
74CCoverFinderCCoverFinder::Init2382
75CWorldPointsCWorldPoints::Init2383
76fwTimerCGame::TimerInit2384
77PostFXPostFX::Init2385
78CRendererCRenderer::Init2386
79ViewportSystemInitLevelViewportSystemInit2387
80CGameSituationCGameSituation::Init2388
81CPrioritizedClipSetRequestManagerCPrioritizedClipSetRequestManager::Init2389
82CPrioritizedClipSetStreamerCPrioritizedClipSetStreamer::Init2390
83CSituationalClipSetStreamerCSituationalClipSetStreamer::Init2391
84CClipDictionaryStoreInterfaceCClipDictionaryStoreInterface::Init2392
85CRiotsCRiots::Init2393
86CCoverCCover::InitSession2394
87CExtraMetadataMgr::ClassInitCExtraMetadataMgr::ClassInit2395
88BackgroundScriptsBackgroundScripts::InitClass2396
89CAILogManagerCAILogManager::InitAI_DEBUG_OUTPUT_ENABLED2398
90CJetpackManagerCJetpackManager::InitENABLE_JETPACK2402

依赖级别 3(src/dev_ng/game/Core/game.cpp:2406-2428)

#系统名回调条件编译行
1CTextCText::Init2408
2CMiniMapCMiniMap::Init2409
3CNewHudCNewHud::Init2410
4CHudMarkerManagerCHudMarkerManager::Init2411
5CBusySpinnerCBusySpinner::Init2412
6CMultiplayerChatCMultiplayerChat::InitRSG_PC2415
7CExplosionManagerCExplosionManager::Init2417
8CPickupDataManagerCPickupDataManager::Init2418
9CPopulationStreamingCPopulationStreamingWrapper::Init2419
10CDecoratorInterfaceCDecoratorInterface::Init2420
11CScenarioManagerCScenarioManager::Init2421
12CGestureManagerCGestureManager::Init2422
13CTexLodCTexLod::InitSession2423
14CPathServer::InitSessionCPathServer::InitSession2424
15CPauseMenuCPauseMenu::Init2425
16CExtraContentWrapperCExtraContentWrapper::Init2426
17CDLCScriptCDLCScript::Init2427
18audNorthAudioEngineDLCaudNorthAudioEngine::DLCInit2428

依赖级别 4(src/dev_ng/game/Core/game.cpp:2432-2434)

#系统名回调条件编译行
1CScaleformMgr::PreallocTestCScaleformMgr::PreallocTest__DEV2434

SHUTDOWN_SESSION(CGame::RegisterSessionShutdownFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2439-2631。

依赖级别 1(src/dev_ng/game/Core/game.cpp:2443-2461)

#系统名回调条件编译行
1CExtraContentWrapper::ShutdownStartCExtraContentWrapper::ShutdownStart2445
2BackgroundScriptsBackgroundScripts::ShutdownClass2446
3CDLCScriptCDLCScript::Shutdown2447
4CStatsMgrCStatsMgr::Shutdown2448
5CCompEntityCCompEntity::Shutdown2449
6CProcObjectManCProcObjectManWrapper::Shutdown2450
7audNorthAudioEngineaudNorthAudioEngine::Shutdown2451
8decoratorsdecorator_commands::Shutdown2452
9CConditionalAnimManagerCConditionalAnimManager::Shutdown2453
10CAmbientModelSetManagerCAmbientModelSetManager::ShutdownClass2454
11CScenarioPointManagerCScenarioPointManager::ShutdownSession2455
12CPlayerSwitchDbgCPlayerSwitchDbg::Shutdown__BANK2458
13CPlayerSwitchCPlayerSwitch::Shutdown2461

依赖级别 2(src/dev_ng/game/Core/game.cpp:2464-2566)

#系统名回调条件编译行
1CAILogManagerCAILogManager::ShutDownAI_DEBUG_OUTPUT_ENABLED2467
2CClipDictionaryStoreInterfaceCClipDictionaryStoreInterface::Shutdown2469
3CSituationalClipSetStreamerCSituationalClipSetStreamer::Shutdown2470
4CPrioritizedClipSetStreamerCPrioritizedClipSetStreamer::Shutdown2471
5CGameSituationCGameSituation::Shutdown2472
6ViewportSystemShutdownLevelViewportSystemShutdown2473
7CWorldPointsCWorldPoints::Shutdown2474
8CWaypointRecordingCWaypointRecording::Shutdown2475
9CVehiclePopulationCVehiclePopulation::Shutdown2476
10CVehicleModelInfoCVehicleModelInfo::ShutdownClass2477
11CPedVariationStreamCPedVariationStream::ShutdownSession2478
12CutSceneManagerWrapperCutSceneManagerWrapper::Shutdown2479
13CRenderTargetMgrCRenderTargetMgr::ShutdownClass2480
14CTheScriptsCTheScripts::Shutdown2481
15CScriptAreasCScriptAreas::Shutdown2482
16CScriptDebugCScriptDebug::Shutdown2483
17CScriptHudCScriptHud::Shutdown2484
18CScriptPedAIBlipsCScriptPedAIBlips::Shutdown2485
19CStuntJumpManagerCStuntJumpManager::Shutdown2486
20CStreamingRequestListCStreamingRequestList::Shutdown2487
21CRestartCRestart::Shutdown2488
22CRendererCRenderer::Shutdown2489
23LightEntityMgrLightEntityMgr::Shutdown2493
24CPortalCPortal::Shutdown2494
25CPlayStatsCNetworkTelemetry::Shutdown2495
26CNetworkDebugTelemetryCNetworkDebugTelemetry::Shutdown!__FINAL2496
27CPlantMgrCPlantMgr::Shutdown2497
28CPickerg_PickerManager.StaticShutdown__BANK2499
29CPhysicsCPhysics::Shutdown2501
30CPhoneMgrCPhoneMgr::Shutdown2502
31CPhotoManagerCPhotoManager::Shutdown2503
32CPerformanceCPerformance::Shutdown2504
33CPedPopulationCPedPopulation::Shutdown2505
34CPedModelInfoCPedModelInfo::ShutdownClass2506
35CPedGeometryAnalyserCPedGeometryAnalyser::Shutdown2507
36CHandlingDataMgrCHandlingDataMgr::Shutdown2508
37CPatrolRoutesCPatrolRoutes::Shutdown2509
38CPathFindCPathFindWrapper::Shutdown2510
39CMovieMeshManagerCMovieMeshManager::Shutdown2511
40CObjectPopulationNYCObjectPopulationNY::Shutdown2512
41CNetworkCNetwork::Shutdown2513
42CReplayMgrCReplayMgr::ShutdownSessionGTA_REPLAY2515
43INSTANCESTORE 1CInstanceStoreWrapper::Shutdown12517
44fwMapTypesStore 1CMapTypesStoreWrapper::Shutdown12518
45CBusySpinnerCBusySpinner::Shutdown2520
46CNewHudCNewHud::Shutdown2521
47CMiniMapCMiniMap::Shutdown2522
48CHudMarkerManagerCHudMarkerManager::Shutdown2523
49CVideoEditorUiCVideoEditorUi::ShutdownGTA_REPLAY2525
50WatermarkRendererWatermarkRenderer::ShutdownGTA_REPLAY2526
51CPauseMenuCPauseMenu::Shutdown2528
52cStoreScreenMgrcStoreScreenMgr::Shutdown2529
53CGenericGameStorageCGenericGameStorage::Shutdown2530
54CGaragesCGarages::Shutdown2531
55CGameWorld 1CGameWorld::Shutdown12532
56CPickupManagerCPickupManager::Shutdown2533
57CGameLogicCGameLogic::Shutdown2534
58CCreditsCCredits::Shutdown2535
59CBusesCBuses::Shutdown2536
60CAssistedMovementRouteStoreCAssistedMovementRouteStore::Shutdown2537
61CAnimViewerCAnimViewer::Shutdown__BANK2539
62fwClipSetManagerfwClipSetManager::Shutdown2541
63fwExpressionSetManagerfwExpressionSetManager::Shutdown2542
64fwFacialClipSetGroupManagerfwFacialClipSetGroupManager::Shutdown2543
65CTVPlaylistManagerCTVPlaylistManager::Shutdown2545
66CLODLightManagerCLODLightManager::Shutdown2547
67CLODLightsCLODLights::Shutdown2548
68AmbientLightsAmbientLights::Shutdown2549
69CTaskRecoverCTaskGetUp::ShutdownMetadata2551
70CTargetSequenceManagerCTargetSequenceManager::ShutdownMetadataUSE_TARGET_SEQUENCES2553
71fwAnimDirectorfwAnimDirector::ShutdownStatic2555
72camManagercamManager::Shutdown2556
73CJunctionsCJunctions::Shutdown2557
74CPadGestureMgrCPadGestureMgr::Shutdown__PPU2559
75CDebugSceneCDebugScene::ShutdownModelViewer__DEV2562
76CRiotsCRiots::Shutdown2565
77CPrioritizedClipSetRequestManagerCPrioritizedClipSetRequestManager::Shutdown2566

依赖级别 3(src/dev_ng/game/Core/game.cpp:2569-2602)

#系统名回调条件编译行
1CVolumeManagerCVolumeManager::ShutdownVOLUME_SUPPORT2572
2CVehicleRecordingMgrCVehicleRecordingMgr::Shutdown2574
3CVehicleCombatAvoidanceAreaCVehicleCombatAvoidanceArea::Shutdown2575
4CCombatInfoMgrCCombatInfoMgr::Shutdown2576
5CTacticalAnalysisCTacticalAnalysis::Shutdown2577
6CBoatChaseDirectorCBoatChaseDirector::Shutdown2578
7CVehicleChaseDirectorCVehicleChaseDirector::Shutdown2579
8CCombatDirectorCCombatDirector::Shutdown2580
9CCoverFinderCCoverFinder::Shutdown2581
10CScriptedGunTaskMetadataMgrCScriptedGunTaskMetadataMgr::Shutdown2582
11CRoadBlockCRoadBlock::Shutdown2583
12CWeaponManagerCWeaponManager::Shutdown2584
13CPickupDataManagerCPickupDataManager::Shutdown2585
14CPopulationStreamingCPopulationStreamingWrapper::Shutdown2586
15CPedCPed::Shutdown2587
16CZonedAssetManagerCZonedAssetManager::Shutdown2588
17CInstanceListAssetLoader::ShutdownCInstanceListAssetLoader::ShutdownKEEP_INSTANCELIST_ASSETS_RESIDENT2591
18CModelInfoCModelInfo::Shutdown2593
19CGestureManagerCGestureManager::Shutdown2594
20CGtaAnimManagerCGtaAnimManager::Shutdown2595
21CRenderThreadInterfaceCGtaRenderThreadGameInterface::ShutdownLevel2596
22CDecoratorInterfaceCDecoratorInterface::Shutdown2597
23CScenarioManagerCScenarioManager::Shutdown2598
24CTexLodCTexLod::ShutdownSession2599
25CPathServer::ShutdownSessionCPathServer::ShutdownSession2600
26CJetpackManagerCJetpackManager::ShutdownENABLE_JETPACK2602

依赖级别 4(src/dev_ng/game/Core/game.cpp:2606-2613)

#系统名回调条件编译行
1CVisualEffectsCVisualEffects::Shutdown2608
2CTextTemplateCTextTemplate::CoreShutdownGTA_REPLAY2610
3CScaleformMgrCScaleformMgr::Shutdown2612
4CStaticBoundsStorefwStaticBoundsStoreWrapper::Shutdown2613

依赖级别 5(src/dev_ng/game/Core/game.cpp:2616-2619)

#系统名回调条件编译行
1CStreamingCStreaming::Shutdown2618
2CTrainCTrain::Shutdown2619

依赖级别 6(src/dev_ng/game/Core/game.cpp:2622-2629)

#系统名回调条件编译行
1fwTxdStorefwTxdStoreWrapper::Shutdown2624
2fwClothStorefwClothStoreWrapper::Shutdown2625
3MeshBlendManagerMeshBlendManager::Shutdown2626
4CExtraContentWrapper::ShutdownCExtraContentWrapper::Shutdown2627
5CExtraMetadataMgr::ShutdownDLCMetaFilesCExtraMetadataMgr::ShutdownDLCMetaFiles2628
6CExtraMetadataMgr::ClassShutdownCExtraMetadataMgr::ClassShutdown2629

7. 一帧的完整时序#

图中证据:

  • RunGame 的调用顺序:src/dev_ng/game/Core/app.cpp:1343-1370、src/dev_ng/game/Core/app.cpp:1377-1385、src/dev_ng/game/Core/app.cpp:1440-1456
  • CSystem::BeginUpdate 内 fwTimer::Update():src/dev_ng/game/system/system.cpp:1024-1045
  • CGame::Update 各步骤:src/dev_ng/game/Core/game.cpp:3365-3521
  • GPU_IdleSection/Synchronise 及安全区:src/dev_ng/rage/framework/src/fwrenderer/renderthread.cpp:377-496
  • CGame::Render 构建 drawlist:src/dev_ng/game/Core/game.cpp:3594-3599

7.1 CGame::Update 逐步#

src/dev_ng/game/Core/game.cpp:3315-3533

  1. PS3 商城容器模式:直接走 MarketplaceUpdate()(会话状态机 + COMMERCE_MAIN_UPDATE + 清渲染列表)后返回 src/dev_ng/game/Core/game.cpp:3317-3325、src/dev_ng/game/Core/game.cpp:3251-3265。
  2. 只有当本帧开始前会话已初始化,才推入 “Update” 预算计时条(20 ms)(注释:落地页创建会话时计时条不配对)src/dev_ng/game/Core/game.cpp:3327-3333。
  3. 网络游戏中每帧额外推进一次 CRandomMWCScripts 随机数(推断:用于保持多机随机序列同步节奏,源码无注释说明)src/dev_ng/game/Core/game.cpp:3335-3339。
  4. RAGE_MEMORY_DEBUG 下 F11 打印全部堆与网络/rline/SCxnMgr 分配器 src/dev_ng/game/Core/game.cpp:3341-3363。
  5. 贴花异步工作启动(“尽量紧跟上一帧渲染线程安全区之后”);断言构建使时间周期失效;计算 doFullUpdateRender = ShouldDoFullUpdateRender() || VideoPlayback::IsPlaybackActive() src/dev_ng/game/Core/game.cpp:3365-3375。
  6. m_GameSessionStateMachine.Update()(可能在此同步完成整次换关/读档)src/dev_ng/game/Core/game.cpp:3377。
  7. 回放:等待实体存储、PreProcess;PC 刷新 CPU 频率 src/dev_ng/game/Core/game.cpp:3379-3388。
  8. 压入游戏视口并按第 8 节规则执行更新模式;FULL/SIMPLE 期间 CGameWorld::AllowDelete(true),结束后 AllowDelete(false) 以免渲染列表里的实体被删除 src/dev_ng/game/Core/game.cpp:3390-3429。
  9. “Visibility” 计时条(网络游戏 3 ms,否则 4 ms):完整模式下复位高优先级加载标志 → CRenderer::ClearRenderLists() → 视早启动标志决定是否 gPostScan.Reset()/gWorldMgr.PreScan() → gVpMan.BuildRenderLists() → Water::BlockTillUpdateComplete()(注释“约 800 µs,请保持在最后”)→ 回放 PostProcess → CRenderer::PreRender() → 等待 Verlet 布料任务 → COcclusion::BeforeRender();简化模式只清渲染列表、等水体并复位标志 src/dev_ng/game/Core/game.cpp:3436-3521。
  10. fwGame::Update()(Bank 下扫描/搜索调试)及 Bank 叠加层 src/dev_ng/game/Core/game.cpp:3523-3532、src/dev_ng/rage/framework/src/fwsys/game.cpp:64-70。

物理不是独立的 update 条目:FULL_MAIN_UPDATE 的 CScene::Update 在玩家已定位时调用 CGameWorld::Process(),后者内部执行 CPhysics::Update() src/dev_ng/game/scene/scene.cpp:787-846、src/dev_ng/game/scene/world/GameWorld.cpp:2061。

7.2 CGame::Render 逐步#

src/dev_ng/game/Core/game.cpp:3538-3607:名字叫 Render,但只在主线程构建 drawlist。

  1. Gen9:会话未初始化或落地页活跃时直接返回。
  2. 非 final 主线程调试渲染;再次踢 WorldProbe 异步工作线程;CPostScan::WaitForPostScanHelper();PS3 等待 SPU 渲染列表排序;加入第一人称实体;记录流式 PVS。
  3. CTexLod::Update()、CObjectPopulation::SetHighPriorityDummyObjects()。
  4. 启动异步搜索(CObjectScanner、音频环境局部对象、火焰)——注释称这是“加异步工作的好位置”。
  5. “Build Drawlist”(预算 3 ms):CSystem::AddDrawList_BeginRender() → gVpMan.RenderPhases() → CSystem::AddDrawList_EndRender();之后收尾异步搜索。AddDrawList_BeginRender/EndRender 分别以 DL_BEGIN_DRAW/DL_END_DRAW drawlist 包裹整帧,并插入在渲染线程执行的 dlCmdBeginRender/dlCmdEndRender(后者调用 CSystem::EndRender → 帧率限制 → grmSetup::EndDraw 呈现)src/dev_ng/game/system/system.cpp:1133-1163、src/dev_ng/game/system/system.cpp:1302-1314、src/dev_ng/game/system/system.cpp:1220-1255。

帧率限制器(FORCE_FRAME_LIMIT 仅 PC 与 Durango,PS4 不编译):Durango 在 Present 前(片头视频期间跳过)、PC 在 Present 后执行“芝诺式”睡眠(每次睡剩余时间的一半,提前 5% 的“slop”退出);PC 的最小帧时间为 VSync / RefreshRate(关闭垂直同步时为 1/256 s),Durango 为 gFrameLimit/60(非 PC 的 DEFAULT_FRAME_LIMIT = 2,即 30 fps)src/dev_ng/game/system/system.cpp:137-148、src/dev_ng/game/system/system.cpp:1166-1214。

8. 更新模式选择与明细#

8.1 选择逻辑#

图中证据:src/dev_ng/game/Core/game.cpp:3394-3425。

边界:LANDING_PAGE_PRE_INIT_UPDATE/LANDING_PAGE_UPDATE 只在 Gen9 落地页启用时注册 src/dev_ng/game/Core/game.cpp:1680-1687,而 GEN9_LANDING_PAGE_ENABLED 需要 RSG_GEN9 平台 src/dev_ng/game/frontend/landing_page/LandingPageConfig.h:15-23、src/dev_ng/rage/framework/src/fwutil/Gen9Settings.h:17-20。在 PC/PS4/XB1 上,会话未初始化时 Update(LANDING_PAGE_PRE_INIT_UPDATE) 找不到模式而成为空操作(gameSkeleton::Update 的行为),连 COMMON_MAIN_UPDATE 也不会执行。由于这些平台的首个会话在 RunGame_OnEnter 中同步建立(见 startup-and-app-fsm.md),正常情况下第一次进入 CGame::Update 时会话已初始化。

8.2 ShouldDoFullUpdateRender#

src/dev_ng/game/Core/game.cpp:3158-3212:默认 true;“暂停菜单时不完整更新”的旧逻辑已被注释掉(新暂停菜单会显示背后的游戏画面);网络打开时强制 true;__DEV 可用两个调试开关强制;会话状态机非空闲(IsChangingSessionState())时为 false;Gen9 下落地页需要运行或会话未初始化时也为 false。即:SIMPLE_MAIN_UPDATE 实际只在“会话切换进行中”(以及 Gen9 落地页阶段)使用——例如 START_NEW_GAME/CHANGE_LEVEL 的淡出等待帧。

8.3 各更新模式内容对比#

关注点COMMON_MAIN_UPDATEFULL_MAIN_UPDATESIMPLE_MAIN_UPDATE
何时运行会话已初始化的每一帧(无论完整/简化)正常游戏帧会话切换中
典型内容前端菜单、存储、档案、DLC、统计、网络、CTheScripts::Update、后台脚本、权益、安全模块流式、人口、CScene::Update(世界/物理)、游戏逻辑、脚本 Process、ProcessAfterAllMovement、相机、灯光、时间周期、阴影、可见性早启动、HUD、特效、PostFX、音频水体、人口流式、流式、灯光复位、脚本 Process、淡入淡出、视口、相机、时间周期、PostFX、音频、警告屏
证据src/dev_ng/game/Core/game.cpp:2633-2734src/dev_ng/game/Core/game.cpp:2736-3077src/dev_ng/game/Core/game.cpp:3079-3119

FULL_MAIN_UPDATE 中有几条源码注释明确的顺序约束:

  • CCheat::DoCheats 必须在回放的数据存取之后,否则回放中作弊无效 src/dev_ng/game/Core/game.cpp:2748。
  • ProcessAfterAllMovement 必须在所有会移动物体的代码(包括脚本)之后 src/dev_ng/game/Core/game.cpp:2872-2878。
  • camInterface::UpdateFade 放在视口处理之前(修复 Bug 999476);相机在物体移动后才更新,“只有现在才能查询本帧相机位置” src/dev_ng/game/Core/game.cpp:2891-2900。
  • ProcessPedsEarlyAfterCameraUpdate 先让 ped 发起动画更新,ProcessAfterCameraUpdate 再阻塞等待并处理其余实体 src/dev_ng/game/Core/game.cpp:2919-2923、src/dev_ng/game/Core/game.cpp:2958-2962。
  • CGameScan::KickVisibilityJobs 要尽早启动(依赖遮挡光栅化),但必须在所有修改场景图的操作(光源实体、植被、程序化物体、CNewHud::Update 触发的流式放置)之后 src/dev_ng/game/Core/game.cpp:2976-3006。

两个编码层面的细节:Script 组的预算写作 NetworkInterface::IsGameInProgress()?3.0f:1.0f,但它只在 CGame::Init 注册时求值一次(那时不可能在网络游戏中),因此实际恒为 1.0 ms src/dev_ng/game/Core/game.cpp:2860;PS3 专用的 RegisterCommerceMainUpdateFunctions 推入了 "Common Main" 组却没有对应的 POP_UPDATE_GROUP(),因此其后的 Streaming/Render Update/Audio 组都嵌套在它里面(下表的分组列反映了这一点)src/dev_ng/game/Core/game.cpp:3219-3248。

8.4 逐模式明细#

说明同 6.4;“所在更新组”列显示组嵌套路径,[x] 为该组 timebar 预算(毫秒);“独立计时条”为 _TIMED 注册。

COMMON_MAIN_UPDATE(CGame::RegisterCommonMainUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2633-2734。

#所在更新组系统名回调独立计时条条件编译行
1Common Main[1.0]CPS3Achievements - UpdateWidgetsCPS3Achievements::UpdateWidgets__PPU && __BANK2641
2Common Main[1.0]REST (web) servicesUpdateRestServices__BANK2644
3Common Main[1.0]EndUserBenchmarksEndUserBenchmarks::UpdateCOLLECT_END_USER_BENCHMARKS2648
4Common Main[1.0]CDebug - UpdateProfilerCDebug::UpdateProfiler!__FINAL2652
5Common Main[1.0]CDebugCDebug::Update!__FINAL2653
6Common Main[1.0]CVectorMapfwVectorMap::Update!__FINAL2654
7Common Main[1.0]SmokeTestsSmokeTests::ProcessSmokeTest!__FINAL2655
8Common Main[1.0]CDebug - UpdateDebugScaleformInfoCDebug::UpdateDebugScaleformInfoDEBUG_PAD_INPUT && FINAL_DISPLAY_BAR &! __FINAL_LOGGING2659
9Common Main[1.0]CDebugBarCDebugBar::UpdateFINAL_DISPLAY_BAR2662
10Common Main[1.0]Marketing ToolsCMarketingTools::Update__BANK2665
11Common Main[1.0]PauseMenuCPauseMenu::Update2668
12Common Main[1.0]CVideoEditorUiCVideoEditorUi::UpdateGTA_REPLAY2671
13Common Main[1.0]CVideoEditorInterfaceCVideoEditorInterface::UpdateGTA_REPLAY2672
14Common Main[1.0]WatermarkRendererWatermarkRenderer::UpdateGTA_REPLAY2673
15Common Main[1.0]SocialClubMenuSocialClubMenu::UpdateWrapper2675
16Common Main[1.0]PolicyMenuPolicyMenu::UpdateWrapper2676
17Common Main[1.0]CReportMenuCReportMenu::Update2677
18Common Main[1.0]CTextInputBoxCTextInputBox::UpdateRSG_PC2679
19Common Main[1.0]TamperActionsTamperActions::UpdateTAMPERACTIONS_ENABLED2683
20Common Main[1.0]cStoreScreenMgrcStoreScreenMgr::Update2686
21Common Main[1.0]CGenericGameStorageCGenericGameStorage::Update2687
22Common Main[1.0]GenericGameStoragePhotoGalleryCGenericGameStorage::UpdatePhotoGallery2688
23Common Main[1.0]CPhotoManagerCPhotoManager::Update2689
24Common Main[1.0]CProfileSettingsCProfileSettingsWrapper::Update2690
25Common Main[1.0]CExtraContentCExtraContentWrapper::Update2691
26Common Main[1.0]CDLCScriptCDLCScript::Update2692
27Common Main[1.0]CPerformanceCPerformanceWrapper::Update2693
28Common Main[1.0]CSaveMigrationCSaveMigration::Update2694
29Common Main[1.0]CStatsMgrCStatsMgr::Update2695
30Common Main[1.0]CNetworkCNetwork::Update2696
31Common Main[1.0]CTheScriptsCTheScripts::Update2697
32Common Main[1.0]CDebugVideoEditorScreenCDebugVideoEditorScreen::UpdateGTA_REPLAY && __BANK2700
33Common Main[1.0]CReplayCoordinatorCReplayCoordinator::UpdateGTA_REPLAY2702
34Common Main[1.0]fwGreatestMomentsfwGreatestMoment::UpdateGREATEST_MOMENTS_ENABLED2710
35Common Main[1.0]VideoPlaybackVideoPlayback::Updatedefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED2714
36Common Main[1.0]VideoPlaybackThumbnailManagerVideoPlaybackThumbnailManager::Updatedefined(VIDEO_PLAYBACK_ENABLED) && VIDEO_PLAYBACK_ENABLED2715
37Common Main[1.0]ImposedTxdCleanupfwImposedTextureDictionary::UpdateCleanup2718
38Common Main[1.0]BackgroundScriptsBackgroundScripts::UpdateClass2719
39Common Main[1.0]CEntitlementManagerCEntitlementManager::UpdateRSG_ENTITLEMENT_ENABLED2722
40Common Main[1.0](安全模块)rageSecEngine::UpdateUSE_RAGESEC && !RAGE_SEC_IN_SEPARATE_THREAD2726

FULL_MAIN_UPDATE(CGame::RegisterFullMainUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:2736-3077。

#所在更新组系统名回调独立计时条条件编译行
1Misc[1.0]Water Update Buffer UnflipWater::UnflipWaterUpdateIndex2742
2Misc[1.0]Visual Effects Pre UpdateCVisualEffects::PreUpdate2743
3Misc[1.0]Lights - PreSceneUpdateLights::PreSceneUpdate2744
4Misc[1.0]ScriptHud - PreSceneProcessCScriptHud::PreSceneProcess2745
5Misc[1.0]CutSceneManager - PreSceneUpdateCutSceneManagerWrapper::PreSceneUpdate2746
6Misc[1.0]AnimSceneManager - PreAnimUpdateCAnimSceneManager::UpdatePreAnim2747
7Misc[1.0]CCheatCCheat::DoCheats2748
8Misc[1.0]CClockCClock::Update2749
9Misc[1.0]PedHeadShotManagerPedHeadshotManager::UpdateSafe2750
10Misc[1.0]SettingsManagerCSettingsManager::ProcessTests__DEV && RSG_PC2752
11Misc[1.0]CDebug::PreUpdateCDebugScene::PreUpdate__BANK2755
12Streaming[4.0]Situational Clip Set StreamingCSituationalClipSetStreamer::Update2762
13Streaming[4.0]Prioritized Clip Set StreamingCPrioritizedClipSetStreamer::Update2763
14Streaming[4.0]Population StreamingCPopulationStreamingWrapper::Update2764
15Streaming[4.0]CStreamingCStreaming::Update2765
16Ped and Vehicle assets[1.0]CPedVariationStream - ProcessStreamRequestsCPedVariationStream::ProcessStreamRequests2770
17Ped and Vehicle assets[1.0]CVehicleVariationInstance - ProcessStreamRequestsCVehicleVariationInstance::ProcessStreamRequests2771
18Ped and Vehicle assets[1.0]CPedPropsMgr - ProcessStreamRequestsCPedPropsMgr::ProcessStreamRequests2772
19Ped and Vehicle assets[1.0]MeshBlendManagerMeshBlendManager::Update2773
20Ped and Vehicle assets[1.0]FacialClipSetGroupManagerfwFacialClipSetGroupManager::Update2774
21Game Update[19.0] › World and Population[2.0] › Zones[3.0]CMapAreasCMapAreas::Update2783
22Game Update[19.0] › World and Population[2.0] › Zones[3.0]CPopZonesCPopZones::Update2784
23Game Update[19.0] › World and Population[2.0] › Zones[3.0]CMapZoneManagerCMapZoneManager::Update2785
24Game Update[19.0] › World and Population[2.0] › Vehicles[3.0]CVehiclePopulationCVehiclePopulation::Process2791
25Game Update[19.0] › World and Population[2.0] › Vehicles[3.0]CVehicleAILodManagerCVehicleAILodManager::Update2792
26Game Update[19.0] › World and Population[2.0] › Vehicles[3.0]CFlyingVehicleAvoidanceManagerCFlyingVehicleAvoidanceManager::Update2793
27Game Update[19.0] › World and Population[2.0] › Objects[3.0]CObjectPopulationNYCObjectPopulationNY::Process2799
28Game Update[19.0] › World and Population[2.0] › Peds[3.0]CPedPopulationCPedPopulation::Process2805
29Game Update[19.0] › World and Population[2.0] › Peds[3.0]CPedAILodManagerCPedAILodManager::Update2806
30Game Update[19.0] › World and Population[2.0] › Misc[3.0]CNetworkTelemetryCNetworkTelemetry::Update是2812
31Game Update[19.0] › World and Population[2.0] › Misc[3.0]CNetworkDebugTelemetryCNetworkDebugTelemetry::Update是!__FINAL2813
32Game Update[19.0] › World and Population[2.0] › Misc[3.0]CRandomEventManagerCRandomEventManager::Update2814
33Game Update[19.0] › World and Population[2.0] › Misc[3.0]CRoadBlockCRoadBlock::Update2815
34Game Update[19.0] › World and Population[2.0] › Misc[3.0]CScenarioManagerCScenarioManager::Update2816
35Game Update[19.0] › World and Population[2.0] › Misc[3.0]CGameSituationCGameSituation::Update2817
36Game Update[19.0] › World and Population[2.0] › Misc[3.0]CRecentlyPilotedAircraftCRecentlyPilotedAircraft::Update2818
37Game Update[19.0]strStreamingEngine::SubmitDeferredAsyncPlacementRequestsstrStreamingEngine::SubmitDeferredAsyncPlacementRequests2824
38Game Update[19.0]CSceneCScene::Update2826
39Game Update[19.0]CScenarioManager::ResetExclusiveScenarioGroupCScenarioManager::ResetExclusiveScenarioGroup2828
40Game Update[19.0]CWarpManagerCWarpManager::Update2830
41Game Update[19.0]CPedPopulation::ResetPerFrameScriptedMultipiersCPedPopulation::ResetPerFrameScriptedMultipiers2832
42Game Update[19.0]CVehiclePopulation::ResetPerFrameModifiersCVehiclePopulation::ResetPerFrameModifiers2833
43Game Update[19.0] › Game Logic[0.5]CGpsCGps::Update是2837
44Game Update[19.0] › Game Logic[0.5]CGameLogicCGameLogic::Update是2838
45Game Update[19.0] › Game Logic[0.5]CSlownessZonesManagerCSlownessZoneManager::Update是2839
46Game Update[19.0] › Game Logic[0.5]CGaragesCGarages::Update是2840
47Game Update[19.0] › Game Logic[0.5]CStuntJumpManagerCStuntJumpManager::Update是2841
48Game Update[19.0] › Game Logic[0.5]CJunctionsCJunctions::Update是2842
49Game Update[19.0] › Game Logic[0.5]CPhoneMgrCPhoneMgr::Update是2843
50Game Update[19.0] › Game Logic[0.5]CTaskCTask::StaticUpdate是2844
51Game Update[19.0] › Game Logic[0.5]CTrafficLightsCTrafficLights::Update是2845
52Game Update[19.0] › Game Logic[0.5]CAppDataMgrCAppDataMgr::Update是2846
53Game Update[19.0] › Game Logic[0.5]CNetRespawnMgrCNetRespawnMgr::Update是2847
54Game Update[19.0] › Game Logic[0.5]CAnimViewerCAnimViewer::Process__BANK2850
55Game Update[19.0] › Game Logic[0.5]PedPopulation CacheCPedFactory::ProcessDestroyedPedsCache是2853
56Game Update[19.0] › Game Logic[0.5]VehPopulation CacheCVehicleFactory::ProcessDestroyedVehsCache是2854
57Game Update[19.0] › Game Logic[0.5]Kick WorldProbe Async WorkerWorldProbe::CShapeTestManager::KickAsyncWorker是2855
58Game Update[19.0] › Game Logic[0.5]FirstPersonProp Pre-scriptCPedVariationStream::PreScriptUpdateFirstPersonProp是2856
59Game Update[19.0] › Script[IsGameInProgress()?3.0:1.0,注册时求值]CTheScriptsCTheScripts::Process2862
60Game Update[19.0] › Script[IsGameInProgress()?3.0:1.0,注册时求值]CScriptPedAIBlipsCScriptPedAIBlips::Update2863
61Game Update[19.0] › Script[IsGameInProgress()?3.0:1.0,注册时求值]CMessagesCMessages::Update2864
62Game Update[19.0]CNodeViewerCNodeViewer::Update__BANK2869
63Game Update[19.0] › ProcessAfterMovement[1.5]ProcessAfterMovementCGameWorld::ProcessAfterAllMovement是2876
64Game Update[19.0]FireManager Entity UpdateCFireManager::ProcessAllEntitiesNextToFires2882
65Game Update[19.0]WarningScreenCWarningScreen::Update2884
66Render Update[2.0]Update FadecamInterface::UpdateFade2896
67Render Update[2.0]Viewport ManagerCViewportManagerWrapper::Process2897
68Render Update[2.0]camManagercamManager::Update2900
69Render Update[2.0]FirstPersonPropCPedVariationStream::UpdateFirstPersonProp2902
70Render Update[2.0]LightsLights::Update2904
71Render Update[2.0]CLODLightManagerCLODLightManager::Update2905
72Render Update[2.0]CLODLightsCLODLights::Update2906
73Render Update[2.0]AmbientLightsAmbientLights::Update2907
74Render Update[2.0]Pre-vis Vehicle updateCVehicle::PreVisUpdate2909
75Render Update[2.0]Occlusion jobs early kickCOcclusion::KickOcclusionJobs是2912
76Render Update[2.0]PlantsMgr::UpdateBeginCPlantMgrWrapper::UpdateBegin是2915
77Render Update[2.0]ShaderLib::UpdateCShaderLib::Update是2917
78Render Update[2.0]ProcessPedsEarlyAfterCameraUpdateCGameWorld::ProcessPedsEarlyAfterCameraUpdate是2923
79Render Update[2.0] › Water UpdateWaterWater::Update2927
80Render Update[2.0]Marketing ToolsCMarketingTools::UpdateLights__BANK2932
81Render Update[2.0]CRenderPhaseDebugOverlayInterfaceCRenderPhaseDebugOverlayInterface::Update__BANK2937
82Render Update[2.0]SceneGeometryCaptureSceneGeometryCapture::Update__BANK2938
83Render Update[2.0]CTimeCycleCTimeCycle::UpdateWrapper是2941
84Render Update[2.0]WaterHeightSimWater::UpdateHeightSimulation是2942
85Render Update[2.0]LightsLights::UpdateBaseLights是2943
86Render Update[2.0]CRenderPhaseCascadeShadowsInterfaceCRenderPhaseCascadeShadowsInterface::Update是2944
87Render Update[2.0]CParaboloidShadowCParaboloidShadow::Update是2947
88Render Update[2.0]CreateFinalScreenRenderPhaseListCViewportManagerWrapper::CreateFinalScreenRenderPhaseList是2950
89Render Update[2.0]Occlusion shadows jobs early kickCOcclusion::KickShadowOcclusionJobs是2953
90Render Update[2.0]Run ScanCutBlocks EarlyWater::ScanCutBlocksWrapper是2956
91Render Update[2.0]ProcessAfterCameraUpdateCGameWorld::ProcessAfterCameraUpdate是2962
92Render Update[2.0]FirstPersonPropCamCPedVariationStream::UpdateFirstPersonPropFromCamera2964
93Render Update[2.0]LightEntityMgrLightEntityMgr::Update是2966
94Render Update[2.0]PlantsMgr::UpdateEndCPlantMgrWrapper::UpdateEnd是2969
95Render Update[2.0]Proc ObjectsCProcObjectManWrapper::Update是2972
96Render Update[2.0]CSceneStreamerMgr::PreScanUpdateCSceneStreamerMgrWrapper::PreScanUpdate是2974
97Render Update[2.0]NewHud UpdateCNewHud::Update是2990
98Render Update[2.0]CBusySpinner UpdateCBusySpinner::Update是2991
99Render Update[2.0]CDebugSceneCDebugScene::Update!__FINAL2994
100Render Update[2.0]CutSceneManager - PostSceneUpdateCutSceneManagerWrapper::PostSceneUpdate2997
101Render Update[2.0]UpdateLightsOnFlagsForAllVehiclesCVehicle::UpdateLightsOnFlagsForAllVehicles2999
102Render Update[2.0]ReplayManager - ProcessCReplayMgr::ProcessGTA_REPLAY3003
103Render Update[2.0]Visibility jobs early kickCGameScan::KickVisibilityJobs是3006
104Render Update[2.0]PlantsMgr::UpdateOcclusionCPlantMgrWrapper::UpdateOcclusion是CPLANT_USE_OCCLUSION3009
105Render Update[2.0]CMultiplayerGamerTagHud UpdateCMultiplayerGamerTagHud::Update是3012
106Render Update[2.0]UIWorldIconManagerUIWorldIconManager::UpdateWrapper3013
107Render Update[2.0]CMultiplayerChat UpdateCMultiplayerChat::UpdateRSG_PC3016
108Render Update[2.0]CreditsCCredits::Update是3022
109Render Update[2.0]OcclusionCCullZones::Update是3023
110Render Update[2.0]CLoadingScreensCLoadingScreens::Update3026
111Render Update[2.0]UpdateModelViewerCDebugScene::UpdateModelViewer__DEV3028
112Render Update[2.0]CBlockViewCBlockView::Update!__FINAL3031
113Render Update[2.0]DisplayEntitiesOnVectorMapCDebugScene::DisplayEntitiesOnVectorMap__BANK3034
114Render Update[2.0]CSectorToolsCSectorTools::Update(SECTOR_TOOLS_EXPORT)3037
115Render Update[2.0]CVehicleDeformationCVehicleDeformation::TexCacheUpdate3039
116Render Update[2.0]CVisualEffectsCVisualEffects::Update3040
117Render Update[2.0]CVolumeManagerCVolumeManager::UpdateVOLUME_SUPPORT3042
118Render Update[2.0]CSkyCSky::Update3045
119Render Update[2.0]CTreeImpostersCTreeImposters::UpdateUSE_TREE_IMPOSTERS3048
120Render Update[2.0]PostFxPostFX::Update是3051
121Render Update[2.0]DebugRenderingMgrDebugRenderingMgr::Update是__BANK3053
122Audio Update[2.0]AudioaudNorthAudioEngine::StartUpdate是3062
123Misc Update[1.0]Streaming of alternate entity graphicsCEntityExt_AltGfxMgr::ProcessExtensions是3068
124Misc Update[1.0]Population Multplier areasCThePopMultiplierAreas::Update__DEV3071
125Misc Update[1.0]perfClearingHouse UpdateperfClearingHouse::Update是3074

SIMPLE_MAIN_UPDATE(CGame::RegisterSimpleMainUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:3079-3119。

#所在更新组系统名回调独立计时条条件编译行
1(顶层)WaterWater::Update3083
2(顶层)Population StreamingCPopulationStreamingWrapper::Update是3084
3(顶层)CStreamingCStreaming::Update3085
4(顶层)strStreamingEngine::SubmitDeferredAsyncPlacementRequestsstrStreamingEngine::SubmitDeferredAsyncPlacementRequests3086
5(顶层)ResetSceneLightsLights::ResetSceneLights3087
6Script[1.0]CTheScriptsCTheScripts::Process3091
7Script[1.0]CScriptPedAIBlipsCScriptPedAIBlips::Update3092
8(顶层)Update FadecamInterface::UpdateFade3098
9(顶层)Viewport ManagerCViewportManagerWrapper::Process3099
10(顶层)camManagercamManager::Update3102
11(顶层)Marketing ToolsCMarketingTools::UpdateLights__BANK3104
12(顶层)CTimeCycleCTimeCycle::UpdateWrapper3107
13(顶层)CreateFinalScreenRenderPhaseListCViewportManagerWrapper::CreateFinalScreenRenderPhaseList3108
14(顶层)PostFxPostFX::Update是3109
15Audio Update[0.1]AudioaudNorthAudioEngine::StartUpdate是3113
16(顶层)WarningScreenCWarningScreen::Update3117

LANDING_PAGE_PRE_INIT_UPDATE(CGame::RegisterLandingPagePreInitUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:3122-3135。

#所在更新组系统名回调独立计时条条件编译行
1(顶层)CSaveMigrationCSaveMigration::Update3126
2ScriptCTheScriptsCTheScripts::Process3130
3(顶层)PauseMenuCPauseMenu::Update3134

LANDING_PAGE_UPDATE(CGame::RegisterLandingPageUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:3137-3155。

#所在更新组系统名回调独立计时条条件编译行
1(顶层)CLandingPageCLandingPage::Update3143
2StreamingCStreamingCStreaming::Update3147
3StreamingstrStreamingEngine::SubmitDeferredAsyncPlacementRequestsstrStreamingEngine::SubmitDeferredAsyncPlacementRequests3148
4(顶层)WarningScreenCWarningScreen::Update3152

COMMERCE_MAIN_UPDATE(CGame::RegisterCommerceMainUpdateFunctions)#

注册函数:src/dev_ng/game/Core/game.cpp:3215-3249。

#所在更新组系统名回调独立计时条条件编译行
1Common MaincStoreScreenMgrcStoreScreenMgr::Update3221
2Common MainCLiveManagerCLiveManager::CommerceUpdate3222
3Common MainCExtraContentCExtraContentWrapper::Update3223
4Common MainCDLCScriptCDLCScript::Update3224
5Common MainWarningScreenCWarningScreen::Update3225
6Common MainPauseMenuCPauseMenu::Update3226
7Common Main › Streaming[4.0]CStreamingCStreaming::Update3231
8Common Main › Streaming[4.0]strStreamingEngine::SubmitDeferredAsyncPlacementRequestsstrStreamingEngine::SubmitDeferredAsyncPlacementRequests3232
9Common Main › Render Update[2.0]Viewport ManagerCViewportManagerWrapper::Process3238
10Common Main › Render Update[2.0]CreateFinalScreenRenderPhaseListCViewportManagerWrapper::CreateFinalScreenRenderPhaseList是3239
11Common Main › Render Update[2.0]CBusySpinner UpdateCBusySpinner::Update是3240
12Common Main › AudioAudioaudNorthAudioEngine::StartUpdate是3246

9. 约束与边界行为#

  • 注册只发生一次:RegisterGameSkeletonFunctions 在 CGame::Init 中调用,此后模式内容固定;运行时条件(如网络状态)只能在回调内部判断,不能改变注册表。
  • 同级顺序是隐式契约:同一依赖级别内的系统按源码行序执行,__DEV 的反序测试是唯一的防线;向表中插入新系统时需要关注前后邻居(注释中大量“dependent on …”就是这种契约的记录)。
  • 关闭顺序需人工设计:gameSkeleton 不会反转关闭顺序(见 1.4)。
  • 主线程独占:注册与执行均无锁,CGame 的所有生命周期函数都只能在 update 线程调用(CGame::VerifyMainThread 断言 sysThreadType::IsUpdateThread(),src/dev_ng/game/Core/game.cpp:3866-3872)。
  • 实体删除窗口:只有在 FULL/SIMPLE_MAIN_UPDATE 执行期间 CGameWorld::AllowDelete(true);可见性/渲染列表构建期间禁止删除实体。

10. 未决问题 / 证据不足#

  • 每个注册回调内部如何依据 mode 分派,本页只在个别处验证(如 ViewportSystemInit);各系统的具体行为请见其所属页面。
  • 表中的条件编译宏(如 GTA_REPLAY、VIDEO_RECORDING_ENABLED、GREATEST_MOMENTS_ENABLED、VOLUME_SUPPORT)在各平台/配置下的取值未逐一核实,因此“某平台实际执行哪些条目”需要结合 ../00-overview/build-and-config.md 判断。
  • Gen9 落地页相关路径在本快照中可能不完整(见 session-state-machine.md)。