Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
disk_image_compression [2023/06/06 17:57] maionidisk_image_compression [2026/03/27 10:24] (current) – ↷ Links adapted because of a move operation 40.77.167.44
Line 30: Line 30:
   * [[systems:3do]]   * [[systems:3do]]
   * [[systems:dreamcast]]   * [[systems:dreamcast]]
-  * [[systems:segacd]]+  * [[systems:megacd]]
   * [[systems:neogeocd]]   * [[systems:neogeocd]]
   * [[systems:pcenginecd]]   * [[systems:pcenginecd]]
Line 63: Line 63:
 ==== Creating CHDs ==== ==== Creating CHDs ====
  
-''chdman'' is a commmand line application. It can create a ''.chd'' file by targeting ''*.cue'', ''*.iso'' or ''*.gdi'' files.+''chdman'' is a commmand line application. It can create a ''.chd'' file by targeting ''*.cue'', ''*.iso'', ''.nrg'' or ''*.gdi'' files.
  
 If there is a ''*.cue'' file available, use this for creating the ''.chd''. Otherwise choose the ''*.iso'' (Sony PlayStation 2 DVDs) or ''*.gdi'' (Dreamcast GD-ROM) file. Note that GameCube/Wii have their [[#rvz|own compressed format]]. If there is a ''*.cue'' file available, use this for creating the ''.chd''. Otherwise choose the ''*.iso'' (Sony PlayStation 2 DVDs) or ''*.gdi'' (Dreamcast GD-ROM) file. Note that GameCube/Wii have their [[#rvz|own compressed format]].
Line 88: Line 88:
 </code> </code>
  
-Then make yourself a cup of tea. This can take a while. After that you'll have ''<game.chd>'' and you can delete the ''*.cue''/''*.bin'', ''*.iso'' or ''*.gdi''/''*.bin'' file(s).+Then make yourself a cup of tea. This can take a while. After that you'll have ''<game.chd>'' and you can delete the ''*.cue''/''*.bin'', ''*.iso'', ''.nrg'' or ''*.gdi''/''*.bin'' file(s).
  
 The compression is fully lossless so it is possible to redo the compression and get the original files back: The compression is fully lossless so it is possible to redo the compression and get the original files back:
Line 95: Line 95:
 chdman extractcd -i <game.chd> -o <game.cue> chdman extractcd -i <game.chd> -o <game.cue>
 </code> </code>
 +
 +For DVD-based systems, you can use the ''createdvd'' command rather than ''createcd'' in the examples above. It is usually a little more efficient in term of compression (7-10% gain on the resulting ''.chd'' file) but it also provides better performance in-game. 
  
 === CHD batch converting === === CHD batch converting ===
Line 102: Line 104:
 **Linux/macOS:** **Linux/macOS:**
  
-Navigate to the folder that has all your game ROMs and run the following ''for'' loop to convert all the files in one go:+Place the script into your folder that holds your ROMs and execute the script. This will take it's time. So relax....
  
-<code+<file bash allimg-to-chd.sh
-for i in *.cue; do chdman createcd -i "${i}" -o "${i%.*}.chd"; done +#!/usr/bin/env -S bash #PROTECTED 
-</code>+grep -rlq $'\r' "$0" && { dos2unix -k -q "$0"; echo "Script repaired ... please try again"; exit 0; } # Selfrepair for called script 
 +pushd "$(dirname "$0")" 
 +readarray -t array < <(find -maxdepth 1 -type f \( -iname "*.cue" -o -iname "*.iso" -o -iname "*.toc" -o -iname "*.gdi" -o -iname "*.nrg" \) -printf "%p\n"
 +[ -z "${array[@]}" ] && { echo "No disc images found.... Exit now"; exit; } 
 +[ -f "/usr/bin/mame/chdman" ] || { echo "chdman not found! ... Exit now"; exit; } 
 +for i in "${array[@]}"; do 
 +    /usr/bin/mame/chdman createcd -i "${i}" -o "${i%.*}.chd"; 
 +    echo; echo "You can remove file: $i and additionals if you want!" 
 +done 
 +popd 
 +</file>
  
-replacing ''*.cue'' as needed. If you're converting a lot of files, practice some yoga poses. This may take a while.+replacing ''*.cue'' and other images as needed. If you're converting a lot of files, practice some yoga poses. This may take a while.
  
 Here's a command to convert all the games in the current folder and recursive folders to CHD:  Here's a command to convert all the games in the current folder and recursive folders to CHD: 
Line 126: Line 138:
 find . -name "*gdi" -exec chdman createcd -i {} -o {}.chd \; find . -name "*gdi" -exec chdman createcd -i {} -o {}.chd \;
 </code> </code>
 +
 +For ''*.toc'':
 +<code>
 +find . -name "*toc" -exec chdman createcd -i {} -o {}.chd \;
 +</code>
 +
 +Note: find command is recursive, so it will convert files from subfolders.
  
 **Windows:** **Windows:**
Line 146: Line 165:
 <code - gdi-to-chd.bat> <code - gdi-to-chd.bat>
 for /r %%i in (*.gdi) do chdman createcd -i "%%i" -o "%%~ni.chd" for /r %%i in (*.gdi) do chdman createcd -i "%%i" -o "%%~ni.chd"
 +</code>
 +
 +For ''*.toc'':
 +<code - gdi-to-chd.bat>
 +for /r %%i in (*.toc) do chdman createcd -i "%%i" -o "%%~ni.chd"
 </code> </code>
  
 Or combine both: Or combine both:
-for /r %%i in (*.cue, *.gdi, *.iso) do chdman createcd -i "%%i" -o "%%~ni.chd"+for /r %%i in (*.cue, *.gdi, *.iso, *.toc) do chdman createcd -i "%%i" -o "%%~ni.chd"
  
 If you're converting a lot of files, play some tunes on your guitar. This may take a while. If you're converting a lot of files, play some tunes on your guitar. This may take a while.
 +
 +==== CDI / NRG / IMG TO CHD ====
 +
 +[[https://master.dl.sourceforge.net/project/mame/mame/0.138/mame0138b_64bit.exe|chdman 0.138b]] and below support converting ''.cdi'' files to CHD as well. It requires the additional [[https://www.cdiemu.org/download/cdifile-0.5.1.zip|cdifile]] executable to be in the same directory as it.
 +
 +<WRAP center round important>
 +Newer versions of chdman (0139+) are not compatible with cdifile.
 +</WRAP>
 +
 +Put the files ''chdman.exe'' and ''cdifile.exe''in the same directory
 +
 +And run the code line command:
 +
 +**For Windows:**
 +<code>
 +cdifile.exe game.cdi -createcd
 +cdifile.exe game.nrg -createcd
 +cdifile.exe game.cue -createcd
 +cdifile.exe game.img -createcd
 +</code>
 +
 +These commands can also be run from WINE in any Linux distro.
 +
 +<WRAP center round tip>
 +It's a good idea to test the game is still working after the conversion before deleting anything.
 +</WRAP>
  
 ===== CSO ===== ===== CSO =====
Line 201: Line 251:
 **Linux/macOS:** **Linux/macOS:**
  
-<code+<file bash iso-to-cso.sh> 
-for i in *.iso; do maxcso "${i}"; done +#!/bin/bash 
-</code>+for i in *.iso; 
 +do maxcso "${i}"; 
 +done 
 +</file>
  
 **Windows:** **Windows:**
  
-<code>+<file - iso-to-cso.bat>
 for %i in (*.iso) do maxcso.exe "%i" for %i in (*.iso) do maxcso.exe "%i"
-</code>+</file>
  
 === With ciso === === With ciso ===
Line 247: Line 300:
 **Linux/MacOS:** **Linux/MacOS:**
  
-<code+Create a file with these contents... 
-for i in *.iso; do ciso 9 "${i}" "${i}".ciso; done + 
-</code>+<file bash iso-to-ciso.sh> 
 +#!/bin/bash 
 +for i in "$@"; do  
 +    ciso 9 "${i}" "${i%*.iso}".cso; 
 +done 
 +</file> 
 + 
 +...mark it executable with this... 
 + 
 +<code>chmod +x iso-to-ciso.sh</code> 
 + 
 +...and then run it like this: 
 + 
 +<code>./iso-to-ciso.sh *.iso</code>
  
 **Windows:** **Windows:**
  
-<code>+<file - iso-to-ciso.sh>
 for %i in (*.iso) do ciso.exe 9 "%i" "%i".ciso for %i in (*.iso) do ciso.exe 9 "%i" "%i".ciso
-</code>+</file>
  
 ===== PBP ===== ===== PBP =====
Line 376: Line 442:
 **Linux/MacOS:** **Linux/MacOS:**
  
-<code+<file bash iso-to-pbp> 
-for i in *.iso; do  -l 9 psxpackager -i "${i}" -o "${i}".pbp; done +#!/bin/bash 
-</code>+for i in *.iso; 
 +do psxpackager -l 9 -i "${i}" -o "${i}".pbp; 
 +done 
 +</file> 
 + 
 +Here's a command to convert all the games in the current folder and recursive folders to PBP:  
 +<file bash all-to-pbp.sh> 
 +find . -name "*iso" -exec psxpackager -l 9 -i {} -o {}.pbp \; 
 +find . -name "*cue" -exec psxpackager -l 9 -i {} -o {}.pbp \; 
 +find . -name "*m3u" -exec psxpackager -l 9 -i {} -o {}.pbp \; 
 +</file>
  
 **Windows:** **Windows:**
  
-<code>+<file - all-to-pbp.bat>
 for %i in (*.iso) do psxpackager.exe -l 9 -i "%i" -o "%i".pbp for %i in (*.iso) do psxpackager.exe -l 9 -i "%i" -o "%i".pbp
-</code>+for %i in (*.cue) do psxpackager.exe -l 9 -i "%i" -o "%i".pbp 
 +for %i in (*.m3u) do psxpackager.exe -l 9 -i "%i" -o "%i".pbp 
 +</file>
  
 OR OR
Line 473: Line 551:
   cd /userdata/roms/dos   cd /userdata/roms/dos
   mksquashfs skweek.pc skweek.pc.squashfs   mksquashfs skweek.pc skweek.pc.squashfs
 +  
 +  cd /userdata/roms/scummvm
 +  mksquashfs "astro chicken" "astro chicken.squashfs" -comp xz
  
 Or to compress a single file : Or to compress a single file :
Line 490: Line 571:
   or   or
   find . -maxdepth 1 -name "[^.]*" -type d -exec mksquashfs {} {}.squashfs -comp xz \;   find . -maxdepth 1 -name "[^.]*" -type d -exec mksquashfs {} {}.squashfs -comp xz \;
 +
 +Or compress multiple .iso files to .squashfs:
 +  for i in *.iso; do mksquashfs "${i}" "${i}".squashfs; done
 +  for i in *.iso; do mksquashfs "${i}" "${i}".squashfs -comp xz; done
  
 After confirming that the game still launches and runs correctly, the old folder can be safely removed. After confirming that the game still launches and runs correctly, the old folder can be safely removed.
  • disk_image_compression.1686074241.txt.gz
  • Last modified: 3 years ago
  • by maioni