Jump to content

Code for installer auto detect WoT installation path


Go to solution Solved by Aslain,

Recommended Posts

Posted

Hello Aslain, 

 

I'm curious about the Aslain mod setup. How to make it auto detect WoT installation path in user's PC?

 

I'm developing a setup to install WoT mods. Currently I'm using Inno Setup 6.2.2.

 

My installer works fine, but for now it cannot auto detect WoT installation path.

User have to manually select the installation path to their WoT folder (during their first time installation), which may cause problems. 

 

I summarized the code for the installation path as below. If you need more details, I can send to you the complete source code.

 

Quote

   

#define GameID            "{5F05CE9B-7768-490E-9A71-C6R92B4EX123}"  


[Setup]
AppId={{#GameID}
AppName={#MyAppName}
 

//====={ Default installation Dir Name that will appear before Browse }=====\\
DefaultDirName={code:MyDirName}
DefaultGroupName={#MyAppName}
AppendDefaultDirName=no
;not add new folder after browse


[Code]
function MyDirName(S:String): String;
var
  InsPath: String;
  er: boolean;
  myFile:String;
begin
  Result:=ExpandConstant('C:\Games\World_of_Tanks\'); //Nyan: Default dir name before Browse
  er := RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5F05CE9B-7768-490E-9A71-C6R92B4EX123}_is1', 'InstallLocation', InsPath);
  if er and (InsPath<>'') then //Nyan: Browsing direction
  begin
    Result := InsPath;
  end;
end;
 

 

Thanks a lot for your support! I'm a WoT modder since 2014 (mostly sound mods) but I haven't tried your mods until yesterday and it was a wow to me after using yours.

 

 

  • Administrator
  • Solution
Posted

Hi,
I'm using this:  https://gitlab.com/openwg/openwg.utils it's also used in the installer from the XVM Team. You can look how they coded it in Inno Setup here: https://gitlab.com/xvm/xvm.installer

 

I recognize your name, I've seen it often on asian forums, probably related to anime mods or GuP. I even have some mods (anime music) from you in my modpack.

 

I'm glad that you like my work 🙂

Posted

Thanks Aslain, after some investigation I made it 😀

 

I put the summarized code here in case someone else need it. Could be helpful if someone already designed the code different from original XVM and only need some functions, like me.

 

Quote

//Download Release code of openwg.utils from Git and extract to setup workspace folder


#include "innosetup\openwg.utils.iss"

//In this file, make sure DLL paths are correct.

 

//====={ Default installation Dir Name that will appear before Browse }=====\\
DefaultDirName={code:MyDirName}
DefaultGroupName={#MyAppName}
AppendDefaultDirName=no
;not add new folder after browse

[Code]
function MyDirName(S:String): String;
var
  InsPath: String;
  er: integer;
  myFile:String;
begin
  Result:=ExpandConstant('C:\Games\World_of_Tanks\'); //Nyan: Default dir name before Browse
  myFile := WOT_GetClientPathW(er);
  if myFile<>'' then //Nyan: Browsing direction
  begin
    Result := myFile;
  end;
end;

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.