Implement Ram Poke - poking of float types, and fix bugs in float validation

This commit is contained in:
adelikat 2013-10-12 02:37:50 +00:00
parent ed637998fb
commit f9ef8a7271
2 changed files with 12 additions and 7 deletions

View File

@ -874,12 +874,14 @@ namespace BizHawk.MultiClient
case DisplayType.Float:
if (InputValidate.IsValidDecimalNumber(value))
{
throw new NotImplementedException();
byte[] bytes = BitConverter.GetBytes(float.Parse(value));
val = BitConverter.ToUInt32(bytes, 0);
}
else
{
return false;
}
break;
}
PokeDWord(val);
return true;

View File

@ -193,15 +193,15 @@ namespace BizHawk
byte[] bc = AE.GetBytes(input[x].ToString());
// Determine if the ASCII code is within the valid range of numerical values.
if (bc[x] > 58)
if (bc[0] > 58)
return false;
if (bc[x] == 46)
if (bc[0] == 46)
continue;
if (bc[0] < 48)
{
if (bc[x] == 45 && x == 0)
if (bc[0] == 45 && x == 0)
continue;
else
return false;
@ -242,12 +242,15 @@ namespace BizHawk
byte[] bc = AE.GetBytes(input[x].ToString());
// Determine if the ASCII code is within the valid range of numerical values.
if (bc[x] > 58)
if (bc[0] > 58)
return false;
if (bc[x] < 48)
if (bc[0] == 46)
continue;
if (bc[0] < 48)
{
if (bc[x] == 45 && x == 0)
if (bc[0] == 45 && x == 0)
continue;
else
return false;