Sign in to follow this  
Guest misho

Progress Update - WinXP users - Read!

Recommended Posts

I'm progressing with the next version of TB steadily and I think I found the cause of the headache for users running TB on non-Win9x setups (WinXP, Win2000...)I was consulting one of the programmers at work and he suggested that, instead of the BAT files, WinXP looks for *.CMD files - so now, I'm checking for a non 9x OS, and renaming BAT to CMD. Hopefully, that will do the trick...Also - seems like multi-source INF-files are a go! This will greatly clarify what is going on with the night and seasonal textures! I will confirm this within next few days!

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Misho,Instead of using DOS batch files at all, it would probably be better to handle it internally in the "windows" way. There are three benefits to this:1) The control code is handled internally in whatever language you are writing the application in... Much, much more powerful than what the simple batch language offers.2) You can wait for the process to exit and get any exit code returned. The command run can also be hidden so you can control its outcome (as long as you show a "cancel" dialog of some sort of course).3) Has no problems on any version of windows, from 95 to XP.The relevant API commands are CreateProcess, WaitforSingleObject and GetExitCodeProcess. Since I'm a delphi guy, here's an example in Delphi:[pre]

---[font face="Courier New"][font color="#000080"][b]function [/b][/font]WinExecAndWait[font color="#800080"]([/font]FileName[font color="#800080"]: [/font][font color="#000080"][b]String[/b][/font][font color="#800080"]; [/font]Visibility[font color="#800080"]: [/font]Integer[font color="#800080"]): [/font]LongWord[font color="#800080"];[/font][font color="#000080"][b]var  [/b][/font]zAppName[font color="#800080"]:[/font][font color="#000080"][b]array[/b][/font][font color="#800080"]([/font][font color="#808000"]0[/font][font color="#800080"]..[/font][font color="#808000"]512[/font][font color="#800080"]) [/font][font color="#000080"][b]of [/b][/font]char[font color="#800080"];  [/font]zCurDir[font color="#800080"]:[/font][font color="#000080"][b]array[/b][/font][font color="#800080"]([/font][font color="#808000"]0[/font][font color="#800080"]..[/font][font color="#808000"]255[/font][font color="#800080"]) [/font][font color="#000080"][b]of [/b][/font]char[font color="#800080"];  [/font]WorkDir[font color="#800080"]:[/font][font color="#000080"][b]String[/b][/font][font color="#800080"];  [/font]StartupInfo[font color="#800080"]:[/font]TStartupInfo[font color="#800080"];  [/font]ProcessInfo[font color="#800080"]:[/font]TProcessInformation[font color="#800080"];  [/font]iRet[font color="#800080"]:[/font]LongWord[font color="#800080"];[/font][font color="#000080"][b]begin  [/b][/font]StrPCopy[font color="#800080"]([/font]zAppName[font color="#800080"],[/font]FileName[font color="#800080"]);  [/font]GetDir[font color="#800080"]([/font][font color="#808000"]0[/font][font color="#800080"],[/font]WorkDir[font color="#800080"]);  [/font]StrPCopy[font color="#800080"]([/font]zCurDir[font color="#800080"],[/font]WorkDir[font color="#800080"]);  [/font]FillChar[font color="#800080"]([/font]StartupInfo[font color="#800080"],[/font]Sizeof[font color="#800080"]([/font]StartupInfo[font color="#800080"]),[/font][font color="#008000"]#0[/font][font color="#800080"]);  [/font]StartupInfo[font color="#800080"].[/font]cb [font color="#800080"]:= [/font]Sizeof[font color="#800080"]([/font]StartupInfo[font color="#800080"]);  [/font]StartupInfo[font color="#800080"].[/font]dwFlags [font color="#800080"]:= [/font]STARTF_USESHOWWINDOW[font color="#800080"];  [/font]StartupInfo[font color="#800080"].[/font]wShowWindow [font color="#800080"]:= [/font]Visibility[font color="#800080"];  [/font][font color="#000080"][b]if not [/b][/font]CreateProcess[font color="#800080"]([/font][font color="#000080"][b]nil[/b][/font][font color="#800080"],	 [/font]zAppName[font color="#800080"],					  [/font][font color="#FF0000"][i]{ pointer to command line string }	 [/i][/font][font color="#000080"][b]nil[/b][/font][font color="#800080"],						   [/font][font color="#FF0000"][i]{ pointer to process security attributes }	 [/i][/font][font color="#000080"][b]nil[/b][/font][font color="#800080"],						   [/font][font color="#FF0000"][i]{ pointer to thread security attributes }	 [/i][/font]false[font color="#800080"],						 [/font][font color="#FF0000"][i]{ handle inheritance flag }	 [/i][/font]CREATE_NEW_CONSOLE [font color="#000080"][b]or		  [/b][/font][font color="#FF0000"][i]{ creation flags }	 [/i][/font]NORMAL_PRIORITY_CLASS[font color="#800080"],	 [/font][font color="#000080"][b]nil[/b][/font][font color="#800080"],						   [/font][font color="#FF0000"][i]{ pointer to new environment block }	 [/i][/font][font color="#000080"][b]nil[/b][/font][font color="#800080"],						   [/font][font color="#FF0000"][i]{ pointer to current directory name }	 [/i][/font]StartupInfo[font color="#800080"],				   [/font][font color="#FF0000"][i]{ pointer to STARTUPINFO }	 [/i][/font]ProcessInfo[font color="#800080"]) [/font][font color="#000080"][b]then			  [/b][/font][font color="#FF0000"][i]{ pointer to PROCESS_INF }	[/i][/font]Result [font color="#800080"]:= [/font][font color="#808000"]4294967295  [/font][font color="#000080"][b]else begin	repeat	  [/b][/font]Application[font color="#800080"].[/font]ProcessMessages[font color="#800080"];	  [/font]iRet [font color="#800080"]:= [/font]WaitforSingleObject[font color="#800080"]([/font]ProcessInfo[font color="#800080"].[/font]hProcess[font color="#800080"],[/font][font color="#808000"]500[/font][font color="#800080"]);	[/font][font color="#000080"][b]until [/b][/font]iRet [font color="#800080"]<> [/font]WAIT_TIMEOUT[font color="#800080"];	[/font]GetExitCodeProcess[font color="#800080"]([/font]ProcessInfo[font color="#800080"].[/font]hProcess[font color="#800080"],[/font]Result[font color="#800080"]);  [/font][font color="#000080"][b]end[/b][/font][font color="#800080"];[/font][font color="#000080"][b]end[/b][/font][font color="#800080"];[/font][/font]

[/pre]---You would call it with something like this:iErrCode := WinExecAndWait('C:Tempaprogram.exe /commandline', SW_SHOWNORMAL);(or for visibility, with SW_HIDE, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED, etc). It won't return until the process has completed. In the above case, I add the "Application.ProcessMessages" loop that allows the UI to remain responsive. You could skip that loop if you wanted and use the INFINITE flag with WaitForSingleObject instead of the 500ms that I used above. Usually I change the code a bit to create a modal dialog (outside the above function of course) and in the above function insert a cancel flag check within the loop. If modal dialog is canceled, I then kill the process and return a special Result.There are many ways to use these commands besides the way I outlined above such as within one of your own threads, etc, but the above should work for what you are doing I'd think.Just a suggestion that might alleviate some of the problems you might be having with batch files.Take care,http://members.rogers.com/eelvish/elrondlogo.gifhttp://members.rogers.com/eelvish/flyurl.gif

Share this post


Link to post
Share on other sites

Thanks!I will look into this. Batch files seemed like an easy way, and they provided feedback. I want to first get the functionality going though - this will be a "nice" thing to have.Thanks again,

Share this post


Link to post
Share on other sites

I tested a multi-source, multi-destination INF-file approach and it looks like the "CUSTOM" type source does NOT work with multi-approach. Too bad, but this is not a show stopper because this can be done through different means (multi-INF files)Does anyone know what are the keywords for "season=" directive?As in:lightmapsummerfallwinterhard winterspringwinter and hard winter (hwinter?) are not recognized, all other keywords are recognized and the resampler names textures with appropriate suffixes...Also, for anyone who is experimenting:withseasons=1 andseason=...must reside in DESTINATION section, NOT SOURCE section.

Share this post


Link to post
Share on other sites

Hi Misho - grate work! Hope you will solve the xp problem since i am running xp. In the meantime i use your software only to chop the picture and to create the inf file. The rest i have to do in a dos window with resample.exe - tmf2bgl.exe and imagetool.exe and elronds nice textureconverter to get the watertextures. The reason your wintertexture wont show is thar yor parameters for winter are wrong. The right parameters for the seasons are: 'lightmap', 'fall', 'spring', 'harsh winter' and 'mild winter'besides summer."harsh winter" makes the hw textures and "mild winter" makes the wi textures.keep up the work!Torgeir Opland

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this