Jump to content
  • 0

How to change strings fast


Ivan88870

Question

2 answers to this question

Recommended Posts

"Edit selected" interface feature edits only selected values of results list (or saved list). Your search results only include space for first 4 characters of a string in utf-16le encoding to be used in place of "coin", that's why only first 4 characters are edited. To be able to as well edit 6 bytes (for 3 characters in utf-16le encoding) that directly follow "coin", they need to be present in search results list. And values of those 6 bytes most likely aren't constant, so search modes like "h" or "Q" can't be used to reliably find them in all cases. Luckily, there is other search mode that can be used to find 6 bytes, that directly follow "coin", regardless of their values - group search with ranges (relevant examples are present in documentation for searchNumber GG API function).

So there is a need to create group search to find sequences of bytes that match the following pattern: 

04 00 00 00 63 00 6f 00 69 00 6e 00 ?? ?? ?? ?? ?? ??

where "??" means any possible value of byte, from 0x0 to 0xFF.

Group searches, apart from list of values, have the following parameters:
  - group search type (unordered or ordered);
  - group size in bytes;
  - default data type of values.

For this case group search needs to:
  - be ordered;
  - have group size equal to amount of bytes in searched sequence (18);
  - have default data type set to "Byte" (or to specify type of each value in list of values as "B" in which case default type doesn't matter).

After figuring out parameters of desired group search, search string for the group search should be constructed according to the format (that is described in GG help: https://gameguardian.net/help/help.html#help_group_search_).

To use hexadecimal values of bytes for convenience, "h" suffix needs to be appended to them. To specify any value, as mentioned in GG help about group search, "0~~0" can be used.

Search string to find desired sequence of bytes can then be next: 

04h;00h;00h;00h;63h;00h;6fh;00h;69h;00h;6eh;00h;0~~0;0~~0;0~~0;0~~0;0~~0;0~~0::18

After entering this search string in GG search window and choosing "Byte" type, it should look like the following: 

image.thumb.png.f5b0714811cc69f2a9cd1dcea2edb630.png

When search with above parameters completes, results list will be populated with values that match the pattern mentioned above. The only thing left is to edit found sequences of bytes.

String to edit group(s) of results follows the format of list of values in group search string: value1;value2;...;valueN.

After applying desired edits to list of values from search string:
  - first byte is changed from "04h" to "07h";
  - 5-th to 18-th bytes are changed to bytes that encode "diamond" in utf-16le encoding;
the string becomes: 

07h;00h;00h;00h;64h;00h;69h;00h;61h;00h;6dh;00h;6fh;00h;6eh;00h;64h;00h

It can then be used in "Value:" field of "Edit selected" feature to edit all found sequences of bytes in search results.

Lastly, if it is desired, this method of searching and editing particular sequences of bytes can be automated with a simple script: 

gg.clearResults() -- ensures that new search will be started
gg.searchNumber("04h;00h;00h;00h;63h;00h;6fh;00h;69h;00h;6eh;00h;0~~0;0~~0;0~~0;0~~0;0~~0;0~~0::18", gg.TYPE_BYTE)
gg.getResults(gg.getResultsCount()) -- loads all found results
gg.editAll("07h;00h;00h;00h;64h;00h;69h;00h;61h;00h;6dh;00h;6fh;00h;6eh;00h;64h;00h", gg.TYPE_BYTE)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.