Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Customizable Watermark #546

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Osiris/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ static void from_json(const json& j, Config::Misc::KeyBoardDisplay& kbd)
static void from_json(const json& j, Config::Misc::Watermark& o)
{
read(j, "Enabled", o.enabled);
read(j, "Cheat", o.cheat);
read(j, "User", o.user);
read(j, "Fps", o.fps);
read(j, "Latency", o.latency);
read(j, "Time", o.wtime);
read<value_t::object>(j, "Pos", o.pos);
}

Expand Down Expand Up @@ -1215,7 +1220,11 @@ static void to_json(json& j, const Config::Misc::KeyBoardDisplay& o, const Confi
static void to_json(json& j, const Config::Misc::Watermark& o, const Config::Misc::Watermark& dummy = {})
{
WRITE("Enabled", enabled);

WRITE("Cheat", cheat);
WRITE("User", user);
WRITE("Fps", fps);
WRITE("Latency", latency);
WRITE("Time", wtime);
if (const auto window = ImGui::FindWindowByName("Watermark")) {
j["Pos"] = window->Pos;
}
Expand Down
5 changes: 5 additions & 0 deletions Osiris/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ class Config {

struct Watermark {
bool enabled = false;
bool cheat = true;
bool user = true;
bool fps = true;
bool latency = true;
bool wtime = true;
ImVec2 pos;
};
Watermark watermark;
Expand Down
14 changes: 14 additions & 0 deletions Osiris/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,20 @@ void GUI::renderMiscWindow() noexcept
ImGui::PopID();

ImGui::Checkbox("Watermark", &config->misc.watermark.enabled);
ImGui::SameLine();

ImGui::PushID("Watermark");
if (ImGui::Button("..."))
ImGui::OpenPopup("");

if (ImGui::BeginPopup("")) {
ImGui::Checkbox("Cheat", &config->misc.watermark.cheat);
ImGui::Checkbox("User", &config->misc.watermark.user);
ImGui::Checkbox("Fps", &config->misc.watermark.fps);
ImGui::Checkbox("Latency", &config->misc.watermark.latency);
ImGui::Checkbox("Time", &config->misc.watermark.wtime);
ImGui::EndPopup();
}
ImGuiCustom::colorPicker("Offscreen Enemies", config->misc.offscreenEnemies, &config->misc.offscreenEnemies.enabled);
ImGui::SameLine();
ImGui::PushID("Offscreen Enemies");
Expand Down
41 changes: 40 additions & 1 deletion Osiris/Hacks/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,10 +1661,49 @@ void Misc::watermark() noexcept
ImGui::SetNextWindowBgAlpha(0.3f);
ImGui::Begin("Watermark", nullptr, windowFlags);

char* username = getenv("username");

static auto frameRate = 1.0f;
frameRate = 0.9f * frameRate + 0.1f * memory->globalVars->absoluteFrameTime;

ImGui::Text("Osiris | %d fps | %d ms", frameRate != 0.0f ? static_cast<int>(1 / frameRate) : 0, GameData::getNetOutgoingLatency());
static auto lastTime = 0.0f;
if (memory->globalVars->realtime - lastTime < 1.0f)
return;

const auto time = std::time(nullptr);
const auto localTime = std::localtime(&time);

//cheat
if (config->misc.watermark.cheat)
ImGui::Text("Osiris");
ImGui::SameLine();
if (config->misc.watermark.cheat && (config->misc.watermark.user || config->misc.watermark.fps || config->misc.watermark.latency || config->misc.watermark.wtime))
ImGui::Text("|");
ImGui::SameLine();
//username
if (config->misc.watermark.user)
ImGui::Text(username);
ImGui::SameLine();
if (config->misc.watermark.user && (config->misc.watermark.fps || config->misc.watermark.latency || config->misc.watermark.wtime))
ImGui::Text("|");
ImGui::SameLine();
//fps
if (config->misc.watermark.fps)
ImGui::Text("%d fps", frameRate != 0.0f ? static_cast<int>(1 / frameRate) : 0);
ImGui::SameLine();
if (config->misc.watermark.fps && (config->misc.watermark.latency || config->misc.watermark.wtime))
ImGui::Text("|");
ImGui::SameLine();
//latency
if (config->misc.watermark.latency)
ImGui::Text("%d ms", GameData::getNetOutgoingLatency());
ImGui::SameLine();
if (config->misc.watermark.latency && config->misc.watermark.wtime)
ImGui::Text("|");
ImGui::SameLine();
//time
if (config->misc.watermark.wtime)
ImGui::Text("%02d:%02d:%02d", localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
ImGui::End();
}

Expand Down