Fix game freeze/crash issue by adding null pointer safety checks to CHR_DBG_FLAGSReal operations#2
Draft
Fix game freeze/crash issue by adding null pointer safety checks to CHR_DBG_FLAGSReal operations#2
Conversation
…LAGSReal operations Co-authored-by: JohnnyTheCoder1 <111908128+JohnnyTheCoder1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Freeze game
Fix game freeze/crash issue by adding null pointer safety checks to CHR_DBG_FLAGSReal operations
Jul 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Elden Menu mod was causing game freezes and crashes when users clicked on certain features like "FREEZE ENEMIES". This occurred when the signature scanning failed to find the correct memory patterns in newer versions of Elden Ring, resulting in null pointer dereferences.
Root Cause
The issue was in the memory address resolution process:
CHR_DBG_FLAGSAddrcould return 0 when signature scanning failsCHR_DBG_4bytesAddrwould then become(int*)0x2, causing crashes when dereferencedCHR_DBG_FLAGSRealcould become 0 or invalid, but the code still attempted to write to memory offsetsCHR_DBG_FLAGSReal + offset) caused game freezes and crashesSolution
Added comprehensive null pointer safety checks throughout the codebase:
Early Validation
Function-Level Safety Checks
Functions Protected
Applied safety checks to all 9 functions that write to
CHR_DBG_FLAGSReal:CHR_DBG_FLAGSReal + 0xeCHR_DBG_FLAGSReal + 0x0CHR_DBG_FLAGSReal + 0x4CHR_DBG_FLAGSReal + 0x5CHR_DBG_FLAGSReal + 0x6CHR_DBG_FLAGSReal + 0x3CHR_DBG_FLAGSReal + 0x2CHR_DBG_FLAGSReal + 0xdCHR_DBG_FLAGSReal + 0xaBenefits
Testing
The fix handles these scenarios:
Fixes #1.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.