Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Superior Go to Address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  

Do you want such options Cheat Engine?
Absolutely, Yes!
66%
 66%  [ 2 ]
Meh!
33%
 33%  [ 1 ]
Total Votes : 3

Author Message
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 229

PostPosted: Thu Oct 10, 2024 3:54 pm    Post subject: Superior Go to Address Reply with quote

Code:
-- Made by the GameHackingDojo
-- Special thanks to:
-- ParkourPenguin
-- AylinCE

local function go_to_address(type, offset)
  local version = {1, 1, 2, 0}
  local form_colour = 0x242424     --BGR
  local bevel_colour = 0x404040    --BGR
  local font_colour = 0xBBBBBB     --BGR
  local red_colour = 0x453ACC   --BGR
  local small_spacing = 4
  local spacing = 8
  local message_time = 2000   --Milliseconds
  local default_label = "Enter an address"

  -- Create main window
  local form = createForm(false)
  form.Caption = "Superior Go to Address by GHD"
  form.AutoSize = true
  form.Constraints.MaxHeight = 92
  form.Constraints.MinWidth = 400
  form.Constraints.MaxWidth = 1300
  form.Font.Color = font_colour
  --form.BorderStyle = 'bsNone'

  --[[local title_bar = createPanel(form)
  title_bar.Align = alTop
  title_bar.Height = 26
  title_bar.Color = 0x282828
  title_bar.BevelColor = bevel_colour
  title_bar.Color = form_colour
  title_bar.OnMouseDown = function(sender, button, x, y)
    if button == mbLeft then
      form.dragNow()
    end
  end

  local title_label = createLabel(title_bar)
  title_label.Caption = "Go to address"
  title_label.Font.Color = font_colour
  title_label.Font.Size = 9
  title_label.Align = asrCenter
  title_label.BorderSpacing.Left = small_spacing
  title_label.Alignment = "taLeft"
  title_label.OnMouseDown = function(sender, button, x, y)
    if button == mbLeft then
      form.dragNow()
    end
  end]]
 
  -- Centre to MemoryViewForm window
  local form_x, form_y = getMemoryViewForm().getPosition()
  form_x = form_x + getMemoryViewForm().width / 2 - form.width / 2
  form_y = form_y + getMemoryViewForm().height / 2 - form.height / 2
  form.setPosition(form_x, form_y)

  -- Create main panel
  local main_panel = createPanel(form)
  main_panel.Align = alClient
  main_panel.ClientHeight = form.ClientHeight
  main_panel.ClientWidth = form.ClientWidth
  main_panel.BevelColor = bevel_colour
 
  -- Create label
  local label =  createLabel(main_panel)
  label.Align = alLeft
  label.Caption = default_label
  label.BorderSpacing.Top = spacing
  label.BorderSpacing.Left = small_spacing
  label.BorderSpacing.Right = small_spacing

  -- Create input box
  local inputbox = createEdit(main_panel)
  inputbox.Align = asrCenter
  inputbox.BorderSpacing.Left = small_spacing
  inputbox.BorderSpacing.Right = small_spacing

  -- Create version label
  local version_label = createLabel(main_panel)
  version_label.Caption = "v"..version[1].."."..version[2].."."..version[3].."."..version[4]
  version_label.font.Color = red_colour
  version_label.font.size = 8
  version_label.Align = alRight
  version_label.AnchorSideTop.Control = label
  version_label.BorderSpacing.Top = spacing
  version_label.BorderSpacing.Left = small_spacing
  version_label.BorderSpacing.Right = small_spacing

  -- Create button panel
  local button_panel = createPanel(form)
  button_panel.ClientHeight = 40
  button_panel.Align = alBottom
  button_panel.BevelColor = bevel_colour

  -- Create go button
  local go_button = createButton(button_panel)
  go_button.Caption = "Go"
  go_button.Align = alRight
  go_button.Constraints.MinWidth = 75
  go_button.Constraints.MinHeight = 25
  go_button.AutoSize = true
  go_button.BorderSpacing.around = spacing
  go_button.OnCLick = function()
    if process == nil or process == "" and label.Caption == default_label then
      label.Caption = "Not attached to process" label.Font.Color = red_colour     -- error message
      createTimer(message_time, function()              -- revert the changes
        label.Caption = default_label
        label.Font.Color = font_colour
      end)
      return
    end
    if offset == true then inputbox.text = "$process+"..inputbox.text:gsub("%$process%+", "") end
    inputbox.text = string.gsub(inputbox.text, ":%$", "$process")     --define :$ as $process (x64dbg expression)
    local address = getAddressSafe(inputbox.text) or nil
    if address == nil and label.Caption == default_label then
      label.Caption = "Not a valid address" label.Font.Color = red_colour     -- error message
      createTimer(message_time, function()              -- revert the changes
        label.Caption = default_label
        label.Font.Color = font_colour
      end)
      return
    end
    if type == "disassembler" then getMemoryViewForm().DisassemblerView.TopAddress = address end
    if type == "memory_view" then getMemoryViewForm().HexadecimalView.Address = address end
    form.close()
  end

  -- Add OnKeyDown event for Enter key
  inputbox.OnKeyDown = function(sender, key) if key == VK_RETURN then go_button.DoClick() end end

  -- Create cancel button
  local cancel_button = createButton(button_panel)
  cancel_button.Caption = "Cancel"
  cancel_button.Align = alRight
  cancel_button.Constraints.MinWidth = 75
  cancel_button.Constraints.MinHeight = 25
  cancel_button.AutoSize = true
  cancel_button.BorderSpacing.around = spacing
  cancel_button.OnClick = function() form.close() end

    -- Create module or symbol checkbox
  local offset_checkbox = createCheckBox(button_panel)
  local initial_offset_input = ""
  offset_checkbox.Caption = "Go to Offset"
  offset_checkbox.Align = alLeft
  offset_checkbox.Constraints.MinWidth = 50
  offset_checkbox.Constraints.MaxHeight = 19
  offset_checkbox.BorderSpacing.around = spacing
  if offset == true then offset_checkbox.state = cbChecked end
  offset_checkbox.onChange = function()
    if offset_checkbox.state == cbChecked then offset = true else offset = false end
    inputbox.text = string.gsub(inputbox.text, ":%$", "$process")     --define :$ as $process (x64dbg expression)
    if offset_checkbox.state == cbChecked then
      initial_offset_input = inputbox.text:gsub("%s+$", "")
    else
      if initial_offset_input ~= "" then inputbox.text = initial_offset_input end
    end
  end

  -- Create module or symbol checkbox
  local module_symbol_checkbox = createCheckBox(button_panel)
  local initial_module_symbol_input = ""
  module_symbol_checkbox.Caption = "Module or Symbol"
  module_symbol_checkbox.Align = alLeft
  module_symbol_checkbox.Left = 60
  module_symbol_checkbox.Constraints.MinWidth = 110
  module_symbol_checkbox.Constraints.MaxHeight = 19
  module_symbol_checkbox.BorderSpacing.around = spacing
  module_symbol_checkbox.setAllowGrayed(true)
  module_symbol_checkbox.onChange = function()
    inputbox.text = string.gsub(inputbox.text, ":%$", "$process")     --define :$ as $process (x64dbg expression)
    if getAddressSafe(inputbox.text) == nil and label.Caption == default_label then
      label.Caption = "Not a valid address" label.Font.Color = red_colour     -- error message
      createTimer(message_time, function()              -- revert the changes
        label.Caption = default_label
        label.Font.Color = font_colour
      end)
      module_symbol_checkbox.state  = cbUnchecked
     return
   end
    if module_symbol_checkbox.state ~= cbUnchecked then
      if module_symbol_checkbox.state == cbGrayed then
        initial_module_symbol_input = inputbox.text:gsub("%s+$", "")
        if offset == true then
          inputbox.text = "$process+"..inputbox.text:gsub("%$process%+", "")
          offset = false
          offset_checkbox.state = cbUnchecked
        end
        inputbox.text = getNameFromAddress(inputbox.text, true, false)
      end
      if module_symbol_checkbox.state == cbChecked then
        if offset == true then
          inputbox.text = "$process+"..inputbox.text:gsub("%$process%+", "")
          offset = false
          offset_checkbox.state = cbUnchecked
        end
        inputbox.text = getNameFromAddress(inputbox.text, true, true)
      end
    end
    if module_symbol_checkbox.state == cbUnchecked then
      inputbox.text = initial_module_symbol_input
    end
  end

  form.showModal()
end

for i = 0, getMemoryViewForm().DisassemblerView.PopupMenu.items.count - 1 do
  local item = getMemoryViewForm().DisassemblerView.PopupMenu.items[i]
  if item.name == "Gotoaddress1" then
    local offset_item_index = i + 1
    local popup_menu = getMemoryViewForm().DisassemblerView.PopupMenu
    local menu_item = createMenuItem(popup_menu)
    menu_item.Caption = "Go to Offset"
    menu_item.ImageIndex = 35
    menu_item.ShortCut = textToShortCut("Ctrl+F")
    menu_item.OnClick = function(s)
      go_to_address("disassembler", true)
    end

    popup_menu.Items.insert(offset_item_index, menu_item)

    item.OnClick = function() go_to_address("disassembler", false) end
  end
end

for i = 0, getMemoryViewForm().HexadecimalView.PopupMenu.items.count - 1 do
  local item = getMemoryViewForm().HexadecimalView.PopupMenu.items[i]
  if item.name == "Goto1" then
    local offset_item_index = i + 1
    local popup_menu = getMemoryViewForm().HexadecimalView.PopupMenu
    local menu_item = createMenuItem(popup_menu)
    menu_item.Caption = "Go to Offset"
    menu_item.ImageIndex = 35
    --menu_item.ShortCut = textToShortCut("Ctrl+F")
    menu_item.OnClick = function(s)
      go_to_address("memory_view", true)
    end

    popup_menu.Items.insert(offset_item_index, menu_item)

    item.OnClick = function() go_to_address("memory_view", false) end
  end
