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

Improve PF packet logic #306

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Improve PF packet logic #306

wants to merge 9 commits into from

Conversation

is-this-c
Copy link
Contributor

@is-this-c is-this-c commented Nov 25, 2024

Recognize browsers and also support anticheat status and fire accuracy.

I cannot change anticheat code so it is a best effort.

This PR does not fix that send_pf_player_stats_packet is not regularly called.

@@ -1029,7 +1029,7 @@ CodeInjection multi_io_process_packets_injection{
0x0047918D,
[](auto& regs) {
int packet_type = regs.esi;
if (packet_type > 0x37) {
if (packet_type > 0x37 || packet_type == static_cast<int>(pf_packet_type::player_stats)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

std::memcpy(&in_stats, player_stats_ptr, sizeof(in_stats));
player_stats_ptr += sizeof(in_stats);
auto* player = rf::multi_find_player_by_id(in_stats.player_id);
if (player) {
auto& stats = *static_cast<PlayerStatsNew*>(player->stats);
// Ignore `is_pure`. Why is it in `player_stats`?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense in case AC checks every X seconds whatever you modified something, e.g. using CheatEngine. So we could probably use that. I don't see any downsides. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. Can PF fail auth after a player has authed?

@@ -13,6 +13,7 @@ struct PlayerStatsNew : rf::PlayerLevelStats
float num_shots_fired;
float damage_received;
float damage_given;
std::optional<uint8_t> received_accuracy{};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is your plan for this field? I don't think PF shown it anywhere... Do you think it should be visible in the scoreboard? I worry that people with bad skill wouldn't like it...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was in spectate iirc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is for spectate but could include console cmds or score board.

@@ -51,6 +51,7 @@ Version 1.9.0 (not released yet)
- Support `©` in TrueType fonts
- Improve frag messages
- Search in command descriptions in `.` command
- Improve PF packet logic
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit generic. Does this change has any user-facing impact? I usually avoid adding changelog entries for purely technical changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well PF clients shall see changes and it is what enables browser identifiers so I think it is worth something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants