Giter VIP home page Giter VIP logo

bf1multiplayerchatcopypaster's Introduction

BF1MultiplayerChatCopyPaster

Nothing much just a toy project. Since Battlefield1 doesn't let you copy paste into the chat box so wanted to try to write a bypass for that (BTW, yes this is tested only on the Steam version, but I believe it would be pretty much same for Origins version except some offset values). It just uses Detours to hook to a specific location of the game in order to modify some certain values to ensure that the text currently clipboard container is containing gets written to the Chat box.

How BF1 handles it's chat message insert?

So far after wasting 6-8 hours I think the game checks for keyboard key state again and again in a loop proably uses GetKeyState WinAPI, a function checks if the specified key is pressed, as of writing the offset to that function is bf1.exe+0xC46610, this checks if the key is pressed then calls bf1.fb::TwinkleOverlayManager::isVisible+0x38E0 function, this checks if the chat overlay is visible and calls bf1.exe+0x650830, eventually after checking if the key which was pressed was a ASCII character the game allocates 2 buffer:

  1. [Not sure, we modify this anyways] To show the text nice and tiday it allocates the buffer with an extra space and stores the ASCII character. Probably from this buffer the Chat Overlay Renderer copies the characters to render the whole text. Address: bf1.exe+0x650B96
  2. Another buffer and there is also the ASCII character is stored, and some other code copies the character and copies the characters this buffer has to another buffer which is the whole Chat Text buffer, this whole Chat Text buffer is later used to send the text to the server. Address: bf1.exe+0x650BE2

We can just hook to an easy address to abuse the Key Press check, address bf1.exe+0x650BF2 was used in this case. While executing this address's code the RAX register still contains the Key Code(RAX >> 32) which was pressed, so simple check if Left Ctrl(0xA2) was pressed and then copy the text from the clipboard container using WinAPI GetClipboardData. During the execution of that address's code RDI + 0x60 is where the 1st buffer address is stored and RDI + 0x68 where this buffer address + 2 (2 for extra space) is stored the game subtracts RDI + 0x68 and RDI + 0x60 and checks the value if not equal to 0 in order to check if it needs to render new characters to the Chat Box Overlay. RDI + 0x40 is where the 2nd buffer address is stored and RDI + 0x48 where the buffer address + 1 is stored (why adding 1? The game subtracts this RDI + 0x48 value with the RDI + 0x40 value, I think this way the game checks if the whole Chat Text Buffer needs an update).

We get the clipboard text make two copies one with one extra space and then store to the respectable places RDI + 0x60 and RDI + 0x68, RDI + 0x40 and RDI + 0x48.

bf1multiplayerchatcopypaster's People

Contributors

iamsanjid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.