From 8bdd33d936f8cf236ba75880e18b9bd9f3b8b425 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Sun, 11 Jun 2023 00:07:04 -0400 Subject: [PATCH] someone fix 12.00 floor loot spawn please --- .../AbilitySystemComponent_Abilities.cpp | 10 +-- Project Reboot 3.0/AttributeSet.h | 9 +-- Project Reboot 3.0/Class.h | 18 +++++ Project Reboot 3.0/FortGameModeAthena.cpp | 4 + Project Reboot 3.0/FortLootPackage.cpp | 2 - Project Reboot 3.0/FortPlayerController.cpp | 2 + Project Reboot 3.0/Object.cpp | 24 ++---- Project Reboot 3.0/ScriptDisassembler.cpp | 9 +-- Project Reboot 3.0/Stack.h | 2 +- Project Reboot 3.0/UnrealString.h | 8 +- Project Reboot 3.0/World.cpp | 2 +- Project Reboot 3.0/addresses.cpp | 13 ++-- Project Reboot 3.0/calendar.h | 4 + Project Reboot 3.0/dllmain.cpp | 8 +- Project Reboot 3.0/gui.h | 78 +++++++------------ Project Reboot 3.0/hooking.h | 2 +- Project Reboot 3.0/reboot.h | 34 ++------ 17 files changed, 95 insertions(+), 134 deletions(-) diff --git a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp index 7c1e041..8c53b1f 100644 --- a/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp +++ b/Project Reboot 3.0/AbilitySystemComponent_Abilities.cpp @@ -27,7 +27,7 @@ void LoopSpecs(UAbilitySystemComponent* AbilitySystemComponent, std::function("/Script/GameplayAbilities.AbilitySystemComponent.BP_ApplyGameplayEffectToSelf"); + static auto BP_ApplyGameplayEffectToSelfFn = FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.BP_ApplyGameplayEffectToSelf"); struct { @@ -74,7 +74,7 @@ void UAbilitySystemComponent::ServerEndAbility(FGameplayAbilitySpecHandle Abilit void UAbilitySystemComponent::ClientEndAbility(FGameplayAbilitySpecHandle AbilityToEnd, FGameplayAbilityActivationInfo* ActivationInfo) { - static auto ClientEndAbilityFn = FindObject("/Script/GameplayAbilities.AbilitySystemComponent.ClientEndAbility"); + static auto ClientEndAbilityFn = FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ClientEndAbility"); auto Params = Alloc(ClientEndAbilityFn->GetPropertiesSize()); @@ -144,7 +144,7 @@ void UAbilitySystemComponent::InternalServerTryActivateAbilityHook(UAbilitySyste auto Spec = AbilitySystemComponent->FindAbilitySpecFromHandle(Handle); - static auto PredictionKeyStruct = FindObject("/Script/GameplayAbilities.PredictionKey"); + static auto PredictionKeyStruct = FindObject(L"/Script/GameplayAbilities.PredictionKey"); static auto PredictionKeySize = PredictionKeyStruct->GetPropertiesSize(); static auto CurrentOffset = FindOffsetStruct("/Script/GameplayAbilities.PredictionKey", "Current"); @@ -239,7 +239,7 @@ FGameplayAbilitySpec* UAbilitySystemComponent::FindAbilitySpecFromHandle(FGamepl void UAbilitySystemComponent::RemoveActiveGameplayEffectBySourceEffect(UClass* GameplayEffect, UAbilitySystemComponent* InstigatorAbilitySystemComponent, int StacksToRemove) { - static auto RemoveActiveGameplayEffectBySourceEffectFn = FindObject("/Script/GameplayAbilities.AbilitySystemComponent.RemoveActiveGameplayEffectBySourceEffect"); + static auto RemoveActiveGameplayEffectBySourceEffectFn = FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.RemoveActiveGameplayEffectBySourceEffect"); struct { @@ -259,6 +259,6 @@ void UAbilitySystemComponent::ClearAbility(const FGameplayAbilitySpecHandle& Han return; } - static void (*ClearAbilityOriginal)(UAbilitySystemComponent * AbilitySystemComponent, const FGameplayAbilitySpecHandle& Handle) = decltype(ClearAbilityOriginal)(Addresses::ClearAbility); + static void (*ClearAbilityOriginal)(UAbilitySystemComponent* AbilitySystemComponent, const FGameplayAbilitySpecHandle& Handle) = decltype(ClearAbilityOriginal)(Addresses::ClearAbility); ClearAbilityOriginal(this, Handle); } \ No newline at end of file diff --git a/Project Reboot 3.0/AttributeSet.h b/Project Reboot 3.0/AttributeSet.h index 042e319..f287493 100644 --- a/Project Reboot 3.0/AttributeSet.h +++ b/Project Reboot 3.0/AttributeSet.h @@ -23,14 +23,7 @@ struct FGameplayAttribute if (!Attribute) return "INVALIDATTRIBUTE"; - FName* NamePrivate = nullptr; - - if (Engine_Version >= 425) - NamePrivate = (FName*)(__int64(Attribute) + 0x28); - else - NamePrivate = &((UField*)Attribute)->NamePrivate; - - return NamePrivate->ToString(); + return GetFNameOfProp(Attribute)->ToString(); } }; diff --git a/Project Reboot 3.0/Class.h b/Project Reboot 3.0/Class.h index e376f57..4591f9f 100644 --- a/Project Reboot 3.0/Class.h +++ b/Project Reboot 3.0/Class.h @@ -12,6 +12,24 @@ struct UField : UObject // void* pad; void* pad2; }; +template +static inline PropertyType* GetNext(void* Field) +{ + return Fortnite_Version >= 12.10 ? *(PropertyType**)(__int64(Field) + 0x20) : ((UField*)Field)->Next; +} + +static inline FName* GetFNameOfProp(void* Property) +{ + FName* NamePrivate = nullptr; + + if (Fortnite_Version >= 12.10) + NamePrivate = (FName*)(__int64(Property) + 0x28); + else + NamePrivate = &((UField*)Property)->NamePrivate; + + return NamePrivate; +} + class UStruct : public UField { public: diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index af8cef5..1f5aa68 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -644,6 +644,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game GameSession->Get(MaxPlayersOffset) = 100; GameState->OnRep_CurrentPlaylistInfo(); // ? + + // Calendar::SetSnow(1000); static auto bAlwaysDBNOOffset = GameMode->GetOffset("bAlwaysDBNO"); // GameMode->Get(bAlwaysDBNOOffset) = true; @@ -1169,6 +1171,8 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } } + LOG_INFO(LogDev, "Spawning loot!"); + auto SpawnIsland_FloorLoot = FindObject(L"/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); auto BRIsland_FloorLoot = FindObject(L"/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); diff --git a/Project Reboot 3.0/FortLootPackage.cpp b/Project Reboot 3.0/FortLootPackage.cpp index 085f591..9fe9f29 100644 --- a/Project Reboot 3.0/FortLootPackage.cpp +++ b/Project Reboot 3.0/FortLootPackage.cpp @@ -366,8 +366,6 @@ void PickLootDropsFromLootPackage(const std::vector& LPTables, cons } } -// #define brudda - std::vector PickLootDrops(FName TierGroupName, int WorldLevel, int ForcedLootTier, bool bPrint, int recursive, bool bCombineDrops) { std::vector LootDrops; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 69a638c..cf57caf 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -713,6 +713,8 @@ void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* void AFortPlayerController::ServerSuicideHook(AFortPlayerController* PlayerController) { + LOG_INFO(LogDev, "Suicide!"); + auto Pawn = PlayerController->GetPawn(); if (!Pawn) diff --git a/Project Reboot 3.0/Object.cpp b/Project Reboot 3.0/Object.cpp index edd3e54..81e149b 100644 --- a/Project Reboot 3.0/Object.cpp +++ b/Project Reboot 3.0/Object.cpp @@ -7,18 +7,6 @@ #include "UObjectArray.h" #include "Package.h" -FName* getFNameOfProp(void* Property) -{ - FName* NamePrivate = nullptr; - - if (Engine_Version >= 425) - NamePrivate = (FName*)(__int64(Property) + 0x28); - else - NamePrivate = &((UField*)Property)->NamePrivate; - - return NamePrivate; -}; - void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) const { for (auto CurrentClass = ClassPrivate; CurrentClass; CurrentClass = *(UClass**)(__int64(CurrentClass) + Offsets::SuperStruct)) @@ -29,7 +17,7 @@ void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) c { // LOG_INFO(LogDev, "Reading prop name.."); - std::string PropName = getFNameOfProp(Property)->ToString(); + std::string PropName = GetFNameOfProp(Property)->ToString(); // LOG_INFO(LogDev, "PropName: {}", PropName); @@ -45,8 +33,8 @@ void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) c return Property; } - Property = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; - PropName = Property ? getFNameOfProp(Property)->ToString() : ""; + Property = GetNext(Property); + PropName = Property ? GetFNameOfProp(Property)->ToString() : ""; } } } @@ -67,7 +55,7 @@ void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) { // LOG_INFO(LogDev, "Reading prop name.."); - std::string PropName = getFNameOfProp(Property)->ToString(); + std::string PropName = GetFNameOfProp(Property)->ToString(); // LOG_INFO(LogDev, "PropName: {}", PropName); @@ -83,8 +71,8 @@ void* UObject::GetProperty(const std::string& ChildName, bool bWarnIfNotFound) return Property; } - Property = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; - PropName = Property ? getFNameOfProp(Property)->ToString() : ""; + Property = GetNext(Property); + PropName = Property ? GetFNameOfProp(Property)->ToString() : ""; } } } diff --git a/Project Reboot 3.0/ScriptDisassembler.cpp b/Project Reboot 3.0/ScriptDisassembler.cpp index 14ac141..8264ff6 100644 --- a/Project Reboot 3.0/ScriptDisassembler.cpp +++ b/Project Reboot 3.0/ScriptDisassembler.cpp @@ -819,14 +819,7 @@ namespace EExprToken std::string GetNameSafe(void* Property) { - FName* NamePrivate = nullptr; - - if (Engine_Version >= 425) - NamePrivate = (FName*)(__int64(Property) + 0x28); - else - NamePrivate = &((UField*)Property)->NamePrivate; - - return NamePrivate->ToString(); + return GetFNameOfProp(Property)->ToString(); } void FKismetBytecodeDisassembler::ProcessCommon(int32& ScriptIndex, uint8 Opcode) diff --git a/Project Reboot 3.0/Stack.h b/Project Reboot 3.0/Stack.h index 9992e63..57b919c 100644 --- a/Project Reboot 3.0/Stack.h +++ b/Project Reboot 3.0/Stack.h @@ -68,7 +68,7 @@ public: LOG_INFO(LogDev, "No code!"); void* Property = GetPropertyChainForCompiledIn(); - GetPropertyChainForCompiledIn() = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; + GetPropertyChainForCompiledIn() = GetNext(Property); StepExplicitProperty(Result, Property); } } diff --git a/Project Reboot 3.0/UnrealString.h b/Project Reboot 3.0/UnrealString.h index 24637c6..58f769c 100644 --- a/Project Reboot 3.0/UnrealString.h +++ b/Project Reboot 3.0/UnrealString.h @@ -37,16 +37,18 @@ public: if (!NewStr/* || std::wcslen(NewStr) == 0 */) return; + constexpr size_t Inc = 1; + #ifndef EXPERIMENTAL_FSTRING - Data.ArrayMax = Data.ArrayNum = *NewStr ? (int)std::wcslen(NewStr) + 1 : 0; + Data.ArrayMax = Data.ArrayNum = *NewStr ? (int)std::wcslen(NewStr) + Inc : 0; if (Data.ArrayNum) Data.Data = const_cast(NewStr); #else - Data.ArrayNum = (int)std::wcslen(NewStr) + 1; + Data.ArrayNum = (int)std::wcslen(NewStr) + Inc; Data.ArrayMax = Data.ArrayNum; - if (Data.ArrayNum > 0) // this should never happen unless std::wcslen returns negative.. + if (Data.ArrayNum > 0) { int amountToAlloc = (Data.ArrayNum * sizeof(TCHAR)); diff --git a/Project Reboot 3.0/World.cpp b/Project Reboot 3.0/World.cpp index 68b37b5..49c2e4c 100644 --- a/Project Reboot 3.0/World.cpp +++ b/Project Reboot 3.0/World.cpp @@ -80,7 +80,7 @@ void UWorld::Listen() static auto LevelCollectionsOffset = GetWorld()->GetOffset("LevelCollections"); auto& LevelCollections = GetWorld()->Get>(LevelCollectionsOffset); - static int LevelCollectionSize = FindObject("/Script/Engine.LevelCollection")->GetPropertiesSize(); + static int LevelCollectionSize = FindObject(L"/Script/Engine.LevelCollection")->GetPropertiesSize(); *(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver; *(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver; diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index a057423..1a83a93 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -389,15 +389,17 @@ void Addresses::Print() void Offsets::FindAll() { - Offsets::Offset_Internal = Engine_Version >= 425 && std::floor(Fortnite_Version) < 20 ? 0x4C : 0x44; + Offsets::Offset_Internal = Fortnite_Version >= 12.10 && std::floor(Fortnite_Version) < 20 ? 0x4C : 0x44; Offsets::SuperStruct = Engine_Version >= 422 ? 0x40 : 0x30; - Offsets::Children = Engine_Version >= 425 ? 0x50 : Offsets::SuperStruct + 8; + Offsets::Children = Fortnite_Version >= 12.10 ? 0x50 : Offsets::SuperStruct + 8; Offsets::PropertiesSize = Offsets::Children + 8; if (Engine_Version >= 416 && Engine_Version <= 421) Offsets::Func = 0xB0; else if (Engine_Version >= 422 && Engine_Version <= 424) Offsets::Func = 0xC0; + else if (Fortnite_Version >= 12.00 && Fortnite_Version < 12.10) + Offsets::Func = 0xC8; else if (Engine_Version == 425) Offsets::Func = 0xF0; else if (Engine_Version >= 426) @@ -540,11 +542,6 @@ std::vector Addresses::GetFunctionsToNull() toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class } - if (Engine_Version == 421) - { - toNull.push_back(Memcury::Scanner::FindStringRef(L"Widget Class %s - Running Initialize On Archetype, %s.").ScanFor({ 0x40, 0x55 }, false).Get()); // Widget class - } - if (Engine_Version == 422) { toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 30 48 8B 41 28 48 8B DA 48 8B F9 48 85 C0 74 34 48 8B 4B 08 48 8D").Get()); // widget class @@ -582,7 +579,7 @@ std::vector Addresses::GetFunctionsToNull() // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC // toNull.push_back(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 8B D9 E8 ? ? ? ? B2 01 8B CB E8").Get()); // GC Caller 1 - // toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 55 41 56 48 8B EC 48 83 EC 50 83 65 28 00 40 B6 05 40 38 35 ? ? ? ? 4C").Get()); // InitializeUI + toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 55 41 56 48 8B EC 48 83 EC 50 83 65 28 00 40 B6 05 40 38 35 ? ? ? ? 4C").Get()); // InitializeUI } if (Engine_Version >= 426) diff --git a/Project Reboot 3.0/calendar.h b/Project Reboot 3.0/calendar.h index 89b554d..c5d9065 100644 --- a/Project Reboot 3.0/calendar.h +++ b/Project Reboot 3.0/calendar.h @@ -66,6 +66,8 @@ namespace Calendar LOG_INFO(LogDev, "Called OnReady!"); + return; + if (NewValue != -1) { static auto SnowAmountOffset = SnowSetup->GetOffset("SnowAmount"); @@ -77,6 +79,8 @@ namespace Calendar // SnowSetup->ProcessEvent(SetSnowFn, &NewValue); } + auto SetFallingSnowFn = FindObject("/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFallingSnow"); + LOG_INFO(LogDev, "Called SetSnow!"); static auto ada = FindObject(L"/Game/Athena/Apollo/Environments/Blueprints/CalendarEvents/BP_ApolloSnowSetup.BP_ApolloSnowSetup_C.SetFullSnowEd"); diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index e65f583..0737772 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -168,9 +168,9 @@ void __fastcall ApplyHomebaseEffectsOnPlayerSetupHook( AthenaHeroTypes.push_back(CurrentHeroType); } - if (AthenaHeroTypes.size()) + if (AthenaHeroTypes.size() > 0) { - HeroType = AthenaHeroTypes.at(std::rand() % AthenaHeroTypes.size()); + HeroType = AthenaHeroTypes.at(std::rand() % AthenaHeroTypes.size() /* - 1 */); } } @@ -512,6 +512,8 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x41624C8), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 7FF79E3E24C8 } + /* + if (Fortnite_Version == 6.21) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x191D2E0), (PVOID)CanCreateInCurrentContextHook, (PVOID*)&CanCreateInCurrentContextOriginal); else if (Fortnite_Version == 10.40) @@ -519,6 +521,8 @@ DWORD WINAPI Main(LPVOID) else if (Fortnite_Version == 12.41) Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x2DBCBA0), (PVOID)CanCreateInCurrentContextHook, (PVOID*)&CanCreateInCurrentContextOriginal); + */ + ChangeLevels(); auto AddressesToNull = Addresses::GetFunctionsToNull(); diff --git a/Project Reboot 3.0/gui.h b/Project Reboot 3.0/gui.h index 709d172..f480e56 100644 --- a/Project Reboot 3.0/gui.h +++ b/Project Reboot 3.0/gui.h @@ -1277,62 +1277,45 @@ static inline void PregameUI() ImGui::InputText("Playlist", &PlaylistName); } +static inline HICON LoadIconFromMemory(const char* bytes, int bytes_size, const wchar_t* IconName) { + HANDLE hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, bytes_size, IconName); + if (hMemory == NULL) { + return NULL; + } + + LPVOID lpBuffer = MapViewOfFile(hMemory, FILE_MAP_READ, 0, 0, bytes_size); + + if (lpBuffer == NULL) { + CloseHandle(hMemory); + return NULL; + } + + ICONINFO icon_info; + + if (!GetIconInfo((HICON)lpBuffer, &icon_info)) { + UnmapViewOfFile(lpBuffer); + CloseHandle(hMemory); + return NULL; + } + + HICON hIcon = CreateIconIndirect(&icon_info); + UnmapViewOfFile(lpBuffer); + CloseHandle(hMemory); + return hIcon; +} + static inline DWORD WINAPI GuiThread(LPVOID) { WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"RebootClass", NULL }; ::RegisterClassEx(&wc); HWND hwnd = ::CreateWindowExW(0L, wc.lpszClassName, L"Project Reboot", (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX), 100, 100, Width, Height, NULL, NULL, wc.hInstance, NULL); - HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(reboot_icon_data)); - - if (!hGlobal) + if (false) // idk why this dont work { - LOG_WARN(LogDev, "Failed to allocate global icon data!"); - } - else - { - void* data = GlobalLock(hGlobal); - memcpy(data, reboot_icon_data, sizeof(reboot_icon_data)); - GlobalUnlock(hGlobal); - - IStream* stream; - HRESULT hr = CreateStreamOnHGlobal(hGlobal, FALSE, &stream); - if (hr != S_OK) - { - // Handle error - } - - HBITMAP hBitmap{}; - HRESULT hr1 = CoInitialize(NULL); - hr1 = OleLoadPicture(stream, sizeof(reboot_icon_data), FALSE, IID_IPicture, (void**)&hBitmap); - stream->Release(); - GlobalFree(hGlobal); - CoUninitialize(); - - if (hr1 != S_OK) - { - // Handle error - } - - // Create the icon from the bitmap - ICONINFO iconInfo{}; - iconInfo.fIcon = TRUE; - iconInfo.xHotspot = 0; - iconInfo.yHotspot = 0; - iconInfo.hbmMask = NULL; - iconInfo.hbmColor = hBitmap; - - HICON hIcon = CreateIconIndirect(&iconInfo); - + auto hIcon = LoadIconFromMemory((const char*)reboot_icon_data, strlen((const char*)reboot_icon_data), L"RebootIco"); SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - - // Cleanup the resources - DeleteObject(iconInfo.hbmColor); } - - // HANDLE hIcon = LoadImageW(wc.hInstance, L"Reboot Resources/images/reboot.ico", IMAGE_ICON, 48, 48, LR_LOADFROMFILE); - // SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); // SetWindowLongPtrW(hwnd, GWL_STYLE, WS_POPUP); // Disables windows title bar at the cost of dragging and some quality @@ -1356,8 +1339,7 @@ static inline DWORD WINAPI GuiThread(LPVOID) io.IniFilename = NULL; // Disable imgui.ini generation. io.DisplaySize = ImGui::GetMainViewport()->Size; io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls - io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls - // io.Fonts->AddFontFromFileTTF("../vendor/fonts/Aller_Bd.ttf", 17); + // io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style InitFont(); diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index 1f725d8..8ee626f 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -330,7 +330,7 @@ namespace Hooking LOG_INFO(LogDev, "Hooking {} with Idx 0x{:x} (0x{:x})", FunctionName, AddrOrIdx, __int64(DefaultClass->VFTable[Idx]) - __int64(GetModuleHandleW(0))); - VirtualSwap(DefaultClass->VFTable, Idx, Detour); + VirtualSwap(DefaultClass->VFTable, Idx, Detour); // we should loop thrugh all objects and check if they inherit from the DefaultClass if so also swap that return true; } diff --git a/Project Reboot 3.0/reboot.h b/Project Reboot 3.0/reboot.h index ad69d39..04b6f05 100644 --- a/Project Reboot 3.0/reboot.h +++ b/Project Reboot 3.0/reboot.h @@ -262,25 +262,13 @@ inline void* FindPropertyStruct(const std::string& StructName, const std::string // LOG_INFO(LogFinder, "Struct: {}", Struct->GetFullName()); - auto getFNameOfProp = [](void* Property) -> FName* - { - FName* NamePrivate = nullptr; - - if (Engine_Version >= 425) - NamePrivate = (FName*)(__int64(Property) + 0x28); - else - NamePrivate = &((UField*)Property)->NamePrivate; - - return NamePrivate; - }; - for (auto CurrentClass = Struct; CurrentClass; CurrentClass = *(UObject**)(__int64(CurrentClass) + Offsets::SuperStruct)) { void* Property = *(void**)(__int64(CurrentClass) + Offsets::Children); if (Property) { - std::string PropName = getFNameOfProp(Property)->ToString(); + std::string PropName = GetFNameOfProp(Property)->ToString(); if (PropName == MemberName) { @@ -297,7 +285,7 @@ inline void* FindPropertyStruct(const std::string& StructName, const std::string } Property = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; - PropName = Property ? getFNameOfProp(Property)->ToString() : ""; + PropName = Property ? GetFNameOfProp(Property)->ToString() : ""; } } } @@ -322,25 +310,13 @@ inline int FindOffsetStruct(const std::string& StructName, const std::string& Me // LOG_INFO(LogFinder, "Struct: {}", Struct->GetFullName()); - auto getFNameOfProp = [](void* Property) -> FName* - { - FName* NamePrivate = nullptr; - - if (Engine_Version >= 425) - NamePrivate = (FName*)(__int64(Property) + 0x28); - else - NamePrivate = &((UField*)Property)->NamePrivate; - - return NamePrivate; - }; - for (auto CurrentClass = Struct; CurrentClass; CurrentClass = *(UObject**)(__int64(CurrentClass) + Offsets::SuperStruct)) { void* Property = *(void**)(__int64(CurrentClass) + Offsets::Children); if (Property) { - std::string PropName = getFNameOfProp(Property)->ToString(); + std::string PropName = GetFNameOfProp(Property)->ToString(); if (PropName == MemberName) { @@ -356,8 +332,8 @@ inline int FindOffsetStruct(const std::string& StructName, const std::string& Me return *(int*)(__int64(Property) + Offsets::Offset_Internal); } - Property = Engine_Version >= 425 ? *(void**)(__int64(Property) + 0x20) : ((UField*)Property)->Next; - PropName = Property ? getFNameOfProp(Property)->ToString() : ""; + Property = GetNext(Property); + PropName = Property ? GetFNameOfProp(Property)->ToString() : ""; } } }