Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Disable Alt+Enter

A Script for disabling Alt+Enter with RPGXP Version 1.02a:
Code:
########################

# Disable Alt+Enter

# Autor Reborn

########################

module Disable 

  PAGE_READWRITE = 0x04 

  MoveMemory = Win32API.new('Kernel32.dll', 'RtlMoveMemory', 'ppl', 'v') 

  VirtualProtect = Win32API.new('Kernel32.dll', 'VirtualProtect', 'pllp', 'l') 

  def self.AltEnter(disable=true) 

    if (disable) 

      patchAltEnter() 

    else 

      unpatchAltEnter() 

    end 

  end 

  def self.F1(disable=true) 

    if (disable) 

      patchF1() 

    else 

      unpatchF1() 

    end 

  end 

  def self.patchAltEnter() 

    # 1 retn and 4 NOPs 

    charArr = [0xC3, 0x90, 0x90, 0x90, 0x90].pack('C5') 

    # address before full screen call 

    address = 0x1008C975 

    oldProtection = "xxxx" 

    VirtualProtect.call(address, 1024, PAGE_READWRITE, oldProtection) 

    # place a retn-command before full screen call 

    MoveMemory.call(address, charArr, 5) 

    VirtualProtect.call(address, 1024, 64, "xxxx") 

  end 

  def self.unpatchAltEnter() 

    # the orginal assemblies 

    charArr = [0x66, 0xC7, 0x44, 0x24, 0x3C].pack('C5') 

    # address from full screen call 

    address = 0x1008C975 

    oldProtection = "xxxx" 

    VirtualProtect.call(address, 1024, PAGE_READWRITE, oldProtection) 

    MoveMemory.call(address, charArr, 5) 

    VirtualProtect.call(address, 1024, 64, "xxxx") 

  end 

  def self.patchF1() 

    # 6 NOPs 

    charArr = [0x90, 0x90, 0x90, 0x90, 0x90, 0x90].pack('C6') 

    # address from F1 call 

    address = 0x10003A36 

    oldProtection = "xxxx" 

    VirtualProtect.call(address, 1024, PAGE_READWRITE, oldProtection) 

    MoveMemory.call(address, charArr, 6) 

    VirtualProtect.call(address, 1024, 64, "xxxx") 

  end 

  def self.unpatchF1() 

    # the orginal assemblies 

    charArr = [0xFF, 0x15, 0x18, 0x00, 0x0E, 0x10].pack('C6') 

    # address from F1 call 

    address = 0x10003A36 

    oldProtection = "xxxx" 

    VirtualProtect.call(address, 1024, PAGE_READWRITE, oldProtection) 

    MoveMemory.call(address, charArr, 6) 

    VirtualProtect.call(address, 1024, 64, "xxxx") 

  end 

end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top