HomeCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in
Community database: HERE!

Share | 
 

 Updating UT drivers (Direct3D and OpenGL)

View previous topic View next topic Go down 
AuthorMessage
=*dark*=Shai-Hulud




Posts : 954
Join date : 2008-04-23

UT Player Information
Current Skin: Malcolm Malcolm
PostSubject: Updating UT drivers (Direct3D and OpenGL)   Mon Apr 09, 2012 12:44 pm

Ahhh, a while ago I tinkered with this when Laz was having trouble with his new PC, but didn't get around to finishing it (because he was able to fix his problems anyway), but I resurrected it to help someone else recently.

I use something called Inno Setup to create "installers" for some of my stuff (it's an alternative to the more well known NullSoft Installer), it's really easy to script (and it uses a flavour of the Pascal language, so that was good because I'm reasonably familiar with it) - you can read about it here if you're interested: http://www.jrsoftware.org/isinfo.php

So I created this super-simple installer that includes copies of the latest (at the time of writing) Direct3D and OpenGL drivers for UT from: http://www.cwdohnal.com/utglr/ (Direct3D9 1.3 and OpenGL 3.5).

Why would you want to? Well, if you're running UT smoothly at the moment, then you probably don't. But if you're into tweaking your settings, it might be of interest - see Rob's excellent thread that talked this in more detail here:
http://blsclan.friendhood.net/t93-optimize-your-graphic-performance-in-ut-opengl-direct3d?highlight=opengl

When you run it, it'll ask which driver you want to update - the Direct3D9 option is selected by default. If you continue with this setting, it'll copy the new driver to the UT System directory, then update your UnrealTournament.ini file and set this as the renderer to use when you run the game.
If you choose the OpenGL option, the installer will rename the existing OpenGL driver (turning it into a "backup"), then copy the updated OpenGL driver to the UT System directory and update your UT ini file to set this as the renderer of choice.

If you run UT, and don't like the updated driver you've chosen, run the Uninstaller (there'll be a new Start menu shortcut called "Updated UT Drivers"), and it'll remove the new driver from the UT System directory (and in the case of the OpenGL driver, rename the "backup" copy), and restore the previous "renderer" setting in your UnrealTournament.ini file - so everything will be back as it was previously.

The installer isn't digitally signed, so if you're running Vista or Windows 7 you'll get the "Unknown Publisher" warning. You should *always* be very careful about running any new software on your machine, so if you don't feel comfortable about it, that makes sense to me - don't do it.

You can do all of this very easily, of course, by yourself - manually download the files from cwdohnal.com and so on - the installer was intended to make the process accessible for anyone who wasn't sure how to go about it.

Download link: mediafire.com ?jy2roe732979ei0


Below is the complete text for the Inno Setup script used to create the installer - to set minds at ease (or you could use the Inno Setup compiler to create your own):

=======================================
; Install updated D3D9 driver (1.3) and OpenGL driver (3.6) for Unreal Tournament 99

[Setup]
AppName=UT Direct3D9 and OpenGL updates
AppVersion=1.0
Compression=lzma2/ultra64
DefaultDirName={code:GetUTDirectory|True}
DefaultGroupName=Updated UT drivers
DirExistsWarning=no
DisableDirPage=yes
DisableProgramGroupPage=yes
InternalCompressLevel=ultra64
OutputBaseFilename=UTDriverUpdate
SolidCompression=true

[Files]
Source: "D3D9Drv.dll"; DestDir: "{app}"; Flags: onlyifdoesntexist;
Source: "D3D9Drv.int"; DestDir: "{app}"; Flags: onlyifdoesntexist;
Source: "OpenGLDrv.dll"; DestDir: "{app}";
Source: compiler:WizModernSmallImage.bmp; Flags: dontcopy

[Icons]
Name: "{group}\Remove Updated UT drivers"; Filename: "{uninstallexe}"

[Code]
const
CSIDL_PROGRAM_FILES = $0026;

scCap1 = 'Install DirectX9 renderer';
scCap2 = 'Install OpenGL renderer';
scDefaultRenderer = 'SoftDrv.SoftwareRenderDevice';
scDirecX9Renderer = 'D3D9Drv.D3D9RenderDevice';
scDriverBackup = 'DriverSettingBackup.ini';
scGames = 'Games';
scOpenGLDriver = 'OpenGLDrv.dll';
scOpenGLDriverOld = 'Old_OpenGLDrv.dll';
scOpenGLRenderer = 'OpenGLDrv.OpenGLRenderDevice';
scSystem = 'System';
scUnrealTournament = 'UnrealTournament';

var
GInstallDirectX: Boolean;
GRadBtn1, GRadBtn2: TNewRadioButton;
GSetupRanToFinish: Boolean;
GUTDirectory: String;

//-----------------------------------------------------------------------------------------------
// Silly simple implementation of the Pascal 'Inc' function - just adds 'Amount' to a passed in value
procedure Inc(var Value: Integer; const Amount: Integer);
begin
Value := Value + Amount;
end;

//-----------------------------------------------------------------------------------------------
// Get the index of SubStr in MainStr starting from a specified offset
function PosEx(const SubStr, MainStr: String; const Offset: Integer): Integer;
var
i, MStrLen, SStrLen: Integer;
TmpStr: String;
begin
Result := 0;
MStrLen := Length(MainStr);
SStrLen := Length(SubStr);

if (SubStr = '') or (MainStr = '') or (Offset <= 0) or (Offset > (MStrLen - SStrLen)) then
Exit;

if Offset = 1 then
Result := Pos(SubStr, MainStr)
else begin
i := Offset;
while i <= MStrLen do begin
if MainStr[i] = SubStr[1] then begin
TmpStr := Copy(MainStr, i, SStrLen);
if TmpStr = SubStr then begin
Result := i;
Break;
end;
end;
Inc(i, 1);
end;
end;
end;

//-----------------------------------------------------------------------------------------------
// Find last occurrence of SubStr in MainStr, and return the location of the index of the match.
// Returns 0 if no match found
function StrLast(const SubStr, MainStr: String): Integer;
var
i: Integer;
begin
Result := PosEx(SubStr, MainStr, 1);
i := Result;
while i > 0 do begin
i := PosEx(SubStr, MainStr, i + 1);
if i > 0 then
Result := i;
end;
end;

//-----------------------------------------------------------------------------------------------
// Returns True if MainStr ends with SubStr (e.g, "Testing" ends with "ing")
function StrEndsWith(const SubStr, MainStr: String): Boolean;
var
TempString: String;
begin
TempString := Copy(MainStr, Length(MainStr) - (Length(SubStr) - 1), Length(SubStr));
Result := CompareText(TempString, SubStr) = 0;
end;

//-----------------------------------------------------------------------------------------------
// Extract a value from the Registry
function GetRegistryKeyValue(const KeyValueName, AppName: String; var FoundValue: String): Boolean;
var
RootKeyName: Integer;
SubKeyName, ValueName: String;
begin
Result := False;
FoundValue := '';

RootKeyName := HKEY_LOCAL_MACHINE;
SubKeyName := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppName;
ValueName := KeyValueName;
try
Result := RegQueryStringValue(RootKeyName, SubKeyName, ValueName, FoundValue);
except
end;
end;

//-----------------------------------------------------------------------------------------------
function IsUTDirectory(const Value: String): Boolean;
begin
Result := DirExists(Value) and StrEndsWith(scSystem, Value);
end;

//-----------------------------------------------------------------------------------------------
// Try to get location of UT directory
function GetUTDirectory(const Param: String): String;
var
DefaultPath: String;
Drive: String;
GamesPath: String;
KeyValue: String;
PathEnd: Integer;
ProgFilesPath: String;
UTUserDir: String;
begin
Result := '';
if Length(GUTDirectory) > 0 then
Result := GUTDirectory
else begin
// Attempt to locate directory from Windows "Uninstall" registry key
GetRegistryKeyValue('UninstallString', scUnrealTournament, KeyValue);
if Length(KeyValue) > 0 then begin
// Note that "KeyValue" will be returned in the form: C:\Games\UnrealTournament\System\Setup.exe uninstall "UnrealTournament"
// We need to parse the path from this -> look for last "\"
PathEnd := StrLast('\', KeyValue) - 1;
Result := Copy(KeyValue, 1, PathEnd);

// Test that we've ended up with a valid folder
if IsUTDirectory(Result) then begin
GUTDirectory := Result;
Exit;
end;
end;

// FindFirstFile search for UnrealTournament directory - rather than try to enum all files from the root directory (hah!)
// just look in a couple of obvious places: 1) Default directory 2) Below "Program Files" 3) In a "games" directory
ProgFilesPath := GetShellFolderByCSIDL(CSIDL_PROGRAM_FILES, False);
// Assumption: the default directory and any "games" folder live on the same drive as the Program Files folder
if Length(ProgFilesPath) > 0 then begin
// 1) Try default directory (e.g., C:\UnrealTournament\System)
Drive := ExtractFileDrive(ProgFilesPath) + '\';
DefaultPath := Drive + scUnrealTournament + '\' + scSystem;
if IsUTDirectory(DefaultPath) then begin
GUTDirectory := DefaultPath;
Result := DefaultPath;
Exit;
end;

// 2) Try sub-directory of Program Files
ProgFilesPath := ProgFilesPath + '\' + scUnrealTournament + '\' + scSystem;
if IsUTDirectory(ProgFilesPath) then begin
GUTDirectory := ProgFilesPath;
Result := ProgFilesPath;
Exit;
end;

// 3) Try under a "games" sub-directory
GamesPath := Drive + scGames + '\' + scUnrealTournament + '\' + scSystem;
if IsUTDirectory(GamesPath) then begin
GUTDirectory := GamesPath;
Result := GamesPath;
Exit;
end;

// None of the above worked - give user option of finding it themselves
if Param = 'True' then begin
if MsgBox('Couldn''t find your Unreal Tournament System directory. Would you like to choose its location yourself?', mbConfirmation, MB_YESNO) = IDYES then begin
UTUserDir := Drive;
if BrowseForFolder('Location UT directory', UTUserDir, False) then begin
if IsUTDirectory(UTUserDir) then begin
GUTDirectory := UTUserDir;
Result := UTUserDir;
Exit;
end;
end;
end;
end;
end;
end;
end;

//-----------------------------------------------------------------------------------------------
procedure RadioButtonOnClick(Sender: TObject);
begin
if Sender = GRadBtn1 then begin
GInstallDirectX := True;
GRadBtn2.Checked := False;
end else begin
GInstallDirectX := False;
GRadBtn1.Checked := False;
end;

// Backup old OpenGL driver
if not FileExists(GUTDirectory + '\' + scOpenGLDriverOld) then begin
RenameFile(GUTDirectory + '\' + scOpenGLDriver, GUTDirectory + '\' + scOpenGLDriverOld);
DeleteFile(GUTDirectory + '\' + scOpenGLDriver);
end;

WizardForm.NextButton.Enabled := True;
end;

//-----------------------------------------------------------------------------------------------
procedure OnActivate(Sender: TWizardPage);
begin
if ((GRadBtn1 <> nil) and (GRadBtn1.Checked)) or ((GRadBtn2 <> nil) and (GRadBtn2.Checked)) then
WizardForm.NextButton.Enabled := True
else
WizardForm.NextButton.Enabled := False;
end;

//-----------------------------------------------------------------------------------------------
procedure CreateTheWizardPages;
var
Page: TWizardPage;
RadioButton1, RadioButton2: TNewRadioButton;
begin
{ TButton and others }

Page := CreateCustomPage(wpWelcome, 'Which renderer do you want to update?', 'Try "DirectX9" first; if that that doesn''t work well, try "OpenGL" next');
Page.OnActivate := @OnActivate;

RadioButton1 := TNewRadioButton.Create(Page);
RadioButton1.Width := Page.SurfaceWidth div 2;
RadioButton1.Height := ScaleY(17);
RadioButton1.Caption := scCap1;
RadioButton1.Checked := False;
RadioButton1.Parent := Page.Surface;
RadioButton1.OnClick := @RadioButtonOnClick;
GRadBtn1 := RadioButton1;

RadioButton2 := TNewRadioButton.Create(Page);
RadioButton2.Top := RadioButton1.Top + RadioButton1.Height + ScaleY(Cool;
RadioButton2.Width := Page.SurfaceWidth div 2;
RadioButton2.Height := ScaleY(17);
RadioButton2.Caption := scCap2;
RadioButton2.Checked := False;
RadioButton2.Parent := Page.Surface;
RadioButton2.OnClick := @RadioButtonOnClick;
GRadBtn2 := RadioButton2;
end;

//-----------------------------------------------------------------------------------------------
// Set global variables to default values when INSTALLING
function InitializeSetup(): Boolean;
begin
GUTDirectory := '';
Result := True;
GRadBtn1 := nil;
GRadBtn2 := nil;
GInstallDirectX := False;
GSetupRanToFinish := False;
end;

//-----------------------------------------------------------------------------------------------
// If user cancelled setup, and the old OpenGLL driver was backup, restore it
procedure DeinitializeSetup();
begin
if not GSetupRanToFinish then begin
// Restore old OpenGL driver
if FileExists(GUTDirectory + '\' + scOpenGLDriverOld) then begin
RenameFile(GUTDirectory + '\' + scOpenGLDriverOld, GUTDirectory + '\' + scOpenGLDriver);
DeleteFile(GUTDirectory + '\' + scOpenGLDriverOld);
end;
end;
end;

//-----------------------------------------------------------------------------------------------
// Create custom wizard page (choose OpenGL or DirectX)
procedure InitializeWizard();
begin
CreateTheWizardPages;
end;

//-----------------------------------------------------------------------------------------------
// Set global variables to default values when UNINSTALLING
function InitializeUninstall(): Boolean;
begin
GUTDirectory := GetUTDirectory('');
Result := True;
end;

//-----------------------------------------------------------------------------------------------
procedure CurStepChanged(CurStep: TSetupStep);
var
BackupINIPath: String;
DriverSetting: String;
UTINIPath: String;
begin
if CurStep = ssDone then begin
// Modify UnrealTournament.ini
UTINIPath := GUTDirectory + '\' + scUnrealTournament + '.ini';

// First store existing setting
BackupINIPath := GUTDirectory + '\' + scDriverBackup;
if not FileExists(BackupINIPath) then begin
DriverSetting := GetINIString('Engine.Engine', 'GameRenderDevice', scDefaultRenderer, UTINIPath);
SetIniString('Engine.Engine', 'GameRenderDevice', DriverSetting, BackupINIPath);
end;

if GInstallDirectX then
SetIniString('Engine.Engine', 'GameRenderDevice', scDirecX9Renderer, UTINIPath)
else
SetIniString('Engine.Engine', 'GameRenderDevice', scOpenGLRenderer, UTINIPath);
end;

if CurStep = ssPostInstall then
GSetupRanToFinish := True;
end;

//-----------------------------------------------------------------------------------------------
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
BackupINIPath: String;
DriverSetting: String;
UTINIPath: String;
begin
if CurUninstallStep = usDone then begin
// Modify UnrealTournament.ini
UTINIPath := GUTDirectory + '\' + scUnrealTournament + '.ini';

// Extract backup renderer
BackupINIPath := GUTDirectory + '\' + scDriverBackup;
if FileExists(BackupINIPath) then
DriverSetting := GetINIString('Engine.Engine', 'GameRenderDevice', scDefaultRenderer, BackupINIPath)
else
DriverSetting := scDefaultRenderer;

SetIniString('Engine.Engine', 'GameRenderDevice', DriverSetting, UTINIPath);

// Restore old OpenGL driver
if FileExists(GUTDirectory + '\' + scOpenGLDriverOld) then
RenameFile(GUTDirectory + '\' + scOpenGLDriverOld, GUTDirectory + '\' + scOpenGLDriver);
end;
end;
=======================================
Back to top Go down
View user profile
medor



Posts : 30
Join date : 2010-01-17

PostSubject: Re: Updating UT drivers (Direct3D and OpenGL)   Tue Apr 10, 2012 5:48 am

Nice cheers but

The opengl 35 is buggy ; there has been the problem included 35 ; The 34 and previous are OK.
I think it would be wise to switch back to 34 for this utility.

First bug opengl35 and more

opengl34


opengl 35 and after
*


Second bug with opengl35 and more

Not work with UTPure7E there is a bug for see weapond










Have you integrated setting comming with this exe ?
for edit:
UnrealTournament.ini
[WinDrv.WindowsClient]
[OpenGLDrv.OpenGLRenderDevice]
[D3DDrv.D3DRenderDevice]
Back to top Go down
View user profile
{Dark}Shadow

avatar


Posts : 1514
Join date : 2008-04-11
Location : Eternal Night
Job/hobbies : Tech and Art
Humor : Virtual Reality

UT Player Information
Current Skin: Blake Blake
PostSubject: Re: Updating UT drivers (Direct3D and OpenGL)   Wed Apr 11, 2012 9:02 am

Use this to update all drivers and install missing ones:
http://drp.su/

It's a large download, but it works automatically. It should be good for problems with video card drivers in UT.
Back to top Go down
View user profile
medor



Posts : 30
Join date : 2010-01-17

PostSubject: Re: Updating UT drivers (Direct3D and OpenGL)   Thu Apr 12, 2012 9:48 am

{Dark}Shadow wrote:
Use this to update all drivers and install missing ones:
http://drp.su/

It's a large download, but it works automatically. It should be good for problems with video card drivers in UT.

I speak render UT not this. I you have a buggy render UT your download not repairs it.
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Updating UT drivers (Direct3D and OpenGL)   

Back to top Go down
 
Updating UT drivers (Direct3D and OpenGL)
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» UPDATED BGT Drivers Guide - Post Here
» Stable drivers for Radeon with MAX
» Eight drivers two simultaneous races three laps fujimi knock out circuit
» Driver Hotswap to AI Questions
» EZT StockHatch Series 1 - Driver List / Teams / Privateers

Permissions in this forum:You cannot reply to topics in this forum
Black Luster Soldiers - BLS - Clan :: Unreal Tournament :: Problems-
Jump to: