fix(desktop): drop game capture injection and pin dll search (#2069)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-29 14:26:28 +02:00
1 parent 9ad026b8ce
commit 9d0be1ebd1
43 files changed
+158 -12089

No files matched your search

@@ -278,10 +278,6 @@ const DEVELOPER_OPTION_DESCRIPTOR = msg({
message: 'Developer option',
comment: 'Developer tools debug menu label. Internal-only surface for developers; translators may keep this terse.',
});
const GAME_CAPTURE_INJECTION_METHOD_DESCRIPTOR = msg({
message: 'Game capture injection (Windows)',
comment: 'Developer tools debug menu label. Internal-only surface for developers; translators may keep this terse.',
});
const DEVELOPER_OPTION_LABEL_FALLBACKS: Partial<Record<keyof DeveloperOptionsState, MessageDescriptor>> = {
mockAttachmentStates: ATTACHMENT_MOCKS_DESCRIPTOR,
};
@@ -327,7 +323,6 @@ const formatDeveloperOptionValue = <K extends keyof DeveloperOptionsState>(
case 'mockRequiredActionsResendOutcome':
case 'mockTitlebarPlatformOverride':
case 'mockUpdaterState':
case 'gameCaptureInjectionMethod':
return String(value).replace(/_/g, ' ');
case 'premiumSinceOverride':
case 'premiumUntilOverride':
@@ -410,8 +405,6 @@ export const getDeveloperOptionLabel = (key: keyof DeveloperOptionsState): Messa
return VANITY_URL_DISCLAIMER_DESCRIPTOR;
case 'forceShowVoiceConnection':
return VOICE_CONNECTION_DEBUG_DESCRIPTOR;
case 'gameCaptureInjectionMethod':
return GAME_CAPTURE_INJECTION_METHOD_DESCRIPTOR;
case 'premiumTypeOverride':
return PREMIUM_TYPE_DESCRIPTOR;
case 'premiumLifetimeSequenceOverride':
@@ -1,15 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {getDeveloperOptionLabel} from '@app/features/channel/components/channel_header_components/developer_tools/DeveloperOptionLabels';
import {DeveloperOptionRadioSubmenu} from '@app/features/channel/components/channel_header_components/developer_tools/DeveloperToolsMenuComponents';
import {translateDescriptor} from '@app/features/channel/components/channel_header_components/developer_tools/DeveloperToolsShared';
import {getGameCaptureInjectionMethodOptions} from '@app/features/channel/components/channel_header_components/developer_tools/OptionPresets';
import {getToggleGroups, type ToggleGroup} from '@app/features/devtools/components/DeveloperOptionsToggleGroups';
import type {DeveloperOptionsState} from '@app/features/devtools/state/DeveloperOptions';
import DeveloperOptions from '@app/features/devtools/state/DeveloperOptions';
import {CheckboxItem} from '@app/features/ui/action_menu/ContextMenu';
import {MenuItemSubmenu} from '@app/features/ui/action_menu/MenuItemSubmenu';
import {getNativePlatformSync} from '@app/features/ui/utils/NativeUtils';
import * as UserSettingsCommands from '@app/features/user/commands/UserSettingsCommands';
import UserSettings from '@app/features/user/state/UserSettings';
import Users from '@app/features/user/state/Users';
@@ -71,7 +67,6 @@ export const GeneralDeveloperOptionsMenu: React.FC = observer(() => {
const currentUser = Users.currentUser;
const canConfigureMentionSuppression = currentUser?.isStaff() ?? false;
const suppressUnprivilegedSelfMentions = UserSettings.getSuppressUnprivilegedSelfMentions();
const isWindows = getNativePlatformSync() === 'windows';
return (
<>
{toggleGroups.map((group, index) => (
@@ -81,14 +76,6 @@ export const GeneralDeveloperOptionsMenu: React.FC = observer(() => {
data-flx="channel.channel-header-components.developer-tools-context-menu.general-developer-options-menu.toggle-group-submenu"
/>
))}
{isWindows && (
<DeveloperOptionRadioSubmenu
label={translateDescriptor(i18n, getDeveloperOptionLabel('gameCaptureInjectionMethod'))}
optionKey="gameCaptureInjectionMethod"
options={getGameCaptureInjectionMethodOptions()}
data-flx="channel.channel-header-components.developer-tools-context-menu.general-developer-options-menu.game-capture-injection"
/>
)}
{canConfigureMentionSuppression && (
<MenuItemSubmenu
label={i18n._(MENTION_CONTROLS_DESCRIPTOR)}
@@ -196,14 +196,3 @@ export const getGiftDurationOptions = (): Array<RadioMenuOption<DeveloperOptions
{value: 12, label: MESSAGE_12_MONTHS_1_YEAR_DESCRIPTOR},
{value: 0, label: LIFETIME_DESCRIPTOR},
];
export const INJECT_METHOD_AUTOMATIC_DESCRIPTOR = msg({
message: 'Automatic',
comment: 'Developer tools debug menu label. Internal-only surface for developers; translators may keep this terse.',
});
export const getGameCaptureInjectionMethodOptions = (): Array<
RadioMenuOption<DeveloperOptionsState['gameCaptureInjectionMethod']>
> => [
{value: 'auto', label: INJECT_METHOD_AUTOMATIC_DESCRIPTOR},
{value: 'remote-thread', label: 'CreateRemoteThread'},
{value: 'set-windows-hook', label: 'SetWindowsHookEx'},
];
@@ -69,7 +69,6 @@ export const DEFAULT_DEVELOPER_OPTIONS = {
mockTitlebarPlatformOverride: 'auto',
mockAttachmentStates: {},
noOpInAppReports: false,
gameCaptureInjectionMethod: 'auto',
} satisfies DeveloperOptionsState;
const PREMIUM_SCENARIO_OVERRIDE_KEYS = new Set<keyof DeveloperOptionsState>([
'premiumTypeOverride',
@@ -97,7 +97,6 @@ export type DeveloperOptionsState = Readonly<{
}
>;
noOpInAppReports: boolean;
gameCaptureInjectionMethod: 'auto' | 'remote-thread' | 'set-windows-hook';
}>;
type MutableDeveloperOptionsState = {
-readonly [K in keyof DeveloperOptionsState]: DeveloperOptionsState[K];
@@ -182,7 +181,6 @@ class DeveloperOptions implements DeveloperOptionsState {
mockGiftRedeemed: boolean | null = null;
mockTitlebarPlatformOverride: DeveloperOptionsState['mockTitlebarPlatformOverride'] = 'auto';
noOpInAppReports = false;
gameCaptureInjectionMethod: DeveloperOptionsState['gameCaptureInjectionMethod'] = 'auto';
constructor() {
makeAutoObservable(this, {}, {autoBind: true});
@@ -255,7 +253,6 @@ class DeveloperOptions implements DeveloperOptionsState {
'mockTitlebarPlatformOverride',
'mockAttachmentStates',
'noOpInAppReports',
'gameCaptureInjectionMethod',
]);
}
@@ -188,7 +188,7 @@ function inferWindowsCaptureMethod(
return null;
}
if (diagnostics?.activeStrategy) return diagnostics.activeStrategy;
if (capture.sourceKind === 'game') return 'game-hook';
if (capture.sourceKind === 'game') return 'wgc';
if (capture.sourceKind === 'screen') return 'wgc';
if (capture.sourceKind === 'window') return 'dxgi-duplication';
return 'native-screen-capture';
+1 -6
View File
@@ -695,8 +695,6 @@ export interface NativeScreenCaptureSource {
targetPid?: number;
}
export type GameCaptureInjectionMethod = 'auto' | 'remote-thread' | 'set-windows-hook';
export interface NativeScreenCaptureRect {
x: number;
y: number;
@@ -710,7 +708,6 @@ export interface NativeScreenCaptureStartOptions {
width?: number;
height?: number;
frameRate?: number;
injectionMethod?: GameCaptureInjectionMethod;
captureId?: string;
colorRange?: 'full' | 'limited';
colorSpace?: 'rec709' | 'srgb';
@@ -746,7 +743,7 @@ export interface NativeScreenCaptureLifecycleMessage {
source?: NativeScreenCaptureLifecycleSource;
}
export type NativeScreenCaptureStrategy = 'game-hook' | 'dxgi-duplication' | 'window-gdi' | string;
export type NativeScreenCaptureStrategy = 'wgc' | 'dxgi-duplication' | 'window-gdi' | string;
export interface NativeScreenCaptureDiagnostics {
state?: number;
@@ -761,8 +758,6 @@ export interface NativeScreenCaptureDiagnostics {
droppedFrameCounter?: number;
lastPresentTimestampUs?: number;
lastError?: number;
requestedInjectionMethod?: string;
injectionMethod?: string;
activeStrategy?: NativeScreenCaptureStrategy;
lastFallbackReason?: string;
backend?: string;