Skip to content

Commit

Permalink
chore: Merge branch 'master' into branch
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
  • Loading branch information
maximilien-noal committed Nov 11, 2024
2 parents 9e57156 + a5a6dae commit 62f448a
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 313 deletions.
3 changes: 0 additions & 3 deletions src/Bufdio.Spice86/Bufdio.Spice86.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<RootNamespace>Bufdio.Spice86</RootNamespace>
<Copyright>Luthfi Tri Atmaja</Copyright>
<Description>Only for Spice86 usage. A cross platform audio playback library for .NET based on PortAudio, forked from the original Bufdio by Luthfi Tri Atmaja.</Description>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
<!-- Properties geared towards NuGet -->
<PropertyGroup>
Expand Down
29 changes: 6 additions & 23 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.2.25">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.12.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SerilogAnalyzer" Version="0.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
</Project>
56 changes: 56 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<NoWarn>$(NoWarn);NU1507</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="11.2.0" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.0" />
<PackageVersion Include="Avalonia.Controls.PanAndZoom" Version="11.2.0" />
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.0" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.1.4" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.0" />
<PackageVersion Include="Avalonia.Xaml.Behaviors" Version="11.2.0" />
<PackageVersion Include="AvaloniaGraphControl" Version="0.6.1" />
<PackageVersion Include="AvaloniaHex" Version="0.1.4" />
<PackageVersion Include="bodong.Avalonia.PropertyGrid" Version="11.1.4.2" />
<PackageVersion Include="bodong.PropertyModels" Version="11.1.4.2" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="CommunityToolkit.HighPerformance" Version="8.3.2" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageVersion Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="FluentIcons.Avalonia.Fluent" Version="1.1.263" />
<PackageVersion Include="Iced" Version="1.21.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageVersion Include="JvE.Structurizer" Version="1.0.1" />
<PackageVersion Include="MeltySynth" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Morris.Moxy" Version="1.10" />
<PackageVersion Include="Mt32emu.net" Version="1.0.0-rc.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.9" />
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.9" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.0" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.0" />
<PackageVersion Include="Semi.Avalonia.TreeDataGrid" Version="11.0.10" />
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.IO" Version="4.3.0" />
<PackageVersion Include="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Memory.Data" Version="8.0.1" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
30 changes: 14 additions & 16 deletions src/Spice86.Core/Emulator/VM/EmulationLoop.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
namespace Spice86.Core.Emulator.VM;

using Spice86.Core.Emulator.CPU;
using Spice86.Core.Emulator.Devices.DirectMemoryAccess;
using Timer = Spice86.Core.Emulator.Devices.Timer.Timer;
using Spice86.Core.Emulator.Errors;
using Spice86.Core.Emulator.Function;

namespace Spice86.Core.Emulator.VM;

using Spice86.Core.Emulator.CPU.CfgCpu;
using Spice86.Core.Emulator.Gdb;
using Spice86.Shared.Interfaces;

using Spice86.Shared.Diagnostics;
using System.Diagnostics;

using Timer = Spice86.Core.Emulator.Devices.Timer.Timer;

