public string GetChar(byte value) { if (!CharLookup.ContainsKey(value)) { // Invalid throw new Exception("Invalid character"); } return(CharLookup[value]); }
public string GetChar(byte[] rom, int address) { byte value = rom[address]; if (!CharLookup.ContainsKey(value)) { // Invalid throw new Exception("Invalid character 0x" + value.ToString("X2") + " at address 0x" + address.ToString("X7")); } return(CharLookup[value]); }
public void AddJapaneseCharsToLookup(Block romData) { if (CharLookup == null) { throw new InvalidOperationException(nameof(CharLookup)); } int offset = GetOffset("Text.MainFont", romData); var stream = romData.ToBinaryStream(offset); for (short i = 0; i < 7332; i++) { if (CharLookup.ContainsKey(i)) { stream.Position += 22; continue; } byte[] sjis = { stream.ReadByte(), stream.ReadByte() }; stream.Position += 20; string value = sjisEncoding.GetString(sjis); CharLookup.Add(i, new ContextString(value)); } }