Add SNES models

This commit is contained in:
Matt Nadareski
2026-03-11 11:47:39 -04:00
parent c7a932c07f
commit d102e2fc0b
7 changed files with 290 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ Not all of this information was able to be gathered directly from the files in q
| [PKWARE(?)](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) | PKZIP |
| [PS3 Developer Wiki](https://www.psdevwiki.com/ps3/) | IRD, PlayStation3 |
| [RanseiLink](https://github.com/Deijin27/RanseiLink) | Nitro |
| [raphnet](https://www.raphnet.net/divers/documentation/Sneskart.txt) | SNES |
| [Reverse Engineering Wise](https://codeberg.org/CYBERDEV/REWise) | WiseInstaller |
| [SharpCompress](https://github.com/adamhathcock/sharpcompress) | PKZIP |
| [Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013) | BSP |

View File

@@ -0,0 +1,19 @@
namespace SabreTools.Data.Models.SNES
{
/// <summary>
/// SNES cart image
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public class Cart
{
/// <summary>
/// Copier header
/// </summary>
public Header? Header { get; set; }
/// <summary>
/// Cartridge data
/// </summary>
public byte[] Data { get; set; } = [];
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Data.Models.SNES
{
public static class Constants
{
/// <summary>
/// Super Wild Card header identifier
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public static readonly byte[] SuperWildCardHeaderIdentifier = [0xAA, 0xBB, 0x04];
}
}

View File

@@ -0,0 +1,174 @@
using System;
namespace SabreTools.Data.Models.SNES
{
/// <summary>
/// Pro Fighter first SRAM mode
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public enum FIGDSPMode1 : byte
{
/// <summary>
/// If using DSP1 microchip and if no SRAM (SRAM size=0)
/// </summary>
DSP1WithNoSRAM = 0x47,
/// <summary>
/// If not using DSP1 and no SRAM (SRAM size=0)
/// </summary>
NoDSP1WithNoSRAM = 0x77,
/// <summary>
/// If using DSP1 microchip and if using SRAM (SRAM size>0)
/// </summary>
DSP1WithSRAM = 0xFD,
}
/// <summary>
/// Pro Fighter second SRAM mode
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public enum FIGDSPMode2 : byte
{
/// <summary>
/// If using DSP1 microchip and if using SRAM (SRAM size>0)
/// </summary>
DSP1WithSRAM = 0x82,
/// <summary>
/// If using DSP1 microchip and if no SRAM (SRAM size=0)
/// </summary>
DSP1WithNoSRAM = 0x83,
/// <summary>
/// If not using DSP1 and no SRAM (SRAM size=0)
/// </summary>
NoDSP1WithNoSRAM = 0x83,
}
/// <summary>
/// Pro Fighter image mode
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public enum FIGImageMode : byte
{
/// <summary>
/// Last image in set (or single image)
/// </summary>
SingleImage = 0x00,
/// <summary>
/// Multi image
/// </summary>
MultiImage = 0x40,
}
/// <summary>
/// Pro Fighter ROM mode
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public enum FIGRomMode : byte
{
LoROM = 0x00,
HiROM = 0x80,
}
/// <summary>
/// Super Wild Card image information
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
[Flags]
public enum SWCImageInformation : byte
{
/// <summary>
/// Reserved
/// </summary>
Reserved0 = 0b00000001,
/// <summary>
/// Reserved
/// </summary>
Reserved1 = 0b00000010,
#region SRAM size
/// <summary>
/// 256kbit SRAM
/// </summary>
SRAM256kbit = 0b00000000,
/// <summary>
/// 65kbit SRAM
/// </summary>
SRAM65kbit = 0b00000100,
/// <summary>
/// 16kbit SRAM
/// </summary>
SRAM16kbit = 0b00001000,
/// <summary>
/// no SRAM
/// </summary>
SRAMNone = 0b00001100,
#endregion
#region DRAM mode
/// <summary>
/// DRAM memory mapping Mode 20
/// </summary>
DRAMMappingMode20 = 0b00000000,
/// <summary>
/// DRAM memory mapping Mode 21 (HiROM)
/// </summary>
DRAMMappingMode21 = 0b00010000,
#endregion
#region SRAM mode
/// <summary>
/// SRAM memory mapping Mode 20
/// </summary>
SRAMMappingMode20 = 0b00000000,
/// <summary>
/// SRAM memory mapping Mode 21 (HiROM)
/// </summary>
SRAMMappingMode21 = 0b00100000,
#endregion
#region Multi-image
/// <summary>
/// Not multi image (no more split files to follow)
/// </summary>
NotMultiImage = 0b00000000,
/// <summary>
/// Multi image (there is another split file to follow)
/// </summary>
MultiImage = 0b01000000,
#endregion
#region Run program mode
/// <summary>
/// Run program in Mode 1 (JMP RESET Vector)
/// </summary>
RunProgramInMode1 = 0b00000000,
/// <summary>
/// Run program in Mode 0 (JMP $8000)
/// </summary>
RunProgramInMode0 = 0b10000000,
#endregion
}
}

View File

@@ -0,0 +1,7 @@
namespace SabreTools.Data.Models.SNES
{
/// <summary>
/// SNES copier header
/// </summary>
public abstract class Header { }
}

View File

@@ -0,0 +1,41 @@
namespace SabreTools.Data.Models.SNES
{
/// <summary>
/// Pro Fighter (FIG) header
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public class ProFighterHeader : Header
{
/// <summary>
/// Size word
/// </summary>
/// <remarks>Little-endian</remarks>
public ushort Size { get; set; }
/// <summary>
/// Single- or multi-image
/// </summary>
public FIGImageMode ImageMode { get; set; }
/// <summary>
/// ROM mode
/// </summary>
public FIGRomMode RomMode { get; set; }
/// <summary>
/// First DSP1 SRAM flag
/// </summary>
public FIGDSPMode1 DSPMode1 { get; set; }
/// <summary>
/// Second DSP1 SRAM flag
/// </summary>
public FIGDSPMode2 DSPMode2 { get; set; }
/// <summary>
/// Padding to get to 512 bytes
/// </summary>
/// <remarks>506 bytes</remarks>
public byte[] Padding { get; set; } = new byte[506];
}
}

View File

@@ -0,0 +1,37 @@
namespace SabreTools.Data.Models.SNES
{
/// <summary>
/// Super Wild Card (SWC) header
/// </summary>
/// <see href="https://www.raphnet.net/divers/documentation/Sneskart.txt"/>
public class SuperWildCardHeader : Header
{
/// <summary>
/// Size word
/// </summary>
/// <remarks>Little-endian</remarks>
public ushort Size { get; set; }
/// <summary>
/// Image information byte
/// </summary>
public SWCImageInformation ImageInformation { get; set; }
/// <summary>
/// Reserved
/// </summary>
/// <remarks>4 bytes</remarks>
public byte[] Reserved1 { get; set; } = new byte[4];
/// <summary>
/// SWC header identifier (0xAA, 0xBB, 0x04)
/// </summary>
public byte[] HeaderIdentifier { get; set; } = new byte[3];
/// <summary>
/// Padding to get to 512 bytes
/// </summary>
/// <remarks>502 bytes</remarks>
public byte[] Padding { get; set; } = new byte[502];
}
}