Page 1 of 1

Modding SWBF2 under Linux using WINE

Posted: Thu Jul 09, 2015 8:36 pm
by zwyx1234
Greetings everyone,

Since I would like to mod SWBF2 under Linux using WINE, I want to have a place to post any progress, setbacks, research, and what not that I have. With that said, here is a list of items which I hope to expand upon. Hide tags used for easier reading/navigation.

THE SWBF2 CLIENT
Hidden/Spoiler:
KNOWN ISSUES:
-The ingame steam overlay must be disabled or SWBF2 will crash upon pressing any key after loading a game.
-Load times of 5 minutes or so are always present. The game will look like it froze, but it has not. This is only for getting into a game or changing levels. I want to see if I can fix this further down the road.

WHAT WORKS:
-Everything else seems to work flawlessly. The introduction campaign videos play, no crashes or freezing, everything feels smooth and is very enjoyable.

WHAT WAS NOT TESTED:
-No idea what multiplayer looks like at this time. I might try and test that at a later date.
THE MOD TOOLS
Hidden/Spoiler:
KNOWN ISSUES:
-The windows batch (.bat) files used for compiling (or munging in SWBF2 terms) are set to open with the text editor and I have been trying to figure out a way to open them with the wine command prompt but no luck yet. You'd think this would be a simple fix, it is not.

WHAT WORKS:
-Have not been able to do any tests to confirm what works and what does not at this time.

WHAT WAS NOT TESTED:
-Everything at this time.
In case someone finds its useful, I am going to post my laptops specifications and my general WINE setup below.

MY CURRENT SYSTEM:
Hidden/Spoiler:
-I am running the steam version of SWBF2

johnbobsmith@JohnBobSmith-laptop ~ $ wine --version
wine-1.6.2
johnbobsmith@JohnBobSmith-laptop ~ $ inxi -SCG
System: Host: JohnBobSmith-laptop Kernel: 3.13.0-24-generic x86_64 (64 bit)
Desktop: Xfce 4.11.8 Distro: Linux Mint 17 Qiana
CPU: Dual core AMD A4-4300M APU with Radeon HD Graphics (-MCP-) cache: 2048 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm)
Clock Speeds: 1: 1400.00 MHz 2: 1400.00 MHz
Graphics: Card: Advanced Micro Devices [AMD/ATI] Trinity [Radeon HD 7420G]
X.Org: 1.15.1 driver: fglrx Resolution: [email protected]
GLX Renderer: AMD Radeon HD 7420G GLX Version: 4.4.13084 - CPC 14.301.1001
johnbobsmith@JohnBobSmith-laptop ~ $
I think thats it. I plan on keeping this thread up to date as I make progress, in hopes that someone will find it useful. :)

Re: Modding SWBF2 under Linux using WINE

Posted: Sat Jul 11, 2015 12:05 am
by Oceans14
Interesting! I read this post earlier and was inspired to try fixing the ZE runtime error by using WINE in my Debian partition. I figured maybe the Linux nouveau driver would coexist better than nvidia's, but no dice. Very curious to see what you are able to get working here.

Re: Modding SWBF2 under Linux using WINE

Posted: Sat Jul 11, 2015 6:49 am
by zwyx1234
I am excited to. On that note, I have good, bad, and ugly news:

THE GOOD NEWS:
-Creating a world using the visual munge program works!
-I have successfully gotten the batch files to run!

