Wild-W / CivilizationVI_CommunityExtension

Script extender DLL patch for Civilization VI
https://steamcommunity.com/sharedfiles/filedetails/?id=3277976174
GNU Affero General Public License v3.0
10 stars 0 forks source link

RegisterProcessor race condition #5

Open Wild-W opened 2 months ago

Wild-W commented 2 months ago

Critical bug

Usage of RegisterProcessor to hook a function in program memory creates a race condition that depends on the result of the hook not to resolve while the thread that owns the lua state is modifying it. The solution should be to find the location in CivilizationVI.exe that handles the game's lua event loop (or whatever other dispatch system is being used) and hook into it, or to reverse the ScriptSystem, ScriptSystemArgs, and TypedVariantMap structures and just use the existing processor system.

This bug was first reported to me 08/03/2024 and since 08/08/2024, fixing it has been this project's top priority. Unfortunately, I've been largely unsuccessful.