Community site

GameSpector Home and Downloads

New GameSpector patching guide (GSL)

GameSpector guides, patching FAQs, tool downloads

New GameSpector patching guide (GSL)

Postby dexplorer » Mon Aug 13, 2012 11:27 pm

Here is a quick and dirty guide to get you started with GameSpector patches.


1. You must understand the purpose and format of the classes.dex file.
2. You must know how to use baksmali and apktool.
3. Read this: GameSpector GSL specification

For the purpose of this guide, we will only look at the primary GameSpector patching mechanism, FileReplaceHex(), which is essentially an automated hex editor - it changes value of a byte (or sequence of bytes) at a specified file offset.

For example, a patch action FileReplaceHex("1234:55:66") changes the value of a byte in a file at offset 1234 from 55 to 66 (all values are hexadecimal). Byteswap can also do complex replacements, for example: "1234:22??44??6677:11??22334455", which changes byte sequence at offset 1234 from "22??44??6677" to "11??22334455". The ?? here stands for "don't care" or "leave as is".

Typical steps for patching an application:

1. Decompile the application using baksmali or apktool (for a custom version of baksmali.jar that prints dex file offsets head over to the GameSpector website ).
2. Find an instruction to change and replace as needed. Collect instruction address (which is an offset in classes.dex file) and instruction's old and new bytes. Let's suppose that changing the value at address 1234 in classes.dex from 55 to 66 provides unlimited money.

3.Create GameSpector patch:

Code: Select all
Patch {
  target_package: ""
  target_version: 1102
  title         : "Unlimited money"
  author        : "The Hacker"
  revision      : 1

  Apply {

  Remove {

Explanation for patch fields:
target_package is target package name
target_version identifies package versions supported by the patch (package version is a number from AndroidManifest.xml, available via GetInfo context menu in GameSpector). Ranges of versions are also suported, see GSL specification.
author is just a string that credits patch creator
revision is an incremental number that is used to detect newer patches (GameSpector will overwrite existing patches with newer ones when it updates patches)
title is a short description for the patch
Apply{} This block defines a set of actions that will run sequentially when applying a patch
Remove{} This block defines a set of actions that will run sequentially when removing a patch. The RestoreFiles() action will revert changes in all files that were previously changed.

Path actions and features that can be user within patch files are described in the
GameSpector GSL patch format

4. Save the patch into mygamepatch.gsl file and place the file into GameSpector directory on the primary external storage (GameSpector creates this directory if it does not exist).
5. Open GameSpector and update patches, it should find your patch. You can now delete mygamepatch.gsl from the directory
6. Test your patch, and if it works, share it (patches are lightly moderated to filter out junk submissions, so it may take a few hours before your shared patch is available to other GameSpector users).

That is it!
Posts: 35
Joined: Sun Aug 12, 2012 4:02 pm

Return to Documentation, FAQ, and Downloads

Who is online

Users browsing this forum: No registered users and 1 guest