Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couple of small tweaks #125

Merged
merged 2 commits into from
Jan 3, 2025
Merged
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
7 changes: 7 additions & 0 deletions src/chimera/command/client/debug/show_coordinates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "../../../command/command.hpp"
#include "../../../halo_data/player.hpp"
#include "../../../halo_data/object.hpp"
#include "../../../signature/signature.hpp"
#include "../../../chimera.hpp"

namespace Chimera {
static void show_coordinates() noexcept;
Expand Down Expand Up @@ -35,7 +37,10 @@ namespace Chimera {

static void show_coordinates() noexcept {
auto *player = PlayerTable::get_player_table().get_client_player();
auto *camx = *reinterpret_cast<float **>(get_chimera().get_signature("camera_rotation_sig").data() + 0xF);
auto *camy = *reinterpret_cast<float **>(get_chimera().get_signature("camera_rotation_sig").data() + 0x14);

char rotation[256] = "";
char center[256] = "Dead";
char relative[256] = "";

Expand All @@ -44,6 +49,7 @@ namespace Chimera {
auto &object_table = ObjectTable::get_object_table();
auto *object = object_table.get_dynamic_object(player->object_id);
if(object) {
std::snprintf(rotation, sizeof(center), "Rotation: %.10f, %.10f", *camx , *camy);
std::snprintf(center, sizeof(center), "Center: %.05f, %.05f, %.05f", object->center_position.x, object->center_position.y, object->center_position.z);

auto *vehicle_object = object_table.get_dynamic_object(object->parent);
Expand All @@ -58,6 +64,7 @@ namespace Chimera {

auto font = GenericFont::FONT_CONSOLE;
int font_size = font_pixel_height(font);
apply_text(rotation, -240, 220 - font_size * 3, 480, 200, blue, font, FontAlignment::ALIGN_CENTER, TextAnchor::ANCHOR_CENTER);
apply_text(center, -240, 220 - font_size * 2, 480, 200, blue, font, FontAlignment::ALIGN_CENTER, TextAnchor::ANCHOR_CENTER);
apply_text(relative, -240, 220 - font_size, 480, 200, blue, font, FontAlignment::ALIGN_CENTER, TextAnchor::ANCHOR_CENTER);
}
Expand Down
6 changes: 3 additions & 3 deletions src/chimera/command/client/enhancement/throttle_fps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Chimera {
typedef std::chrono::high_resolution_clock clock;
static clock::time_point next_frame;

static void on_preframe() {
static void on_frame() {
while(clock::now() < next_frame) {
Sleep(0);
}
Expand All @@ -34,13 +34,13 @@ namespace Chimera {
// If user inputs an invalid framerate, assume they are turning it off.
if(new_fps <= 0) {
enabled = false;
remove_preframe_event(on_preframe);
remove_frame_event(on_frame);
}
else {
enabled = true;
max_spf = 1.0f / new_fps;
next_frame = clock::now();
add_preframe_event(on_preframe);
add_frame_event(on_frame, EventPriority::EVENT_PRIORITY_FINAL);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/chimera/signature/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ namespace Chimera {
FIND("on_camera_sig", "client", { 0xE8, -1, -1, -1, -1, 0x8B, 0x45, 0xEC, 0x8B, 0x4D, 0xF0, 0x40, 0x81, 0xC6 });
FIND("camera_coord_sig", "client", { 0xD9, 0x05, -1, -1, -1, -1, 0x83, 0xEC, 0x18, 0xDD, 0x5C, 0x24, 0x10 });
FIND("camera_type_sig", "client", { 0x81, 0xC1, -1, -1, -1, -1, 0x8B, 0x41, 0x08, 0x3D, -1, -1, -1, -1, 0x75, 0x1D, 0xD9, 0x05 });
FIND("camera_rotation_sig", "client", { 0xE8, -1, -1, -1, -1, 0x8B, 0xF0, 0x33, 0xC0, 0xA3, -1, -1, -1, -1, 0xA3, -1, -1, -1, -1, 0xA3, -1, -1, -1, -1 });
FIND("camera_interpolation_sig", "client", { 0x8D, 0x54, 0x24, -1, 0x52, 0xE8, -1, -1, -1, -1, 0x83, 0xC4, 0x10, 0x84, 0xC0, 0x74, -1 });
FIND("checkpoint_func_sig", "client", { 0xA1, -1, -1, -1, -1, 0x8A, 0x48, 0x02, 0x84, 0xC9, 0x0F, 0x85, -1, -1, -1, -1, 0xA0 });
FIND("checkpoint_sig", "client", { 0x38, 0x1D, -1, -1, -1, -1, 0x74, 0x05, 0xE8, -1, -1, -1, -1, 0xA1, -1, -1, -1, -1, 0x83, 0xF8, 0xFF, 0x74, 0x19 });
Expand Down