View Single Post
  #5  
Old 31-05-2017, 00:48
KaktoR's Avatar
KaktoR KaktoR is offline
Lame User
 
Join Date: Jan 2012
Location: From outer space
Posts: 4,689
Thanks: 1,106
Thanked 7,336 Times in 2,838 Posts
KaktoR is on a distinguished road
Have not tested yet, but this should work?

Code:
#define AC3Registry

...

#ifdef AC3Registry
function GetAppName(Param: string): string;
  begin
    Result:=FmtMessage(ExpandConstant('{cm:AppName}'),[chr(39)]) ;
end;

#else

function GetAppName(Default:String):String;
begin
  if not (GetIniString('Messages', 'ApplicationName', '', ExpandConstant('{tmp}\' + ActLang + '.txt')) = '') and (GetValStr('InstallOptions', 'ApplicationName' + ActLangShort, '') = '') then
    Result := GetIniString('Messages', 'ApplicationName', '', ExpandConstant('{tmp}\' + ActLang + '.txt'))
  else
    Result:=GetValStr('InstallOptions', 'ApplicationName' + ActLangShort, GetOrigAppName(''))
end;

#endif
Will test it further on weekend. But i am sure i have forgot something important.

And a question: Can i use #ifdef for this on [CustomMessages] too? If yes, it is neccessary at all?

Edit: Ok, it seems to work. I have just switched #define to ON. But as i said, will test it with registry.iss on weekend.

Edit 2: Here is the full code i am using for the fast test
Code:
#define AC3Registry
Code:
[CustomMessages]
#ifdef AC3Registry
eng.AppName=Assassin%1s Creed(R) III
#endif
Code:
#ifdef AC3Registry
function GetAppName(Param: string): string;
  begin
    Result:=FmtMessage(ExpandConstant('{cm:AppName}'),[chr(39)]) ;
end;

#else

function GetAppName(Default:String):String;
begin
  if not (GetIniString('Messages', 'ApplicationName', '', ExpandConstant('{tmp}\' + ActLang + '.txt')) = '') and (GetValStr('InstallOptions', 'ApplicationName' + ActLangShort, '') = '') then
    Result := GetIniString('Messages', 'ApplicationName', '', ExpandConstant('{tmp}\' + ActLang + '.txt'))
  else
    Result:=GetValStr('InstallOptions', 'ApplicationName' + ActLangShort, GetOrigAppName(''))
end;
#endif
Attached Images
File Type: png Unbenannt.png (27.7 KB, 114 views)
__________________
Haters gonna hate

Last edited by KaktoR; 31-05-2017 at 00:55.
Reply With Quote