Fix style problems, mainly docs
This commit is contained in:
parent
b0f38a4d91
commit
ca646f87cf
|
@ -542,6 +542,9 @@
|
|||
<!-- Element return value documentation should have text -->
|
||||
<Rule Id="SA1616" Action="Hidden" />
|
||||
|
||||
<!-- Generic type parameter documentation should have text -->
|
||||
<Rule Id="SA1622" Action="Hidden" />
|
||||
|
||||
<!-- Property summary documentation should match accessors -->
|
||||
<Rule Id="SA1623" Action="Hidden" />
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class PlatformFrameRates
|
||||
public static class PlatformFrameRates
|
||||
{
|
||||
// these are political numbers, designed to be in accord with tasvideos.org tradition. they're not necessarily mathematical factualities (although they may be in some cases)
|
||||
// it would be nice if we could turn this into a rational expression natively, and also, to write some comments about the derivation and ideal values (since this seems to be where they're all collected)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Common
|
|||
void Write (ReadOnlySpan<byte> buffer);
|
||||
int Read (Span<byte> buffer);
|
||||
}
|
||||
public class SpanStream
|
||||
public static class SpanStream
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a stream in spanstream mode, or creates a wrapper that provides that functionality
|
||||
|
|
|
@ -30,26 +30,47 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class MemoryLayoutTemplate
|
||||
{
|
||||
/// <summary>
|
||||
/// Memory space to serve brk(2)
|
||||
/// </summary>
|
||||
public UIntPtr sbrk_size;
|
||||
|
||||
/// <summary>
|
||||
/// Memory space to serve alloc_sealed(3)
|
||||
/// </summary>
|
||||
public UIntPtr sealed_size;
|
||||
|
||||
/// <summary>
|
||||
/// Memory space to serve alloc_invisible(3)
|
||||
/// </summary>
|
||||
public UIntPtr invis_size;
|
||||
|
||||
/// <summary>
|
||||
/// Memory space to serve alloc_plain(3)
|
||||
/// </summary>
|
||||
public UIntPtr plain_size;
|
||||
|
||||
/// <summary>
|
||||
/// Memory space to serve mmap(2) and friends.
|
||||
/// Calls without MAP_FIXED or MREMAP_FIXED will be placed in this area.
|
||||
/// TODO: Are we allowing fixed calls to happen anywhere in the block?
|
||||
/// </summary>
|
||||
public UIntPtr mmap_size;
|
||||
}
|
||||
/// Read bytes into the buffer. Return number of bytes read on success, or < 0 on failure.
|
||||
|
||||
/// <summary>
|
||||
/// Read bytes into the buffer. Return number of bytes read on success, or < 0 on failure.
|
||||
/// permitted to read less than the provided buffer size, but must always read at least 1
|
||||
/// byte if EOF is not reached. If EOF is reached, should return 0.
|
||||
/// </summary>
|
||||
public delegate IntPtr ReadCallback(IntPtr userdata, IntPtr /*byte**/ data, UIntPtr size);
|
||||
/// write bytes. Return 0 on success, or < 0 on failure.
|
||||
|
||||
/// <summary>
|
||||
/// write bytes. Return 0 on success, or < 0 on failure.
|
||||
/// Must write all provided bytes in one call or fail, not permitted to write less (unlike reader).
|
||||
/// </summary>
|
||||
public delegate int WriteCallback(IntPtr userdata, IntPtr /*byte**/ data, UIntPtr size);
|
||||
|
||||
// public delegate UIntPtr /*MissingFileResult*/ FileCallback(IntPtr userdata, UIntPtr /*string*/ name);
|
||||
|
||||
public static WriteCallback MakeCallbackForWriter(Stream s)
|
||||
|
@ -98,59 +119,96 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
// public bool writable;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Given a guest executable and a memory layout, create a new host environment. All data will be immediately consumed from the reader,
|
||||
/// which will not be used after this call.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_create_host(MemoryLayoutTemplate layout, string moduleName, ReadCallback wbx, IntPtr userdata, ReturnData /*WaterboxHost*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Tear down a host environment. May not be called while the environment is active.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_destroy_host(IntPtr /*WaterboxHost*/ obj, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Activate a host environment. This swaps it into memory and makes it available for use.
|
||||
/// Pointers to inside the environment are only valid while active. Uses a mutex internally
|
||||
/// so as to not stomp over other host environments in the same 4GiB slice.
|
||||
/// Returns a pointer to the activated object, used to do most other functions.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_activate_host(IntPtr /*WaterboxHost*/ obj, ReturnData /*ActivatedWaterboxHost*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates a host environment, and releases the mutex.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_deactivate_host(IntPtr /*ActivatedWaterboxHost*/ obj, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the address of an exported function from the guest executable. This pointer is only valid
|
||||
/// while the host is active. A missing proc is not an error and simply returns 0.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_get_proc_addr(IntPtr /*ActivatedWaterboxHost*/ obj, string name, ReturnData /*UIntPtr*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Calls the seal operation, which is a one time action that prepares the host to save states.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_seal(IntPtr /*ActivatedWaterboxHost*/ obj, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Mounts a file in the environment. All data will be immediately consumed from the reader, which will not be used after this call.
|
||||
/// To prevent nondeterminism, adding and removing files is very limited WRT savestates. If a file is writable, it must never exist
|
||||
/// when save_state is called, and can only be used for transient operations. If a file is readable, it can appear in savestates,
|
||||
/// but it must exist in every savestate and the exact sequence of add_file calls must be consistent from savestate to savestate.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_mount_file(IntPtr /*ActivatedWaterboxHost*/ obj, string name, ReadCallback reader, IntPtr userdata, bool writable, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a file previously added. Writer is optional; if provided, the contents of the file at time of removal will be dumped to it.
|
||||
/// It is an error to remove a file which is currently open in the guest.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_unmount_file(IntPtr /*ActivatedWaterboxHost*/ obj, string name, WriteCallback writer, IntPtr userdata, ReturnData /*void*/ ret);
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Set (or clear, with None) a callback to be called whenever the guest tries to load a nonexistant file.
|
||||
/// The callback will be provided with the name of the requested load, and can either return null to signal the waterbox
|
||||
/// to return ENOENT to the guest, or a struct to immediately load that file. You may not call any wbx methods
|
||||
/// in the callback. If the MissingFileResult is provided, it will be consumed immediately and will have the same effect
|
||||
/// as wbx_mount_file(). You may free resources associated with the MissingFileResult whenever control next returns to your code.
|
||||
// [BizImport(CallingConvention.Cdecl)]
|
||||
// public abstract void wbx_set_missing_file_callback(IntPtr /*ActivatedWaterboxHost*/ obj, MissingFileCallback mfc_o);
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_set_missing_file_callback(IntPtr /*ActivatedWaterboxHost*/ obj, MissingFileCallback mfc_o);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Save state. Must not be called before seal. Must not be called with any writable files mounted.
|
||||
/// Must always be called with the same sequence and contents of readonly files.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_save_state(IntPtr /*ActivatedWaterboxHost*/ obj, WriteCallback writer, IntPtr userdata, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Load state. Must not be called before seal. Must not be called with any writable files mounted.
|
||||
/// Must always be called with the same sequence and contents of readonly files that were in the save state.
|
||||
/// Must be called with the same wbx executable and memory layout as in the savestate.
|
||||
/// Errors generally poison the environment; sorry!
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_load_state(IntPtr /*ActivatedWaterboxHost*/ obj, ReadCallback reader, IntPtr userdata, ReturnData /*void*/ ret);
|
||||
|
||||
/// <summary>
|
||||
/// Control whether the host automatically evicts blocks from memory when they are not active. For the best performance,
|
||||
/// this should be set to false. Set to true to help catch dangling pointer issues. Will be ignored (and forced to true)
|
||||
/// if waterboxhost was built in debug mode. This is a single global setting.
|
||||
/// </summary>
|
||||
[BizImport(CallingConvention.Cdecl)]
|
||||
public abstract void wbx_set_always_evict_blocks(bool val);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue