Workaround for duplicate addresses
Fixes hex parsing, but hacks around #832
This commit is contained in:
parent
7f7714059b
commit
7c74ff70a3
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace CxbxDebugger
|
||||
{
|
||||
|
@ -23,14 +24,21 @@ namespace CxbxDebugger
|
|||
AddressMap = new Dictionary<uint, string>(Pairs.Length);
|
||||
|
||||
// Swap SYMBOL, ADDR to be ADDR -> SYMBOL
|
||||
uint Addr;
|
||||
foreach (KeyValuePair<string, string> Symbol in Pairs)
|
||||
{
|
||||
uint Address = Convert.ToUInt32(Symbol.Value);
|
||||
AddressMap.Add(Address, Symbol.Key);
|
||||
if (!uint.TryParse(Symbol.Value, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out Addr))
|
||||
continue;
|
||||
|
||||
// See https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/832
|
||||
if (!AddressMap.ContainsKey(Addr))
|
||||
{
|
||||
AddressMap.Add(Addr, Symbol.Key);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue