コード例 #1
0
ファイル: LibretroApi.cs プロジェクト: amsolg/AutoMario
 /// <summary>
 /// Locks a buffer and sets it into libretro. You must pass a delegate to be executed while that buffer is locked.
 /// This is meant to be used for avoiding a memcpy for large roms (which the core is then just going to memcpy again on its own)
 /// The memcpy has to happen at some point (libretro semantics specify [not literally, the docs dont say] that the core should finish using the buffer before its init returns)
 /// but this limits it to once.
 /// Moreover, this keeps the c++ side from having to free strings when they're no longer used (and memory management is trickier there, so we try to avoid it)
 /// </summary>
 public void SetBytes(BufId id, byte[] bytes, Action andThen)
 {
     fixed(byte *bp = bytes)
     {
         _setBuffer(id, bp, (ulong)bytes.Length);
         andThen();
     }
 }
コード例 #2
0
 /// <summary>
 /// see SetBytes
 /// </summary>
 public void SetAscii(BufId id, string str, Action andThen)
 {
     fixed(byte *cp = System.Text.Encoding.ASCII.GetBytes(str + "\0"))
     {
         _setBuffer(id, cp, (ulong)str.Length + 1);
         andThen();
     }
 }
コード例 #3
0
ファイル: LibretroApi.cs プロジェクト: mzaman07/BizHawk
 /// <summary>
 /// Copy a buffer into libretro. It keeps the copy.
 /// </summary>
 public void CopyBytes(BufId id, byte[] bytes)
 {
     fixed(byte *bp = bytes)
     _copyBuffer(id, bp, (ulong)bytes.Length);
 }
コード例 #4
0
ファイル: LibretroApi.cs プロジェクト: mzaman07/BizHawk
 /// <summary>
 /// Copy an ascii string into libretro. It keeps the copy.
 /// </summary>
 public void CopyAscii(BufId id, string str)
 {
     fixed(char *cp = str)
     _copyBuffer(id, cp, (ulong)str.Length + 1);
 }