mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
22e3d8f06e
Remove some palettes. Add PaletteSetSlate. Change all gr_palette_std to gr32_palette_std. Change all CBGR48 to CBGR24.
242 lines
27 KiB
HTML
Executable file
242 lines
27 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.11">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"File/CD DVD"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU16</span><span class=cF0> *dst, </span><span class=cF9>U16</span><span class=cF0> w)
|
|
<a name="l4"></a>{
|
|
<a name="l5"></a> dst->big = </span><span class=cF5>EndianU16</span><span class=cF0>(w);
|
|
<a name="l6"></a> dst->little = w;
|
|
<a name="l7"></a>}
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU32</span><span class=cF0> *dst, </span><span class=cF9>I64</span><span class=cF0> d)
|
|
<a name="l10"></a>{
|
|
<a name="l11"></a> dst->big = </span><span class=cF5>EndianU32</span><span class=cF0>(d);
|
|
<a name="l12"></a> dst->little = d;
|
|
<a name="l13"></a>}
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CElTorito</span><span class=cF0>
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF9>U16</span><span class=cF0> w[</span><span class=cFE>16</span><span class=cF0>];
|
|
<a name="l18"></a> </span><span class=cF1>U8</span><span class=cF0> bootable; </span><span class=cF2>// 88=bootable 00=not bootable</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF1>U8</span><span class=cF0> media_type; </span><span class=cF2>// 0=no emulation 4=hard disk</span><span class=cF0>
|
|
<a name="l20"></a> </span><span class=cF9>U16</span><span class=cF0> load_seg; </span><span class=cF2>// 0000->07C0</span><span class=cF0>
|
|
<a name="l21"></a> </span><span class=cF1>U8</span><span class=cF0> sys_type;
|
|
<a name="l22"></a> </span><span class=cF1>U8</span><span class=cF0> zero;
|
|
<a name="l23"></a> </span><span class=cF9>U16</span><span class=cF0> sect_count;
|
|
<a name="l24"></a> </span><span class=cF9>U32</span><span class=cF0> load_rba; </span><span class=cF2>// start addr of virtual disk</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF1>U8</span><span class=cF0> zero2[</span><span class=cFE>20</span><span class=cF0>];
|
|
<a name="l26"></a>};
|
|
<a name="l27"></a>
|
|
<a name="l28"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename, </span><span class=cF1>U8</span><span class=cF0> *stage2_filename)
|
|
<a name="l29"></a>{
|
|
<a name="l30"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
|
|
<a name="l31"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l32"></a> </span><span class=cF1>U8</span><span class=cF0> *stage1_buf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>);
|
|
<a name="l33"></a>
|
|
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF0>stage2_filename, &de</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>out_file = </span><span class=cF5>FOpen</span><span class=cF0>(iso_filename, </span><span class=cF6>"wc+"</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l35"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(stage1_buf, </span><span class=cFD>BDVD_START</span><span class=cF0>, </span><span class=cFD>BDVD_END</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>);
|
|
<a name="l37"></a> *(</span><span class=cFD>BDVD_BLK_LO</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U32</span><span class=cF0> *) = de.clus >> </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l38"></a> *(</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) = (de.size + </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) >> (</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l39"></a> *(</span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) = de.clus & </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l40"></a>
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (de.clus & </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l42"></a> *(</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) += </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l43"></a>
|
|
<a name="l44"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, stage1_buf, </span><span class=cFE>20</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0> / </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
|
<a name="l45"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
|
|
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(stage1_buf);
|
|
<a name="l48"></a>}
|
|
<a name="l49"></a>
|
|
<a name="l50"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename, </span><span class=cF1>U8</span><span class=cF0> drv_let)
|
|
<a name="l51"></a>{
|
|
<a name="l52"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive = </span><span class=cF5>Letter2Drive</span><span class=cF0>(drv_let);
|
|
<a name="l53"></a> </span><span class=cF9>CISOPriDesc</span><span class=cF0> *iso_pri = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
|
|
<a name="l54"></a> *iso_boot = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
|
|
<a name="l55"></a> *iso_sup = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
|
|
<a name="l56"></a> *iso_term = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
|
|
<a name="l57"></a> </span><span class=cF9>I64</span><span class=cF0> iso_size = </span><span class=cFE>0</span><span class=cF0>, i, j;
|
|
<a name="l58"></a> </span><span class=cF9>U32</span><span class=cF0> *d;
|
|
<a name="l59"></a> </span><span class=cF9>CElTorito</span><span class=cF0> *et = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
|
|
<a name="l60"></a> </span><span class=cF1>U8</span><span class=cF0> *zero_buf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
|
|
<a name="l61"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l62"></a>
|
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (out_file = </span><span class=cF5>FOpen</span><span class=cF7>(</span><span class=cF0>iso_filename, </span><span class=cF6>"wc+"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l64"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l65"></a> iso_size = </span><span class=cF5>FSize</span><span class=cF0>(out_file) / </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>;
|
|
<a name="l66"></a>
|
|
<a name="l67"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < drive->bd->drv_offset; i += </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l68"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, zero_buf, i, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l69"></a>
|
|
<a name="l70"></a> iso_pri->type = </span><span class=cF3>ISOT_PRI_VOL_DESC</span><span class=cF0>;
|
|
<a name="l71"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_pri->id, </span><span class=cF6>"CD001"</span><span class=cF0>);
|
|
<a name="l72"></a> iso_pri->version = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l73"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&iso_pri->vol_set_size, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l74"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&iso_pri->vol_seq_num, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l75"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&iso_pri->log_block_size, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
|
|
<a name="l76"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&iso_pri->vol_space_size, iso_size);
|
|
<a name="l77"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&iso_pri->root_dir_record, drive->root_clus);
|
|
<a name="l78"></a> iso_pri->file_structure_version = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_pri->publisher_id, </span><span class=cF6>"ZealOS RedSea"</span><span class=cF0>);
|
|
<a name="l80"></a>
|
|
<a name="l81"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(iso_sup, iso_pri, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
|
|
<a name="l82"></a> iso_sup->type = </span><span class=cF3>ISOT_SUPPLEMENTARY_DESC</span><span class=cF0>;
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> iso_boot->type = </span><span class=cF3>ISOT_BOOT_RECORD</span><span class=cF0>;
|
|
<a name="l85"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_boot->id, </span><span class=cF6>"CD001"</span><span class=cF0>);
|
|
<a name="l86"></a> iso_boot->version = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l87"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_boot</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>7</span><span class=cF0>, </span><span class=cF6>"EL TORITO SPECIFICATION"</span><span class=cF0>);
|
|
<a name="l88"></a>
|
|
<a name="l89"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_pri, </span><span class=cFE>16</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l90"></a> iso_term->type = </span><span class=cF3>ISOT_TERMINATOR</span><span class=cF0>;
|
|
<a name="l91"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_term->id, </span><span class=cF6>"CD001"</span><span class=cF0>);
|
|
<a name="l92"></a> iso_term->version = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l93"></a>
|
|
<a name="l94"></a> d = iso_boot(</span><span class=cF1>U8</span><span class=cF0> *) + </span><span class=cFE>0x47</span><span class=cF0>;
|
|
<a name="l95"></a> *d = </span><span class=cFE>20</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0> >> </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l96"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_boot, </span><span class=cFE>17</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l97"></a>
|
|
<a name="l98"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_sup, </span><span class=cFE>18</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l99"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_term, </span><span class=cFE>19</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l100"></a>
|
|
<a name="l101"></a> et->w[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l102"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(&et->w[</span><span class=cFE>2</span><span class=cF0>], </span><span class=cF6>"ZealOS"</span><span class=cF0>);
|
|
<a name="l103"></a> et->w[</span><span class=cFE>15</span><span class=cF0>] = </span><span class=cFE>0xAA55</span><span class=cF0>;
|
|
<a name="l104"></a>
|
|
<a name="l105"></a> j = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l106"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>16</span><span class=cF0>; i++) </span><span class=cF2>//Checksum</span><span class=cF0>
|
|
<a name="l107"></a> j += et->w[i];
|
|
<a name="l108"></a>
|
|
<a name="l109"></a> et->w[</span><span class=cFE>14</span><span class=cF0>] = -j;
|
|
<a name="l110"></a> et->bootable = </span><span class=cFE>0x88</span><span class=cF0>;
|
|
<a name="l111"></a> et->media_type = </span><span class=cFE>0</span><span class=cF0>;</span><span class=cF2>//0=no emu 2=1.44meg 4=hard drive</span><span class=cF0>
|
|
<a name="l112"></a> et->sect_count = </span><span class=cFE>4</span><span class=cF0>; </span><span class=cF2>//5 seems like the limit, 4 is safer</span><span class=cF0>
|
|
<a name="l113"></a> et->load_rba = </span><span class=cFE>20</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0> >> </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l114"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, et, </span><span class=cFE>20</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l115"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
|
|
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l117"></a> </span><span class=cF5>Free</span><span class=cF0>(zero_buf);
|
|
<a name="l118"></a> </span><span class=cF5>Free</span><span class=cF0>(et);
|
|
<a name="l119"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_pri);
|
|
<a name="l120"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_boot);
|
|
<a name="l121"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_sup);
|
|
<a name="l122"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_term);
|
|
<a name="l123"></a>}
|
|
<a name="l124"></a>
|
|
<a name="l125"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
|
|
<a name="l126"></a>{
|
|
<a name="l127"></a> </span><span class=cF9>I64</span><span class=cF0> dir_entry_count = </span><span class=cFE>3</span><span class=cF0> + </span><span class=cF5>LinkedListCount</span><span class=cF0>(tmpde), res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l128"></a>
|
|
<a name="l129"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
|
|
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
|
|
<a name="l132"></a> {
|
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde->sub)
|
|
<a name="l134"></a> res += </span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(tmpde->sub);
|
|
<a name="l135"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l136"></a> res += </span><span class=cF3>BLK_SIZE</span><span class=cF0>; </span><span class=cF2>//Empty dir</span><span class=cF0>
|
|
<a name="l137"></a> }
|
|
<a name="l138"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l139"></a> res += </span><span class=cF5>CeilU64</span><span class=cF0>(tmpde->size, </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
|
<a name="l140"></a>
|
|
<a name="l141"></a> tmpde = tmpde->next;
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a> res += </span><span class=cF5>CeilU64</span><span class=cF0>(dir_entry_count << </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0>); </span><span class=cF2>//Size in bytes</span><span class=cF0>
|
|
<a name="l144"></a>
|
|
<a name="l145"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF3>CDIR_SIZE</span><span class=cF0> == </span><span class=cFE>64</span><span class=cF0>
|
|
<a name="l146"></a>
|
|
<a name="l147"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l148"></a>}
|
|
<a name="l149"></a>
|
|
<a name="l150"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISO</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_iso_filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *_src_dir, </span><span class=cF1>U8</span><span class=cF0> *_stage2_filename=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l151"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Misc/DoDistro.CC.html#l1"><span class=cF4>::/Misc/DoDistro.CC</span></a><span class=cF2>. Must be ISO.C</span><span class=cF0>
|
|
<a name="l152"></a> </span><span class=cF9>I64</span><span class=cF0> i, res, root_count, root_dir_blks, bitmap_blks, bitmap_blks1;
|
|
<a name="l153"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde;
|
|
<a name="l154"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>], *iso_filename, *src_dir, *stage2_filename;
|
|
<a name="l155"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive = </span><span class=cF5>DriveMakeFreeSlot</span><span class=cF0>(</span><span class=cF5>DriveNextFreeLet</span><span class=cF7>(</span><span class=cF6>'Q'</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//First </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3268"><span class=cF4>BDT_ISO_FILE_WRITE</span></a><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd = </span><span class=cF5>BlkDevNextFreeSlot</span><span class=cF0>(drive->drv_let, </span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>);
|
|
<a name="l157"></a>
|
|
<a name="l158"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsDir</span><span class=cF7>(</span><span class=cF0>_src_dir</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l159"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"'%s' is not a dir.\n"</span><span class=cF0>, _src_dir);
|
|
<a name="l160"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (!_iso_filename)
|
|
<a name="l163"></a> _iso_filename = </span><span class=cFB>blkdev</span><span class=cF0>.default_iso_c_filename;
|
|
<a name="l164"></a>
|
|
<a name="l165"></a> iso_filename = </span><span class=cF5>ExtChange</span><span class=cF0>(_iso_filename, </span><span class=cF6>"ISO.C"</span><span class=cF0>);
|
|
<a name="l166"></a> src_dir = </span><span class=cF5>DirNameAbs</span><span class=cF0>(_src_dir);
|
|
<a name="l167"></a>
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (_stage2_filename)
|
|
<a name="l169"></a> {
|
|
<a name="l170"></a> stage2_filename = </span><span class=cF5>FileNameAbs</span><span class=cF0>(_stage2_filename);
|
|
<a name="l171"></a> *stage2_filename = drive->drv_let;
|
|
<a name="l172"></a>
|
|
<a name="l173"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(src_dir);
|
|
<a name="l174"></a> </span><span class=cF1>if</span><span class=cF0> (i != </span><span class=cFE>3</span><span class=cF0>) </span><span class=cF2>//If not root</span><span class=cF0>
|
|
<a name="l175"></a> i++; </span><span class=cF2>//Skip slash</span><span class=cF0>
|
|
<a name="l176"></a>
|
|
<a name="l177"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(stage2_filename + </span><span class=cFE>3</span><span class=cF0>, stage2_filename + i);
|
|
<a name="l178"></a> }
|
|
<a name="l179"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l180"></a> stage2_filename = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l181"></a>
|
|
<a name="l182"></a> tmpde = </span><span class=cF5>FilesFind</span><span class=cF0>(src_dir, </span><span class=cF3>FUF_RECURSE</span><span class=cF0>);
|
|
<a name="l183"></a> root_count = </span><span class=cF5>LinkedListCount</span><span class=cF0>(tmpde) + </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l184"></a> root_dir_blks = </span><span class=cF5>CeilU64</span><span class=cF0>(root_count << </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0>) >> </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
|
<a name="l185"></a>
|
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (res = </span><span class=cF5>RedSeaISOPass1</span><span class=cF7>(</span><span class=cF0>tmpde</span><span class=cF7>)</span><span class=cF0> >> </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>)
|
|
<a name="l187"></a> {
|
|
<a name="l188"></a> bd->drv_offset = </span><span class=cFE>19</span><span class=cF0> << </span><span class=cFE>2</span><span class=cF0> + (</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>) / </span><span class=cF3>BLK_SIZE</span><span class=cF0>;
|
|
<a name="l189"></a> bitmap_blks = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l190"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l191"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l192"></a> bitmap_blks1 = bitmap_blks;
|
|
<a name="l193"></a> bitmap_blks = (res + bitmap_blks + </span><span class=cF3>BLK_SIZE</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) / </span><span class=cF3>BLK_SIZE</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l194"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l195"></a> </span><span class=cF1>while</span><span class=cF0> (bitmap_blks != bitmap_blks1);
|
|
<a name="l196"></a>
|
|
<a name="l197"></a> bd->max_blk = </span><span class=cF5>CeilI64</span><span class=cF0>(bd->drv_offset + </span><span class=cFE>1</span><span class=cF0> + bitmap_blks + res, </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l198"></a> bd->max_blk--; </span><span class=cF2>//Inclusive.</span><span class=cF0>
|
|
<a name="l199"></a> bd->file_disk_name = </span><span class=cF5>SysStrNew</span><span class=cF0>(iso_filename);
|
|
<a name="l200"></a> bd->init_root_dir_blks = root_dir_blks;
|
|
<a name="l201"></a> </span><span class=cF5>BlkDevAdd</span><span class=cF0>(bd,, </span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l202"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>"%C:/"</span><span class=cF0>, drive->drv_let);
|
|
<a name="l203"></a> </span><span class=cF5>CopyTree</span><span class=cF0>(src_dir, buf, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l204"></a> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(iso_filename, stage2_filename);
|
|
<a name="l205"></a> </span><span class=cF5>DriveDel</span><span class=cF0>(drive);
|
|
<a name="l206"></a> </span><span class=cF5>BlkDevDel</span><span class=cF0>(bd);
|
|
<a name="l207"></a> }
|
|
<a name="l208"></a> </span><span class=cF5>Free</span><span class=cF0>(stage2_filename);
|
|
<a name="l209"></a> </span><span class=cF5>Free</span><span class=cF0>(src_dir);
|
|
<a name="l210"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_filename);
|
|
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l212"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l213"></a>}
|
|
</span></pre></body>
|
|
</html>
|