Skip to content

Commit

Permalink
add support for render flags
Browse files Browse the repository at this point in the history
  • Loading branch information
karliky committed May 8, 2020
1 parent 2603da6 commit eff0fe0
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 107 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bugcraft-studio",
"version": "1.0.1-beta",
"version": "1.0.2-beta",
"author": "karliky <[email protected]>",
"description": "In-game cinematics for World of Warcraft",
"license": "Unlicense",
Expand Down
7 changes: 6 additions & 1 deletion src/core/domain/environment/getEnvPtr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ function GetEnvPtr(Game, memory, Module, offsets) {
const timeOfDay = Module + offsets[Game.client].environment.version[Game.build].timeOfDay;
const timeOfDaySpeed = Module + offsets[Game.client].environment.version[Game.build].timeOfDaySpeed;
const timeOfDayPattern = offsets[Game.client].environment.version[Game.build].timeOfDayPattern;
const renderFlags = Module + offsets[Game.client].environment.version[Game.build].renderFlags;
const renderFlagsDefault = offsets[Game.client].environment.version[Game.build].renderFlagsDefault;
const enableTimeOfDay = timeOfDayPattern ? memory.find(timeOfDayPattern.toString('hex'), 0, -1, 1, '-x')[0] : 0;

console.log(`# Time of day at: 0x${timeOfDay.toString(16)}`);
if (timeOfDaySpeed) console.log(`# Time of day speed at: 0x${timeOfDaySpeed.toString(16)}`)
if (timeOfDaySpeed) console.log(`# Time of day speed at: 0x${timeOfDaySpeed.toString(16)}`);
if (renderFlags) console.log(`# Render flags located at: 0x${renderFlags.toString(16)}`);

return {
timeOfDay,
timeOfDaySpeed,
enableTimeOfDay,
renderFlags,
renderFlagsDefault,
};
};
}
Expand Down
11 changes: 11 additions & 0 deletions src/core/domain/environment/getRenderFlags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function GetRenderFlags(Memory) {
const GetRenderFlagsBuffer = new Buffer(1);
return (environmentStruct, index) => {
const renderFlagsPtr = environmentStruct.renderFlags;
if (!renderFlagsPtr) return;
Memory.readData(renderFlagsPtr + index, GetRenderFlagsBuffer, GetRenderFlagsBuffer.byteLength);
return GetRenderFlagsBuffer.readUInt8();
};
}

module.exports = GetRenderFlags;
13 changes: 13 additions & 0 deletions src/core/domain/environment/resetRenderFlags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function resetRenderFlags(Memory) {
const SetRenderFlagsBuffer = new Buffer(4);
return (environmentStruct) => {
const renderFlagsPtr = environmentStruct.renderFlags;
const renderFlagsDefault = environmentStruct.renderFlagsDefault;
if (!renderFlagsPtr) return;
SetRenderFlagsBuffer.writeUInt32LE(renderFlagsDefault);
console.log('# SetRenderFlagsBuffer', SetRenderFlagsBuffer.toString('hex'));
Memory.writeData(renderFlagsPtr, SetRenderFlagsBuffer, SetRenderFlagsBuffer.byteLength);
};
}

module.exports = resetRenderFlags;
15 changes: 15 additions & 0 deletions src/core/domain/environment/setCustomRenderFlags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable no-bitwise */
function SetRenderFlags(Memory) {
const SetRenderFlagsBuffer = new Buffer(4);
return (environmentStruct, renderFlags) => {
const renderFlagsPtr = environmentStruct.renderFlags;
if (!renderFlagsPtr) return;
SetRenderFlagsBuffer.writeUInt8(renderFlags[0], 0);
SetRenderFlagsBuffer.writeUInt8(renderFlags[1], 1);
SetRenderFlagsBuffer.writeUInt8(renderFlags[2], 2);
SetRenderFlagsBuffer.writeUInt8(renderFlags[3], 3);
Memory.writeData(renderFlagsPtr, SetRenderFlagsBuffer, SetRenderFlagsBuffer.byteLength);
};
}

