Skip to content

Load records with attributes on their tag; run Cheat Engine tables' Lua - #16

Merged
wleeaf merged 1 commit into
mainfrom
ct-entry-attributes
Nov 21, 2026
Merged

wleeaf merged 1 commit into
mainfrom
ct-entry-attributes

Conversation

@wleeaf

@wleeaf wleeaf commented Nov 21, 2026

Copy link
Copy Markdown
Owner

For #15. The table from that issue (Dave the Diver, fearlessrevolution) did not load properly. I could not reproduce the crash itself, so the issue stays open for the reporter's details.

Table loading. Cheat Engine marks some records on the tag itself, as <CheatEntry NoCheckbox="1"> or <CheatEntry NoScriptTag="1">. The loader looked only for <CheatEntry>, so it skipped such a record and moved its children to the top level. Its nesting count missed these tags as well.

For this table that meant 550 of 1040 records. None of its 19 scripts loaded: "Initialize Mono" and every hook under it were gone, and the remaining records point through symbols only those scripts register.

Now:

  • Start tags match with or without attributes.
  • The attributes are kept and written back on save, through the GUI's records too.
  • All 1040 records of the table load. Each matches an XML reference parse in parent, description and address.

Lua the table needs

  • Function names. Cheat Engine registers every Lua function under both cases of its first letter (lua_register in LuaHandler.pas), and the table calls OpenProcess and ShellExecute.
    • Engine functions now get the other name too. Lua's own functions don't, and a name already in use is never overwritten.
    • The pass runs again after the GUI registers its functions.
    • Gated functions are wrapped when registered, so an alias inherits the gate.
  • getProcessIDFromProcessName / openProcess find a Windows program under Wine by the .exe name in argv[0], ignoring case. Only the program has it there. Proton's launcher, steam.exe and the runtime's wrappers name it later in their arguments.
  • mono_initialize() and LaunchMonoDataCollector() are accepted. Mono and IL2CPP support is built in, so nothing is injected. The second returns the runtime module's base, or 0, like Cheat Engine's.
  • beep() exists.

Tests

  • cecore_test covers:
    • records with tag attributes: nesting, whitespace in the tag, save and reload;
    • both name cases (Print and Dofile stay absent);
    • the .exe lookup on a process whose argv[0] is a Windows path;
    • the Mono start-up functions.
  • I drove the real main window offscreen against a Wine program named DaveTheDiver.exe, with this table loaded and its Lua accepted:
    • "Initialize Mono" now enables, and the game keeps running;
    • a hook whose game code is absent fails with a clear message.
  • The full build and regression suite pass on workhorse.

Cheat Engine marks some records on the tag itself (<CheatEntry
NoCheckbox="1">, <CheatEntry NoScriptTag="1">). The loader looked only
for "<CheatEntry>", so it skipped such a record and moved its children
to the top level, and the nesting count missed them too. The Dave the
Diver table from issue #15 loaded 550 of its 1040 records, without its
"Initialize Mono" script and all 18 hooks under it. Start tags are now
matched with or without attributes, and the attributes are kept and
written back on save (through the GUI's records as well).

The same table's Lua needed more of Cheat Engine:
- Cheat Engine registers every Lua function under both cases of its
  first letter, and tables call OpenProcess and ShellExecute. Engine
  functions now get the other name too (not Lua's own, and never over
  a name in use); the pass runs again after the GUI's functions.
- getProcessIDFromProcessName and openProcess find a Windows program
  under Wine by the .exe name in argv[0], ignoring case. Only the
  program itself has it there, not Proton's launcher or steam.exe.
- mono_initialize() and LaunchMonoDataCollector() exist. Mono and
  IL2CPP support is built in, so nothing is injected; the latter
  returns the runtime module's base, or 0, as Cheat Engine does.
- beep() exists (the desktop bell in the GUI).
@wleeaf
wleeaf merged commit fd374fc into main Nov 21, 2026
15 checks passed
@wleeaf
wleeaf deleted the ct-entry-attributes branch November 21, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant