built cdi

This commit is contained in:
Andy Killorin 2025-01-03 11:57:49 -05:00
commit ed96599058
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
6 changed files with 123 additions and 0 deletions

59
Cargo.lock generated Normal file
View file

@ -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"

17
Cargo.toml Normal file
View file

@ -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" }

17
Justfile Normal file
View file

@ -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

18
build.rs Normal file
View file

@ -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);
}
}

9
ip.txt Normal file
View file

@ -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

3
src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}