From b4ac1d28c1c4134aead837e16284e9e37796cf74 Mon Sep 17 00:00:00 2001 From: Mgamerz Date: Wed, 22 Jul 2020 19:04:05 -0600 Subject: [PATCH 1/2] Experiments: Xbox input logger --- Experiments/Experiments.cpp | 160 +++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 76 deletions(-) diff --git a/Experiments/Experiments.cpp b/Experiments/Experiments.cpp index 54bd588..42d7e1f 100644 --- a/Experiments/Experiments.cpp +++ b/Experiments/Experiments.cpp @@ -35,95 +35,103 @@ FVector inline RotationToVector(FRotator Rotation) { void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void* pParms, void* pResult) { char* szName = pFunction->GetFullName(); - if (isPartOf(szName, "Function Engine.DebugCameraHUD.PostRender")) - { - ProcessEvent(pObject, pFunction, pParms, pResult); - ADebugCameraHUD* debugCameraHud = (ADebugCameraHUD*)pObject; - if (!debugCameraHud->Canvas) - { - return; - } - int xpos = 40; - int ypos = 300; + //if (isPartOf(szName, "Function Engine.DebugCameraHUD.PostRender")) + //{ + // ProcessEvent(pObject, pFunction, pParms, pResult); + // ADebugCameraHUD* debugCameraHud = (ADebugCameraHUD*)pObject; + // if (!debugCameraHud->Canvas) + // { + // return; + // } + // int xpos = 40; + // int ypos = 300; - debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) - debugCameraHud->Canvas->SetDrawColor(150, 150, 255, 255); - debugCameraHud->Canvas->DrawText(L"ME3Tweaks Enhanced Debug Camera Mod", true, 1.5f, 1.5f, NULL); + // debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) + // debugCameraHud->Canvas->SetDrawColor(150, 150, 255, 255); + // debugCameraHud->Canvas->DrawText(L"ME3Tweaks Enhanced Debug Camera Mod", true, 1.5f, 1.5f, NULL); - xpos += 25; - ypos += 20; - debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) - debugCameraHud->Canvas->SetDrawColor(255, 255, 255, 255); + // xpos += 25; + // ypos += 20; + // debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) + // debugCameraHud->Canvas->SetDrawColor(255, 255, 255, 255); - //Perform trace + // //Perform trace - FVector Extent = { 0,0,0 }; - FVector HitLocation; - FVector HitNormal; - FTraceHitInfo HitInfo; - FRotator camRotation = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.Rotation; + // FVector Extent = { 0,0,0 }; + // FVector HitLocation; + // FVector HitNormal; + // FTraceHitInfo HitInfo; + // FRotator camRotation = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.Rotation; - FVector end = RotationToVector(camRotation); + // FVector end = RotationToVector(camRotation); - FVector camLoc = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.location; - end.X = end.X * 5000 * 20 + camLoc.X; - end.Y = end.Z * 5000 * 20 + camLoc.Y; - end.Z = end.Z * 5000 * 20 + camLoc.Z; + // FVector camLoc = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.location; + // end.X = end.X * 5000 * 20 + camLoc.X; + // end.Y = end.Z * 5000 * 20 + camLoc.Y; + // end.Z = end.Z * 5000 * 20 + camLoc.Z; - AActor* foundActor = debugCameraHud->Trace(end, camLoc, 1, Extent, 0, &HitLocation, &HitNormal, &HitInfo); - if (foundActor) - { - string str = string_format("Containing file: %s.pcc", foundActor->GetContainingMapName()); - std::wstring widestr = std::wstring(str.begin(), str.end()); - debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), true, 1.0f, 1.0f, NULL); - - ypos += 12; - debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) - str = string_format("Hit Actor: %s_%i", foundActor->GetFullNameNoClass(), (foundActor->Name.GetIndex() - 1)); - widestr = std::wstring(str.begin(), str.end()); - debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), true, 1.0f, 1.0f, NULL); - - - if (HitInfo.HitComponent) { - ypos += 12; - debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) - str = string_format("Hit component: %s_%d", HitInfo.HitComponent->GetFullName(), HitInfo.HitComponent->Name.GetIndex() - 1); - widestr = std::wstring(str.begin(), str.end()); - debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), false, 1.0f, 1.0f, NULL); - // HitInfo.HitComponent-> - } + // AActor* foundActor = debugCameraHud->Trace(end, camLoc, 1, Extent, 0, &HitLocation, &HitNormal, &HitInfo); + // if (foundActor) + // { + // string str = string_format("Containing file: %s.pcc", foundActor->GetContainingMapName()); + // std::wstring widestr = std::wstring(str.begin(), str.end()); + // debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), true, 1.0f, 1.0f, NULL); - //logger.writeToLog(string_format("(%s) %s_%d\n", mapname, fullname, instanceIndex), true); - } - else - { - debugCameraHud->Canvas->DrawText(L"No trace hit", true, 1.0f, 1.0f, NULL); + // ypos += 12; + // debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) + // str = string_format("Hit Actor: %s_%i", foundActor->GetFullNameNoClass(), (foundActor->Name.GetIndex() - 1)); + // widestr = std::wstring(str.begin(), str.end()); + // debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), true, 1.0f, 1.0f, NULL); + + + // if (HitInfo.HitComponent) { + // ypos += 12; + // debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10) + // str = string_format("Hit component: %s_%d", HitInfo.HitComponent->GetFullName(), HitInfo.HitComponent->Name.GetIndex() - 1); + // widestr = std::wstring(str.begin(), str.end()); + // debugCameraHud->Canvas->DrawText(FString(const_cast(widestr.c_str())), false, 1.0f, 1.0f, NULL); + // // HitInfo.HitComponent-> + // } + + // //logger.writeToLog(string_format("(%s) %s_%d\n", mapname, fullname, instanceIndex), true); + // } + // else + // { + // debugCameraHud->Canvas->DrawText(L"No trace hit", true, 1.0f, 1.0f, NULL); - } - return; // do not process twice. - /*AActor* actor = (AActor*)pObject; - if (actor->WorldInfo) - { - if (actor->WorldInfo->bUseConsoleInput == 0) - { - logger.writeToConsoleOnly(string_format(" >> WI IS ZERO! WorldInfo.bUseConsoleInput: %u\n", actor->WorldInfo->bUseConsoleInput), true); - } - actor->WorldInfo->bUseConsoleInput = 1; - }*/ - } - //else if (isPartOf(szName, "Function SFXGame.SFXConsole.InputKey")) { - // USFXConsole_execInputKey_Parms* params = (USFXConsole_execInputKey_Parms*)pParms; - // //Event: 0 - > Down - // //Event: 1 - > Up - // //Event: 2 - > Holding - // logger.writeToConsoleOnly(string_format("Key pressed: %u %s\n", params->Event, params->Key.GetName()), true); - // if (params->Event == 1 && isPartOf(params->Key.GetName(), "Xbox")) { - // logger.writeToConsoleOnly(string_format("%u %s, setting bUseConsoleInput on next tick!\n", params->Event, params->Key.GetName()), true); - // logNextTick = true; // } + // return; // do not process twice. + // /*AActor* actor = (AActor*)pObject; + // if (actor->WorldInfo) + // { + // if (actor->WorldInfo->bUseConsoleInput == 0) + // { + // logger.writeToConsoleOnly(string_format(" >> WI IS ZERO! WorldInfo.bUseConsoleInput: %u\n", actor->WorldInfo->bUseConsoleInput), true); + // } + // actor->WorldInfo->bUseConsoleInput = 1; + // }*/ //} + //else + if (isPartOf(szName, "Function SFXGame.SFXConsole.InputKey")) { + USFXConsole_execInputKey_Parms* params = (USFXConsole_execInputKey_Parms*)pParms; + //Event: 0 - > Down + //Event: 1 - > Up + //Event: 2 - > Holding + //logger.writeToConsoleOnly(string_format("Key pressed: %u %s\n", params->Event, params->Key.GetName()), true); + if (isPartOf(params->Key.GetName(), "Xbox")) { + if (params->Event == 0) { + logger.writeToConsoleOnly(string_format("%s DOWN\n", params->Key.GetName()), true); + } + else if (params->Event == 1) { + logger.writeToConsoleOnly(string_format("%s UP\n", params->Key.GetName()), true); + } + else if (params->Event == 2) { + logger.writeToConsoleOnly(string_format("%s HOLD\n", params->Key.GetName()), true); + } + } + } ProcessEvent(pObject, pFunction, pParms, pResult); } From 5e9180c492e99f8fa5869cb5ba00170931f9adc8 Mon Sep 17 00:00:00 2001 From: Mgamerz Date: Wed, 7 Oct 2020 19:51:41 -0600 Subject: [PATCH 2/2] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 645ebe5..d4f53c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ # ME3-ASI-Plugins -ASI Plugins for Mass Effect 3 -This is a repository for my ME3 ASI plugins. You can download and install these inside of Mass Effect 3 Mod Manager by going to Mod Management > ASI Mod Manager or using the ASI Manager tool in ME3Explorer - ME3Tweaks Fork 4.1 or higher. +This is a repository for ME3Tweaks ME3 ASI plugins. You can download and install these inside of ME3Tweaks Mod Manager by going to Mod Management > ASI Mod Manager, or using the ASI Manager tool in ME3Explorer - ME3Tweaks Fork 4.1 or higher.