Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tourmi committed May 24, 2022
2 parents 52c414a + a696a79 commit d3e86cd
Show file tree
Hide file tree
Showing 320 changed files with 5,796 additions and 1,629 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,12 @@ src/Web/Avalonia.Web.Blazor/Interop/Typescript/*.js
# Manually Added
##################

*.sfc
*.sfc
*.nes
*.gb
*.gbc
*.gba
*.smc
*.z64
*.v64
*.n64
12 changes: 6 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_CLONE_PATH: $CI_BUILDS_DIR\smw-ml
GIT_CLONE_PATH: $CI_BUILDS_DIR\retro-ml

stages:
- build-dependencies
Expand Down Expand Up @@ -33,11 +33,11 @@ build-app:
- build-emu
- build-sharpneat
artifacts:
name: smw-ml-build
name: retro-ml-build
paths:
- .\SMW-ML\bin\Release\net6.0\
- .\Application\bin\Release\net6.0\
script:
- cd .\SMW-ML\
- cd .\Application\
- dotnet build --configuration Release
- cd .\..\

Expand All @@ -48,8 +48,8 @@ test-app:
artifacts:
name: test-results
paths:
- .\SMW_ML_TEST\TestResults\
- .\Retro_ML_TEST\TestResults\
script:
- cd .\SMW_ML_TEST\
- cd .\Retro_ML_TEST\
- dotnet test --logger trx
- cd .\..\
File renamed without changes.
4 changes: 2 additions & 2 deletions SMW-ML/App.axaml → Application/App.axaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SMW_ML"
x:Class="SMW_ML.App">
xmlns:local="clr-namespace:Retro_ML.Application"
x:Class="Retro_ML.Application.App">
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
Expand Down
9 changes: 4 additions & 5 deletions SMW-ML/App.axaml.cs → Application/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using SMW_ML.ViewModels;
using SMW_ML.Views;
using Retro_ML.Application.ViewModels;
using Retro_ML.Application.Views;

namespace SMW_ML
namespace Retro_ML.Application
{
public class App : Application
public class App : Avalonia.Application
{
public override void Initialize()
{
Expand Down
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion SMW-ML/Models/Error.cs → Application/Models/Error.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace SMW_ML.Models
namespace Retro_ML.Application.Models
{
internal class Error
{
Expand Down
2 changes: 1 addition & 1 deletion SMW-ML/Program.cs → Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Avalonia.ReactiveUI;
using System;

namespace SMW_ML
namespace Retro_ML.Application
{
internal class Program
{
Expand Down
50 changes: 35 additions & 15 deletions SMW-ML/SMW_ML.csproj → Application/Retro_ML.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
<PublishReadyToRun>true</PublishReadyToRun>
<ApplicationIcon>Assets/logo.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="$(AssemblyName)_TEST" />
</ItemGroup>

<ItemGroup>
<Emulator Include="..\Submodules\BizHawk\output\**\*.*" />
<ROM Include="smw.sfc" />
<ROMs Include="*.nes" />
<ROMs Include="*.sfc" />
<ROMs Include="*.smc" />
<ROMs Include="*.n64" />
<ROMs Include="*.z64" />
<ROMs Include="*.v64" />
<ROMs Include="*.gb" />
<ROMs Include="*.gbc" />
<ROMs Include="*.gba" />
<Plugins Include="..\Games\**\$(OutDir)\Retro_ML.*.dll" />
<Plugins Include="..\Consoles\**\$(OutDir)\Retro_ML.*.dll" />
</ItemGroup>

<ItemGroup>
Expand All @@ -29,23 +35,19 @@
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.11" />
<PackageReference Include="Avalonia.Remote.Protocol" Version="0.10.11" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-beta.101" />
<PackageReference Include="PresentationFramework" Version="4.6.0" />
<PackageReference Include="Redzen" Version="13.0.0" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="SharpNeat">
<HintPath>..\Submodules\SharpNEAT\src\SharpNeat\bin\Release\net6.0\SharpNeat.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="config\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</None>
</ItemGroup>
<ItemGroup>
<Compile Update="Views\Components\FieldInfo\BoolView.axaml.cs">
<DependentUpon>BoolView.axaml</DependentUpon>
</Compile>
<Compile Update="Views\Components\ScoreFactorView.axaml.cs">
<DependentUpon>ScoreFactorView.axaml</DependentUpon>
</Compile>
Expand All @@ -61,7 +63,7 @@
</ItemGroup>
<ItemGroup>
<None Update="config\appConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="config\bizhawkAdapter.lua">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand All @@ -72,20 +74,38 @@
<None Update="config\bizhawkConfigPlayMode.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="config\plugins\smw-config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="config\sharpNeatConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Views\Components\MessageBox.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Retro_ML\Retro_ML.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\Configuration\" />
<Folder Include="Views\Configuration\" />
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<Target Name="CopyEmulator" AfterTargets="AfterCompile">
<Error Condition="!Exists('..\Submodules\BizHawk\output\EmuHawk.exe')" Text="The emulator (..\Submodules\BizHawk\output\EmuHawk.exe) is missing, or was not built! " />
<Copy SourceFiles="@(Emulator)" DestinationFolder="$(TargetDir)\emu\%(RecursiveDir)" />
<Message Text="Copied Emulator to emu\" Importance="high" />

<Copy Condition="Exists('smw.sfc')" SourceFiles="@(ROM)" DestinationFolder="$(TargetDir)" />
<Message Text="Copied ROM to project root" Condition="Exists('$(TargetDir)\smw.sfc')" Importance="high" />
<Copy SourceFiles="%(ROMs.Identity)" DestinationFolder="$(TargetDir)" />
<Message Text="Copied %(ROMs.Identity) to $(TargetDir)" Importance="high" />
</Target>
<Target Name="CopyPlugins" AfterTargets="AfterCompile">
<MakeDir Directories="$(TargetDir)plugins" />
<Copy SourceFiles="%(Plugins.Identity)" DestinationFolder="$(TargetDir)plugins" />
<Message Text="Copied: %(Plugins.Identity) to $(TargetDir)plugins\" Importance="high" />
</Target>
</Project>
File renamed without changes.
6 changes: 3 additions & 3 deletions SMW-ML/ViewLocator.cs → Application/ViewLocator.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using SMW_ML.ViewModels;
using SMW_ML.Views;
using Retro_ML.Application.ViewModels;
using Retro_ML.Application.Views;
using System;

namespace SMW_ML
namespace Retro_ML.Application
{
internal class ViewLocator : IDataTemplate
{
Expand Down
31 changes: 31 additions & 0 deletions Application/ViewModels/Components/FieldInfo/BoolViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using ReactiveUI;
using Retro_ML.Configuration.FieldInformation;

namespace Retro_ML.Application.ViewModels.Components.FieldInfo
{
internal class BoolViewModel : ViewModelBase
{
public BoolFieldInfo FieldInfo { get; }
public string FieldName => FieldInfo.Name;
public string DisplayName => FieldInfo.ReadableName;

private bool isChecked;
public bool IsChecked
{
get => isChecked;
set => this.RaiseAndSetIfChanged(ref isChecked, value);
}

public BoolViewModel()
{
this.IsChecked = true;
FieldInfo = new BoolFieldInfo("TestField", "Test Field");
}

public BoolViewModel(BoolFieldInfo boolFieldInfo, bool value)
{
FieldInfo = boolFieldInfo;
isChecked = value;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using ReactiveUI;
using Retro_ML.Configuration.FieldInformation;

namespace Retro_ML.Application.ViewModels.Components.FieldInfo
{
internal class IntegerChoiceViewModel : ViewModelBase
{
public IntegerChoiceFieldInfo FieldInfo { get; }
public string FieldName => FieldInfo.Name;
public string DisplayName => FieldInfo.ReadableName;
private int value;
public int Value
{
get => value;
set
{
this.RaiseAndSetIfChanged(ref this.value, value);
}
}
public int[] PossibleValues => FieldInfo.PossibleValues;

public IntegerChoiceViewModel()
{
FieldInfo = new IntegerChoiceFieldInfo("TestField", "Test Field", new int[] { 1, 3, 5, 7, 10 });
this.value = 5;
}

public IntegerChoiceViewModel(IntegerChoiceFieldInfo fieldInfo, int value)
{
FieldInfo = fieldInfo;
this.value = value;
}
}
}
39 changes: 39 additions & 0 deletions Application/ViewModels/Components/FieldInfo/IntegerViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using ReactiveUI;
using Retro_ML.Configuration.FieldInformation;

namespace Retro_ML.Application.ViewModels.Components.FieldInfo
{
internal class IntegerViewModel : ViewModelBase
{
public IntegerFieldInfo FieldInfo { get; }
public string FieldName => FieldInfo.Name;
public string DisplayName => FieldInfo.ReadableName;

private int value;
public int Value
{
get => value;
set
{
this.RaiseAndSetIfChanged(ref this.value, value);
}
}
public int MinimumValue => FieldInfo.MinimumValue;
public int MaximumValue => FieldInfo.MaximumValue;
public int Increment => FieldInfo.Increment;
public bool HasIncrement => FieldInfo.Increment > 0;

public IntegerViewModel()
{
FieldInfo = new IntegerFieldInfo("TestField", "Test Field", 5, 25, 5);
Value = 15;
}

public IntegerViewModel(IntegerFieldInfo fieldInfo, int value)
{
FieldInfo = fieldInfo;
Value = value;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ReactiveUI;
using SMW_ML.Game.SuperMarioWorld;
using Retro_ML.Neural;

namespace SMW_ML.ViewModels.Components
namespace Retro_ML.Application.ViewModels.Components
{
internal class InputOutputConfigViewModel : ViewModelBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using ReactiveUI;
using SMW_ML.Neural.Scoring;
using Retro_ML.Neural.Scoring;
using System.Collections.ObjectModel;

namespace SMW_ML.ViewModels.Components
namespace Retro_ML.Application.ViewModels.Components
{
internal class ScoreFactorViewModel : ViewModelBase
{
Expand All @@ -11,11 +11,11 @@ internal class ScoreFactorViewModel : ViewModelBase

public ScoreFactorViewModel(IScoreFactor scoreFactor)
{
this.Name = scoreFactor.Name;
this.CanBeDisabled = scoreFactor.CanBeDisabled;
this.isEnabled = !scoreFactor.IsDisabled;
this.multiplier = scoreFactor.ScoreMultiplier;
this.ExtraFields = new ObservableCollection<ExtraField>(scoreFactor.ExtraFields);
Name = scoreFactor.Name;
CanBeDisabled = scoreFactor.CanBeDisabled;
isEnabled = !scoreFactor.IsDisabled;
multiplier = scoreFactor.ScoreMultiplier;
ExtraFields = new ObservableCollection<ExtraField>(scoreFactor.ExtraFields);
}

public string Name { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ReactiveUI;
using SMW_ML.Neural.Training.StopCondition;
using Retro_ML.Neural.Train.StopCondition;

namespace SMW_ML.ViewModels.Components
namespace Retro_ML.Application.ViewModels.Components
{
internal class StopConditionViewModel : ViewModelBase
{
Expand Down
Loading

0 comments on commit d3e86cd

Please sign in to comment.