AFAIK, vanilla BF2 has more or less been abandoned by the BF2 community for this.
I'm not sure how they reworked the entire thing, so I'm guessing you might find the source-code/reverse-engineered stuff somewhere.
"Project Reality: Battlefield 2 is a free-to-download single and multiplayer game modification for the Battlefield 2 (BF2) retail Microsoft Windows PC game. Project Reality installs alongside your existing Battlefield 2 game installation, allowing both the original game and Project Reality to be played separately without conflict."
I'm not sure how they reworked the entire thing, so I'm guessing you might find the source-code/reverse-engineered stuff somewhere.
"Project Reality: Battlefield 2 is a free-to-download single and multiplayer game modification for the Battlefield 2 (BF2) retail Microsoft Windows PC game. Project Reality installs alongside your existing Battlefield 2 game installation, allowing both the original game and Project Reality to be played separately without conflict."
https://www.realitymod.com/about