unreal.js
Version:
A pak reader for games like VALORANT & Fortnite written in Node.JS
65 lines (64 loc) • 3.04 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VersionContainer = void 0;
const collection_1 = __importDefault(require("@discordjs/collection"));
const Game_1 = require("./Game");
const Versions_1 = require("./Versions");
class VersionContainer {
constructor(game = Game_1.Game.GAME_UE4(Game_1.Game.LATEST_SUPPORTED_UE4_VERSION), ver = Versions_1.VER_UE4_DETERMINE_BY_GAME, customVersions = null, optionOverrides = null) {
this._game = -1;
this._ver = -1;
this.explicitVer = false;
this.options = new collection_1.default();
this.optionsOverrides = optionOverrides;
this.game = game;
this.ver = ver;
this.customVersions = customVersions;
}
static from(other) {
const container = new VersionContainer(other.game, other.ver, other.customVersions, other.optionsOverrides);
container.explicitVer = other.explicitVer;
return container;
}
get game() {
return this._game;
}
set game(value) {
this._game = value;
this.initOptions();
}
get ver() {
return this._ver;
}
set ver(value) {
this.explicitVer = value != Versions_1.VER_UE4_DETERMINE_BY_GAME;
this._ver = this.explicitVer ? value : Game_1.Ue4Version.getArVer(this.game);
this.initOptions();
}
initOptions() {
this.options.clear();
this.options.set("RawIndexBuffer.HasShouldExpandTo32Bit", this.game >= Game_1.Game.GAME_UE4(25));
this.options.set("ShaderMap.UseNewCookedFormat", this.game >= Game_1.Game.GAME_UE5(0));
this.options.set("SkeletalMesh.KeepMobileMinLODSettingOnDesktop", this.game >= Game_1.Game.GAME_UE4(27));
this.options.set("SkeletalMesh.UseNewCookedFormat", this.game >= Game_1.Game.GAME_UE4(24));
this.options.set("StaticMesh.HasLODsShareStaticLighting", this.game < Game_1.Game.GAME_UE4(15) || this.game >= Game_1.Game.GAME_UE4(16));
this.options.set("StaticMesh.HasRayTracingGeometry", this.game >= Game_1.Game.GAME_UE4(25));
this.options.set("StaticMesh.HasVisibleInRayTracing", this.game >= Game_1.Game.GAME_UE4(26));
this.options.set("StaticMesh.KeepMobileMinLODSettingOnDesktop", this.game >= Game_1.Game.GAME_UE4(27));
this.options.set("StaticMesh.UseNewCookedFormat", this.game >= Game_1.Game.GAME_UE4(23));
this.options.set("VirtualTextures", this.game >= Game_1.Game.GAME_UE4(23));
if (this.optionsOverrides != null) {
for (const [key, value] of this.optionsOverrides) {
this.options.set(key, value);
}
}
}
get(key) {
return this.options.get(key) || false;
}
}
exports.VersionContainer = VersionContainer;
VersionContainer.DEFAULT = new VersionContainer();