UNPKG

@shockpkg/dir-projector

Version:

Package for creating Shockwave Director projectors

84 lines (66 loc) 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectorWindows32 = void 0; var _path = require("path"); var _archiveFiles = require("@shockpkg/archive-files"); var _windows = require("../../util/windows"); var _windows2 = require("../windows"); /** * ProjectorWindows32 constructor. * * @param path Output path. */ class ProjectorWindows32 extends _windows2.ProjectorWindows { /** * Patch the Shockave 3D Xtra to have a larger buffer to avoid a crash. * The buffer for resolving InstalledDisplayDrivers to a path is small. * Changes to the values stored in InstalledDisplayDrivers cause issues. * The value is now supposed to hold full paths on modern Windows. * In particular, Nvidia drivers which do this need this patch. * * @default false */ constructor(path) { super(path); this.patchShockwave3dInstalledDisplayDriversSize = false; } /** * Modify the projector skeleton. */ async _modifySkeleton() { await super._modifySkeleton(); await this._patchShockwave3dInstalledDisplayDriversSize(); } /** * Patch projector, Shockwave 3D InstalledDisplayDrivers size. */ async _patchShockwave3dInstalledDisplayDriversSize() { if (!this.patchShockwave3dInstalledDisplayDriversSize) { return; } const xtrasDir = this.xtrasPath; const search = 'Shockwave 3D Asset.x32'; const searchLower = search.toLowerCase(); let found = false; await (0, _archiveFiles.fsWalk)(xtrasDir, async (path, stat) => { if (!stat.isFile()) { return; } const fn = (0, _path.basename)(path); if (fn.toLowerCase() !== searchLower) { return; } found = true; await (0, _windows.windowsPatchShockwave3dInstalledDisplayDriversSize)((0, _path.join)(xtrasDir, path)); }, { ignoreUnreadableDirectories: true }); if (!found) { throw new Error(`Failed to locate for patching: ${search}`); } } } exports.ProjectorWindows32 = ProjectorWindows32; //# sourceMappingURL=32.js.map