mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 10:36:44 +00:00
Moved plugins folder to appdata.
Added config to disable plugins
This commit is contained in:
parent
f7d4b728f5
commit
3326d0e73d
3 changed files with 6 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"EngineMode": 0,
|
||||
"SafeMode": false,
|
||||
"Window": {
|
||||
"Scale": 2
|
||||
},
|
||||
|
|
|
@ -112,7 +112,6 @@ public class Capy64 : Game
|
|||
private readonly InputManager _inputManager;
|
||||
private RenderTarget2D renderTarget;
|
||||
private readonly GraphicsDeviceManager _graphics;
|
||||
private IServiceProvider _serviceProvider;
|
||||
private ulong _totalTicks = 0;
|
||||
private int tickrate = 0;
|
||||
private int everyTick => 60 / tickrate;
|
||||
|
@ -122,7 +121,7 @@ public class Capy64 : Game
|
|||
Instance = this;
|
||||
|
||||
_graphics = new GraphicsDeviceManager(this);
|
||||
Content.RootDirectory = "Content";
|
||||
//Content.RootDirectory = "Content";
|
||||
IsMouseVisible = true;
|
||||
|
||||
EventEmitter = new();
|
||||
|
@ -131,11 +130,6 @@ public class Capy64 : Game
|
|||
Drawing = new();
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public void SetEngineMode(EngineMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
|
@ -265,7 +259,9 @@ public class Capy64 : Game
|
|||
Audio = new Audio();
|
||||
|
||||
NativePlugins = GetNativePlugins();
|
||||
Plugins = PluginLoader.LoadAllPlugins("plugins", _serviceProvider);
|
||||
var safeMode = Configuration.GetValue("SafeMode", false);
|
||||
if (!safeMode)
|
||||
Plugins = PluginLoader.LoadAllPlugins(Path.Combine(AssetsPath, "plugins"));
|
||||
|
||||
EventEmitter.RaiseInit();
|
||||
|
||||
|
@ -284,7 +280,6 @@ public class Capy64 : Game
|
|||
foreach (var type in types)
|
||||
{
|
||||
var instance = (IComponent)Activator.CreateInstance(type, this);
|
||||
//var instance = (IComponent)ActivatorUtilities.CreateInstance(_serviceProvider, type)!;
|
||||
plugins.Add(instance);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ internal class PluginLoader
|
|||
return loadContext.LoadFromAssemblyName(new AssemblyName(Path.GetFileNameWithoutExtension(path)));
|
||||
}
|
||||
|
||||
public static List<IComponent> LoadAllPlugins(string pluginsPath, IServiceProvider provider)
|
||||
public static List<IComponent> LoadAllPlugins(string pluginsPath)
|
||||
{
|
||||
if (!Directory.Exists(pluginsPath))
|
||||
Directory.CreateDirectory(pluginsPath);
|
||||
|
|
Loading…
Reference in a new issue