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.

138 lines
3.0 KiB

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