Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CommandLine/CommandLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>pw</AssemblyName>
<Configurations>Debug;Release</Configurations>
<Nullable>enable</Nullable>
Expand All @@ -20,7 +20,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="Spectre.Console.Cli" Version="0.51.1" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions CommandLine/Commands/Convert/ConvertFromC64Command.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using System.IO;
using CommandLine.Commands.Settings;
using PixelWorld;
Expand All @@ -12,15 +12,15 @@ namespace CommandLine.Commands.Convert;
[Description("Create ZX font from Commodore 64 font")]
public class ConvertFromC64Command : Command<RequiredSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] RequiredSettings settings)
public override Int32 Execute(CommandContext context, RequiredSettings settings)
{
foreach (var fileName in Utils.MatchGlobWithFiles(settings.Glob))
ConvertFromC64(settings, fileName);

return 0;
}

private static void ConvertFromC64(RequiredSettings settings, string fileName)
private static void ConvertFromC64(RequiredSettings settings, String fileName)
{
Out.Write($"Generating ch8 file from {fileName}");

Expand Down
8 changes: 4 additions & 4 deletions CommandLine/Commands/Convert/ConvertFromPngCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using System.IO;
using CommandLine.Commands.Settings;
using PixelWorld;
Expand All @@ -13,15 +13,15 @@ namespace CommandLine.Commands.Convert;
[Description("Create ZX font from PNG preview")]
public class ConvertFromPngCommand : Command<RequiredSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] RequiredSettings settings)
public override Int32 Execute(CommandContext context, RequiredSettings settings)
{
foreach (var fileName in Utils.MatchGlobWithFiles(settings.Glob))
ConvertFromImage(settings, fileName);

return 0;
}

