Fix UnrealEd on recent versions of Windows
UnrealEd 3.0 suffers from two annoying issues on Windows systems later than XP: first, when selecting a surface or an actor by clicking on it, the editor becomes unresponsive for several seconds, sometimes a full minute. Second: on shutdown, the editor may write abnormal values in one of its configuration files. The next time the editor is launched, all the settings of the Surface Properties window are squashed in a corner and the window is unusable.
Selection freeze
This problem seems to be caused by the natural evolution of DirectX. Starting with Windows Vista, some people reported very long hang-ups when clicking on actors or surfaces in both 2D and 3D viewports. On Windows 10, this is universal. It only happens with click-selection; using AltGr and a left-click to draw a selection rectangle around actors does not result in a freeze. This hurdle is also present in UnrealEd 2.1 and 2.2 for Unreal and UT99 when using OldUnreal's community patches, but these editors can revert to software rendering or use alternate renderers such as OpenGL to circumvent the issue.
Fortunately, after years of tedious suffering, someone developed a fix. You can download it on his GitHub. The fix comes as a .7z archive which requires 7zip to open. Simply extract D3DDrv.dll and drop it inside UT2004's \System\ directory. Erase or rename the original driver as you prefer.
Collapsed Surface Properties
Here is the Surface Properties window as it should appear:
However, starting with Windows 7, opening this window often results in the window's content being crumpled to the left and unusable.
This is due to the editor writing fancy values for the window's position in its configuration file when exiting the editor. These values are stored in UT2004's \System\ directory, halfway through the user.ini file.
There is no way to prevent UnrealEd from writing wrong values on shutdown. However, if a needed parameter is missing from user.ini, the engine will automatically insert it and give it a default value. We can use this to our advantage by making sure each time the editor is launched, the "WPropertyPage" setting is deleted from user.ini and reset by the editor. To do this, you have to launch the editor from a shortcut which will not be directed at UnrealEd.exe but at a batch script, whose role is to first remove this line from user.ini and only then launch the editor.
Batch scripts are simple text files saved with the .bat extension, containing a list of commands. Ours is going to be extremely simple:
@echo off
cd /d "D:\UT2004\System"
powershell -Command "(gc user.ini) -replace 'WPropertyPage.*', '' | Out-File user.ini"
start "" "D:\UT2004\System\UnrealEd.exe"
exit
You may notice the second line contains the path to UT2004's \System\ directory. Be sure to write the correct path depending on where your game is installed. In my case, UT2004 is located at the root of the D:\ drive. By default, UT2004 is installed at the root of C:\. If you bought UT2004 from Steam, the path may look like this: "C:\Program Files (x86)\Steam\steamapps\common\Unreal Tournament 2004\System\". The same holds true for the penultimate line, where D:\UT2004\System\UnrealEd.exe is the path to UnrealEd.exe in your \System\ directory.
If you're like me, you might want to add the -nogamma launch parameter after the path to Unrealed. The line would read: start "" "D:\UT2004\System\UnrealEd.exe" -nogamma.
Here's a line-by-line description of what the script does:
@echo off simply prevents the script from writing what it is doing in the command prompt.
cd /d "D:\UT2004\System" tells the script the location of the file it is going to act upon.
powershell -Command "(gc user.ini) -replace 'WPropertyPage.*', '' | Out-File user.ini" is a Windows powershell command. It is largely readable and self-explanatory: "gc user.ini" means "get content from user.ini", it's a way to open the file. Next, we use the -replace command with two parameters separated by a comma. 'WPropertyPage.*' is the line we want to replace. It is made up of the "WPropertyPage" string of characters, followed by a dot, which means "any character", and an asterisk, which means "repeated". The second parameter contains only two apostrophes and indicates an empty string. We are effectively blanking the whole line by replacing any instance of "WPropertyPage followed by any characters" with nothing.
After the vertical bar, Out-File user.ini saves the file after it has been modified.
start "" "D:\UT2004\System\UnrealEd.exe" starts the editor, which reads the user.ini files and, noticing the WPropertyPage parameter is nowhere to be found, adds it with a default value.
Finally, the ultimate line, exit, closes the command prompt which opens briefly when the script is run.
Open any text editor (Notepad will do) and paste the aforementioned script in a new file. Change the two paths to fit your setup and save the result. Change its file extension from .txt to .bat (use F2 to rename a file). You now have a working batch script to blank the troublesome line in user.ini and launch UnrealEd.
You can use this .bat script as is to launch UnrealEd from now on, but if you want to tidy it up, drop the script in your \System\ directory and create a shortcut to it. This allows you to set an icon for your shortcut and use UnrealEd's icon.
UnrealEd might still write whimsical numbers on shutdown, but it won't matter because the line will be reset on startup.