placeholder pause UI
This commit is contained in:
@@ -143,6 +143,14 @@ namespace TLAC::Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComponentsManager::UpdatePostDraw()
|
||||||
|
{
|
||||||
|
for (auto& component : components)
|
||||||
|
{
|
||||||
|
component->UpdatePostDraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ComponentsManager::OnFocusGain()
|
void ComponentsManager::OnFocusGain()
|
||||||
{
|
{
|
||||||
for (auto& component : components)
|
for (auto& component : components)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace TLAC::Components
|
|||||||
void Update();
|
void Update();
|
||||||
void UpdateInput();
|
void UpdateInput();
|
||||||
void UpdatePostInput();
|
void UpdatePostInput();
|
||||||
|
void UpdatePostDraw();
|
||||||
void OnFocusGain();
|
void OnFocusGain();
|
||||||
void OnFocusLost();
|
void OnFocusLost();
|
||||||
void Dispose();
|
void Dispose();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace TLAC::Components
|
|||||||
|
|
||||||
virtual void UpdateInput() {};
|
virtual void UpdateInput() {};
|
||||||
virtual void UpdatePostInput() {};
|
virtual void UpdatePostInput() {};
|
||||||
|
virtual void UpdatePostDraw() {};
|
||||||
virtual void OnFocusGain() {};
|
virtual void OnFocusGain() {};
|
||||||
virtual void OnFocusLost() {};
|
virtual void OnFocusLost() {};
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,16 @@
|
|||||||
#include "../Constants.h"
|
#include "../Constants.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "Input/InputState.h"
|
#include "Input/InputState.h"
|
||||||
|
#include "GL\glut.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace TLAC::Components
|
namespace TLAC::Components
|
||||||
{
|
{
|
||||||
|
bool Pause::isPaused = false;
|
||||||
|
std::vector<uint8_t> Pause::origAetMovOp;
|
||||||
|
std::vector<bool> Pause::streamPlayStates;
|
||||||
|
|
||||||
Pause::Pause()
|
Pause::Pause()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -42,8 +47,20 @@ namespace TLAC::Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// swallow all button inputs if paused
|
|
||||||
InputState* inputState = (InputState*)(*(uint64_t*)INPUT_STATE_PTR_ADDRESS);
|
InputState* inputState = (InputState*)(*(uint64_t*)INPUT_STATE_PTR_ADDRESS);
|
||||||
|
|
||||||
|
if (inputState->Tapped.Buttons & JVS_SQUARE)
|
||||||
|
showUI = !showUI;
|
||||||
|
|
||||||
|
if (inputState->Tapped.Buttons & JVS_L)
|
||||||
|
menuPos -= 1;
|
||||||
|
|
||||||
|
if (inputState->Tapped.Buttons & JVS_R)
|
||||||
|
menuPos += 1;
|
||||||
|
|
||||||
|
menuPos %= menuItems.size();
|
||||||
|
|
||||||
|
// swallow all button inputs if paused
|
||||||
inputState->Tapped.Buttons = JVS_NONE;
|
inputState->Tapped.Buttons = JVS_NONE;
|
||||||
inputState->DoubleTapped.Buttons = JVS_NONE;
|
inputState->DoubleTapped.Buttons = JVS_NONE;
|
||||||
inputState->Down.Buttons = JVS_NONE;
|
inputState->Down.Buttons = JVS_NONE;
|
||||||
@@ -65,6 +82,61 @@ namespace TLAC::Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pause::UpdatePostDraw()
|
||||||
|
{
|
||||||
|
if (isPaused && showUI)
|
||||||
|
{
|
||||||
|
// this isn't imgui code, but I probably wouldn't have gotten this working properly if I didn't reference it, so... umm... yeah lol
|
||||||
|
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
|
|
||||||
|
int width = glutGet(GLUT_WINDOW_WIDTH);
|
||||||
|
int height = glutGet(GLUT_WINDOW_HEIGHT);
|
||||||
|
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, 1280, 720, 0, -1.0f, +1.0f);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
glColor4ub(0, 0, 0, 127);
|
||||||
|
glVertex2i(0, 0);
|
||||||
|
glVertex2i(1280, 0);
|
||||||
|
glVertex2i(1280, 720);
|
||||||
|
glVertex2i(0, 720);
|
||||||
|
|
||||||
|
glColor4ub(255, 255, 255, 127);
|
||||||
|
glVertex2i(560, 250);
|
||||||
|
glVertex2i(620, 250);
|
||||||
|
glVertex2i(620, 470);
|
||||||
|
glVertex2i(560, 470);
|
||||||
|
glVertex2i(660, 250);
|
||||||
|
glVertex2i(720, 250);
|
||||||
|
glVertex2i(720, 470);
|
||||||
|
glVertex2i(660, 470);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glPopAttrib();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Pause::isPauseKeyTapped()
|
bool Pause::isPauseKeyTapped()
|
||||||
{
|
{
|
||||||
return ((InputState*)(*(uint64_t*)INPUT_STATE_PTR_ADDRESS))->Tapped.Buttons & JVS_START;
|
return ((InputState*)(*(uint64_t*)INPUT_STATE_PTR_ADDRESS))->Tapped.Buttons & JVS_START;
|
||||||
|
|||||||
@@ -15,15 +15,24 @@ namespace TLAC::Components
|
|||||||
virtual void Initialize(ComponentsManager*) override;
|
virtual void Initialize(ComponentsManager*) override;
|
||||||
virtual void Update() override;
|
virtual void Update() override;
|
||||||
virtual void UpdatePostInput() override;
|
virtual void UpdatePostInput() override;
|
||||||
|
virtual void UpdatePostDraw() override;
|
||||||
|
|
||||||
|
static bool isPaused;
|
||||||
private:
|
private:
|
||||||
bool isPaused;
|
// this is a mess of static so that menuItems can work
|
||||||
bool isPauseKeyTapped();
|
static bool isPauseKeyTapped();
|
||||||
void setPaused(bool pause);
|
static void setPaused(bool pause);
|
||||||
std::vector<bool> streamPlayStates;
|
static std::vector<bool> streamPlayStates;
|
||||||
void InjectCode(void* address, const std::vector<uint8_t> data);
|
static void InjectCode(void* address, const std::vector<uint8_t> data);
|
||||||
|
|
||||||
std::vector<uint8_t> origAetMovOp;
|
static std::vector<uint8_t> origAetMovOp;
|
||||||
uint8_t* aetMovPatchAddress = (uint8_t*)0x1401703b3;
|
static constexpr uint8_t* aetMovPatchAddress = (uint8_t*)0x1401703b3;
|
||||||
|
|
||||||
|
bool showUI = true;
|
||||||
|
unsigned int menuPos = 0;
|
||||||
|
static void unpause() { setPaused(false); };
|
||||||
|
std::vector<std::pair<std::string, void(*)()>> menuItems = {
|
||||||
|
std::pair<std::string, void(*)()>(std::string("RESUME"), &unpause),
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ constexpr uint8_t JNE_OPCODE = 0x85;
|
|||||||
|
|
||||||
//constexpr uint64_t ENGINE_UPDATE_HOOK_TARGET_ADDRESS = 0x000000014018CC40;
|
//constexpr uint64_t ENGINE_UPDATE_HOOK_TARGET_ADDRESS = 0x000000014018CC40;
|
||||||
constexpr uint64_t ENGINE_UPDATE_INPUT_ADDRESS = 0x000000014018CBB0;
|
constexpr uint64_t ENGINE_UPDATE_INPUT_ADDRESS = 0x000000014018CBB0;
|
||||||
|
constexpr uint64_t ENGINE_FINISH_DRAW_ADDRESS = 0x0000000140192730;
|
||||||
|
|
||||||
constexpr uint64_t CURRENT_GAME_STATE_ADDRESS = 0x0000000140EDA810;
|
constexpr uint64_t CURRENT_GAME_STATE_ADDRESS = 0x0000000140EDA810;
|
||||||
constexpr uint64_t CURRENT_GAME_SUB_STATE_ADDRESS = 0x0000000140EDA82C;
|
constexpr uint64_t CURRENT_GAME_SUB_STATE_ADDRESS = 0x0000000140EDA82C;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#pragma comment(lib, "detours.lib")
|
#pragma comment(lib, "detours.lib")
|
||||||
|
|
||||||
void(__cdecl* divaEngineUpdate)() = (void(__cdecl*)())0x14018CC40;
|
void(__cdecl* divaEngineUpdate)() = (void(__cdecl*)())0x14018CC40;
|
||||||
|
void(__cdecl* divaEngineFinishDraw)() = (void(__cdecl*)())ENGINE_FINISH_DRAW_ADDRESS;
|
||||||
|
|
||||||
LRESULT CALLBACK MessageWindowProcessCallback(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK MessageWindowProcessCallback(HWND, UINT, WPARAM, LPARAM);
|
||||||
DWORD WINAPI WindowMessageDispatcher(LPVOID);
|
DWORD WINAPI WindowMessageDispatcher(LPVOID);
|
||||||
@@ -126,6 +127,11 @@ namespace TLAC
|
|||||||
ComponentsManager.OnFocusLost();
|
ComponentsManager.OnFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdatePostDraw()
|
||||||
|
{
|
||||||
|
ComponentsManager.UpdatePostDraw();
|
||||||
|
}
|
||||||
|
|
||||||
void InitializeExtraSettings()
|
void InitializeExtraSettings()
|
||||||
{
|
{
|
||||||
const LPCTSTR RESOLUTION_CONFIG_FILE_NAME = _T(".\\config.ini");
|
const LPCTSTR RESOLUTION_CONFIG_FILE_NAME = _T(".\\config.ini");
|
||||||
@@ -342,6 +348,12 @@ void hookedEngineUpdate()
|
|||||||
//divaEngineUpdate();
|
//divaEngineUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hookedEngineFinishDraw()
|
||||||
|
{
|
||||||
|
TLAC::UpdatePostDraw();
|
||||||
|
divaEngineFinishDraw();
|
||||||
|
}
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
HWND consoleHandle = GetConsoleWindow();
|
HWND consoleHandle = GetConsoleWindow();
|
||||||
@@ -362,6 +374,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
|
|||||||
DetourUpdateThread(GetCurrentThread());
|
DetourUpdateThread(GetCurrentThread());
|
||||||
DetourAttach(&(PVOID&)divaEngineUpdate, hookedEngineUpdate);
|
DetourAttach(&(PVOID&)divaEngineUpdate, hookedEngineUpdate);
|
||||||
DetourTransactionCommit();
|
DetourTransactionCommit();
|
||||||
|
DetourTransactionBegin();
|
||||||
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
DetourAttach(&(PVOID&)divaEngineFinishDraw, hookedEngineFinishDraw);
|
||||||
|
DetourTransactionCommit();
|
||||||
|
|
||||||
TLAC::InitializeExtraSettings();
|
TLAC::InitializeExtraSettings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user