Add string overload for WriteToFile
and also use UTF-8 instead of ASCII to match reads -_-
This commit is contained in:
parent
b7eb90f990
commit
a931d75143
|
@ -61,5 +61,7 @@ namespace BizHawk.Client.Common
|
||||||
return TryWrite(_mmfFiles[filename] = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length));
|
return TryWrite(_mmfFiles[filename] = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int WriteToFile(string filename, string outputString) => WriteToFile(filename, Encoding.UTF8.GetBytes(outputString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
|
@ -34,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public int MmfScreenshot() => GlobalWin.memoryMappedFiles.ScreenShotToFile();
|
public int MmfScreenshot() => GlobalWin.memoryMappedFiles.ScreenShotToFile();
|
||||||
|
|
||||||
public int MmfWrite(string mmf_filename, string outputString) => GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, Encoding.ASCII.GetBytes(outputString));
|
public int MmfWrite(string mmf_filename, string outputString) => GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, outputString);
|
||||||
|
|
||||||
public string MmfRead(string mmf_filename, int expectedSize) => GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize);
|
public string MmfRead(string mmf_filename, int expectedSize) => GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize);
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public int MmfWrite(string mmf_filename, string outputString)
|
public int MmfWrite(string mmf_filename, string outputString)
|
||||||
{
|
{
|
||||||
CheckMmf();
|
CheckMmf();
|
||||||
return GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, Encoding.ASCII.GetBytes(outputString));
|
return GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, outputString);
|
||||||
}
|
}
|
||||||
[LuaMethod("mmfRead", "Reads a string from a memory mapped file")]
|
[LuaMethod("mmfRead", "Reads a string from a memory mapped file")]
|
||||||
public string MmfRead(string mmf_filename, int expectedSize)
|
public string MmfRead(string mmf_filename, int expectedSize)
|
||||||
|
|
Loading…
Reference in New Issue