Prevent devs from setting '.' as a button's mnemonic

see c2ba2d7d4, #4217
This commit is contained in:
YoshiRulz 2025-04-19 20:49:05 +10:00
parent c2ba2d7d4a
commit a41817b703
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 16 additions and 0 deletions

View File

@ -1,4 +1,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using BizHawk.Common;
using BizHawk.Common.StringExtensions;
namespace BizHawk.Emulation.Common
@ -915,5 +918,18 @@ namespace BizHawk.Emulation.Common
["Weapon Select"] = "W",
},
};
static Bk2MnemonicLookup()
{
const string ERR_FMT_STR = $"{nameof(Bk2MnemonicLookup)}.{{1}}[\"{{0}}\"] must not be '.' as that indicates unpressed buttons";
foreach (var (k, v) in BaseMnemonicLookupTable)
{
Debug.Assert(v is not '.', ERR_FMT_STR, k, nameof(BaseMnemonicLookupTable));
}
foreach (var (sysID, dict) in SystemOverrides) foreach (var (k, v) in dict)
{
Debug.Assert(v is not '.', ERR_FMT_STR, k, $"{nameof(SystemOverrides)}[{sysID}]");
}
}
}
}