From ed96599058153364078918c167be070dcaaa3ec5 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Fri, 3 Jan 2025 11:57:49 -0500 Subject: [PATCH] built cdi --- Cargo.lock | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 17 +++++++++++++++ Justfile | 17 +++++++++++++++ build.rs | 18 ++++++++++++++++ ip.txt | 9 ++++++++ src/main.rs | 3 +++ 6 files changed, 123 insertions(+) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 Justfile create mode 100644 build.rs create mode 100644 ip.txt create mode 100644 src/main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..59e17c8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,59 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "cc" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" +dependencies = [ + "shlex", +] + +[[package]] +name = "dccake" +version = "0.1.0" +dependencies = [ + "gldc-sys", + "kos-rs", +] + +[[package]] +name = "gldc-sys" +version = "0.1.0" +source = "git+https://github.com/dreamcast-rs/gldc-sys#59a2d96a416d3ffd8f6046de888aa88d94548156" + +[[package]] +name = "kos-rs" +version = "0.1.0" +source = "git+https://github.com/dreamcast-rs/kos-rs#ac0185bfaa19d1de715215b92fb199730a9136ed" +dependencies = [ + "kos-sys", +] + +[[package]] +name = "kos-sys" +version = "0.1.0" +source = "git+https://github.com/dreamcast-rs/kos-sys#53a3c190194e659bf7558de7d3e54957a377990f" +dependencies = [ + "cc", + "libc", + "paste", +] + +[[package]] +name = "libc" +version = "0.2.159" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a8c96ad --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "dccake" +version = "0.1.0" +edition = "2021" + +[profile.release] +opt-level = 3 +overflow-checks = false +strip = "symbols" + +[patch.crates-io] +libc = { path = "/opt/toolchains/dc/rust/libc" } + +[dependencies] +kos = { package = "kos-rs", git = "https://github.com/dreamcast-rs/kos-rs" } +gldc = { package = "gldc-sys", git = "https://github.com/dreamcast-rs/gldc-sys" } + diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..874fe23 --- /dev/null +++ b/Justfile @@ -0,0 +1,17 @@ +BUILD:="build" +PROJECT_NAME:="cake" +TARGET:="target/sh-elf/release/dccake.elf" + +logo: + convert cake.png -resize 256x256 cakes.png + convert cakes.png +dither -colors 127 cakec.png + +build: logo + kos-cargo build --release + sh-elf-objcopy -R .stack -O binary {{TARGET}} output.bin + $KOS_BASE/utils/scramble/scramble output.bin {{BUILD}}/1ST_READ.bin + mkdir -p {{BUILD}} + rm {{BUILD}}/IP.BIN || true + makeip ip.txt -l /tmp/cakec.png {{BUILD}}/IP.BIN + mkisofs -C 0,11702 -V {{PROJECT_NAME}} -G {{BUILD}}/IP.BIN -r -J -l -o {{PROJECT_NAME}}.iso {{BUILD}} + cdi4dc {{PROJECT_NAME}}.iso {{PROJECT_NAME}}.cdi diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..e62b51a --- /dev/null +++ b/build.rs @@ -0,0 +1,18 @@ +fn main() { + generate_textures(vec!["tex_claw", "tex_dc", "tex_dcwiki", "tex_gcc", "tex_kos", "tex_rust"]); +} + +fn generate_textures(names: Vec<&str>) { + let vqenc_cmd = format!("{}/utils/vqenc/vqenc", std::env::var("KOS_BASE").unwrap()); + + for texname in names { + let jpgfile = format!("rsrc/{}.jpg", texname); + let vqfile = format!("rsrc/{}.vq", texname); + let outfile = format!("{}/{}.vq", std::env::var("OUT_DIR").unwrap(), texname); + std::process::Command::new(&vqenc_cmd) + .args(["-t", "-v", &jpgfile]) + .output() + .expect("vqenc on {&vqfile} failed!"); + let _ = std::fs::rename(&vqfile, &outfile); + } +} diff --git a/ip.txt b/ip.txt new file mode 100644 index 0000000..37ef63a --- /dev/null +++ b/ip.txt @@ -0,0 +1,9 @@ +Device Info : CD-ROM1/1 +Area Symbols : JUE +Peripherals : E000F10 +Product No : T0000 +Version : V1.000 +Release Date : 20000627 +Boot Filename : 1ST_READ.BIN +SW Maker Name : andy +Game Title : cake diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}