Skip to content

Commit

Permalink
add support for legion 7.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
karliky committed Apr 21, 2020
1 parent f848990 commit 01c6a55
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 42 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
### Features per version:

| Version | Spectate | Cinematic | Environment |
|---------|----------|-----------|-------------|
| 0.5.3 | ✔️ | ✔️ | ⚙️ |
| 0.8.0 | ✔️ | ✔️ | ⚙️ |
| 1.8.0 | ✔️ | ✔️ | ⚙️ |
| 1.12.0 | ✔️ | ✔️ | ⚙️ |
| 2.4.3 | ✔️ | ✔️ | ⚙️ |
| 3.3.5a | ✔️ | ✔️ | ⚙️ |
| 4.3.4 | ✔️ | ✔️ | ⚙️ |
| 6.2.3 | ✔️ | ✔️ | ⚙️ |
| 7.3.5 | ✔️ | ⚙️ | ⚙️ |
|---------|----------|-----------|------------- |
| 0.5.3 | ✔️ | ✔️ | ⚙️ |
| 0.8.0 | ✔️ | ✔️ | ⚙️ |
| 1.8.0 | ✔️ | ✔️ | ⚙️ |
| 1.12.0 | ✔️ | ✔️ | ⚙️ |
| 2.4.3 | ✔️ | ✔️ | ⚙️ |
| 3.3.5a | ✔️ | ✔️ | ⚙️ |
| 4.3.4 | ✔️ | ✔️ | ⚙️ |
| 6.2.3 | ✔️ | ✔️ | ⚙️ |
| 7.2.5(24742) | ✔️ | ✔️ | ⚙️ |
| 7.3.5(26972) | ✔️ | ⚙️ | ⚙️ |

⚙️ Means that the development of that feature it's not finished yet for that version.

Expand Down
56 changes: 38 additions & 18 deletions src/core/domain/getCameraPtr.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,45 @@ function GetCameraPtr(Game, memory, Module, offsets) {
SpectatePointer: null,
CameraValuesPointer: null,
};
} else if (offsets[Game.client].base) {
const viewMatrixFixPtr = offsets[Game.client].cameraViewMatrix.version[Game.build].pattern;
const ViewMatrixInstructionsPointer = memory.find(viewMatrixFixPtr.toString('hex'), 0, -1, 1, '-x')[0];
const SpectatePointerFinder = offsets[Game.client].base.version[Game.build].SpectatePointer;
const SpectatePointer = Array.isArray(SpectatePointerFinder) ? memory.readMultiLevelPtr(SpectatePointerFinder) : SpectatePointerFinder;
const Pointer = memory.readMultiLevelPtr(offsets[Game.client].base.version[Game.build].CameraPointer);
const CameraValuesPointer = Module + offsets[Game.client].base.version[Game.build].CameraValuesPointer;

console.log('# Camera SpectatePointer found at', `0x${SpectatePointer.toString(16)}
- Camera spectate values at: 0x${CameraValuesPointer.toString(16)}
- Camera values at: 0x${Pointer.toString(16)}
- ViewMatrixInstructionsPointer: 0x${ViewMatrixInstructionsPointer.toString(16)}`);
return {
Pointer,
InstructionPointer: null,
ViewMatrixInstructionsPointer,

SpectatePointer,
CameraValuesPointer,
};
} else {
const SpectatePointerFinder = offsets[Game.client].SpectatePointer;
const SpectatePointer = Array.isArray(SpectatePointerFinder) ? memory.readMultiLevelPtr(SpectatePointerFinder) : SpectatePointerFinder;
const Pointer = memory.readMultiLevelPtr(offsets[Game.client].CameraPointer, true);
const CameraValuesPointer = offsets[Game.client].CameraValuesPointer;

console.log('# Camera SpectatePointer found at', `0x${SpectatePointer.toString(16)}
- Camera spectate values at: 0x${CameraValuesPointer.toString(16)}
- Camera values at: 0x${Pointer.toString(16)}
- ViewMatrixInstructionsPointer: 0x${ViewMatrixInstructionsPointer.toString(16)}`);
return {
Pointer,
InstructionPointer: null,
ViewMatrixInstructionsPointer,

SpectatePointer,
CameraValuesPointer,
};
}

