I am developing a game mod for solo single player game. I found a method named…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
I am developing a game mod for solo single player game. I found a method named CanPlayerAccess of Class Door Controller. It checks the enum EDoorAccess and returns if the door can be opened by the player. The pointer [rbx+0000011C] contains the variable EDoorAccess. These are state of EDooorAccess 1 - Locked 2 - ExitOnly 0 - Open 3 - EnterOnly I previously manually set the state EDoorAccess to 3 and I could enter every previously locked door. I don't know why it worked. I want you to modify the method so that the player can open every door.
ScheduleOne.Doors.DoorController.CanPlayerAccess - 48 89 5C 24 08 - mov [rsp+08],rbx
GameAssembly.dll+7629A5 - 57 - push rdi
GameAssembly.dll+7629A6 - 48 83 EC 20 - sub rsp,20 { 32 }
GameAssembly.dll+7629AA - 8B FA - mov edi,edx
GameAssembly.dll+7629AC - 48 8B D9 - mov rbx,rcx
GameAssembly.dll+7629AF - 48 8B 91 80010000 - mov rdx,[rcx+00000180]
GameAssembly.dll+7629B6 - 49 8B C8 - mov rcx,r8
GameAssembly.dll+7629B9 - 49 89 10 - mov [r8],rdx
GameAssembly.dll+7629BC - E8 9F15C1FF - call GameAssembly.il2cpp_value_box+20
GameAssembly.dll+7629C1 - 85 FF - test edi,edi
GameAssembly.dll+7629C3 - 75 2A - jne GameAssembly.dll+7629EF
GameAssembly.dll+7629C5 - 39 BB 1C010000 - cmp [rbx+0000011C],edi
GameAssembly.dll+7629CB - 75 0D - jne GameAssembly.dll+7629DA
GameAssembly.dll+7629CD - B0 01 - mov al,01 { 1 }
GameAssembly.dll+7629CF - 48 8B 5C 24 30 - mov rbx,[rsp+30]
GameAssembly.dll+7629D4 - 48 83 C4 20 - add rsp,20 { 32 }
GameAssembly.dll+7629D8 - 5F - pop rdi
GameAssembly.dll+7629D9 - C3 - ret
GameAssembly.dll+7629DA - 83 BB 1C010000 02 - cmp dword ptr [rbx+0000011C],02 { 2 }
GameAssembly.dll+7629E1 - 0F94 C0 - sete al
GameAssembly.dll+7629E4 - 48 8B 5C 24 30 - mov rbx,[rsp+30]
GameAssembly.dll+7629E9 - 48 83 C4 20 - add rsp,20 { 32 }
GameAssembly.dll+7629ED - 5F - pop rdi
GameAssembly.dll+7629EE - C3 - ret
GameAssembly.dll+7629EF - 83 FF 01 - cmp edi,01 { 1 }
GameAssembly.dll+7629F2 - 75 1E - jne GameAssembly.dll+762A12
GameAssembly.dll+7629F4 - 83 BB 1C010000 00 - cmp dword ptr [rbx+0000011C],00 { 0 }
GameAssembly.dll+7629FB - 74 D0 - je GameAssembly.dll+7629CD
GameAssembly.dll+7629FD - 83 BB 1C010000 03 - cmp dword ptr [rbx+0000011C],03 { 3 }
GameAssembly.dll+762A04 - 0F94 C0 - sete al
GameAssembly.dll+762A07 - 48 8B 5C 24 30 - mov rbx,[rsp+30]
GameAssembly.dll+762A0C - 48 83 C4 20 - add rsp,20 { 32 }
GameAssembly.dll+762A10 - 5F - pop rdi
GameAssembly.dll+762A11 - C3 - ret
GameAssembly.dll+762A12 - 48 8B 5C 24 30 - mov rbx,[rsp+30]
GameAssembly.dll+762A17 - 32 C0 - xor al,al
GameAssembly.dll+762A19 - 48 83 C4 20 - add rsp,20 { 32 }
GameAssembly.dll+762A1D - 5F - pop rdi
GameAssembly.dll+762A1E - C3 - ret
GameAssembly.dll+762A1F - CC - int 3
Could I just use ret to always return the correct value?
To make the CanPlayerAccess method always return true (allowing the player to open every door), you can modify the jump instruction that skips the access checks. Here's a concise and safe way to achieve this:
Identify the relevant code:
EDoorAccess value and returns based on conditions. The critical part is the jne (jump if not equal) instruction at address GameAssembly.dll+7629C3.Patch the jne instruction:
jne (which jumps to GameAssembly.dll+7629EF) with a jmp (jump) to the code that sets al=1 and returns. This skips all access checks and forces the function to return true.Modify the instruction bytes:
GameAssembly.dll+7629C3 (2 bytes):75 2A (hex for jne GameAssembly.dll+7629EF)EB 08 (hex for jmp GameAssembly.dll+7629CD)jne instruction is replaced with a jmp that directly jumps to the code that sets al=1 (at GameAssembly.dll+7629CD). This bypasses all the original checks, ensuring the function always returns true.jmp), avoiding alignment issues.GameAssembly.dll+7629C1 - 85 FF ; test edi, edi
GameAssembly.dll+7629C3 - 75 2A ; jne GameAssembly.dll+7629EF
GameAssembly.dll+7629C1 - 85 FF ; test edi, edi
GameAssembly.dll+7629C3 - EB 08 ; jmp GameAssembly.dll+7629CD
EDoorAccess state (e.g., Locked, ExitOnly, EnterOnly).Okay this did no work. We should modify the method so that the path is executed like when EDoorAccess is set 0.
To ensure the CanPlayerAccess method always returns true (allowing the player to open every door regardless of EDoorAccess state), the most reliable approach is to patch the function to immediately return true by modifying the initial checks. Here's the step-by-step fix:
Locate the test edi, edi instruction at:
GameAssembly.dll+7629C1 - 85 FF
This instruction checks if edi (the access type) is non-zero.
Replace the test edi, edi and jne instructions with:
B0 01 - mov al, 01 { 1 } // Set return value to true
C3 - ret // Return immediately
This bypasses all subsequent logic and forces the function to return true.
edi (the access type) and performs conditional jumps based on EDoorAccess. By overwriting the first two instructions, you skip all checks and return true immediately.ret instruction ensures the function exits cleanly, preserving the stack and return address.Before:
GameAssembly.dll+7629C1 - 85 FF ; test edi, edi
GameAssembly.dll+7629C3 - 75 2A ; jne GameAssembly.dll+7629EF
After:
GameAssembly.dll+7629C1 - B0 01 ; mov al, 01 { 1 } (return true)
GameAssembly.dll+7629C3 - C3 ; ret (exit function)
EDoorAccess values or handle edge cases. This is a minimal, direct patch.GameAssembly.dll+7629C1 may vary slightly depending on the build).Wouldn't it be easier to replace the bytecode at GameAssembly.dll+7629C3 with 90 90 (nop nop). This would make it so that check if EDoorAccess it not 0 would never be executed?
Yes, replacing the jne instruction (75 2A) at GameAssembly.dll+7629C3 with NOP (90 90) would not achieve your goal of making the function always return true. Here's why:
The instruction at GameAssembly.dll+7629C3 is:
75 2A ; jne GameAssembly.dll+7629EF (jump if not equal)
This checks if edi (the access type) is non-zero. If it is, the code jumps to GameAssembly.dll+7629EF (the "exit" path). If not, it continues to the next instruction.
If you replace 75 2A with 90 90 (two NOP instructions), the code will not skip the check. Instead, it will:
GameAssembly.dll+7629C5 - 39 BB 1C010000 ; cmp [rbx+0000011C], edi
EDoorAccess value with edi (the access type).jne path (which is now a NOP and skipped), but the logic is still intact.This means the original access checks are still performed, and the function may still return false for certain door states.
To always return true, you need to directly jump to the code that sets al=1 (the "true" return path). This bypasses all checks.
GameAssembly.dll+7629C1 - 85 FF ; test edi, edi
GameAssembly.dll+7629C3 - 75 2A ; jne GameAssembly.dll+7629EF
Replace the jne instruction (75 2A) with a jmp to the "true" path:
GameAssembly.dll+7629C1 - 85 FF ; test edi, edi
GameAssembly.dll+7629C3 - EB 08 ; jmp GameAssembly.dll+7629CD (directly to the 'al=1' code)
This skips all access checks and forces the function to return true.
jne with jmp to the "true" return path (e.g., EB 08) to bypass all checks and always return true.Okay my solution does not seem to work properly on doors that I normally could access. The replacement with nop or je makes it so that I can access all closed doors, but then I can no longer access the previously openend doors. Replacing it with jmp does not change anything.
To resolve the issue where your mod works for closed doors but fails for previously open doors, the root cause lies in how the jne (jump if not equal) instruction is patched. Here's a step-by-step breakdown and solution:
CanPlayerAccess always return true (allow all doors to open).jne with NOP (no-op): The original logic still runs, causing inconsistent behavior.jne with jmp: The offset was incorrect, so the jump didn't reach the "true" path.The original code checks the EDoorAccess value. To always return true, you need to directly jump to the code that sets al=1 (the "true" return path).
GameAssembly.dll+7629C3:75 2A ; jne GameAssembly.dll+7629EF
This checks if edi (the access type) is non-zero. If so, it jumps to the "false" path.
The code that sets al=1 (true) is at:
GameAssembly.dll+7629CD
The distance from GameAssembly.dll+7629C3 to GameAssembly.dll+7629CD is 10 bytes (0xA in hex).
Replace the jne instruction (75 2A) with a relative jump to GameAssembly.dll+7629CD:
EB 0A ; jmp GameAssembly.dll+7629CD
EB is the opcode for a short jump (1-byte offset).0A is the offset (10 bytes ahead).al=1 (true).EDoorAccess state.GameAssembly.dll+7629C3 in your disassembler or hex editor.75 2A → EB 0A
GameAssembly.dll).Replace the jne instruction at GameAssembly.dll+7629C3 with EB 0A (a jump to the "true" path). This ensures the function always returns true, allowing the player to open every door.