Skip to content

Commit

Permalink
ignore window scale in fs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed May 27, 2024
1 parent 8d1afec commit 75b9406
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions max.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ uint32_t *Max::upgrades() { return (uint32_t *)(slot() + 0x604); }

uint8_t *Max::keys() { return (uint8_t *)(slot() + 0x5c9); }

uint8_t *Max::options() {
return (uint8_t *)(*(size_t *)get_address("slots") + 0x400 + 0x75048);
}

void Max::save_game() {
using SaveGameFunc = void();
static SaveGameFunc *save = (SaveGameFunc *)get_address("save_game");
Expand Down
2 changes: 2 additions & 0 deletions max.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using State = size_t;
using Minimap = size_t;
using Slot = size_t;
using Player = size_t;
using Options = size_t;

struct Coord {
int x;
Expand Down Expand Up @@ -42,5 +43,6 @@ struct Max {
uint8_t *items();
uint32_t *upgrades();
uint8_t *keys();
uint8_t *options();
void save_game();
};
16 changes: 16 additions & 0 deletions ui.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <array>
#include <chrono>
#include <imgui.h>
#include <imgui_internal.h>

Expand Down Expand Up @@ -244,6 +245,8 @@ void UI::DrawMap() {
}

void UI::ScaleWindow() {
if (*Max::get().options() & 2) // FS
return;
RECT c;
RECT w;
GetClientRect(hWnd, &c);
Expand Down Expand Up @@ -329,6 +332,7 @@ UI::UI() {
ImGui::Text("Slot: %p", Max::get().slot());
ImGui::Text("Layer: %p", get_address("layer_base"));
ImGui::Text("Layer: %p", get_address("layer_offset"));
ImGui::Text("Options: %p", Max::get().options());
if (!this->inMenu) {
ImGui::ShowDemoWindow();
ImGui::ShowMetricsWindow();
Expand Down Expand Up @@ -408,6 +412,18 @@ void UI::Draw() {
}
}

{
using namespace std::chrono_literals;
auto now = std::chrono::system_clock::now();
if (io.MousePos.x != lastMousePos.x || io.MousePos.y != lastMousePos.y) {
lastMouseActivity = now;
lastMousePos = io.MousePos;
io.MouseDrawCursor = true;
} else if (lastMouseActivity + 2s < now) {
ImGui::SetMouseCursor(ImGuiMouseCursor_None);
}
}

{
auto mpos = Normalize(io.MousePos);
int x = mpos.x;
Expand Down
3 changes: 3 additions & 0 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class UI {
bool inMenu = false;
int lastMenuFrame = 0;
int lastMinimapFrame = 0;
std::chrono::system_clock::time_point lastMouseActivity =
std::chrono::system_clock::now();
ImVec2 lastMousePos = ImVec2(0, 0);
int windowScale = 4;

public:
Expand Down

0 comments on commit 75b9406

Please sign in to comment.