decord/source/modules/game_detection/GameAnalyticsUtils.tsx

108 lines
3.4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 4553
// Function ID: 4554
2026-07-29 08:29:29 +00:00
// Name: removeExecutablePathPrefix
2026-08-25 06:04:03 +00:00
// Dependencies: [4416, 4554, 500, 2]
2026-07-29 08:29:29 +00:00
// Exports: getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 4553 (removeExecutablePathPrefix)
import _openRobloxURLWithRootPlaceId from "_openRobloxURLWithRootPlaceId" /* 4554 */;
import closure_2 from "gameFromServer" /* 4416 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
const result = require("set").fileFinishedImporting("modules/game_detection/GameAnalyticsUtils.tsx");
export const removeExecutablePathPrefix = function removeExecutablePathPrefix(exePath) {
const formatted = exePath.toLowerCase();
let str = formatted;
2026-07-20 16:05:17 +00:00
if (formatted.endsWith("/")) {
2026-07-29 08:29:29 +00:00
str = formatted.slice(0, -1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const parts = str.split("/");
2026-07-20 16:05:17 +00:00
const substr = parts.slice(-2);
return substr.join("/");
2026-07-29 08:29:29 +00:00
};
2026-07-20 16:05:17 +00:00
export const getRunningGameAnalytics = function getRunningGameAnalytics(streamApplication) {
if (null == streamApplication) {
2026-08-25 06:04:03 +00:00
return { gameName: "Array", gameId: "dispatch", exe: "header", distributor: "Array", sku: "isArray", gameMetadata: "isArray", rawExePath: "useState" };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const str = "exePath" in streamApplication ? streamApplication.exePath : streamApplication.exe;
2026-07-20 16:05:17 +00:00
let id = streamApplication.id;
2026-07-29 08:29:29 +00:00
let obj = { id: null, name: null, exePath: null, cmdLine: null, lastFocused: 0 };
obj[0] = id;
2026-07-20 16:05:17 +00:00
const name = streamApplication.name;
2026-07-29 08:29:29 +00:00
obj[1] = name;
let str2 = str;
if (str == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = str2;
let str3 = str;
if (str == null) {
str3 = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = str3;
2026-08-24 06:08:38 +00:00
const findGameResult = closure_2.findGame(obj);
2026-07-20 16:05:17 +00:00
const name2 = streamApplication.name;
2026-07-29 08:29:29 +00:00
obj = { gameName: null, gameId: null, exe: null, distributor: null, sku: null, gameMetadata: null, rawExePath: null };
obj[0] = name2;
2026-07-20 16:05:17 +00:00
let id2 = streamApplication.id;
2026-07-29 08:29:29 +00:00
if (id2 == null) {
2026-07-20 16:05:17 +00:00
id = undefined;
2026-07-29 08:29:29 +00:00
if (findGameResult != null) {
2026-07-20 16:05:17 +00:00
id = findGameResult.id;
}
id2 = id;
}
2026-07-29 08:29:29 +00:00
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("/");
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = joined;
2026-07-20 16:05:17 +00:00
const distributor = streamApplication.distributor;
2026-07-29 08:29:29 +00:00
obj[3] = distributor;
2026-07-20 16:05:17 +00:00
const sku = streamApplication.sku;
2026-07-29 08:29:29 +00:00
obj[4] = sku;
2026-07-20 16:05:17 +00:00
let subgameMetadata;
if (null != streamApplication) {
2026-08-24 06:08:38 +00:00
subgameMetadata = _openRobloxURLWithRootPlaceId.getSubgameMetadata(streamApplication);
const obj4 = _openRobloxURLWithRootPlaceId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[5] = subgameMetadata;
obj[6] = str;
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-29 08:29:29 +00:00
export const isVerifiedGameExecutable = function isVerifiedGameExecutable(str, arr) {
if (null != str) {
2026-07-20 16:05:17 +00:00
if (null != arr) {
2026-07-29 08:29:29 +00:00
const formatted = str.toLowerCase();
let substr = formatted;
if (formatted.endsWith("/")) {
substr = formatted.slice(0, -1);
}
2026-08-24 06:08:38 +00:00
dependencyMap = substr(500).getPlatformName();
2026-07-20 16:05:17 +00:00
return arr.some((os) => {
let tmp = os.os === closure_1;
if (tmp) {
let endsWithResult;
2026-07-29 08:29:29 +00:00
if (substr != null) {
endsWithResult = obj.endsWith(os.name);
2026-07-20 16:05:17 +00:00
}
tmp = endsWithResult;
2026-07-29 08:29:29 +00:00
obj = substr;
2026-07-20 16:05:17 +00:00
}
return tmp;
});
}
}
return false;
};