From c83eea7ebd55bab4ef90e03fde65ec759c9c0180 Mon Sep 17 00:00:00 2001 From: Alexey 'Cluster' Avdyukhin Date: Wed, 23 Feb 2022 19:30:01 +0300 Subject: Refactoring --- Makefile | 4 +- WriteWarface.cs | 8 +-- tools_sources/ImageSplitter/App.config | 6 --- tools_sources/ImageSplitter/ImageSplitter.csproj | 55 -------------------- tools_sources/ImageSplitter/Program.cs | 59 ---------------------- .../ImageSplitter/Properties/AssemblyInfo.cs | 36 ------------- 6 files changed, 6 insertions(+), 162 deletions(-) delete mode 100644 tools_sources/ImageSplitter/App.config delete mode 100644 tools_sources/ImageSplitter/ImageSplitter.csproj delete mode 100644 tools_sources/ImageSplitter/Program.cs delete mode 100644 tools_sources/ImageSplitter/Properties/AssemblyInfo.cs 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 @@ - - - - - - \ 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 @@ - - - - - Debug - AnyCPU - {3BFAF77A-90AB-4B12-AB06-90290FEBCAC9} - Exe - com.clusterrr.Famicom.ImageSplitter - ImageSplitter - v4.8 - 512 - true - true - - - AnyCPU - true - full - false - ..\..\tools\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - ..\..\tools\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - \ 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 "); - 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")] -- cgit v1.2.3