decord/source/modules/game_detection/GameAnalyticsUtils.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

117 lines
3.8 KiB
TypeScript

// Module ID: 4767
// Function ID: 4768
// Name: GameAnalyticsUtils
// Dependencies: [1932, 4768, 1364, 2]
// Exports: getGameAnalyticsMetadata, getRunningGameAnalytics, isVerifiedGameExecutable, removeExecutablePathPrefix
// Module 4767 (GameAnalyticsUtils)
import PlatformUtils from "PlatformUtils" /* 1364 */;
import RobloxSubgameUtils from "RobloxSubgameUtils" /* 4768 */;
import DetectableGameStore from "DetectableGameStore" /* 1932 */;
require = fn;
const size = fn(2);
const result = size.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: "channel_id", gameId: "duration", exe: "d", distributor: "methodobject", sku: "LengthDelimited", gameMetadata: "dispatch", rawExePath: "l" };
} else {
const str = "exePath" in streamApplication ? streamApplication.exePath : streamApplication.exe;
const id = streamApplication.id;
const obj = { id, name: null, exePath: null, cmdLine: null, lastFocused: 0 };
const name = streamApplication.name;
obj.name = name;
let str2 = str;
if (str == null) {
str2 = "";
}
obj.exePath = str2;
let str3 = str;
if (str == null) {
str3 = "";
}
obj.cmdLine = str3;
const findGameResult = DetectableGameStore.findGame(obj);
const name2 = streamApplication.name;
const obj2 = { gameName: name2, gameId: null, exe: null, distributor: null, sku: null, gameMetadata: null, rawExePath: null };
let id2 = streamApplication.id;
if (id2 == null) {
let id1;
if (findGameResult != null) {
id1 = findGameResult.id;
}
id2 = id1;
}
obj2.gameId = 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("/");
}
obj2.exe = joined;
const distributor = streamApplication.distributor;
obj2.distributor = distributor;
const sku = streamApplication.sku;
obj2.sku = sku;
let subgameMetadata;
if (null != streamApplication) {
subgameMetadata = RobloxSubgameUtils.getSubgameMetadata(streamApplication);
}
obj2.gameMetadata = subgameMetadata;
obj2.rawExePath = str;
return obj2;
}
};
export const getGameAnalyticsMetadata = function getGameAnalyticsMetadata(currentGameForAnalytics, arg1, detected_game_id) {
if (arg1) {
if (null != detected_game_id) {
const _JSON = JSON;
const obj2 = { detected_game_id };
let json = JSON.stringify(obj2);
}
return json;
}
json = RobloxSubgameUtils.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);
}
const platformName = PlatformUtils.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;
};