Skip to content

Attempted fix to improve hardware logging#438

Open
12problems wants to merge 3 commits into
Balatro-Multiplayer:devfrom
12problems:update/hardwareLog
Open

Attempted fix to improve hardware logging#438
12problems wants to merge 3 commits into
Balatro-Multiplayer:devfrom
12problems:update/hardwareLog

Conversation

@12problems
Copy link
Copy Markdown
Contributor

This hopefully improves the hardware logging system to improve it so we run into less duplicates (ideally none).
This is untested on MacOS and Linux, so we need to perform adequette testing to ensure it works right.
In addition, this system keeps the old one, so a new variable will have to be established to create ties between old IDs and new IDs.

@stephenkirk
Copy link
Copy Markdown
Member

A few thoughts from a quick skim, no need to act on all of these now:

  • Wiring it up isn't backward compatible. The new hash is a totally different value than the old one on the same machine, so every existing user looks new to the server - bans, ranked history, etc. get orphaned unless the server learns to map old → new. PR description hints at this ("ties between old IDs and new IDs"), but it's a coordinated client+server migration, not just drop-in.

  • The new ID is also less stable per user. Concatenating five hardware sources means any one of them changing (disk swap, BIOS reflash, mobo swap) invalidates the whole hash. Today's volume-serial-only ID only churns on reformat.

  • The failure mode is "everyone collapses to one ID." wmic is removed by default on Windows 11 24H2+, and the Linux sysfs reads (product_uuid, board_serial) need root. When the probes fail you hash an empty string - every affected user gets the same fingerprint. The if not raw_id2 fallback doesn't catch this because the function always returns a string. Suggest using the registry MachineGuid on Windows and falling back to username on Linux when probes return empty.

  • 4–5 io.popen subprocesses per call, at connection time. wmic alone can easily stall 1-3s per invocation. Worth caching the result in a module-local after first compute, and ideally avoiding subprocesses entirely on Windows (registry/FFI), the current FFI volume-serial path is instant.

  • macOS AppleAHCIDiskDriver query is empty on Apple Silicon (M-series uses NVMe via IONVMeController). The IOPlatformUUID part still works there so it's not fatal - that disk-serial component is just always blank on modern Macs and contributes nothing to the fingerprint.

Nits:

  • rawraw leaks a global (missing local) - pollutes _G with raw hardware serials. Returning the raw concatenated serials at all feels risky; better to hash inside the function and never let the cleartext escape.
  • jit.os == "OSX" vs the existing love.system.getOS() == "OS X" — two conventions in the same function.
  • New functions are space-indented; rest of the file is tabs.

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.

2 participants