 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
peter4d5 Cheater
Reputation: 0
Joined: 21 Dec 2010 Posts: 37
|
Posted: Tue Aug 16, 2016 9:47 pm Post subject: [Request]LUA get Game's version |
|
|
I use aamaker.lua and want LUA automatic get Game's version when I create ct script.
How can I do that?
_________________
my name is peter4d5 |
|
Back to top |
|
 |
Redouane Master Cheater
Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Wed Aug 17, 2016 5:49 am Post subject: Re: [Request]LUA get Game's version |
|
|
peter4d5 wrote: | I use aamaker.lua and want LUA automatic get Game's version when I create ct script.
How can I do that? |
The version number is probably displayed in the main menu, the about screen or somewhere in the game, you could try to find it as a string (maybe a float), find out what accesses its address to find where it reads the version to display it, then you can read it from there, if the game gets an update, the function that displays the version number will probably stay the same, so AOB Scanning might be a solution.
OR:
If the version number is displayed on the website of the game authors, you could use the new Internet Lua features in CE (or Lua socket) to read data from the web page where the version number is displayed, then extract that part using the Lua string processing features, this solution will always require an internet connection, also, it might not always work because the authors website might be down at certain times (for maintenance for example).
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25707 Location: The netherlands
|
Posted: Wed Aug 17, 2016 6:05 am Post subject: |
|
|
one easy way to distinguish versions:
Code: |
md5memory(process,8192)
|
if it's not the same result as the one you worked on, the version is different
hint: You 'could' write a database with MD5's of games, and always have an matching cheat table for whatever game you attach (excluding emulators and browsers obviously)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
peter4d5 Cheater
Reputation: 0
Joined: 21 Dec 2010 Posts: 37
|
Posted: Sat Aug 20, 2016 11:54 pm Post subject: |
|
|
Sorry, It's my fault.
What I want is file version that you can find by right click at Exe and see 'property-->detail-->file version'
and sometime it's not same as in-game version(no problem).I just want to add reference to ct script.
Result that I want when I create ct script is
Quote: |
{ Game : BatmanAK.exe
File version : //------------------ here
Date : 08-18-16
Author : peter4d5
This script does blah blah blah
Make by aamaker Lua plugin
}
|
Here is Delphi's example and I test it ok.
(I think LUA should have short and clean method more than delphi)
File version of Batman - Arkham Knight
Quote: |
---------------------------
Fileversion
---------------------------
1.0.4.5
---------------------------
OK
---------------------------
|
Delphi source
Code: |
var
Form1: TForm1;
type
TBytes = array of byte;
implementation
{$R *.dfm}
function GetAppVersionStr: string;
var
Exe: string;
Size, Handle: DWORD;
Buffer: TBytes;
FixedPtr: PVSFixedFileInfo;
begin
//Exe := ParamStr(0);
Exe := 'C:\Batman - Arkham Knight\Binaries\Win64\BatmanAK.exe';
Size := GetFileVersionInfoSize(PChar(Exe), Handle);
if Size = 0 then
RaiseLastOSError;
SetLength(Buffer, Size);
if not GetFileVersionInfo(PChar(Exe), Handle, Size, Buffer) then
RaiseLastOSError;
if not VerQueryValue(Buffer, '\', Pointer(FixedPtr), Size) then
RaiseLastOSError;
Result := Format('%d.%d.%d.%d',
[LongRec(FixedPtr.dwFileVersionMS).Hi, //major
LongRec(FixedPtr.dwFileVersionMS).Lo, //minor
LongRec(FixedPtr.dwFileVersionLS).Hi, //release
LongRec(FixedPtr.dwFileVersionLS).Lo]) //build
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetAppVersionStr);
end;
end.
|
Problem is that it read from Exe not process, you can find exe's path from process
but not me(with LUA), now I can little modify lua but far away from coding.
Anyone please transfer to lua,I will be appreciate and it will be useful for everyone that use ct script.
_________________
my name is peter4d5 |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25707 Location: The netherlands
|
Posted: Sun Aug 21, 2016 12:09 am Post subject: |
|
|
enumModules()[1].PathToFile will return the path to the currently opened process
but there is currently no easy way to get the file version out of it
edit: next version has getFileVersion which returns the version info from a file
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|