Skip to content

Commit

Permalink
set hotkeys in cfg lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
SSSiyan committed May 23, 2022
1 parent fd1691f commit 7aa7257
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/mods/EnemyStates.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "EnemyStates.hpp"
#include "utility/FixedQueue.hpp"

#if 1
static bool hotkey_enabled = false;
static int hotkey_save = 0;
static int hotkey_load = 0;
// static uint16_t g_prev_input;

// player
Expand Down Expand Up @@ -197,7 +198,7 @@ void EnemyStates::on_frame() {
// uint8_t inputByte2 = *(uint8_t*)0x01C8EFF5;
// if (input != g_prev_input && input) {
// if (inputByte1 & 0x08 && inputByte1 && 0x00 && inputByte2 & 0x01) {
if (GetAsyncKeyState(VK_END)) { // load hotkey
if (GetAsyncKeyState(hotkey_load)) { // load hotkey
uintptr_t enemyBase = *(uintptr_t*)lockedOnEnemyPtr;
if (playerBase && playerBase != -1 && enemyBase && enemyBase != -1) {
float* playerPosXYZ[3];
Expand Down Expand Up @@ -242,7 +243,7 @@ void EnemyStates::on_frame() {
}
}
// if (inputByte1 & 0x08 && inputByte2 & 0x01) {
if (GetAsyncKeyState(VK_HOME)) { // save hotkey
if (GetAsyncKeyState(hotkey_save)) { // save hotkey
uintptr_t enemyBase = *(uintptr_t*)lockedOnEnemyPtr;
if (playerBase && playerBase != -1 && enemyBase && enemyBase != -1) {
float* playerPosXYZ[3];
Expand Down Expand Up @@ -292,12 +293,16 @@ void EnemyStates::on_frame() {

// during load
void EnemyStates::on_config_load(const utility::Config &cfg) {
hotkey_enabled = cfg.get<bool>("enemy_states_hotkey").value_or(false);
hotkey_enabled = cfg.get<bool>("enemy_states_hotkey_enable").value_or(false);
hotkey_save = cfg.get<int>("enemy_states_save_hotkey").value_or(0x24); // HOME
hotkey_load = cfg.get<int>("enemy_states_load_hotkey").value_or(0x23); // END
}

// during save
void EnemyStates::on_config_save(utility::Config & cfg) {
cfg.set<bool>("enemy_states_hotkey", hotkey_enabled);
cfg.set<bool>("enemy_states_hotkey_enable", hotkey_enabled);
cfg.set<int>("enemy_states_save_hotkey", hotkey_save);
cfg.set<int>("enemy_states_load_hotkey", hotkey_load);
}

#endif

0 comments on commit 7aa7257

Please sign in to comment.