/// <summary>
/// Runs the emulation loop in a dedicated thread. <br/>
Expand All @@ -24,8 +21,9 @@ public class EmulationLoop {
private readonly State _cpuState;
private readonly Timer _timer;
private readonly EmulatorBreakpointsManager _emulatorBreakpointsManager;
private readonly Stopwatch _stopwatch;
private readonly IPauseHandler _pauseHandler;
private readonly PerformanceMeasurer _performanceMeasurer;
private readonly Stopwatch _stopwatch;

/// <summary>
/// Whether the emulation is paused.
Expand All @@ -50,6 +48,7 @@ public EmulationLoop(ILoggerService loggerService, FunctionHandler functionHandl
_timer = timer;
_emulatorBreakpointsManager = emulatorBreakpointsManager;
_pauseHandler = pauseHandler;
_performanceMeasurer = new PerformanceMeasurer();
_stopwatch = new();
}

Expand Down Expand Up @@ -87,14 +86,15 @@ private void StartRunLoop(FunctionHandler functionHandler) {
}

private void RunLoop() {
_stopwatch.Start();
if (_cpu is CfgCpu cfgCpu) {
cfgCpu.SignalEntry();
}
_stopwatch.Start();
while (_cpuState.IsRunning) {
_emulatorBreakpointsManager.CheckBreakPoint();
_pauseHandler.WaitIfPaused();
_cpu.ExecuteNext();
_performanceMeasurer.UpdateValue(_cpuState.Cycles);
_timer.Tick();
}
_stopwatch.Stop();
Expand All @@ -103,13 +103,11 @@ private void RunLoop() {

private void OutputPerfStats() {
if (_loggerService.IsEnabled(Serilog.Events.LogEventLevel.Warning)) {
long elapsedTimeMilliSeconds = _stopwatch.ElapsedMilliseconds;
long cycles = _cpuState.Cycles;
long cyclesPerSeconds = 0;
if (elapsedTimeMilliSeconds > 0) {
cyclesPerSeconds = (_cpuState.Cycles * 1000) / elapsedTimeMilliSeconds;
}
_loggerService.Warning("Executed {Cycles} instructions in {ElapsedTimeMilliSeconds}ms. {CyclesPerSeconds} Instructions per seconds on average over run.", cycles, elapsedTimeMilliSeconds, cyclesPerSeconds);
long cyclesPerSeconds = _performanceMeasurer.AverageValuePerSecond;
long elapsedTimeInMilliseconds = _stopwatch.ElapsedMilliseconds;
_loggerService.Warning(
"Executed {Cycles} instructions in {ElapsedTimeMilliSeconds}ms. {CyclesPerSeconds} Instructions per seconds on average over run.",
_cpuState.Cycles, elapsedTimeInMilliseconds, cyclesPerSeconds);
}
}
}
166 changes: 78 additions & 88 deletions src/Spice86.Core/Spice86.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,89 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1591;1572;1573;1570;1587;1574</NoWarn>
</PropertyGroup>
<ItemGroup>
<Using Remove="System.Linq" />
<Using Include="System.Buffers.Binary" />
<Using Include="CommunityToolkit.HighPerformance" />
<Using Include="Spice86.Core.CLI" />
</ItemGroup>
<!-- Properties geared towards NuGet -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<version>7.0.0</version>
<Authors>Kevin Ferrare, Maximilien Noal, Joris van Eijden, Artjom Vejsel</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>Reverse engineer and rewrite real mode dos programs</Description>
<PackageProjectUrl>https://github.com/OpenRakis/Spice86</PackageProjectUrl>
<RepositoryUrl>https://github.com/OpenRakis/Spice86</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<!-- Source Link configuration -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<!-- Moxy configuration -->
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="Emulator/CPU/CfgCpu/ParsedInstruction/Instructions/Mixins/*.mixin" />
<AdditionalFiles Include="Emulator/CPU/CfgCpu/Parser/SpecificParsers/Mixin/*.mixin" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.3.2" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.IO" Version="4.3.0" />
<PackageReference Include="System.IO.UnmanagedMemoryStream" Version="4.3.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Memory.Data" Version="8.0.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<!--WARNING: No Mac OS support (MUNT needs to be build and included for this platform)-->
<PackageReference Include="Mt32emu.net" Version="1.0.0-rc.1" />
<PackageReference Include="MeltySynth" Version="2.4.1" />
<PackageReference Include="Morris.Moxy" Version="1.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bufdio.Spice86\Bufdio.Spice86.csproj" />
<ProjectReference Include="..\Spice86.Logging\Spice86.Logging.csproj" />
<ProjectReference Include="..\Spice86.Shared\Spice86.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="Resources\2MGM.license">
<Link>2MGM.license</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\2MGM.sf2">
<Link>2MGM.sf2</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Spice86.Tests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>1591;1572;1573;1570;1587;1574</NoWarn>
</PropertyGroup>
<ItemGroup>
<Using Remove="System.Linq" />
<Using Include="System.Buffers.Binary" />
<Using Include="CommunityToolkit.HighPerformance" />
<Using Include="Spice86.Core.CLI" />
</ItemGroup>
<!-- Properties geared towards NuGet -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<version>7.0.0</version>
<Authors>Kevin Ferrare, Maximilien Noal, Joris van Eijden, Artjom Vejsel</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>Reverse engineer and rewrite real mode dos programs</Description>
<PackageProjectUrl>https://github.com/OpenRakis/Spice86</PackageProjectUrl>
<RepositoryUrl>https://github.com/OpenRakis/Spice86</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<!-- Source Link configuration -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<!-- Moxy configuration -->
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="Emulator/CPU/CfgCpu/ParsedInstruction/Instructions/Mixins/*.mixin" />
<AdditionalFiles Include="Emulator/CPU/CfgCpu/Parser/SpecificParsers/Mixin/*.mixin" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.HighPerformance" />
<PackageReference Include="JetBrains.Annotations" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Debug" />
<PackageReference Include="System.Buffers" />
<PackageReference Include="System.IO" />
<PackageReference Include="System.IO.UnmanagedMemoryStream" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Memory.Data" />
<PackageReference Include="System.Text.Encoding.CodePages" />
<PackageReference Include="CommandLineParser" />
<!--WARNING: No Mac OS support (MUNT needs to be build and included for this platform)-->
<PackageReference Include="Mt32emu.net" />
<PackageReference Include="MeltySynth" />
<PackageReference Include="Morris.Moxy" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bufdio.Spice86\Bufdio.Spice86.csproj" />
<ProjectReference Include="..\Spice86.Logging\Spice86.Logging.csproj" />
<ProjectReference Include="..\Spice86.Shared\Spice86.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Resources\2MGM.license">
<Link>2MGM.license</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\2MGM.sf2">
<Link>2MGM.sf2</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Spice86.Tests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>
14 changes: 4 additions & 10 deletions src/Spice86.Logging/Spice86.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
</PropertyGroup>
<!-- Properties geared towards NuGet -->
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -23,10 +17,10 @@
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.Debug" />
<PackageReference Include="Serilog.Sinks.File" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spice86.Shared\Spice86.Shared.csproj" />
Expand Down
Loading

0 comments on commit 62f448a

Please sign in to comment.