Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Refractor 2 BitStream

Featured Replies

  • Author
  • Localization

coder_for_life, posted Fri Jun 07, 2019 8:57 am (48567)


I decided to opensource the project I have worked on for a few weeks, hoping someone will come along and help me fix it's current issues. I decided to post about it here since I got the idea from BF2Loop and found bit functions there too.

As long as you don't send ServerInfo and MapList it's fine but without those the game doesnt load ofcourse :P
I started it because my end goal is to emulate the later games, BF Heroes and BF Play4Free, whose latest server files did not leak. So if they didn't leak, how do we get them? Let us emulate them :P
It has no systems for user authentication or rankings, the main goal is to get the game to load 1 player. Then load more players and keep them in sync and THEN I'd work on authentication and rankings.

You can find the code here: https://github.com/lifecoder-phoenix/Re ... m-Emulator

To continue the issue discussion, after authentication succeeded we must send the ServerInfo block and MapList block. If I send any, everything fine, but it doesnt load. If I send both however the game disconnects with the following error message: "network data corruption". I have noticed it never calls DataBlock::executeClient on those blocks. As if it doesnt recognize the packets. This issue has been my headache for 2 weeks now. Couldn't figure it out, hope it will be figured out soon.
  • Author
  • Localization

coder_for_life, posted Fri Jun 07, 2019 10:33 am (48568)


And I fixed the DataBlock issue, comments will be in the code. Long story short, seems there is also an increasing id in the event transmission. Actually increasing it worked
  • Author
  • Localization

coder_for_life, posted Mon Jun 10, 2019 12:00 pm (48636)


Alright, it seems the game loads the objects when it loads the level. Now the issue is that once the client finished loading the server is supposed to send every object on the map to it. But it also asks template id's and I cant seem to find them out. I wish to note that the template id increases too, like, if 2 objects have ladder_4m as template then for object A it will be template id 49 and for object B it would be template id 50
  • Author
  • Localization

aluigi, posted Mon Jun 10, 2019 4:06 pm (48642)


Not sure if there are users here active on the BF protocol but I'm happy you posted here :D
Keep up the good work!
  • Author
  • Localization

coder_for_life, posted Fri Jun 14, 2019 3:35 pm (48782)


No problem :P

I doubt anyone will be that interested in this, unless I get spawning to work. But you never know.

Current issue: the game expects the kits and objects from the server, these use an object id and a template id. The main question now is, how does the game know the id's? When are they loaded? Are they defined when loaded? Are they defined using the files loaded by the levels server zip?
  • Author
  • Localization

aluigi, posted Sun Jun 23, 2019 1:11 am (48971)


Unfortunately I don't have an answer about that doubt.
Probably server and client must have access to the same files and resources but I don't know how the IDs are assigned.

Just for curiosity do you have an example of such IDs (both objects and templates)?
  • Author
  • Localization

coder_for_life, posted Sun Jun 23, 2019 6:26 pm (48995)


I indeed believe so. What I believe is that it first initializes ServerArchives.con and then loads a few con files. Then the level con and when it loads the level's init.con it triggers ObjectManager::getNewId() which is used for the object ids. I haven't found it for the template id's yet but I think the templates are loaded upfront and when they are used they get their id. In case you did not know, here is a very useful thread: https://www.unknowncheats.me/forum/batt ... infos.html which contains debug symbols for bf2. A massive help with reversing this.

As for an example, this is a log made with conditional breakpoints in x32dbg, I added it as attachment. It returns to Object::Object() so it returns to the initializer of the new object.

Objects are thus probably loaded in order they appear in the level con files. And start by id 1.

No idea about templates yet, there are a few functions that I believe do the templates but I'm totally not sure.

EDIT: All data is loaded using the server files so *server.zip, the client zips only contain stuff for visuals. The server ones contain the good stuff
  • Author
  • Localization

coder_for_life, posted Mon Jun 24, 2019 12:14 pm (49010)


I think I finally have it figured out, template ids are also chronological. So in their case, it first loads FreeCamera, then creates the template for Sunlight and then chronological through all files in objects_server.zip
  • Author
  • Localization

coder_for_life, posted Fri Aug 02, 2019 11:36 am (50142)


Been a while, life sucks, but I got further. So except for the kits we ofcourse need to give the game spawngroups(not spawnpoints, well spawnpoints have a group) if we send the sendClientDatabaseComplete event before sending kits/spawngroups the client will disconnect saying the stream got corrupted. This is giving me a real headache
  • Author
  • Localization

devnull, posted Thu Jan 09, 2020 2:55 pm (53102)


Interesting. Is the latest version on github?
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.