Skip to content

Commit

Permalink
Add NGC file format support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecot committed Dec 10, 2023
1 parent e177b63 commit ecc8abe
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Empty
- Microsoft Write (WRI)
- Neo Geo Pocket Color ROM (NGC)
- Picture Exchange (PCX)

# Version 0.22.0 (2023-11-04)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ identification.
- Game Boy ROM (GB)
- Game Gear ROM (GG)
- Mega Drive ROM (MD)
- Neo Geo Pocket Color ROM (NGC)
- Neo Geo Pocket ROM (NGP)
- Nintendo 64 ROM (Z64)
- Nintendo DS ROM (NDS)
Expand Down
Binary file added fixtures/rom/sample.ngc
Binary file not shown.
7 changes: 7 additions & 0 deletions src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,13 @@ formats! {
extension = "mxl"
kind = Application

format = NeoGeoPocketColorRom
name = "Neo Geo Pocket Color ROM"
short_name = "NGC"
media_type = "application/x-neo-geo-pocket-rom"
extension = "ngc"
kind = Rom

format = NeoGeoPocketRom
name = "Neo Geo Pocket ROM"
short_name = "NGP"
Expand Down
4 changes: 4 additions & 0 deletions src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ signatures! {
value =b"SIMPLE = T"

// 29 bytes
format = NeoGeoPocketColorRom
value = b" LICENSED BY SNK CORPORATION", b"\x10" offset = 0x23
value = b"COPYRIGHT BY SNK CORPORATION", b"\x10" offset = 0x23

format = PgpSignature
value = b"-----BEGIN PGP SIGNATURE-----"

Expand Down
6 changes: 6 additions & 0 deletions tests/rom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ fn test_mega_drive_rom() {
assert_eq!(fmt, FileFormat::MegaDriveRom);
}

#[test]
fn test_neo_geo_pocket_color_rom() {
let fmt = FileFormat::from_file("fixtures/rom/sample.ngc").unwrap();
assert_eq!(fmt, FileFormat::NeoGeoPocketColorRom);
}

#[test]
fn test_neo_geo_pocket_rom() {
let fmt = FileFormat::from_file("fixtures/rom/sample.ngp").unwrap();
Expand Down

0 comments on commit ecc8abe

Please sign in to comment.