Skip to content

Commit

Permalink
✨ Create UConsole
Browse files Browse the repository at this point in the history
  • Loading branch information
47PADO47 committed Mar 18, 2024
1 parent 2366cad commit e941353
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Internal/hook/Hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <format>
#include "Features.h"
#include "../utils/Globals.h"

namespace Hook {
HHOOK g_hook;
Expand All @@ -23,14 +24,14 @@ namespace Hook {
Logger::Log("ERROR", "No engine init");
return FALSE;
};
Globals::Init();

UWorld* World = *(UWorld**)(WRLD);
if (!World) {
if (!Globals::World) {
Logger::Log("ERROR", "No World");
return FALSE;
};

UGameInstance* OwningGameInstance = World->OwningGameInstance;
UGameInstance* OwningGameInstance = Globals::World->OwningGameInstance;
if (!OwningGameInstance) {
Logger::Log("ERROR", "No owning game instance");
return FALSE;
Expand All @@ -57,7 +58,7 @@ namespace Hook {
};

PostRenderVTable = ViewPortClientVTable;
ProcessEventVTable = World->VFTable;
ProcessEventVTable = Globals::World->VFTable;

UPortalWarsSaveGame* UserSave = ((UPortalWarsLocalPlayer*)LocalPlayer)->GetUserSaveGame();
if (UserSave) {
Expand All @@ -69,6 +70,10 @@ namespace Hook {

Logger::Log("INFO", format("Found [{:d}] Objects", ObjObjects->NumElements));

UObject* NewObject = Globals::GameplayStatics->SpawnObject(UConsole::StaticClass(), Globals::Engine->GameViewport);
Globals::Engine->GameViewport->ViewportConsole = static_cast<UConsole*>(NewObject);
Logger::Log("SUCCESS", "UConsole spawned");

Scripts::Init();

return TRUE;
Expand Down

0 comments on commit e941353

Please sign in to comment.