Page 3 of 3

Re: Underkeep

Posted: Tue Nov 17, 2026 4:15 am
by Marc

for people like me, having trouble with some of the puzzles: https://intoindiegames.com/walkthrough- ... uides-hub/ :)


Re: Underkeep

Posted: Tue Nov 17, 2026 7:39 am
by bbfox

Underkeep 1.05 — current level / party location struct -- I don't check your table struct data, maybe the same.
This is where my helper app to get map name and coords
Base: underkeep.exe+43F528

SymbolScan for base address (may survival after game update) :
AOB: ?? 88 ?? ?? ?? ?? ?? ?? 85 ?? 74 ?? ?? FF FF FF FF F0 0F C1 ?? 83 ?? 01 75 ?? ?? 8B ?? ?? ?? ?? ?? ?? 85 ?? 74 ?? E8 ?? ?? ?? ?? ?? 8D
hit at address underkeep.exe+1A4114, inst mov [underkeep.exe+43F528],dil
rel32 at +3, instruction length 7 (unique in 1.05)

SymbolScan lua:

Spoiler
[ENABLE]
{$lua}
if syntaxcheck then return end

if not AOBScanModuleUE then
  function AOBScanModuleUE(moduleName, signature)
    local baseAddr = nil
    local maxAddr = 0
    local modList
    synchronize(function()
      modList = enumModules()
    end)
    for _, mod in ipairs(modList) do
      if string.lower(mod.Name) == string.lower(moduleName)
         or (ansiToUTF8 and string.lower(ansiToUTF8(mod.Name) or '') == string.lower(moduleName)) then
        baseAddr = mod.Address
        maxAddr = baseAddr + mod.Size
        break
      end
    end
    if not baseAddr then return nil end
    local ms, results, addr
    local __ok, __err = pcall(function()
      ms = createMemScan()
      synchronize(function()
        ms.firstScan(soExactValue, vtByteArray, nil, signature,
          nil, baseAddr, maxAddr, '+X-C-W', fsmNotAligned, '1', true, true, false, false)
      end)
      ms.waitTillDone()
      results = createFoundList(ms)
      results.initialize()
      synchronize(function()
        if results.getCount() > 0 then
          addr = results[0]
        end
      end)
    end)
    if results then results.destroy() end
    if ms then ms.destroy() end
    if not ok then error(err, 0) end
    return addr
  end
end
registerLuaFunctionHighlight('AOBScanModuleUE')

local AOBs = {
  {name='Loc_struct', aob='?? 88 ?? ?? ?? ?? ?? ?? 85 ?? 74 ?? ?? FF FF FF FF F0 0F C1 ?? 83 ?? 01 75 ?? ?? 8B ?? ?? ?? ?? ?? ?? 85 ?? 74 ?? E8 ?? ?? ?? ?? ?? 8D', pos=3, aoblen=7, symbol='Loc_struct_addr'},
}

local module_name = 'underkeep.exe'