module.exports = SetRenderFlags;
18 changes: 18 additions & 0 deletions src/core/domain/environment/setRenderFlags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable no-bitwise */
function SetRenderFlags(Memory, GetRenderFlags) {
const SetRenderFlagsBuffer = new Buffer(1);
let value;
return (environmentStruct, index, isNegative = false) => {
const renderIndex = Number(index);
const renderFlagsPtr = environmentStruct.renderFlags;
if (!renderFlagsPtr) return;
const renderFlags = GetRenderFlags(environmentStruct, renderIndex);
if (!isNegative) value = renderFlags + 1;
if (isNegative) value = renderFlags - 1;
if (value > 255 || value < 0) return;
SetRenderFlagsBuffer.writeUInt8(value);
Memory.writeData(renderFlagsPtr + index, SetRenderFlagsBuffer, SetRenderFlagsBuffer.byteLength);
};
}

module.exports = SetRenderFlags;
17 changes: 17 additions & 0 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,20 @@ window.launch = launchCore;
// Start of block terrain? 00 F0 E2 23 00 60 E1 05

// Time of day alpha vanilla E8 ?? ?? ?? 00 D9 ?? 04

// rendering control 4.3.4
// 55 8B EC A1 AC41E900 23 05 A841E900 A9 00000008 74 14 8B 0D 7CF4ED00 8B 11 8B 82 C4000000 6A 00 6A 08 FF D0 D9 45 0C 51 8B 4D 08 D9 1C 24 51 E8 07630000 8B 15 AC41E900 23 15 A841E900 83 C4 08 F7 C2 00000008 74 14 8B 0D 7CF4ED00 8B 01 8B 90 C4000000 6A 01 6A 08 FF D2 5D
// Default value 0001BFFF
// next to default 1.890624881

// whole row FF BF 01 00 FF FF F1 3F FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00
// near 00 C0 35 44 00 C0 35 44
// 40 00 00 00 00 C0 35 44 00 C0 35 44

// 3.3.5a and 2.4.3 patterns for rendering 0F84 ?? ?? ?? ?? F7 05 ?? ?? ?? ?? 00002000
// CTL and above 55 8B EC A1 ???????? 23 05 ???????? A9 00000008
// CTL and above FF BF 01 00 FF FF F1 7F FF FF FF FF
// CTL and above, this one works 00 00 C8 46 00 00 00 00
// Legion working 55 8B EC 83 7D 0C 00 8B 45 08 74 08 09 05 ????????
// 0.5.3 .port -1315 -1216 60.0582 0
// rendering 0.5.3 top lighting 80 99 90 07
40 changes: 32 additions & 8 deletions src/core/logic/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ export const alpha = {
['0.5.3']: {
timeOfDayPattern: new Buffer([0xE8, 0x04, 0x0C, 0x14, 0x00, 0xD9, 0x5F, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0x04, 0x0C, 0x14, 0x00, 0xD9, 0x1F, 0x90]),
timeOfDay: 0xCB23B4
timeOfDay: 0xCB23B4,
renderFlags: 0xA4046C,
renderFlagsDefault: 0x07104B73
},
['0.8.0']: {
timeOfDayPattern: new Buffer([0xE8, 0x43, 0xE5, 0x17, 0x00, 0xD9, 0x5E, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0x43, 0xE5, 0x17, 0x00, 0xD9, 0x1E, 0x90]),
timeOfDay: 0xC00AD4
timeOfDay: 0xC00AD4,
renderFlags: 0xA96C30,
renderFlagsDefault: 0x1F900B77
}
}
},
Expand Down Expand Up @@ -232,17 +236,23 @@ export const vanilla = {
['1.1.2']: {
timeOfDayPattern: new Buffer([0xE8, 0x4F, 0xCD, 0x1A, 0x00, 0xD9, 0x5F, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0x4F, 0xCD, 0x1A, 0x00, 0xD9, 0x1F, 0x90]),
timeOfDay: 0x70EB04
timeOfDay: 0x70EB04,
renderFlags: 0x69FE7C,
renderFlagsDefault: 0x1F110F77
},
['1.8.0']: {
timeOfDayPattern: new Buffer([0xE8, 0xFE, 0x0C, 0x1A, 0x00, 0xD9, 0x5E, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0xFE, 0x0C, 0x1A, 0x00, 0xD9, 0x1E, 0x90]),
timeOfDay: 0x85AD1C
timeOfDay: 0x85AD1C,
renderFlags: 0x7EC93C,
renderFlagsDefault: 0x9F110F77
},
['1.12.0']: {
timeOfDayPattern: new Buffer([0xE8, 0x8E, 0x0E, 0x1C, 0x00, 0xD9, 0x5E, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0x8E, 0x0E, 0x1C, 0x00, 0xD9, 0x1E, 0x90]),
timeOfDay: 0x8E9B64
timeOfDay: 0x8E9B64,
renderFlags: 0x87B2A4,
renderFlagsDefault: 0x9F910F77
},
}
},
Expand Down Expand Up @@ -270,7 +280,9 @@ export const tbc = {
['2.4.3']: {
timeOfDayPattern: new Buffer([0xE8, 0xFF, 0x44, 0x19, 0x00, 0xD9, 0x5E, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0xFF, 0x44, 0x19, 0x00, 0xD9, 0x1E, 0x90]),
timeOfDay: 0xA18DEC
timeOfDay: 0xA18DEC,
renderFlags: 0x9A4510,
renderFlagsDefault: 0x1F104F73
}
}
},
Expand Down Expand Up @@ -298,7 +310,9 @@ export const wlk = {
['3.3.5a']: {
timeOfDayPattern: new Buffer([0xE8, 0x4F, 0x4A, 0x27, 0x00, 0xD9, 0x5E, 0x04]),
timeOfDayPatternFix: new Buffer([0xE8, 0x4F, 0x4A, 0x27, 0x00, 0xD9, 0x1E, 0x90]),
timeOfDay: 0x938B04
timeOfDay: 0x938B04,
renderFlags: 0x8D774C,
renderFlagsDefault: 0x1F104F73
}
}
},
Expand Down Expand Up @@ -329,7 +343,9 @@ export const ctl = {
['4.3.4']: {
timeOfDayPattern: new Buffer([0xA3, 0xE4, 0x23, 0xEA, 0x00, 0xF3, 0x0F, 0x11, 0x05, 0xE8, 0x23, 0xEA, 0x00]),
timeOfDayPatternFix: new Buffer([0xA3, 0xE4, 0x23, 0xEA, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90]),
timeOfDay: 0xA423E8
timeOfDay: 0xA423E8,
renderFlags: 0xA741A8,
renderFlagsDefault: 0x0001BFFF
}
}
},
Expand Down Expand Up @@ -357,6 +373,8 @@ export const mop = {
['5.4.8']: {
timeOfDay: 0xC8DF14,
timeOfDaySpeed: 0xC8DF00,
renderFlags: 0xE371D4,
renderFlagsDefault: 0x0001BFFF
}
}
},
Expand Down Expand Up @@ -384,6 +402,8 @@ export const draenor = {
['6.2.3']: {
timeOfDay: 0xD7D614,
timeOfDaySpeed: 0xD7D600,
renderFlags: 0xF8422C,
renderFlagsDefault: 0x00011FFF
}
}
},
Expand Down Expand Up @@ -426,10 +446,14 @@ export const legion = {
['7.2.5']: {
timeOfDay: 0xE116C4,
timeOfDaySpeed: 0xE116B0,
renderFlags: 0x102FF3C,
renderFlagsDefault: 0x7FF7FFFF
},
['7.3.5']: {
timeOfDay: 0,
timeOfDaySpeed: 0,
renderFlags: 0x1252CC0,
renderFlagsDefault: 0x7FF7FFFF
}
}
},
Expand Down
13 changes: 13 additions & 0 deletions src/core/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const createGetEnvPtr = require('./domain/environment/getEnvPtr');
const createEnableTimeOfDayUpdate = require('./domain/environment/enableTimeOfDay');
const createDisableTimeOfDayUpdate = require('./domain/environment/disableTimeOfDay');
const createGetNormalizedTimeOfDay = require('./domain/environment/getNormalizedTimeOfDay');
const createSetRenderFlags = require('./domain/environment/setRenderFlags');
const createGetRenderFlags = require('./domain/environment/getRenderFlags');
const createSetCustomRenderFlags = require('./domain/environment/setCustomRenderFlags');
const createResetRenderFlags = require('./domain/environment/resetRenderFlags');

