Skip to content

Fix script initialization#548

Merged
MiranDMC merged 2 commits intomasterfrom
Fix_script_struct_initialization
Mar 8, 2026
Merged

Fix script initialization#548
MiranDMC merged 2 commits intomasterfrom
Fix_script_struct_initialization

Conversation

@MiranDMC
Copy link
Collaborator

@MiranDMC MiranDMC commented Mar 8, 2026

Hooked CRunning::ScriptInit so ScmFunction and bIsCustom are properly initialized.

@MiranDMC MiranDMC requested a review from x87 March 8, 2026 12:44
@x87
Copy link

x87 commented Mar 8, 2026

Please write unit test.

Before the test, iterate CTheScripts::pIdleScripts and write some value to all inactive scripts ScmFunction Id and IsCustom
Start new script
Validate new struct is clean
Iterate scripts again and reset values.

@MiranDMC
Copy link
Collaborator Author

MiranDMC commented Mar 8, 2026

Please write unit test.

Done

@x87
Copy link

x87 commented Mar 8, 2026

Does it fix your crash?

@MiranDMC
Copy link
Collaborator Author

MiranDMC commented Mar 8, 2026

Does it fix your crash?

Time will show.
Despite of the crash the fact that bIsCustom could be randomly set was disaster.

@x87
Copy link

x87 commented Mar 8, 2026

Despite of the crash the fact that bIsCustom could be randomly set was disaster.

I don't think it was possible unless the script code itself did that. CLEO only sets it for custom scripts and they are never part of idle pool for game to pick up

@MiranDMC
Copy link
Collaborator Author

MiranDMC commented Mar 8, 2026

Despite of the crash the fact that bIsCustom could be randomly set was disaster.

I don't think it was possible unless the script code itself did that. CLEO only sets it for custom scripts and they are never part of idle pool for game to pick up

Hm right. ScmFunction field was actually one creating the problems.
So far I have no crashes even with more strict ScmFunction storage from another branch.

@MiranDMC MiranDMC merged commit 736bac8 into master Mar 8, 2026
@MiranDMC MiranDMC deleted the Fix_script_struct_initialization branch March 8, 2026 23:21
@x87 x87 mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants