Lua - memory domain - if a domain isn't writable, error when attempting to write to it

This commit is contained in:
adelikat 2015-01-25 20:20:43 +00:00
parent 2c09c10721
commit 0d54298f02
2 changed files with 43 additions and 22 deletions

View File

@ -109,14 +109,14 @@ namespace BizHawk.Client.Common
}
else
{
Log(string.Format("Unable to find domain: ", domain));
Log(string.Format("Unable to find domain: {0}", domain));
return false;
}
}
catch // Just in case
{
Log(string.Format("Unable to find domain: ", domain));
Log(string.Format("Unable to find domain: {0}", domain));
}
return false;

View File

@ -54,6 +54,8 @@ namespace BizHawk.Client.Common
}
protected void WriteUnsignedByte(int addr, uint v)
{
if (Domain.CanPoke())
{
if (addr < Domain.Size)
{
@ -65,6 +67,11 @@ namespace BizHawk.Client.Common
" outside the memory size of " + Domain.Size);
}
}
else
{
Log(string.Format("Error: the domain {0} is not writable", Domain.Name));
}
}
protected static int U2S(uint u, int size)
{
@ -169,6 +176,8 @@ namespace BizHawk.Client.Common
}
protected void WriteByteRange(LuaTable memoryblock)
{
if (Domain.CanPoke())
{
foreach (var address in memoryblock.Keys)
{
@ -184,6 +193,11 @@ namespace BizHawk.Client.Common
}
}
}
else
{
Log(string.Format("Error: the domain {0} is not writable", Domain.Name));
}
}
protected float ReadFloat(int addr, bool bigendian)
{
@ -203,6 +217,8 @@ namespace BizHawk.Client.Common
}
protected void WriteFloat(int addr, double value, bool bigendian)
{
if (Domain.CanPoke())
{
if (addr < Domain.Size)
{
@ -217,6 +233,11 @@ namespace BizHawk.Client.Common
" outside memory size of " + Domain.Size);
}
}
else
{
Log(string.Format("Error: the domain {0} is not writable", Domain.Name));
}
}
#endregion
}