MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / HookPlayerPrefs

Function HookPlayerPrefs

Il2cppHook/_Ufunc.js:5771–5839  ·  view source on GitHub ↗
(isShowPrintStack = false, needLRInfo = true)

Source from the content-addressed store, hash-verified

5769Object.defineProperty(exports, "__esModule", { value: true });
5770exports.HookPlayerPrefs = void 0;
5771const HookPlayerPrefs = (isShowPrintStack = false, needLRInfo = true) => {
5772 InterceptorGetFunctions();
5773 InterceptorSetFunctions();
5774 function InterceptorGetFunctions() {
5775 A(Il2Cpp.Api.PlayerPrefs._GetFloat_2, (args, ctx, pass) => {
5776 pass.set("arg0", readU16(args[0]));
5777 pass.set("arg1", args[1]);
5778 }, (retval, ctx, pass) => {
5779 LOGD("\n[*] '" + retval + "' = GetFloat('" + pass.get("arg0") + "'," + pass.get("arg1") + ")");
5780 if (needLRInfo)
5781 LOGZ("\t\t { LR:" + checkCtx(ctx) + " } | { PC:" + checkCtx(ctx, "PC") + " }");
5782 if (isShowPrintStack)
5783 LOGZ((GetStackTraceN(ctx)));
5784 });
5785 A(Il2Cpp.Api.PlayerPrefs._GetInt_2, (args, ctx, pass) => {
5786 pass.set("arg0", readU16(args[0]));
5787 pass.set("arg1", args[1]);
5788 }, (retval, ctx, pass) => {
5789 LOGD("\n[*] '" + retval.toInt32() + "' = GetInt('" + pass.get("arg0") + "'," + pass.get("arg1") + ")");
5790 if (needLRInfo)
5791 LOGZ("\t\t { LR:" + checkCtx(ctx) + " } | { PC:" + checkCtx(ctx, "PC") + " }");
5792 if (isShowPrintStack)
5793 LOGZ((GetStackTraceN(ctx)));
5794 if (pass.get("arg0").indexOf("SaleBoughted") != -1)
5795 retval.replace(ptr(0x1));
5796 });
5797 A(Il2Cpp.Api.PlayerPrefs._GetString, (args, ctx, pass) => {
5798 pass.set("arg0", readU16(args[0]));
5799 }, (retval, ctx, pass) => {
5800 LOGD("\n[*] '" + readU16(retval) + "' = GetString('" + pass.get("arg0") + "')");
5801 if (needLRInfo)
5802 LOGZ("\t\t { LR:" + checkCtx(ctx) + " } | { PC:" + checkCtx(ctx, "PC") + " }");
5803 if (isShowPrintStack)
5804 LOGZ((GetStackTraceN(ctx)));
5805 });
5806 }
5807 function InterceptorSetFunctions() {
5808 A(Il2Cpp.Api.PlayerPrefs._SetFloat, (args, ctx, pass) => {
5809 pass.set("arg0", readU16(args[0]));
5810 pass.set("arg1", (args[1].isNull() ? 0 : readSingle(args[1])));
5811 }, (retval, ctx, pass) => {
5812 LOGD("\n[*] SetFloat('" + pass.get("arg0") + "'," + pass.get("arg1") + ")");
5813 if (needLRInfo)
5814 LOGZ("\t\t { LR:" + checkCtx(ctx) + " } | { PC:" + checkCtx(ctx, "PC") + " }");
5815 if (isShowPrintStack)
5816 LOGZ((GetStackTraceN(ctx)));
5817 });
5818 A(Il2Cpp.Api.PlayerPrefs._SetInt, (args, ctx, pass) => {
5819 pass.set("arg0", readU16(args[0]));
5820 pass.set("arg1", args[1]);
5821 }, (retval, ctx, pass) => {
5822 LOGD("\n[*] SetInt('" + pass.get("arg0") + "'," + pass.get("arg1") + ")");
5823 if (needLRInfo)
5824 LOGZ("\t\t { LR:" + checkCtx(ctx) + " } | { PC:" + checkCtx(ctx, "PC") + " }");
5825 if (isShowPrintStack)
5826 LOGZ((GetStackTraceN(ctx)));
5827 });
5828 A(Il2Cpp.Api.PlayerPrefs._SetString, (args, ctx, pass) => {

Callers

nothing calls this directly

Calls 2

InterceptorGetFunctionsFunction · 0.70
InterceptorSetFunctionsFunction · 0.70

Tested by

no test coverage detected