decord/source/modules/game_detection/GameAnalyticsUtils.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

120 lines
3.8 KiB
TypeScript

// Module ID: 4689
// Function ID: 4690
// Name: removeExecutablePathPrefix
// Dependencies: [1931, 4690, 1115, 2]
// Exports: getGameAnalyticsMetadata, getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
// Module 4689 (removeExecutablePathPrefix)
import _openRobloxURLWithRootPlaceId from "_openRobloxURLWithRootPlaceId" /* 4690 */;
import closure_2 from "gameFromServer" /* 1931 */;
require = arg1;
const result = require("set").fileFinishedImporting("modules/game_detection/GameAnalyticsUtils.tsx");
export const removeExecutablePathPrefix = function removeExecutablePathPrefix(exePath) {
const formatted = exePath.toLowerCase();
let str = formatted;
if (formatted.endsWith("/")) {
str = formatted.slice(0, -1);
}
const parts = str.split("/");
const substr = parts.slice(-2);
return substr.join("/");
};
export const getRunningGameAnalytics = function getRunningGameAnalytics(streamApplication) {
if (null == streamApplication) {
return { gameName: "Array", gameId: "call", exe: "a", distributor: "window", sku: "HermesInternal", gameMetadata: "disabled", rawExePath: "to" };
} else {
const str = "exePath" in streamApplication ? streamApplication.exePath : streamApplication.exe;
let id = streamApplication.id;
let obj = { id: null, name: null, exePath: null, cmdLine: null, lastFocused: 0 };
obj[0] = id;
const name = streamApplication.name;
obj[1] = name;
let str2 = str;
if (str == null) {
str2 = "";
}
obj[2] = str2;
let str3 = str;
if (str == null) {
str3 = "";
}
obj[3] = str3;
const findGameResult = closure_2.findGame(obj);
const name2 = streamApplication.name;
obj = { gameName: null, gameId: null, exe: null, distributor: null, sku: null, gameMetadata: null, rawExePath: null };
obj[0] = name2;
let id2 = streamApplication.id;
if (id2 == null) {
id = undefined;
if (findGameResult != null) {
id = findGameResult.id;
}
id2 = id;
}
obj[1] = id2;
let joined;
if (null != str) {
const formatted = str.toLowerCase();
let str5 = formatted;
if (formatted.endsWith("/")) {
str5 = formatted.slice(0, -1);
}
const parts = str5.split("/");
const substr = parts.slice(-2);
joined = substr.join("/");
}
obj[2] = joined;
const distributor = streamApplication.distributor;
obj[3] = distributor;
const sku = streamApplication.sku;
obj[4] = sku;
let subgameMetadata;
if (null != streamApplication) {
subgameMetadata = _openRobloxURLWithRootPlaceId.getSubgameMetadata(streamApplication);
const obj4 = _openRobloxURLWithRootPlaceId;
}
obj[5] = subgameMetadata;
obj[6] = str;
return obj;
}
};
export const getGameAnalyticsMetadata = function getGameAnalyticsMetadata(currentGameForAnalytics) {
if (arg1) {
if (null != arg2) {
const _JSON = JSON;
let obj = { detected_game_id: null };
obj[0] = arg2;
let json = JSON.stringify(obj);
}
return json;
}
obj = _openRobloxURLWithRootPlaceId;
json = obj.getSubgameMetadata(currentGameForAnalytics);
};
export const isVerifiedGameExecutable = function isVerifiedGameExecutable(str, arr) {
if (null != str) {
if (null != arr) {
const formatted = str.toLowerCase();
let substr = formatted;
if (formatted.endsWith("/")) {
substr = formatted.slice(0, -1);
}
dependencyMap = substr(1115).getPlatformName();
return arr.some((os) => {
let tmp = os.os === closure_1;
if (tmp) {
let endsWithResult;
if (substr != null) {
endsWithResult = obj.endsWith(os.name);
}
tmp = endsWithResult;
obj = substr;
}
return tmp;
});
}
}
return false;
};