Mirror cleanup from 7aa170283
onto the C# APIs
also fixed VS' stupid comma placement and added a "using" in SqlLuaLibrary
This commit is contained in:
parent
7aa170283e
commit
8ce403dab2
|
@ -377,22 +377,22 @@ namespace BizHawk.Client.Common
|
|||
s.DispBackground = luaParam[1];
|
||||
nes.PutSettings(s);
|
||||
}
|
||||
else if (Emulator is QuickNES quickNes)
|
||||
else if (Emulator is QuickNES quicknes)
|
||||
{
|
||||
var s = quickNes.GetSettings();
|
||||
var s = quicknes.GetSettings();
|
||||
|
||||
// this core doesn't support disabling BG
|
||||
bool showsp = GetSetting(0, luaParam);
|
||||
if (showsp && s.NumSprites == 0)
|
||||
bool showSp = GetSetting(0, luaParam);
|
||||
if (showSp && s.NumSprites == 0)
|
||||
{
|
||||
s.NumSprites = 8;
|
||||
}
|
||||
else if (!showsp && s.NumSprites > 0)
|
||||
else if (!showSp && s.NumSprites > 0)
|
||||
{
|
||||
s.NumSprites = 0;
|
||||
}
|
||||
|
||||
quickNes.PutSettings(s);
|
||||
quicknes.PutSettings(s);
|
||||
}
|
||||
else if (Emulator is PCEngine pce)
|
||||
{
|
||||
|
@ -426,12 +426,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private static bool GetSetting(int index, bool[] settings)
|
||||
{
|
||||
if (index < settings.Length)
|
||||
{
|
||||
return settings[index];
|
||||
}
|
||||
|
||||
return true;
|
||||
return index >= settings.Length || settings[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,22 +12,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string GetRomName()
|
||||
{
|
||||
if (Global.Game != null)
|
||||
{
|
||||
return Global.Game.Name ?? "";
|
||||
}
|
||||
|
||||
return "";
|
||||
return Global.Game?.Name ?? "";
|
||||
}
|
||||
|
||||
public string GetRomHash()
|
||||
{
|
||||
if (Global.Game != null)
|
||||
{
|
||||
return Global.Game.Hash ?? "";
|
||||
}
|
||||
|
||||
return "";
|
||||
return Global.Game?.Hash ?? "";
|
||||
}
|
||||
|
||||
public bool InDatabase()
|
||||
|
@ -42,22 +32,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string GetStatus()
|
||||
{
|
||||
if (Global.Game != null)
|
||||
{
|
||||
return Global.Game.Status.ToString();
|
||||
}
|
||||
|
||||
return "";
|
||||
return Global.Game?.Status.ToString();
|
||||
}
|
||||
|
||||
public bool IsStatusBad()
|
||||
{
|
||||
if (Global.Game != null)
|
||||
{
|
||||
return Global.Game.IsRomStatusBad();
|
||||
}
|
||||
|
||||
return true;
|
||||
return Global.Game?.IsRomStatusBad() ?? true;
|
||||
}
|
||||
|
||||
public string GetBoardType()
|
||||
|
|
|
@ -95,8 +95,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var movie = Global.MovieSession.Movie;
|
||||
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
|
||||
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) &&
|
||||
movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
||||
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL)
|
||||
&& movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
||||
|
||||
return new PlatformFrameRates()[system, pal];
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
DataSource = name,
|
||||
Version = 3,
|
||||
JournalMode = SQLiteJournalModeEnum.Wal, // Allows for reads and writes to happen at the same time
|
||||
JournalMode = SQLiteJournalModeEnum.Wal, // Allows for reads and writes to happen at the same time
|
||||
DefaultIsolationLevel = System.Data.IsolationLevel.ReadCommitted, // This only helps make the database lock left. May be pointless now
|
||||
SyncMode = SynchronizationModes.Off // This shortens the delay for do synchronous calls.
|
||||
};
|
||||
|
|
|
@ -44,11 +44,11 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var connBuilder = new SQLiteConnectionStringBuilder
|
||||
{
|
||||
DataSource = name
|
||||
, Version = 3 // SQLite version
|
||||
, JournalMode = SQLiteJournalModeEnum.Wal // Allows for reads and writes to happen at the same time
|
||||
, DefaultIsolationLevel = System.Data.IsolationLevel.ReadCommitted // This only helps make the database lock left. May be pointless now
|
||||
, SyncMode = SynchronizationModes.Off // This shortens the delay for do synchronous calls.
|
||||
DataSource = name,
|
||||
Version = 3,
|
||||
JournalMode = SQLiteJournalModeEnum.Wal, // Allows for reads and writes to happen at the same time
|
||||
DefaultIsolationLevel = System.Data.IsolationLevel.ReadCommitted, // This only helps make the database lock left. May be pointless now
|
||||
SyncMode = SynchronizationModes.Off, // This shortens the delay for do synchronous calls.
|
||||
};
|
||||
|
||||
_mDBConnection = new SQLiteConnection(connBuilder.ToString());
|
||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common
|
|||
var table = Lua.NewTable();
|
||||
_mDBConnection.Open();
|
||||
string sql = $"PRAGMA read_uncommitted =1;{query}";
|
||||
var command = new SQLiteCommand(sql, _mDBConnection);
|
||||
using var command = new SQLiteCommand(sql, _mDBConnection);
|
||||
SQLiteDataReader reader = command.ExecuteReader();
|
||||
bool rows = reader.HasRows;
|
||||
long rowCount = 0;
|
||||
|
|
Loading…
Reference in New Issue