Skip to content

Commit e52c90f

Browse files
authored
Merge branch 'main' into feature/clean-c-api
2 parents 745ca7d + cbe0646 commit e52c90f

File tree

119 files changed

+10386
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10386
-240
lines changed

IntelPresentMon/AppCef/Batch/post-build.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ xcopy /SY "Web\presets" "%~2Presets\"
1919
echo Copy block list...
2020
xcopy /SY "Web\BlockLists" "%~2BlockLists\"
2121

22-
if "%4"=="uiAccessOn" (
22+
if "%4"=="--enable-test-sign" (
2323
echo "Sign executable..."
2424
SignTool sign /a /v /s PrivateCertStore /n "Test Certificate - For Internal Use Only" /t http://timestamp.comodoca.com/authenticode /fd sha1 "%~2%~3"
2525
)

IntelPresentMon/AppCef/CefNano.vcxproj

+4-5
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@
162162
<EmbedManifest>true</EmbedManifest>
163163
</PropertyGroup>
164164
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-EDSS|x64'">
165-
<IntDir>..\..\build\obj\$(ProjectName)-$(Platform)-$(Configuration)\</IntDir>
166-
<OutDir>..\..\build\$(Configuration)\</OutDir>
165+
<IntDir>..\..\build\obj\$(ProjectName)-$(Platform)-Release\</IntDir>
166+
<OutDir>..\..\build\Release\</OutDir>
167167
<TargetName>PresentMon</TargetName>
168168
<LinkIncremental>false</LinkIncremental>
169169
<GenerateManifest>true</GenerateManifest>
@@ -226,7 +226,7 @@
226226
</Link>
227227
<PostBuildEvent>
228228
<Message>Executing Post Build</Message>
229-
<Command>Batch\post-build.bat "$(Configuration)" "$(OutDir)" "$(TargetFileName)" uiAccessOn</Command>
229+
<Command>Batch\post-build.bat "$(Configuration)" "$(OutDir)" "$(TargetFileName)" --enable-test-sign</Command>
230230
</PostBuildEvent>
231231
<Manifest>
232232
<AdditionalManifestFiles>compatibility.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
@@ -259,8 +259,7 @@
259259
<PostBuildEvent>
260260
<Message>
261261
</Message>
262-
<Command>
263-
</Command>
262+
<Command>Batch\post-build.bat "Release" "$(OutDir)" "$(TargetFileName)"</Command>
264263
</PostBuildEvent>
265264
<Manifest>
266265
<AdditionalManifestFiles>compatibility.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>

IntelPresentMon/AppCef/Web/src/App.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
</v-list-item-content>
4949
</v-list-item>
5050

51+
<v-list-item color="primary" :to="{name: 'flash-config'}">
52+
<v-list-item-content>
53+
<v-list-item-title>Flash Injection</v-list-item-title>
54+
</v-list-item-content>
55+
</v-list-item>
56+
5157
<v-list-item color="primary" :to="{name: 'other-config'}">
5258
<v-list-item-content>
5359
<v-list-item-title>Other</v-list-item-title>
@@ -264,7 +270,7 @@ export default Vue.extend({
264270
return Loadout.widgets;
265271
},
266272
inSettings(): boolean {
267-
return ['capture-config', 'overlay-config', 'metric-processing', 'other-config']
273+
return ['capture-config', 'overlay-config', 'metric-processing', 'other-config', 'flash-config']
268274
.includes(this.$route.name ?? '');
269275
},
270276
fatalErrorTitle(): string {

IntelPresentMon/AppCef/Web/src/core/preferences.ts

+36-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ export interface Preferences {
5252
readonly axisSize: 10.0;
5353
};
5454
adapterId:number|null;
55+
enableFlashInjection:boolean;
56+
flashInjectionSize:number;
57+
flashInjectionColor:RgbaColor;
58+
flashInjectionBackgroundEnable:boolean;
59+
flashInjectionBackgroundColor:RgbaColor;
60+
flashInjectionRightShift:number;
5561
};
5662

5763
export function makeDefaultPreferences(): Preferences {
@@ -103,12 +109,28 @@ export function makeDefaultPreferences(): Preferences {
103109
enableAutotargetting: true,
104110
upscaleFactor: 2,
105111
adapterId: null,
112+
enableFlashInjection: false,
113+
flashInjectionSize: 0.25,
114+
flashInjectionColor: {
115+
r: 255,
116+
g: 255,
117+
b: 255,
118+
a: 255,
119+
},
120+
flashInjectionBackgroundEnable: false,
121+
flashInjectionBackgroundColor: {
122+
r: 0,
123+
g: 0,
124+
b: 0,
125+
a: 255,
126+
},
127+
flashInjectionRightShift: 0.5,
106128
};
107129
}
108130

109131
export const signature: Signature = {
110132
code: "p2c-cap-pref",
111-
version: "0.18.0",
133+
version: "0.19.0",
112134
};
113135

114136
export interface PreferenceFile {
@@ -152,6 +174,19 @@ const migrations: Migration[] = [
152174
prefs.metricsOffset = def.metricsOffset;
153175
}
154176
},
177+
{
178+
version: '0.19.0',
179+
migrate: (prefs: Preferences) => {
180+
console.info('Migrating preferences to 0.19.0 (flash injection)');
181+
const def = makeDefaultPreferences();
182+
prefs.enableFlashInjection = def.enableFlashInjection;
183+
prefs.flashInjectionSize = def.flashInjectionSize;
184+
prefs.flashInjectionColor = def.flashInjectionColor;
185+
prefs.flashInjectionBackgroundEnable = def.flashInjectionBackgroundEnable;
186+
prefs.flashInjectionBackgroundColor = def.flashInjectionBackgroundColor;
187+
prefs.flashInjectionRightShift = def.flashInjectionRightShift;
188+
}
189+
},
155190
];
156191

157192
migrations.sort((a, b) => compareVersions(a.version, b.version));

IntelPresentMon/AppCef/Web/src/router/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import LoadoutConfigView from '@/views/LoadoutConfigView.vue'
1010
import SimpleView from '@/views/SimpleView.vue'
1111
import CaptureConfigView from '@/views/CaptureConfigView.vue'
1212
import OtherConfigView from '@/views/OtherConfigView.vue'
13+
import FlashInjectorView from '@/views/FlashInjectorConfigView.vue'
1314

1415
Vue.use(VueRouter);
1516

@@ -60,6 +61,11 @@ const routes: RouteConfig[] = [
6061
name: 'other-config',
6162
component: OtherConfigView,
6263
},
64+
{
65+
path: '/flash',
66+
name: 'flash-config',
67+
component: FlashInjectorView,
68+
},
6369
];
6470