const SpectatePointerFinder = offsets[Game.client].SpectatePointer;
const SpectatePointer = Array.isArray(SpectatePointerFinder) ? memory.readMultiLevelPtr(SpectatePointerFinder) : SpectatePointerFinder;
const Pointer = memory.readMultiLevelPtr(offsets[Game.client].CameraPointer, true);
const CameraValuesPointer = offsets[Game.client].CameraValuesPointer;

console.log('# Camera SpectatePointer found at', `0x${SpectatePointer.toString(16)}
- Camera spectate values at: 0x${CameraValuesPointer.toString(16)}
- Camera values at: 0x${Pointer.toString(16)}
- ViewMatrixInstructionsPointer: 0x${ViewMatrixInstructionsPointer.toString(16)}`);
return {
Pointer,
InstructionPointer: null,
ViewMatrixInstructionsPointer,

SpectatePointer,
CameraValuesPointer,
};
};
}

Expand Down
8 changes: 8 additions & 0 deletions src/core/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ function initialize(cb) {
memory.resolvePtrBySetOfInstruction = resolvePtrBySetOfInstruction;
memory.findPattern = findPattern;
memory.findStrPattern = findStrPattern;

global.robot = {
process,
Memory,
module,
window,
};

return true;
}

Expand Down
32 changes: 19 additions & 13 deletions src/core/logic/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const getVersion = (Memory) => {
if (buildFound === '12340') return { client: 'wlk', build: '3.3.5a' };
if (buildFound === '15595') return { client: 'ctl', build: '4.3.4' };
if (buildFound === '20779') return { client: 'draenor', build: '6.2.3' };
if (buildFound === '24742') return { client: 'legion', build: '7.2.5' };
if (buildFound === '26972') return { client: 'legion', build: '7.3.5' };
};

Expand Down Expand Up @@ -171,29 +172,34 @@ export const draenor = {
};

export const legion = {
SpectatePointer: [0x01226DA0, 0x4, 0x28, 0x8, 0x384],
CameraPointer: [0x01FDF9A4, 0x0324C, 0],
EnableSpectate: new Buffer([0x00, 0x00, 0x48, 0x00]),
DisableSpectate: new Buffer([0, 0, 0, 0]),
CameraValuesPointer: 0x01FF57C8,
Collision: 0x90,
Speed: 0x84,
base: {
version: {
['7.2.5']: {
SpectatePointer: [0x00EE6A74, 0x4, 0x28, 0x8, 0x380],
CameraPointer: [0xFBDE0C, 0x324c, 0],
CameraValuesPointer: 0xFD7BC8,
},
['7.3.5']: {
SpectatePointer: [0x01226DA0, 0x4, 0x28, 0x8, 0x384],
CameraPointer: [0x01BFF9A4, 0x0324C, 0],
CameraValuesPointer: 0x01FF57C8,
}
}
},
cameraViewMatrix: {
version: {
['7.2.5']: {
pattern: new Buffer([0xE8, 0xC2, 0xA7, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0xF3, 0xA5]),
fix: new Buffer([0xE8, 0xC2, 0xA7, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0x90, 0x90])
},
['7.3.5']: {
pattern: new Buffer([0xE8, 0x6D, 0xA7, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0xF3, 0xA5]),
fix: new Buffer([0xE8, 0x6D, 0xA7, 0xFF, 0xFF, 0x6A, 0x09, 0x59, 0x8B, 0xF0, 0x90, 0x90])
}
}
}
};


// Possible spectate pattern for 7.3.5
// ?? 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 08 00 08 00 00 00 00 00 00 01 00


// Spectate speed
// 00 00 00 00 00 00 40 41 DB 0F C9 3F DB 0F C9 3F
// 00 00 A0 41 01 01 00 00 00 00 00 00 00 00 C8 42
// 00 00 C8 42 00 00 00 00 0A D7 23 3D 0A D7 23 3D
1 change: 0 additions & 1 deletion src/core/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const createSetCollision = require('./domain/setCollision');
const createSetSpeed = require('./domain/setSpeed');

module.exports = (process, Module, Memory, window, Offsets) => {

const Game = Offsets.getVersion(Memory);
if (!Game) {
throw new Error('Unsupported game version :|');
Expand Down

0 comments on commit 01c6a55

Please sign in to comment.