private static void ConvertFromImage(RequiredSettings settings, string fileName)
private static void ConvertFromImage(RequiredSettings settings, String fileName)
{
var name = Path.GetFileNameWithoutExtension(fileName);
Out.Write($"Generating ch8 file from {fileName}");
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToAtari8BitCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create Atari 8-bit font from ZX font")]
public class ConvertToAtari8BitCommand : Command<ConvertSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ConvertSettings settings)
public override Int32 Execute(CommandContext context, ConvertSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.Atari8(files, Spectrum.UK, settings.OutputFolder, settings.TemplatePath);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToC64Command.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create Commodore 64 fonts from ZX font")]
public class ConvertToC64Command : Command<ConvertSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ConvertSettings settings)
public override Int32 Execute(CommandContext context, ConvertSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.Commodore64(files, Spectrum.UK, settings.OutputFolder, settings.TemplatePath);
Expand Down
20 changes: 20 additions & 0 deletions CommandLine/Commands/Convert/ConvertToCoVGACommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
using PixelWorld.Tools;
using Spectre.Console.Cli;

namespace CommandLine.Commands.Convert;

[Description("Create CoCoVGA fonts from ZX font")]
public class ConvertToCoVgaCommand : Command<ConvertSettings>
{
public override Int32 Execute(CommandContext context, ConvertSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.CoCoVGA(files, Spectrum.UK, settings.OutputFolder, settings.TemplatePath);
return 0;
}
}
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToCpcCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create Amstrad CPC BASIC font from ZX font")]
public class ConvertToCpcCommand : Command<BasicOutputSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] BasicOutputSettings settings)
public override Int32 Execute(CommandContext context, BasicOutputSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.AmstradCpc(files, Spectrum.UK, settings.OutputFolder, settings.Credit, settings.Line);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToFzxCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create FZX font from ZX font")]
public class ConvertToFzxCommand : Command<ProportionalSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ProportionalSettings settings)
public override Int32 Execute(CommandContext context, ProportionalSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.Fzx(files, Spectrum.UK, settings.Proportional, settings.OutputFolder);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToGbStudioCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create GB Studio PNG font from ZX font")]
public class ConvertToGbStudioCommand : Command<GbStudioSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] GbStudioSettings settings)
public override Int32 Execute(CommandContext context, GbStudioSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertToGameBoy.GbStudio(files, Spectrum.UK, settings.OutputFolder, settings.Dark, settings.Proportional);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToMsxCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create MSX font from ZX font")]
public class ConvertToMsxCommand : Command<ConvertSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ConvertSettings settings)
public override Int32 Execute(CommandContext context, ConvertSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.Msx(files, Spectrum.UK, settings.OutputFolder, settings.TemplatePath);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Convert/ConvertToUFOCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Machines;
Expand All @@ -11,7 +11,7 @@ namespace CommandLine.Commands.Convert;
[Description("Create UFO font from ZX font")]
public class ConvertToUfoCommand : Command<ConvertSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ConvertSettings settings)
public override Int32 Execute(CommandContext context, ConvertSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
ConvertTo.Ufo(files, Spectrum.UK, settings.OutputFolder);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/DumpCommand.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using PixelWorld;
using System;
using PixelWorld;
using PixelWorld.Tools;
using Spectre.Console.Cli;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using CommandLine.Commands.Settings;

namespace CommandLine.Commands;

[Description("Dump memory from emulator snapshot")]
public class DumpCommand : Command<RequiredSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] RequiredSettings settings)
public override Int32 Execute(CommandContext context, RequiredSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
Dumper.Dump(files, settings.OutputFolder);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/ExtractScreenTilesCommand.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using PixelWorld;
using System;
using PixelWorld;
using PixelWorld.Tools;
using Spectre.Console.Cli;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using CommandLine.Commands.Settings;

namespace CommandLine.Commands;

[Description("Dump memory from emulator snapshot")]
public class ExtractScreenTilesCommand : Command<ExtractTilesSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] ExtractTilesSettings settings)
public override Int32 Execute(CommandContext context, ExtractTilesSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
TileExtractor.Extract(files, settings.OutputFolder, settings.MinTiles, settings.MaxTiles);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/FindMatchingGlyphsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Tools;
Expand All @@ -10,7 +10,7 @@ namespace CommandLine.Commands;
[Description("Identify fonts that use glyphs from a source font")]
public class FindMatchingGlyphsCommand :Command<FindMatchingGlyphsSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] FindMatchingGlyphsSettings settings)
public override Int32 Execute(CommandContext context, FindMatchingGlyphsSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
Matcher.Match(files, settings.SourceFontFile, settings.MatchGlyphs);
Expand Down
11 changes: 7 additions & 4 deletions CommandLine/Commands/Generate/Generate6502AssemblyCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Formatters;
Expand All @@ -10,12 +10,15 @@ namespace CommandLine.Commands.Generate;
[Description("Generate MOS 6502 assembly")]
public class Generate6502AssemblyCommand : Command<AssemblySettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] AssemblySettings settings)
public override Int32 Execute(CommandContext context, AssemblySettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
switch (settings.Base)
{
case NumberBase.Decimal:
case NumberBase.Binary:
AssemblyFontFormatter.CreateDefines("6502", ".byte ", "%{0:b8}", files, settings.OutputFolder, settings.Credit);
break;
case NumberBase.Hex:
AssemblyFontFormatter.CreateDefines("6502", ".byte ", "${0:x2}", files, settings.OutputFolder, settings.Credit);
break;
default:
Expand Down
17 changes: 9 additions & 8 deletions CommandLine/Commands/Generate/Generate68000AssemblyCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Formatters;
Expand All @@ -10,18 +10,19 @@ namespace CommandLine.Commands.Generate;
[Description("Generate Motorola 68000 assembly")]
public class Generate68000AssemblyCommand : Command<AssemblySettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] AssemblySettings settings)
public override Int32 Execute(CommandContext context, AssemblySettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
switch (settings.Base)
{
case NumberBase.Decimal:
AssemblyFontFormatter.CreateDefines("68000", "DC.B ", "${0:x2}", files, settings.OutputFolder,
settings.Credit);
case NumberBase.Binary:
AssemblyFontFormatter.CreateDefines("68000", "DC.B ", "${0:x2}", files, settings.OutputFolder, settings.Credit);
break;
case NumberBase.Hex:
AssemblyFontFormatter.CreateDefines("68000", "DC.B ", "${0:x2}", files, settings.OutputFolder, settings.Credit);
break;
default:
AssemblyFontFormatter.CreateDefines("68000", "DC.B ", "{0}", files, settings.OutputFolder,
settings.Credit);
AssemblyFontFormatter.CreateDefines("68000", "DC.B ", "{0}", files, settings.OutputFolder, settings.Credit);
break;
}

Expand Down
14 changes: 8 additions & 6 deletions CommandLine/Commands/Generate/Generate8086AssemblyCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Formatters;
Expand All @@ -10,14 +10,16 @@ namespace CommandLine.Commands.Generate;
[Description("Generate Intel 8086 assembly")]
public class Generate8086AssemblyCommand : Command<AssemblySettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] AssemblySettings settings)
public override Int32 Execute(CommandContext context, AssemblySettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
switch (settings.Base)
{
case NumberBase.Decimal:
AssemblyFontFormatter.CreateDefines("x86", "db\t", "0x{0:x2}", files, settings.OutputFolder,
settings.Credit);
case NumberBase.Binary:
AssemblyFontFormatter.CreateDefines("x86", "db\t", "0b{0:b8}", files, settings.OutputFolder, settings.Credit);
break;
case NumberBase.Hex:
AssemblyFontFormatter.CreateDefines("x86", "db\t", "0x{0:x2}", files, settings.OutputFolder, settings.Credit);
break;
default:
AssemblyFontFormatter.CreateDefines("x86", "db\t", "{0}", files, settings.OutputFolder,
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Generate/GenerateCHeaderCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Formatters;
Expand All @@ -10,7 +10,7 @@ namespace CommandLine.Commands.Generate;
[Description("Generate C header")]
public class GenerateCHeaderCommand : Command<COutputSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] COutputSettings settings)
public override Int32 Execute(CommandContext context, COutputSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
CHeaderFontFormatter.CreateFontHeaderConst(settings.ByteType, files, settings.OutputFolder, settings.Credit);
Expand Down
6 changes: 3 additions & 3 deletions CommandLine/Commands/Generate/GenerateRustHeaderCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System;
using System.ComponentModel;
using CommandLine.Commands.Settings;
using PixelWorld;
using PixelWorld.Formatters;
Expand All @@ -10,7 +10,7 @@ namespace CommandLine.Commands.Generate;
[Description("Generate Rust header")]
public class GenerateRustHeaderCommand : Command<TextOutputSettings>
{
public override int Execute([NotNull] CommandContext context, [NotNull] TextOutputSettings settings)
public override Int32 Execute(CommandContext context, TextOutputSettings settings)
{
var files = Utils.MatchGlobWithFiles(settings.Glob);
RustHeaderFontFormatter.CreateFontHeaderConst(files, settings.OutputFolder, settings.Credit);
Expand Down
Loading