PDA

View Full Version : Inno Setup - check GPU DirectX version?


Smurf Stomper
29-11-2013, 18:00
I would like to add a check to my scripts that will determine if the currently installed GPU is DX 11 capable - which would then allow additional parameters in the script to be executed. For example, my current Far Cry 3 script has the following line:

[Icons]
Name: {userdesktop}\Far Cry 3; Filename: {app}\bin\FarCry3.exe; Parameters: -offline; WorkingDir: {app}\bin

I would change it to something like this:

[Icons]
Name: {userdesktop}\Far Cry 3; Filename: {app}\bin\FarCry3.exe; Parameters: -offline; WorkingDir: {app}\bin
Name: {userdesktop}\Far Cry 3; Filename: {app}\bin\FarCry3_D3D11.exe; Parameters: -offline; WorkingDir: {app}\bin

Adding the second line creates the option for a shortcut to the DX11-specific exe to be shortcutted on the desktop. What I need help with is setting some parameter in the two lines that only causes the appropriate one to be executed as the setup installs, based on the system's directX gpu capability.

For example, when a setup has x64 specific files, I can designate the following check (using my Rage script as an example):

[Icons]
Name: {userdesktop}\Rage; Filename: {app}\Rage.exe; WorkingDir: {app}\; Tasks: desktopshortcut; Check: not isWin64
Name: {userdesktop}\Rage (64-bit); Filename: {app}\Rage64.exe; WorkingDir: {app}\; Tasks: desktopshortcut; Check: isWin64

the "isWin64" check is built in to inno setup, so I don't have to put a specific function in the CODE section. Unfortunately, no GPU directX check is built in that I'm aware of.

Anyone have a custom 'check' function already coded up that they'll share?

Razor12911
29-11-2013, 23:01
Link (http://fileforums.com/showthread.php?t=93899&page=5)

pakrat2k2
30-11-2013, 06:52
post #65 ( get sysinfo exe ) & post 72 ( xml code ) are the posts you need to look at specifically. ( For Razor's link )

altef_4
30-11-2013, 10:13
here link (http://fileforums.com/showpost.php?p=426631&postcount=95)
link ver.2 (http://fileforums.com/showpost.php?p=426644&postcount=97)

Smurf Stomper
01-12-2013, 12:30
altef, you the man. Thanks!!!!!

Smurf Stomper
08-12-2013, 08:37
Altef, one question: I'm using the code from your 'link ver. 2' in your post, and noticed how your listed out all the different directX versions (except for 11.1) that are out so far.

If a new version of directX is released in the future, say v12.0, and future gpus are at that version, will this code still work? It seems the code looks at specific directX versions, not doing a general GPU ability check, like this pseudocode idea:

function: check GPU directX version
if check result <11.0, then shortcut to farcry3.exe
else shortcut to farcry3_d3d11.exe

Obviously this is just my idea - I like the idea of having a check after each line in the [icons] section - I'm just giving you an idea in case the code you graciously wrote up won't work for future directX versions.

Let me know.. thanks for your help!

altef_4
09-12-2013, 07:23
Altef, one question: I'm using the code from your 'link ver. 2' in your post, and noticed how your listed out all the different directX versions (except for 11.1) that are out so far.

If a new version of directX is released in the future, say v12.0, and future gpus are at that version, will this code still work? It seems the code looks at specific directX versions, not doing a general GPU ability check, like this pseudocode idea:



Obviously this is just my idea - I like the idea of having a check after each line in the [icons] section - I'm just giving you an idea in case the code you graciously wrote up won't work for future directX versions.

Let me know.. thanks for your help!

this code will work, all what you need it's add new check like this

function DX12:boolean;
begin
Case GetDXV of
'9': Result:=False;
'9.0c': Result:=False;
'10': Result:=False;
'10.1': Result:=False;
'11': Result:=False;
'11.1': Result:=False;
'11.2': Result:=False;
'12': Result:=True;
else
Result:=False;
end;
end;

Fahimft2014
05-10-2014, 06:10
Hey,the exec2 function is not working for me.I have done everything to solve this but in vain.No files are executing and no error is occured.Please someone help me to solve this problem.