end


Last edited by Game Hacking Dojo on Sat Oct 12, 2024 4:26 pm; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 229

PostPosted: Fri Oct 11, 2024 9:28 am    Post subject: Reply with quote

A big update

Dark byte, can you please try it and add it to Cheat Engine? We really need this, Thank you



Screenshot 2024-10-11 172317.png
 Description:
 Filesize:  7.18 KB
 Viewed:  3671 Time(s)

Screenshot 2024-10-11 172317.png



Superior Go to Address.lua
 Description:

Download
 Filename:  Superior Go to Address.lua
 Filesize:  9.24 KB
 Downloaded:  146 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 229

PostPosted: Tue Nov 26, 2024 12:13 pm    Post subject: Reply with quote

Another Big Update

Now:
- It saves your history
- You can go to the module base if the input box is empty while the offset is checked
- You can type :$ to go to the module base. (no plus needed between the symbol and offset like in x64dbg)
- You can use hotkeys (Ctrl + F) to toggle offset on or off.
- You can use the Escape key to close the form
- The input box is filled with the selected address by default



Screenshot 2024-11-26 190940.png
 Description:
 Filesize:  7.92 KB
 Viewed:  799 Time(s)

Screenshot 2024-11-26 190940.png



Superior Go to Address.lua
 Description:

Download
 Filename:  Superior Go to Address.lua
 Filesize:  10.46 KB
 Downloaded:  32 Time(s)

Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1432

PostPosted: Tue Nov 26, 2024 1:35 pm    Post subject: Reply with quote

Need advice?

1) Avoid overused control names (like "form")

2) Make the dimensions uniform and equal for each user;

Code:
DP1=getScreenDPI()/96

  form.Constraints.MaxHeight = 92*DP1

  title_label.Font.Size = 9*DP1

  local form_x, form_y = getMemoryViewForm().getPosition()
  form_x = form_x + getMemoryViewForm().width*DP1 / 2*DP1 - form.width*DP1 / 2*DP1
  form_y = form_y + getMemoryViewForm().height*DP1 / 2*DP1 - form.height*DP1 / 2*DP1
  form.setPosition(form_x*DP1, form_y*DP1)

  module_symbol_checkbox.Left = 60*DP1

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 229

PostPosted: Tue Nov 26, 2024 4:49 pm    Post subject: Reply with quote

Thank you for the feedback that really helps, AylinCE

And here's the update:

- Fixed history list order now shows the last address at the top
- Fixed not detecting screen dpi. (Thanks to AylinCE)
- And of course, introduced new bugs to fix later



Screenshot 2024-11-26 233944.png
 Description:
 Filesize:  7.91 KB
 Viewed:  750 Time(s)

Screenshot 2024-11-26 233944.png



Superior Go to Address.lua
 Description:

Download
 Filename:  Superior Go to Address.lua
 Filesize:  10.67 KB
 Downloaded:  43 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 229

PostPosted: Sat Nov 30, 2024 4:55 am    Post subject: Reply with quote

New update:

- Fixed not showing in the middle of the memory view form
- Tested on multiple screens and resolutions
- More safety checks added to avoid access violation
- UI improvements
- And perhaps some new bugs



Screenshot 2024-11-30 031518.png
 Description:
 Filesize:  5.8 KB
 Viewed:  468 Time(s)

Screenshot 2024-11-30 031518.png



Superior Go to Address.lua
 Description:

Download
 Filename:  Superior Go to Address.lua
 Filesize:  11.7 KB
 Downloaded:  27 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites