Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/gms2/use-gms2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,21 @@ async function createLocalSettings(
return userDir;
}

// GMAssetCompiler ignores some project options unless the matching feature flag is on.
const ASSET_COMPILER_FEATURE_FLAGS = ["strip_unused_assets"];

/**
* Igor obfuscates the flag list before passing it as `/ffe=`: the comma
* separated list as UTF-8, every byte shifted by 10, then base64.
*/
function encodeFeatureFlags(flags: string[]): string {
const bytes = Buffer.from(flags.join(","), "utf-8");
for (const [i, byte] of bytes.entries()) {
bytes[i] = byte + 10;
}
return bytes.toString("base64");
}

export interface CommonIgorBuildArgs {
igorPath: string;
licenseFile: string;
Expand Down Expand Up @@ -327,6 +342,8 @@ export function constructIgorBuildArgs(
...(commonArgs.verbose ? ["-v"] : []),
"-projectool",
commonArgs.projectToolPath,
"-ac",
`/ffe=${encodeFeatureFlags(ASSET_COMPILER_FEATURE_FLAGS)}`,
"-jsonErrors",
...(commonArgs.userDir ? ["-uf", commonArgs.userDir] : []),
...(commonArgs.config ? ["-config", commonArgs.config] : []),
Expand Down
Loading