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?
Yes, you can modify this method to always return true (1) to allow opening any door. The simplest approach is to place a mov al,01 instruction at the beginning followed by a ret instruction to immediately return with success.
Here's how you can patch it:
ScheduleOne.Doors.DoorController.CanPlayerAccess - B0 01 - mov al,01 { 1 } ; Set al to 1 (true)
GameAssembly.dll+7629A5 - C3 - ret ; Return immediately
This replaces the first two instructions of the function. It simply:
This modification will make the function always report that the player can access any door, regardless of its EDoorAccess state.
Would you like me to explain or break down the code?
Okay this did no work. We should modify the method so that the path is executed like when EDoorAccess is set 0.
Looking at the disassembly, I can see that when EDoorAccess is 0 (Open), the code path that returns success is at address 7629CD. Let's modify the function to always follow that path regardless of the door state.
Here's how you can patch it:
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 - E9 1E000000 - jmp GameAssembly.dll+7629CD ; Jump directly to success path
This modification preserves the function's prologue (necessary for proper stack management) but then immediately jumps to the success path at 7629CD, which:
This way, the function will behave exactly like it would for an Open door, but for all doors regardless of their actual state.
Would you like me to explain or break down the code?
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?
You're right! That's a much more elegant solution. By replacing the conditional jump at 7629C3 with NOPs, you'll prevent the code from taking the branch that performs additional checks.
Here's what would happen:
GameAssembly.dll+7629C1 - 85 FF - test edi,edi
GameAssembly.dll+7629C3 - 90 90 - nop nop ; Was "75 2A" (jne +2A)
GameAssembly.dll+7629C5 - 39 BB 1C010000 - cmp [rbx+0000011C],edi
With this change:
This is a more minimal change that preserves most of the original function logic while effectively bypassing the access restrictions. It's an excellent solution that should work for your needs.
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.
I see the issue now. The function is more complex than I initially thought - it handles different access scenarios based on both the door state and whether you're entering or exiting.
Let's try a more comprehensive approach. Looking at the disassembly more carefully, I can see that the function checks both:
edi - whether entering or exiting)[rbx+0000011C])Here's a better solution that should work for all doors:
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 - B0 01 - mov al,01 { 1 } ; Set al to 1 (true)
GameAssembly.dll+7629C3 - 48 8B 5C 24 30 - mov rbx,[rsp+30]
GameAssembly.dll+7629C8 - 48 83 C4 20 - add rsp,20 { 32 }
GameAssembly.dll+7629CC - 5F - pop rdi
GameAssembly.dll+7629CD - C3 - ret ; Return immediately
This modification:
This should work for both entering and exiting any door, regardless of its state.