decord/alpha/source/modules/game_detection/GameAnalyticsUtils.tsx

121 lines
3.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7435
// Function ID: 7436
// Name: GameAnalyticsUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [2037, 7436, 1382, 2]
2026-09-03 10:05:34 +00:00
// Exports: getGameAnalyticsMetadata, getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7435 (GameAnalyticsUtils)
2026-10-09 10:00:15 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-12 06:59:38 +00:00
import RobloxSubgameUtils from "RobloxSubgameUtils" /* 7436 */;
2026-10-09 10:00:15 +00:00
import DetectableGameStore from "DetectableGameStore" /* 2037 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const result = size.fileFinishedImporting("modules/game_detection/GameAnalyticsUtils.tsx");
2026-07-29 08:29:29 +00:00
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) {
2026-10-03 08:58:59 +00:00
let distributor;
let id2;
let joined;
let name;
let sku;
let str2;
let str3;
let subgameMetadata;
2026-07-20 16:05:17 +00:00
if (null == streamApplication) {
2026-10-13 12:43:34 +00:00
return { gameName: "Array", gameId: "code", exe: "hasDiversityParent", distributor: "has", sku: "backgroundColor", gameMetadata: "status", rawExePath: "w" };
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;
const id = streamApplication.id;
2026-10-03 08:58:59 +00:00
const obj = { id, name, exePath: str2, cmdLine: str3, lastFocused: 0 };
name = streamApplication.name;
str2 = str;
2026-07-29 08:29:29 +00:00
if (str == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
str3 = str;
2026-07-29 08:29:29 +00:00
if (str == null) {
str3 = "";
2026-07-20 16:05:17 +00:00
}
const findGameResult = DetectableGameStore.findGame(obj);
2026-07-20 16:05:17 +00:00
const name2 = streamApplication.name;
2026-10-03 08:58:59 +00:00
const obj2 = { gameName: name2, gameId: id2, exe: joined, distributor, sku, gameMetadata: subgameMetadata, rawExePath: str };
id2 = streamApplication.id;
2026-07-29 08:29:29 +00:00
if (id2 == null) {
let id1;
2026-07-29 08:29:29 +00:00
if (findGameResult != null) {
id1 = findGameResult.id;
2026-07-20 16:05:17 +00:00
}
id2 = id1;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
joined = undefined;
2026-07-29 08:29:29 +00:00
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-10-03 08:58:59 +00:00
distributor = streamApplication.distributor;
sku = streamApplication.sku;
subgameMetadata = undefined;
2026-07-20 16:05:17 +00:00
if (null != streamApplication) {
2026-10-03 08:58:59 +00:00
const obj4 = RobloxSubgameUtils;
subgameMetadata = obj4.getSubgameMetadata(streamApplication);
2026-07-20 16:05:17 +00:00
}
return obj2;
2026-07-20 16:05:17 +00:00
}
};
export const getGameAnalyticsMetadata = function getGameAnalyticsMetadata(currentGameForAnalytics, arg1, detected_game_id) {
2026-10-03 08:58:59 +00:00
const tmp = arg1;
if (tmp) {
let json;
if (null != detected_game_id) {
2026-09-03 10:05:34 +00:00
const _JSON = JSON;
const obj2 = { detected_game_id };
2026-10-03 08:58:59 +00:00
json = JSON.stringify(obj2);
2026-09-03 10:05:34 +00:00
}
return json;
}
2026-10-03 08:58:59 +00:00
const obj = RobloxSubgameUtils;
json = obj.getSubgameMetadata(currentGameForAnalytics);
2026-09-03 10:05:34 +00:00
};
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-10-03 08:58:59 +00:00
let obj = PlatformUtils;
const platformName = obj.getPlatformName();
2026-07-20 16:05:17 +00:00
return arr.some((os) => {
let tmp = os.os === closure_1;
if (tmp) {
let endsWithResult;
2026-10-03 08:58:59 +00:00
const obj = substr;
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;
}
return tmp;
});
}
}
return false;
};