| 1 | + | ### GameGuardian Patching Tool |
| 2 | + | Documentation: [here](cddn.fun/docs/memapi) |
| 3 | + | Created with love by [@asdhuman](t.me/asdhuman) |
| 4 | + | |
| 5 | + | ### General |
| 6 | + | MemAPI is a library for GameGuardian, created to work with memory easily. Place a library somewhere close to executed script, and import it |
| 7 | + | |
| 8 | + | ```lua |
| 9 | + | local memapi = require "libs/memapi" -- path is .../libs/memapi.lua |
| 10 | + | ``` |
| 11 | + | Now you can create handlers, hook to libraries, and read/modify memory. Basic example: |
| 12 | + | |
| 13 | + | ```lua |
| 14 | + | local handler = memapi.hook("libname") |
| 15 | + | |
| 16 | + | while not handler.is_hooked then |
| 17 | + | handler:attach() -- trying... |
| 18 | + | gg.sleep(100) -- waiting... |
| 19 | + | end |
| 20 | + | |
| 21 | + | function bypass_thing() |
| 22 | + | handler.write(0xAAAA, "mov r1, #21", "bx lr") -- asm |
| 23 | + | handler.write(0xF012, "00 00 FF FF 03 54 AA CD") -- bytes |
| 24 | + | handler.write(0xC00B, false) -- bool (mov + bx lr) |
| 25 | + | handler.write(0x5555, 63) -- int (mov + bx lr) |
| 26 | + | end |
| 27 | + | |
| 28 | + | local godmode = handler:switch(0xdeadbeef, "ff 00 ff aa 01 02 03 04", false) |
| 29 | + | -- state is false, if expected bytes in place |
| 30 | + | |
| 31 | + | local gm_char |
| 32 | + | while true then |
| 33 | + | if godmode.state then gm_char = "(+)" |
| 34 | + | else gm_char = "(-)" end |
| 35 | + | local menu = gg.multiChoise({ |
| 36 | + | gm_char .. " Godmode", |
| 37 | + | "Exit"}) |
| 38 | + | if menu == 1 then godmode.toggle() |
| 39 | + | elseif menu == 2 then os.exit() |
| 40 | + | else gg.setVisible(false) end |
| 41 | + | end |
| 42 | + | ``` |