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

FEAT(positional-audio): Add plugin for Among Us #4571

Conversation

davidebeatrici
Copy link
Member

No description provided.

stream << "Hat ID: " << std::to_string(playerFields.hatId) << std::endl;
stream << "Pet ID: " << std::to_string(playerFields.petId) << std::endl;
stream << "Dead: " << (playerFields.isDead ? "true" : "false") << std::endl;
stream << "Impostor: " << (playerFields.isImpostor ? "true" : "false") << std::endl;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm considering removing this, as it would allow anyone who can read the identity to cheat.

Copy link
Member

Choose a reason for hiding this comment

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

Well I think the positional data alone is enough info for being able to cheat. Not sure if we have to be this cautious here 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically the positional data could indeed indicate whether a player is an impostor, for example due to the coordinates "jumping" when moving through a duct (only impostors can do that).

However, I'm pretty sure it can be mistaken for lag.

plugins/Process.cpp Outdated Show resolved Hide resolved
plugins/Process.cpp Outdated Show resolved Hide resolved
plugins/Process.cpp Show resolved Hide resolved
plugins/Process.h Outdated Show resolved Hide resolved
plugins/amongus/Game.cpp Outdated Show resolved Hide resolved
}

const std::vector< uint8_t > clientPattern = { 0x74, 0x39, 0xA1, '?', '?', '?', '?', 0x8B, 0x40, 0x5C };
m_client = m_proc.peekPtr(m_proc.peekPtr(m_proc.findPattern(clientPattern, iter->second) + 3));
Copy link
Member

Choose a reason for hiding this comment

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

Why + 3? The comment about "magic numbers" applies here as well ☝️

Copy link
Member Author

Choose a reason for hiding this comment

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

I can see why it's confusing, I will write the assembly code in a comment.

stream << "Hat ID: " << std::to_string(playerFields.hatId) << std::endl;
stream << "Pet ID: " << std::to_string(playerFields.petId) << std::endl;
stream << "Dead: " << (playerFields.isDead ? "true" : "false") << std::endl;
stream << "Impostor: " << (playerFields.isImpostor ? "true" : "false") << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

Well I think the positional data alone is enough info for being able to cheat. Not sure if we have to be this cautious here 🤔

plugins/amongus/amongus.cpp Outdated Show resolved Hide resolved
plugins/amongus/amongus.cpp Outdated Show resolved Hide resolved
@davidebeatrici davidebeatrici force-pushed the positional-audio-plugin-amongus branch 2 times, most recently from 397dfcc to 762d392 Compare November 8, 2020 22:27
@@ -9,6 +9,8 @@

#include <chrono>

constexpr uint16_t findPatternBufferSize = 32768;
Copy link
Member

Choose a reason for hiding this comment

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

This still doesn't explain, why it has to be this specific vlaue...

And if this variable is only ever used inside findPattern, then I would make this a local variable to that function.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't have to be a specific value.

In fact, I could make the variable a parameter to the function.

Copy link
Member

Choose a reason for hiding this comment

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

Well if it doesn't have to be a specific value, how did you arrive at this particular number? It looks oddly specific to me xD

I don't think that making this a function parameter is a good idea. This seems like an implementation detail that the caller shouldn't have to worry about 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I chose a number that appears a good balance for the buffer size.

Copy link
Member

@Krzmbrzl Krzmbrzl Nov 10, 2020

Choose a reason for hiding this comment

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

I guess if it was plain 33000 instead folks like me wouldn't start wondering how that number came to existence ^^

Copy link
Member Author

Choose a reason for hiding this comment

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

I wrote a comment explaining that it's 32 KiB.

plugins/amongus/Game.cpp Show resolved Hide resolved
@StarGate01
Copy link

StarGate01 commented Nov 10, 2020

I also made this: https://github.com/StarGate01/AmongUs-Mumble , a mod for the game itself - uses the Mumble Link plugin. It has the benefit of being faster than memory scanning (uses hooking) and can be updated independently to follow the games rapid release cycle.

@davidebeatrici
Copy link
Member Author

Awesome, thank you very much for your work!

Consider that memory is never scanned once the plugin is successfully initialized, because memory addresses are cached.

The main advantage with your method is that game functions can be called directly, allowing to easily expand the plugin's feature set.

Among (Us) the disadvantages:

  • No support for Linux right now.
  • A mod has to be loaded into the game and there's no guarantee it will not be flagged as cheat in the future.

Regardless of that, it's still a really cool idea. The README is well made too.

About the RPC calls: with the new plugin framework (#3743) it will be possible to do that in the plugin itself.

However, I believe it would be better to handle that server-side through the "identity" sent by the client (see https://github.com/mumble-voip/mumo).

@StarGate01
Copy link

Agree on all points.

Linux support is planned, the Proton/Wine adapter is currently in development.

Cheat detection is a valid concern, if this ever becomes relevant we hope to make a deal with the developers.

The new JSON RPC API will be included once Mumble 1.4 releases with pluggin support, see #4575.

searchInBuffer() searches for the specified pattern in the specified buffer. "?" is used as wildcard.

findPattern(), given a start address and the size of the area, reads memory in chunks of 32 KiB.

It stops when a match is found, the end is reached or an error is encountered (peek() fails).

There's also an overload which iterates through the specified module's readable regions.
Tested with v2020.10.22s and v2020.09.22s.

Unless the pattern we're searching for becomes invalid or the structures we're using change, the plugin should keep working.
@davidebeatrici davidebeatrici merged commit cc84e4f into mumble-voip:master Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants