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];
|
s.DispBackground = luaParam[1];
|
||||||
nes.PutSettings(s);
|
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
|
// this core doesn't support disabling BG
|
||||||
bool showsp = GetSetting(0, luaParam);
|
bool showSp = GetSetting(0, luaParam);
|
||||||
if (showsp && s.NumSprites == 0)
|
if (showSp && s.NumSprites == 0)
|
||||||
{
|
{
|
||||||
s.NumSprites = 8;
|
s.NumSprites = 8;
|
||||||
}
|
}
|
||||||
else if (!showsp && s.NumSprites > 0)
|
else if (!showSp && s.NumSprites > 0)
|
||||||
{
|
{
|
||||||
s.NumSprites = 0;
|
s.NumSprites = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
quickNes.PutSettings(s);
|
quicknes.PutSettings(s);
|
||||||
}
|
}
|
||||||
else if (Emulator is PCEngine pce)
|
else if (Emulator is PCEngine pce)
|
||||||
{
|
{
|
||||||
|
@ -426,12 +426,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
private static bool GetSetting(int index, bool[] settings)
|
private static bool GetSetting(int index, bool[] settings)
|
||||||
{
|
{
|
||||||
if (index < settings.Length)
|
return index >= settings.Length || settings[index];
|
||||||
{
|
|
||||||
return settings[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,22 +12,12 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public string GetRomName()
|
public string GetRomName()
|
||||||
{
|
{
|
||||||
if (Global.Game != null)
|
return Global.Game?.Name ?? "";
|
||||||
{
|
|
||||||
return Global.Game.Name ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetRomHash()
|
public string GetRomHash()
|
||||||
{
|
{
|
||||||
if (Global.Game != null)
|
return Global.Game?.Hash ?? "";
|
||||||
{
|
|
||||||
return Global.Game.Hash ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool InDatabase()
|
public bool InDatabase()
|
||||||
|
@ -42,22 +32,12 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public string GetStatus()
|
public string GetStatus()
|
||||||
{
|
{
|
||||||
if (Global.Game != null)
|
return Global.Game?.Status.ToString();
|
||||||
{
|
|
||||||
return Global.Game.Status.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsStatusBad()
|
public bool IsStatusBad()
|
||||||
{
|
{
|
||||||
if (Global.Game != null)
|
return Global.Game?.IsRomStatusBad() ?? true;
|
||||||
{
|
|
||||||
return Global.Game.IsRomStatusBad();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetBoardType()
|
public string GetBoardType()
|
||||||
|
|
|
@ -95,8 +95,8 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var movie = Global.MovieSession.Movie;
|
var movie = Global.MovieSession.Movie;
|
||||||
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
|
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
|
||||||
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) &&
|
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL)
|
||||||
movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
&& movie.HeaderEntries[HeaderKeys.PAL] == "1";
|
||||||
|
|
||||||
return new PlatformFrameRates()[system, pal];
|
return new PlatformFrameRates()[system, pal];
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
DataSource = name,
|
DataSource = name,
|
||||||
Version = 3,
|
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
|
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.
|
SyncMode = SynchronizationModes.Off // This shortens the delay for do synchronous calls.
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,11 +44,11 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var connBuilder = new SQLiteConnectionStringBuilder
|
var connBuilder = new SQLiteConnectionStringBuilder
|
||||||
{
|
{
|
||||||
DataSource = name
|
DataSource = name,
|
||||||
, Version = 3 // SQLite version
|
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
|
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.
|
SyncMode = SynchronizationModes.Off, // This shortens the delay for do synchronous calls.
|
||||||
};
|
};
|
||||||
|
|
||||||
_mDBConnection = new SQLiteConnection(connBuilder.ToString());
|
_mDBConnection = new SQLiteConnection(connBuilder.ToString());
|
||||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common
|
||||||
var table = Lua.NewTable();
|
var table = Lua.NewTable();
|
||||||
_mDBConnection.Open();
|
_mDBConnection.Open();
|
||||||
string sql = $"PRAGMA read_uncommitted =1;{query}";
|
string sql = $"PRAGMA read_uncommitted =1;{query}";
|
||||||
var command = new SQLiteCommand(sql, _mDBConnection);
|
using var command = new SQLiteCommand(sql, _mDBConnection);
|
||||||
SQLiteDataReader reader = command.ExecuteReader();
|
SQLiteDataReader reader = command.ExecuteReader();
|
||||||
bool rows = reader.HasRows;
|
bool rows = reader.HasRows;
|
||||||
long rowCount = 0;
|
long rowCount = 0;
|
||||||
|
|
Loading…
Reference in New Issue