1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Core - Don't fail entire frame on plugin fail

This commit is contained in:
Robert 2021-05-07 23:58:19 +02:00
parent bb28f2db16
commit f2c0d63a49

View File

@ -119,11 +119,24 @@ namespace Artemis.Core.Services
try try
{ {
_frameStopWatch.Restart(); _frameStopWatch.Restart();
// Render all active modules
SKTexture texture = _rgbService.OpenRender();
lock (_dataModelExpansions) lock (_dataModelExpansions)
{ {
// Update all active modules, check Enabled status because it may go false before before the _dataModelExpansions list is updated // Update all active modules, check Enabled status because it may go false before before the _dataModelExpansions list is updated
foreach (BaseDataModelExpansion dataModelExpansion in _dataModelExpansions.Where(e => e.IsEnabled)) foreach (BaseDataModelExpansion dataModelExpansion in _dataModelExpansions.Where(e => e.IsEnabled))
dataModelExpansion.InternalUpdate(args.DeltaTime); {
try
{
dataModelExpansion.InternalUpdate(args.DeltaTime);
}
catch (Exception e)
{
_updateExceptions.Add(e);
}
}
} }
List<Module> modules; List<Module> modules;
@ -137,10 +150,16 @@ namespace Artemis.Core.Services
// Update all active modules // Update all active modules
foreach (Module module in modules) foreach (Module module in modules)
module.InternalUpdate(args.DeltaTime); {
try
// Render all active modules {
SKTexture texture = _rgbService.OpenRender(); module.InternalUpdate(args.DeltaTime);
}
catch (Exception e)
{
_updateExceptions.Add(e);
}
}
SKCanvas canvas = texture.Surface.Canvas; SKCanvas canvas = texture.Surface.Canvas;
canvas.Save(); canvas.Save();
@ -152,7 +171,16 @@ namespace Artemis.Core.Services
if (!ModuleRenderingDisabled) if (!ModuleRenderingDisabled)
{ {
foreach (Module module in modules.Where(m => m.IsActivated)) foreach (Module module in modules.Where(m => m.IsActivated))
module.InternalRender(args.DeltaTime, canvas, texture.ImageInfo); {
try
{
module.InternalRender(args.DeltaTime, canvas, texture.ImageInfo);
}
catch (Exception e)
{
_updateExceptions.Add(e);
}
}
} }
OnFrameRendering(new FrameRenderingEventArgs(canvas, args.DeltaTime, _rgbService.Surface)); OnFrameRendering(new FrameRenderingEventArgs(canvas, args.DeltaTime, _rgbService.Surface));