fix(wasm): enable windows diagnostics and disable gui mode
This commit is contained in:
parent
33432725d6
commit
36ea209e72
|
|
@ -69,11 +69,13 @@ emscripten::val Convert(const emscripten::val& request, const emscripten::val& c
|
||||||
if (!request["icon"].isNull()) input.Icon = ReadBytes(request["icon"], remaining);
|
if (!request["icon"].isNull()) input.Icon = ReadBytes(request["icon"], remaining);
|
||||||
Relinker::ConversionOptions options;
|
Relinker::ConversionOptions options;
|
||||||
options.Target = target == "windows" ? Relinker::TargetSystem::Windows : Relinker::TargetSystem::Linux;
|
options.Target = target == "windows" ? Relinker::TargetSystem::Windows : Relinker::TargetSystem::Linux;
|
||||||
options.WindowsGui = target == "windows";
|
options.WindowsGui = false;
|
||||||
|
options.WindowsDiagnostics = target == "windows";
|
||||||
options.ToIntel = request["toIntel"].as<bool>();
|
options.ToIntel = request["toIntel"].as<bool>();
|
||||||
BrowserProgress progress(callback);
|
BrowserProgress progress(callback);
|
||||||
auto output = Relinker::Conversion(progress).Convert(std::move(input), options);
|
auto output = Relinker::Conversion(progress).Convert(std::move(input), options);
|
||||||
result.set("executable", CopyBytes(output.Executable));
|
result.set("executable", CopyBytes(output.Executable));
|
||||||
|
result.set("diagnostics", output.WindowsDiagnostics);
|
||||||
auto artifacts = emscripten::val::array();
|
auto artifacts = emscripten::val::array();
|
||||||
for (const auto& module : output.Modules) {
|
for (const auto& module : output.Modules) {
|
||||||
auto artifact = emscripten::val::object();
|
auto artifact = emscripten::val::object();
|
||||||
|
|
|
||||||
|
|
@ -216,12 +216,14 @@ export async function packageArchive(archive, converted, outputName, libraryFile
|
||||||
const originalFiles = archive.files.filter(item => !replaced.has("app0/" + item.name));
|
const originalFiles = archive.files.filter(item => !replaced.has("app0/" + item.name));
|
||||||
for (const item of originalFiles) claim("app0/" + item.name);
|
for (const item of originalFiles) claim("app0/" + item.name);
|
||||||
claim(outputName);
|
claim(outputName);
|
||||||
|
if (converted.diagnostics) claim("windows-diagnostics-imports.txt");
|
||||||
for (const module of converted.modules) {
|
for (const module of converted.modules) {
|
||||||
if (!module.name.startsWith("app0/sce_module/")) throw new Error("Invalid converted module path");
|
if (!module.name.startsWith("app0/sce_module/")) throw new Error("Invalid converted module path");
|
||||||
claim(module.name);
|
claim(module.name);
|
||||||
}
|
}
|
||||||
const binary = { versionMadeBy: 0x31e, externalFileAttributes: (0o100755 << 16) >>> 0 };
|
const binary = { versionMadeBy: 0x31e, externalFileAttributes: (0o100755 << 16) >>> 0 };
|
||||||
await writer.add(outputName, new Uint8ArrayReader(converted.executable), binary);
|
await writer.add(outputName, new Uint8ArrayReader(converted.executable), binary);
|
||||||
|
if (converted.diagnostics) await writer.add("windows-diagnostics-imports.txt", new Uint8ArrayReader(new TextEncoder().encode(converted.diagnostics)));
|
||||||
for (const module of converted.modules) await writer.add(module.name, new Uint8ArrayReader(module.bytes), binary);
|
for (const module of converted.modules) await writer.add(module.name, new Uint8ArrayReader(module.bytes), binary);
|
||||||
for (const entry of libraryEntries) {
|
for (const entry of libraryEntries) {
|
||||||
if (entry.directory) await writer.add(entry.filename, undefined, { directory: true });
|
if (entry.directory) await writer.add(entry.filename, undefined, { directory: true });
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ for (const target of ["windows", "linux"]) {
|
||||||
const converted = native.Convert(input, event => events.push(event));
|
const converted = native.Convert(input, event => events.push(event));
|
||||||
assert.equal(converted.ok, true, converted.error);
|
assert.equal(converted.ok, true, converted.error);
|
||||||
assert.equal(converted.executable[0], target === "windows" ? 77 : 127);
|
assert.equal(converted.executable[0], target === "windows" ? 77 : 127);
|
||||||
|
if (target === "windows") {
|
||||||
|
const image = new DataView(converted.executable.buffer, converted.executable.byteOffset, converted.executable.byteLength);
|
||||||
|
assert.equal(image.getUint16(image.getUint32(60, true) + 24 + 68, true), 3);
|
||||||
|
}
|
||||||
assert(events.some(event => event.stage === 6 && event.completed > 0));
|
assert(events.some(event => event.stage === 6 && event.completed > 0));
|
||||||
const libraries = await zip([["libs/system.prx", new Uint8Array([1, 2, 3])]]);
|
const libraries = await zip([["libs/system.prx", new Uint8Array([1, 2, 3])]]);
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue