This commit is contained in:
Alessandro Proto 2023-01-08 00:50:12 +01:00
parent 29c55500bd
commit 8ea43d327b
3 changed files with 7 additions and 12 deletions

View file

@ -23,9 +23,9 @@ namespace Capy64.BIOS;
public class Bios : IPlugin public class Bios : IPlugin
{ {
private static IGame _game; private static IGame _game;
private EventEmitter _eventEmitter; private readonly EventEmitter _eventEmitter;
private RuntimeInputEvents _runtimeInputEvents; private RuntimeInputEvents _runtimeInputEvents;
private Drawing _drawing; private readonly Drawing _drawing;
private static bool CloseRuntime = false; private static bool CloseRuntime = false;
private static bool OpenBios = false; private static bool OpenBios = false;
@ -132,7 +132,7 @@ public class Bios : IPlugin
} }
} }
private void InitLuaPlugins() private static void InitLuaPlugins()
{ {
var allPlugins = new List<IPlugin>(_game.NativePlugins); var allPlugins = new List<IPlugin>(_game.NativePlugins);
allPlugins.AddRange(_game.Plugins); allPlugins.AddRange(_game.Plugins);
@ -142,7 +142,7 @@ public class Bios : IPlugin
} }
} }
public void InstallOS(bool force = false) public static void InstallOS(bool force = false)
{ {
var installedFilePath = Path.Combine(FileSystem.BasePath, ".installed"); var installedFilePath = Path.Combine(FileSystem.BasePath, ".installed");
if (!File.Exists(installedFilePath) || force) if (!File.Exists(installedFilePath) || force)

View file

@ -9,7 +9,6 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Capy64.LuaRuntime.Extensions; namespace Capy64.LuaRuntime.Extensions;
public static class Utils public static class Utils
{ {
public static void PushArray(this Lua state, object obj) public static void PushArray(this Lua state, object obj)
@ -25,10 +24,10 @@ public static class Utils
} }
state.SetTop(-1); state.SetTop(-1);
} }
#nullable enable
public static int PushValue(this Lua state, object? obj) public static int PushValue(this Lua state, object? obj)
{ {
var type = obj.GetType(); var type = obj?.GetType();
switch (obj) switch (obj)
{ {
case string str: case string str:
@ -74,7 +73,7 @@ public static class Utils
break; break;
default: default:
if (type.IsArray) if (type is not null && type.IsArray)
{ {
state.PushArray(obj); state.PushArray(obj);
} }

View file

@ -14,10 +14,6 @@ namespace Capy64.LuaRuntime;
internal class Sandbox internal class Sandbox
{ {
private struct CallData
{
public int Delta;
}
internal static void OpenLibraries(Lua L) internal static void OpenLibraries(Lua L)
{ {
L.OpenBase(); L.OpenBase();