Wargus / wargus

Importer and scripts for Warcraft II: Tides of Darkness, the expansion Beyond the Dark Portal, and Aleonas Tales
GNU General Public License v2.0
355 stars 55 forks source link

Start of modernization of wartool. #401

Closed ghost closed 2 years ago

ghost commented 2 years ago

This pull request addresses #398. This pull request only updates the code as minimally as possible. Future pull requests may more radically update the interfaces or functions. Mainly I changed raw pointers to either unique or shared pointers, char *'s to strings and malloc'ed arrays with std::vectors. I tried to keep the overall flow of the code as intact as possible and preserved most of the comments.

This pull request is the basis for more serious refactoring in the future, and was designed to give byte identical output with previous versions of wartool. Included as part of that is the start of a regression testing framework. The initial documentation of how to use the python scripts for testing is here: (https://github.com/Wargus/wargus/wiki/Testing-wartool).

As of right now, this has only been tested on Fedora Linux 35 with the BNE English language CD. I hope in the near future to be able to test on a larger variety of platforms. As part of that I am submitting the pull request to see if there are any issues building.

ghost commented 2 years ago

It looks like the builds are currently failing due to the error function in stratagus-gameutils being less forgiving than my workaround, I will try to fix that shortly.

ghost commented 2 years ago

Looks like the windows build failed due to a ssize_t, so I added a using declaration for it.

ghost commented 2 years ago

Looks like there are still some issues building with the MS compiler. This weekend I can try getting Windows running and see if I can get it to compile there.

ghost commented 2 years ago

https://stackoverflow.com/questions/59943984/how-can-i-convert-an-stdfilesystempath-to-lpcstr-for-use-in-one-of-the-loadl . It looks like on Windows the std::filesystem functions convert to wchar_t strings instead of char strings. I will have to make some changes to work around that.

ghost commented 2 years ago

It looks like some function calls will need to be replaced with the wchar_t versions on windows: https://stackoverflow.com/a/9746912. Overall this is likely going to lead to an improvement in path handling on windows after I get it building there.

ghost commented 2 years ago

Currently this is blocked by us building for Windows XP. On Windows XP TCHAR is a multibyte encoding, and we need UTF-16 TCHAR with the current changes I made. Currently retargetting to Windows 7 requires updating the dependencies. This is in progress on my branch here https://github.com/abenedic/win32-stratagus-dependencies, but I am still facing a lot of build issues.