From c547297c1efe19abfa75a17adec377476ec96691 Mon Sep 17 00:00:00 2001 From: TommySalami Date: Sat, 9 Aug 2025 15:45:34 -0600 Subject: [PATCH] Add project files. --- .gitattributes | 63 + .gitignore | 366 +++ AutomatedROMTools-CLI/App.config | 6 + .../AutomatedROMTools-CLI.csproj | 87 + AutomatedROMTools-CLI/AutomatedROMTools.cs | 2006 +++++++++++++++++ .../CRC32CryptoServiceProvider.cs | 114 + AutomatedROMTools-CLI/DatEmAll.cs | 12 + AutomatedROMTools-CLI/DeheadEmAll.cs | 12 + AutomatedROMTools-CLI/Program.cs | 32 + .../Properties/AssemblyInfo.cs | 36 + .../AutomatedROMTools-BuildPatchesDat.bat | 7 + .../AutomatedROMTools-BuildROMsDat.bat | 7 + .../Batches/AutomatedROMTools-DeheadA78.bat | 7 + .../Batches/AutomatedROMTools-DeheadAll.bat | 7 + .../Batches/AutomatedROMTools-DeheadFDS.bat | 7 + .../Batches/AutomatedROMTools-DeheadLnx.bat | 7 + .../Batches/AutomatedROMTools-DeheadNES.bat | 7 + .../Batches/AutomatedROMTools-PrintHelp.bat | 7 + .../AutomatedROMTools-PrintLicense.bat | 7 + .../AutomatedROMTools-PrintVersion.bat | 7 + .../Batches/AutomatedROMTools-SortA2Z.bat | 7 + .../Batches/AutomatedROMTools-SortZ2A.bat | 7 + .../Batches/AutomatedROMTools-Split-(USA).bat | 7 + .../AutomatedROMTools-TrimZerosFromEnd.bat | 7 + .../put your batches in this directory.txt | 1 + .../Dats/put your dats in this directory.txt | 1 + ...put your sorted dats in this directory.txt | 1 + .../put your split dats in this directory.txt | 1 + .../Output/Docs/AutomatedROMTools-Help.txt | 63 + .../put your patches in this directory.txt | 1 + .../ROMs/put your roms in this directory.txt | 1 + ...your deheadered roms in this directory.txt | 1 + ...ut your trimmed roms in this directory.txt | 1 + AutomatedROMTools-CLI/SortEmAll.cs | 12 + AutomatedROMTools-CLI/SplitEmAll.cs | 12 + AutomatedROMTools-CLI/TrimEmAll.cs | 12 + AutomatedROMTools-GUI/App.config | 6 + .../AutomatedROMTools-GUI.csproj | 84 + .../FrmAutomatedROMTools.Designer.cs | 61 + AutomatedROMTools-GUI/FrmAutomatedROMTools.cs | 20 + .../FrmAutomatedROMTools.resx | 120 + AutomatedROMTools-GUI/Program.cs | 22 + .../Properties/AssemblyInfo.cs | 36 + .../Properties/Resources.Designer.cs | 63 + .../Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 26 + .../Properties/Settings.settings | 7 + AutomatedROMTools-Release/App.config | 6 + .../AutomatedROMTools-Release.csproj | 98 + AutomatedROMTools.sln | 51 + CHANGELOG.md | 12 + CODE_OF_CONDUCT.md | 127 ++ CONTRIBUTING.md | 25 + LICENSE | 38 + README.md | 45 + TODO.md | 5 + 56 files changed, 3908 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 AutomatedROMTools-CLI/App.config create mode 100644 AutomatedROMTools-CLI/AutomatedROMTools-CLI.csproj create mode 100644 AutomatedROMTools-CLI/AutomatedROMTools.cs create mode 100644 AutomatedROMTools-CLI/CRC32CryptoServiceProvider.cs create mode 100644 AutomatedROMTools-CLI/DatEmAll.cs create mode 100644 AutomatedROMTools-CLI/DeheadEmAll.cs create mode 100644 AutomatedROMTools-CLI/Program.cs create mode 100644 AutomatedROMTools-CLI/Properties/AssemblyInfo.cs create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildPatchesDat.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildROMsDat.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadA78.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadAll.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadFDS.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadLnx.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadNES.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintHelp.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintLicense.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintVersion.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortA2Z.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortZ2A.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-Split-(USA).bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-TrimZerosFromEnd.bat create mode 100644 AutomatedROMTools-CLI/Resources/Output/Batches/put your batches in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/Dats/put your dats in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/DatsSorted/put your sorted dats in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/DatsSplit/put your split dats in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/Docs/AutomatedROMTools-Help.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/Patches/put your patches in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/ROMs/put your roms in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/ROMsDeheaded/put your deheadered roms in this directory.txt create mode 100644 AutomatedROMTools-CLI/Resources/Output/ROMsTrimmed/put your trimmed roms in this directory.txt create mode 100644 AutomatedROMTools-CLI/SortEmAll.cs create mode 100644 AutomatedROMTools-CLI/SplitEmAll.cs create mode 100644 AutomatedROMTools-CLI/TrimEmAll.cs create mode 100644 AutomatedROMTools-GUI/App.config create mode 100644 AutomatedROMTools-GUI/AutomatedROMTools-GUI.csproj create mode 100644 AutomatedROMTools-GUI/FrmAutomatedROMTools.Designer.cs create mode 100644 AutomatedROMTools-GUI/FrmAutomatedROMTools.cs create mode 100644 AutomatedROMTools-GUI/FrmAutomatedROMTools.resx create mode 100644 AutomatedROMTools-GUI/Program.cs create mode 100644 AutomatedROMTools-GUI/Properties/AssemblyInfo.cs create mode 100644 AutomatedROMTools-GUI/Properties/Resources.Designer.cs create mode 100644 AutomatedROMTools-GUI/Properties/Resources.resx create mode 100644 AutomatedROMTools-GUI/Properties/Settings.Designer.cs create mode 100644 AutomatedROMTools-GUI/Properties/Settings.settings create mode 100644 AutomatedROMTools-Release/App.config create mode 100644 AutomatedROMTools-Release/AutomatedROMTools-Release.csproj create mode 100644 AutomatedROMTools.sln create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 TODO.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d801b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,366 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# Extra misc solution files +misc/ diff --git a/AutomatedROMTools-CLI/App.config b/AutomatedROMTools-CLI/App.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/AutomatedROMTools-CLI/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/AutomatedROMTools-CLI/AutomatedROMTools-CLI.csproj b/AutomatedROMTools-CLI/AutomatedROMTools-CLI.csproj new file mode 100644 index 0000000..97ab9c1 --- /dev/null +++ b/AutomatedROMTools-CLI/AutomatedROMTools-CLI.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {B9C0B7E7-FC25-4F96-8115-453D1759E25A} + Exe + AutomatedROMTools + AutomatedROMTools-CLI + v4.8 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AutomatedROMTools-CLI/AutomatedROMTools.cs b/AutomatedROMTools-CLI/AutomatedROMTools.cs new file mode 100644 index 0000000..9f5376e --- /dev/null +++ b/AutomatedROMTools-CLI/AutomatedROMTools.cs @@ -0,0 +1,2006 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Xml.Linq; +using System.Security.Cryptography; + +namespace AutomatedROMTools +{ + /// + /// The AutomatedROMTools Class which interacts with the Main Program Class. + /// + class AutomatedROMTools + { + #region Private Members + + // Private members. + private string _strAppName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName; // Product Name + private string _strAppVersion = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductVersion; // Product Version + private string _strAppCopyright = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).LegalCopyright; // Product Copyright + private string _strCommandSwitch = "-help"; // Command switch (-version/-help/-license) + private string _strPathPatchesDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Patches"); // Path to the patches directory + private string _strPathROMsDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "ROMs"); // Path to the ROMs directory + private string _strPathROMsDeheadedDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "ROMsDeheaded"); // Path to the deheadered ROMs directory + private string _strPathROMsTrimmedDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "ROMsTrimmed"); // Path to the trimmed ROMs directory + private string _strPathDatsDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Dats"); // Path to the Dats directory + private string _strPathDatsSortedDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "DatsSorted"); // Path to the sorted Dats directory + private string _strPathDatsSplitDir = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "DatsSplit"); // Path to the split Dats directory + private string _strFilterText = ""; // Text to filter + private string _strComment = ""; // Comment to use in ROMs datafiles + private string _strPathLogFile = ""; // Path to the log file + private List _arrLog = new List(); // The log string list array + private int _intBufferSize = 1024 * 1024; // Buffer size + private int _intTrimmedROMSize = 0; // Trimmed ROM size + private int _intSizeToTrim = 0; // Size to trim from the ROM + + #endregion + + #region Getters/Setters Public Accessors + + // Public member accessors. + public string AppName + { + get { return _strAppName; } + set { } + } + public string AppVersion + { + get { return _strAppVersion; } + set { } + } + public string AppCopyright + { + get { return _strAppCopyright; } + set { } + } + public string CommandSwitch + { + get { return _strCommandSwitch; } + set { _strCommandSwitch = value; } + } + public string PathPatchesDir + { + get { return _strPathPatchesDir; } + set { _strPathPatchesDir = value; } + } + public string PathROMsDir + { + get { return _strPathROMsDir; } + set { _strPathROMsDir = value; } + } + public string PathROMsDeheadedDir + { + get { return _strPathROMsDeheadedDir; } + set { _strPathROMsDeheadedDir = value; } + } + public string PathROMsTrimmedDir + { + get { return _strPathROMsTrimmedDir; } + set { _strPathROMsTrimmedDir = value; } + } + public string PathDatsDir + { + get { return _strPathDatsDir; } + set { _strPathDatsDir = value; } + } + public string PathDatsSortedDir + { + get { return _strPathDatsSortedDir; } + set { _strPathDatsSortedDir = value; } + } + public string PathDatsSplitDir + { + get { return _strPathDatsSplitDir; } + set { _strPathDatsSplitDir = value; } + } + public string FilterText + { + get { return _strFilterText; } + set { _strFilterText = value; } + } + public string Comment + { + get { return _strComment; } + set { _strComment = value; } + } + public string PathLogFile + { + get { return _strPathLogFile; } + set { _strPathLogFile = value; } + } + public List Log + { + get { return _arrLog; } + set { _arrLog = value; } + } + public int BufferSize + { + get { return _intBufferSize; } + set { _intBufferSize = value; } + } + public int TrimmedROMSize + { + get { return _intTrimmedROMSize; } + set { _intTrimmedROMSize = value; } + } + public int SizeToTrim + { + get { return _intSizeToTrim; } + set { _intSizeToTrim = value; } + } + + #endregion + + #region CLI + + /// + /// Sets the variables passed from the CLI. + /// + /// + public void SetVariablesFromCLI(string[] strArgs) + { + try + { + foreach (string strArg in strArgs) + { + if (Regex.IsMatch(strArg, "^-", RegexOptions.IgnoreCase) == true) + { + // Set the command switch. + CommandSwitch = strArg; + } + if (Regex.IsMatch(strArg, "^DD:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the Dats directory. + PathDatsDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^DO:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the sorted Dats directory. + PathDatsSortedDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^DP:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the split Dats directory. + PathDatsSplitDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^FT:", RegexOptions.IgnoreCase) == true) + { + // Set the filter text. + FilterText = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^RD:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the ROMs directory. + PathROMsDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^RE:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the deheadered ROMs directory. + PathROMsDeheadedDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^RT:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the trimmed ROMs directory. + PathROMsTrimmedDir = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^CO:", RegexOptions.IgnoreCase) == true) + { + // Set the comment to use in datafiles. + Comment = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^LF:", RegexOptions.IgnoreCase) == true) + { + // Set the path to the log file. + PathLogFile = strArg.Substring(3); + } + if (Regex.IsMatch(strArg, "^BS:", RegexOptions.IgnoreCase) == true) + { + // Set the buffer size. + BufferSize = Convert.ToInt32(strArg.Substring(3)); + } + if (Regex.IsMatch(strArg, "^RS:", RegexOptions.IgnoreCase) == true) + { + // Set the trimmed ROM size. + TrimmedROMSize = Convert.ToInt32(strArg.Substring(3)); + } + if (Regex.IsMatch(strArg, "^TS:", RegexOptions.IgnoreCase) == true) + { + // Set the size to trim from the ROM. + SizeToTrim = Convert.ToInt32(strArg.Substring(3)); + } + } + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Setting options from CLI failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Processes the command switch. + /// + public void ProcessCommandSwitch() + { + switch (CommandSwitch) + { + case "-buildpatchesdat": + BuildPatchesDatafile(); // Build a datafile from the Patches directory. + break; + case "-buildromsdat": + BuildROMsDatafile(); // Build a datafile from the ROMs directory. + break; + case "-deheadall": + DeheadAllROMs(); // Deheader all FDS/NES/7800/Lynx ROMs. + break; + case "-deheadfds": + DeheadFDSROMs(); // Deheader all FDS ROMs. + break; + case "-deheadnes": + DeheadNESROMs(); // Deheader all NES ROMs. + break; + case "-deheada78": + DeheadA78ROMs(); // Deheader all 7800 ROMs. + break; + case "-deheadlnx": + DeheadLnxROMs(); // Deheader all Lynx ROMs. + break; + case "-sorta2z": + SortA2Z(); // Sort all game names from A-Z in all datafiles. + break; + case "-sortz2a": + SortZ2A(); // Sort all game names from Z-A in all datafiles. + break; + case "-split": + SplitDats(); // Split all datafiles using a text filter. + break; + case "-trimzerosfrombegin": + LTrimROMs(); // Trim all zeros from the beginning of all possible ROMs. + break; + case "-trimzerosfromend": + RTrimROMs(); // Trim all zeros from the end of all possible ROMs. + break; + case "-trimtosizefromend": + STrimROMs(); // Trim all possible ROMs to a specific size. + break; + case "-trimsizefrombegin": + SFLTrimROMs(); // Trim a specific size from the beginning of all possible ROMs. + break; + case "-trimsizefromend": + SFRTrimROMs(); // Trim a specific size from the end of all possible ROMs. + break; + case "-license": + PrintLicense(); // Print the license text. + break; + case "-version": + // Do nothing. // Do nothing. + break; + default: + PrintHelp(); // Print the help text. + break; + } + } + + #endregion + + #region Save Log + + /// + /// Saves the log to a text file. + /// + public void SaveLog() + { + try + { + // Determine if the user selected a log filename. + if (PathLogFile.Length > 0) + { + // Get the log file directory name. + FileInfo fi = new FileInfo(PathLogFile); + + // Create log file directory if it doesn't exist. + if (Directory.Exists(fi.DirectoryName) == false) Directory.CreateDirectory(fi.DirectoryName); + + // Save the contents of the log to a text file. + File.WriteAllLines(PathLogFile, Log); + + // Print to screen + OutputLine("Info: Log file saved (" + PathLogFile + ")"); + OutputLine(""); + } + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Saving log file failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Printers + + /// + /// Prints the help text. + /// + public void PrintHelp() + { + // Print to screen + OutputLine("Usage:"); + OutputLine("\tAutomatedROMTools-CLI.exe [-command] [option:]"); + OutputLine("\tOptions that contain spaces must be enclosed in quotations"); + OutputLine("\tOptions may be specified in any order"); + OutputLine("\tOnly one command may be be used"); + OutputLine(""); + OutputLine("-------------------------------------------------------------------------------"); + OutputLine(""); + OutputLine("Build Patches Datafile Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -buildpatchesdat"); + OutputLine(""); + OutputLine("Build ROMs Datafile Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -buildromsdat"); + OutputLine(""); + OutputLine("Dehead ROMs Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -deheadall"); + OutputLine(""); + OutputLine("Split All Datafiles Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -split \"(USA)\""); + OutputLine(""); + OutputLine("Sort Game Names In All Datafiles Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -sorta2z"); + OutputLine(""); + OutputLine("Trim ROMs Example:"); + OutputLine("\tAutomatedROMTools-CLI.exe -trimzerosfromend"); + OutputLine(""); + OutputLine("-------------------------------------------------------------------------------"); + OutputLine(""); + OutputLine("Standard Commands:"); + OutputLine("\t-buildpatchesdat\tBuild a datafile from the Patches directory"); + OutputLine("\t-buildromsdat\t\tBuild a datafile from the ROMs directory"); + OutputLine("\t-deheadall\t\tDeheader all FDS/NES/7800/Lynx ROMs"); + OutputLine("\t-deheadfds\t\tDeheader all FDS ROMs"); + OutputLine("\t-deheadnes\t\tDeheader all NES ROMs"); + OutputLine("\t-deheada78\t\tDeheader all 7800 ROMs"); + OutputLine("\t-deheadlnx\t\tDeheader all Lynx ROMs"); + OutputLine("\t-sorta2z\t\tSort all game names from A-Z in all datafiles"); + OutputLine("\t-sortz2a\t\tSort all game names from Z-A in all datafiles"); + OutputLine("\t-splitall\t\tSplit all datafiles using a text filter"); + // OutputLine("\t-trimzerosfrombegin\tTrim all zeros from the beginning of all ROMs"); + OutputLine("\t-trimzerosfromend\tTrim all zeros from the end of all ROMs"); + // OutputLine("\t-trimtosizefromend\tTrim all possible ROMs to a specific size"); + // OutputLine("\t-trimsizefrombegin\tTrim a specific size from the beginning of ROMs"); + // OutputLine("\t-trimsizefromend\tTrim a specific size from the end of ROMs"); + OutputLine("\t-help\t\t\tPrint the help"); + OutputLine("\t-license\t\tPrint the license"); + OutputLine("\t-version\t\tPrint the version"); + OutputLine(""); + OutputLine("-------------------------------------------------------------------------------"); + OutputLine(""); + OutputLine("Standard Options:"); + OutputLine("\tDD:\t\tPath to the Dats directory"); + OutputLine("\tDO:\t\tPath to the sorted Dats directory"); + OutputLine("\tDP:\t\tPath to the split Dats directory"); + OutputLine("\tRD:\t\tPath to the ROMs directory"); + OutputLine("\tRE:\t\tPath to the deheadered ROMs directory"); + OutputLine("\tRT:\t\tPath to the trimmed ROMs directory"); + OutputLine("\tCO:\t\tComment to use for building a datafile"); + OutputLine("\tFT:\t\tText to filter"); + OutputLine("\tLF:\t\tPath to the log file"); + OutputLine("\tBS:\t\tBuffer size (Default: 1048576)"); + OutputLine("\tRS:\t\tTrimmed ROM size"); + OutputLine("\tTS:\t\tSize to trim from ROMs"); + OutputLine(""); + } + + /// + /// Prints the license text. + /// + public void PrintLicense() + { + // Print to screen + OutputLine("-------------------------------------------------------------------------------"); + OutputLine("AutomatedROMTools - License version 20250729"); + OutputLine("Copyright (c) 2016-2025 AutomatedROMTools - All Rights Reserved"); + OutputLine("-------------------------------------------------------------------------------"); + OutputLine(""); + OutputLine("Redistribution and use in binary forms, without modification,"); + OutputLine("is permitted provided that the following conditions are met:"); + OutputLine(""); + OutputLine("1.This software may not be reverse engineered, decompiled,"); + OutputLine(" or disassembled."); + OutputLine(""); + OutputLine("2.Redistributions of source code are not permitted whatsoever,"); + OutputLine(" under any conditions."); + OutputLine(""); + OutputLine("3.Redistributions in binary form must reproduce the above copyright"); + OutputLine(" notice, this list of conditions and the following disclaimer in"); + OutputLine(" the documentation and/or other materials provided with the"); + OutputLine(" distribution."); + OutputLine(""); + OutputLine("4.Redistributions in binary form must retain the following acknowledgment:"); + OutputLine(" \"This product includes AutomatedROMTools software, which is freely available.\""); + OutputLine(""); + OutputLine("5.AutomatedROMTools may publish revised and/or new versions of the"); + OutputLine(" license from time to time. Each version will be given a"); + OutputLine(" distinguishing version number. No one other than AutomatedROMTools has"); + OutputLine(" the right to modify the terms applicable to covered code created"); + OutputLine(" under this License."); + OutputLine(""); + OutputLine("6.This software may not be used for any illegal purposes or activities."); + OutputLine(" It is your responsibility to use this software in accordance with all"); + OutputLine(" applicable laws."); + OutputLine(""); + OutputLine("7.This software is for use only on files that you own"); + OutputLine(" or have the right to use it on."); + OutputLine(""); + OutputLine("-------------------------------------------------------------------------------"); + OutputLine(""); + OutputLine("THIS SOFTWARE IS PROVIDED BY THE BUILDEMALL DEVELOPMENT TEAM 'AS IS'"); + OutputLine("AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,"); + OutputLine("THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A"); + OutputLine("PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BUILDEMALL"); + OutputLine("DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,"); + OutputLine("INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES"); + OutputLine("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR"); + OutputLine("SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)"); + OutputLine("HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,"); + OutputLine("STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)"); + OutputLine("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED"); + OutputLine("OF THE POSSIBILITY OF SUCH DAMAGE."); + OutputLine(""); + } + + /// + /// Prints the version and copyright notice texts. + /// + public void PrintVersion() + { + // Print to screen + OutputLine("------------------------------------------------------------------------------"); + OutputLine(AppName + " v" + AppVersion); + OutputLine(AppCopyright); + OutputLine("------------------------------------------------------------------------------"); + OutputLine(""); + } + + /// + /// Outputs a line of text. + /// + /// + private void OutputLine(string strMsg) + { + // Print the line of text to the console window. + Console.WriteLine(strMsg); + + // Print the line of text to the log. + if (PathLogFile.Length > 0) + { + // Add the line of text to the log. + Log.Add(strMsg); + } + } + + #endregion + + #region Checkers + + /// + /// Checks the Patches directory path. + /// + /// + private bool PathPatchesDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathPatchesDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The Patches directory path does not exist (" + PathPatchesDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the Dats directory path. + /// + /// + private bool PathDatsDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathDatsDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The Dats directory path does not exist (" + PathDatsDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the sorted Dats directory path. + /// + /// + private bool PathDatsSortedDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathDatsSortedDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The sorted Dats directory path does not exist (" + PathDatsSortedDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the split Dats directory path. + /// + /// + private bool PathDatsSplitDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathDatsSplitDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The split Dats directory path does not exist (" + PathDatsSplitDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the ROMs directory path. + /// + /// + private bool PathROMsDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathROMsDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The ROMs directory path does not exist (" + PathROMsDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the deheadered ROMs directory path. + /// + /// + private bool PathROMsDeheadedDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathROMsDeheadedDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The deheadered ROMs directory path does not exist (" + PathROMsDeheadedDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + /// + /// Checks the trimmed ROMs directory path. + /// + /// + private bool PathROMsTrimmedDirCheck() + { + // Set the exit flag value. + bool boolReturnValue = false; + + // Check if the directory exists. + if (Directory.Exists(PathROMsTrimmedDir) == true) + { + // Set the exit flag value. + boolReturnValue = false; + } + else + { + // Print to screen and set the exit flag value. + OutputLine("Error: The trimmed ROMs directory path does not exist (" + PathROMsTrimmedDir + ")"); + boolReturnValue = true; + } + + // Return the exit flag value. + return boolReturnValue; + } + + #endregion + + #region Dehead ROMs + + /// + /// Deheaders all possible FDS ROMs. + /// + private void DeheadFDSROMs() + { + try + { + // Print to screen + OutputLine("Info: Deheadering all possible FDS ROMs ..."); + + // Declarations + int intCounterTotalDeheaded = 0; // Total deheadered counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsDeheadedDir = PathROMsDeheadedDir; // Path to the deheadered ROMs directory + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsDeheadedDirCheck = PathROMsDeheadedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsDeheadedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsDeheaded Directory (" + strPathROMsDeheadedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.fds", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Deheader all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Length > 16) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 16); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(16, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Deheadered " + intCounterTotalDeheaded + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Deheadering all possible FDS ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Deheadering all possible FDS ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Deheaders all possible NES ROMs. + /// + private void DeheadNESROMs() + { + try + { + // Print to screen + OutputLine("Info: Deheadering all possible NES ROMs ..."); + + // Declarations + int intCounterTotalDeheaded = 0; // Total deheadered counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsDeheadedDir = PathROMsDeheadedDir; // Path to the deheadered ROMs directory + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsDeheadedDirCheck = PathROMsDeheadedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsDeheadedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsDeheaded Directory (" + strPathROMsDeheadedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.nes", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Deheader all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Length > 16) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 16); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(16, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Deheadered " + intCounterTotalDeheaded + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Deheadering all possible NES ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Deheadering all possible NES ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Deheaders all possible 7800 ROMs. + /// + private void DeheadA78ROMs() + { + try + { + // Print to screen + OutputLine("Info: Deheadering all possible 7800 ROMs ..."); + + // Declarations + int intCounterTotalDeheaded = 0; // Total deheadered counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsDeheadedDir = PathROMsDeheadedDir; // Path to the deheadered ROMs directory + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsDeheadedDirCheck = PathROMsDeheadedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsDeheadedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsDeheaded Directory (" + strPathROMsDeheadedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.a78", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Deheader all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Length > 128) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 128); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(128, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Deheadered " + intCounterTotalDeheaded + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Deheadering all possible 7800 ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Deheadering all possible 7800 ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Deheaders all possible Lynx ROMs. + /// + private void DeheadLnxROMs() + { + try + { + // Print to screen + OutputLine("Info: Deheadering all possible Lynx ROMs ..."); + + // Declarations + int intCounterTotalDeheaded = 0; // Total deheadered counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsDeheadedDir = PathROMsDeheadedDir; // Path to the deheadered ROMs directory + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsDeheadedDirCheck = PathROMsDeheadedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsDeheadedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsDeheaded Directory (" + strPathROMsDeheadedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.lnx", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Deheader all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Length > 64) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 64); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(64, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Deheadered " + intCounterTotalDeheaded + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Deheadering all possible Lynx ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Deheadering all possible Lynx ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Deheaders all possible ROMs. + /// + private void DeheadAllROMs() + { + try + { + // Print to screen + OutputLine("Info: Deheadering all possible ROMs ..."); + + // Declarations + int intCounterTotalDeheaded = 0; // Total deheadered counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsDeheadedDir = PathROMsDeheadedDir; // Path to the deheadered ROMs directory + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsDeheadedDirCheck = PathROMsDeheadedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsDeheadedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsDeheaded Directory (" + strPathROMsDeheadedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Deheader all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if ((fiInputFile.Extension == ".fds" || fiInputFile.Extension == ".nes") && fiInputFile.Length > 16) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 16); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(16, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + else if (fiInputFile.Extension == ".lnx" && fiInputFile.Length > 64) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 64); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(64, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + else if (fiInputFile.Extension == ".a78" && fiInputFile.Length > 128) + { + OutputLine("Deheading: " + fiInputFile.FullName); + int intOutputFileLength = (int)(fiInputFile.Length - 128); + byte[] arrOutputFileBytes = new byte[intOutputFileLength]; + using (BinaryReader reader = new BinaryReader(new FileStream(fiInputFile.FullName, FileMode.Open))) + { + reader.BaseStream.Seek(128, SeekOrigin.Begin); + reader.Read(arrOutputFileBytes, 0, intOutputFileLength); + } + File.WriteAllBytes(Path.Combine(strPathROMsDeheadedDir, fiInputFile.Name), arrOutputFileBytes); + intCounterTotalDeheaded = intCounterTotalDeheaded + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Deheadered " + intCounterTotalDeheaded + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Deheadering all possible ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Deheadering all possible ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Sort Game Names + + /// + /// Sorts all game names in all datafiles from A-Z. + /// + private void SortA2Z() + { + try + { + // Print to screen + OutputLine("Info: Sorting all game names in all datafiles ..."); + + // Declarations + int intCounterTotalSorted = 0; // Total sorted counter + int intCountArrDirFiles = 0; // Total loop count + string strPathDatsDir = PathDatsDir; // Path to the Dats directory + string strPathDatsSortedDir = PathDatsSortedDir; // Path to the sorted Dats directory + + // Checkers + bool boolPathDatsDirCheck = PathDatsDirCheck(); + bool boolPathDatsSortedDirCheck = PathDatsSortedDirCheck(); + + // Check the paths and directories. + if (boolPathDatsDirCheck == false && boolPathDatsSortedDirCheck == false) + { + // Print to screen + OutputLine("Options: Dats Directory (" + strPathDatsDir + ")"); + OutputLine("Options: DatsSorted Directory (" + strPathDatsSortedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathDatsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Sort all of the game names in all datafiles. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Extension == ".dat" || fiInputFile.Extension == ".ppd" || fiInputFile.Extension == ".xml") + { + try + { + + XDocument xdocDatafile = XDocument.Load(strPathFile); + XDocument xdocDatafileNew = new XDocument(); + OutputLine("Sorting: " + fiInputFile.Name); + xdocDatafileNew.Declaration = xdocDatafile.Declaration; + xdocDatafileNew.Add(xdocDatafile.Root); + xdocDatafileNew.Root.RemoveNodes(); + xdocDatafileNew.Root.Add(xdocDatafile.Root.Elements("header")); + xdocDatafileNew.Root.Add(xdocDatafile.Root.Elements("game").OrderBy(e => e.Attribute("name").Value)); + xdocDatafileNew.Save(Path.Combine(strPathDatsSortedDir, fiInputFile.Name)); + intCounterTotalSorted = intCounterTotalSorted + 1; + } + catch + { + // Print to screen + OutputLine("Error: Incompatible datafile (" + fiInputFile.Name + ")"); + } + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Sorted " + intCounterTotalSorted + " Dats in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Sorting all game names in all datafiles completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Sorting all game names in all datafiles failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Sorts all game names in all datafiles from Z-A. + /// + private void SortZ2A() + { + try + { + // Print to screen + OutputLine("Info: Sorting all game names in all datafiles ..."); + + // Declarations + int intCounterTotalSorted = 0; // Total sorted counter + int intCountArrDirFiles = 0; // Total loop count + string strPathDatsDir = PathDatsDir; // Path to the Dats directory + string strPathDatsSortedDir = PathDatsSortedDir; // Path to the sorted Dats directory + + // Checkers + bool boolPathDatsDirCheck = PathDatsDirCheck(); + bool boolPathDatsSortedDirCheck = PathDatsSortedDirCheck(); + + // Check the paths and directories. + if (boolPathDatsDirCheck == false && boolPathDatsSortedDirCheck == false) + { + // Print to screen + OutputLine("Options: Dats Directory (" + strPathDatsDir + ")"); + OutputLine("Options: DatsSorted Directory (" + strPathDatsSortedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathDatsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Sort all of the game names in all datafiles. + foreach (string strPathFile in arrDirFiles) + { + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Extension == ".dat" || fiInputFile.Extension == ".ppd" || fiInputFile.Extension == ".xml") + { + try + { + + XDocument xdocDatafile = XDocument.Load(strPathFile); + XDocument xdocDatafileNew = new XDocument(); + OutputLine("Sorting: " + fiInputFile.Name); + xdocDatafileNew.Declaration = xdocDatafile.Declaration; + xdocDatafileNew.Add(xdocDatafile.Root); + xdocDatafileNew.Root.RemoveNodes(); + xdocDatafileNew.Root.Add(xdocDatafile.Root.Elements("header")); + xdocDatafileNew.Root.Add(xdocDatafile.Root.Elements("game").OrderByDescending(e => e.Attribute("name").Value)); + xdocDatafileNew.Save(Path.Combine(strPathDatsSortedDir, fiInputFile.Name)); + intCounterTotalSorted = intCounterTotalSorted + 1; + } + catch + { + // Print to screen + OutputLine("Error: Incompatible datafile (" + fiInputFile.Name + ")"); + } + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Sorted " + intCounterTotalSorted + " Dats in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Sorting all game names in all datafiles completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Sorting all game names in all datafiles failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Split Datafiles + + /// + /// Splits all datafiles. + /// + private void SplitDats() + { + try + { + // Print to screen + OutputLine("Info: Splitting all datafiles ..."); + + // Declarations + int intCounterTotalSplit = 0; // Total split counter + int intCountArrDirFiles = 0; // Total loop count + string strPathDatsDir = PathDatsDir; // Path to the Dats directory + string strPathDatsSplitDir = PathDatsSplitDir; // Path to the split Dats directory + string strFilterText = FilterText; // Text to filter + + // Checkers + bool boolPathDatsDirCheck = PathDatsDirCheck(); + bool boolPathDatsSplitDirCheck = PathDatsSplitDirCheck(); + + // Check the paths and directories. + if (boolPathDatsDirCheck == false && boolPathDatsSplitDirCheck == false) + { + // Print to screen + OutputLine("Options: Dats Directory (" + strPathDatsDir + ")"); + OutputLine("Options: DatsSplit Directory (" + strPathDatsSplitDir + ")"); + OutputLine("Options: Filter Text (" + strFilterText + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathDatsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Split all datafiles. + foreach (string strPathFile in arrDirFiles) + { + int intCounterTotalGames = 0; + FileInfo fiInputFile = new FileInfo(strPathFile); + if (fiInputFile.Extension == ".dat" || fiInputFile.Extension == ".ppd" || fiInputFile.Extension == ".xml") + { + try + { + XDocument xdocDatafile = XDocument.Load(strPathFile); + XDocument xdocDatafileNew = new XDocument(); + OutputLine("Splitting: " + fiInputFile.Name); + xdocDatafileNew.Declaration = xdocDatafile.Declaration; + xdocDatafileNew.Add(xdocDatafile.Root); + xdocDatafileNew.Root.RemoveNodes(); + xdocDatafileNew.Root.Add(xdocDatafile.Root.Elements("header")); + foreach (XElement xelGame in xdocDatafile.Descendants("game")) + { + if (xelGame.Attribute("name").Value.Contains(strFilterText)) + { + xdocDatafileNew.Root.Add(xelGame); + intCounterTotalGames = intCounterTotalGames + 1; + } + } + string strName = xdocDatafile.Element("datafile").Element("header").Element("name").Value + " [" + strFilterText + "]"; + string strVersion = DateTime.Now.ToString("yyyyMMdd HHmmss"); + string strDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); + string strDescription = strName + " (" + intCounterTotalGames + ") (" + strVersion + ")"; + string strAuthor = xdocDatafile.Element("datafile").Element("header").Element("author").Value + ", " + AppName + " v" + AppVersion; + string strOutputFileName = Path.Combine(strPathDatsSplitDir, strDescription + fiInputFile.Extension); + strOutputFileName = Regex.Replace(strOutputFileName, "\\/", "-"); + xdocDatafileNew.Element("datafile").Element("header").Element("name").Value = strName; + if (xdocDatafileNew.Element("datafile").Element("header").Descendants("description").Count() > 0) + { + xdocDatafileNew.Element("datafile").Element("header").Element("description").Value = strDescription; + } + if (xdocDatafileNew.Element("datafile").Element("header").Descendants("version").Count() > 0) + { + xdocDatafileNew.Element("datafile").Element("header").Element("version").Value = strVersion; + } + if (xdocDatafileNew.Element("datafile").Element("header").Descendants("date").Count() > 0) + { + xdocDatafileNew.Element("datafile").Element("header").Element("date").Value = strDate; + } + if (xdocDatafileNew.Element("datafile").Element("header").Descendants("author").Count() > 0) + { + xdocDatafileNew.Element("datafile").Element("header").Element("author").Value = strAuthor; + } + xdocDatafileNew.Save(strOutputFileName); + intCounterTotalSplit = intCounterTotalSplit + 1; + } + catch + { + // Print to screen + OutputLine("Error: Incompatible datafile (" + fiInputFile.Name + ")"); + } + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Split " + intCounterTotalSplit + " Dats in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Splitting all datafiles completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Splitting all datafiles failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Build Patches Datafile + + /// + /// Builds a datafile from the Patches directory. + /// + public void BuildPatchesDatafile() + { + try + { + // Print to screen + OutputLine("Info: Building new patches datafile ..."); + + // Declarations + int intCounterTotalBuilt = 0; // Total built counter + int intCountArrDirFiles = 0; // Total loop count + string strPathPatchesDir = PathPatchesDir; // Path to the Patches directory + string strPathDatsDir = PathDatsDir; // Path to the Dats directory + string strName = Path.GetFileName(PathPatchesDir); // Datafile name + string strVersion = DateTime.Now.ToString("yyyyMMdd HHmmss"); // Datafile version + string strDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); // Datafile date + string strDescription = strName + " (0) (" + strVersion + ")"; // Datafile description + string strCategory = "Games"; // Datafile category + string strAuthor = AppName + " v" + AppVersion; // Datafile author + string strComment = Comment; // Datafile comment + string strPathSaveFilename = ""; // Path to the new datafile + + // Checkers + bool boolPathDatsDirCheck = PathDatsDirCheck(); + bool boolPathPatchesDirCheck = PathPatchesDirCheck(); + + // Check the paths and directories. + if (boolPathDatsDirCheck == false && boolPathPatchesDirCheck == false) + { + // Print to screen + OutputLine("Options: Patches Directory (" + strPathPatchesDir + ")"); + OutputLine("Options: Dats Directory (" + strPathDatsDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathPatchesDir, "*.xd3"); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Build a datafile from the patches directory files. + if (intCountArrDirFiles > 0) + { + // Create a new datafile XDocument. + XDocument xdocDatafile = new XDocument( + new XDeclaration("1.0", "utf-8", "yes"), + new XElement("datafile", + new XElement("header", + new XElement("name", strName), + new XElement("description", strDescription), + new XElement("category", strCategory), + new XElement("version", strVersion), + new XElement("date", strDate), + new XElement("author", strAuthor), + new XElement("comment", strComment) + ) + ) + ); + + // Loop through the directory files array. + foreach (string strPathFile in arrDirFiles) + { + // Get the patch filesize and filename. + string strRomFilename = Path.GetFileName(strPathFile); + string strRomFileSize = new FileInfo(strPathFile).Length.ToString(); + + // Print to screen + OutputLine("Adding: " + strRomFilename); + + // Get the game name, category and description. + string strGameName = Path.GetFileNameWithoutExtension(strPathFile); + string strGameCategory = "Patches"; + string strGameDescription = Path.GetFileNameWithoutExtension(strPathFile); + + // Get the patch hashes. + byte[] arrRomFileHashSHA1 = new SHA1CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + byte[] arrRomFileHashMD5 = new MD5CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + byte[] arrRomFileHashCRC = new CRC32CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + string strRomFileHashSHA1 = BitConverter.ToString(arrRomFileHashSHA1).Replace("-", "").ToLower(); + string strRomFileHashMD5 = BitConverter.ToString(arrRomFileHashMD5).Replace("-", "").ToLower(); + string strRomFileHashCRC = BitConverter.ToString(arrRomFileHashCRC).Replace("-", "").ToLower(); + + // Add the patch file to the datafile XDocument. + xdocDatafile.Element("datafile").Add( + new XElement("game", + new XAttribute("name", strGameName), + new XElement("category", strGameCategory), + new XElement("description", strGameDescription), + new XElement("rom", + new XAttribute("name", strRomFilename), + new XAttribute("size", strRomFileSize), + new XAttribute("crc", strRomFileHashCRC), + new XAttribute("md5", strRomFileHashMD5), + new XAttribute("sha1", strRomFileHashSHA1) + ) + ) + ); + + // Increment the counter. + intCounterTotalBuilt = intCounterTotalBuilt + 1; + } + + // Modify the datafile header elements and filename. + xdocDatafile.Element("datafile").Element("header").Element("description").Value = strName + " (" + intCounterTotalBuilt + ") (" + strVersion + ")"; + strPathSaveFilename = Path.Combine(strPathDatsDir, strName + " (" + intCounterTotalBuilt + ") (" + strVersion + ").dat"); + + // Save the contents of the datafile XDocument to the file. + xdocDatafile.Save(strPathSaveFilename); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: " + intCounterTotalBuilt + " patches added to datafile successfully in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Building patches datafile completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Building patches datafile failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Build ROMs Datafile + + /// + /// Builds a datafile from the ROMs directory. + /// + public void BuildROMsDatafile() + { + try + { + // Print to screen + OutputLine("Info: Building new ROMs datafile ..."); + + // Declarations + int intCounterTotalBuilt = 0; // Total built counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathDatsDir = PathDatsDir; // Path to the Dats directory + string strName = Path.GetFileName(PathROMsDir); // Datafile name + string strVersion = DateTime.Now.ToString("yyyyMMdd HHmmss"); // Datafile version + string strDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); // Datafile date + string strDescription = strName + " (0) (" + strVersion + ")"; // Datafile description + string strCategory = "Games"; // Datafile category + string strAuthor = AppName + " v" + AppVersion; // Datafile author + string strComment = Comment; // Datafile comment + string strPathSaveFilename = ""; // Path to the new datafile + + // Checkers + bool boolPathDatsDirCheck = PathDatsDirCheck(); + bool boolPathROMsDirCheck = PathROMsDirCheck(); + + // Check the paths and directories. + if (boolPathDatsDirCheck == false && boolPathROMsDirCheck == false) + { + // Print to screen + OutputLine("Options: Dats Directory (" + strPathDatsDir + ")"); + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*"); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Build a datafile from the ROMs directory files. + if (intCountArrDirFiles > 0) + { + // Create a new datafile XDocument. + XDocument xdocDatafile = new XDocument( + new XDeclaration("1.0", "utf-8", "yes"), + new XElement("datafile", + new XElement("header", + new XElement("name", strName), + new XElement("description", strDescription), + new XElement("category", strCategory), + new XElement("version", strVersion), + new XElement("date", strDate), + new XElement("author", strAuthor), + new XElement("comment", strComment) + ) + ) + ); + + // Loop through the directory files array. + foreach (string strPathFile in arrDirFiles) + { + // Get the ROM filesize and filename. + string strRomFilename = Path.GetFileName(strPathFile); + string strRomFileSize = new FileInfo(strPathFile).Length.ToString(); + + // Print to screen + OutputLine("Adding: " + strRomFilename); + + // Get the game name, category and description. + string strGameName = Path.GetFileNameWithoutExtension(strPathFile); + string strGameCategory = "Games"; + string strGameDescription = Path.GetFileNameWithoutExtension(strPathFile); + + // Get the ROM hashes. + byte[] arrRomFileHashSHA1 = new SHA1CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + byte[] arrRomFileHashMD5 = new MD5CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + byte[] arrRomFileHashCRC = new CRC32CryptoServiceProvider().ComputeHash(File.OpenRead(strPathFile)); + string strRomFileHashSHA1 = BitConverter.ToString(arrRomFileHashSHA1).Replace("-", "").ToLower(); + string strRomFileHashMD5 = BitConverter.ToString(arrRomFileHashMD5).Replace("-", "").ToLower(); + string strRomFileHashCRC = BitConverter.ToString(arrRomFileHashCRC).Replace("-", "").ToLower(); + + // Add the patch file to the datafile XDocument. + xdocDatafile.Element("datafile").Add( + new XElement("game", + new XAttribute("name", strGameName), + new XElement("category", strGameCategory), + new XElement("description", strGameDescription), + new XElement("rom", + new XAttribute("name", strRomFilename), + new XAttribute("size", strRomFileSize), + new XAttribute("crc", strRomFileHashCRC), + new XAttribute("md5", strRomFileHashMD5), + new XAttribute("sha1", strRomFileHashSHA1) + ) + ) + ); + + // Increment the counter. + intCounterTotalBuilt = intCounterTotalBuilt + 1; + } + + // Modify the datafile header elements and filename. + xdocDatafile.Element("datafile").Element("header").Element("description").Value = strName + " (" + intCounterTotalBuilt + ") (" + strVersion + ")"; + strPathSaveFilename = Path.Combine(strPathDatsDir, strName + " (" + intCounterTotalBuilt + ") (" + strVersion + ").dat"); + + // Save the contents of the datafile XDocument to the file. + xdocDatafile.Save(strPathSaveFilename); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: " + intCounterTotalBuilt + " ROMs added to datafile successfully in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Building ROMs datafile completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Building ROMs datafile failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + + #region Trim ROMs + + /// + /// Trims the zeros from the beginning of all possible ROMs. + /// + public void LTrimROMs() + { + try + { + // Print to screen + OutputLine("Info: Trimming the zeros from the beginning of all possible ROMs ..."); + + // Declarations + int intCounterTotalTrimmed = 0; // Total trimmed counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsTrimmedDir = PathROMsTrimmedDir; // Path to the trimmed ROMs directory + int intBufferSize = BufferSize; // Buffer size + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsTrimmedDirCheck = PathROMsTrimmedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsTrimmedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsTrimmed Directory (" + strPathROMsTrimmedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Trim all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + OutputLine("Info: Trimming the zeros from the beginning of all possible ROMs is not yet implemented"); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Trimmed " + intCounterTotalTrimmed + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Trimming the zeros from the beginning of ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Trimming ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Trims the zeros from the end of all possible ROMs. + /// + public void RTrimROMs() + { + try + { + // Print to screen + OutputLine("Info: Trimming the zeros from the end of all possible ROMs ..."); + + // Declarations + int intCounterTotalTrimmed = 0; // Total trimmed counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsTrimmedDir = PathROMsTrimmedDir; // Path to the trimmed ROMs directory + int intBufferSize = BufferSize; // Buffer size + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsTrimmedDirCheck = PathROMsTrimmedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsTrimmedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsTrimmed Directory (" + strPathROMsTrimmedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Trim all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + int intNumBytes; + using (FileStream fsInputFile = new FileStream(strPathFile, FileMode.Open)) + { + OutputLine("Info: Checking (" + strPathFile + ")"); + bool boolExitFlag = false; + fsInputFile.Seek(0, SeekOrigin.End); + for (intNumBytes = -1; boolExitFlag == false; intNumBytes++) + { + fsInputFile.Seek(-1, SeekOrigin.Current); + byte byteByte = (byte)fsInputFile.ReadByte(); + if (byteByte == 0) + { + boolExitFlag = false; + } + else + { + boolExitFlag = true; + } + fsInputFile.Seek(-1, SeekOrigin.Current); + } + } + if (intNumBytes > 0) + { + OutputLine("Info: Trimming " + intNumBytes + " bytes from the end of (" + strPathFile + ")"); + using (FileStream fsInputFile = new FileStream(strPathFile, FileMode.Open)) + { + using (FileStream fsOutputFile = new FileStream(Path.Combine(strPathROMsTrimmedDir, Path.GetFileName(strPathFile)), FileMode.Create)) + { + long longOutputFileLength = fsInputFile.Length - intNumBytes; + fsOutputFile.SetLength(longOutputFileLength); + int bytesRead = -1; + byte[] bytes = new byte[intBufferSize]; + while ((bytesRead = fsInputFile.Read(bytes, 0, intBufferSize)) > 0) + { + if (fsInputFile.Position < longOutputFileLength) + { + fsOutputFile.Write(bytes, 0, bytesRead); + } + else + { + bytesRead = (int)(longOutputFileLength - fsOutputFile.Position); + fsOutputFile.Write(bytes, 0, bytesRead); + } + } + } + } + intCounterTotalTrimmed = intCounterTotalTrimmed + 1; + } + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Trimmed " + intCounterTotalTrimmed + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Trimming the zeros from the end of ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Trimming ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Trims all possible ROMs to a specific size. + /// + public void STrimROMs() + { + try + { + // Print to screen + OutputLine("Info: Trimming all possible ROMs to a specific size ..."); + + // Declarations + int intCounterTotalTrimmed = 0; // Total trimmed counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsTrimmedDir = PathROMsTrimmedDir; // Path to the trimmed ROMs directory + int intBufferSize = BufferSize; // Buffer size + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsTrimmedDirCheck = PathROMsTrimmedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsTrimmedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsTrimmed Directory (" + strPathROMsTrimmedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Trim all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + OutputLine("Info: Trimming all possible ROMs to a specific size is not yet implemented"); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Trimmed " + intCounterTotalTrimmed + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Trimming ROMs to a specific size completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Trimming ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Trims a specific size from the beginning of all possible ROMs. + /// + public void SFLTrimROMs() + { + try + { + // Print to screen + OutputLine("Info: Trimming bytes from the beginning of all possible ROMs ..."); + + // Declarations + int intCounterTotalTrimmed = 0; // Total trimmed counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsTrimmedDir = PathROMsTrimmedDir; // Path to the trimmed ROMs directory + int intBufferSize = BufferSize; // Buffer size + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsTrimmedDirCheck = PathROMsTrimmedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsTrimmedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsTrimmed Directory (" + strPathROMsTrimmedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Trim all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + OutputLine("Info: Trimming bytes from the beginning of all possible ROMs is not yet implemented"); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Trimmed " + intCounterTotalTrimmed + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Trimming bytes from the beginning of ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Trimming ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + /// + /// Trims a specific size from the end of all possible ROMs. + /// + public void SFRTrimROMs() + { + try + { + // Print to screen + OutputLine("Info: Trimming bytes from the end of all possible ROMs ..."); + + // Declarations + int intCounterTotalTrimmed = 0; // Total trimmed counter + int intCountArrDirFiles = 0; // Total loop count + string strPathROMsDir = PathROMsDir; // Path to the ROMs directory + string strPathROMsTrimmedDir = PathROMsTrimmedDir; // Path to the trimmed ROMs directory + int intBufferSize = BufferSize; // Buffer size + + // Checkers + bool boolPathROMsDirCheck = PathROMsDirCheck(); + bool boolPathROMsTrimmedDirCheck = PathROMsTrimmedDirCheck(); + + // Check the paths and directories. + if (boolPathROMsDirCheck == false && boolPathROMsTrimmedDirCheck == false) + { + // Print to screen + OutputLine("Options: ROMs Directory (" + strPathROMsDir + ")"); + OutputLine("Options: ROMsTrimmed Directory (" + strPathROMsTrimmedDir + ")"); + + // Get the directory files array and count. + string[] arrDirFiles = Directory.GetFiles(strPathROMsDir, "*.*", SearchOption.AllDirectories); + intCountArrDirFiles = arrDirFiles.Count(); + + // Create and start a stopwatch. + var stopWatch = new Stopwatch(); + stopWatch.Start(); + + // Main loop - Trim all of the ROMs. + foreach (string strPathFile in arrDirFiles) + { + OutputLine("Info: Trimming bytes from the end of all possible ROMs is not yet implemented"); + } + + // Stop the stopwatch. + stopWatch.Stop(); + + // Print to screen + OutputLine("Info: Trimmed " + intCounterTotalTrimmed + " ROMs in " + stopWatch.Elapsed); + } + + // Print to screen + OutputLine("Info: Trimming bytes from the end of ROMs completed"); + OutputLine(""); + } + catch (Exception ex) + { + // Print to screen + OutputLine("Error: Trimming ROMs failed"); + OutputLine("Error: " + ex.Message); + OutputLine(""); + } + } + + #endregion + } +} diff --git a/AutomatedROMTools-CLI/CRC32CryptoServiceProvider.cs b/AutomatedROMTools-CLI/CRC32CryptoServiceProvider.cs new file mode 100644 index 0000000..3d59a35 --- /dev/null +++ b/AutomatedROMTools-CLI/CRC32CryptoServiceProvider.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; + +namespace AutomatedROMTools +{ + /// + /// Implements a 32-bit CRC hash algorithm compatible with Zip etc. + /// + /// + /// If you need to call multiple times for the same data either use the HashAlgorithm + /// interface or remember that the result of one Compute call needs to be ~ (XOR) before + /// being passed in as the seed for the next Compute call. + /// + public sealed class CRC32CryptoServiceProvider : HashAlgorithm + { + public const UInt32 DefaultPolynomial = 0xedb88320u; + public const UInt32 DefaultSeed = 0xffffffffu; + static UInt32[] defaultTable; + readonly UInt32 seed; + readonly UInt32[] table; + UInt32 hash; + + public CRC32CryptoServiceProvider() : this(DefaultPolynomial, DefaultSeed) + { + + } + + public CRC32CryptoServiceProvider(UInt32 polynomial, UInt32 seed) + { + table = InitializeTable(polynomial); + this.seed = hash = seed; + } + + public override void Initialize() + { + hash = seed; + } + + protected override void HashCore(byte[] array, int ibStart, int cbSize) + { + hash = CalculateHash(table, hash, array, ibStart, cbSize); + } + + protected override byte[] HashFinal() + { + var hashBuffer = UInt32ToBigEndianBytes(~hash); + HashValue = hashBuffer; + return hashBuffer; + } + + public override int HashSize + { + get { return 32; } + } + + public static UInt32 Compute(byte[] buffer) + { + return Compute(DefaultSeed, buffer); + } + + public static UInt32 Compute(UInt32 seed, byte[] buffer) + { + return Compute(DefaultPolynomial, seed, buffer); + } + + public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer) + { + return ~CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length); + } + + static UInt32[] InitializeTable(UInt32 polynomial) + { + if (polynomial == DefaultPolynomial && defaultTable != null) + return defaultTable; + + var createTable = new UInt32[256]; + for (var i = 0; i < 256; i++) + { + var entry = (UInt32)i; + for (var j = 0; j < 8; j++) + if ((entry & 1) == 1) + entry = (entry >> 1) ^ polynomial; + else + entry = entry >> 1; + createTable[i] = entry; + } + + if (polynomial == DefaultPolynomial) + defaultTable = createTable; + + return createTable; + } + + static UInt32 CalculateHash(UInt32[] table, UInt32 seed, IList buffer, int start, int size) + { + var hash = seed; + for (var i = start; i < start + size; i++) + hash = (hash >> 8) ^ table[buffer[i] ^ hash & 0xff]; + return hash; + } + + static byte[] UInt32ToBigEndianBytes(UInt32 uint32) + { + var result = BitConverter.GetBytes(uint32); + + if (BitConverter.IsLittleEndian) + Array.Reverse(result); + + return result; + } + } +} diff --git a/AutomatedROMTools-CLI/DatEmAll.cs b/AutomatedROMTools-CLI/DatEmAll.cs new file mode 100644 index 0000000..8004493 --- /dev/null +++ b/AutomatedROMTools-CLI/DatEmAll.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + class DatEmAll + { + } +} diff --git a/AutomatedROMTools-CLI/DeheadEmAll.cs b/AutomatedROMTools-CLI/DeheadEmAll.cs new file mode 100644 index 0000000..7e90ab6 --- /dev/null +++ b/AutomatedROMTools-CLI/DeheadEmAll.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + class DeheadEmAll + { + } +} diff --git a/AutomatedROMTools-CLI/Program.cs b/AutomatedROMTools-CLI/Program.cs new file mode 100644 index 0000000..5cd6104 --- /dev/null +++ b/AutomatedROMTools-CLI/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + /// + /// The Main Program Class. + /// + class Program + { + static void Main(string[] args) + { + // Create a new program object. + AutomatedROMTools ART = new AutomatedROMTools(); + + // Input the variables passed from the command line arguments. + ART.SetVariablesFromCLI(args); + + // Print the version. + ART.PrintVersion(); + + // Process the command switch. + ART.ProcessCommandSwitch(); + + // Output the log to a text file. + ART.SaveLog(); + } + } +} diff --git a/AutomatedROMTools-CLI/Properties/AssemblyInfo.cs b/AutomatedROMTools-CLI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bfd123b --- /dev/null +++ b/AutomatedROMTools-CLI/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("AutomatedROMTools-CLI")] +[assembly: AssemblyDescription("Automated ROM Tools")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Automated ROM Tools")] +[assembly: AssemblyProduct("AutomatedROMTools-CLI")] +[assembly: AssemblyCopyright("Copyright (c) 2016-2025 Automated ROM Tools")] +[assembly: AssemblyTrademark("Automated ROM Tools")] +[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("b9c0b7e7-fc25-4f96-8115-453d1759e25a")] + +// 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("0.0.2")] +[assembly: AssemblyFileVersion("0.0.2")] diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildPatchesDat.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildPatchesDat.bat new file mode 100644 index 0000000..c94bb76 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildPatchesDat.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -buildpatchesdat + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildROMsDat.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildROMsDat.bat new file mode 100644 index 0000000..5ec827b --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-BuildROMsDat.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -buildromsdat "RD:..\ROMs" + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadA78.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadA78.bat new file mode 100644 index 0000000..744a7f7 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadA78.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -deheada78 + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadAll.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadAll.bat new file mode 100644 index 0000000..30c441a --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadAll.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -deheadall + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadFDS.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadFDS.bat new file mode 100644 index 0000000..12f1d53 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadFDS.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -deheadfds + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadLnx.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadLnx.bat new file mode 100644 index 0000000..aab48b0 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadLnx.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -deheadlnx + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadNES.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadNES.bat new file mode 100644 index 0000000..d77b468 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-DeheadNES.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -deheadnes + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintHelp.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintHelp.bat new file mode 100644 index 0000000..efbe4e3 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintHelp.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -help "LF:..\Logs\Log_ART_00000000_000000.txt" + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintLicense.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintLicense.bat new file mode 100644 index 0000000..13082ee --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintLicense.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -license + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintVersion.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintVersion.bat new file mode 100644 index 0000000..852260f --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-PrintVersion.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -version + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortA2Z.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortA2Z.bat new file mode 100644 index 0000000..c68f9cd --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortA2Z.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -sorta2z + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortZ2A.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortZ2A.bat new file mode 100644 index 0000000..b900653 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-SortZ2A.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -sortz2a + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-Split-(USA).bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-Split-(USA).bat new file mode 100644 index 0000000..caa48c9 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-Split-(USA).bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -split "FT:(USA)" + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-TrimZerosFromEnd.bat b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-TrimZerosFromEnd.bat new file mode 100644 index 0000000..0d73df1 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/AutomatedROMTools-TrimZerosFromEnd.bat @@ -0,0 +1,7 @@ +@echo off + +rem */ Main /* +"..\AutomatedROMTools-CLI.exe" -trimzerosfromend + +rem */ Pause /* +@pause diff --git a/AutomatedROMTools-CLI/Resources/Output/Batches/put your batches in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/Batches/put your batches in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Batches/put your batches in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/Dats/put your dats in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/Dats/put your dats in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Dats/put your dats in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/DatsSorted/put your sorted dats in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/DatsSorted/put your sorted dats in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/DatsSorted/put your sorted dats in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/DatsSplit/put your split dats in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/DatsSplit/put your split dats in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/DatsSplit/put your split dats in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/Docs/AutomatedROMTools-Help.txt b/AutomatedROMTools-CLI/Resources/Output/Docs/AutomatedROMTools-Help.txt new file mode 100644 index 0000000..9fd235d --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Docs/AutomatedROMTools-Help.txt @@ -0,0 +1,63 @@ +------------------------------------------------------------------------------- +AutomatedROMTools - Help version 20250809 +Copyright (c) 2016-2025 AutomatedROMTools - All Rights Reserved +------------------------------------------------------------------------------- + +[I] About +[II] Notes +[III] Installation +[IV] Thanks +[V] Disclaimer + +[I] About +------------------------------------------------------------------------------- +Automated ROM Tools or ART is The Original Automated ROM Tools. Automated ROM Tools or ART is a suite of automated ROM and datafile software tools. + +Here are some of the features of Automated ROM Tools: +* Building dats for patches +* Building dats for ROMs +* Sorting dats +* Splitting dats +* Deheadering ROMs +* Trimming ROMs +* More to come + +Automated ROM Tools is mostly unfinished. The GUI does not exist yet. + + +[II] Notes +------------------------------------------------------------------------------- +1) This software should NOT be used on files that are not backed up! +2) This software should be installed as close to the drive's root directory as possible. The nature of things dictates that there will be very long filenames, on occasion. Keep in mind that some things may not work correctly if you choose too long of a path to put your files. + +[III] Installation +------------------------------------------------------------------------------- +Download and unzip the program to any location that you wish to use. However, this software should be installed as close to the drive's root directory as possible. + +I like to put my installation in a directory called ART on my C:\ drive. My installation layout looks like this: + +C:\ART\Batches\ +C:\ART\Dats\ +C:\ART\DatsSorted\ +C:\ART\DatsSplit\ +C:\ART\Docs\ +C:\ART\Logs\ +C:\ART\Patches\ +C:\ART\ROMs\ +C:\ART\ROMsDeheaded\ +C:\ART\ROMsTrimmed\ +C:\ART\AutomatedROMTools-CLI.exe + +[IV] Thanks +------------------------------------------------------------------------------- +Thanks to the development team and everyone who inspired or made this possible. + +[V] Disclaimer +------------------------------------------------------------------------------- +This software may not be used for any illegal purposes or activities. It is your responsibility to use this software in accordance with all applicable laws. + +This software may only be used and/or distributed in accordance with the license with which it is distributed. + +This software may only be used on files that you own and/or have the right to use it on. + +AutomatedROMTools has not, does not and will not post or host any patches or ROMs. diff --git a/AutomatedROMTools-CLI/Resources/Output/Patches/put your patches in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/Patches/put your patches in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/Patches/put your patches in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/ROMs/put your roms in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/ROMs/put your roms in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/ROMs/put your roms in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/ROMsDeheaded/put your deheadered roms in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/ROMsDeheaded/put your deheadered roms in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/ROMsDeheaded/put your deheadered roms in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/Resources/Output/ROMsTrimmed/put your trimmed roms in this directory.txt b/AutomatedROMTools-CLI/Resources/Output/ROMsTrimmed/put your trimmed roms in this directory.txt new file mode 100644 index 0000000..6d78808 --- /dev/null +++ b/AutomatedROMTools-CLI/Resources/Output/ROMsTrimmed/put your trimmed roms in this directory.txt @@ -0,0 +1 @@ +This file can be deleted. \ No newline at end of file diff --git a/AutomatedROMTools-CLI/SortEmAll.cs b/AutomatedROMTools-CLI/SortEmAll.cs new file mode 100644 index 0000000..5d2f5c7 --- /dev/null +++ b/AutomatedROMTools-CLI/SortEmAll.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + class SortEmAll + { + } +} diff --git a/AutomatedROMTools-CLI/SplitEmAll.cs b/AutomatedROMTools-CLI/SplitEmAll.cs new file mode 100644 index 0000000..e849797 --- /dev/null +++ b/AutomatedROMTools-CLI/SplitEmAll.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + class SplitEmAll + { + } +} diff --git a/AutomatedROMTools-CLI/TrimEmAll.cs b/AutomatedROMTools-CLI/TrimEmAll.cs new file mode 100644 index 0000000..877c5de --- /dev/null +++ b/AutomatedROMTools-CLI/TrimEmAll.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AutomatedROMTools +{ + class TrimEmAll + { + } +} diff --git a/AutomatedROMTools-GUI/App.config b/AutomatedROMTools-GUI/App.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/AutomatedROMTools-GUI/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/AutomatedROMTools-GUI/AutomatedROMTools-GUI.csproj b/AutomatedROMTools-GUI/AutomatedROMTools-GUI.csproj new file mode 100644 index 0000000..ecdf302 --- /dev/null +++ b/AutomatedROMTools-GUI/AutomatedROMTools-GUI.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {36D5D1DF-7A99-464F-8CF8-A504916836E6} + WinExe + AutomatedROMTools + AutomatedROMTools-GUI + v4.8 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + FrmAutomatedROMTools.cs + + + + + FrmAutomatedROMTools.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/AutomatedROMTools-GUI/FrmAutomatedROMTools.Designer.cs b/AutomatedROMTools-GUI/FrmAutomatedROMTools.Designer.cs new file mode 100644 index 0000000..cfd73e5 --- /dev/null +++ b/AutomatedROMTools-GUI/FrmAutomatedROMTools.Designer.cs @@ -0,0 +1,61 @@ +namespace AutomatedROMTools +{ + partial class FrmAutomatedROMTools + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(171, 13); + this.label1.TabIndex = 0; + this.label1.Text = "The GUI project does not exist yet!"; + // + // FrmAutomatedROMTools + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 261); + this.Controls.Add(this.label1); + this.Name = "FrmAutomatedROMTools"; + this.Text = "Automated ROM Tools"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} + diff --git a/AutomatedROMTools-GUI/FrmAutomatedROMTools.cs b/AutomatedROMTools-GUI/FrmAutomatedROMTools.cs new file mode 100644 index 0000000..ffe1eaa --- /dev/null +++ b/AutomatedROMTools-GUI/FrmAutomatedROMTools.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AutomatedROMTools +{ + public partial class FrmAutomatedROMTools : Form + { + public FrmAutomatedROMTools() + { + InitializeComponent(); + } + } +} diff --git a/AutomatedROMTools-GUI/FrmAutomatedROMTools.resx b/AutomatedROMTools-GUI/FrmAutomatedROMTools.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/AutomatedROMTools-GUI/FrmAutomatedROMTools.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AutomatedROMTools-GUI/Program.cs b/AutomatedROMTools-GUI/Program.cs new file mode 100644 index 0000000..aefe1d3 --- /dev/null +++ b/AutomatedROMTools-GUI/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AutomatedROMTools +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new FrmAutomatedROMTools()); + } + } +} diff --git a/AutomatedROMTools-GUI/Properties/AssemblyInfo.cs b/AutomatedROMTools-GUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b84b1ff --- /dev/null +++ b/AutomatedROMTools-GUI/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("AutomatedROMTools-GUI")] +[assembly: AssemblyDescription("Automated ROM Tools")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Automated ROM Tools")] +[assembly: AssemblyProduct("AutomatedROMTools-GUI")] +[assembly: AssemblyCopyright("Copyright (c) 2016-2025 Automated ROM Tools")] +[assembly: AssemblyTrademark("Automated ROM Tools")] +[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("36d5d1df-7a99-464f-8cf8-a504916836e6")] + +// 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("0.0.2")] +[assembly: AssemblyFileVersion("0.0.2")] diff --git a/AutomatedROMTools-GUI/Properties/Resources.Designer.cs b/AutomatedROMTools-GUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c090308 --- /dev/null +++ b/AutomatedROMTools-GUI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AutomatedROMTools.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AutomatedROMTools.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/AutomatedROMTools-GUI/Properties/Resources.resx b/AutomatedROMTools-GUI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/AutomatedROMTools-GUI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AutomatedROMTools-GUI/Properties/Settings.Designer.cs b/AutomatedROMTools-GUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..11fab08 --- /dev/null +++ b/AutomatedROMTools-GUI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AutomatedROMTools.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/AutomatedROMTools-GUI/Properties/Settings.settings b/AutomatedROMTools-GUI/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/AutomatedROMTools-GUI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/AutomatedROMTools-Release/App.config b/AutomatedROMTools-Release/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/AutomatedROMTools-Release/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AutomatedROMTools-Release/AutomatedROMTools-Release.csproj b/AutomatedROMTools-Release/AutomatedROMTools-Release.csproj new file mode 100644 index 0000000..e544177 --- /dev/null +++ b/AutomatedROMTools-Release/AutomatedROMTools-Release.csproj @@ -0,0 +1,98 @@ + + + + + Debug + AnyCPU + {755DCDF4-811F-4417-96FC-48779EED6D06} + + + v4.8 + + + + AnyCPU + bin\Debug\ + false + + + AnyCPU + bin\Release\ + false + + + + + + + AutomatedROMTools + 0.0.2 + AutomatedROMTools-Portable + AutomatedROMTools-Source + AutomatedROMTools-CLI + AutomatedROMTools-GUI + $(OutputPath)Portable\ + $(OutputPath)ILMerge\ + $(OutputPath)Source\ + $(OutputPath)Releases\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AutomatedROMTools.sln b/AutomatedROMTools.sln new file mode 100644 index 0000000..3f90b39 --- /dev/null +++ b/AutomatedROMTools.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36327.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedROMTools-CLI", "AutomatedROMTools-CLI\AutomatedROMTools-CLI.csproj", "{B9C0B7E7-FC25-4F96-8115-453D1759E25A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedROMTools-GUI", "AutomatedROMTools-GUI\AutomatedROMTools-GUI.csproj", "{36D5D1DF-7A99-464F-8CF8-A504916836E6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}" + ProjectSection(SolutionItems) = preProject + CHANGELOG.md = CHANGELOG.md + CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md + CONTRIBUTING.md = CONTRIBUTING.md + LICENSE = LICENSE + README.md = README.md + TODO.md = TODO.md + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedROMTools-Release", "AutomatedROMTools-Release\AutomatedROMTools-Release.csproj", "{755DCDF4-811F-4417-96FC-48779EED6D06}" + ProjectSection(ProjectDependencies) = postProject + {36D5D1DF-7A99-464F-8CF8-A504916836E6} = {36D5D1DF-7A99-464F-8CF8-A504916836E6} + {B9C0B7E7-FC25-4F96-8115-453D1759E25A} = {B9C0B7E7-FC25-4F96-8115-453D1759E25A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B9C0B7E7-FC25-4F96-8115-453D1759E25A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9C0B7E7-FC25-4F96-8115-453D1759E25A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9C0B7E7-FC25-4F96-8115-453D1759E25A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9C0B7E7-FC25-4F96-8115-453D1759E25A}.Release|Any CPU.Build.0 = Release|Any CPU + {36D5D1DF-7A99-464F-8CF8-A504916836E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36D5D1DF-7A99-464F-8CF8-A504916836E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36D5D1DF-7A99-464F-8CF8-A504916836E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36D5D1DF-7A99-464F-8CF8-A504916836E6}.Release|Any CPU.Build.0 = Release|Any CPU + {755DCDF4-811F-4417-96FC-48779EED6D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {755DCDF4-811F-4417-96FC-48779EED6D06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {755DCDF4-811F-4417-96FC-48779EED6D06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {755DCDF4-811F-4417-96FC-48779EED6D06}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E07D0F09-A5F8-43CD-BBF7-54302981D0A8} + EndGlobalSection +EndGlobal diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ed90162 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +Version 0.0.2 - 2025-08-09 + +* Add Release project +* Add Resources +* Update repository info and related URLs +* Update to .NET Framework 4.8 again for some reason +* Minor changes + +Version 0.0.1 - 2023-04-30 + +* Update to .NET Framework 4.8 +* Initial release diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..41dd9eb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,127 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..98d3b62 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# @AutomatedROMTools +### The Original Automated ROM Tools +## Contributing +Let's work better together. We are looking to collaborate with like-minded people who want to contribute in any capacity. Collaboration is open to everyone and we need your help if you are a: +* Collector +* Database Administrator +* Datter +* Developer +* Dumper +* Graphic Artist +* Translator +* Player +* Tester + +Feel free to: +* Fork the repository +* Create an issue +* Branch your repository with the issue number and a meaningful name related to the changes you are making +* Create a pull request + +## Contact +GitEmAll: [https://gitemall.devemall.int.eu.org/TommySalami/AutomatedROMTools](https://gitemall.devemall.int.eu.org/TommySalami/AutomatedROMTools "GitEmAll") + +--- +###### Copyright (c) 2016-2025 Automated Redump 2 IRD - All Rights Reserved v2025-07-29-00 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cdcb076 --- /dev/null +++ b/LICENSE @@ -0,0 +1,38 @@ +*************************************************************** +Automated ROM Tools - License version 20250729 +Copyright (c) 2020-2025 Automated ROM Tools +All Rights Reserved +*************************************************************** + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Redistributions in any form are not permitted whatsoever, +under any conditions. + +2. This software may not be reverse engineered, decompiled, +or disassembled. + +3. Automated ROM Tools may publish revised and/or new +versions of the license from time to time. Each version will be +given a distinguishing version number. No one other than Redump +Disc Info Collector has the right to modify the terms applicable +to covered code created under this License. + +4. It is your responsibility to use this software in accordance +with all applicable laws. + +*************************************************************** + +THIS SOFTWARE IS PROVIDED BY THE AUTOMATED ROM TOOLS +DEVELOPMENT TEAM 'AS IS' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE Automated ROM Tools +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d75a199 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# @AutomatedROMTools +### The Original Automated ROM Tools +## About +Automated ROM Tools or ART is The Original Automated ROM Tools. Automated ROM Tools or ART is a suite of automated ROM and datafile software tools. + +Here are some of the features of Automated ROM Tools: +* Building dats for patches +* Building dats for ROMs +* Sorting dats +* Splitting dats +* Deheadering ROMs +* Trimming ROMs +* More to come + +Automated ROM Tools is mostly unfinished. The GUI does not exist yet. +## Dependencies +.Net Framework 4.8 +## Projects +* AutomatedROMTools-CLI - Console App +* AutomatedROMTools-GUI - Windows Forms App +* AutomatedROMTools-Release - Release Project +## How to ... +How to ... +## Contributing +Let's work better together. We are looking to collaborate with like-minded people who want to contribute in any capacity. Collaboration is open to everyone and we need your help if you are a: +* Collector +* Database Administrator +* Datter +* Developer +* Dumper +* Graphic Artist +* Translator +* Player +* Tester + +Feel free to: +* Fork the repository +* Create an issue +* Branch your repository with the issue number and a meaningful name related to the changes you are making +* Create a pull request +## Contact +GitEmAll: [https://gitemall.devemall.int.eu.org/TommySalami/AutomatedROMTools](https://gitemall.devemall.int.eu.org/TommySalami/AutomatedROMTools "GitEmAll") + +--- +###### Copyright (c) 2016-2025 AutomatedROMTools - All Rights Reserved v2025-08-09-00 diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..a38578c --- /dev/null +++ b/TODO.md @@ -0,0 +1,5 @@ +### To Do +* Nothing to do + +### Completed Tasks +* Develop initial release