local scan_failed = {}
for _, entry in ipairs(AOBs) do
  local aob_addr_str = AOBScanModuleUE(module_name, entry.aob)
  if not aob_addr_str and module_name ~= process then
    print(string.format(
      '[SymbolScanner] module %s not found or no match; falling back to %s',
      tostring(module_name), tostring(process)))
    aob_addr_str = AOBScanModuleUE(process, entry.aob)
  end
  if aob_addr_str then
    local aob_addr_val = tonumber(aob_addr_str, 16)
    local offset_addr = aob_addr_val + entry.pos
    local relative_offset = readInteger(offset_addr, true)
    local final_addr = relative_offset + aob_addr_val + entry.aoblen
    synchronize(function()
      unregisterSymbol(entry.symbol)
      registerSymbol(entry.symbol, final_addr)
    end)
    print(string.format('[SymbolScanner] %s registered at: %X', entry.name, final_addr))
  else
    print(string.format('[SymbolScanner] WARNING: AOB scan failed for %s', entry.name))
    scan_failed[#scan_failed + 1] = entry.name
  end
end
if #scan_failed > 0 then
  error('[SymbolScanner] AOB scan failed for ' .. table.concat(scan_failed, ', '), 0)
end

{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
unregisterSymbol('Loc_struct_addr')
{$asm}

Structures: not spend time in double check. may be incorrect

Offset Type Description
+000 byte Level loaded flag (1 = loaded, 0 = unloaded)
+008 ptr Level name string block -> +0 refcount, +4 length, +8 char[] i.e. ("Starting_forest") <=== map name string
+010 char* Level name chars (= block+8)
+018 int32 Level name length
+098 int32 Array count (cleared on load)
+0A8 int32 Tile chunk count
+0B0 ptr Tile chunk array (0x98 bytes each, first qword = x,y)
+0B8 int32 Array count (cleared on load)
+0C8 int32 Array count (cleared on load)
+0D8 ? Container (cleared on load/unload)
+0E8 int32 Map min X
+0EC int32 Map min Y
+0F0 int32 Map width (max X - min X + 1)
+0F4 int32 Map height (max Y - min Y + 1)
+0F8 int32 Party loc X (east = +1)
+0FC int32 Party loc Y (south = +1)
+100 int32 Facing (0 = N, 1 = E, 2 = S, 3 = W)

Notes

  • The level name equals the level file name without "level_" / ".level.rfile", e.g. base\level_Starting_forest.level.rfile. The game has no numeric map ID; levels are looked up by name.

  • Each surface map has its own coordinate system. Most dungeons share coordinates with the surface map above them.

  • Map bounds = min/max X/Y of the level file's tiles. Checked against Starting_forest: X -32..39, Y -64..-11 -> min (-32,-64), width 72, height 54.

  • Offsets +0E8 and above may be separate globals that happen to be adjacent, not members of the same struct. May be changed after a game update.


Re: Underkeep

Posted: Tue Nov 17, 2026 9:36 am
by bbfox

Hi Marc:
In some case your spending Stamina sets it back to max will not working as expected (stamina will reset to 0 in my Stoneborn race warrior) because of eflags not correct (cmovs will set value to 0). Also I don't check if register r8d will be used later, so I play safe.
Here is revised one that working in my PC.

Code: Select all

[ENABLE]

aobscanmodule(stamina,underkeep.exe,44 29 87 00 01 00 00 BB 00 00 00 00 8B 87 00 01 00 00) // should be unique
alloc(newmem,$100,stamina)

label(code)
label(return)

newmem:
  mov ebx,[rdi+000000F0]
  add ebx,r8d
  mov [rdi+00000100],ebx

code:
  sub [rdi+00000100],r8d
  jmp return

stamina:
  jmp newmem
  nop 2
return:
registersymbol(stamina)

[DISABLE]

stamina:
  db 44 29 87 00 01 00 00

unregistersymbol(stamina)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: underkeep.exe+184A75

underkeep.exe+184A4E: B9 01 00 00 00        - mov ecx,00000001
underkeep.exe+184A53: BA 1B 00 00 04        - mov edx,0400001B
underkeep.exe+184A58: 89 4C 24 20           - mov [rsp+20],ecx
underkeep.exe+184A5C: 48 8B CF              - mov rcx,rdi
underkeep.exe+184A5F: E8 5C A5 FF FF        - call underkeep.exe+17EFC0
underkeep.exe+184A64: E9 1F 01 00 00        - jmp underkeep.exe+184B88
underkeep.exe+184A69: A9 FC FF FF FF        - test eax,FFFFFFFC
underkeep.exe+184A6E: 75 25                 - jne underkeep.exe+184A95
underkeep.exe+184A70: 83 F8 01              - cmp eax,01
underkeep.exe+184A73: 74 20                 - je underkeep.exe+184A95
// ---------- INJECTING HERE ----------
underkeep.exe+184A75: 44 29 87 00 01 00 00  - sub [rdi+00000100],r8d
// ---------- DONE INJECTING  ----------
underkeep.exe+184A7C: BB 00 00 00 00        - mov ebx,00000000
underkeep.exe+184A81: 8B 87 00 01 00 00     - mov eax,[rdi+00000100]
underkeep.exe+184A87: 0F 48 C3              - cmovs eax,ebx
underkeep.exe+184A8A: 89 87 00 01 00 00     - mov [rdi+00000100],eax
underkeep.exe+184A90: E9 F3 00 00 00        - jmp underkeep.exe+184B88
underkeep.exe+184A95: 83 C0 FC              - add eax,-04
underkeep.exe+184A98: 83 F8 01              - cmp eax,01
underkeep.exe+184A9B: 0F 87 E7 00 00 00     - ja underkeep.exe+184B88
underkeep.exe+184AA1: 48 8B 8F A0 02 00 00  - mov rcx,[rdi+000002A0]
underkeep.exe+184AA8: 48 63 87 98 02 00 00  - movsxd  rax,dword ptr [rdi+00000298]
}

Re: Underkeep

Posted: Tue Nov 17, 2026 10:31 am
by Marc

hi bbfox,

thanks for finding and fixing - will update the table :)