The previous fog patch has some issues, misaligning the x87 stack mainly, and some poor naming
jmpFog -> getFog:
fld DWORD PTR [ecx+0xc60]
This is not a jmp instruction but a fld instruction, it loads the fog end distance onto the x87 stack.
The previous solution of removing the instruction entirely, no longer loads something onto the stack, misaligning it and using whatever value happened to exist there before.
This has been replaced with the fldz instruction, which always loads 0 onto the stack, and mimics how the fog_toggle command works (sets end distance to 0).
codeF512 -> float96:
0, 0, 192, 66 isn't code and is just the bytes for 96.0
For the below explanation: float512Address is the address for default sky distance, which the fog patch changes from 96 to 512, allowing you to zoom out more without the the ground unloading.
jmpMapSkyDistance -> setMapSkyDistance:
fstp DWORD PTR [ebx+0xc70]
This is also not a jmp instruction but a fstp instruction, related to how far you can zoom out before the game stops drawing parts of the ground. The game at this instruction is replacing the default sky distance value (now 512) with a more specific value, but we always want the large default.
The previous solution of removing the instruction entirely, doesn't remove a value from the stack anymore, misaligning it.
This was replaced with fstp st(0), which prevents the game from changing the default value, but also removes the new value from the stack.
The previous fog patch has some issues, misaligning the x87 stack mainly, and some poor naming
jmpFog -> getFog:
fld DWORD PTR [ecx+0xc60]
This is not a jmp instruction but a fld instruction, it loads the fog end distance onto the x87 stack. The previous solution of removing the instruction entirely, no longer loads something onto the stack, misaligning it and using whatever value happened to exist there before. This has been replaced with thefldz
instruction, which always loads 0 onto the stack, and mimics how the fog_toggle command works (sets end distance to 0).codeF512 -> float96:
0, 0, 192, 66
isn't code and is just the bytes for 96.0 For the below explanation: float512Address is the address for default sky distance, which the fog patch changes from 96 to 512, allowing you to zoom out more without the the ground unloading.jmpMapSkyDistance -> setMapSkyDistance:
fstp DWORD PTR [ebx+0xc70]
This is also not a jmp instruction but a fstp instruction, related to how far you can zoom out before the game stops drawing parts of the ground. The game at this instruction is replacing the default sky distance value (now 512) with a more specific value, but we always want the large default. The previous solution of removing the instruction entirely, doesn't remove a value from the stack anymore, misaligning it. This was replaced withfstp st(0)
, which prevents the game from changing the default value, but also removes the new value from the stack.