Skip to content

Add support for the GPU in bruteforcing mode#8

Draft
jonbarrow wants to merge 1 commit intomasterfrom
feat/gpu
Draft

Add support for the GPU in bruteforcing mode#8
jonbarrow wants to merge 1 commit intomasterfrom
feat/gpu

Conversation

@jonbarrow
Copy link
Member

@jonbarrow jonbarrow commented Feb 16, 2026

Resolves #XXX

Changes:

  • Removes the -stop-after flag. This flag was rather useless, I added it under the impression that maybe a few collisions would happen and you could pick out the correct key from the list, but that's nowhere near the case. When bruteforcing a PRUDPv1 access key, only 1 possibility exists so it will ALWAYS return 1 result. When bruteforcing a PRUDPv0 access key, there will be thousands of collisions, making it impossible to determine the original access key. Plus, it made the GPU code more complex. So instead, I just opted to remove that flag entirely and always only return the first valid access key
  • Moves all the bruteforcing code into a bruteforce folder, for organizational reasons. This lets us put all the CGO backend code alongside the bruteforcing code without cluttering the main folder
  • Creates a common folder for some common utilities shared between ROM scanning mode and bruteforcing mode
  • Adds a new -gpu flag. When set with -bruteforce, the program will try to select the first available GPU backend to run the bruteforcing on. If none are available, it falls back to the CPU backend. I tried to make this flag customizable, such as -gpu doing automatic scanning and -gpu=metal to manually set the backend, but the Go flag package makes that annoying when using interfaces like this is now
  • Adds an Apple Metal GPU backend. This is the only GPU backend I am able to test. I had originally put the shader in a .metal file alongside the Objective-C code, but when the program was compiled it wouldn't actually bundle that source into the program. It would try to dynamically load the .metal file, which would break when distributing the build. So I just embedded it manually. Unsure if there's a way around that

In my tests I was able to get the Terraria game server access key in 5 seconds and the MK7 access key in 0.2 seconds when using the Metal backend.

Marked as a draft for now since I'm not very good at writing GPU code, and I only have a 2024 Mac Mini to test with. Other GPU backends should be added before this is merged. Also need to make sure builds work in CI, no idea if they will since iirc the Apple parts require Xcode?

@DaniElectra @shutterbug2000 do you guys have other GPUs to test with? Y'all seem like the type of people to have some

this commit only adds work for the Apple Metal GPU backend. it tries to establish a common API for other backends to follow, but I dont have any other devices to test with
@DaniElectra
Copy link
Member

I have a RTX 4060 Ti on Windows and integrated AMD graphics of a Ryzen 7 5700U on Linux. I'm not sure I can work on GPU implementations right now but if you make something I'll be happy to test it

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

Comments