#include <pthread.h> #include <cstring> #include <cstdlib...
A public project built with the Lightcap AI agent by anon-29ef — open to read, run, fork, and export. Updated .
Prompt
#include <pthread.h> #include <cstring> #include <cstdlib> #include <stdint.h>
// --- Template Function & Macro Declarations --- // This manually declares what the mod menu layout uses so you don't need Menu.h extern "C" bool getFeatureSettingIf(int featureId);
#ifndef OBFUSCATE #define OBFUSCATE(str) str #endif
// --- Variable Configuration --- long long customGoldValue = 999999; // Default starting value for Gold
// --- Function Pointer Signatures --- // C# 'long' types map to 64-bit 'long long' integers in native C++ long long (orig_get_SoftCurrency)(void instance); long long (orig_get_HardCurrency)(void instance);
// --- Hook Replacements ---
// Soft Currency (Gold/Coins) Hook - RVA: 0x2F0F84C long long hk_get_SoftCurrency(void *instance) { if (instance != nullptr) { // Feature ID 1 is the toggle switch for Unlimited Gold if (getFeatureSettingIf(1)) { return customGoldValue; // Return the custom textfield value } } return orig_get_SoftCurrency(instance); }
// Hard Currency (Gems/Diamonds) Hook - RVA: 0x2F0F85C long long hk_get_HardCurrency(void *instance) { if (instance != nullptr) { // Feature ID 3 is the toggle switch for Unlimited Gems if (getFeatureSettingIf(3)) { return 9999999; // Fallback maximum amount for premium gems } } return orig_get_HardCurrency(instance); }
// --- Menu Framework Setup Functions ---
// 1. Define the layout items inside your menu void setup() { OBFUSCATE("1[-]Enable Unlimited Gold"); OBFUSCATE("2[Textfield:Enter Gold Amount]"); OBFUSCATE("3[-]Enable Unlimited Gems"); }
// 2. Capture when features or inputs change in the menu layout void featureChanged(int feature, bool booleanValue, int intValue, const char* textValue) { switch (feature) { case 2: // Captures input from the Gold textfield (Feature ID 2) if (textValue != nullptr && std::strlen(textValue) > 0) { // strtoll parses the text box string into a clean 64-bit number safely customGoldValue = std::strtoll(textValue, nullptr, 10); } break; default: break; } }
// --- Injection Core (Thread & Initialization) ---
extern "C" uintptr_t getRealOffset(uintptr_t offset); extern "C" void MSHookFunction(void symbol, void replace, void **result);
void hack_thread(void ) { // Calculate memory targets using layout offsets from the dump void target_get_SoftCurrency = (void )getRealOffset(0x2F0F84C); void target_get_HardCurrency = (void )getRealOffset(0x2F0F85C);
// Apply dynamic method hooking if (target_get_SoftCurrency != nullptr) { MSHookFunction(target_get_SoftCurrency, (void )hk_get_SoftCurrency, (void *)&orig_get_SoftCurrency); }
if (target_get_HardCurrency != nullptr) { MSHookFunction(target_get_HardCurrency, (void )hk_get_HardCurrency, (void *)&orig_get_HardCurrency); }
return nullptr; }
__attribute__((constructor)) void init() { pthread_t pt; pthread_create(&pt, nullptr, hack_thread, nullptr); }
╰─ make clean && make package ─╯ ==> Cleaning… ==> Notice: Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://theos.dev/docs/parallel-building
Making all for tweak lol…
==> Preprocessing Tweak.xm… ==> Compiling Tweak.xm (arm64)… Tweak.xm:50:15: error: expression result unused [-Werror,-Wunused-value] 50 | OBFUSCATE("1[-]Enable Unlimited Gold"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Tweak.xm:11:24: note: expanded from macro 'OBFUSCATE' 11 | #define OBFUSCATE(str) str | ^~~ Tweak.xm:51:15: error: expression result unused [-Werror,-Wunused-value] 51 | OBFUSCATE("2[Textfield:Enter Gold Amount]"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tweak.xm:11:24: note: expanded from macro 'OBFUSCATE' 11 | #define OBFUSCATE(str) str | ^~~ Tweak.xm:52:15: error: expression result unused [-Werror,-Wunused-value] 52 | OBFUSCATE("3[-]Enable Unlimited Gems"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Tweak.xm:11:24: note: expanded from macro 'OBFUSCATE' 11 | #define OBFUSCATE(str) str | ^~~ 3 errors generated. make[3]: * [/Users/mardy/Desktop/lol/.theos/obj/debug/arm64/Tweak.xm.76065de2.o] Error 1 rm [path] make[2]: [/Users/mardy/Desktop/lol/.theos/obj/debug/arm64/lol.dylib] Error 2 make[1]: [internal-library-all_] Error 2 make: * [lol.all.tweak.variables] Error 2
Lightcap
Lightcap Small built this together — split into 1 part and worked in parallel, so it came together fast.
It doesn't compile yet — build failed, so the later checks couldn't run.
The 12 files are a real first draft in your workspace, not a dead end. Reply "continue" and I'll take another pass at the errors, or open the Files tab to jump in yourself.
_6.4k tokens · 36s · built in parallel_