haekb / nolf2-modernizer

NOLF 2 Modernizer aims to unlock resolution support, restore multi-player support, and fix a few bugs here and there.
https://haekb.itch.io/nolf2-modernizer
30 stars 4 forks source link

Features/15 new server dir #41

Closed haekb closed 4 years ago

haekb commented 4 years ago

Resolves #15 (Mostly)

I didn't end up re-writing the server dir, but I have cleaned it up to a state where it's not complete garbage.

I've added MOTD and version checking functionality, as well as a way to use a different master server if I ever die, and cannot pay my bills :P

Still needs a bit of clean up!

haekb commented 4 years ago

Massive re-work of JServerDir, couple of notes:

Request thread now has the ability to cleanly return data through m_vReturnData.

For supported functions you need to return a <JOB>ReturnData struct. This will then go into the union declared in JobReturnData and ->bSet = true will done. And finally it'll be pushed into m_vReturnData.

On the main thread's Update() function, it'll act similar to the Request thread's job popping. It'll try to lock m_vReturnData, if it can't it'll just return. If it can, it'll pop one off, and set any data on the main thread.

This allows me to do away with the custom GetMOTD function, as well as a whole lot of ugly states.

One problems right now:

Some menu functionality is tied to eStatus_Waiting/eStatus_Processing. This should maybe transferred over to iQueryRefCounter?

haekb commented 4 years ago

There are still some problems with this, but in general it seems to be working fairly well.

The addition of version checking and motd are pretty smooth now! The async changes I've done to the browser listing seem to work well too!