Skip to content

Instantly share code, notes, and snippets.

@alessandrogario
Created September 3, 2014 12:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alessandrogario/82e01e29cf8de9301416 to your computer and use it in GitHub Desktop.
Save alessandrogario/82e01e29cf8de9301416 to your computer and use it in GitHub Desktop.
Simple IDC script for IDA Pro that prevents the game (XCOM: Terror from the Deep) from going fullscren
// XCOM-TFtD_DisableFullscreen.idc
// Simple IDC script for IDA Pro that prevents the game (XCOM: Terror from the Deep) from going fullscren
#include <idc.idc>
static main()
{
auto IDirectDraw7_SetCooperativeLevel = 0x0046587E;
if (!RunTo(IDirectDraw7_SetCooperativeLevel))
return 1;
if (GetDebuggerEvent(WFNE_SUSP, -1) <= 0)
return 1;
auto screen_flags_ptr = GetRegValue("ESP");
screen_flags_ptr = screen_flags_ptr + 0x08;
auto screen_flags = DbgDword(screen_flags_ptr);
if (screen_flags != 0x51) // (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX)
return 1;
PatchDbgByte(screen_flags_ptr, 0x08); // (DDSCL_NORMAL)
GetDebuggerEvent(WFNE_CONT, 0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment