PrismaticFlower / swbf-unmunge

A totally groovy tool for getting access to game files for a game from 2005.
MIT License
25 stars 4 forks source link

Will there ever be a Linux version? #22

Open ghost opened 3 years ago

ghost commented 3 years ago

Title explains itself, please consider porting to Linux, it would be greatly helpful.

BAD-AL commented 3 years ago

One support library that this project depends on (DirectXTex) is Windows dependent, which makes it a bit difficult to port to a non-windows platform. There is a fork (https://github.com/WHSnyder/swbf-unmunge) that aims to support Mac/Linux. I am unsure how functional it is though.

Since the SWBF1 & SWBF2 mod tools are already dependent on Windows, it seems like a Linux port would have a very limited user base. But I would suggest trying out the branch by WHSnyder to see if it meets your use case.

PrismaticFlower commented 3 years ago

It certainly isn't a primary goal at this stage for me, given that in the primary use case for the tool people are likely to be on Windows. But I don't rule it out ever happening. I think there are really only four key barriers to it building on other platforms. (I might be forgetting something though, but I do not think I am.)

  1. The Mapped_file class, it uses the Windows specific APIs for creating memory mapped files. Simply taking a dependency on boost and using it's mapped_file would be an easy and effective way to solve this problem.

  2. DirectXTex this is the tricky one it's ScratchImage and Image objects and a few key functions from it's API are used frequently throughout texture handling. It's also used for saving textures as DDS and PNG files, TGA files have their own special handler that saves out files in the way the SWBF tool chain likes. Building on other platforms would require finding or creating library that can do all the same things DirectXTex currently does but in a platform independent manner.

  3. There might be a couple dependencies on enums found in Windows headers, solving this is fairly easy of course. They'd just need recreating in the style swbf-unmunge uses, as was done for D3DPRIMITIVETYPE in handle_model.cpp.

  4. I think there are a couple places where I've used MSVC specific syntax by mistake (which it doesn't warn of when /permissive- is set). Solving this should be straightforward in most cases however, just identify what the correct standard syntax is and apply it. Thankfully I believe the places where non-standard syntax is used are rare.