THE BAD NEWS:
-Using visual munge to compile said world does not work :(

THE UGLY NEWS:
-Although the batch files *run*, they seem to hang on the line that reads something like "merging ../../Common/Localize/English.cfg". I left it for 40 minutes while I played a Dota 2 match, nothing. I have been trying to tweak the .bat file ever since, no avail. The English.cfg localization file is just a stupid amount of plain text at first glance, weighing in at 1.3MB or so. The texture (.tga) files munge super fast, why is it hanging on text? :roll:

Re: Modding SWBF2 under Linux using WINE

Posted: Sat Jul 11, 2015 2:32 pm
by jedimoose32
I know next to nothing about Linux but I do know that VisualMunge calls BF2_ModTools/ToolsFL/bin/LocalizeMunge.exe for that step. So maybe make sure everything in the ToolsFL folder is covered by WINE as well? (If that doesn't make sense, again I apologize for knowing nothing about Linux :o )

Re: Modding SWBF2 under Linux using WINE

Posted: Sat Jul 11, 2015 7:47 pm
by zwyx1234
I have been trying to get LocalizeMunge.exe to run with the parameters given to it within the batch file(s). The VisualMunge.exe will not work for compilation with common checked, but perhaps having only Localize checked would work? Modifying the batch files has given, thus far, 0 success. I know the LocalizeMunge.exe runs because I see a console then it closes. Having captured a screen shot of it running its spitting what seems to be usage text. I believe the way the batch files are structured are causing the "freeze" as in it has nothing left to do but has not reached EOF. I am going to keep working on this.

Re: Modding SWBF2 under Linux using WINE

Posted: Sun Jul 12, 2015 11:43 pm
by Marth8880
zwyx1234 wrote:but perhaps having only Localize checked would work?
Pretty sure that checkbox doesn't actually do anything.

Re: Modding SWBF2 under Linux using WINE

Posted: Sun Jul 12, 2015 11:57 pm
by [RDH]Zerted
I tried this a long time ago. Multiplayer does work, but the super long loading times means you timeout after each match. My plan for munging was to rewrite everything as ant build scripts, but I never finished that project.

Re: Modding SWBF2 under Linux using WINE

Posted: Mon Jul 13, 2015 4:06 am
by zwyx1234
Would using Python work as an alternative scripting language to the Ant Build Scripts? If I could use Python, I am almost certain I could get munging working. The batch files seem dumb and awkward to me, and re-writing bits and pieces has done nothing.

On a different note, it appears that LocalizeMunge.exe is not being called correctly (or at all) from the Munge.bat located in BF2_ModTools/Data_ABC/_BUILD/Common. Relevant code below, no modifications from my end.
Hidden/Spoiler:
[code]REM ===== Merge and munge localization files

set InputDir1=%MUNGE_ROOT_DIR%\Common\Localize\%MUNGE_PLATFORM%
set InputDir2=%MUNGE_ROOT_DIR%\Common\Localize
set MungeTemp=MungeTemp
call MergeLocalize.bat %InputDir1% %InputDir2% %MungeTemp%
REM Perform Munging
localizemunge -inputfile *.cfg %MUNGE_ARGS% -sourcedir %MungeTemp% -outputdir %MUNGE_DIR% 2>>%MUNGE_LOG%
REM Delete Merge Temp Dir
del /q %MungeTemp%\*.*
rmdir %MungeTemp%
[/code]
Contents of MergeLocalize.bat, which is called from previously mentioned munge.bat
Hidden/Spoiler:
[code]
@echo off

:: //-----------------------------------------------------------
:: // Create some cleaner variable names
:: //-----------------------------------------------------------

if "%3"=="" (
ECHO.
Echo Format: MergeLocalize.Bat InputDir1 InputDir2 TempDir
ECHO.
GOTO DONE
)

setlocal ENABLEDELAYEDEXPANSION

set Source1Dir=%1
set Source2Dir=%2
set TempDir=%3

:: //-----------------------------------------------------------
:: // Copy and merge the two text files for each language
:: //-----------------------------------------------------------

if NOT EXIST %TempDir% mkdir %TempDir%

FOR %%i IN (%Source1Dir%\*.cfg %Source2Dir%\*.cfg) DO (
echo Merging %%i...
more %%i >> %TempDir%\%%~ni%%~xi
)

ECHO.

endlocal

:DONE
[/code]
It looks like the line of code right below REM Perform Munging is supposed to run the LocalizeMunge.exe program located in BF2_ModTools/ToolsFL/bin/. However, it is failing to do so. Invoking the LocalizeMunge.exe by itself causes a bunch of scrolling text which, after a hastily taken screenshot, seems to be usage information regarding textures (which I find odd). Sadly I am an idiot and forgot to save the screenshot but with trial and error I can get another one if needed. The point is the localizemunge.exe does run by itself. Now I have been trying to get it to run with the arguments in the batch file. Manually expanding the variables hasnt worked, and start C:/BF2_ModTools/ToolsFL/bin/LocalizeMunge.exe <the arguments here> didnt work either. Will post back if I figure anything else out.

EDIT: It has occurred to me that the LocalizeMunge.exe may not the the problem. The problem may be the more %%i >> %TempDir%\%%~ni%%~xi line of code found in MergeLocalize.bat, which occurs after printing out that it is merging. Now to find out what all that means/does...

Re: Modding SWBF2 under Linux using WINE

Posted: Tue Jul 14, 2015 9:47 pm
by [RDH]Zerted
more %%i >> %TempDir%\%%~ni%%~xi is copying the contents of %%i to %TempDir%\%%~ni%%~xi

Run LocalizeMunge.exe (and all of the other ones) from a command line, don't double click on them. If you run it from a command line you can see the output and it won't close. If you have to double-click in Windows, there's still a way to keep it from closing. Right click on the file, and it's a setting somewhere in Properties or something.

You can use whatever you want to replace the batch scripts. You could even use Lua.

Re: Modding SWBF2 under Linux using WINE

Posted: Wed Jul 15, 2015 2:57 pm
by zwyx1234
Thank you Zerted. After looking up the more command, it said that more displays textual output to the console one screen at a time, which I find odd for use as copying. When I replaced "more" with "copy", the entire munge process finished! Or so I thought... I played my successfully created map in SWBF2 only to find that upon getting past loading screen there was no actual map or terrain to play on. Sure enough, world munging had not occurred. I changed the following parameters in the munge.bat found in Data_ABC/_BUILD/ to munge the world only. On line 9, set WORLD_PARAMETERS=EVERYTHING and on line 21, set MUNGE_ALL=0. This only invokes world munging. After a few batch file calls, somewhere there is a syntax error which likely causes the invalid parameter errors I am also getting. Apparently "else" is not recognized as an internal command blah blah blah, and valid directories for world munging are invalid. In one file there *IS* a glaring error in that a double quoted block of text is missing the second quote, like (in C++ syntax) std::cout << "error, missing quote after period. << std::endl; Attempting to muck with the batch file(s) has gotten nowhere, even commenting offending lines out.

I feel like I am at the last stepping stone now though. Once I figure out exactly where world munging is failing, I should be good to go munge wise.

Then there is the problem of ZeroEditor potentially not working... We will worry about that when we get there.

Re: Modding SWBF2 under Linux using WINE

Posted: Wed Jul 15, 2015 9:21 pm
by [RDH]Zerted
I should have been more specific. >> appends to the specified file. Appending is not the same as copying. It is a very common practice in both Windows and Linux to redirect the standard output of one program into the standard input of another program. You use characters like |, <, >, <<, >> to do that.

You're trying to make major changes or fixes the the .bat files you should learn batch scripting: https://en.wikibooks.org/wiki/Windows_Batch_Scripting

Re: Modding SWBF2 under Linux using WINE

Posted: Fri Jul 31, 2015 1:05 pm
by zwyx1234
Thank you for suggesting I learn batch Zerted. My goal for modding swbf2 under WINE is to get as much stuff working as I can, so learning batch is a good first step. :) I will post how it goes.



EDIT
Unfortunately, due to real life circumstances I will be unable to work on this project. I would love to, but family comes first. Always.

Best wishes to all,
zwyx1234