mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Implement makercode as expected
This commit is contained in:
parent
89c883466a
commit
7ec077e08a
|
@ -14,7 +14,7 @@ fn main() -> Result<()> {
|
|||
.arg(arg!(-o --output <OUTPUT> "Set output file, defaults to replacing INPUT's extension to .gba").value_parser(value_parser!(PathBuf)))
|
||||
.arg(arg!(-t --title <TITLE> "Set the title. At most 12 bytes. Defaults to truncating the input file name"))
|
||||
.arg(arg!(-c --gamecode <GAME_CODE> "Sets the game code, 4 bytes"))
|
||||
.arg(arg!(-m --makercode <MAKER_CODE> "Set the maker code, 0-65535").value_parser(value_parser!(u16)))
|
||||
.arg(arg!(-m --makercode <MAKER_CODE> "Set the maker code, 2 bytes"))
|
||||
.arg(arg!(-r --gameversion <VERSION> "Set the version of the game, 0-255").value_parser(value_parser!(u8)))
|
||||
.arg(arg!(-p "Ignored for compatibility with gbafix"))
|
||||
.get_matches();
|
||||
|
@ -43,8 +43,19 @@ fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(maker_code) = matches.get_one::<u16>("makercode") {
|
||||
header.maker_code = maker_code.to_le_bytes();
|
||||
if let Some(maker_code) = matches.get_one::<String>("makercode") {
|
||||
let maker_code = maker_code.as_bytes();
|
||||
if maker_code.len() > 2 {
|
||||
bail!(
|
||||
"Maker code must be at most 2 bytes, got {}",
|
||||
maker_code.len()
|
||||
);
|
||||
}
|
||||
|
||||
header.maker_code = [
|
||||
*maker_code.first().unwrap_or(&0),
|
||||
*maker_code.get(1).unwrap_or(&0),
|
||||
];
|
||||
}
|
||||
|
||||
if let Some(game_version) = matches.get_one::<u8>("gameversion") {
|
||||
|
|
2
justfile
2
justfile
|
@ -105,7 +105,7 @@ _build-rom folder name:
|
|||
|
||||
mkdir -p examples/target/examples
|
||||
|
||||
just gbafix --title "${INTERNAL_NAME:0:12}" --gamecode "${INTERNAL_NAME:0:4}" "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" -o "$GBA_FILE"
|
||||
just gbafix --title "${INTERNAL_NAME:0:12}" --gamecode "${INTERNAL_NAME:0:4}" --makercode GC "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" -o "$GBA_FILE"
|
||||
|
||||
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
||||
|
||||
|
|
Loading…
Reference in a new issue