OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.0 KiB

  1. #!/bin/bash
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: target/dreamcast/DreamBurn.sh
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. show_usage() {
  16. cat <<EOT
  17. Usage:
  18. $0 <content> <IP.BIN> [ -cdrw ] [-dev <device>] [-genopt <string>] [-burnopt <string>] [-xa <string>]
  19. Burn boot-able discs for the SEGA Dreamcast console using cdrecord.
  20. mandatory parameters:
  21. <content> file or directory containing scrambled executable
  22. <IP.BIN> valid IP header conforming to <content>
  23. options:
  24. -cdrw burn CD-RW (blank PMA, TOC, Pregap first). Note that
  25. the Dreamcast cannot read CD-RWs !
  26. -dev cdrecord device string. Default is "0,0,0"
  27. -genopt additional cdrecord options. Default is ""
  28. -burnopt additional cdrecord options for burning (e.g. speed=8 ).
  29. Default is ""
  30. -xa cdrecord option for CD/XA with form 1 sectors with 2048
  31. bytes per sector. Depending on cdrecord version this is
  32. -xa or -xa1 (consult the manpage !). Default is "-xa"
  33. EOT
  34. exit 1
  35. }
  36. ##### default values
  37. cdrw=""
  38. dev="0,0,0"
  39. genopt=""
  40. burnopt=""
  41. xa="-xa"
  42. ####################
  43. content=$1
  44. ip=$2
  45. shift ; shift
  46. while [ "$1" ] ; do
  47. case "$1" in
  48. -cdrw) cdrw=" blank=minimal" ; shift ;;
  49. -dev) dev="$2" ; shift ; shift ;;
  50. -genopt) genopt=" $2" ; shift ; shift ;;
  51. -burnopt) burnopt=" $2" ; shift ; shift ;;
  52. -xa) xa="$2" ; shift ; shift ;;
  53. *) echo "Unknown option: $1" ; show_usage ;;
  54. esac
  55. done
  56. [ -e "$content" -a -f "$ip" ] || show_usage;
  57. cdr="cdrecord dev=$dev$genopt"
  58. burnaudio="$cdr$burnopt$cdrw -multi -audio"
  59. info="$cdr -msinfo"
  60. burndata="$cdr$burnopt -multi $xa"
  61. cat <<EOT
  62. cdrecord calls to be executed:
  63. # $burnaudio (FILE)
  64. # $info
  65. # $burndata (FILE)
  66. EOT
  67. echo -n "Proceed ? [Y/n] "
  68. read confirm;
  69. [ -z "$confirm" -o "$confirm" == "y" -o "$confirm" == "Y" ] || exit 0;
  70. audiofile=`mktemp -t audio.raw.XXXXXX`
  71. datafile=`mktemp -t data.raw.XXXXXX`
  72. isofile=`mktemp -t data.iso.XXXXXX`
  73. echo "Creating bogus audio track."
  74. dd if=/dev/zero bs=2352 count=300 of=$audiofile 2>/dev/null
  75. echo
  76. echo
  77. echo "Burning...."
  78. cmd="$burnaudio $audiofile"
  79. echo "$cmd"
  80. eval "$cmd"
  81. echo
  82. echo
  83. echo "Geting multisession status:"
  84. echo "$info"
  85. status=`eval "$info"`
  86. echo "--> $status"
  87. echo
  88. echo
  89. echo "Creating image."
  90. mkisofs -l -C $status -o $isofile $content
  91. echo "Inserting $ip."
  92. ( cat $ip ; dd if=$isofile bs=2048 skip=16 ) > $datafile
  93. echo
  94. echo
  95. echo "Burning..."
  96. cmd="$burndata $datafile"
  97. echo "$cmd"
  98. eval "$cmd"
  99. echo
  100. echo
  101. echo "Cleaning up."
  102. rm -f $audiofile $isofile $datafile
  103. echo "Done."