After modification, you must create a new ISO. Do not just save over the original—build a fresh one.
Use:
Ensure you use the correct settings: Mode 1 (data) vs. Mode 2 (CD-i/Video CD), and include any necessary post-gap or ECC data. convert chd to iso repack
Notes:
If you are managing a large ROM collection and need to repack multiple games, batch processing is essential. After modification, you must create a new ISO
#!/bin/bash # chd2iso_repack.sh INPUT_CHD="$1" OUTPUT_ISO="$INPUT_CHD%.chd_repacked.iso" TEMP_DIR=$(mktemp -d)echo "Extracting CHD..." chdman extractcd -i "$INPUT_CHD" -o "$TEMP_DIR/disc.cue" -ob "$TEMP_DIR/disc.bin"
echo "Converting to intermediate ISO..." bchunk "$TEMP_DIR/disc.bin" "$TEMP_DIR/disc.cue" "$TEMP_DIR/interim" Ensure you use the correct settings: Mode 1 (data) vs
echo "Mounting and repacking..." sudo mount -o loop,ro "$TEMP_DIR/interim.iso" "$TEMP_DIR/mnt" mkisofs -R -J -udf -o "$OUTPUT_ISO" "$TEMP_DIR/mnt" sudo umount "$TEMP_DIR/mnt"
echo "Cleaning up..." rm -rf "$TEMP_DIR" echo "Repacked ISO created: $OUTPUT_ISO"