From a8408ed3bec6e16ab4731b40778e7b64e34d9d36 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 1 Jan 2020 08:24:46 +1000 Subject: [PATCH] Improve exception docs in BizHawk.Client.Common --- BizHawk.Client.Common/Api/Classes/MemApi.cs | 1 + BizHawk.Client.Common/Api/Classes/UserDataApi.cs | 1 + BizHawk.Client.Common/BinarySaveStates.cs | 12 ++++++------ BizHawk.Client.Common/ControllerBinding.cs | 1 + BizHawk.Client.Common/CoreFileProvider.cs | 3 +++ BizHawk.Client.Common/FrameworkFastZipWriter.cs | 1 + BizHawk.Client.Common/QuickBmpFile.cs | 4 ++++ BizHawk.Client.Common/RomGame.cs | 1 + BizHawk.Client.Common/XmlGame.cs | 1 + BizHawk.Client.Common/config/ConfigService.cs | 1 + BizHawk.Client.Common/config/ToolDialogSettings.cs | 7 ++----- .../inputAdapters/OverrideAdaptor.cs | 1 + BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs | 11 +++++++++++ BizHawk.Client.Common/lua/LuaLibraryBase.cs | 1 + BizHawk.Client.Common/lua/LuaSandbox.cs | 1 + BizHawk.Client.Common/miniz/MinizZipWriter.cs | 2 ++ BizHawk.Client.Common/movie/MovieSession.cs | 1 + BizHawk.Client.Common/movie/bk2/StringLogs.cs | 3 +++ BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 2 ++ .../movie/tasproj/TasStateManager.cs | 1 + BizHawk.Client.Common/rewind/StreamBlobDatabase.cs | 3 +++ BizHawk.Client.Common/tools/CheatList.cs | 1 + BizHawk.Client.Common/tools/RamSearchEngine.cs | 2 ++ BizHawk.Client.Common/tools/Watch/Watch.cs | 5 ++--- .../tools/Watch/WatchList/WatchList.cs | 5 ----- 25 files changed, 53 insertions(+), 19 deletions(-) diff --git a/BizHawk.Client.Common/Api/Classes/MemApi.cs b/BizHawk.Client.Common/Api/Classes/MemApi.cs index 8f775bc657..9b09842187 100644 --- a/BizHawk.Client.Common/Api/Classes/MemApi.cs +++ b/BizHawk.Client.Common/Api/Classes/MemApi.cs @@ -190,6 +190,7 @@ namespace BizHawk.Client.Common return false; } + /// range defined by and extends beyond the bound of (or if null) public string HashRegion(long addr, int count, string domain = null) { var d = NamedDomainOrCurrent(domain); diff --git a/BizHawk.Client.Common/Api/Classes/UserDataApi.cs b/BizHawk.Client.Common/Api/Classes/UserDataApi.cs index 9bff930198..ee9ae3b7e8 100644 --- a/BizHawk.Client.Common/Api/Classes/UserDataApi.cs +++ b/BizHawk.Client.Common/Api/Classes/UserDataApi.cs @@ -4,6 +4,7 @@ namespace BizHawk.Client.Common { public sealed class UserDataApi : IUserData { + /// type of cannot be used in userdata public void Set(string name, object value) { if (value != null) diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index 5753863d91..bbb944ac2b 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -235,13 +235,11 @@ namespace BizHawk.Client.Common } } - /// - /// Gets a lump - /// - /// lump to retriever - /// true to throw exception on failure + /// lump to retrieve + /// pass true to throw exception instead of returning false /// function to call with the desired stream - /// true if callback was called and stream was loaded + /// true iff stream was loaded + /// stream not found and is public bool GetLump(BinaryStateLump lump, bool abort, Action callback) { ZipEntry e; @@ -290,6 +288,7 @@ namespace BizHawk.Client.Common }); } + /// couldn't find Binary or Text savestate public void GetCoreState(Action callbackBinary, Action callbackText) { if (!GetLump(BinaryStateLump.Corestate, false, callbackBinary) @@ -299,6 +298,7 @@ namespace BizHawk.Client.Common } } + /// couldn't find Binary or Text savestate public void GetCoreState(Action callbackBinary, Action callbackText) { if (!GetLump(BinaryStateLump.Corestate, false, callbackBinary) diff --git a/BizHawk.Client.Common/ControllerBinding.cs b/BizHawk.Client.Common/ControllerBinding.cs index fc322b4a66..e57012ee4d 100644 --- a/BizHawk.Client.Common/ControllerBinding.cs +++ b/BizHawk.Client.Common/ControllerBinding.cs @@ -265,6 +265,7 @@ namespace BizHawk.Client.Common _buttonStarts.Clear(); } + /// always public float GetFloat(string name) { throw new NotImplementedException(); diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index 9dbaad2a94..a68a8a91f8 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -59,6 +59,7 @@ namespace BizHawk.Client.Common } } + /// not found and is true public string GetFirmwarePath(string sysId, string firmwareId, bool required, string msg = null) { var path = FirmwareManager.Request(sysId, firmwareId); @@ -99,12 +100,14 @@ namespace BizHawk.Client.Common return ret; } + /// not found and is true public byte[] GetFirmware(string sysId, string firmwareId, bool required, string msg = null) { string unused; return GetFirmwareWithPath(sysId, firmwareId, required, msg, out unused); } + /// not found and is true public byte[] GetFirmwareWithGameInfo(string sysId, string firmwareId, bool required, out GameInfo gi, string msg = null) { byte[] ret = GetFirmwareWithPath(sysId, firmwareId, required, msg, out var path); diff --git a/BizHawk.Client.Common/FrameworkFastZipWriter.cs b/BizHawk.Client.Common/FrameworkFastZipWriter.cs index 8612b66b44..b7317afc50 100644 --- a/BizHawk.Client.Common/FrameworkFastZipWriter.cs +++ b/BizHawk.Client.Common/FrameworkFastZipWriter.cs @@ -130,6 +130,7 @@ namespace BizHawk.Client.Common } } + /// is 0 public FrameworkFastZipWriter(string path, int compressionlevel) { _output = new FileStream(path, FileMode.Create, FileAccess.Write); diff --git a/BizHawk.Client.Common/QuickBmpFile.cs b/BizHawk.Client.Common/QuickBmpFile.cs index 8ddfb906b9..e3d25fb772 100644 --- a/BizHawk.Client.Common/QuickBmpFile.cs +++ b/BizHawk.Client.Common/QuickBmpFile.cs @@ -29,6 +29,7 @@ namespace BizHawk.Client.Common bfSize = (uint)Marshal.SizeOf(this); } + /// misformatted data public static BITMAPFILEHEADER FromStream(Stream s) { var ret = GetObject(s); @@ -62,6 +63,7 @@ namespace BizHawk.Client.Common biSize = (uint)Marshal.SizeOf(this); } + /// misformatted data public static BITMAPINFOHEADER FromStream(Stream s) { var ret = GetObject(s); @@ -231,11 +233,13 @@ namespace BizHawk.Client.Common public int BufferHeight { get; set; } public int BackgroundColor => unchecked((int)0xff000000); + /// always public int VsyncNumerator { get { throw new InvalidOperationException(); } } + /// always public int VsyncDenominator { get { throw new InvalidOperationException(); } diff --git a/BizHawk.Client.Common/RomGame.cs b/BizHawk.Client.Common/RomGame.cs index 78f1aeec6a..51cc595c0c 100644 --- a/BizHawk.Client.Common/RomGame.cs +++ b/BizHawk.Client.Common/RomGame.cs @@ -25,6 +25,7 @@ namespace BizHawk.Client.Common { } + /// does not exist public RomGame(HawkFile file, string patch) { if (!file.Exists) diff --git a/BizHawk.Client.Common/XmlGame.cs b/BizHawk.Client.Common/XmlGame.cs index 483fd9b6e7..a9fb8b8969 100644 --- a/BizHawk.Client.Common/XmlGame.cs +++ b/BizHawk.Client.Common/XmlGame.cs @@ -18,6 +18,7 @@ namespace BizHawk.Client.Common public IList> Assets { get; } = new List>(); public IList AssetFullPaths { get; } = new List(); // TODO: Hack work around, to avoid having to refactor Assets into a object array, should be refactored! + /// internal error public static XmlGame Create(HawkFile f) { try diff --git a/BizHawk.Client.Common/config/ConfigService.cs b/BizHawk.Client.Common/config/ConfigService.cs index babcec000c..ebea720774 100644 --- a/BizHawk.Client.Common/config/ConfigService.cs +++ b/BizHawk.Client.Common/config/ConfigService.cs @@ -30,6 +30,7 @@ namespace BizHawk.Client.Common }; } + /// internal error public static T Load(string filepath) where T : new() { T config = default(T); diff --git a/BizHawk.Client.Common/config/ToolDialogSettings.cs b/BizHawk.Client.Common/config/ToolDialogSettings.cs index e59b8e4b04..5635960e79 100644 --- a/BizHawk.Client.Common/config/ToolDialogSettings.cs +++ b/BizHawk.Client.Common/config/ToolDialogSettings.cs @@ -64,11 +64,8 @@ namespace BizHawk.Client.Common } } - /// - /// Gets a value that represents the top left corner coordinate, if and form a valid point - /// Throws an InvalidOperationException if or is null - /// It is expected to check for this before using this property - /// + /// the top-left corner of the , equivalent to the combined values of and + /// either or is null (it is expected to check for this before using this property) [JsonIgnore] public Point TopLeft { diff --git a/BizHawk.Client.Common/inputAdapters/OverrideAdaptor.cs b/BizHawk.Client.Common/inputAdapters/OverrideAdaptor.cs index 2fc25a4ad8..190563209f 100644 --- a/BizHawk.Client.Common/inputAdapters/OverrideAdaptor.cs +++ b/BizHawk.Client.Common/inputAdapters/OverrideAdaptor.cs @@ -17,6 +17,7 @@ namespace BizHawk.Client.Common private readonly Dictionary _floatOverrides = new Dictionary(); private readonly List _inverses = new List(); + /// not overridden public bool IsPressed(string button) { if (_overrides.ContainsKey(button)) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs index bc9ed96f4f..e336173f62 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs @@ -60,6 +60,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("if ( nes.getallowmorethaneightsprites( ) ) then\r\n\tconsole.log( \"Gets the NES setting 'Allow more than 8 sprites per scanline' value\" );\r\nend;")] [LuaMethod("getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")] public bool GetAllowMoreThanEightSprites() => Settings switch @@ -69,6 +70,7 @@ namespace BizHawk.Client.Common _ => throw new InvalidOperationException() }; + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("local innesget = nes.getbottomscanline( false );")] [LuaMethod("getbottomscanline", "Gets the current value for the bottom scanline value")] public int GetBottomScanline(bool pal = false) => Settings switch @@ -78,6 +80,7 @@ namespace BizHawk.Client.Common _ => throw new InvalidOperationException() }; + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("if ( nes.getclipleftandright( ) ) then\r\n\tconsole.log( \"Gets the current value for the Clip Left and Right sides option\" );\r\nend;")] [LuaMethod("getclipleftandright", "Gets the current value for the Clip Left and Right sides option")] public bool GetClipLeftAndRight() => Settings switch @@ -87,6 +90,7 @@ namespace BizHawk.Client.Common _ => throw new InvalidOperationException() }; + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("if ( nes.getdispbackground( ) ) then\r\n\tconsole.log( \"Indicates whether or not the bg layer is being displayed\" );\r\nend;")] [LuaMethod("getdispbackground", "Indicates whether or not the bg layer is being displayed")] public bool GetDisplayBackground() => Settings switch @@ -96,6 +100,7 @@ namespace BizHawk.Client.Common _ => throw new InvalidOperationException() }; + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("if ( nes.getdispsprites( ) ) then\r\n\tconsole.log( \"Indicates whether or not sprites are being displayed\" );\r\nend;")] [LuaMethod("getdispsprites", "Indicates whether or not sprites are being displayed")] public bool GetDisplaySprites() => Settings switch @@ -105,6 +110,7 @@ namespace BizHawk.Client.Common _ => throw new InvalidOperationException() }; + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("local innesget = nes.gettopscanline(false);")] [LuaMethod("gettopscanline", "Gets the current value for the top scanline value")] public int GetTopScanline(bool pal = false) => Settings switch @@ -126,6 +132,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("nes.setallowmorethaneightsprites( true );")] [LuaMethod("setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")] public void SetAllowMoreThanEightSprites(bool allow) @@ -145,6 +152,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("nes.setclipleftandright( true );")] [LuaMethod("setclipleftandright", "Sets the Clip Left and Right sides option")] public void SetClipLeftAndRight(bool leftandright) @@ -164,6 +172,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("nes.setdispbackground( true );")] [LuaMethod("setdispbackground", "Sets whether or not the background layer will be displayed")] public void SetDisplayBackground(bool show) @@ -181,6 +190,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("nes.setdispsprites( true );")] [LuaMethod("setdispsprites", "Sets whether or not sprites will be displayed")] public void SetDisplaySprites(bool show) @@ -200,6 +210,7 @@ namespace BizHawk.Client.Common } } + /// loaded core is not NESHawk or QuickNes [LuaMethodExample("nes.setscanlines( 10, 20, false );")] [LuaMethod("setscanlines", "sets the top and bottom scanlines to be drawn (same values as in the graphics options dialog). Top must be in the range of 0 to 127, bottom must be between 128 and 239. Not supported in the Quick Nes core")] public void SetScanlines(int top, int bottom, bool pal = false) diff --git a/BizHawk.Client.Common/lua/LuaLibraryBase.cs b/BizHawk.Client.Common/lua/LuaLibraryBase.cs index 8538e26e33..6ecf3baec4 100644 --- a/BizHawk.Client.Common/lua/LuaLibraryBase.cs +++ b/BizHawk.Client.Common/lua/LuaLibraryBase.cs @@ -38,6 +38,7 @@ namespace BizHawk.Client.Common } } + /// attempted to have Lua running in two host threads at once public static void SetCurrentThread(LuaFile luaFile) { lock (ThreadMutex) diff --git a/BizHawk.Client.Common/lua/LuaSandbox.cs b/BizHawk.Client.Common/lua/LuaSandbox.cs index ccf28bc50e..315360d3ee 100644 --- a/BizHawk.Client.Common/lua/LuaSandbox.cs +++ b/BizHawk.Client.Common/lua/LuaSandbox.cs @@ -101,6 +101,7 @@ namespace BizHawk.Client.Common return sandbox; } + /// could not get sandbox reference for thread ( has not been called) public static LuaSandbox GetSandbox(Lua thread) { // this is just placeholder. diff --git a/BizHawk.Client.Common/miniz/MinizZipWriter.cs b/BizHawk.Client.Common/miniz/MinizZipWriter.cs index 19e2c8f672..9b999f25c7 100644 --- a/BizHawk.Client.Common/miniz/MinizZipWriter.cs +++ b/BizHawk.Client.Common/miniz/MinizZipWriter.cs @@ -14,6 +14,7 @@ namespace BizHawk.Client.Common.Miniz private uint _flags; private static readonly byte[] _shitcock = new byte[32 * 1024 * 1024]; + /// unmanaged call failed public MinizZipWriter(string path, int compressionlevel) { _zip = Marshal.AllocHGlobal(128); @@ -54,6 +55,7 @@ namespace BizHawk.Client.Common.Miniz } } + /// unmanaged call failed public void WriteItem(string name, Action callback) { lock (_shitcock) diff --git a/BizHawk.Client.Common/movie/MovieSession.cs b/BizHawk.Client.Common/movie/MovieSession.cs index 68b061b7e9..e150cd917b 100644 --- a/BizHawk.Client.Common/movie/MovieSession.cs +++ b/BizHawk.Client.Common/movie/MovieSession.cs @@ -446,6 +446,7 @@ namespace BizHawk.Client.Common public bool? PreviousSNES_InSnes9x { get; set; } public bool? PreviousGBA_UsemGBA { get; set; } + /// is and . does not match . public void QueueNewMovie(IMovie movie, bool record, IEmulator emulator) { if (!record) // The semantics of record is that we are starting a new movie, and even wiping a pre-existing movie with the same path, but non-record means we are loading an existing movie into playback mode diff --git a/BizHawk.Client.Common/movie/bk2/StringLogs.cs b/BizHawk.Client.Common/movie/bk2/StringLogs.cs index 6478b8a63a..8fb22226e4 100644 --- a/BizHawk.Client.Common/movie/bk2/StringLogs.cs +++ b/BizHawk.Client.Common/movie/bk2/StringLogs.cs @@ -9,7 +9,10 @@ namespace BizHawk.Client.Common public static class StringLogUtil { public static bool DefaultToDisk { get; set; } + public static bool DefaultToAWE { get; set; } + + /// is but not running on Windows host public static IStringLog MakeStringLog() { if (DefaultToDisk) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 766ee99768..a48b546b6a 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -46,6 +46,7 @@ namespace BizHawk.Client.Common WasLagged = TasLagLog.History(index + 1) }; + /// loaded core does not implement public TasMovie(string path, bool startsFromSavestate = false) : base(path) { @@ -66,6 +67,7 @@ namespace BizHawk.Client.Common CurrentBranch = -1; } + /// loaded core does not implement public TasMovie(bool startsFromSavestate = false) { if (!Global.Emulator.HasSavestates()) diff --git a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs index f4b540a689..3516daefd7 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs @@ -33,6 +33,7 @@ namespace BizHawk.Client.Common (int)((ulong)Settings.DiskCapacityMb * 1024 * 1024 / _expectedStateSize); private int FileStateGap => 1 << Settings.FileStateGap; + /// loaded core expects savestate size of 0 B public TasStateManager(TasMovie movie) { _movie = movie; diff --git a/BizHawk.Client.Common/rewind/StreamBlobDatabase.cs b/BizHawk.Client.Common/rewind/StreamBlobDatabase.cs index 46f3e0f7d3..962b12685f 100644 --- a/BizHawk.Client.Common/rewind/StreamBlobDatabase.cs +++ b/BizHawk.Client.Common/rewind/StreamBlobDatabase.cs @@ -186,6 +186,7 @@ namespace BizHawk.Client.Common return _mHead.Value.Index; } + /// empty public ListItem Pop() { if (_mHead == null) @@ -207,6 +208,7 @@ namespace BizHawk.Client.Common return ret; } + /// empty public ListItem Peek() { if (_mHead == null) @@ -217,6 +219,7 @@ namespace BizHawk.Client.Common return _mHead.Value; } + /// empty public ListItem Dequeue() { if (_mTail == null) diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index 8cd1eb4736..98fb330d37 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -109,6 +109,7 @@ namespace BizHawk.Client.Common Changes = false; } + /// is null public void Add(Cheat cheat) { if (cheat is null) diff --git a/BizHawk.Client.Common/tools/RamSearchEngine.cs b/BizHawk.Client.Common/tools/RamSearchEngine.cs index 8291e8fcc9..1b72240ab5 100644 --- a/BizHawk.Client.Common/tools/RamSearchEngine.cs +++ b/BizHawk.Client.Common/tools/RamSearchEngine.cs @@ -223,6 +223,7 @@ namespace BizHawk.Client.Common public MemoryDomain Domain => _settings.Domain; + /// (from setter) is and is not public Compare CompareTo { get => _compareTo; @@ -268,6 +269,7 @@ namespace BizHawk.Client.Common _settings.BigEndian = bigEndian; } + /// is and is public void SetPreviousType(PreviousType type) { if (_settings.Mode == Settings.SearchMode.Fast) diff --git a/BizHawk.Client.Common/tools/Watch/Watch.cs b/BizHawk.Client.Common/tools/Watch/Watch.cs index d549f521fc..b70b7707a8 100644 --- a/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -620,9 +620,8 @@ namespace BizHawk.Client.Common } } - /// - /// Gets the current - /// + /// the domain of + /// (from setter) does not have the same name as this property's value public MemoryDomain Domain { get diff --git a/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs b/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs index 79df2f54b4..6ef180ebd2 100644 --- a/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs +++ b/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs @@ -114,9 +114,6 @@ namespace BizHawk.Client.Common /// /// The one-dimension that will serve as destination to copy /// Zero-based index where the copy should starts - /// - /// - /// public void CopyTo(Watch[] array, int arrayIndex) { _watchList.CopyTo(array, arrayIndex); @@ -158,7 +155,6 @@ namespace BizHawk.Client.Common /// /// The zero-base index where the should be inserted /// to insert - /// public void Insert(int index, Watch watch) { _watchList.Insert(index, watch); @@ -168,7 +164,6 @@ namespace BizHawk.Client.Common /// Removes item at the specified index /// /// Zero-based index of the to remove - /// public void RemoveAt(int index) { _watchList.RemoveAt(index);