From b0bb56dfe0a7fbe6618aca5688aa3951138ab0f3 Mon Sep 17 00:00:00 2001 From: Bobby Galli Date: Wed, 5 Jun 2024 19:15:48 +0000 Subject: [PATCH 1/3] feat: allow nss uploads for Nintendo --- src/upload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/upload.ts b/src/upload.ts index 03ee1e2..0037d18 100644 --- a/src/upload.ts +++ b/src/upload.ts @@ -95,4 +95,4 @@ async function createSymbolFileInfos(symbolFilePath: string): Promise Date: Thu, 11 Jul 2024 14:21:11 -0400 Subject: [PATCH 2/3] fix: hacky workaround for .nss files --- src/elf.ts | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/elf.ts b/src/elf.ts index 0d670d2..8082967 100644 --- a/src/elf.ts +++ b/src/elf.ts @@ -1,34 +1,33 @@ import { ElfFile } from '@bugsplat/elfy'; +import { extname } from 'node:path'; export async function tryGetElfUUID(path: string) { let success: boolean, section: Buffer | undefined; - // TODO BG use a using statement here when we move away from pkg and can use node 20+ - let elfFile = await ElfFile.create(path); - try { - ({ success, section } = await elfFile.tryReadSection('.note.gnu.build-id')); - } finally { - elfFile.dispose(); - } + using elfFile = await ElfFile.create(path); + ({ success, section } = await elfFile.tryReadSection('.note.gnu.build-id')); if (success) { - return getUUID(section!, 16); + return getUUID(section!, path, 16); } - elfFile = await ElfFile.create(path); - try { - ({ success, section } = await elfFile.tryReadSection('.sce_special')); - } finally { - elfFile.dispose(); - } + ({ success, section } = await elfFile.tryReadSection('.sce_special')); if (success) { - return getUUID(section!); + return getUUID(section!, path); } return ''; } -function getUUID(section: Buffer, offset = 0) { - return section.subarray(offset, offset + 20).toString('hex'); +function getUUID(section: Buffer, path: string, offset = 0) { + let uuid = section.subarray(offset, offset + 20).toString('hex'); + + // Nintendo GUIDs seem to be 32 or 40 hex chars 0 padded to 64 hex chars + // Until we know more, pad it ourselves with this hacky workaround + if (extname(path) === '.nss') { + uuid = uuid.padEnd(64, '0'); + } + + return uuid; } \ No newline at end of file From 5c67add6b2b86bbcf9242d10c6728a94a5410ad3 Mon Sep 17 00:00:00 2001 From: Bobby Galli Date: Thu, 8 Aug 2024 16:46:24 +0000 Subject: [PATCH 3/3] fix: path comparison for nss --- src/elf.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elf.ts b/src/elf.ts index 8082967..ca59672 100644 --- a/src/elf.ts +++ b/src/elf.ts @@ -25,7 +25,7 @@ function getUUID(section: Buffer, path: string, offset = 0) { // Nintendo GUIDs seem to be 32 or 40 hex chars 0 padded to 64 hex chars // Until we know more, pad it ourselves with this hacky workaround - if (extname(path) === '.nss') { + if (extname(path)?.toLowerCase() === '.nss') { uuid = uuid.padEnd(64, '0'); }