const createSetTimeOfday = require('./domain/environment/setTimeOfday');
const createSetNormalizedTimeOfDay = require('./domain/environment/setNormalizedTimeOfDay');
const createEnableSpectate = require('./domain/enableSpectate');
Expand Down Expand Up @@ -65,12 +70,20 @@ module.exports = (process, Module, Memory, window, Offsets) => {
const setTimeOfday = createSetTimeOfday(Memory, GetNormalizedTimeOfDay);
const setNormalizedTimeOfDay = createSetNormalizedTimeOfDay(Memory);
const environmentStruct = createGetEnvPtr(Game, Memory, Module, Offsets)();
const GetRenderFlags = createGetRenderFlags(Memory);
const SetRenderFlags = createSetRenderFlags(Memory, GetRenderFlags);
const SetCustomRenderFlags = createSetCustomRenderFlags(Memory);
const ResetRenderFlags = createResetRenderFlags(Memory);
const environment = {
setTimeOfday: (timeOfDay) => setTimeOfday(environmentStruct, timeOfDay),
setNormalizedTimeOfDay: (timeOfDay) => setNormalizedTimeOfDay(environmentStruct, timeOfDay),
GetNormalizedTimeOfDay,
enableTimeOfDay: () => EnableTimeOfDay(environmentStruct),
disableTimeOfDay: () => DisableTimeOfDay(environmentStruct),
SetRenderFlags: (index, isNegative) => SetRenderFlags(environmentStruct, index, isNegative),
SetCustomRenderFlags: (renderFlags) => SetCustomRenderFlags(environmentStruct, renderFlags),
GetRenderFlags: (index) => GetRenderFlags(environmentStruct, index),
ResetRenderFlags: () => ResetRenderFlags(environmentStruct),
};
return {
Game,
Expand Down
1 change: 1 addition & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function createWindow() {
width: 1280,
minWidth: 750,
height: 370,
backgroundColor: "#161b26",
frame: false,
title: 'BugCraft Studio',
bottom: 0,
Expand Down
23 changes: 18 additions & 5 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
};
</script>

<style>
/* CSS */
</style>

<style lang="scss">
html {
overflow-y: auto;
Expand Down Expand Up @@ -191,6 +187,23 @@
color: #e8e8ea;
}
/**
* Button
*/
.button {
border: none;
background: #10141c;
color: #e8e8ea;
font-size: 14px;
border: 1px solid #1e2433;
width: initial;
}
.button:hover, .button:active, .button:focus {
color: #e8e8ea;
border: 1px solid #1e2433;
}
/**
* Input range
*/
Expand All @@ -209,7 +222,7 @@
background: #ff1a3b;
}
input[type=range]::-webkit-slider-thumb {
border: 1px solid #1e2433;
border: 2px solid #1e2433;
height: 22px;
width: 22px;
border-radius: 50%;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
};
</script>

<style>
<style scoped>
.error {
margin: 0;
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/keyboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
configurable: null,
},
onComplete: () => {
if (shouldLoop) return playCinematic(cinematicSteps, speed, commit, shouldLoop, Camera);
if (shouldLoop) return playCinematic(cinematicSteps, speed, store, shouldLoop);
commit('setMode', 'SPECTATE');
tween = null;
},
Expand Down Expand Up @@ -146,5 +146,5 @@
};
</script>

<style>
<style scoped>
</style>
2 changes: 1 addition & 1 deletion src/renderer/components/sections/cinematicBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
};
</script>

<style>
<style scoped>
.cinematic_builder {
user-select: none;
}
Expand Down
Loading

0 comments on commit eff0fe0

Please sign in to comment.