创意设置和游戏资源管理器(GAMEUX) [英] Inno Setup and Game Explorer (GAMEUX)

查看:1067
本文介绍了创意设置和游戏资源管理器(GAMEUX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用innosetup将游戏添加到GE,我正在使用此脚本(仅代码):

I'm trying to add my game to GE with innosetup, I'm using this script (only code):

[CODE] 
type TGUID          = record Data1: Cardinal; Data2, Data3: Word; Data4: array [0..8] of Char; end; 

const PlayTask    = 0; 
        SupportTask = 1; 
var GameuxGUID: TGUID; 

function GenerateGUID(var GUID: TGUID): Cardinal; external 'GenerateGUID@files:GameuxInstallHelper.dll stdcall setuponly'; 
function AddToGameExplorer(Binary: String; Path: String; InstallType: Integer; var GUID: TGUID): Cardinal; external 'AddToGameExplorerA@files:GameuxInstallHelper.dll stdcall setuponly'; 
function CreateTask(InstallType: Integer; var GUID: TGUID; TaskType: Integer; TaskNumber: Integer; TaskName: String; Binary: String; Parameters: String): Cardinal; external 'CreateTaskA@files:GameuxInstallHelper.dll stdcall setuponly'; 
function RetrieveGUIDForApplication(Binary: String; var GUID: TGUID): Cardinal; external 'RetrieveGUIDForApplicationA@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly'; 
function RemoveFromGameExplorer(var GUID: TGUID): Cardinal; external 'RemoveFromGameExplorer@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly'; 
function RemoveTasks(var GUID: TGUID): Cardinal; external 'RemoveTasks@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly'; 

function IntToHex(Int: Cardinal; Digits: Integer): String; var i, Digit: Integer; ch: Byte; 
begin 
  result:=''; 
  for i:=0 to Digits-1 do 
    begin 
    digit:=Int mod 16; 
    Int:=Int div 16; 
    if digit<0 then 
      digit:=digit+16; 
      ch:=Ord('0')+digit; 
        if digit>9 then 
        ch:=ch+7; 
        result:=chr(ch)+result; 
    end; 
end; 

function GetGUID(GGUID: TGUID): String; var i: Integer; 
begin 
  result:='{'+IntToHex(GGUID.Data1, 8)+'-'+IntToHex(GGUID.Data2, 4)+'-'+IntToHex(GGUID.Data3, 4)+'-'+IntToHex(Ord(GGUID.Data4[0]), 2)+IntToHex(Ord(GGUID.Data4[1]), 2)+'-'; 
  for i:=2 to 7 do result:=result+IntToHex(Ord(GGUID.Data4[i]), 2); result:=result+'}'; 
end; 

procedure GDFInstall(Binary, MainExe: String); 
begin 
  GenerateGUID(GameuxGUID); 
  AddToGameExplorer(ExpandConstant(Binary), ExpandConstant('{app}'), 3, GameuxGUID); 

  CreateTask(3, GameuxGUID, PlayTask, 0, 'Play', ExpandConstant(MainExe), ''); 
end; 

**procedure win7fix;** 
  var regGDF: Cardinal; 
begin 
  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned', regGDF) then 
    if regGDF=0 then 
      if RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned') then 
        RegWriteDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned', 1); 
end; 

procedure CurStepChanged(CurStep: TSetupStep); 
  var Version: TWindowsVersion; 
begin 
  GetWindowsVersionEx(Version); 
  if (CurStep = ssPostInstall) and Version.NTPlatform and (Version.Major > 5) then begin 
    GDFInstall('{#GDFBinary}', '{#GDFExe}'); 
      win7fix;
  end;
end; 

但是"win7fix"过程不起作用. 这适用于Windows 7,因为如果我创建自己的GDF定义dll文件,则该文件没有经过签名,并且游戏资源管理器不会显示诸如Rating之类的信息. 但是,如果我手动从0到1编辑注册表项已分配",则会显示该注册表项. 如何使用inno自动为生成的guid编辑此(双字)条目?

But the "win7fix" procedure doesn't work. This for windows 7 because if I create my own GDF definition dll file it is not signed and the game explorer doesn't shows some information such as Rating. But if i edit the registry key "issigned" manually from 0 to 1 it shows. How can I do with inno to automatically edit this (dword) entry for the generated guid?

推荐答案

问题的根源是您试图在Win7x64上读取和写入32位注册表树的原因,但 GameuxInstallHelper.dll 将将游戏信息写入64位树. 我在项目中使用了您的过程代码,这里是:

The root of the problem is what you trying to read&write the 32 bit tree of registry on Win7x64 but GameuxInstallHelper.dll will write game info to the 64 bit tree. I used your procedure code in my project, here it is:

procedure win7fix;
  var regGDF: Cardinal;
  var GUXPath: string;
begin
GUXPath := 'Software\Microsoft\Windows\CurrentVersion\GameUX\Games\' + GetGUID(GameuxGUID);
  if isWin64 then
  begin
    if RegQueryDWordValue(HKLM64, GUXPath, 'IsSigned', regGDF) then
      if regGDF=0 then
        if RegDeleteValue(HKLM64, GUXPath, 'IsSigned') then 
          RegWriteDWordValue(HKLM64, GUXPath, 'IsSigned', 1);
  end
  else
  begin
    if RegQueryDWordValue(HKLM, GUXPath, 'IsSigned', regGDF) then
      if regGDF=0 then
        if RegDeleteValue(HKLM, GUXPath, 'IsSigned') then 
          RegWriteDWordValue(HKLM, GUXPath, 'IsSigned', 1);
  end;
end; 

这篇关于创意设置和游戏资源管理器(GAMEUX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