Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

rvz support

Laylef87ddb08fc1a
diff --git a/Cargo.lock b/Cargo.lock
index 2e895c6..90df824 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1150,6 +1150,7 @@ checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"crc32fast",
"miniz_oxide",
+ "zlib-rs",
]
[[package]]
@@ -1577,6 +1578,8 @@ dependencies = [
"idb-rs",
"object",
"zerocopy",
+ "zip",
+ "zstd",
]
[[package]]
@@ -3623,6 +3626,12 @@ dependencies = [
"rustc-hash 2.1.2",
]
+[[package]]
+name = "typed-path"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
+
[[package]]
name = "typenum"
version = "1.19.0"
@@ -4736,6 +4745,38 @@ dependencies = [
"syn",
]
+[[package]]
+name = "zip"
+version = "8.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcab981e19633ebcf0b001ddd37dd802996098bc1864f90b7c5d970ce76c1d59"
+dependencies = [
+ "crc32fast",
+ "flate2",
+ "indexmap",
+ "memchr",
+ "typed-path",
+ "zopfli",
+]
+
+[[package]]
+name = "zlib-rs"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513"
+
+[[package]]
+name = "zopfli"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
+dependencies = [
+ "bumpalo",
+ "crc32fast",
+ "log",
+ "simd-adler32",
+]
+
[[package]]
name = "zstd"
version = "0.13.3"
diff --git a/crates/dbglib/src/windows/dvd.rs b/crates/dbglib/src/windows/dvd.rs
index 13e7569..e67b8c4 100644
--- a/crates/dbglib/src/windows/dvd.rs
+++ b/crates/dbglib/src/windows/dvd.rs
@@ -7,10 +7,10 @@ pub fn show_dvd(ctx: &Context, open: &mut bool, di: &DvdInterface) {
egui::Window::new("DVD").open(open).show(ctx, |ui| {
// Disc info
if let Some(dvd) = &di.dvd {
- let game_name = String::from_utf8_lossy(&dvd.header.game_name);
+ let game_name = String::from_utf8_lossy(&dvd.header().game_name);
let game_name = game_name.trim_end_matches('\0');
- let game_code = String::from_utf8_lossy(&dvd.header.game_code);
- let maker_code = String::from_utf8_lossy(&dvd.header.maker_code);
+ let game_code = String::from_utf8_lossy(&dvd.header().game_code);
+ let maker_code = String::from_utf8_lossy(&dvd.header().maker_code);
ui.strong("Disc");
Grid::new("dvd_disc_info").num_columns(2).striped(true).show(ui, |ui| {
@@ -19,7 +19,7 @@ pub fn show_dvd(ctx: &Context, open: &mut bool, di: &DvdInterface) {
ui.end_row();
ui.label("ID");
- ui.monospace(format!("{}{} v{}", game_code, maker_code, dvd.header.version));
+ ui.monospace(format!("{}{} v{}", game_code, maker_code, dvd.header().version));
ui.end_row();
});
} else {
diff --git a/crates/debugger/src/main.rs b/crates/debugger/src/main.rs
index a54a3b1..e48624a 100644
--- a/crates/debugger/src/main.rs
+++ b/crates/debugger/src/main.rs
@@ -10,7 +10,6 @@ use winit::window::{Window, WindowId};
use gecko::flipper::si::pad::{self, PadStatus, STICK_CENTER};
use gecko::gamecube::GameCube;
use image::Dol;
-use image::dvd::Dvd;
use crate::debugger::DebuggerUi;
use crate::render::RenderState;
@@ -138,13 +137,13 @@ struct Args {
#[arg(long)]
skip_ipl: bool,
- /// Boot from ISO using HLE IPL (requires --iso)
+ /// Boot from a disc image using HLE IPL (requires --dvd)
#[arg(long)]
ipl_hle: bool,
- /// Path to a GameCube ISO file
+ /// Path to a GameCube disc image (.iso or .rvz)
#[arg(long)]
- iso: Option<String>,
+ dvd: Option<String>,
/// Use immediate present mode (no vsync)
#[arg(long)]
@@ -181,37 +180,22 @@ fn main() {
};
let mut emulator = if args.ipl_hle {
- let Some(ref iso) = args.iso else {
- eprintln!("--ipl-hle requires --iso");
- std::process::exit(1);
+ let Some(ref dvd) = args.dvd else {
+ panic!("--ipl-hle requires --dvd");
};
- let iso_data = std::fs::read(iso).expect("failed to read ISO");
- let dvd = Dvd::parse(iso_data);
- GameCube::with_ipl_hle(dvd)
+ GameCube::with_ipl_hle(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")))
} else if let Some(ref ipl) = args.ipl {
- let ipl_data = std::fs::read(ipl).expect("failed to read IPL");
- GameCube::with_ipl(&ipl_data, args.skip_ipl)
- } else if let Some(ref path) = args.dol {
- let dol_data = std::fs::read(path).expect("failed to read DOL");
- let dol = Dol::parse(dol_data);
- GameCube::with_image(&dol)
+ let mut gc = GameCube::with_ipl(&std::fs::read(ipl).expect("failed to read IPL"), args.skip_ipl);
+ if let Some(ref dvd) = args.dvd {
+ gc.insert_dvd(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")));
+ }
+ gc
+ } else if let Some(ref dol) = args.dol {
+ GameCube::with_image(&Dol::parse(std::fs::read(dol).expect("failed to read DOL")))
} else {
- eprintln!("error: either --ipl, --ipl-hle, or --dol must be provided");
- std::process::exit(1);
+ panic!("either --ipl, --ipl-hle, or --dol must be provided");
};
- if !args.ipl_hle {
- if let Some(ref iso) = args.iso {
- if args.ipl.is_none() {
- eprintln!("--iso requires --ipl or --ipl-hle");
- std::process::exit(1);
- }
- let iso_data = std::fs::read(iso).expect("failed to read ISO");
- let dvd = Dvd::parse(iso_data);
- emulator.insert_dvd(dvd);
- }
- }
-
if let Some(ref dsp_path) = args.dsp {
let dsp_data = std::fs::read(dsp_path).expect("failed to read DSP IROM");
emulator.dsp.load_irom(&dsp_data);
diff --git a/crates/gctool/src/dol.rs b/crates/gctool/src/dol.rs
index f89ef72..8f190bd 100644
--- a/crates/gctool/src/dol.rs
+++ b/crates/gctool/src/dol.rs
@@ -1,8 +1,9 @@
use comfy_table::Table;
use comfy_table::presets::ASCII_MARKDOWN;
-use image::{Dol, Executable};
+use image::dol::Dol;
+use image::{Executable, Section};
-fn section_table(sections: &[image::Section]) -> Table {
+fn section_table(sections: &[Section]) -> Table {
let mut table = Table::new();
table.load_preset(ASCII_MARKDOWN);
table.set_header(vec!["idx", "offset", "vaddr", "size", "end"]);
diff --git a/crates/gctool/src/iso.rs b/crates/gctool/src/iso.rs
index 162fe06..eb43219 100644
--- a/crates/gctool/src/iso.rs
+++ b/crates/gctool/src/iso.rs
@@ -4,7 +4,7 @@ use owo_colors::OwoColorize;
use termtree::Tree;
pub fn info(data: Vec<u8>) {
- let dvd = image::dvd::Dvd::parse(data);
+ let dvd = image::dvd::Iso::parse(data);
let game_name = String::from_utf8_lossy(&dvd.header.game_name);
let game_name = game_name.trim_end_matches('\0');
@@ -75,7 +75,7 @@ fn build_tree(node: &FstNode) -> Tree<String> {
}
pub fn extract(data: Vec<u8>) {
- let dvd = image::dvd::Dvd::parse(data);
+ let dvd = image::dvd::Iso::parse(data);
let output_path = std::path::Path::new("output");
extract_filesystem(&dvd, &dvd.filesystem, output_path);
extract_apploader(&dvd, output_path);
@@ -83,7 +83,7 @@ pub fn extract(data: Vec<u8>) {
println!("Extracted ISO contents to {}", output_path.display());
}
-fn extract_filesystem(dvd: &image::dvd::Dvd, node: &FstNode, path: &std::path::Path) {
+fn extract_filesystem(dvd: &image::dvd::Iso, node: &FstNode, path: &std::path::Path) {
match node {
FstNode::Directory { name, children } => {
let dir_path = path.join(name);
@@ -101,14 +101,14 @@ fn extract_filesystem(dvd: &image::dvd::Dvd, node: &FstNode, path: &std::path::P
}
}
-fn extract_apploader(dvd: &image::dvd::Dvd, path: &std::path::Path) {
+fn extract_apploader(dvd: &image::dvd::Iso, path: &std::path::Path) {
let apploader = &dvd.apploader;
let data = &dvd.data()[DVD_APPLOADER_OFFSET..(DVD_APPLOADER_OFFSET + apploader.size.get() as usize)];
std::fs::write(path.join("apploader.bin"), data).unwrap();
}
-fn extract_main_dol(dvd: &image::dvd::Dvd, path: &std::path::Path) {
+fn extract_main_dol(dvd: &image::dvd::Iso, path: &std::path::Path) {
let dol_offset = dvd.header.offset_main_executable.get() as usize;
- let main_dol = image::Dol::parse(dvd.data()[dol_offset..].to_vec());
+ let main_dol = image::dol::Dol::parse(dvd.data()[dol_offset..].to_vec());
std::fs::write(path.join("main.dol"), &main_dol.data()[..main_dol.size()]).unwrap();
}
diff --git a/crates/gecko/src/dvd.rs b/crates/gecko/src/dvd.rs
index 2f91253..2e0404b 100644
--- a/crates/gecko/src/dvd.rs
+++ b/crates/gecko/src/dvd.rs
@@ -1,7 +1,6 @@
pub mod regs;
use crate::gamecube::GameCube;
-use image::Executable;
pub enum Command {
DriveInfo,
@@ -21,7 +20,7 @@ pub struct DvdInterface {
pub cmdbuf1: u32,
pub cmdbuf2: u32,
pub immbuf: u32,
- pub dvd: Option<image::dvd::Dvd>,
+ pub dvd: Option<Box<dyn image::Dvd>>,
}
impl DvdInterface {
@@ -139,7 +138,7 @@ pub fn start_transfer(gc: &mut GameCube) {
}
#[inline(always)]
-fn process_dvd_command(gc: &mut GameCube, cmd: Command, dvd: &image::dvd::Dvd) {
+fn process_dvd_command(gc: &mut GameCube, cmd: Command, dvd: &dyn image::Dvd) {
match cmd {
Command::DriveInfo => {
let dst = gc.di.dma_address.address();
@@ -153,7 +152,7 @@ fn process_dvd_command(gc: &mut GameCube, cmd: Command, dvd: &image::dvd::Dvd) {
assert!(len == gc.di.dma_length.length() as usize, "DMA length mismatch");
let buffer = gc.mmio.phys_slice_mut(dst, len);
- buffer.copy_from_slice(&dvd.data()[src as usize..src as usize + len]);
+ dvd.read_disc_into(src as usize, buffer);
tracing::debug!(
src = format!("{:08X}", src),
@@ -168,7 +167,7 @@ fn process_dvd_command(gc: &mut GameCube, cmd: Command, dvd: &image::dvd::Dvd) {
let len = gc.di.dma_length.length() as usize;
let buffer = gc.mmio.phys_slice_mut(dst, len);
- buffer.copy_from_slice(&dvd.data()[..len]);
+ dvd.read_disc_into(0, buffer);
tracing::debug!(
src = format!("{:08X}", src),
@@ -185,8 +184,8 @@ fn process_dvd_command(gc: &mut GameCube, cmd: Command, dvd: &image::dvd::Dvd) {
}
impl GameCube {
- pub fn insert_dvd(&mut self, dvd: image::dvd::Dvd) {
- let name = String::from_utf8_lossy(&dvd.header.game_name);
+ pub fn insert_dvd(&mut self, dvd: Box<dyn image::Dvd>) {
+ let name = String::from_utf8_lossy(&dvd.header().game_name);
let name = name.trim_end_matches('\0');
tracing::info!("DVD inserted: {}", name);
self.di.dvd = Some(dvd);
diff --git a/crates/gecko/src/gamecube.rs b/crates/gecko/src/gamecube.rs
index cfe7ac9..f9744bb 100644
--- a/crates/gecko/src/gamecube.rs
+++ b/crates/gecko/src/gamecube.rs
@@ -139,17 +139,17 @@ impl GameCube {
emulator
}
- pub fn with_ipl_hle(dvd: image::dvd::Dvd) -> Self {
+ pub fn with_ipl_hle(dvd: Box<dyn image::Dvd>) -> Self {
const APPLOADER_LOAD: u32 = 0x0120_0000;
const IPL_LOAD: u32 = 0x0130_0000;
const IPL_ENTRY: u32 = 0x8130_0000;
const ARAM_SIZE: u32 = 16 * 1024 * 1024;
- let game_name = String::from_utf8_lossy(&dvd.header.game_name);
+ let game_name = String::from_utf8_lossy(&dvd.header().game_name);
let game_name = game_name.trim_end_matches('\0');
tracing::info!("Game: {game_name}");
- let apploader_version = String::from_utf8_lossy(&dvd.apploader.timestamp);
+ let apploader_version = String::from_utf8_lossy(&dvd.apploader().timestamp);
tracing::info!("Apploader: {apploader_version}");
let mut emulator = Self::new(IPL_ENTRY);
@@ -171,12 +171,12 @@ impl GameCube {
emulator.cpu.spr.ibat3l = 0xFFF0_0001;
// DVD header fields to low memory
- emulator.mmio.ram[0x00..0x04].copy_from_slice(&dvd.header.game_code);
- emulator.mmio.ram[0x04..0x06].copy_from_slice(&dvd.header.maker_code);
- emulator.mmio.ram[0x06] = dvd.header.disk_id;
- emulator.mmio.ram[0x07] = dvd.header.version;
- emulator.mmio.ram[0x08] = dvd.header.audio_streaming;
- emulator.mmio.ram[0x09] = dvd.header.streaming_buffer_size;
+ emulator.mmio.ram[0x00..0x04].copy_from_slice(&dvd.header().game_code);
+ emulator.mmio.ram[0x04..0x06].copy_from_slice(&dvd.header().maker_code);
+ emulator.mmio.ram[0x06] = dvd.header().disk_id;
+ emulator.mmio.ram[0x07] = dvd.header().version;
+ emulator.mmio.ram[0x08] = dvd.header().audio_streaming;
+ emulator.mmio.ram[0x09] = dvd.header().streaming_buffer_size;
// System info
emulator
@@ -198,10 +198,12 @@ impl GameCube {
// Load apploader code into RAM
let apploader_code_start = image::dvd::DVD_APPLOADER_OFFSET + 0x20;
- let apploader_size = (dvd.apploader.size.get() + dvd.apploader.trailer_size.get()) as usize;
- let apploader_entry = dvd.apploader.entrypoint.get();
- emulator.mmio.ram[APPLOADER_LOAD as usize..][..apploader_size]
- .copy_from_slice(&dvd.data()[apploader_code_start..][..apploader_size]);
+ let apploader_size = (dvd.apploader().size.get() + dvd.apploader().trailer_size.get()) as usize;
+ let apploader_entry = dvd.apploader().entrypoint.get();
+ dvd.read_disc_into(
+ apploader_code_start,
+ &mut emulator.mmio.ram[APPLOADER_LOAD as usize..][..apploader_size],
+ );
// Load custom IPL binary into RAM
emulator.mmio.ram[IPL_LOAD as usize..][..IPL_HLE.len()].copy_from_slice(IPL_HLE);
diff --git a/crates/image/Cargo.toml b/crates/image/Cargo.toml
index 16434cf..6cefd2c 100644
--- a/crates/image/Cargo.toml
+++ b/crates/image/Cargo.toml
@@ -11,3 +11,5 @@ symbols = ["dep:idb-rs", "dep:object"]
idb-rs = { git = "https://github.com/ioncodes/idb-rs.git", optional = true }
object = { version = "0.36.7", default-features = false, features = ["elf", "read"], optional = true }
zerocopy = { version = "0.8.48", features = ["derive"] }
+zstd = "0.13.3"
+zip = { version = "8.5.1", default-features = false, features = ["deflate"] }
diff --git a/crates/image/src/dol.rs b/crates/image/src/dol.rs
new file mode 100644
index 0000000..791636b
--- /dev/null
+++ b/crates/image/src/dol.rs
@@ -0,0 +1,83 @@
+use crate::{Executable, Section};
+
+pub struct Dol {
+ raw: Vec<u8>,
+ text_sections: Vec<Section>,
+ data_sections: Vec<Section>,
+ bss_start: u32,
+ bss_size: u32,
+ entry_point: u32,
+}
+
+impl Dol {
+ pub fn parse(data: Vec<u8>) -> Self {
+ let mut text_sections = Vec::new();
+ let mut data_sections = Vec::new();
+
+ for i in 0..=6 {
+ let offset = u32::from_be_bytes(data[(i * 4)..(i * 4) + 4].try_into().unwrap());
+ let vaddr = u32::from_be_bytes(data[0x48 + (i * 4)..0x48 + (i * 4) + 4].try_into().unwrap());
+ let size = u32::from_be_bytes(data[0x90 + (i * 4)..0x90 + (i * 4) + 4].try_into().unwrap());
+
+ if size > 0 {
+ text_sections.push(Section { offset, vaddr, size });
+ }
+ }
+
+ for i in 0..=10 {
+ let offset = u32::from_be_bytes(data[0x1C + (i * 4)..0x1C + (i * 4) + 4].try_into().unwrap());
+ let vaddr = u32::from_be_bytes(data[0x64 + (i * 4)..0x64 + (i * 4) + 4].try_into().unwrap());
+ let size = u32::from_be_bytes(data[0xAC + (i * 4)..0xAC + (i * 4) + 4].try_into().unwrap());
+
+ if size > 0 {
+ data_sections.push(Section { offset, vaddr, size });
+ }
+ }
+
+ let bss_start = u32::from_be_bytes(data[0xD8..0xDC].try_into().unwrap());
+ let bss_size = u32::from_be_bytes(data[0xDC..0xE0].try_into().unwrap());
+ let entry_point = u32::from_be_bytes(data[0xE0..0xE4].try_into().unwrap());
+
+ Dol {
+ raw: data,
+ text_sections,
+ data_sections,
+ bss_start,
+ bss_size,
+ entry_point,
+ }
+ }
+}
+
+impl Dol {
+ pub fn size(&self) -> usize {
+ self.text_sections
+ .iter()
+ .chain(self.data_sections.iter())
+ .map(|s| (s.offset + s.size) as usize)
+ .max()
+ .unwrap_or(0)
+ }
+}
+
+impl Executable for Dol {
+ fn text_sections(&self) -> &[Section] {
+ &self.text_sections
+ }
+
+ fn data_sections(&self) -> &[Section] {
+ &self.data_sections
+ }
+
+ fn bss(&self) -> (u32, u32) {
+ (self.bss_start, self.bss_size)
+ }
+
+ fn entry_point(&self) -> u32 {
+ self.entry_point
+ }
+
+ fn data(&self) -> &[u8] {
+ &self.raw
+ }
+}
diff --git a/crates/image/src/dvd.rs b/crates/image/src/dvd.rs
index 2de0112..29d1491 100644
--- a/crates/image/src/dvd.rs
+++ b/crates/image/src/dvd.rs
@@ -1,8 +1,6 @@
use zerocopy::byteorder::big_endian::U32;
use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};
-use crate::{Dol, Executable, Section};
-
pub const DVD_HEADER_SIZE: usize = 0x440;
pub const DVD_HEADER_INFO_SIZE: usize = 0x2000;
pub const DVD_APPLOADER_SIZE: usize = 0x2000;
@@ -12,7 +10,7 @@ pub const DVD_HEADER_INFO_OFFSET: usize = DVD_HEADER_OFFSET + DVD_HEADER_SIZE;
pub const DVD_APPLOADER_OFFSET: usize = DVD_HEADER_INFO_OFFSET + DVD_HEADER_INFO_SIZE;
#[repr(C, packed)]
-#[derive(FromBytes, IntoBytes, Immutable, KnownLayout, Debug)]
+#[derive(FromBytes, IntoBytes, Immutable, KnownLayout, Debug, Clone, Copy)]
pub struct Header {
pub game_code: [u8; 4],
pub maker_code: [u8; 2],
@@ -49,7 +47,7 @@ pub struct HeaderInfo {
}
#[repr(C, packed)]
-#[derive(FromBytes, IntoBytes, Immutable, KnownLayout, Debug)]
+#[derive(FromBytes, IntoBytes, Immutable, KnownLayout, Debug, Clone, Copy)]
pub struct Apploader {
pub timestamp: [u8; 10],
_unused0: [u8; 6],
@@ -122,71 +120,3 @@ impl FstNode {
matches!(self, Self::File { .. })
}
}
-
-pub struct Dvd {
- pub header: Header,
- pub header_info: HeaderInfo,
- pub apploader: Apploader,
- pub filesystem: FstNode,
- data: Vec<u8>,
- sections: Vec<Section>,
-}
-
-impl Dvd {
- pub fn parse(data: Vec<u8>) -> Self {
- let header = Header::read_from_bytes(&data[DVD_HEADER_OFFSET..DVD_HEADER_OFFSET + DVD_HEADER_SIZE]).unwrap();
- let header_info =
- HeaderInfo::read_from_bytes(&data[DVD_HEADER_INFO_OFFSET..DVD_HEADER_INFO_OFFSET + DVD_HEADER_INFO_SIZE])
- .unwrap();
- let apploader =
- Apploader::read_from_bytes(&data[DVD_APPLOADER_OFFSET..DVD_APPLOADER_OFFSET + DVD_APPLOADER_SIZE]).unwrap();
-
- let fst_start = header.offset_filesystem.get() as usize;
- let fst_end = fst_start + header.filesystem_size.get() as usize;
- let filesystem = FstNode::parse(&data[fst_start..fst_end]);
-
- let apploader_section = Section {
- offset: DVD_APPLOADER_OFFSET as u32,
- vaddr: 0x81200000,
- size: apploader.size.get(),
- };
-
- let main_dol = Dol::parse(data[header.offset_main_executable.get() as usize..].to_vec());
- let main_section = Section {
- offset: header.offset_main_executable.get(),
- vaddr: main_dol.entry_point(),
- size: main_dol.size() as u32,
- };
-
- Dvd {
- header,
- header_info,
- apploader,
- filesystem,
- data,
- sections: vec![apploader_section, main_section],
- }
- }
-}
-
-impl Executable for Dvd {
- fn entry_point(&self) -> u32 {
- self.apploader.entrypoint.get()
- }
-
- fn data(&self) -> &[u8] {
- &self.data
- }
-
- fn text_sections(&self) -> &[crate::Section] {
- &self.sections
- }
-
- fn data_sections(&self) -> &[crate::Section] {
- &[]
- }
-
- fn bss(&self) -> (u32, u32) {
- (0, 0)
- }
-}
diff --git a/crates/image/src/iso.rs b/crates/image/src/iso.rs
new file mode 100644
index 0000000..b200250
--- /dev/null
+++ b/crates/image/src/iso.rs
@@ -0,0 +1,51 @@
+use crate::dvd::*;
+use zerocopy::FromBytes;
+
+pub struct Iso {
+ pub header: Header,
+ pub header_info: HeaderInfo,
+ pub apploader: Apploader,
+ pub filesystem: FstNode,
+ data: Vec<u8>,
+}
+
+impl Iso {
+ pub fn parse(data: Vec<u8>) -> Self {
+ let header = Header::read_from_bytes(&data[DVD_HEADER_OFFSET..DVD_HEADER_OFFSET + DVD_HEADER_SIZE]).unwrap();
+ let header_info =
+ HeaderInfo::read_from_bytes(&data[DVD_HEADER_INFO_OFFSET..DVD_HEADER_INFO_OFFSET + DVD_HEADER_INFO_SIZE])
+ .unwrap();
+ let apploader =
+ Apploader::read_from_bytes(&data[DVD_APPLOADER_OFFSET..DVD_APPLOADER_OFFSET + DVD_APPLOADER_SIZE]).unwrap();
+
+ let fst_start = header.offset_filesystem.get() as usize;
+ let fst_end = fst_start + header.filesystem_size.get() as usize;
+ let filesystem = FstNode::parse(&data[fst_start..fst_end]);
+
+ Iso {
+ header,
+ header_info,
+ apploader,
+ filesystem,
+ data,
+ }
+ }
+
+ pub fn data(&self) -> &[u8] {
+ &self.data
+ }
+}
+
+impl crate::Dvd for Iso {
+ fn header(&self) -> &Header {
+ &self.header
+ }
+
+ fn apploader(&self) -> &Apploader {
+ &self.apploader
+ }
+
+ fn read_disc_into(&self, offset: usize, buf: &mut [u8]) {
+ buf.copy_from_slice(&self.data[offset..offset + buf.len()]);
+ }
+}
diff --git a/crates/image/src/lib.rs b/crates/image/src/lib.rs
index 515b630..a898a49 100644
--- a/crates/image/src/lib.rs
+++ b/crates/image/src/lib.rs
@@ -1,4 +1,8 @@
+pub mod dol;
pub mod dvd;
+pub mod iso;
+pub mod rvz;
+
#[cfg(feature = "symbols")]
pub mod elf;
#[cfg(feature = "symbols")]
@@ -7,98 +11,72 @@ pub mod idb;
pub mod loader;
pub mod symbols;
-pub struct Section {
- pub offset: u32,
- pub vaddr: u32,
- pub size: u32,
-}
+pub use dol::Dol;
+pub use iso::Iso;
+pub use rvz::Rvz;
-pub trait Executable {
- fn text_sections(&self) -> &[Section];
- fn data_sections(&self) -> &[Section];
- fn bss(&self) -> (u32, u32);
- fn entry_point(&self) -> u32;
- fn data(&self) -> &[u8];
-}
+use dvd::{Apploader, Header};
-pub struct Dol {
- raw: Vec<u8>,
- text_sections: Vec<Section>,
- data_sections: Vec<Section>,
- bss_start: u32,
- bss_size: u32,
- entry_point: u32,
+pub trait Dvd: Send {
+ fn header(&self) -> &Header;
+ fn apploader(&self) -> &Apploader;
+ fn read_disc_into(&self, offset: usize, buf: &mut [u8]);
}
-impl Dol {
- pub fn parse(data: Vec<u8>) -> Self {
- let mut text_sections = Vec::new();
- let mut data_sections = Vec::new();
-
- for i in 0..=6 {
- let offset = u32::from_be_bytes(data[(i * 4)..(i * 4) + 4].try_into().unwrap());
- let vaddr = u32::from_be_bytes(data[0x48 + (i * 4)..0x48 + (i * 4) + 4].try_into().unwrap());
- let size = u32::from_be_bytes(data[0x90 + (i * 4)..0x90 + (i * 4) + 4].try_into().unwrap());
-
- if size > 0 {
- text_sections.push(Section { offset, vaddr, size });
- }
- }
-
- for i in 0..=10 {
- let offset = u32::from_be_bytes(data[0x1C + (i * 4)..0x1C + (i * 4) + 4].try_into().unwrap());
- let vaddr = u32::from_be_bytes(data[0x64 + (i * 4)..0x64 + (i * 4) + 4].try_into().unwrap());
- let size = u32::from_be_bytes(data[0xAC + (i * 4)..0xAC + (i * 4) + 4].try_into().unwrap());
-
- if size > 0 {
- data_sections.push(Section { offset, vaddr, size });
- }
- }
-
- let bss_start = u32::from_be_bytes(data[0xD8..0xDC].try_into().unwrap());
- let bss_size = u32::from_be_bytes(data[0xDC..0xE0].try_into().unwrap());
- let entry_point = u32::from_be_bytes(data[0xE0..0xE4].try_into().unwrap());
-
- Dol {
- raw: data,
- text_sections,
- data_sections,
- bss_start,
- bss_size,
- entry_point,
- }
+impl<T: Dvd + ?Sized> Dvd for Box<T> {
+ fn header(&self) -> &Header {
+ (**self).header()
}
-}
-impl Dol {
- pub fn size(&self) -> usize {
- self.text_sections
- .iter()
- .chain(self.data_sections.iter())
- .map(|s| (s.offset + s.size) as usize)
- .max()
- .unwrap_or(0)
+ fn apploader(&self) -> &Apploader {
+ (**self).apploader()
}
-}
-impl Executable for Dol {
- fn text_sections(&self) -> &[Section] {
- &self.text_sections
+ fn read_disc_into(&self, offset: usize, buf: &mut [u8]) {
+ (**self).read_disc_into(offset, buf)
}
+}
- fn data_sections(&self) -> &[Section] {
- &self.data_sections
+pub fn load_dvd(data: Vec<u8>) -> Box<dyn Dvd> {
+ let data = if data.starts_with(b"PK\x03\x04") {
+ self::extract_from_zip(data)
+ } else {
+ data
+ };
+
+ if data.starts_with(b"RVZ\x01") {
+ Box::new(rvz::Rvz::parse(data))
+ } else {
+ Box::new(iso::Iso::parse(data))
}
+}
- fn bss(&self) -> (u32, u32) {
- (self.bss_start, self.bss_size)
- }
+fn extract_from_zip(data: Vec<u8>) -> Vec<u8> {
+ use std::io::Read;
+ let cursor = std::io::Cursor::new(data);
+ let mut archive = zip::ZipArchive::new(cursor).expect("failed to open ZIP archive");
+ let index = (0..archive.len())
+ .find(|&i| {
+ let name = archive.by_index(i).unwrap().name().to_ascii_lowercase();
+ name.ends_with(".iso") || name.ends_with(".rvz")
+ })
+ .expect("no disc image found in ZIP");
+ let mut entry = archive.by_index(index).unwrap();
+ let mut buf = Vec::with_capacity(entry.size() as usize);
+ entry.read_to_end(&mut buf).expect("failed to read ZIP entry");
+ buf
+}
- fn entry_point(&self) -> u32 {
- self.entry_point
- }
+pub struct Section {
+ pub offset: u32,
+ pub vaddr: u32,
+ pub size: u32,
+}
- fn data(&self) -> &[u8] {
- &self.raw
- }
+pub trait Executable {
+ fn text_sections(&self) -> &[Section];
+ fn data_sections(&self) -> &[Section];
+ fn bss(&self) -> (u32, u32);
+ fn entry_point(&self) -> u32;
+ fn data(&self) -> &[u8];
}
diff --git a/crates/image/src/rvz.rs b/crates/image/src/rvz.rs
new file mode 100644
index 0000000..299f279
--- /dev/null
+++ b/crates/image/src/rvz.rs
@@ -0,0 +1,446 @@
+use crate::dvd::{Apploader, DVD_APPLOADER_OFFSET, DVD_APPLOADER_SIZE, DVD_HEADER_OFFSET, DVD_HEADER_SIZE, Header};
+use zerocopy::FromBytes;
+
+const RVZ_MAGIC: [u8; 4] = [b'R', b'V', b'Z', 0x01];
+
+const H1_SIZE: usize = 0x48;
+const H1_ISO_FILE_SIZE: usize = 0x24;
+
+const H2_DISC_TYPE: usize = 0x00;
+const H2_COMPRESSION_TYPE: usize = 0x04;
+const H2_CHUNK_SIZE: usize = 0x0C;
+const H2_DISC_HEADER: usize = 0x10;
+const H2_NUM_PARTITIONS: usize = 0x90;
+const H2_NUM_RAW_DATA: usize = 0xB4;
+const H2_RAW_DATA_OFFSET: usize = 0xB8;
+const H2_RAW_DATA_SIZE: usize = 0xC0;
+const H2_NUM_GROUPS: usize = 0xC4;
+const H2_GROUPS_OFFSET: usize = 0xC8;
+const H2_GROUPS_SIZE: usize = 0xD0;
+
+const RAW_DATA_ENTRY_SIZE: usize = 0x18;
+const RVZ_GROUP_ENTRY_SIZE: usize = 0x0C;
+
+const SECTOR_SIZE: u64 = 0x8000;
+const RVZ_JUNK_BLOCK_SIZE: usize = 0x8000;
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+enum Compression {
+ None,
+ Zstd,
+}
+
+#[derive(Clone)]
+struct RawData {
+ data_offset: u64,
+ data_size: u64,
+ group_index: u32,
+ num_groups: u32,
+}
+
+#[derive(Clone, Copy)]
+struct GroupEntry {
+ file_offset: u64,
+ stored_size: u32,
+ is_compressed: bool,
+ rvz_packed_size: u32,
+}
+
+pub struct Rvz {
+ header: Header,
+ apploader: Apploader,
+ disc_header: [u8; 0x80],
+ iso_size: u64,
+ chunk_size: u32,
+ compression: Compression,
+ raw_data: Vec<RawData>,
+ groups: Vec<GroupEntry>,
+ file_data: Vec<u8>,
+}
+
+impl Rvz {
+ pub fn parse(data: Vec<u8>) -> Self {
+ assert!(data.len() >= H1_SIZE, "RVZ file too small for header");
+ assert_eq!(&data[0..4], &RVZ_MAGIC, "not an RVZ file (bad magic)");
+
+ let iso_size = self::be64(&data, H1_ISO_FILE_SIZE);
+ let h2 = H1_SIZE;
+
+ let disc_type = self::be32(&data, h2 + H2_DISC_TYPE);
+ assert_eq!(disc_type, 1, "only GameCube RVZ is supported (disc_type=1)");
+
+ let num_partitions = self::be32(&data, h2 + H2_NUM_PARTITIONS);
+ assert_eq!(num_partitions, 0, "Wii partitions are not supported");
+
+ let compression = match self::be32(&data, h2 + H2_COMPRESSION_TYPE) {
+ 0 => Compression::None,
+ 5 => Compression::Zstd,
+ other => panic!("unsupported RVZ compression type {other} (only None/Zstd supported)"),
+ };
+ let chunk_size = self::be32(&data, h2 + H2_CHUNK_SIZE);
+
+ let mut disc_header = [0u8; 0x80];
+ disc_header.copy_from_slice(&data[h2 + H2_DISC_HEADER..h2 + H2_DISC_HEADER + 0x80]);
+
+ let num_raw_data = self::be32(&data, h2 + H2_NUM_RAW_DATA);
+ let raw_data_off = self::be64(&data, h2 + H2_RAW_DATA_OFFSET);
+ let raw_data_compressed_size = self::be32(&data, h2 + H2_RAW_DATA_SIZE);
+ let num_groups = self::be32(&data, h2 + H2_NUM_GROUPS);
+ let groups_off = self::be64(&data, h2 + H2_GROUPS_OFFSET);
+ let groups_compressed_size = self::be32(&data, h2 + H2_GROUPS_SIZE);
+
+ let raw_data_blob = self::decompress_metadata(
+ &data[raw_data_off as usize..raw_data_off as usize + raw_data_compressed_size as usize],
+ compression,
+ (num_raw_data as usize) * RAW_DATA_ENTRY_SIZE,
+ );
+ let raw_data = self::parse_raw_data(&raw_data_blob, num_raw_data);
+
+ let groups_blob = self::decompress_metadata(
+ &data[groups_off as usize..groups_off as usize + groups_compressed_size as usize],
+ compression,
+ (num_groups as usize) * RVZ_GROUP_ENTRY_SIZE,
+ );
+ let groups = self::parse_groups(&groups_blob, num_groups);
+
+ let mut header_bytes = [0u8; DVD_HEADER_SIZE];
+ self::read_into(
+ &data,
+ &disc_header,
+ chunk_size,
+ compression,
+ &raw_data,
+ &groups,
+ DVD_HEADER_OFFSET as u64,
+ &mut header_bytes,
+ );
+ let header = Header::read_from_bytes(&header_bytes).expect("invalid DVD header");
+
+ let mut apploader_bytes = [0u8; DVD_APPLOADER_SIZE];
+ self::read_into(
+ &data,
+ &disc_header,
+ chunk_size,
+ compression,
+ &raw_data,
+ &groups,
+ DVD_APPLOADER_OFFSET as u64,
+ &mut apploader_bytes,
+ );
+ let apploader = Apploader::read_from_bytes(&apploader_bytes).expect("invalid apploader");
+
+ Rvz {
+ header,
+ apploader,
+ disc_header,
+ iso_size,
+ chunk_size,
+ compression,
+ raw_data,
+ groups,
+ file_data: data,
+ }
+ }
+}
+
+fn parse_raw_data(blob: &[u8], count: u32) -> Vec<RawData> {
+ let mut out = Vec::with_capacity(count as usize);
+
+ for i in 0..count as usize {
+ let base = i * RAW_DATA_ENTRY_SIZE;
+ let nominal_offset = self::be64(blob, base);
+ let nominal_size = self::be64(blob, base + 0x08);
+ let group_index = self::be32(blob, base + 0x10);
+ let num_groups = self::be32(blob, base + 0x14);
+
+ let skipped = nominal_offset % SECTOR_SIZE;
+ out.push(RawData {
+ data_offset: nominal_offset - skipped,
+ data_size: nominal_size + skipped,
+ group_index,
+ num_groups,
+ });
+ }
+
+ out
+}
+
+fn parse_groups(blob: &[u8], count: u32) -> Vec<GroupEntry> {
+ let mut out = Vec::with_capacity(count as usize);
+
+ for i in 0..count as usize {
+ let base = i * RVZ_GROUP_ENTRY_SIZE;
+ let data_off4 = self::be32(blob, base);
+ let data_size_raw = self::be32(blob, base + 0x04);
+ let rvz_packed_size = self::be32(blob, base + 0x08);
+
+ out.push(GroupEntry {
+ file_offset: (data_off4 as u64) << 2,
+ stored_size: data_size_raw & 0x7FFF_FFFF,
+ is_compressed: (data_size_raw & 0x8000_0000) != 0,
+ rvz_packed_size,
+ });
+ }
+
+ out
+}
+
+fn decompress_metadata(payload: &[u8], compression: Compression, expected: usize) -> Vec<u8> {
+ let decompressed = match compression {
+ Compression::None => payload.to_vec(),
+ Compression::Zstd => zstd::decode_all(std::io::Cursor::new(payload)).expect("failed to zstd-decode metadata"),
+ };
+
+ assert_eq!(
+ decompressed.len(),
+ expected,
+ "RVZ metadata size mismatch (got {}, want {})",
+ decompressed.len(),
+ expected
+ );
+
+ decompressed
+}
+
+fn read_into(
+ file: &[u8],
+ disc_header: &[u8; 0x80],
+ chunk_size: u32,
+ compression: Compression,
+ raw_data: &[RawData],
+ groups: &[GroupEntry],
+ mut offset: u64,
+ buf: &mut [u8],
+) {
+ let mut buf_off = 0usize;
+ let mut remaining = buf.len();
+
+ if offset < 0x80 {
+ let take = core::cmp::min(0x80 - offset as usize, remaining);
+ buf[buf_off..buf_off + take].copy_from_slice(&disc_header[offset as usize..offset as usize + take]);
+ buf_off += take;
+ offset += take as u64;
+ remaining -= take;
+ }
+
+ while remaining > 0 {
+ let rd = raw_data
+ .iter()
+ .find(|r| offset >= r.data_offset && offset < r.data_offset + r.data_size)
+ .expect("disc offset not covered by any raw-data entry");
+
+ let within = offset - rd.data_offset;
+ let group_idx = (within / chunk_size as u64) as u32;
+ assert!(group_idx < rd.num_groups, "group index out of range");
+
+ let group_offset_in_data = (group_idx as u64) * (chunk_size as u64);
+ let this_chunk_size = core::cmp::min(chunk_size as u64, rd.data_size - group_offset_in_data) as usize;
+
+ let group = &groups[(rd.group_index + group_idx) as usize];
+ let chunk = self::decompress_group(file, group, this_chunk_size, compression, group_offset_in_data);
+
+ let byte_off_in_chunk = (within - group_offset_in_data) as usize;
+ let avail = this_chunk_size - byte_off_in_chunk;
+ let take = core::cmp::min(avail, remaining);
+ buf[buf_off..buf_off + take].copy_from_slice(&chunk[byte_off_in_chunk..byte_off_in_chunk + take]);
+
+ buf_off += take;
+ offset += take as u64;
+ remaining -= take;
+ }
+}
+
+fn decompress_group(
+ file: &[u8],
+ group: &GroupEntry,
+ this_chunk_size: usize,
+ file_compression: Compression,
+ group_offset_in_data: u64,
+) -> Vec<u8> {
+ if group.stored_size == 0 {
+ return vec![0u8; this_chunk_size];
+ }
+
+ let start = group.file_offset as usize;
+ let end = start + group.stored_size as usize;
+ let payload = &file[start..end];
+
+ let effective = if group.is_compressed {
+ file_compression
+ } else {
+ Compression::None
+ };
+
+ let decompressed: Vec<u8> = match effective {
+ Compression::None => payload.to_vec(),
+ Compression::Zstd => zstd::decode_all(std::io::Cursor::new(payload)).expect("failed to zstd-decode group"),
+ };
+
+ if group.rvz_packed_size == 0 {
+ let mut out = vec![0u8; this_chunk_size];
+ let n = core::cmp::min(decompressed.len(), this_chunk_size);
+ out[..n].copy_from_slice(&decompressed[..n]);
+ out
+ } else {
+ assert_eq!(
+ decompressed.len(),
+ group.rvz_packed_size as usize,
+ "rvz_packed_size mismatch"
+ );
+
+ self::rvz_unpack(&decompressed, this_chunk_size, group_offset_in_data)
+ }
+}
+
+fn rvz_unpack(src: &[u8], out_len: usize, data_offset: u64) -> Vec<u8> {
+ let mut out = vec![0u8; out_len];
+ let mut cursor = 0usize;
+ let mut out_pos = 0usize;
+
+ while out_pos < out_len {
+ let hdr = u32::from_be_bytes(src[cursor..cursor + 4].try_into().unwrap());
+ cursor += 4;
+
+ let is_junk = (hdr & 0x8000_0000) != 0;
+ let size = (hdr & 0x7FFF_FFFF) as usize;
+
+ if is_junk {
+ let mut seed = [0u8; 68];
+ seed.copy_from_slice(&src[cursor..cursor + 68]);
+ cursor += 68;
+
+ let mut lfg = Lfg::new(&seed);
+ lfg.forward_n((data_offset as usize) % RVZ_JUNK_BLOCK_SIZE);
+ lfg.get_bytes(&mut out[out_pos..out_pos + size]);
+ } else {
+ out[out_pos..out_pos + size].copy_from_slice(&src[cursor..cursor + size]);
+ cursor += size;
+ }
+
+ out_pos += size;
+ }
+
+ out
+}
+
+const LFG_K: usize = 521;
+const LFG_J: usize = 32;
+const LFG_STATE_BYTES: usize = LFG_K * 4;
+
+struct Lfg {
+ buffer: [u32; LFG_K],
+ position_bytes: usize,
+}
+
+impl Lfg {
+ fn new(seed: &[u8; 68]) -> Self {
+ let mut buffer = [0u32; LFG_K];
+
+ for i in 0..17 {
+ buffer[i] = u32::from_be_bytes(seed[i * 4..i * 4 + 4].try_into().unwrap());
+ }
+
+ let mut lfg = Self {
+ buffer,
+ position_bytes: 0,
+ };
+
+ lfg.initialize();
+
+ lfg
+ }
+
+ fn initialize(&mut self) {
+ for i in 17..LFG_K {
+ self.buffer[i] = (self.buffer[i - 17] << 23) ^ (self.buffer[i - 16] >> 9) ^ self.buffer[i - 1];
+ }
+
+ for x in self.buffer.iter_mut() {
+ *x = (*x & 0xFF00_FFFF) | ((*x >> 2) & 0x00FF_0000);
+ }
+
+ for _ in 0..4 {
+ self.forward();
+ }
+ }
+
+ #[inline(always)]
+ fn forward(&mut self) {
+ for i in 0..LFG_J {
+ self.buffer[i] ^= self.buffer[i + LFG_K - LFG_J];
+ }
+
+ for i in LFG_J..LFG_K {
+ self.buffer[i] ^= self.buffer[i - LFG_J];
+ }
+ }
+
+ fn forward_n(&mut self, count: usize) {
+ self.position_bytes += count;
+
+ while self.position_bytes >= LFG_STATE_BYTES {
+ self.forward();
+ self.position_bytes -= LFG_STATE_BYTES;
+ }
+ }
+
+ #[inline(always)]
+ fn get_byte(&mut self) -> u8 {
+ let word_idx = self.position_bytes / 4;
+ let byte_in_word = self.position_bytes % 4;
+ let byte = (self.buffer[word_idx] >> ((3 - byte_in_word) * 8)) as u8;
+
+ self.position_bytes += 1;
+
+ if self.position_bytes == LFG_STATE_BYTES {
+ self.forward();
+ self.position_bytes = 0;
+ }
+
+ byte
+ }
+
+ fn get_bytes(&mut self, out: &mut [u8]) {
+ for b in out.iter_mut() {
+ *b = self.get_byte();
+ }
+ }
+}
+
+impl crate::Dvd for Rvz {
+ fn header(&self) -> &Header {
+ &self.header
+ }
+
+ fn apploader(&self) -> &Apploader {
+ &self.apploader
+ }
+
+ fn read_disc_into(&self, offset: usize, buf: &mut [u8]) {
+ assert!(
+ (offset as u64) + (buf.len() as u64) <= self.iso_size,
+ "read past end of disc image"
+ );
+
+ self::read_into(
+ &self.file_data,
+ &self.disc_header,
+ self.chunk_size,
+ self.compression,
+ &self.raw_data,
+ &self.groups,
+ offset as u64,
+ buf,
+ );
+ }
+}
+
+#[inline(always)]
+fn be32(data: &[u8], off: usize) -> u32 {
+ u32::from_be_bytes(data[off..off + 4].try_into().unwrap())
+}
+
+#[inline(always)]
+fn be64(data: &[u8], off: usize) -> u64 {
+ u64::from_be_bytes(data[off..off + 8].try_into().unwrap())
+}
diff --git a/crates/tinyapp/src/main.rs b/crates/tinyapp/src/main.rs
index 62f90e5..d4a8069 100644
--- a/crates/tinyapp/src/main.rs
+++ b/crates/tinyapp/src/main.rs
@@ -6,7 +6,6 @@ use crossbeam_channel::bounded;
use gecko::flipper::si::pad::{self, PadStatus, STICK_CENTER};
use gecko::gamecube::GameCube;
use image::Dol;
-use image::dvd::Dvd;
use std::sync::{Arc, Mutex};
use winit::event_loop::EventLoop;
use winit::keyboard::KeyCode;
@@ -26,13 +25,13 @@ struct Args {
#[arg(long)]
skip_ipl: bool,
- /// Boot from ISO using HLE IPL (requires --iso)
+ /// Boot from a disc image using HLE IPL (requires --dvd)
#[arg(long)]
ipl_hle: bool,
- /// Path to a GameCube ISO file
+ /// Path to a GameCube disc image (.iso or .rvz)
#[arg(long)]
- iso: Option<String>,
+ dvd: Option<String>,
/// Use immediate present mode (no vsync)
#[arg(long)]
@@ -71,37 +70,22 @@ fn main() {
.init();
let mut emulator = if args.ipl_hle {
- let Some(ref iso) = args.iso else {
- eprintln!("--ipl-hle requires --iso");
- std::process::exit(1);
+ let Some(ref dvd) = args.dvd else {
+ panic!("--ipl-hle requires --dvd");
};
- let iso_data = std::fs::read(iso).expect("failed to read ISO");
- let dvd = Dvd::parse(iso_data);
- GameCube::with_ipl_hle(dvd)
+ GameCube::with_ipl_hle(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")))
} else if let Some(ref ipl) = args.ipl {
- let ipl_data = std::fs::read(ipl).expect("failed to read IPL");
- GameCube::with_ipl(&ipl_data, args.skip_ipl)
- } else if let Some(ref path) = args.dol {
- let dol_data = std::fs::read(path).expect("failed to read DOL");
- let dol = Dol::parse(dol_data);
- GameCube::with_image(&dol)
+ let mut gc = GameCube::with_ipl(&std::fs::read(ipl).expect("failed to read IPL"), args.skip_ipl);
+ if let Some(ref dvd) = args.dvd {
+ gc.insert_dvd(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")));
+ }
+ gc
+ } else if let Some(ref dol) = args.dol {
+ GameCube::with_image(&Dol::parse(std::fs::read(dol).expect("failed to read DOL")))
} else {
- eprintln!("error: either --ipl, --ipl-hle, or --dol must be provided");
- std::process::exit(1);
+ panic!("either --ipl, --ipl-hle, or --dol must be provided");
};
- if !args.ipl_hle {
- if let Some(ref iso) = args.iso {
- if args.ipl.is_none() {
- eprintln!("--iso requires --ipl or --ipl-hle");
- std::process::exit(1);
- }
- let iso_data = std::fs::read(iso).expect("failed to read ISO");
- let dvd = Dvd::parse(iso_data);
- emulator.insert_dvd(dvd);
- }
- }
-
if let Some(ref dsp_path) = args.dsp {
let dsp_data = std::fs::read(dsp_path).expect("failed to read DSP IROM");
emulator.dsp.load_irom(&dsp_data);
diff --git a/crates/tinybench/src/main.rs b/crates/tinybench/src/main.rs
index 1b31c38..1b50c20 100644
--- a/crates/tinybench/src/main.rs
+++ b/crates/tinybench/src/main.rs
@@ -10,7 +10,7 @@ struct Args {
#[arg(long)]
ipl: Option<String>,
- /// Boot from ISO using HLE IPL (requires --iso)
+ /// Boot from a disc image using HLE IPL (requires --dvd)
#[arg(long)]
ipl_hle: bool,
@@ -18,9 +18,9 @@ struct Args {
#[arg(long)]
dsp: Option<String>,
- /// Path to a GameCube ISO
+ /// Path to a GameCube disc image (.iso or .rvz)
#[arg(long)]
- iso: Option<String>,
+ dvd: Option<String>,
/// Number of frames to run (0 = unlimited)
#[arg(long, default_value_t = 0)]
@@ -35,20 +35,15 @@ fn main() {
let args = Args::parse();
let mut emulator = if args.ipl_hle {
- let Some(ref iso_path) = args.iso else {
- eprintln!("--ipl-hle requires --iso");
+ let Some(ref dvd) = args.dvd else {
+ eprintln!("--ipl-hle requires --dvd");
std::process::exit(1);
};
- let iso_data = std::fs::read(iso_path).expect("failed to read ISO");
- let dvd = image::dvd::Dvd::parse(iso_data);
- GameCube::with_ipl_hle(dvd)
+ GameCube::with_ipl_hle(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")))
} else if let Some(ref ipl) = args.ipl {
- let ipl_data = std::fs::read(ipl).expect("failed to read IPL");
- let mut gc = GameCube::with_ipl(&ipl_data, false);
- if let Some(ref iso_path) = args.iso {
- let iso_data = std::fs::read(iso_path).expect("failed to read ISO");
- let dvd = image::dvd::Dvd::parse(iso_data);
- gc.insert_dvd(dvd);
+ let mut gc = GameCube::with_ipl(&std::fs::read(ipl).expect("failed to read IPL"), false);
+ if let Some(ref dvd) = args.dvd {
+ gc.insert_dvd(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")));
}
gc
} else {
diff --git a/crates/tinytracer/src/main.rs b/crates/tinytracer/src/main.rs
index ebd96b1..caab0da 100644
--- a/crates/tinytracer/src/main.rs
+++ b/crates/tinytracer/src/main.rs
@@ -36,13 +36,13 @@ struct Args {
#[arg(long)]
ipl: Option<String>,
- /// Boot from ISO using HLE IPL (requires --iso)
+ /// Boot from a disc image using HLE IPL (requires --dvd)
#[arg(long)]
ipl_hle: bool,
- /// Path to a GameCube ISO file
+ /// Path to a GameCube disc image (.iso or .rvz)
#[arg(long)]
- iso: Option<String>,
+ dvd: Option<String>,
/// Print decoded instructions and register diffs after each step
#[arg(long)]
@@ -95,34 +95,22 @@ fn main() {
.init();
let mut emulator = if args.ipl_hle {
- let Some(iso_path) = &args.iso else {
- panic!("--ipl-hle requires --iso");
+ let Some(ref dvd) = args.dvd else {
+ panic!("--ipl-hle requires --dvd");
};
- let iso_data = std::fs::read(iso_path).expect("failed to read ISO");
- let dvd = image::dvd::Dvd::parse(iso_data);
- gecko::gamecube::GameCube::with_ipl_hle(dvd)
- } else if let Some(dol_path) = &args.dol {
- let dol_data = std::fs::read(dol_path).expect("failed to read DOL");
- let dol = image::Dol::parse(dol_data);
- gecko::gamecube::GameCube::with_image(&dol)
- } else if let Some(ipl_path) = &args.ipl {
- let ipl_data = std::fs::read(ipl_path).expect("failed to read IPL");
- gecko::gamecube::GameCube::with_ipl(&ipl_data, false)
+ gecko::gamecube::GameCube::with_ipl_hle(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")))
+ } else if let Some(ref dol) = args.dol {
+ gecko::gamecube::GameCube::with_image(&image::Dol::parse(std::fs::read(dol).expect("failed to read DOL")))
+ } else if let Some(ref ipl) = args.ipl {
+ let mut gc = gecko::gamecube::GameCube::with_ipl(&std::fs::read(ipl).expect("failed to read IPL"), false);
+ if let Some(ref dvd) = args.dvd {
+ gc.insert_dvd(image::load_dvd(std::fs::read(dvd).expect("failed to read DVD")));
+ }
+ gc
} else {
- panic!("Either --dol, --ipl, or --ipl-hle must be provided");
+ panic!("either --dol, --ipl, or --ipl-hle must be provided");
};
- if !args.ipl_hle {
- if let Some(iso_path) = &args.iso {
- if args.ipl.is_none() {
- panic!("--iso requires --ipl or --ipl-hle");
- }
- let iso_data = std::fs::read(iso_path).expect("failed to read ISO");
- let dvd = image::dvd::Dvd::parse(iso_data);
- emulator.insert_dvd(dvd);
- }
- }
-
if let Some(dsp_path) = &args.dsp {
let dsp_data = std::fs::read(dsp_path).expect("failed to read DSP IROM");
emulator.dsp.load_irom(&dsp_data);
diff --git a/other/gamelist.txt b/other/gamelist.txt
new file mode 100644
index 0000000..e69160b
--- /dev/null
+++ b/other/gamelist.txt
@@ -0,0 +1,560 @@
+4x4 Evo 2 (USA).zip
+007 - Agent Under Fire (USA).zip
+007 - Everything or Nothing (USA).zip
+007 - From Russia with Love (USA).zip
+007 - Nightfire (USA).zip
+18 Wheeler - American Pro Trucker (USA).zip
+1080 Avalanche (USA).zip
+2002 FIFA World Cup (USA).zip
+Aggressive Inline (USA).zip
+Alien Hominid (USA).zip
+All-Star Baseball 2002 (USA).zip
+All-Star Baseball 2003 featuring Derek Jeter (USA).zip
+All-Star Baseball 2004 featuring Derek Jeter (USA).zip
+Amazing Island (USA).zip
+American Chopper 2 - Full Throttle (USA).zip
+Animal Crossing (USA).zip
+Animal Crossing (USA, Canada).zip
+Animaniacs - The Great Edgar Hunt (USA).zip
+Ant Bully, The (USA) (En,Fr).zip
+Aquaman - Battle for Atlantis (USA).zip
+Army Men - Air Combat - The Elite Missions (USA).zip
+Army Men - RTS (USA).zip
+Army Men - Sarge's War (USA).zip
+ATV - Quad Power Racing 2 (USA).zip
+Auto Modellista (USA).zip
+Backyard Baseball (USA).zip
+Backyard Football (USA).zip
+Backyard Sports - Baseball 2007 (USA).zip
+Bad Boys - Miami Takedown (USA).zip
+Baldur's Gate - Dark Alliance (USA).zip
+Baten Kaitos - Eternal Wings and the Lost Ocean (USA) (Disc 1).zip
+Baten Kaitos Origins (USA) (Disc 1).zip
+Baten Kaitos Origins (USA, Canada) (Disc 1).zip
+Batman - Rise of Sin Tzu (USA) (En,Fr,Es).zip
+Batman - Vengeance (USA) (En,Fr,Es).zip
+Batman Begins (USA).zip
+Battalion Wars (USA).zip
+Battalion Wars (USA, Canada).zip
+Beach Spikers - Virtua Beach Volleyball (USA).zip
+Beyblade VForce - Super Tournament Battle (USA).zip
+Beyond Good & Evil (USA) (En,Es).zip
+Big Air Freestyle (USA).zip
+Big Mutha Truckers (USA).zip
+Billy Hatcher and the Giant Egg (USA).zip
+Bionicle (USA).zip
+Black & Bruised (USA).zip
+Blood Omen 2 - The Legacy of Kain Series (USA).zip
+BloodRayne (USA).zip
+Bloody Roar - Primal Fury (USA).zip
+Blowout (USA).zip
+BMX XXX (USA).zip
+Bomberman Generation (USA).zip
+Bomberman Jetters (USA).zip
+Bratz - Forever Diamondz (USA).zip
+Bratz - Rock Angelz (USA).zip
+Buffy the Vampire Slayer - Chaos Bleeds (USA).zip
+Burnout (USA).zip
+Burnout 2 - Point of Impact (USA).zip
+Bust-A-Move 3000 (USA).zip
+Cabela's Big Game Hunter 2005 Adventures (USA).zip
+Cabela's Dangerous Hunts 2 (USA).zip
+Cabela's Outdoor Adventures (USA).zip
+Call of Duty - Finest Hour (USA).zip
+Call of Duty 2 - Big Red One (USA).zip
+Capcom vs. SNK 2 EO (USA).zip
+Carmen Sandiego - The Secret of the Stolen Drums (USA) (En,Fr).zip
+Casper - Spirit Dimensions (USA).zip
+Catwoman (USA).zip
+Cel Damage (USA).zip
+Chaos Field (USA).zip
+Charlie and the Chocolate Factory (USA).zip
+Charlie's Angels (USA) (En,Fr).zip
+Chibi-Robo! (USA).zip
+Chronicles of Narnia, The - The Lion, the Witch and the Wardrobe (USA).zip
+City Racer (USA).zip
+Codename - Kids Next Door - Operation - V.I.D.E.O.G.A.M.E. (USA).zip
+Conflict - Desert Storm (USA).zip
+Conflict - Desert Storm II - Back to Baghdad (USA).zip
+Crash Bandicoot - The Wrath of Cortex (USA).zip
+Crash Nitro Kart (USA).zip
+Crash Tag Team Racing (USA).zip
+Crazy Taxi (USA).zip
+Cubivore - Survival of the Fittest (USA).zip
+Cubix Robots for Everyone - Showdown (USA).zip
+Curious George (USA).zip
+Custom Robo (USA).zip
+Dakar 2 - The World's Ultimate Rally (USA) (En,Fr,De,Es,It).zip
+Dark Summit (USA).zip
+Darkened Skye (USA).zip
+Dave Mirra Freestyle BMX 2 (USA).zip
+Dead to Rights (USA).zip
+Def Jam - Fight for NY (USA).zip
+Def Jam - Vendetta (USA).zip
+Defender (USA).zip
+Die Hard - Vendetta (USA).zip
+Digimon Rumble Arena 2 (USA).zip
+Digimon World 4 (USA).zip
+Dinotopia - The Sunstone Odyssey (USA).zip
+Disney Sports - Basketball (USA).zip
+Disney Sports - Football (USA).zip
+Disney Sports - Skateboarding (USA).zip
+Disney Sports - Soccer (USA).zip
+Disney-Pixar Cars (USA).zip
+Disney-Pixar Finding Nemo (USA).zip
+Disney-Pixar Monsters, Inc. - Scream Arena (USA).zip
+Disney-Pixar Ratatouille (USA).zip
+Disney-Pixar The Incredibles - Rise of the Underminer (USA).zip
+Disney-Pixar The Incredibles (USA).zip
+Disney's Chicken Little (USA).zip
+Disney's Donald Duck - Goin' Quackers (USA) (En,Fr).zip
+Disney's Extreme Skate Adventure (USA).zip
+Disney's Magical Mirror Starring Mickey Mouse (USA).zip
+Disney's Party (USA).zip
+Disney's Piglet's Big Game (USA).zip
+Disney's PK - Out of the Shadows (USA) (En,Fr,De,It).zip
+Disney's Tarzan - Untamed (USA) (En,Fr).zip
+Disney's The Haunted Mansion (USA).zip
+Disney's Winnie the Pooh's Rumbly Tumbly Adventure (USA) (En,Fr,Es).zip
+Donkey Kong Jungle Beat (USA).zip
+Donkey Konga (USA).zip
+Donkey Konga 2 (USA).zip
+Dr. Muto (USA).zip
+Dragon Ball Z - Budokai (USA).zip
+Dragon Ball Z - Budokai 2 (USA).zip
+Dragon Ball Z - Sagas (USA).zip
+Dragon's Lair 3D - Return to the Lair (USA).zip
+DreamWorks & Aardman Flushed Away (USA).zip
+DreamWorks Over the Hedge (USA).zip
+DreamWorks Shark Tale (USA).zip
+DreamWorks Shrek - Smash n' Crash Racing (USA).zip
+DreamWorks Shrek - SuperSlam (USA).zip
+Driven (USA) (En,Fr,De,Es,It).zip
+Drome Racers (USA).zip
+Ed, Edd n Eddy - The Mis-Edventures (USA) (En,Fr).zip
+Enter the Matrix (USA) (Disc 1).zip
+ESPN International Winter Sports 2002 (USA).zip
+ESPN MLS ExtraTime 2002 (USA).zip
+Eternal Darkness - Sanity's Requiem (USA).zip
+Evolution Skateboarding (USA).zip
+Evolution Snowboarding (USA).zip
+Evolution Worlds (USA).zip
+F1 2002 (USA) (En,Fr,De,It).zip
+Fairly OddParents, The - Breakin' da Rules (USA).zip
+Fairly OddParents, The - Shadow Showdown (USA).zip
+Fantastic 4 (USA).zip
+FIFA Soccer 06 (USA).zip
+FIFA Soccer 07 (USA) (En,Es).zip
+FIFA Soccer 2002 (USA).zip
+FIFA Soccer 2003 (USA).zip
+FIFA Soccer 2004 (USA).zip
+FIFA Soccer 2005 (USA) (En,Es).zip
+FIFA Street (USA) (En,Es).zip
+FIFA Street 2 (USA) (En,Es).zip
+FIFA World Cup Germany 2006 (USA).zip
+Fight Night Round 2 (USA).zip
+Final Fantasy Crystal Chronicles (USA).zip
+Fire Emblem - Path of Radiance (USA).zip
+FireBlade (USA).zip
+Freaky Flyers (USA) (Disc 1).zip
+Freedom Fighters (USA).zip
+Freekstyle (USA).zip
+Freestyle Metal X (USA).zip
+Freestyle Street Soccer (USA) (En,Es).zip
+Freestyle Street Soccer (USA).zip
+Frogger - Ancient Shadow (USA) (En,Es).zip
+Frogger Beyond (USA).zip
+Frogger's Adventures - The Rescue (USA).zip
+Future Tactics - The Uprising (USA).zip
+F-Zero GX (USA).zip
+Gauntlet - Dark Legacy (USA).zip
+Geist (USA).zip
+Gladius (USA).zip
+Go! Go! Hypergrind (USA).zip
+Goblin Commander - Unleash the Horde (USA).zip
+Godzilla - Destroy All Monsters Melee (USA).zip
+GoldenEye - Rogue Agent (USA) (Disc 1).zip
+Gotcha Force (USA).zip
+Grim Adventures of Billy & Mandy, The (USA).zip
+Grooverider - Slot Car Thunder (USA).zip
+Gun (USA).zip
+Happy Feet (USA) (En,Fr).zip
+Harry Potter - Quidditch World Cup (USA) (En,Fr,Es).zip
+Harry Potter and the Chamber of Secrets (USA).zip
+Harry Potter and the Goblet of Fire (USA).zip
+Harry Potter and the Prisoner of Azkaban (USA).zip
+Harvest Moon - A Wonderful Life (USA).zip
+Harvest Moon - Another Wonderful Life (USA).zip
+Harvest Moon - Magical Melody (USA).zip
+Hello Kitty - Roller Rescue (USA).zip
+Hitman 2 - Silent Assassin (USA).zip
+Hobbit, The - The Prelude to the Lord of the Rings (USA).zip
+Home Run King (USA).zip
+Hot Wheels - Velocity X (USA).zip
+Hulk (USA).zip
+Hunter - The Reckoning (USA).zip
+Ice Age 2 - The Meltdown (USA).zip
+Ikaruga (USA).zip
+Incredible Hulk, The - Ultimate Destruction (USA).zip
+I-Ninja (USA).zip
+Intellivision Lives! (USA).zip
+Italian Job, The (USA).zip
+Jeremy McGrath Supercross World (USA).zip
+Judge Dredd - Dredd vs. Death (USA).zip
+Kao the Kangaroo - Round 2 (USA).zip
+Karaoke Revolution Party (USA).zip
+Kelly Slater's Pro Surfer (USA).zip
+King Arthur (USA).zip
+Kirby Air Ride (USA).zip
+Knockout Kings 2003 (USA).zip
+Lara Croft Tomb Raider - Legend (USA).zip
+Legend of Spyro, The - A New Beginning (USA).zip
+Legend of Zelda, The - Collector's Edition (USA).zip
+Legend of Zelda, The - Collector's Edition (USA, Canada).zip
+Legend of Zelda, The - Four Swords Adventures (USA).zip
+Legend of Zelda, The - Ocarina of Time & Master Quest (USA).zip
+Legend of Zelda, The - Ocarina of Time & Master Quest (USA, Canada).zip
+Legend of Zelda, The - The Wind Waker (USA).zip
+Legend of Zelda, The - The Wind Waker (USA, Canada).zip
+Legend of Zelda, The - Twilight Princess (USA).zip
+Legends of Wrestling (USA).zip
+Legends of Wrestling II (USA).zip
+LEGO Star Wars - The Video Game (USA).zip
+LEGO Star Wars II - The Original Trilogy (USA).zip
+Lemony Snicket's A Series of Unfortunate Events (USA).zip
+Looney Tunes - Back in Action (USA).zip
+Lord of the Rings, The - The Return of the King (USA).zip
+Lord of the Rings, The - The Third Age (USA) (Disc 1).zip
+Lord of the Rings, The - The Two Towers (USA).zip
+Lost Kingdoms (USA).zip
+Lost Kingdoms II (USA).zip
+Lotus Challenge (USA).zip
+Luigi's Mansion (USA).zip
+Luigi's Mansion (USA, Canada).zip
+Madden NFL 06 (USA).zip
+Madden NFL 07 (USA).zip
+Madden NFL 08 (USA).zip
+Madden NFL 2002 (USA).zip
+Madden NFL 2003 (USA).zip
+Madden NFL 2004 (USA).zip
+Madden NFL 2005 (USA).zip
+Major League Baseball 2K6 (USA).zip
+Mario Golf - Toadstool Tour (USA).zip
+Mario Kart - Double Dash!! (USA) (Bonus Disc).zip
+Mario Kart - Double Dash!! (USA) (Debug) (2004-07-05).zip
+Mario Kart - Double Dash!! (USA).zip
+Mario Party 4 (USA).zip
+Mario Party 5 (USA).zip
+Mario Party 6 (USA).zip
+Mario Power Tennis (USA).zip
+Mario Superstar Baseball (USA).zip
+Mark Davis Pro Bass Challenge (USA).zip
+Marvel Nemesis - Rise of the Imperfects (USA).zip
+Mary-Kate and Ashley - Sweet 16 - Licensed to Drive (USA).zip
+Mat Hoffman's Pro BMX 2 (USA).zip
+MC Groovz Dance Craze (USA).zip
+MC Groovz Dance Craze (USA, Canada).zip
+Medabots Infinity (USA).zip
+Medal of Honor - European Assault (USA).zip
+Medal of Honor - Frontline (USA).zip
+Medal of Honor - Rising Sun (USA) (Disc 1).zip
+Mega Man Network Transmission (USA).zip
+Mega Man X - Command Mission (USA).zip
+Mega Man X Collection (USA).zip
+Men in Black II - Alien Escape (USA).zip
+Metal Arms - Glitch in the System (USA).zip
+Metal Gear Solid - The Twin Snakes (USA) (Disc 1).zip
+Metroid Prime (USA).zip
+Metroid Prime 2 - Echoes (USA) (Bonus Disc).zip
+Metroid Prime 2 - Echoes (USA).zip
+Metroid Prime 2 - Echoes (USA, Canada) (Bonus Disc).zip
+Midway Arcade Treasures (USA).zip
+Midway Arcade Treasures 2 (USA).zip
+Midway Arcade Treasures 3 (USA).zip
+Minority Report - Everybody Runs (USA).zip
+Mission - Impossible - Operation Surma (USA).zip
+MLB SlugFest 2003 (USA).zip
+MLB SlugFest 2004 (USA).zip
+Monopoly Party (USA).zip
+Monster 4x4 - Masters of Metal (USA).zip
+Monster House (USA) (En,Fr).zip
+Monster Jam - Maximum Destruction (USA).zip
+Mortal Kombat - Deadly Alliance (USA).zip
+Mortal Kombat - Deception (USA).zip
+Muppets - Party Cruise (USA).zip
+MVP Baseball 2004 (USA).zip
+MVP Baseball 2005 (USA).zip
+MX SuperFly (USA).zip
+Mystic Heroes (USA).zip
+Namco Museum (USA).zip
+Namco Museum 50th Anniversary (USA).zip
+Naruto - Clash of Ninja (USA).zip
+Naruto - Clash of Ninja 2 (USA).zip
+NASCAR - Dirt to Daytona (USA).zip
+NASCAR 2005 - Chase for the Cup (USA).zip
+NASCAR Thunder 2003 (USA).zip
+NBA 2K2 (USA).zip
+NBA 2K3 (USA).zip
+NBA Courtside 2002 (USA).zip
+NBA Live 06 (USA).zip
+NBA Live 2003 (USA).zip
+NBA Live 2004 (USA).zip
+NBA Live 2005 (USA).zip
+NBA Street (USA).zip
+NBA Street V3 (USA).zip
+NBA Street Vol. 2 (USA).zip
+NCAA College Basketball 2K3 (USA).zip
+NCAA College Football 2K3 (USA).zip
+NCAA Football 2003 (USA).zip
+NCAA Football 2004 (USA).zip
+NCAA Football 2005 (USA).zip
+Need for Speed - Carbon (USA).zip
+Need for Speed - Hot Pursuit 2 (USA).zip
+Need for Speed - Most Wanted (USA).zip
+Need for Speed - Underground (USA).zip
+Need for Speed - Underground 2 (USA).zip
+NFL 2K3 (USA).zip
+NFL Blitz 2002 (USA).zip
+NFL Blitz 2003 (USA).zip
+NFL Blitz Pro (USA).zip
+NFL QB Club 2002 (USA).zip
+NFL Street (USA).zip
+NFL Street 2 (USA).zip
+NHL 2K3 (USA).zip
+NHL 06 (USA) (En,Fr).zip
+NHL 2003 (USA).zip
+NHL 2004 (USA).zip
+NHL 2005 (USA) (En,Fr).zip
+NHL Hitz 2002 (USA).zip
+NHL Hitz 2003 (USA).zip
+NHL Hitz Pro (USA).zip
+Nick Jr. Dora the Explorer - Journey to the Purple Planet (USA).zip
+Nickelodeon Avatar - The Last Airbender (USA).zip
+Nickelodeon Barnyard (USA).zip
+Nickelodeon Jimmy Neutron - Boy Genius - Attack of the Twonkies (USA).zip
+Nickelodeon Jimmy Neutron - Boy Genius (USA).zip
+Nickelodeon Party Blast (USA).zip
+Nickelodeon Rocket Power - Beach Bandits (USA).zip
+Nickelodeon Rugrats - Royal Ransom (USA).zip
+Nickelodeon SpongeBob SquarePants - Battle for Bikini Bottom (USA).zip
+Nickelodeon SpongeBob SquarePants - Creature from the Krusty Krab (USA).zip
+Nickelodeon SpongeBob SquarePants - Lights, Camera, Pants! (USA).zip
+Nickelodeon SpongeBob SquarePants - Revenge of the Flying Dutchman (USA).zip
+Nickelodeon Tak - The Great Juju Challenge (USA).zip
+Nickelodeon Tak 2 - The Staff of Dreams (USA).zip
+Nickelodeon The Adventures of Jimmy Neutron - Boy Genius - Jet Fusion (USA).zip
+Nicktoons - Battle for Volcano Island (USA).zip
+Nicktoons Unite! (USA).zip
+Nintendo GameCube Preview Disc - May 2003 (USA).zip
+Nintendo GameCube Preview Disc - May 2003 (USA, Canada).zip
+Nintendo GameCube Service Disc Version 1.0-03 (USA).zip
+Open Season (USA) (En,Fr,Es).zip
+Outlaw Golf (USA).zip
+P.N. 03 (USA).zip
+Pac-Man Fever (USA).zip
+Pac-Man Vs. (USA).zip
+Pac-Man World 2 (USA).zip
+Pac-Man World 3 (USA).zip
+Pac-Man World Rally (USA).zip
+Paper Mario - The Thousand-Year Door (USA).zip
+Peter Jackson's King Kong - The Official Game of the Movie (USA) (En,Fr,Es).zip
+Phantasy Star Online Episode I & II (USA) (En,Ja,Fr,De,Es).zip
+Phantasy Star Online Episode III - C.A.R.D. Revolution (USA) (En,Ja).zip
+Pikmin (USA).zip
+Pikmin 2 (USA).zip
+Pinball Hall of Fame - The Gottlieb Collection (USA).zip
+Pitfall - The Lost Expedition (USA).zip
+Pokemon Channel (USA).zip
+Pokemon Colosseum (USA) (Bonus Disc).zip
+Pokemon Colosseum (USA).zip
+Pokemon XD - Gale of Darkness (USA).zip
+Polar Express, The (USA).zip
+Pool Paradise (USA).zip
+Power Rangers - Dino Thunder (USA).zip
+Powerpuff Girls, The - Relish Rampage - Pickled Edition (USA).zip
+Prince of Persia - The Sands of Time (USA) (En,Fr,Es).zip
+Prince of Persia - The Two Thrones (USA) (En,Fr,Es).zip
+Prince of Persia - Warrior Within (USA) (En,Fr,Es).zip
+Pro Rally 2002 (USA) (En,Fr,Es).zip
+Puyo Pop Fever (USA) (En,Ja,Fr,De,Es,It).zip
+Rally Championship (USA).zip
+Rampage - Total Destruction (USA).zip
+Rave Master (USA).zip
+Rayman 3 - Hoodlum Havoc (USA) (En,Fr,De,Es,It).zip
+Rayman Arena (USA) (En,Fr,Es).zip
+Red Faction II (USA).zip
+RedCard 20-03 (USA).zip
+Reign of Fire (USA).zip
+Resident Evil - Code - Veronica X (USA) (Disc 1).zip
+Resident Evil (USA) (Disc 1).zip
+Resident Evil 2 (USA).zip
+Resident Evil 3 - Nemesis (USA).zip
+Resident Evil 4 (USA) (Disc 1).zip
+Resident Evil 4 (USA) (Preview Disc).zip
+Resident Evil Zero (USA) (Disc 1).zip
+Ribbit King (USA) (En,Es).zip
+Ribbit King Plus! (USA) (Bonus Disc).zip
+Road Trip - The Arcade Edition (USA).zip
+RoadKill (USA).zip
+Robotech - Battlecry (USA).zip
+Robots (USA).zip
+Rocky (USA).zip
+Rogue Ops (USA).zip
+R-Racing Evolution (USA).zip
+Samurai Jack - The Shadow of Aku (USA).zip
+Scaler (USA) (En,Fr).zip
+Scooby-Doo! Mystery Mayhem (USA).zip
+Scooby-Doo! Night of 100 Frights (USA).zip
+Scooby-Doo! Unmasked (USA) (En,Fr).zip
+Scorpion King, The - Rise of the Akkadian (USA).zip
+SeaWorld Adventure Parks - Shamu's Deep Sea Adventures (USA).zip
+Second Sight (USA).zip
+Sega Soccer Slam (USA).zip
+Shadow the Hedgehog (USA) (En,Ja,Fr,De,Es,It).zip
+Shonen Jump's One Piece - Grand Adventure (USA).zip
+Shonen Jump's One Piece - Grand Battle (USA).zip
+Shonen Jump's One Piece - Pirates' Carnival (USA).zip
+Shrek 2 (USA).zip
+Shrek Extra Large (USA).zip
+Shrek Super Party (USA).zip
+Simpsons, The - Hit & Run (USA).zip
+Simpsons, The - Road Rage (USA).zip
+Sims 2, The - Pets (USA).zip
+Sims 2, The (USA).zip
+Sims, The - Bustin' Out (USA).zip
+Sims, The (USA).zip
+Skies of Arcadia - Legends (USA).zip
+Skies of Arcadia Legends (USA).zip
+Smashing Drive (USA).zip
+Smuggler's Run - Warzones (USA).zip
+Sonic Adventure 2 - Battle (USA) (En,Ja,Fr,De,Es).zip
+Sonic Adventure DX - Director's Cut (USA) (En,Ja,Fr,De,Es).zip
+Sonic Gems Collection (USA).zip
+Sonic Heroes (USA) (En,Ja,Fr,De,Es,It).zip
+Sonic Mega Collection (USA).zip
+Sonic Riders (USA) (En,Ja,Fr,De,Es,It).zip
+Soulcalibur II (USA).zip
+Space Raiders (USA).zip
+Spartan - Total Warrior (USA).zip
+Spawn - Armageddon (USA).zip
+Speed Kings (USA).zip
+Sphinx and the Cursed Mummy (USA).zip
+Spider-Man (USA).zip
+Spider-Man 2 (USA).zip
+Spirits & Spells (USA).zip
+SpyHunter (USA).zip
+Spyro - A Hero's Tail (USA).zip
+Spyro - Enter the Dragonfly (USA).zip
+Spyro - Enter the Dragonfly (USA, Canada).zip
+SRS - Street Racing Syndicate (USA).zip
+SSX 3 (USA).zip
+SSX on Tour (USA).zip
+SSX Tricky (USA).zip
+Star Fox - Assault (USA).zip
+Star Fox Adventures (USA).zip
+Star Wars - Bounty Hunter (USA).zip
+Star Wars - Jedi Knight II - Jedi Outcast (USA).zip
+Star Wars - Rogue Squadron II - Rogue Leader (USA).zip
+Star Wars - Rogue Squadron III - Rebel Strike - Limited Edition Preview Disc (USA).zip
+Star Wars - Rogue Squadron III - Rebel Strike (USA) (En,Fr,De,Es,It).zip
+Star Wars - Rogue Squadron III - Rebel Strike (USA) (Limited Edition Preview Disc).zip
+Star Wars - The Clone Wars (USA).zip
+Starsky & Hutch (USA).zip
+Street Hoops (USA).zip
+Strike Force Bowling (USA).zip
+Sum of All Fears, The (USA).zip
+Summoner - A Goddess Reborn (USA).zip
+Super Bubble Pop (USA).zip
+Super Mario Strikers (USA).zip
+Super Mario Sunshine (USA).zip
+Super Mario Sunshine (USA, Canada).zip
+Super Monkey Ball (USA).zip
+Super Monkey Ball 2 (USA).zip
+Super Monkey Ball Adventure (USA).zip
+Super Smash Bros. Melee (USA) (En,Ja).zip
+Superman - Shadow of Apokolips (USA).zip
+Surf's Up (USA) (En,Fr,Es).zip
+Swingerz Golf (USA).zip
+SX Superstar (USA).zip
+Tak and the Power of Juju (USA).zip
+Tales of Symphonia (USA) (Disc 1).zip
+Taz - Wanted (USA) (En,Fr,De,Es,It).zip
+Teen Titans (USA) (En,Fr).zip
+Teenage Mutant Ninja Turtles (USA).zip
+Teenage Mutant Ninja Turtles 2 - Battle Nexus (USA) (Disc 1).zip
+Teenage Mutant Ninja Turtles 3 - Mutant Nightmare (USA) (Disc 1).zip
+Terminator 3 - The Redemption (USA).zip
+Tetris Worlds (USA).zip
+Tiger Woods PGA Tour 06 (USA).zip
+Tiger Woods PGA Tour 2003 (USA).zip
+Tiger Woods PGA Tour 2004 (USA) (Disc 1).zip
+Tiger Woods PGA Tour 2005 (USA) (Disc 1).zip
+TimeSplitters - Future Perfect (USA).zip
+TimeSplitters 2 (USA).zip
+TMNT - Mutant Melee (USA).zip
+TMNT (USA) (En,Fr,Es).zip
+Tom and Jerry in War of the Whiskers (USA).zip
+Tom Clancy's Ghost Recon (USA).zip
+Tom Clancy's Ghost Recon 2 (USA) (En,Fr,Es).zip
+Tom Clancy's Rainbow Six - Lockdown (USA).zip
+Tom Clancy's Rainbow Six 3 (USA).zip
+Tom Clancy's Splinter Cell - Chaos Theory (USA) (En,Fr,Es) (Disc 1).zip
+Tom Clancy's Splinter Cell - Double Agent (USA) (En,Fr,Es) (Disc 1).zip
+Tom Clancy's Splinter Cell (USA).zip
+Tonka - Rescue Patrol (USA).zip
+Tony Hawk's American Wasteland (USA).zip
+Tony Hawk's Pro Skater 3 (USA).zip
+Tony Hawk's Pro Skater 4 (USA).zip
+Tony Hawk's Underground (USA).zip
+Tony Hawk's Underground 2 (USA).zip
+Top Angler - Real Bass Fishing (USA).zip
+Top Gun - Combat Zones (USA).zip
+TransWorld Surf - Next Wave (USA).zip
+Trigger Man (USA).zip
+True Crime - New York City (USA).zip
+True Crime - Streets of LA (USA).zip
+Tube Slider - The Championship of Future Formula (USA).zip
+Turok - Evolution (USA).zip
+TY the Tasmanian Tiger (USA).zip
+TY the Tasmanian Tiger 2 - Bush Rescue (USA).zip
+UFC - Throwdown (USA).zip
+Ultimate Muscle - Legends vs. New Generation (USA).zip
+Ultimate Spider-Man (USA).zip
+Universal Studios Theme Park Adventure (USA).zip
+Urbz, The - Sims in the City (USA).zip
+Vexx (USA).zip
+Viewtiful Joe - Red Hot Rumble (USA).zip
+Viewtiful Joe (USA).zip
+Viewtiful Joe 2 (USA).zip
+Virtua Quest (USA).zip
+Virtua Striker 2002 (USA).zip
+Wallace & Gromit in Project Zoo (USA).zip
+Walt Disney Pictures Presents Meet the Robinsons (USA).zip
+Wario World (USA).zip
+WarioWare, Inc. - Mega Party Game$! (USA).zip
+Wave Race - Blue Storm (USA).zip
+Whirl Tour (USA).zip
+Worms 3D (USA) (En,Fr).zip
+Worms Blast (USA) (En,Fr,Es).zip
+Wreckless - The Yakuza Missions (USA).zip
+WTA Tour Tennis (USA).zip
+WWE Crush Hour (USA).zip
+WWE Day of Reckoning (USA).zip
+WWE Day of Reckoning 2 (USA).zip
+WWE WrestleMania X8 (USA).zip
+WWE WrestleMania XIX (USA).zip
+X2 - Wolverine's Revenge (USA).zip
+XGIII - Extreme G Racing (USA).zip
+XGRA - Extreme G Racing Association (USA).zip
+XIII (USA) (En,Fr,Es).zip
+X-Men - Next Dimension (USA).zip
+X-Men - The Official Game (USA).zip
+X-Men Legends (USA).zip
+X-Men Legends II - Rise of Apocalypse (USA).zip
+Yu-Gi-Oh! The Falsebound Kingdom (USA).zip
+Zapper (USA).zip
+Zatch Bell! Mamodo Battles (USA).zip
+Zatch Bell! Mamodo Fury (USA).zip
+Zoids - Battle Legends (USA).zip
+ZooCube (USA).zip
+TY the Tasmanian Tiger - Night of the Quinkan (USA).zip
diff --git a/other/screenshots.py b/other/screenshots.py
new file mode 100644
index 0000000..dc4a484
--- /dev/null
+++ b/other/screenshots.py
@@ -0,0 +1,13 @@
+from pathlib import Path
+
+ROMS_PATH = Path("\\\\VIBRATOR\\Roms\\Nintendo - GameCube")
+BLACKLIST = [
+ "Alpha", "Beta", "Proto", "Rev ", "Action Replay", "(v1.", "(Unl)", "Disc 2", "Disc 3", "Demo"
+]
+
+screenshots = []
+for file in ROMS_PATH.glob("*.zip"):
+ if "USA" in file.name and not any(x.lower() in file.name.lower() for x in BLACKLIST):
+ screenshots.append(file)
+for sc in screenshots:
+ print(sc.name)
\ No newline at end of file