Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/nes-warface.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-02-23 19:30:01 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-02-23 19:30:01 +0300
commitc83eea7ebd55bab4ef90e03fde65ec759c9c0180 (patch)
treef72bd43c55a79db9c36a60f2b8443f554fc7c65c
parent75920b63bab409e3d83597486436c65b66660054 (diff)
Refactoring
-rw-r--r--Makefile4
-rw-r--r--WriteWarface.cs8
-rw-r--r--tools_sources/ImageSplitter/App.config6
-rw-r--r--tools_sources/ImageSplitter/ImageSplitter.csproj55
-rw-r--r--tools_sources/ImageSplitter/Program.cs59
-rw-r--r--tools_sources/ImageSplitter/Properties/AssemblyInfo.cs36
6 files changed, 6 insertions, 162 deletions
diff --git a/Makefile b/Makefile
index 8dca427..0eab172 100644
--- a/Makefile
+++ b/Makefile
@@ -406,9 +406,9 @@ $(MUSIC_BIN):
dd if=$(MUSIC) of=music.bin bs=1 skip=128
write: $(EXECUTABLE)
- tools\FamicomDumper.exe script --csfile WriteWarface.cs --sound
+ tools\famicom-dumper.exe script --csfile Scripts/WriteWarface.cs --sound
erase:
- tools\FamicomDumper.exe script --csfile EraseCheck.cs --sound
+ tools\famicomDumper.exe script --csfile Scripts/EraseCheck.cs --sound
.PHONY: clean write erase
diff --git a/WriteWarface.cs b/WriteWarface.cs
index 7a032ce..bbc00f1 100644
--- a/WriteWarface.cs
+++ b/WriteWarface.cs
@@ -8,9 +8,9 @@ namespace com.clusterrr.Warface
{
class WriteWarface
{
- void Run(IFamicomDumperConnection dumper)
+ void Run(IFamicomDumperConnection dumper, string filename)
{
- var rom = new NesFile("warface.nes");
+ var rom = new NesFile(filename);
const int prgBankSize = 0x4000;
const int chrBankSize = 0x1000;
bool problem = false;
@@ -23,7 +23,7 @@ namespace com.clusterrr.Warface
Console.WriteLine("Writing PRG bank #{0}...", bank);
dumper.WriteCpu(0x6000, (byte)bank);
var data = new byte[prgBankSize];
- Array.Copy(rom.PRG, bank * prgBankSize, data, 0, prgBankSize);
+ Array.Copy(rom.PRG.ToArray(), bank * prgBankSize, data, 0, prgBankSize);
if (data.Where(b => b != 0xFF).Any())
dumper.WriteCpu(0x8000, data);
var dataVerify = dumper.ReadCpu(0x8000, prgBankSize);
@@ -48,7 +48,7 @@ namespace com.clusterrr.Warface
Console.WriteLine("Writing CHR bank #{0}...", bank);
dumper.WriteCpu(0x6001, (byte)bank);
var data = new byte[chrBankSize];
- Array.Copy(rom.CHR, bank * chrBankSize, data, 0, chrBankSize);
+ Array.Copy(rom.CHR.ToArray(), bank * chrBankSize, data, 0, chrBankSize);
if (data.Where(b => b != 0xFF).Any())
dumper.WritePpu(0x0000, data);
var dataVerify = dumper.ReadPpu(0x0000, chrBankSize);
diff --git a/tools_sources/ImageSplitter/App.config b/tools_sources/ImageSplitter/App.config
deleted file mode 100644
index 3916e0e..0000000
--- a/tools_sources/ImageSplitter/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
- </startup>
-</configuration> \ No newline at end of file
diff --git a/tools_sources/ImageSplitter/ImageSplitter.csproj b/tools_sources/ImageSplitter/ImageSplitter.csproj
deleted file mode 100644
index 785d4c4..0000000
--- a/tools_sources/ImageSplitter/ImageSplitter.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{3BFAF77A-90AB-4B12-AB06-90290FEBCAC9}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <RootNamespace>com.clusterrr.Famicom.ImageSplitter</RootNamespace>
- <AssemblyName>ImageSplitter</AssemblyName>
- <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
- <Deterministic>true</Deterministic>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>..\..\tools\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>..\..\tools\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-</Project> \ No newline at end of file
diff --git a/tools_sources/ImageSplitter/Program.cs b/tools_sources/ImageSplitter/Program.cs
deleted file mode 100644
index b395c79..0000000
--- a/tools_sources/ImageSplitter/Program.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ImageSplitter
-{
- class Program
- {
- static int Main(string[] args)
- {
- try
- {
- if (args.Length < 5)
- {
- Console.WriteLine("ImageSplitter.exe <input> <output1> <output2> <output3> <output4>");
- return 1;
- }
-
- var inputImage = Image.FromFile(args[0]);
-
- var output1 = new Bitmap(256, 64, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- var output2 = new Bitmap(256, 64, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- var output3 = new Bitmap(256, 64, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- var output4 = new Bitmap(256, 48, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
-
- var gr1 = Graphics.FromImage(output1);
- var gr2 = Graphics.FromImage(output2);
- var gr3 = Graphics.FromImage(output3);
- var gr4 = Graphics.FromImage(output4);
-
- gr1.DrawImageUnscaled(inputImage, 0, 0);
- gr2.DrawImageUnscaled(inputImage, 0, -64);
- gr3.DrawImageUnscaled(inputImage, 0, -128);
- gr4.DrawImageUnscaled(inputImage, 0, -192);
-
- gr1.Flush();
- gr2.Flush();
- gr3.Flush();
- gr4.Flush();
-
- output1.Save(args[1], ImageFormat.Png);
- output2.Save(args[2], ImageFormat.Png);
- output3.Save(args[3], ImageFormat.Png);
- output4.Save(args[4], ImageFormat.Png);
-
- return 0;
- }
- catch (Exception ex)
- {
- Console.WriteLine($"Error {ex.GetType()}: {ex.Message}{ex.StackTrace}");
- return 1;
- }
- }
- }
-}
diff --git a/tools_sources/ImageSplitter/Properties/AssemblyInfo.cs b/tools_sources/ImageSplitter/Properties/AssemblyInfo.cs
deleted file mode 100644
index ddd0216..0000000
--- a/tools_sources/ImageSplitter/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ImageSplitter")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ImageSplitter")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3bfaf77a-90ab-4b12-ab06-90290febcac9")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]