Skip to content

Instantly share code, notes, and snippets.

@eybisi
Last active December 4, 2020 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eybisi/b9b3ba5c289f5af767b45d68d33ddf15 to your computer and use it in GitHub Desktop.
Save eybisi/b9b3ba5c289f5af767b45d68d33ddf15 to your computer and use it in GitHub Desktop.
var DEBUG = false
console.log('Starting ..')
const YourCountry = 'Americans'
const HACKS = ['Cost','BuildTime','Armor','income','speed','firepower']
function processCountry(rawCountry: NativePointer) {
const buffer = rawCountry.readByteArray(0x1A9);
if (buffer instanceof ArrayBuffer) {
const country = {
CountryName: rawCountry.add(0x98).readCString(),
Color: rawCountry.add(0xc0).readInt(),
Firepower: rawCountry.add(0xc8).readDouble(),
Groundspeed: rawCountry.add(0xd0).readDouble(),
Armor: rawCountry.add(0xd8).readDouble(),
Cost: rawCountry.add(0xf0).readDouble(),
Buildtime: rawCountry.add(0xf8).readDouble(),
armorInfantry: rawCountry.add(0x100).readFloat(),
armorUnit: rawCountry.add(0x104).readFloat(),
armorAircraft: rawCountry.add(0x108).readFloat(),
armorBuildings: rawCountry.add(0x10c).readFloat(),
armorDefense: rawCountry.add(0x110).readFloat(),
costInfantry: rawCountry.add(0x114).readFloat(),
costUnit: rawCountry.add(0x118).readFloat(),
costAircraft: rawCountry.add(0x11c).readFloat(),
costBuildings: rawCountry.add(0x120).readFloat(),
costDefense: rawCountry.add(0x124).readFloat(),
speedInfantry: rawCountry.add(0x128).readFloat(),
speedUnits: rawCountry.add(0x12c).readFloat(),
speedAircraft: rawCountry.add(0x130).readFloat(),
buildtimeInfantry: rawCountry.add(0x134).readFloat(),
buildtimeUnits: rawCountry.add(0x138).readFloat(),
buildtimeAircraft: rawCountry.add(0x13c).readFloat(),
buildtimeBuildings: rawCountry.add(0x140).readFloat(),
buildtimeDefense: rawCountry.add(0x144).readFloat(),
income: rawCountry.add(0x148).readFloat()
};
for(var h in HACKS){
console.log(`[+] ${HACKS[h]} hack is ACTIVE!`)
switch(HACKS[h]){
case 'Cost':
rawCountry.add(0xf0).writeDouble(0)
rawCountry.add(0x114).writeFloat(0)
rawCountry.add(0x118).writeFloat(0)
rawCountry.add(0x11c).writeFloat(0)
rawCountry.add(0x120).writeFloat(0)
rawCountry.add(0x124).writeFloat(0)
case 'BuildTime':
rawCountry.add(0xf8).writeDouble(0)
rawCountry.add(0x134).writeFloat(0)
rawCountry.add(0x138).writeFloat(0)
rawCountry.add(0x13c).writeFloat(0)
rawCountry.add(0x140).writeFloat(0)
rawCountry.add(0x144).writeFloat(0)
case 'Armor':
rawCountry.add(0x100).writeFloat(10)
rawCountry.add(0x104).writeFloat(10)
rawCountry.add(0x108).writeFloat(10)
rawCountry.add(0x10c).writeFloat(10)
rawCountry.add(0x110).writeFloat(10)
rawCountry.add(0xd8).writeDouble(10)
case 'income':
rawCountry.add(0x148).writeFloat(50)
case 'speed':
rawCountry.add(0x128).writeFloat(5)
rawCountry.add(0x12c).writeFloat(5)
rawCountry.add(0x130).writeFloat(5)
rawCountry.add(0xd0).writeDouble(5)
case 'firepower':
rawCountry.add(0xc8).writeDouble(10)
}
}
if(DEBUG){
console.log(JSON.stringify(country,null," "))
}
}
}
var libhead = Process.findModuleByName('game.exe')
if (libhead){
var assignCountry = libhead.base.add(0x4F9550-0x400000)
Interceptor.attach(assignCountry,{
onEnter: function(args){
let mycntx = <Ia32CpuContext>this.context
this.country_name =mycntx.ecx.add(0x24).readCString()
this.country_ptr = mycntx.ecx
// if(this.country_name == YourCountry){
// processCountry(this.country_ptr)
// }
},
onLeave: function(retval){
if(this.country_name == YourCountry){
console.log("Changing country multipliers for ",this.country_name)
processCountry(this.country_ptr)
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment