From ee0dea46bc0008a6317a5c446ddeadd5c0b3c938 Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:03:40 -0800 Subject: [PATCH] fix #3030 --- .../Consoles/Nintendo/NDS/MelonDS.ISettable.cs | 2 +- src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISettable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISettable.cs index f8420f8c55..80f41eaf43 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISettable.cs @@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS public string FirmwareUsername { get => _firmwareusername; - set => _firmwareusername = value.Substring(0, Math.Min(10, value.Length)); + set => _firmwareusername = value.Length != 0 ? value.Substring(0, Math.Min(10, value.Length)) : _firmwareusername.Substring(0, 1); } public enum Language : int diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs index e23066205f..762849231c 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs @@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS fwSettings.FirmwareBirthdayMonth = _syncSettings.FirmwareBirthdayMonth; fwSettings.FirmwareBirthdayDay = _syncSettings.FirmwareBirthdayDay; fwSettings.FirmwareFavouriteColour = _syncSettings.FirmwareFavouriteColour; - var message = Encoding.UTF8.GetBytes(_syncSettings.FirmwareMessage); + var message = _syncSettings.FirmwareMessage.Length != 0 ? Encoding.UTF8.GetBytes(_syncSettings.FirmwareMessage) : new byte[1] { 0 }; fwSettings.FirmwareMessageLength = message.Length; _exe.AddReadonlyFile(roms[0], "game.rom");