451 lines
23 KiB
C++
451 lines
23 KiB
C++
#pragma once
|
|
#include "../Methods.h"
|
|
#include "../../Utils/scan.h"
|
|
#include "../../Utils/deps/spoofcall/RetSpoof.hpp"
|
|
|
|
// Campus server target
|
|
// Change these constants if you move to a different server / Photon apps.
|
|
static const char* CAMPUS_NAMESERVER_HOST = "gameauth.ddns.net";
|
|
static const char* CAMPUS_APP_ID_REALTIME = "3034d59c-49d5-4441-b627-a90683970217";
|
|
static const char* CAMPUS_APP_ID_VOICE = "2f0fac1b-e91a-4271-8e95-8aee7fd67360";
|
|
static const char* CAMPUS_APP_ID_CHAT = "e75ba377-2f03-46a4-a87d-f4fc151913b8";
|
|
static const char* CAMPUS_APP_VERSION = "20250719_prod";
|
|
|
|
// Referee bypass: NOP the 4 anti-tamper checks so they return immediately. Same technique the
|
|
// reference 2025 patch uses. Also reused for TLS NotifyServerCertificate (a bool method - "return"
|
|
// with an empty body coerces to false but the caller path doesn't care about the value; what
|
|
// matters is that the real check body never runs, so self-signed certs are accepted).
|
|
void (*nop_O)();
|
|
void nop_H() { return; }
|
|
|
|
// il2cpp API resolution
|
|
// On protected (Referee) builds GameAssembly.dll's export table is stripped, so the reference
|
|
// patch's plain GetProcAddress path returns null and every downstream il2cpp_* call blows up.
|
|
// We fall back to scanning UnityPlayer.dll's decrypted code for the standard
|
|
// `lea reg, "il2cpp_name"; ... mov [rip+slot], rax` pattern - same technique the Puck Dumper
|
|
// uses to resolve il2cpp APIs on this exact build. Runs off already-decrypted memory; no exports
|
|
// required.
|
|
namespace UnityPlayerScan {
|
|
static void* find_il2cpp_api(const char* name) {
|
|
HMODULE up = GetModuleHandleA("UnityPlayer.dll");
|
|
HMODULE ga = GetModuleHandleA("GameAssembly.dll");
|
|
if (!up || !ga) return nullptr;
|
|
auto upBase = (uint8_t*)up;
|
|
auto dos = (PIMAGE_DOS_HEADER)upBase;
|
|
if (dos->e_magic != IMAGE_DOS_SIGNATURE) return nullptr;
|
|
auto nt = (PIMAGE_NT_HEADERS64)(upBase + dos->e_lfanew);
|
|
if (nt->Signature != IMAGE_NT_SIGNATURE) return nullptr;
|
|
const uint8_t* modEnd = upBase + nt->OptionalHeader.SizeOfImage;
|
|
|
|
auto gaDos = (PIMAGE_DOS_HEADER)ga;
|
|
auto gaNt = (PIMAGE_NT_HEADERS64)((uint8_t*)ga + gaDos->e_lfanew);
|
|
const uint8_t* gaBase = (uint8_t*)ga;
|
|
const uint8_t* gaEnd = gaBase + gaNt->OptionalHeader.SizeOfImage;
|
|
|
|
size_t nameLen = strlen(name);
|
|
auto sec = IMAGE_FIRST_SECTION(nt);
|
|
for (WORD s = 0; s < nt->FileHeader.NumberOfSections; s++) {
|
|
if (!(sec[s].Characteristics & IMAGE_SCN_CNT_CODE)) continue;
|
|
uint8_t* code = upBase + sec[s].VirtualAddress;
|
|
size_t codeSize = sec[s].Misc.VirtualSize;
|
|
if (code + codeSize > modEnd) codeSize = (size_t)(modEnd - code);
|
|
|
|
for (size_t off = 0; off + 7 < codeSize; off++) {
|
|
uint8_t* p = code + off;
|
|
// lea r64, [rip+disp32] (REX.W/REX.WR + 8D + modrm mod=00 rm=101)
|
|
if (!((p[0] == 0x48 || p[0] == 0x4C) && p[1] == 0x8D && (p[2] & 0xC7) == 0x05)) continue;
|
|
int32_t disp = *(int32_t*)(p + 3);
|
|
uint8_t* target = p + 7 + disp;
|
|
if (target < upBase || target + nameLen + 1 >= modEnd) continue;
|
|
if (memcmp(target, name, nameLen) != 0 || target[nameLen] != 0) continue;
|
|
|
|
// Next store-to-global (mov [rip+d], rax) within a short window is the slot.
|
|
for (size_t k = 7; k < 128 && off + k + 7 < codeSize; k++) {
|
|
uint8_t* q = p + k;
|
|
if (q[0] == 0x48 && q[1] == 0x89 && (q[2] & 0xC7) == 0x05) {
|
|
int32_t d2 = *(int32_t*)(q + 3);
|
|
uint8_t* slot = q + 7 + d2;
|
|
if (slot >= upBase && slot + 8 <= modEnd) {
|
|
void* fn = *(void**)slot;
|
|
// Sanity: resolved pointer must land INSIDE GameAssembly.dll.
|
|
if (fn && (uint8_t*)fn >= gaBase && (uint8_t*)fn < gaEnd)
|
|
return fn;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
// SendRequest hook: rewrite ns.rec.net -> CAMPUS_NAMESERVER_HOST
|
|
// Direct port of the reference 2025 patch's URL redirect, just retargeted at our host instead of
|
|
// the reference's ns.cgb.net. HTTPRequest carries the URI on the object at +0x10; we read it,
|
|
// stringify it, and if it references ns.rec.net we build a new Uri object with the swapped host
|
|
// and swap it into the request before the real SendRequest runs.
|
|
void (*SendRequest_O)(void*);
|
|
void SendRequest_H(void* request) {
|
|
void* uri = read<void*>(request, 16);
|
|
if (uri) {
|
|
using ToStringFn = Il2cppString * (*)(void*);
|
|
auto toStringFn = reinterpret_cast<ToStringFn>(GA + RR::Methods::System::Uri::ToString);
|
|
|
|
// ONE toString per request. The previous version called this twice (once to inspect,
|
|
// once for the debug print), doubling IL2CPP string allocations on every HTTP request.
|
|
Il2cppString* Uri = spoof_call(RetAddr, toStringFn, uri);
|
|
std::string url = ReadIl2CppStringOwned(Uri);
|
|
|
|
const std::string find = "ns.rec.net";
|
|
bool rewritten = false;
|
|
auto findPos = url.find(find);
|
|
if (findPos != std::string::npos) {
|
|
url.replace(findPos, find.length(), CAMPUS_NAMESERVER_HOST);
|
|
|
|
using Il2cppStringNewFn = Il2cppString * (*)(const char*);
|
|
auto strNew = reinterpret_cast<Il2cppStringNewFn>(GA + RR::Methods::Il2cpp::il2cpp_string_new);
|
|
Il2cppString* NewStr = spoof_call(RetAddr, strNew, url.c_str());
|
|
|
|
using ObjectGetClassFn = void * (*)(void*);
|
|
auto getClass = reinterpret_cast<ObjectGetClassFn>(GA + RR::Methods::Il2cpp::il2cpp_object_get_class);
|
|
void* UriClass = spoof_call(RetAddr, getClass, uri);
|
|
|
|
using ObjectNewFn = void* (*)(void*);
|
|
auto objNew = reinterpret_cast<ObjectNewFn>(GA + RR::Methods::Il2cpp::il2cpp_object_new);
|
|
void* NewUri = spoof_call(RetAddr, objNew, UriClass);
|
|
|
|
if (NewUri && NewStr) {
|
|
using UriCtor = void (*)(void*, Il2cppString*);
|
|
auto uriCtor = reinterpret_cast<UriCtor>(GA + RR::Methods::System::Uri::ctor);
|
|
spoof_call(RetAddr, uriCtor, NewUri, NewStr);
|
|
set<void*>(request, 16, NewUri);
|
|
rewritten = true;
|
|
}
|
|
}
|
|
// Log the URL here. Status is logged separately by RecNetResponse_H — the console will
|
|
// show `Uri: <url>` followed by ` <- HTTP <status>` for the same request. Pairing them
|
|
// in one line would need a request-pointer -> URL side map, which is more surface than
|
|
// it's worth.
|
|
std::cout << "Uri: " << url << (rewritten ? " (rewritten)" : "") << std::endl;
|
|
}
|
|
return SendRequest_O(request);
|
|
}
|
|
|
|
// RecNet HTTP response hook: log HTTP status per completed request
|
|
// Signature confirmed against DUMPER-7 (CBACIMLIBPF.h line 1361):
|
|
// static void CLCAHKCJDLC(CDHPGPJPLII* request, DPEENGNNEEB* response, JFNOOGODOOA* promise)
|
|
// It IS a static method (no `this` arg) — the 3-arg raw signature matches perfectly.
|
|
//
|
|
// IMPORTANT: `CDHPGPJPLII` is RecNet's own request wrapper, NOT BestHTTP's `HTTPRequest`.
|
|
// Its offset 16 is a `bool`, NOT a `Uri*`. The previous version of this hook tried to read
|
|
// `request+16` as a Uri pointer, got garbage, called Uri.ToString on it, and black-screened
|
|
// the client on the first RecNet response. We now touch ONLY the response object, whose
|
|
// layout IS confirmed (DPEENGNNEEB.h: `int32_t backingField__IKBENAMGBFE` at offset 16 =
|
|
// the HTTP status code the ctor stores).
|
|
void (*RecNetResponse_O)(void*, void*, void*);
|
|
void RecNetResponse_H(void* request, void* response, void* promise) {
|
|
if (response) {
|
|
int status = read<int>(response, 16);
|
|
// Force decimal — Resolve() sets `std::hex` when printing RVAs, and it sticks on the
|
|
// shared cout stream, so status codes were printing as "c8" instead of "200".
|
|
std::cout << " <- HTTP " << std::dec << status << std::endl;
|
|
}
|
|
return RecNetResponse_O(request, response, promise);
|
|
}
|
|
|
|
// Gradient recolor: Rec Room orange -> Campus purple/magenta/orange/gold ramp
|
|
// Direct native port of CampusPatch (2023)'s RRUIGradientPatch: intercept UIGradient.set_Gradient,
|
|
// walk the incoming Unity Gradient's color keys, and if ANY key looks like Rec Room orange,
|
|
// replace ALL keys with the Campus 4-stop ramp (times preserved so the gradient's shape stays).
|
|
//
|
|
// UnityEngine.Gradient stores its actual key data on the C++ side behind m_Ptr; managed
|
|
// get_colorKeys hands back a fresh copy each call, so mutating that copy is invisible until we
|
|
// push it back via SetKeys.
|
|
namespace CampusGradient {
|
|
struct Color { float r, g, b, a; };
|
|
|
|
// 4 stops sampled from the admin panel's Background.png so recolored UI reads as the same
|
|
// visual palette Puck / the dashboard uses.
|
|
static constexpr Color Purple { 0.475f, 0.106f, 0.553f, 1.0f }; // #791B8D
|
|
static constexpr Color Magenta { 0.749f, 0.161f, 0.400f, 1.0f }; // #BF2966
|
|
static constexpr Color Orange { 0.976f, 0.365f, 0.141f, 1.0f }; // #F95D24
|
|
static constexpr Color Gold { 0.980f, 0.600f, 0.071f, 1.0f }; // #FA9912
|
|
|
|
static Color rampAt(float t) {
|
|
const Color stops[4] = { Purple, Magenta, Orange, Gold };
|
|
if (t <= 0.0f) return stops[0];
|
|
if (t >= 1.0f) return stops[3];
|
|
float f = t * 3.0f;
|
|
int i = (int)f;
|
|
float u = f - (float)i;
|
|
return Color{
|
|
stops[i].r * (1.0f - u) + stops[i+1].r * u,
|
|
stops[i].g * (1.0f - u) + stops[i+1].g * u,
|
|
stops[i].b * (1.0f - u) + stops[i+1].b * u,
|
|
1.0f,
|
|
};
|
|
}
|
|
|
|
static void rgbToHsv(float r, float g, float b, float& h, float& s, float& v) {
|
|
float mx = r; if (g > mx) mx = g; if (b > mx) mx = b;
|
|
float mn = r; if (g < mn) mn = g; if (b < mn) mn = b;
|
|
v = mx;
|
|
float d = mx - mn;
|
|
s = (mx == 0.0f) ? 0.0f : d / mx;
|
|
if (d == 0.0f) { h = 0.0f; return; }
|
|
if (mx == r) h = fmodf((g - b) / d, 6.0f);
|
|
else if (mx == g) h = (b - r) / d + 2.0f;
|
|
else h = (r - g) / d + 4.0f;
|
|
h /= 6.0f;
|
|
if (h < 0.0f) h += 1.0f;
|
|
}
|
|
|
|
// Two-branch HSV window matching bright Rec Room orange and the lighter yellow-orange used
|
|
// in secondary UI sweeps.
|
|
static bool isRecRoomOrange(float r, float g, float b) {
|
|
float h, s, v;
|
|
rgbToHsv(r, g, b, h, s, v);
|
|
return
|
|
(h >= 0.02f && h <= 0.07f && s >= 0.70f && v >= 0.60f) ||
|
|
(h >= 0.05f && h <= 0.10f && s >= 0.45f && s <= 0.80f && v >= 0.85f);
|
|
}
|
|
}
|
|
|
|
void (*UIGradient_set_Gradient_O)(void*, void*);
|
|
void UIGradient_set_Gradient_H(void* self, void* gradient) {
|
|
if (gradient) {
|
|
using GetKeysFn = void*(*)(void*);
|
|
using SetKeysFn = void (*)(void*, void*, void*);
|
|
auto getColorKeys = (GetKeysFn)(GA + RR::Methods::UnityGradient::get_colorKeys);
|
|
auto getAlphaKeys = (GetKeysFn)(GA + RR::Methods::UnityGradient::get_alphaKeys);
|
|
auto setKeys = (SetKeysFn)(GA + RR::Methods::UnityGradient::SetKeys);
|
|
|
|
void* colorKeys = spoof_call(RetAddr, getColorKeys, gradient);
|
|
if (colorKeys) {
|
|
// Il2Cpp single-dim value-type array: length at +24, packed data at +32.
|
|
// GradientColorKey = { Color color(16B), float time(4B) } = 20 bytes.
|
|
uint64_t len = read<uint64_t>(colorKeys, 24);
|
|
if (len > 0 && len <= 32) {
|
|
uint8_t* keyData = (uint8_t*)colorKeys + 32;
|
|
constexpr size_t STRIDE = 20;
|
|
|
|
bool looksOrange = false;
|
|
for (uint64_t i = 0; i < len; i++) {
|
|
float r = *(float*)(keyData + i * STRIDE + 0);
|
|
float g = *(float*)(keyData + i * STRIDE + 4);
|
|
float b = *(float*)(keyData + i * STRIDE + 8);
|
|
if (CampusGradient::isRecRoomOrange(r, g, b)) { looksOrange = true; break; }
|
|
}
|
|
|
|
if (looksOrange) {
|
|
void* alphaKeys = spoof_call(RetAddr, getAlphaKeys, gradient);
|
|
for (uint64_t i = 0; i < len; i++) {
|
|
float t = (len > 1) ? (float)i / (float)(len - 1) : 0.5f;
|
|
auto c = CampusGradient::rampAt(t);
|
|
*(float*)(keyData + i * STRIDE + 0) = c.r;
|
|
*(float*)(keyData + i * STRIDE + 4) = c.g;
|
|
*(float*)(keyData + i * STRIDE + 8) = c.b;
|
|
*(float*)(keyData + i * STRIDE + 12) = c.a;
|
|
}
|
|
spoof_call(RetAddr, setKeys, gradient, colorKeys, alphaKeys);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
UIGradient_set_Gradient_O(self, gradient);
|
|
}
|
|
|
|
// Photon connect hooks: rewrite AppSettings identity to Campus values on the way through
|
|
// Each connect entry point takes (this, AppSettings*, [maybe extra args]). We mutate AppSettings'
|
|
// string fields BEFORE the real method runs (Prefix-style behaviour), so the game connects to
|
|
// OUR Photon apps and version. This is the native equivalent of CampusPatch (2023)'s
|
|
// PhotonAppSettingsPatch Postfix that overwrote AppIdRealtime / AppIdVoice / AppVersion.
|
|
// The previous implementation allocated a fresh IL2CPP string for realtime/voice/version on
|
|
// EVERY Photon connect (matchmaking, room join, voice channel switch, reconnects). The GC does
|
|
// clean these up eventually, but under a busy session they piled up and showed as a memory
|
|
// climb. Allocate once, cache forever, and short-circuit if AppSettings already points at our
|
|
// cached strings.
|
|
static Il2cppString* g_campusAppIdRealtime = nullptr;
|
|
static Il2cppString* g_campusAppIdVoice = nullptr;
|
|
static Il2cppString* g_campusAppIdChat = nullptr;
|
|
static Il2cppString* g_campusAppVersion = nullptr;
|
|
|
|
// The four Photon connect hooks (Realtime / PUN / Voice / VoicePUN) can fire on independent
|
|
// threads simultaneously. Without a guard, two threads could each see all four globals as null,
|
|
// each call il2cpp_string_new four times, and orphan the four losers of the race.
|
|
static std::once_flag g_campusPhotonStringsOnce;
|
|
|
|
static void EnsureCampusPhotonStrings()
|
|
{
|
|
std::call_once(g_campusPhotonStringsOnce, []{
|
|
if (!RR::Methods::Il2cpp::il2cpp_string_new) return;
|
|
|
|
using Il2cppStringNewFn = Il2cppString * (*)(const char*);
|
|
auto strNew = reinterpret_cast<Il2cppStringNewFn>(GA + RR::Methods::Il2cpp::il2cpp_string_new);
|
|
|
|
g_campusAppIdRealtime = spoof_call(RetAddr, strNew, CAMPUS_APP_ID_REALTIME);
|
|
g_campusAppIdVoice = spoof_call(RetAddr, strNew, CAMPUS_APP_ID_VOICE);
|
|
g_campusAppIdChat = spoof_call(RetAddr, strNew, CAMPUS_APP_ID_CHAT);
|
|
g_campusAppVersion = spoof_call(RetAddr, strNew, CAMPUS_APP_VERSION);
|
|
});
|
|
}
|
|
|
|
static void RewriteAppSettings(void* appSettings)
|
|
{
|
|
if (!appSettings) return;
|
|
EnsureCampusPhotonStrings();
|
|
if (!g_campusAppIdRealtime) {
|
|
std::cout << "[Campus/Photon] AppSettings NOT rewritten - il2cpp_string_new not resolved\n";
|
|
return;
|
|
}
|
|
|
|
// Skip the write when AppSettings already points at our cached strings — cuts out a bunch
|
|
// of __TypeStore / write-barrier work on hot Photon reconnect paths.
|
|
void* curRt = read<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdRealtime);
|
|
void* curVc = read<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdVoice);
|
|
void* curChat = read<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdChat);
|
|
void* curVer = read<void*>(appSettings, RR::Methods::AppSettingsFields::AppVersion);
|
|
if (curRt == g_campusAppIdRealtime &&
|
|
curVc == g_campusAppIdVoice &&
|
|
curChat == g_campusAppIdChat &&
|
|
curVer == g_campusAppVersion) {
|
|
return; // already redirected — nothing to do
|
|
}
|
|
|
|
if (g_campusAppIdRealtime) set<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdRealtime, g_campusAppIdRealtime);
|
|
if (g_campusAppIdVoice) set<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdVoice, g_campusAppIdVoice);
|
|
if (g_campusAppIdChat) set<void*>(appSettings, RR::Methods::AppSettingsFields::AppIdChat, g_campusAppIdChat);
|
|
if (g_campusAppVersion) set<void*>(appSettings, RR::Methods::AppSettingsFields::AppVersion, g_campusAppVersion);
|
|
|
|
std::cout << "[Campus/Photon] AppSettings redirected -> " << CAMPUS_APP_ID_REALTIME
|
|
<< " ver " << CAMPUS_APP_VERSION << "\n";
|
|
}
|
|
|
|
// Image signature patch (DISABLED)
|
|
// Placeholder for a future image-sig bypass. Two prior attempts hard-crashed the client
|
|
// (see project-image-sig-crash memory), so this stays fully commented out until we have a
|
|
// safer hook target. Uncomment + wire the RVA in Methods.h + add the hook() call below when
|
|
// the sig verify function is confirmed.
|
|
//
|
|
// void (*ImageSig_O)(void*, void*);
|
|
// void ImageSig_H(void* self, void* payload) {
|
|
// // e.g. bypass RSA/HMAC check on inbound image manifests: return early so the caller
|
|
// // treats the payload as valid without actually verifying the signature.
|
|
// return;
|
|
// }
|
|
//
|
|
// Register in Patch() when re-enabling:
|
|
// hook(GA + RR::Methods::ImageSig::VerifyFn,
|
|
// (void*)ImageSig_H, (void**)&ImageSig_O, "Image signature verify");
|
|
|
|
bool (*RealtimeConnect_O)(void*, void*);
|
|
bool RealtimeConnect_H(void* self, void* appSettings) {
|
|
RewriteAppSettings(appSettings);
|
|
return RealtimeConnect_O(self, appSettings);
|
|
}
|
|
|
|
bool (*PunConnect_O)(void*, void*, bool);
|
|
bool PunConnect_H(void* self, void* appSettings, bool arg) {
|
|
RewriteAppSettings(appSettings);
|
|
return PunConnect_O(self, appSettings, arg);
|
|
}
|
|
|
|
bool (*VoiceConnect_O)(void*, void*);
|
|
bool VoiceConnect_H(void* self, void* appSettings) {
|
|
RewriteAppSettings(appSettings);
|
|
return VoiceConnect_O(self, appSettings);
|
|
}
|
|
|
|
bool (*VoicePUNConnect_O)(void*, void*);
|
|
bool VoicePUNConnect_H(void* self, void* appSettings) {
|
|
RewriteAppSettings(appSettings);
|
|
return VoicePUNConnect_O(self, appSettings);
|
|
}
|
|
|
|
//Patch installer
|
|
namespace RR::Patches {
|
|
void Resolve() {
|
|
RetAddr = PatternScan<uint64_t*>("FF 23", GA, NtHeaders->OptionalHeader.SizeOfImage);
|
|
std::cout << "[Campus] RetSpoof gadget (FF 23): 0x" << std::hex << (uintptr_t)RetAddr << "\n";
|
|
auto assm = GetModuleHandle("GameAssembly.dll");
|
|
|
|
// 1) Try GetProcAddress first (works on unpacked builds).
|
|
auto tryExport = [&](const char* name) -> uintptr_t {
|
|
void* p = spoof_call(RetAddr, GetProcAddress, assm, name);
|
|
return p ? (uintptr_t)p - GA : 0;
|
|
};
|
|
RR::Methods::Il2cpp::il2cpp_string_new = tryExport("il2cpp_string_new");
|
|
RR::Methods::Il2cpp::il2cpp_object_get_class = tryExport("il2cpp_object_get_class");
|
|
RR::Methods::Il2cpp::il2cpp_object_new = tryExport("il2cpp_object_new");
|
|
|
|
// 2) Fall back to UnityPlayer scan when exports are stripped (Referee'd builds).
|
|
auto fallback = [&](const char* name, uintptr_t& slot) {
|
|
if (slot) return;
|
|
void* p = UnityPlayerScan::find_il2cpp_api(name);
|
|
if (p) slot = (uintptr_t)p - GA;
|
|
};
|
|
fallback("il2cpp_string_new", RR::Methods::Il2cpp::il2cpp_string_new);
|
|
fallback("il2cpp_object_get_class", RR::Methods::Il2cpp::il2cpp_object_get_class);
|
|
fallback("il2cpp_object_new", RR::Methods::Il2cpp::il2cpp_object_new);
|
|
|
|
auto label = [](uintptr_t v) { return v ? "OK " : "FAIL"; };
|
|
std::cout << "[Campus] " << label(RR::Methods::Il2cpp::il2cpp_string_new)
|
|
<< " il2cpp_string_new -> 0x" << std::hex << RR::Methods::Il2cpp::il2cpp_string_new << "\n";
|
|
std::cout << "[Campus] " << label(RR::Methods::Il2cpp::il2cpp_object_get_class)
|
|
<< " il2cpp_object_get_class -> 0x" << std::hex << RR::Methods::Il2cpp::il2cpp_object_get_class << "\n";
|
|
std::cout << "[Campus] " << label(RR::Methods::Il2cpp::il2cpp_object_new)
|
|
<< " il2cpp_object_new -> 0x" << std::hex << RR::Methods::Il2cpp::il2cpp_object_new << "\n";
|
|
}
|
|
|
|
static void hook(uintptr_t abs, void* detour, void** orig, const char* label) {
|
|
MH_STATUS s = MH_CreateHook((void*)abs, detour, (LPVOID*)orig);
|
|
if (s == MH_OK) s = MH_EnableHook((void*)abs);
|
|
std::cout << "[Campus] hook " << label << " @ 0x" << std::hex << abs
|
|
<< " -> " << (s == MH_OK ? "OK" : "FAIL") << "\n";
|
|
}
|
|
|
|
void Patch() {
|
|
if (MH_Initialize() != MH_OK) {
|
|
std::cout << "[Campus] MH_Initialize FAILED\n";
|
|
return;
|
|
}
|
|
|
|
// Referee bypass (must run before anything else calls into libil2cpp under Referee's watch).
|
|
hook(Referee + RR::Methods::Referee::Check1, (void*)nop_H, (void**)&nop_O, "Referee Check1");
|
|
hook(Referee + RR::Methods::Referee::Check2, (void*)nop_H, (void**)&nop_O, "Referee Check2");
|
|
hook(Referee + RR::Methods::Referee::Check3, (void*)nop_H, (void**)&nop_O, "Referee Check3");
|
|
hook(Referee + RR::Methods::Referee::Check4, (void*)nop_H, (void**)&nop_O, "Referee Check4");
|
|
|
|
// Accept any TLS cert (private server uses self-signed).
|
|
hook(GA + RR::Methods::LegacyTlsAuthentication::NotifyServerCertificate,
|
|
(void*)nop_H, (void**)&nop_O, "TLS NotifyServerCertificate");
|
|
|
|
// URI rewrite (ns.rec.net -> CAMPUS_NAMESERVER_HOST).
|
|
hook(GA + RR::Methods::HTTPManager::SendRequest,
|
|
(void*)SendRequest_H, (void**)&SendRequest_O, "HTTPManager.SendRequest");
|
|
|
|
// RecNet response callback — logs " <- HTTP <status>" per completed request. Pairs
|
|
// visually with the SendRequest URL log line above.
|
|
hook(GA + RR::Methods::RecNetHttp::ResponseCallback,
|
|
(void*)RecNetResponse_H, (void**)&RecNetResponse_O, "RecNet response callback (status)");
|
|
|
|
// Gradient recolor: Rec Room orange -> Campus purple/magenta/orange/gold ramp.
|
|
hook(GA + RR::Methods::UIGradient::set_Gradient,
|
|
(void*)UIGradient_set_Gradient_H, (void**)&UIGradient_set_Gradient_O,
|
|
"UIGradient.set_Gradient (gradient recolor)");
|
|
|
|
// Photon redirect (all four connect-with-AppSettings entry points).
|
|
hook(GA + RR::Methods::Photon::OLPEILEPEAD_JBNCMFDFDLM,
|
|
(void*)RealtimeConnect_H, (void**)&RealtimeConnect_O, "Photon Realtime connect");
|
|
hook(GA + RR::Methods::Photon::OEOMKFKDCCG_JBNCMFDFDLM,
|
|
(void*)PunConnect_H, (void**)&PunConnect_O, "Photon PUN connect");
|
|
hook(GA + RR::Methods::Photon::VoiceConnection_ConnectUsingSettings,
|
|
(void*)VoiceConnect_H, (void**)&VoiceConnect_O, "Photon Voice connect");
|
|
hook(GA + RR::Methods::Photon::PhotonVoiceNetwork_ConnectUsingSettings,
|
|
(void*)VoicePUNConnect_H, (void**)&VoicePUNConnect_O, "Photon Voice PUN connect");
|
|
|
|
std::cout << "[Campus] all hooks installed. target = " << CAMPUS_NAMESERVER_HOST << "\n";
|
|
}
|
|
}
|