<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: изменение скорости процесса игры]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5999&amp;type=atom" />
	<updated>2011-07-13T08:04:35Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5999</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: изменение скорости процесса игры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=49827#p49827" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Александр_ пишет:</cite><blockquote><div class="quotebox"><cite>winstan пишет:</cite><blockquote><p>может кто понимает что тут написано я на Delphi ещё не разу не пробовал работать</p></blockquote></div><p>Это не весь исходник. Сначала там идёт инжект другой dll, в зависимости от разрядности системы, потом перехват функций GetTickCount, timeGetTime и QueryPerformanceCounter. Заканчивается листинг функцией установки коэффициента ускорения.<br />Я бы на вашем месте не стал ковырять этот код, а просто переписал бы его на хорошо знакомом языке программирования. Для перехвата функций microsoft предлагает готовую библиотеку <a href="http://research.microsoft.com/en-us/projects/detours/">Detours</a>.</p></blockquote></div><p>в общемто хочется чтобы всё делать обной программной.</p><p>Сейчас в нужные моменты я ускаряю игру через скрип (он узнает по некоторым усолвиям когда над ускорить процес) и СЕ в которую по горячим клавишам посылаеются команды от скрипта</p>]]></content>
			<author>
				<name><![CDATA[winstan]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26953</uri>
			</author>
			<updated>2011-07-13T08:04:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=49827#p49827</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: изменение скорости процесса игры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=49826#p49826" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>winstan пишет:</cite><blockquote><p>может кто понимает что тут написано я на Delphi ещё не разу не пробовал работать</p></blockquote></div><p>Это не весь исходник. Сначала там идёт инжект другой dll, в зависимости от разрядности системы, потом перехват функций GetTickCount, timeGetTime и QueryPerformanceCounter. Заканчивается листинг функцией установки коэффициента ускорения.<br />Я бы на вашем месте не стал ковырять этот код, а просто переписал бы его на хорошо знакомом языке программирования. Для перехвата функций microsoft предлагает готовую библиотеку <a href="http://research.microsoft.com/en-us/projects/detours/">Detours</a>.</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-07-12T19:07:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=49826#p49826</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: изменение скорости процесса игры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=49825#p49825" />
			<content type="html"><![CDATA[<p>на сайте СЕ в исходниках нашёл это , вроде как это должно отвечать за спид хак в связки с DLL</p><div class="codebox"><pre><code>unit speedhack2;

{$MODE Delphi}

interface

uses Classes,LCLIntf, SysUtils, NewKernelHandler,CEFuncProc, symbolhandler,
     autoassembler, dialogs,Clipbrd;

type TSpeedhack=class
  private
    processid: dword;
    initaddress: ptrUint;
  public
    procedure setSpeed(speed: single);
    constructor create;
    destructor destroy; override;
  end;

var speedhack: TSpeedhack;

implementation

uses frmAutoInjectUnit;

constructor TSpeedhack.create;
var i: integer;
    script: tstringlist;
    AllocArray: TCEAllocArray;
    x,y: dword;
    a,b: ptrUint;
begin
  initaddress:=0;


  try
    if processhandler.is64bit then
      injectdll(CheatEngineDir+&#039;speedhack-x86_64.dll&#039;,&#039;&#039;)
    else
      injectdll(CheatEngineDir+&#039;speedhack-i386.dll&#039;,&#039;&#039;);
    symhandler.reinitialize;
    symhandler.waitforsymbolsloaded;
  except
    raise exception.Create(&#039;Failure enabling speedhack. (DLL injection failed)&#039;);
  end;

       
  script:=tstringlist.Create;
  try
    script.Add(&#039;alloc(init,512)&#039;);
    //check if it already has a a speedhack script running

    a:=symhandler.getAddressFromName(&#039;realgettickcount&#039;) ;
    b:=0;
    readprocessmemory(processhandle,pointer(a),@b,processhandler.pointersize,x);
    if b&lt;&gt;0 then //already configured
      generateAPIHookScript(script, &#039;GetTickCount&#039;, &#039;speedhackversion_GetTickCount&#039;)
    else
      generateAPIHookScript(script, &#039;GetTickCount&#039;, &#039;speedhackversion_GetTickCount&#039;, &#039;realgettickcount&#039;);



    try
      setlength(AllocArray,0);

      autoassemble(script,false,true,false,false,AllocArray);

      //fill in the address for the init region
      for i:=0 to length(AllocArray)-1 do
        if AllocArray[i].varname=&#039;init&#039; then
        begin
          initaddress:=AllocArray[i].address;
          break;
        end;


    except
      raise exception.Create(&#039;Failure configuring speedhack part 1&#039;);
    end;


    //timegettime
    script.Clear;
    script.Add(&#039;timeGetTime:&#039;);
    script.Add(&#039;jmp speedhackversion_GetTickCount&#039;);
    try
      autoassemble(script,false);
    except //don&#039;t mind
    end;


    script.clear;
    a:=symhandler.getAddressFromName(&#039;realQueryPerformanceCounter&#039;) ;
    b:=0;
    readprocessmemory(processhandle,pointer(a),@b,processhandler.pointersize,x);
    if b&lt;&gt;0 then //already configured
      generateAPIHookScript(script, &#039;QueryPerformanceCounter&#039;, &#039;speedhackversion_QueryPerformanceCounter&#039;)
    else
      generateAPIHookScript(script, &#039;QueryPerformanceCounter&#039;, &#039;speedhackversion_QueryPerformanceCounter&#039;, &#039;realQueryPerformanceCounter&#039;);

    try
      autoassemble(script,false);
    except //do mind
      raise exception.Create(&#039;Failure configuring speedhack part 2&#039;);
    end;

  finally
    script.free;
  end;

  setspeed(1);
  processid:=cefuncproc.processid;
end;

destructor TSpeedhack.destroy;
var script: tstringlist;
    i: integer;
    x: dword;
begin
  if processid=cefuncproc.ProcessID then
  begin

    try
      setSpeed(1);
    except
    end;
  end;

  //do not undo the speedhack script (not all games handle a counter that goes back)
 
end;

procedure TSpeedhack.setSpeed(speed: single);
var x: single;
    script: Tstringlist;

begin
  x:=speed;
  script:=tstringlist.Create;
  try
    script.add(&#039;CreateThread(&#039;+inttohex(initaddress,8)+&#039;)&#039;);
    script.add(&#039;label(newspeed)&#039;);
    script.add(inttohex(initaddress,8)+&#039;:&#039;);
    if processhandler.is64Bit then
    begin
      script.add(&#039;sub rsp,#32&#039;);
      script.add(&#039;movss xmm0,[newspeed]&#039;);
      script.add(&#039;push rcx&#039;);
    end
    else
      script.add(&#039;push [newspeed]&#039;);

    script.add(&#039;call InitializeSpeedhack&#039;);

    if processhandler.is64Bit then
      script.add(&#039;add rsp,#40&#039;);

    script.add(&#039;ret&#039;);

    script.add(&#039;newspeed:&#039;);
    script.add(&#039;dd &#039;+inttohex(pdword(@x)^,8));

    try

//      showmessage(script.Text);
      Clipboard.AsText:=script.text;
      autoassemble(script,false);
    except
      raise exception.Create(&#039;Failure setting speed&#039;);
    end;
  finally
    script.free;
  end;

end;


end.</code></pre></div><p>может кто понимает что тут написано я на Delphi ещё не разу не пробовал работать<br />(dll-библиотеки чучуть попоже залью)</p><p><a href="http://gopnik.nextmail.ru/speedhack-dll.rar">gopnik.nextmail.ru/speedhack-dll.rar</a></p>]]></content>
			<author>
				<name><![CDATA[winstan]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26953</uri>
			</author>
			<updated>2011-07-12T18:44:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=49825#p49825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: изменение скорости процесса игры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=49824#p49824" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>winstan пишет:</cite><blockquote><p>В общем, все знают что в CE есть функця &quot;speed hack&quot;</p></blockquote></div><p>Я не знал.<br /></p><div class="quotebox"><cite>winstan пишет:</cite><blockquote><p>хотелосьбы узнать как можно аналогично данной функции изменить скорость процесса игры.</p></blockquote></div><p>Интервал между фреймами в играх под Windows обычно замеряют функцией timeGetTime. Поэтому нужно перехватывать эту функцию и править возвращаемое значение. Это задача не для AHK, без dll тут придётся много ассемблерного кода написать.</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-07-12T18:17:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=49824#p49824</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: изменение скорости процесса игры]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=49823#p49823" />
			<content type="html"><![CDATA[<p>В общем, все знают что в CE есть функця &quot;speed hack&quot; хотелосьбы узнать как можно аналогично данной функции изменить скорость процесса игры.<br />Чем проще примерчик тем лучше:)</p>]]></content>
			<author>
				<name><![CDATA[winstan]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26953</uri>
			</author>
			<updated>2011-07-12T17:08:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=49823#p49823</id>
		</entry>
</feed>