6571
const router = new VueRouter({
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<!-- Copyright (C) 2022 Intel Corporation -->
2+
<!-- SPDX-License-Identifier: MIT -->
3+
4+
<template>
5+
<div class="page-wrap">
6+
7+
<h2 class="mt-5 ml-5 link-head">
8+
Flash Injection <span style="color:red">*Experimental*</span>
9+
</h2>
10+
11+
<v-card class="page-card">
12+
13+
<v-row class="mt-8">
14+
<v-col cols="3">
15+
Enable Flash Injection
16+
<p class="text--secondary text-sm-caption mb-0">Enable the injector child process.</p>
17+
</v-col>
18+
<v-col cols="9">
19+
<v-row>
20+
<v-col cols="6">
21+
<v-switch v-model="enableFlashInjection" label="Enable"></v-switch>
22+
</v-col>
23+
</v-row>
24+
</v-col>
25+
</v-row>
26+
27+
<v-row class="mt-8">
28+
<v-col cols="3">
29+
Enable Background
30+
<p class="text--secondary text-sm-caption mb-0">Renders a static rectangle every frame. When a click occurs the "flash" rectangle is rendered on top of the background.</p>
31+
</v-col>
32+
<v-col cols="9">
33+
<v-row>
34+
<v-col cols="6">
35+
<v-switch v-model="flashInjectionBackgroundEnable" label="Enable"></v-switch>
36+
</v-col>
37+
</v-row>
38+
</v-col>
39+
</v-row>
40+
41+
<v-row class="mt-8">
42+
<v-col cols="3">
43+
Colors
44+
<p class="text--secondary text-sm-caption mb-0">Colors of various elements of the graph</p>
45+
</v-col>
46+
<v-col cols="9">
47+
<v-row dense>
48+
<v-col cols="6">
49+
<color-picker v-model="flashInjectionColor" class="color-picker" label="Flash"></color-picker>
50+
</v-col>
51+
<v-col cols="6">
52+
<color-picker v-model="flashInjectionBackgroundColor" class="color-picker" label="Background"></color-picker>
53+
</v-col>
54+
</v-row>
55+
</v-col>
56+
</v-row>
57+
58+
<v-row class="mt-8">
59+
<v-col cols="3">
60+
Flash Width
61+
<p class="text--secondary text-sm-caption mb-0">Width of the flash rectangle and background</p>
62+
</v-col>
63+
<v-col cols="9">
64+
<v-slider
65+
v-model="flashInjectionSize"
66+
:min="0.01"
67+
:max="1"
68+
:step="0.01"
69+
thumb-label="always"
70+
></v-slider>
71+
</v-col>
72+
</v-row>
73+
74+
<v-row class="mt-8">
75+
<v-col cols="3">
76+
Flash Offset
77+
<p class="text--secondary text-sm-caption mb-0">How far to offset the flash rectangle from the left of the screen</p>
78+
</v-col>
79+
<v-col cols="9">
80+
<v-slider
81+
v-model="flashInjectionRightShift"
82+
:min="0"
83+
:max="1"
84+
:step="0.01"
85+
thumb-label="always"
86+
></v-slider>
87+
</v-col>
88+
</v-row>
89+
90+
<v-row class="mt-4">
91+
<v-col>
92+
<h3>Notes</h3>
93+
<p class="text--secondary text-sm-caption mb-1">The flash injector injects code into a target process, causing it to draw a rectangle on top of its normal output whenever it detects a mouse click.</p>
94+
<p class="text--secondary text-sm-caption mb-1">It can be used to measure latency between a click input and a corresponding visual response of the target app.</p>
95+
<p class="text--secondary text-sm-caption mb-1">To perform injection, target an app with the overlay and then restart the app. Any changes to the above settings will similarly only take effect after the target app has been restarted.</p>
96+
<p class="orange--text text-sm-caption mb-1">Using this feature with certain titles (in particular, competitive online games protected by anticheat services) may result in a permanent ban.</p>
97+
</v-col>
98+
</v-row>
99+
100+
</v-card>
101+
102+
</div>
103+
</template>
104+
105+
<script lang="ts">
106+
import Vue from 'vue'
107+
import { Preferences } from '@/store/preferences'
108+
import { Hotkey } from '@/store/hotkey'
109+
import { RgbaColor } from '@/core/color'
110+
import ColorPicker from '@/components/ColorPicker.vue'
111+
112+
export default Vue.extend({
113+
name: 'FlashInjectorConfig',
114+
115+
components: {
116+
ColorPicker,
117+
},
118+
data: () => ({
119+
dialog: false,
120+
}),
121+
methods: {
122+
async reset(): Promise<void> {
123+
Preferences.resetPreferences();
124+
await Hotkey.bindDefaults();
125+
this.dialog = false;
126+
},
127+
},
128+
computed: {
129+
enableFlashInjection: {
130+
get(): boolean { return Preferences.preferences.enableFlashInjection; },
131+
set(val: boolean) {
132+
Preferences.writeAttribute({ attr: 'enableFlashInjection', val });
133+
},
134+
},
135+
flashInjectionSize: {
136+
get(): number { return Preferences.preferences.flashInjectionSize; },
137+
set(val: number) {
138+
Preferences.writeAttribute({ attr: 'flashInjectionSize', val });
139+
},
140+
},
141+
flashInjectionColor: {
142+
get(): RgbaColor { return Preferences.preferences.flashInjectionColor; },
143+
set(val: RgbaColor) {
144+
Preferences.writeAttribute({ attr: 'flashInjectionColor', val });
145+
},
146+
},
147+
flashInjectionBackgroundEnable: {
148+
get(): boolean { return Preferences.preferences.flashInjectionBackgroundEnable; },
149+
set(val: boolean) {
150+
Preferences.writeAttribute({ attr: 'flashInjectionBackgroundEnable', val });
151+
},
152+
},
153+
flashInjectionBackgroundColor: {
154+
get(): RgbaColor { return Preferences.preferences.flashInjectionBackgroundColor; },
155+
set(val: RgbaColor) {
156+
Preferences.writeAttribute({ attr: 'flashInjectionBackgroundColor', val });
157+
},
158+
},
159+
flashInjectionRightShift: {
160+
get(): number { return Preferences.preferences.flashInjectionRightShift; },
161+
set(val: number) {
162+
Preferences.writeAttribute({ attr: 'flashInjectionRightShift', val });
163+
},
164+
},
165+
},
166+
watch: {
167+
}
168+
});
169+
</script>
170+
171+
<style scoped>
172+
.top-label {
173+
margin: 0;
174+
padding: 0;
175+
height: auto;
176+
}
177+
.color-picker {
178+
max-width: 150px;
179+
}
180+
.link-head {
181+
color: white;
182+
user-select: none;
183+
}
184+
.page-card {
185+
margin: 15px 0;
186+
padding: 0 15px 15px;
187+
}
188+
.page-wrap {
189+
max-width: 750px;
190+
flex-grow: 1;
191+
}
192+
</style>

IntelPresentMon/AppCef/source/util/CefValues.h

+8
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ namespace p2c::client::util
174174
std::wstring AsWString() const;
175175
std::string AsString() const;
176176
template<typename T>
177+
std::optional<T> AsOptional() const
178+
{
179+
if (IsNull()) {
180+
return std::nullopt;
181+
}
182+
return T(*this);
183+
}
184+
template<typename T>
177185
operator T() const
178186
{
179187
using str::ToWide;

IntelPresentMon/AppCef/source/util/MakeOverlaySpec.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace p2c::client::util
4545
.hideAlways = traversedPref["hideAlways"],
4646
.independentKernelWindow = traversedPref["independentWindow"],
4747
.generateStats = traversedPref["generateStats"],
48+
.enableFlashInjection = traversedPref["enableFlashInjection"],
4849
});
4950

5051
// style sheets

IntelPresentMon/AppCef/source/util/async/PushSpecification.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88

99
namespace p2c::client::util::async
1010
{
11+
namespace
12+
{
13+
gfx::Color ColorFromV8(const CefRefPtr<CefValue>& rgba)
14+
{
15+
return gfx::Color::FromBytes(
16+
Traverse(rgba)["r"],
17+
Traverse(rgba)["g"],
18+
Traverse(rgba)["b"]
19+
).WithAlpha(Traverse(rgba)["a"]);
20+
}
21+
}
22+
1123
class PushSpecification : public AsyncEndpoint
1224
{
1325
public:
@@ -16,7 +28,16 @@ namespace p2c::client::util::async
1628
// {very-complicated-spec-object} => null
1729
Result ExecuteOnKernelTask(uint64_t uid, CefRefPtr<CefValue> pArgObj, kern::Kernel& kernel) const override
1830
{
19-
if (Traverse(pArgObj)["pid"].IsNull()) {
31+
auto args = Traverse(pArgObj);
32+
kernel.UpdateInjection(
33+
args["preferences"]["enableFlashInjection"],
34+
args["pid"].AsOptional<uint32_t>(),
35+
args["preferences"]["flashInjectionBackgroundEnable"],
36+
ColorFromV8(args["preferences"]["flashInjectionColor"]),
37+
ColorFromV8(args["preferences"]["flashInjectionBackgroundColor"]),
38+
args["preferences"]["flashInjectionSize"],
39+
args["preferences"]["flashInjectionRightShift"]);
40+
if (args["pid"].IsNull()) {
2041
kernel.ClearOverlay();
2142
}
2243
else {

0 commit comments

Comments
 (0)