Skip to content

Instantly share code, notes, and snippets.

@kirides
Last active November 14, 2024 16:23
Show Gist options
  • Save kirides/25e8b4a9c0ba669464164c2a24eeeda5 to your computer and use it in GitHub Desktop.
Save kirides/25e8b4a9c0ba669464164c2a24eeeda5 to your computer and use it in GitHub Desktop.
Borderless Gaming - Assassins Creed IV - Black Flag

Changes required to the AC4BFSP.exe file to enable borderless fullscreen gaming For details on these instructions see https://defuse.ca/online-x86-assembler.htm

As long as github allow it, here is a zip file which includes the patch for quick use https://github.com/user-attachments/files/17745242/aciv_borderless_patch.zip

These instructions set the width/height to 0 which forces the game to re-calculate the screen size at the start. Aswell as settin the global IsFullscreen byte (0x2ac07d3) to 0

file offset: 0x0000593D (address 0x0040653d)
old: E8 BE 41 42 00 8B 78 18 E8 B6 41 42 00 8B 58 1C
new: 31 ff 31 db c6 05 d3 07 ac 02 00 90 90 90 90 90

0:  31 ff                   xor    edi,edi
2:  31 db                   xor    ebx,ebx
4:  c6 05 d3 07 ac 02 00    mov    BYTE PTR ds:0x2ac07d3,0x0
b:  90                      nop
c:  90                      nop
d:  90                      nop
e:  90                      nop
f:  90                      nop 

These instructions replace the window style with WS_POPUP | WS_VISIBLE and clear the required registers for further operation.

file offset: 0x0000598C (address 0x0040658c)
old: 0f b6 35 d3 07 ac 02 f7 de 1b f6 33 c0 81 e6 00 00 36 7f 50 81 c6 00 00 ca 00
new: 33 c0 50 31 f6 81 c6 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90

0:  33 c0                   xor    eax,eax
2:  50                      push   eax
3:  31 f6                   xor    esi,esi
5:  81 c6 00 00 00 90       add    esi,0x90000000
b:  90                      nop
c:  90                      nop
d:  90                      nop
e:  90                      nop
f:  90                      nop
10: 90                      nop
11: 90                      nop
12: 90                      nop
13: 90                      nop
14: 90                      nop
15: 90                      nop
16: 90                      nop
17: 90                      nop
18: 90                      nop
19: 90                      nop 
0040653d - ? -         e8 be 41        CALL       get_config
                       42 00
00406542 - ? -         8b 78 18        MOV        EDI,dword ptr [EAX + 0x18]
00406545 - ? -         e8 b6 41        CALL       get_config
                       42 00
0040654a - ? -         8b 58 1c        MOV        EBX,dword ptr [EAX + 0x1c]
puVar2 = get_config();
local_14.right = puVar2[6];
puVar2 = get_config();
local_14.bottom = puVar2[7];
0040658c - ? -         0f b6 35        MOVZX      ESI,byte ptr [g_IsFullscreen]
                       d3 07 ac 02
00406593 - ? -         f7 de           NEG        ESI
00406595 - ? -         1b f6           SBB        ESI,ESI
00406597 - ? -         33 c0           XOR        EAX,EAX
00406599 - ? -         81 e6 00        AND        ESI,0x7f360000
                       00 36 7f
0040659f - ? -         50              PUSH       EAX
004065a0 - ? -         81 c6 00        ADD        ESI,0xca0000
                       00 ca 00
dwStyle = (-(uint)(g_IsFullscreen != 0) & 0x7f360000) + 0xca0000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment