DUMPER-COMPANION: More typing fixes

This commit is contained in:
Le Philousophe
2025-12-26 18:47:18 +00:00
parent 9582f7ed0e
commit 79f7201888
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ async function dumpVolume(file: ArrayBuffer, s: DumpSettings): Promise<void> {
s.log('2. Unzip the game data.');
s.log('3. Add the directory to ScummVM.');
} catch (err) {
s.log(err);
s.log(err as Error);
}
s.finished();
}
@@ -128,7 +128,7 @@ export default function Dumper() {
log(`Loading volume "${image.name}"...`);
const reader = new FileReader();
reader.addEventListener('load', () => {
dumpVolume(reader.result as ArrayBuffer, {
void dumpVolume(reader.result as ArrayBuffer, {
imageName: image.name,
lang,
unicode,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useState } from 'preact/hooks';
import * as punycode from 'punycode/';
import * as punycode from 'punycode';
import { escapeString, unescapeString } from './encoding';
export default function Punycoder() {
+6 -4
View File
@@ -1,4 +1,4 @@
import * as punycode from 'punycode/';
import * as punycode from 'punycode';
import { codePoint, byteToHex } from "./util";
@@ -19,7 +19,9 @@ export enum Language {
export function getLanguages(): string[] {
return Object.keys(Language).map(key => Language[key]);
return Object.keys(Language).map(
// Typecast to string as the key obviously exists
(key: string): string => Language[key] as string);
}
@@ -136,7 +138,7 @@ export function decodeMacRoman(str: Uint8Array): string {
*/
/* eslint-disable no-sparse-arrays */
const macJapaneseMap = {
const macJapaneseMap: Record<string, string[]> = {
'81': [' ','、','。','','','・','','','','','゛','゜','´','','¨','',' ̄','_','ヽ','ヾ','ゝ','ゞ','〃','仝','々','〆','','ー','—','','','','〜','‖','','…','‥','','','“','”','','','','','','','','','〈','〉','《','》','「','」','『','』','【','】','','','±','×',,'÷','','≠','','','≦','≧','∞','∴','♂','♀','°','','″','℃','¥','','¢','£','','','','','','§','☆','★','○','●','◎','◇','◆','□','■','△','▲','▽','▼','※','〒','→','←','↑','↓','〓',,,,,,,,,,,,'∈','∋','⊆','⊇','⊂','⊃','','∩',,,,,,,,,'∧','','¬','⇒','⇔','∀','∃',,,,,,,,,,,,'∠','⊥','⌒','∂','∇','≡','≒','≪','≫','√','∽','∝','∵','∫','∬',,,,,,,,'Å','‰','♯','♭','♪','†','‡','¶',,,,,'◯'],
'82': [,,,,,,,,,,,,,,,'','','','','','','','','','',,,,,,,,'','','','','','','','','','','','','','','','','','','','','','','','','','',,,,,,,,'','','','','','','','','','','','','','','','','','','','','','','','','','',,,,,'ぁ','あ','ぃ','い','ぅ','う','ぇ','え','ぉ','お','か','が','き','ぎ','く','ぐ','け','げ','こ','ご','さ','ざ','し','じ','す','ず','せ','ぜ','そ','ぞ','た','だ','ち','ぢ','っ','つ','づ','て','で','と','ど','な','に','ぬ','ね','の','は','ば','ぱ','ひ','び','ぴ','ふ','ぶ','ぷ','へ','べ','ぺ','ほ','ぼ','ぽ','ま','み','む','め','も','ゃ','や','ゅ','ゆ','ょ','よ','ら','り','る','れ','ろ','ゎ','わ','ゐ','ゑ','を','ん'],
'83': ['ァ','ア','ィ','イ','ゥ','ウ','ェ','エ','ォ','オ','カ','ガ','キ','ギ','ク','グ','ケ','ゲ','コ','ゴ','サ','ザ','シ','ジ','ス','ズ','セ','ゼ','ソ','ゾ','タ','ダ','チ','ヂ','ッ','ツ','ヅ','テ','デ','ト','ド','ナ','ニ','ヌ','ネ','','ハ','バ','パ','ヒ','ビ','ピ','フ','ブ','プ','ヘ','ベ','ペ','ホ','ボ','ポ','マ','ミ',,'ム','メ','モ','ャ','ヤ','ュ','ユ','ョ','ヨ','ラ','リ','ル','レ','ロ','ヮ','ワ','ヰ','ヱ','ヲ','ン','ヴ','ヵ','ヶ',,,,,,,,,'Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ','Χ','Ψ','Ω',,,,,,,,,'α','β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ','ν','ξ','ο','π','ρ','σ','τ','υ','φ','χ','ψ','ω'],
@@ -204,7 +206,7 @@ export function decodeMacJapanese(str: Uint8Array, log: (string) => void): strin
const hiKey = hi.toString(16);
const loKey = lo - 0x40;
if (macJapaneseMap[hiKey] == null || macJapaneseMap[hiKey][loKey] == null) {
if (!(hiKey in macJapaneseMap) || !(loKey in macJapaneseMap[hiKey])) {
log(`Warning: No mapping for Mac Japanese sequence 0x${byteToHex(hi)}${byteToHex(lo)}, decoding as Mac Roman`);
return decodeMacRoman(str);
}