Added generator short commit hash to end of reserved space for all ROMs

This commit is contained in:
Adam Gastineau
2023-06-28 17:41:42 -07:00
parent 9ec5ea327c
commit 6e77dfd2a0
5 changed files with 79 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ First bit is version. Spec V1 is as follows:
0x0: [version 8 bits (01)][mpu 8 bits][screen configuration 8 bits][screen width|screen height 24 bits][reserved 16 bits]
0x8: input mapping 40 bytes - [s0 config 4 bytes][s1 config 4 bytes] ... [s7 config 4 bytes][b config 1 byte][ba config 1 byte][acl config 1 byte][grounded port index 1 byte][reserved 4 bytes]
0x30: Start of reserved space - This is reserved for future functionality
0x79: [generator tool commit (ascii) 7 bytes]
0x80: Start of byte interleaved images
0x17BB80: [mask config 0x2DB40 bytes] End of images, start of mask config
0x1A96C0: ROM data

51
support/Cargo.lock generated
View File

@@ -57,6 +57,12 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "anyhow"
version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
[[package]]
name = "arrayref"
version = "0.3.7"
@@ -434,6 +440,7 @@ dependencies = [
"sha1",
"svg",
"tiny-skia-path",
"vergen",
"zip",
]
@@ -918,6 +925,12 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "rustversion"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
[[package]]
name = "rustybuzz"
version = "0.7.0"
@@ -1134,6 +1147,33 @@ dependencies = [
"weezl",
]
[[package]]
name = "time"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [
"itoa",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
dependencies = [
"time-core",
]
[[package]]
name = "tiny-skia"
version = "0.9.0"
@@ -1280,6 +1320,17 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "vergen"
version = "8.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b3c89c2c7e50f33e4d35527e5bf9c11d6d132226dbbd1753f0fbe9f19ef88c6"
dependencies = [
"anyhow",
"rustversion",
"time",
]
[[package]]
name = "version_check"
version = "0.9.4"

View File

@@ -3,6 +3,8 @@ name = "fpga-gnw-romgenerator"
version = "0.1.0"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@@ -21,3 +23,6 @@ sha1 = "0.10.5"
svg = "0.13.1"
tiny-skia-path = "0.9"
zip = { version = "0.6", features = ["deflate"], default-features = false }
[build-dependencies]
vergen = { version = "8.2.1", features = ["git", "gitcl"] }

8
support/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use std::error::Error;
use vergen::EmitBuilder;
fn main() -> Result<(), Box<dyn Error>> {
// Emit the instructions
EmitBuilder::builder().git_sha(true).emit()?;
Ok(())
}

View File

@@ -255,10 +255,23 @@ fn build_config(platform: &PlatformSpecification) -> Result<Vec<u8>, String> {
}
// Reserved space
for _ in 0..0xD0 {
for _ in 0..0xC9 {
config.push(0);
}
let sha = env!("VERGEN_GIT_SHA");
if sha.len() < 1 {
println!("Unknown git SHA");
vec![0 as u8; 7].iter().for_each(|c| config.push(*c));
} else {
sha.chars()
.take(7)
.map(|c| c as u8)
.for_each(|c| config.push(c));
};
Ok(config)
}