memoryReadStringPtr Limit Length and Unicode?
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
memoryReadStringPtr Limit Length and Unicode?
Is it possible to add two new arguments to memoryReadStringPtr ? I would like to read only a limited length of letters and to activate/deativate Unicode support for that Adress.
Because I wanted to read the text of a pointer without unicode and only a length of 50 chars, but instead im getting a different output of a Players Name instead the Name of a mob. In CE it shows correctly.
Because I wanted to read the text of a pointer without unicode and only a length of 50 chars, but instead im getting a different output of a Players Name instead the Name of a mob. In CE it shows correctly.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: memoryReadStringPtr Limit Length and Unicode?
So the problem arises when reading Unicode? Then, it would seem, that is because Unicode checks for 2 (typically) NULL bytes consecutively and may include single NULL bytes, where ASCII checks for a single NULL byte to terminate the string. I will try to add a Unicode-friendly version. Lua's stance on Unicode is sort of iffy, so the Unicode support will probably only be really available within MicroMacro, while the Lua-side strings are actually ASCII. This is no big problem, though, as you'd still be able to use it just fine except for certain weird characters which you'd need to substitute for 2 (or more) characters.
EDIT: I've added two new functions: memoryReadUString and memoryReadUStringPtr. These are exactly like their ASCII counterparts, only they allow the reading of Unicode strings. In my tests, these functions appear to be working. Please download the attachment and test the functions further and report back. If everything goes according to plan, I'll add the documentation on them, and they'll become officially part of MicroMacro.
EDIT: I've added two new functions: memoryReadUString and memoryReadUStringPtr. These are exactly like their ASCII counterparts, only they allow the reading of Unicode strings. In my tests, these functions appear to be working. Please download the attachment and test the functions further and report back. If everything goes according to plan, I'll add the documentation on them, and they'll become officially part of MicroMacro.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: memoryReadStringPtr Limit Length and Unicode?
elverion wrote:So the problem arises when reading Unicode? Then, it would seem, that is because Unicode checks for 2 (typically) NULL bytes consecutively and may include single NULL bytes, where ASCII checks for a single NULL byte to terminate the string. I will try to add a Unicode-friendly version. Lua's stance on Unicode is sort of iffy, so the Unicode support will probably only be really available within MicroMacro, while the Lua-side strings are actually ASCII. This is no big problem, though, as you'd still be able to use it just fine except for certain weird characters which you'd need to substitute for 2 (or more) characters.
EDIT: I've added two new functions: memoryReadUString and memoryReadUStringPtr. These are exactly like their ASCII counterparts, only they allow the reading of Unicode strings. In my tests, these functions appear to be working. Please download the attachment and test the functions further and report back. If everything goes according to plan, I'll add the documentation on them, and they'll become officially part of MicroMacro.
Code: Select all
BaseAdress = 0x1058BAE4;
PlayerHPoff = 0xF9498;
PlayerLeveloff = 0x10563A08;
TargetHoveroff = 0xF9260;
TargetNameoff = 0xF91D8;
TargetLeveloff = 0xF9200;
-----
attach( findWindow("LastChaos - Gamigo*") );
proc = openProcess( findProcess("LastChaos - Gamigo*") );
PlayerHP = memoryReadShortPtr(proc, BaseAdress, PlayerHPoff);
PlayerLevel = memoryReadByte(proc, PlayerLeveloff);
TargetHover = memoryReadBytePtr(proc, BaseAdress, TargetHoveroff);
TargetLevel = memoryReadBytePtr(proc, BaseAdress, TargetLeveloff);
TargetName = memoryReadStringPtr(proc, BaseAdress, TargetNameoff);
printf("Character is Level [%d] - HP [%d] | Enemy: [%s] is Level [%d]. \n",PlayerLevel,PlayerHP,TargetName,TargetLevel);
to mislocate the adress always and im not sure why, atleast it displays something else with even a different lenght. Is that the evil doing of the game?
Also i'd like to request a function from autoit
PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )
; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
It will search for a colour in a rectangle and outputs it into the arrays. Kinda complex.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: memoryReadStringPtr Limit Length and Unicode?
That seems to be the desired action to me. memoryReadStringPtr is for ASCII only, and memoryReadUStringPtr is for Unicode. Or are you trying to say that memoryReadUStringPtr is not reading the correct data?Your function works well, if I use the Unicode method I can see the correct letters compared in cheatengine, however memoryReadStringPtr seems
to mislocate the adress always and im not sure why, atleast it displays something else with even a different lenght. Is that the evil doing of the game?
I'll add in some helper functions (getR, getG, getB), and then this can be done in Lua with ease. Thanks for all the suggestions.Also i'd like to request a function from autoit
PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )
; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
It will search for a colour in a rectangle and outputs it into the arrays. Kinda complex.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Indeed, however my Pointer isn't Unicode. I was merely suggesting it, but what bothers me is this fact;elverion wrote:That seems to be the desired action to me. memoryReadStringPtr is for ASCII only, and memoryReadUStringPtr is for Unicode. Or are you trying to say that memoryReadUStringPtr is not reading the correct data?Your function works well, if I use the Unicode method I can see the correct letters compared in cheatengine, however memoryReadStringPtr seems
to mislocate the adress always and im not sure why, atleast it displays something else with even a different lenght. Is that the evil doing of the game?
I'll add in some helper functions (getR, getG, getB), and then this can be done in Lua with ease. Thanks for all the suggestions.Also i'd like to request a function from autoit
PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )
; Find a pure red pixel in the range 0,0-20,300
$coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
If Not @error Then
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
EndIf
It will search for a colour in a rectangle and outputs it into the arrays. Kinda complex.
If I compare the output of memoryReadUStringPtr to my Adress that I converted to unicode, then the output will be the same for some reason.
But if I try to compare it with memoryReadStringPtr to the original state of the adress (Which is Ascii), it will show something else.
I can assure you that it is correct, ASCII shows me something like " Young Fox".
Maybe the game is playing some mind tricks on me, suprisly it shows correct in CheatEngine. But I will try this now on some Roguelike.
Thanks for your efforts
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Ok, this is getting confusing. You're trying to read the target's name (ie. Young Fox). This works for Unicode, but not for regular C-strings? So, if you use memoryReadStringPtr on that address, you're getting a space (or some other non-visible character) in front of the name? Or maybe I'm misunderstanding you completely.If I compare the output of memoryReadUStringPtr to my Adress that I converted to unicode, then the output will be the same for some reason.
But if I try to compare it with memoryReadStringPtr to the original state of the adress (Which is Ascii), it will show something else.
I can assure you that it is correct, ASCII shows me something like " Young Fox".
If I understood correctly, this is possible. Sometimes in games, they might pre-pend a name with some character, and later replace that character with a graphic. Or, even, this character could represent a color. Well, anyways, there's a quick way around it. Just take the address (or offset, in this case) + 1.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Okay to be more exact, it is NOT unicode. In unicode it shows me some shit like Tn. In CheatEngine I can convert the value to Unicode and it also shows Tn. Howeverelverion wrote:Ok, this is getting confusing. You're trying to read the target's name (ie. Young Fox). This works for Unicode, but not for regular C-strings? So, if you use memoryReadStringPtr on that address, you're getting a space (or some other non-visible character) in front of the name? Or maybe I'm misunderstanding you completely.If I compare the output of memoryReadUStringPtr to my Adress that I converted to unicode, then the output will be the same for some reason.
But if I try to compare it with memoryReadStringPtr to the original state of the adress (Which is Ascii), it will show something else.
I can assure you that it is correct, ASCII shows me something like " Young Fox".
If I understood correctly, this is possible. Sometimes in games, they might pre-pend a name with some character, and later replace that character with a graphic. Or, even, this character could represent a color. Well, anyways, there's a quick way around it. Just take the address (or offset, in this case) + 1.
on ASCII it shows me Young Fox (Three spaces infront of it indicate it is an enemy, Im not sure if this is revelant). Also it has space for 244 Letters.
Thats to clear up the whole Unicode thing.
If I try to read it normally in MicroMacro without Unicode support, it will show also nonsense like TlMn4 etc with some ASCII Symbols.
However that Text wont change in MicroMacro even if I click at another Monster. In CheatEngine it shows correctly the ASCII letters.
But nvm that, im going to try it tomorrow if It's really only the problem of the game.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Ah, alright. This could very well be a bug in MicroMacro. However, it is strange to me that the Unicode version appears to work (although, not giving you what you need), since I just copy/pasted the ASCII version and modified it to create the Unicode version. I'm downloading Last Chaos now to further debug the issue.
Update:
Ok! I've found the bug! It turns out that memoryReadStringPtr() was not taking pointer offset into account. That is, the given offset was not being used, and only the string increment offset was. This has been corrected, but not uploaded yet.
pixelSearch() has been added, but needs speed improvements. It has been implemented in C++ because the Lua route was too slow to be useful. The functions colorMatch(), getR(), getG(), and getB() will remain, as well (colorMatch() is now in the lib, the remaining three are implemented in C++).
Optional length limiters have been added to memoryReadString(), memoryReadUString(), memoryReadStringPtr(), and memoryReadUStringPtr().
A final note: your pointer is not static. I was unable to find a proper static pointer myself, however, 0x067845FF + 0x05 worked for the duration of my testing.
Update:
Ok! I've found the bug! It turns out that memoryReadStringPtr() was not taking pointer offset into account. That is, the given offset was not being used, and only the string increment offset was. This has been corrected, but not uploaded yet.
pixelSearch() has been added, but needs speed improvements. It has been implemented in C++ because the Lua route was too slow to be useful. The functions colorMatch(), getR(), getG(), and getB() will remain, as well (colorMatch() is now in the lib, the remaining three are implemented in C++).
Optional length limiters have been added to memoryReadString(), memoryReadUString(), memoryReadStringPtr(), and memoryReadUStringPtr().
A final note: your pointer is not static. I was unable to find a proper static pointer myself, however, 0x067845FF + 0x05 worked for the duration of my testing.
- 3cmSailorfuku
- Posts: 354
- Joined: Mon Jan 21, 2008 6:25 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Oh, I was about to say it was the problem of Cheat Engine thanks for clearing this up.elverion wrote:Ah, alright. This could very well be a bug in MicroMacro. However, it is strange to me that the Unicode version appears to work (although, not giving you what you need), since I just copy/pasted the ASCII version and modified it to create the Unicode version. I'm downloading Last Chaos now to further debug the issue.
Update:
Ok! I've found the bug! It turns out that memoryReadStringPtr() was not taking pointer offset into account. That is, the given offset was not being used, and only the string increment offset was. This has been corrected, but not uploaded yet.
pixelSearch() has been added, but needs speed improvements. It has been implemented in C++ because the Lua route was too slow to be useful. The functions colorMatch(), getR(), getG(), and getB() will remain, as well (colorMatch() is now in the lib, the remaining three are implemented in C++).
A final note: your pointer is not static. I was unable to find a proper static pointer myself, however, 0x067845FF + 0x05 worked for the duration of my testing.
Also perhaps you have gotten the English version of Last Chaos since I've used the German version to find them, and the german version is very easy to work with a Memoryeditor. It even offers Imports and Exports for the game functions . But those pointers are static, a friend inplented them into an AutoIt Script and it worked for everyone so far. Might be wrong though, but I'm sure it a lvl1 pointer.
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: memoryReadStringPtr Limit Length and Unicode?
Ah, OK. That would make sense. I've made all the changed (for now), and have uploaded the new version of MicroMacro. You can download it from the download page to take advantage of the new/fixed functions. Check the manual that comes with it for documentation if it's not available in the wiki by the time you download it.
Re: memoryReadStringPtr Limit Length and Unicode?
I came onto the forums and was just about to ask for memoryReadString() with Unicode support, looks like you have already created it.
Who is online
Users browsing this forum: No registered users and 1 guest