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
29 stars 4 forks source link

Cross-platform support? #86

Open a-hurst opened 3 years ago

a-hurst commented 3 years ago

Hi there,

Super-cool project! Glad someone is putting in the effort to preserving these games. I'm just curious whether, DirectX renderer aside, your porting of large chunks of this game (and NOLF1) over to SDL2 would eventually make the source code platform-independent enough to allow builds for Linux, macOS, and other platforms?

I'm partly asking because I stumbled on this project a while back, where the developer has taken the Lithtech and NOLF2 source and ported it over to 64-bit Linux and a Cmake build system, and has started initial work on an OpenGL renderer for the game. Was wondering how much overlap there's been in your efforts, and whether their cross-platform work could integrate nicely with your bugfixing/quality-of-life work to make a definitive, portable, WINAPI-free source port of these games. I'd imagine it would be a down-the-road thing since you've likely got larger priorities for this patch, just curious whether the way you've written things makes it a possibility!

Edit: @rohit-n, you mentioned in an issue for the other NOLF2 source port that you were interested in writing an OpenGL renderer for the game, but didn't want to bother if you couldn't fix some other game-breaking bugs you'd found with that version of the source. Have those bugs been addressed here?

haekb commented 3 years ago

Interesting. I won't be doing any work in this personally, but they're more than welcome to make a fork of this mod. They'll want to rip out the engine hacks, and the shims for STLPort I wrote to get it working on the vanilla client. 😅

But other than that it should be good to go. It'll probably provide nicer compatibility since I am breaking the "rules" of compilers, and compiling a VS2019 dll against VC++ 6.0 libs. (I'm still surprise this works as well as it does.)

With regards to SDL2, most of it was for convenience, I didn't really wanna touch the windows api, so stuff like window management isn't really the best. The input overhaul I did also isn't great, but that was mainly due to me figuring out how all that stuff worked while I was writing it. But the input stuff can just be ripped out since that can be fixed in the engine.

I'll leave this open for any questions that may come up.

a-hurst commented 3 years ago

Cool, thanks for the reply! Maybe if I have some free time over the next few months I'll try merging your efforts into their work to see if it gets their 64-bit Windows version running properly. If that's working, then maybe 64-bit Linux or macOS builds would get work with the DX9 renderer using winelib as a compatibility layer, at least until a proper OpenGL/Vulkan renderer is written.

What's unfortunate is that perfectly good OpenGL renderers for NOLF & NOLF2 already exist, but the source has never seen the light of day: there were OSX ports of both games in the PowerPC era that used OpenGL done by a third-party. Ah well, if some intrepid hackers can get a reverse-engineered port of GTA III running natively on a Switch, there's definitely hope for a future where NOLF2 is running along side it.

haekb commented 3 years ago

Yea, the OSX ports have debugging symbols (function names, and some variables, no structs though) still in, so I've been poking around in there every now and then to try and reverse engineer them. Some initial super rough work is here: https://github.com/haekb/OpenRen. Looking for that 3d model data is tough.

Good luck though!

rohit-n commented 3 years ago

Sorry for the late reply.

@a-hurst I made the decoder/lockpicking fix in Katana-Steel's repo here: https://github.com/Katana-Steel/lithtech/pull/24

It doesn't look like the fix is in this project. I'm not sure if it's needed here though, since this would have been quickly noticed. @haekb Do the decoder and lockpick work in the modernizer?

I haven't touched the code in a while, but I remember getting crashes when using the level skip cheat to get past Siberia. Unfortunately, I haven't been very productive since the pandemic began (you can tell because my last commits were in March, before lockdown). Perhaps I will get get back to this in the near future.

haekb commented 3 years ago

They do indeed work! I believe this actually fixed it https://github.com/haekb/nolf2-modernizer/pull/70/files.

The main issue I noticed was bananas had pretty much every effect applied to them at once.

But the game is fully playable. There were some issues when I switched STLPort to VS2019's std library, but I've cleaned that out too. (There was a light switch in Siberia that was crashing things.)

haekb commented 3 years ago

Here's the fix for that Siberia crash (I believe it's most likely the one you're referring too.) https://github.com/haekb/nolf2-modernizer/commit/57f3e6a430b2cfd3ffc919c6c08b6fa18f548a9c

And there's also a pretty dedicated lithtech modding community discord I'm in, if you're interested. Probably would get quicker answers there. https://discord.com/invite/NteWk2s