mirror of https://github.com/minexew/Shrine.git
47 changed files with 92 additions and 12851 deletions
Binary file not shown.
@ -1,444 +0,0 @@
|
||||
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)" |
||||
Bool ChkDskConfirm(Bool *_fix,Bool *_confirm) |
||||
{ |
||||
if (*_fix && *_confirm) { |
||||
"Fix "; |
||||
if (!YorN) |
||||
*_fix=FALSE; |
||||
*_confirm=FALSE; |
||||
} |
||||
return *_fix; |
||||
} |
||||
|
||||
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tmpde1, |
||||
U8 *bits,U8 *bits2,I64 size,I64 bpc) |
||||
{ |
||||
CDirEntry *tmpde2; |
||||
I64 i,j,errs=0; |
||||
while (tmpde1) { |
||||
tmpde2=tmpde1->next; |
||||
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub) |
||||
errs+=RedSeaChkDskLst(dv,tmpde1->sub,bits,bits2,size,bpc); |
||||
j=(tmpde1->size+bpc-1)/bpc; |
||||
for (i=0;i<j;i++) { |
||||
if (i+tmpde1->cluster-dv->data_area>size) { |
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tmpde1->full_name, |
||||
i+tmpde1->cluster); |
||||
errs++; |
||||
break; |
||||
} |
||||
if (LBts(bits,i+tmpde1->cluster-dv->data_area)) { |
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tmpde1->full_name, |
||||
i+tmpde1->cluster); |
||||
errs++; |
||||
} |
||||
if (!LBtr(bits2,i+tmpde1->cluster-dv->data_area)) { |
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tmpde1->full_name, |
||||
i+tmpde1->cluster); |
||||
errs++; |
||||
} |
||||
} |
||||
DirEntryDel(tmpde1); |
||||
tmpde1=tmpde2; |
||||
} |
||||
return errs; |
||||
} |
||||
|
||||
I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm) |
||||
{ |
||||
I64 i,j,bpc,size,errs=0; |
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv; |
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)), |
||||
*old_dir=StrNew(Fs->cur_dir), |
||||
*bits,*bits2; |
||||
CDirEntry *ptr,*ptr2; |
||||
|
||||
Drv(drv_let); |
||||
"Scanning...\n"; |
||||
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc; |
||||
bpc=dv->spc<<BLK_SIZE_BITS; |
||||
bits=CAlloc((size+7)>>3); |
||||
bits2=CAlloc((size+7)>>3+BLK_SIZE); |
||||
RBlks(dv,bits2,dv->fat1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS); |
||||
|
||||
//Get Root Dir size |
||||
ptr2=MAlloc(bpc); |
||||
RBlks(dv,ptr2,dv->root_cluster,1); |
||||
ptr=ptr2(U8 *)-offset(CDirEntry.start); |
||||
j=(ptr->size+bpc-1)/bpc; |
||||
Free(ptr2); |
||||
|
||||
for (i=0;i<j;i++) { |
||||
if (i+dv->root_cluster-dv->data_area>size) { |
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",i+dv->root_cluster); |
||||
errs++; |
||||
break; |
||||
} |
||||
if (LBts(bits,i+dv->root_cluster-dv->data_area)) { |
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",i+dv->root_cluster); |
||||
errs++; |
||||
} |
||||
if (!LBtr(bits2,i+dv->root_cluster-dv->data_area)) { |
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",i+dv->root_cluster); |
||||
errs++; |
||||
} |
||||
} |
||||
|
||||
errs+=RedSeaChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE), |
||||
bits,bits2,size,bpc); |
||||
for (i=1;i<size;i++) |
||||
if (Bt(bits2,i)) { |
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i+dv->data_area); |
||||
errs++; |
||||
if (ChkDskConfirm(_fix,_confirm)) |
||||
RedSeaFreeClusters(dv,i+dv->data_area,1); |
||||
} |
||||
|
||||
Free(files_find_mask); |
||||
Free(bits); |
||||
Free(bits2); |
||||
Drv(Drv2Let(old_dv)); |
||||
Cd(old_dir); |
||||
Free(old_dir); |
||||
return errs; |
||||
} |
||||
|
||||
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tmpde1, |
||||
U8 *bits,U32 *bits2,I64 size,I64 bpc) |
||||
{ |
||||
CDirEntry *tmpde2; |
||||
I64 i,c,errs=0; |
||||
while (tmpde1) { |
||||
tmpde2=tmpde1->next; |
||||
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub) |
||||
errs+=FAT32ChkDskLst(dv,tmpde1->sub,bits,bits2,size,bpc); |
||||
i=0; |
||||
c=tmpde1->cluster; |
||||
while (0<c<0x0FFFFFF8) { |
||||
if (c>size) { |
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tmpde1->full_name,c); |
||||
errs++; |
||||
break; |
||||
} |
||||
if (LBts(bits,c)) { |
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tmpde1->full_name,c); |
||||
errs++; |
||||
} |
||||
if (!bits2[c]) { |
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tmpde1->full_name,c); |
||||
errs++; |
||||
} else |
||||
bits2[c]=0; |
||||
c=ClusterNumNext(dv,c); |
||||
i++; |
||||
} |
||||
if (!(tmpde1->attr & RS_ATTR_DIR)) { |
||||
i*=bpc; |
||||
if (tmpde1->size>i) { |
||||
PrintErr("Alloced File Too Short:%s\n",tmpde1->full_name); |
||||
errs++; |
||||
} |
||||
if (i>tmpde1->size+bpc-1) { |
||||
PrintWarn("Alloced File Too Long:%s\n",tmpde1->full_name); |
||||
errs++; |
||||
} |
||||
} |
||||
DirEntryDel(tmpde1); |
||||
tmpde1=tmpde2; |
||||
} |
||||
return errs; |
||||
} |
||||
|
||||
I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm) |
||||
{ |
||||
I64 i,bpc,size,c,errs=0; |
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv; |
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)), |
||||
*old_dir=StrNew(Fs->cur_dir), |
||||
*bits; |
||||
U32 *bits2; |
||||
Drv(drv_let); |
||||
"Scanning...\n"; |
||||
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc; |
||||
bpc=dv->spc<<BLK_SIZE_BITS; |
||||
bits=CAlloc((size+7)>>3); |
||||
bits2=CAlloc(size*4+BLK_SIZE); |
||||
RBlks(dv,bits2,dv->fat1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS); |
||||
|
||||
c=dv->root_cluster; |
||||
while (0<c<0x0FFFFFF8) { |
||||
if (c>size) { |
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",c); |
||||
errs++; |
||||
break; |
||||
} |
||||
if (LBts(bits,c)) { |
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",c); |
||||
errs++; |
||||
} |
||||
if (!bits2[c]) { |
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",c); |
||||
errs++; |
||||
} else |
||||
bits2[c]=0; |
||||
c=ClusterNumNext(dv,c); |
||||
} |
||||
|
||||
errs+=FAT32ChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE), |
||||
bits,bits2,size,bpc); |
||||
|
||||
bits2[1]=0; //See $LK,"FAT32Fmt",A="MN:FAT32Fmt"$() |
||||
for (i=1;i<size;i++) |
||||
if (bits2[i]) { |
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i); |
||||
errs++; |
||||
if (ChkDskConfirm(_fix,_confirm)) |
||||
FAT32FreeClusters(dv,i); |
||||
} |
||||
Free(files_find_mask); |
||||
Free(bits); |
||||
Free(bits2); |
||||
Drv(Drv2Let(old_dv)); |
||||
Cd(old_dir); |
||||
Free(old_dir); |
||||
return errs; |
||||
} |
||||
|
||||
public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE) |
||||
{//Check disk for allocation errors and, optionally, fix. |
||||
//You probably want to reformat and reinstall. |
||||
I64 errs=0; |
||||
CDrv *dv=Let2Drv(drv_let); |
||||
switch (dv->fs_type) { |
||||
case FSt_REDSEA: |
||||
errs=RedSeaChkDsk(drv_let,&fix,&confirm); |
||||
break; |
||||
case FSt_FAT32: |
||||
errs=FAT32ChkDsk(drv_let,&fix,&confirm); |
||||
break; |
||||
default: |
||||
PrintErr("File System Not Supported\n"); |
||||
} |
||||
if (errs) { |
||||
if (fix) |
||||
"It might be a little better. "; |
||||
"Copy files to another partition or CD/DVD, " |
||||
"reformat, and copy back. " |
||||
"Or, copy from a back-up.\n"; |
||||
} |
||||
return errs; |
||||
} |
||||
|
||||
U0 RedSeaDrvView(U8 drv_let=0) |
||||
{ |
||||
CDrv *dv=Let2Drv(drv_let); |
||||
I64 lohi,c1,i,x,y,l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1), |
||||
s=dv->size+dv->drv_offset-dv->data_area; |
||||
U8 *bitmap; |
||||
CDC *dc=DCAlias; |
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ |
||||
WinMax; |
||||
WinBorder(ON); |
||||
DocCursor; |
||||
DocClear; |
||||
DCFill; |
||||
try { |
||||
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS); |
||||
RBlks(dv,bitmap,dv->fat1,i); |
||||
i=0; |
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) { |
||||
if (ScanKey) |
||||
break; |
||||
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) { |
||||
lohi=i*s; |
||||
c1=lohi/l; |
||||
if (Bt(bitmap,c1)) |
||||
dc->color=ROP_XOR+BLUE^TRANSPARENT; |
||||
else |
||||
dc->color=ROP_XOR+WHITE^TRANSPARENT; |
||||
GrPlot(dc,x,y); |
||||
i++; |
||||
} |
||||
} |
||||
Free(bitmap); |
||||
} catch |
||||
DrvUnlock(dv); |
||||
GetChar; |
||||
|
||||
SettingsPop; |
||||
DCFill; |
||||
DCDel(dc); |
||||
} |
||||
U0 FAT32DrvView(U8 drv_let=0) |
||||
{ |
||||
CDrv *dv=Let2Drv(drv_let); |
||||
I64 lohi,c1,i,x,y,l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1), |
||||
s=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset); |
||||
U32 *bitmap; |
||||
CDC *dc=DCAlias; |
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ |
||||
WinMax; |
||||
WinBorder(ON); |
||||
DocCursor; |
||||
DocClear; |
||||
DCFill; |
||||
try { |
||||
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS); |
||||
RBlks(dv,bitmap,dv->fat1,i); |
||||
i=0; |
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) { |
||||
if (ScanKey) |
||||
break; |
||||
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) { |
||||
lohi=i*s; |
||||
c1=lohi/l; |
||||
if (bitmap[c1]) |
||||
dc->color=ROP_XOR+BLUE^TRANSPARENT; |
||||
else |
||||
dc->color=ROP_XOR+WHITE^TRANSPARENT; |
||||
GrPlot(dc,x,y); |
||||
i++; |
||||
} |
||||
} |
||||
Free(bitmap); |
||||
} catch |
||||
DrvUnlock(dv); |
||||
GetChar; |
||||
|
||||
SettingsPop; |
||||
DCFill; |
||||
DCDel(dc); |
||||
} |
||||
public U0 DrvView(U8 drv_let=0) |
||||
{//Drive view. Graph the allocation map's fragmentation. |
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv; |
||||
Drv(drv_let); |
||||
switch (dv->fs_type) { |
||||
case FSt_REDSEA: |
||||
RedSeaDrvView(drv_let); |
||||
break; |
||||
case FSt_FAT32: |
||||
FAT32DrvView(drv_let); |
||||
break; |
||||
default: |
||||
PrintErr("File System Not Supported\n"); |
||||
} |
||||
Drv(Drv2Let(old_dv)); |
||||
} |
||||
|
||||
public U0 DskView(U8 drv_let=0) |
||||
{//Disk view. Pie chart of partition sizes. |
||||
I64 i,j,attr, |
||||
h=Fs->pix_width, |
||||
v=Fs->pix_height, |
||||
radius; |
||||
CDrv *dv; |
||||
CBlkDev *bd=Let2BlkDev(drv_let); |
||||
CDC *dc=DCAlias; |
||||
F64 sect_start,sect_end; |
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ |
||||
DocCursor; |
||||
DocClear; |
||||
DCFill; |
||||
if (h<v) |
||||
radius=0.4*h; |
||||
else |
||||
radius=0.4*v; |
||||
dc->color=BLACK; |
||||
GrCircle(dc,h>>1,v>>1,radius); |
||||
|
||||
j=1; |
||||
for (i=0;i<DRVS_NUM;i++) { |
||||
dv=&blkdev.drvs[i]; |
||||
if (bd==dv->bd && dv->fs_type) { |
||||
sect_start=-(dv->drv_offset*2*รฃ/(bd->max_blk+1)); |
||||
sect_end =-((dv->drv_offset+dv->size)*2*รฃ/(bd->max_blk+1)); |
||||
dc->color=BLACK; |
||||
GrLine(dc,h>>1,v>>1, |
||||
h>>1+radius*Cos(sect_start), |
||||
v>>1+radius*Sin(sect_start)); |
||||
GrLine(dc,h>>1,v>>1, |
||||
h>>1+radius*Cos(sect_end), |
||||
v>>1+radius*Sin(sect_end)); |
||||
|
||||
attr=DrvTextAttrGet(Drv2Let(dv)); |
||||
dc->color=attr&15; |
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drv2Let(dv), |
||||
dv->fs_type,"ST_DRV_TYPES"); |
||||
dc->color.c1=attr>>4; |
||||
dc->color|=ROPF_DITHER; |
||||
GrFloodFill(dc, |
||||
h>>1+(radius-4)*Cos((sect_start+sect_end)/2), |
||||
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE); |
||||
j++; |
||||
} |
||||
} |
||||
|
||||
GetChar(,FALSE); |
||||
SettingsPop; |
||||
DCFill; |
||||
DCDel(dc); |
||||
} |
||||
|
||||
I64 RedSeaUnusedDrvSpace(U8 drv_let=0) |
||||
{ |
||||
CDrv *dv=Let2Drv(drv_let); |
||||
I64 res=0,i,l; |
||||
U8 *bitmap; |
||||
try { |
||||
l=dv->size+dv->drv_offset-dv->data_area; |
||||
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS); |
||||
RBlks(dv,bitmap,dv->fat1,i); |
||||
for (i=0;i<l;i++) |
||||
if (!Bt(bitmap,i)) |
||||
res++; |
||||
Free(bitmap); |
||||
} catch |
||||
DrvUnlock(dv); |
||||
return res*BLK_SIZE*dv->spc; |
||||
} |
||||
I64 FAT32UnusedDrvSpace(U8 drv_let=0) |
||||
{ |
||||
CDrv *dv=Let2Drv(drv_let); |
||||
I64 res=0,i,l; |
||||
U32 *bitmap; |
||||
try { |
||||
l=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset); |
||||
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS); |
||||
RBlks(dv,bitmap,dv->fat1,i); |
||||
for (i=0;i<l;i++) |
||||
if (!bitmap[i]) |
||||
res++; |
||||
Free(bitmap); |
||||
} catch |
||||
DrvUnlock(dv); |
||||
return res*BLK_SIZE*dv->spc; |
||||
} |
||||
public I64 UnusedDrvSpace(U8 drv_let=0) |
||||
{//Returns unused size in bytes. |
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv; |
||||
U8 *old_dir=StrNew(Fs->cur_dir); |
||||
I64 res=0; |
||||
Drv(drv_let); |
||||
switch (dv->fs_type) { |
||||
case FSt_REDSEA: |
||||
res=RedSeaUnusedDrvSpace(drv_let); |
||||
break; |
||||
case FSt_FAT32: |
||||
res=FAT32UnusedDrvSpace(drv_let); |
||||
break; |
||||
default: |
||||
PrintErr("File System Not Supported\n"); |
||||
} |
||||
Drv(Drv2Let(old_dv)); |
||||
Cd(old_dir); |
||||
Free(old_dir); |
||||
return res; |
||||
} |
@ -1,167 +0,0 @@
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)" |
||||
|
||||
#define ROUND_DRV_TO (63*255) |
||||
#define DRV_HEADER 63 |
||||
|
||||
class CPlannedDrv |
||||
{ |
||||
CPlannedDrv *next,*last; |
||||
I64 size; |
||||
Bool pri; |
||||
}; |
||||
|
||||
public I64 PrtDsk(U8 drv_let=0,...) |
||||
{/*Partition the disk containing partition drv_let. |
||||
|
||||
drv_let=0 means add new drive that is not already mounted. |
||||
|
||||
>PrtDsk('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk. |
||||
|
||||
*/ |
||||
CBlkDev *bd; |
||||
CPlannedDrv head,*tmppp; |
||||
CMasterBoot mbr; |
||||
Bool pri=TRUE; |
||||
I64 ext_base,drv_let2,pri_cnt=0,i,start_offset,offset, |
||||
total,remaining,cur_arg=0; |
||||
"This command does not play well\n" |
||||
"with other operating systems.\n" |
||||
"You really should use another\n" |
||||
"operating system's partitioner.\n" |
||||
"If you use this, it may, in fact,\n" |
||||
"make your hard drive impossible\n" |
||||
"to repartition with other operating\n" |
||||
"until you set block zero to zero\n" |
||||
"with $$LK,\"BootMHDZero\",\"MN:BootMHDZero\"$$()\n\n\n" |
||||
"Continue"; |
||||
if (argc<=cur_arg && !YorN) |
||||
return 0; |
||||
'\n'; |
||||
|
||||
if (drv_let && !Let2BlkDev(drv_let,FALSE)) |
||||
drv_let=0; |
||||
if (!drv_let && !(drv_let=Mount(TRUE)) || |
||||
!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA) |
||||
return 0; |
||||
|
||||
total=bd->max_blk+1; |
||||
QueInit(&head); |
||||
drv_let2=bd->first_drv_let; |
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO); |
||||
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) { |
||||
tmppp=MAlloc(sizeof(CPlannedDrv)); |
||||
do { |
||||
"$$RED$$Partition %C$$FG$$\n",drv_let2; |
||||
tmppp->pri=FALSE; |
||||
if (pri) { |
||||
"Primary Partition"; |
||||
if (argc>cur_arg || YorN) { |
||||
pri_cnt++; |
||||
tmppp->pri=TRUE; |
||||
if (pri_cnt==3) |
||||
pri=FALSE; |
||||
} else |
||||
pri=FALSE; |
||||
} |
||||
"\nBlocks Remaining:%d (0x%X)\n", |
||||
remaining-DRV_HEADER,remaining-DRV_HEADER; |
||||
if (argc>cur_arg) |
||||
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO), |
||||
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO)); |
||||
else |
||||
tmppp->size=CeilU64(GetI64("Size in Blocks :", |
||||
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO); |
||||
} while (!(ROUND_DRV_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRV_TO))); |
||||
QueIns(tmppp,head.last); |
||||
remaining-=tmppp->size; |
||||
drv_let2++; |
||||
} |
||||
|
||||
"\n\n!!! Repartition Drive !!!\n\n"; |
||||
tmppp=head.next; |
||||
drv_let2=bd->first_drv_let; |
||||
while (tmppp!=&head) { |
||||
"Drive %C:%08X ",drv_let2,tmppp->size; |
||||
if (tmppp->pri) |
||||
"Primary\n"; |
||||
else |
||||
"Logical\n"; |
||||
tmppp=tmppp->next; |
||||
drv_let2++; |
||||
} |
||||
if (!argc && !AreYouSure) |
||||
goto pd_done; |
||||
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO; |
||||
tmppp=head.next; |
||||
MemSet(&mbr,0,BLK_SIZE); |
||||
mbr.signature=0xAA55; |
||||
offset=0; |
||||
for (i=0;i<pri_cnt;i++) { |
||||
mbr.p[i].active=0x80; |
||||
mbr.p[i].start_head=0; |
||||
mbr.p[i].start_cyl=0x101; |
||||
mbr.p[i].type=1; //Will get set different. |
||||
mbr.p[i].end_head=0xFE; |
||||
mbr.p[i].end_cyl=0xFFFF; |
||||
mbr.p[i].offset=DRV_HEADER+offset; |
||||
mbr.p[i].size=tmppp->size-DRV_HEADER; |
||||
offset+=tmppp->size; |
||||
remaining-=tmppp->size; |
||||
tmppp=tmppp->next; |
||||
} |
||||
if (!i) i++; |
||||
if (tmppp!=&head) { |
||||
mbr.p[i].active=0x80; |
||||
mbr.p[i].start_head=0; |
||||
mbr.p[i].start_cyl=0x101; |
||||
mbr.p[i].type=0xF; |
||||
mbr.p[i].end_head=0xFE; |
||||
mbr.p[i].end_cyl=0xFFFF; |
||||
mbr.p[i].offset=offset; |
||||
mbr.p[i].size=remaining; |
||||
ext_base=offset; |
||||
} |
||||
ATAWriteBlks(bd,&mbr,0,1); |
||||
|
||||
while (tmppp!=&head) { |
||||
start_offset=offset; |
||||
MemSet(&mbr,0,BLK_SIZE); |
||||
mbr.signature=0xAA55; |
||||
|
||||
mbr.p[0].active=0x80; |
||||
mbr.p[0].start_head=1; |
||||
mbr.p[0].start_cyl=0x101; |
||||
mbr.p[0].type=1; //Will get set different. |
||||
mbr.p[0].end_head=0xFE; |
||||
mbr.p[0].end_cyl=0xFFFF; |
||||
mbr.p[0].offset=DRV_HEADER; |
||||
mbr.p[0].size=tmppp->size-DRV_HEADER; |
||||
offset+=tmppp->size; |
||||
tmppp=tmppp->next; |
||||
if (tmppp!=&head) { |
||||
mbr.p[1].active=0x80; |
||||
mbr.p[1].start_head=0; |
||||
mbr.p[1].start_cyl=0x101; |
||||
mbr.p[1].type=5; |
||||
mbr.p[1].end_head=0xFE; |
||||
mbr.p[1].end_cyl=0xFFFF; |
||||
mbr.p[1].offset=offset-ext_base; |
||||
mbr.p[1].size=tmppp->size; |
||||
} |
||||
ATAWriteBlks(bd,&mbr,start_offset,1); |
||||
} |
||||
|
||||
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS); |
||||
BlkDevAdd(bd,,FALSE,TRUE); |
||||
for (i=bd->first_drv_let;i<drv_let2;i++) |
||||
Fmt(i,,FALSE); |
||||
|
||||
pd_done: |
||||
while (head.next!=&head) { |
||||
tmppp=head.next; |
||||
QueRem(tmppp); |
||||
Free(tmppp); |
||||
} |
||||
return total; |
||||
} |
@ -1,58 +0,0 @@
|
||||
#help_index "Graphics/Device Contexts;Graphics/GR Files" |
||||
|
||||
#define MV_FILE_MAX 0x007FF000 |
||||
|
||||
public I64 GR2MV(U8 *print_fmt="VID%03d.MV", |
||||
U8 *files_find_mask,U8 *fu_flags=NULL) |
||||
{/*Merge GR lst to MV file. |
||||
"+d" will delete GR list files. |
||||
*/ |
||||
I64 fuf_flags=0,file_num=0,size; |
||||
CDirEntry *tmpde,*tmpde1; |
||||
U8 *base,*dst,*src,*st; |
||||
CDC *dc,*dc_base=DCNew(GR_WIDTH,GR_HEIGHT); |
||||
CDate cdt; |
||||
Bool old_silent; |
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F"); |
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); |
||||
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND); |
||||
if (progress1_max=LinkedLstCnt(tmpde1)) { |
||||
dst=base=MAlloc(MV_FILE_MAX); |
||||
while (tmpde) { |
||||
dc=GRRead(tmpde->full_name); |
||||
GrBlot(dc_base,dc->x0,dc->y0,dc); |
||||
if (dst+GR_FILE_MAX>base+MV_FILE_MAX) { |
||||
st=MStrPrint(print_fmt,file_num++); |
||||
FileWrite(st,base,dst-base); |
||||
Free(st); |
||||
dst=base; |
||||
|
||||
cdt=dc->cdt; |
||||
dc=DCCopy(dc_base); |
||||
dc->cdt=cdt; |
||||
} |
||||
src=DCSave(dc,&size); |
||||
DCDel(dc); |
||||
MemCpy(dst,src,size); |
||||
dst+=size; |
||||
Free(src); |
||||
if (fuf_flags&FUF_DEL) { |
||||
old_silent=Silent; |
||||
Del(tmpde->full_name); |
||||
Silent(old_silent); |
||||
} |
||||
progress1++; |
||||
tmpde=tmpde->next; |
||||
} |
||||
if (dst>base) { |
||||
st=MStrPrint(print_fmt,file_num++); |
||||
FileWrite(st,base,dst-base); |
||||
Free(st); |
||||
} |
||||
Free(base); |
||||
} |
||||
progress1=progress1_max=0; |
||||
DirTreeDel(tmpde1); |
||||
DCDel(dc_base); |
||||
return file_num; |
||||
} |
@ -1,506 +0,0 @@
|
||||
#help_index "File/CD DVD" |
||||
|
||||
class CCDVDUserData //Create DVD |
||||
{ |
||||
I64 loc,path_entry_num, |
||||
short_dir_blks,long_dir_blks; |
||||
}; |
||||
|
||||
I64 DVDFileCreate2(CFile *out_file,CDirEntry *tmpde,CISO1DirEntry *tmpi, |
||||
CISO1DirEntry *tmpi2,I64 *_cur_blk,CDirEntry *parent,Bool write, |
||||
U8 *stage2_filename,I64 *_stage2_blk) |
||||
{ |
||||
CCDVDUserData *tmpc; |
||||
CDirEntry *tmpde1,*tmpde2; |
||||
CFile *in_file; |
||||
U8 *buf=MAlloc(DVD_BLK_SIZE),*ptr1,*ptr2; |
||||
CISO1DirEntry *dir_blk_buf =CAlloc(DVD_BLK_SIZE*128), |
||||
*de =dir_blk_buf, *de1, |
||||
*dir_blk_buf2=CAlloc(DVD_BLK_SIZE*128), |
||||
*de2=dir_blk_buf2,*de12; |
||||
I64 i,n; |
||||
|
||||
tmpc=parent->user_data; |
||||
|
||||
de->len=sizeof(CISO1DirEntry)-1; |
||||
de->ext_attr_len=0; |
||||
FillU16Palindrome(&de->vol_seq_num,1); |
||||
Date2ISO1(&de->date,tmpde->datetime); |
||||
de->flags=ISO1_ATTR_DIR; |
||||
de->name_len=1; |
||||
de->name=0; |
||||
de->len+=de->name_len; |
||||
de(U8 *)+=de->len; |
||||
|
||||
de->len=sizeof(CISO1DirEntry)-1; |
||||
de->ext_attr_len=0; |
||||
FillU32Palindrome(&de->loc,tmpc->loc); |
||||
FillU32Palindrome(&de->size,tmpc->short_dir_blks*DVD_BLK_SIZE); |
||||
FillU16Palindrome(&de->vol_seq_num,1); |
||||
Date2ISO1(&de->date,parent->datetime); |
||||
de->flags=ISO1_ATTR_DIR; |
||||
de->name_len=1; |
||||
de->name=1; |
||||
de->len+=de->name_len; |
||||
de(U8 *)+=de->len; |
||||
|
||||
de2->len=sizeof(CISO1DirEntry)-1; |
||||
de2->ext_attr_len=0; |
||||
FillU16Palindrome(&de2->vol_seq_num,1); |
||||
Date2ISO1(&de2->date,tmpde->datetime); |
||||
de2->flags=ISO1_ATTR_DIR; |
||||
de2->name_len=1; |
||||
de2->name=0; |
||||
de2->len+=de2->name_len; |
||||
de2(U8 *)+=de2->len; |
||||
|
||||
de2->len=sizeof(CISO1DirEntry)-1; |
||||
de2->ext_attr_len=0; |
||||
FillU32Palindrome(&de2->loc,tmpc->loc+tmpc->short_dir_blks); |
||||
FillU32Palindrome(&de2->size,tmpc->long_dir_blks*DVD_BLK_SIZE); |
||||
FillU16Palindrome(&de2->vol_seq_num,1); |
||||
Date2ISO1(&de2->date,parent->datetime); |
||||
de2->flags=ISO1_ATTR_DIR; |
||||
de2->name_len=1; |
||||
de2->name=1; |
||||
de2->len+=de2->name_len; |
||||
de2(U8 *)+=de2->len; |
||||
|
||||
tmpde1=tmpde->sub; |
||||
while (tmpde1) { |
||||
tmpde2=tmpde1->next; |
||||
if (!write) tmpde1->user_data=CAlloc(sizeof(CCDVDUserData)); |
||||
de1=de; |
||||
de12=de2; |
||||
if (tmpde1->attr & RS_ATTR_DIR) { |
||||
n=DVDFileCreate2(out_file,tmpde1,de,de2,_cur_blk, |
||||
tmpde,write,stage2_filename,_stage2_blk); |
||||
de(U8 *)+=sizeof(CISO1DirEntry)-1+n; |
||||
de2(U8 *)+=sizeof(CISO1DirEntry)-1+n<<1; |
||||
} else { |
||||
tmpc=tmpde1->user_data; |
||||
de->len=sizeof(CISO1DirEntry)-1; |
||||
de->ext_attr_len=0; |
||||
FillU32Palindrome(&de->loc,*_cur_blk); |
||||
tmpc->loc=*_cur_blk; |
||||
if (write) { |
||||
if (stage2_filename && !StrCmp(tmpde1->full_name,stage2_filename)) { |
||||
"$$RED$$!!! Boot Stage 2 !!!$$FG$$\n"; |
||||
if (_stage2_blk) *_stage2_blk=*_cur_blk; |
||||
} |
||||
"%X:%s\n",*_cur_blk,tmpde1->full_name; |
||||
} |
||||
FillU32Palindrome(&de->size,tmpde1->size); |
||||
FillU16Palindrome(&de->vol_seq_num,1); |
||||
Date2ISO1(&de->date,tmpde1->datetime); |
||||
de->flags=0; |
||||
de->name_len=StrLen(tmpde1->name); |
||||
StrCpy(&de->name,tmpde1->name); |
||||
de->len=de->len+de->name_len; |
||||
de(U8 *)+=de->len; |
||||
|
||||
de2->len=sizeof(CISO1DirEntry)-1; |
||||
de2->ext_attr_len=0; |
||||
FillU32Palindrome(&de2->loc,*_cur_blk); |
||||
FillU32Palindrome(&de2->size,tmpde1->size); |
||||
FillU16Palindrome(&de2->vol_seq_num,1); |
||||
Date2ISO1(&de2->date,tmpde1->datetime); |
||||
de2->flags=0; |
||||
de2->name_len=StrLen(tmpde1->name)<<1; |
||||
ptr1=&de2->name; |
||||
ptr2=&tmpde1->name; |
||||
for (i=0;i<de2->name_len;i=i+2) { |
||||
ptr1++; |
||||
*ptr1++=*ptr2++; |
||||
} |
||||
de2->len+=de2->name_len; |
||||
de2(U8 *)+=de2->len; |
||||
|
||||
in_file=FOpen(tmpde1->full_name,"r"); |
||||
for (i=0;i<(FSize(in_file)+DVD_BLK_SIZE-1)/DVD_BLK_SIZE;i++) { |
||||
n=4; |
||||
if ((i+1)<<2>(FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS) { |
||||
n=(FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS&3; |
||||
MemSet(buf,0,DVD_BLK_SIZE); |
||||
} |
||||
if (write) { |
||||
FBlkRead(in_file,buf,i<<2,n); |
||||
FBlkWrite(out_file,buf,*_cur_blk<<2,n); |
||||
} |
||||
*_cur_blk+=1; |
||||
} |
||||
FClose(in_file); |
||||
} |
||||
if ((de1(U8 *)-dir_blk_buf(U8 *))/DVD_BLK_SIZE!= |
||||
(de(U8 *) -dir_blk_buf(U8 *))/DVD_BLK_SIZE) { |
||||
i=de1->len; |
||||
MemCpy(buf,de1,i); |
||||
MemSet(de1,0,i); |
||||
de=dir_blk_buf(U8 *)+(de(U8 *) |
||||
-dir_blk_buf(U8 *))/DVD_BLK_SIZE*DVD_BLK_SIZE; |
||||
MemCpy(de,buf,i); |
||||
de(U8 *)+=i; |
||||
} |
||||
if ((de12(U8 *)-dir_blk_buf2(U8 *))/DVD_BLK_SIZE!= |
||||
(de2(U8 *) -dir_blk_buf2(U8 *))/DVD_BLK_SIZE) { |
||||
i=de12->len; |
||||
MemCpy(buf,de12,i); |
||||
MemSet(de12,0,i); |
||||
de2(U8 *)=dir_blk_buf2(U8 *)+(de2(U8 *) |
||||
-dir_blk_buf2(U8 *))/DVD_BLK_SIZE*DVD_BLK_SIZE; |
||||
MemCpy(de2,buf,i); |
||||
de2(U8 *)+=i; |
||||
} |
||||
tmpde1=tmpde2; |
||||
} |
||||
|
||||
tmpc=tmpde->user_data; |
||||
|
||||
tmpi->len=sizeof(CISO1DirEntry)-1; |
||||
tmpi->ext_attr_len=0; |
||||
tmpi->flags=ISO1_ATTR_DIR; |
||||
if (!tmpde->name[0]) { |
||||
tmpi->name_len=1; |
||||
tmpi->name=1; |
||||
} else { |
||||
tmpi->name_len=StrLen(tmpde->name); |
||||
StrCpy(&tmpi->name,tmpde->name); |
||||
} |
||||
tmpi->len+=tmpi->name_len; |
||||
|
||||
n=de(U8 *)+1-dir_blk_buf(U8 *); |
||||
n=(n+DVD_BLK_SIZE-1)/DVD_BLK_SIZE; |
||||
FillU32Palindrome(&tmpi->size,n*DVD_BLK_SIZE); |
||||
FillU32Palindrome(&tmpi->loc,*_cur_blk); |
||||
tmpc->short_dir_blks=n; |
||||
tmpc->loc=*_cur_blk; |
||||
FillU32Palindrome(&dir_blk_buf->size,n*DVD_BLK_SIZE); |
||||
FillU32Palindrome(&dir_blk_buf->loc,*_cur_blk); |
||||
FillU16Palindrome(&tmpi->vol_seq_num,1); |
||||
Date2ISO1(&tmpi->date,tmpde->datetime); |
||||
if (write) |
||||
"%X:%s\n",*_cur_blk,tmpde->full_name; |
||||
if (write) |
||||
FBlkWrite(out_file,dir_blk_buf,*_cur_blk<<2,n<<2); |
||||
*_cur_blk+=n; |
||||
|
||||
tmpi2->len=sizeof(CISO1DirEntry)-1; |
||||
tmpi2->ext_attr_len=0; |
||||
tmpi2->flags=ISO1_ATTR_DIR; |
||||
if (!tmpde->name[0]) { |
||||
tmpi2->name_len=1; |
||||
tmpi->name=1; |
||||
} else { |
||||
tmpi2->name_len=StrLen(tmpde->name)<<1; |
||||
ptr1=&tmpi2->name; |
||||
ptr2=&tmpde->name; |
||||
for (i=0;i<tmpi2->name_len;i=i+2) { |
||||
ptr1++; |
||||
*ptr1++=*ptr2++; |
||||
} |
||||
} |
||||
tmpi2->len+=tmpi2->name_len; |
||||
n=de2(U8 *)+1-dir_blk_buf2(U8 *); |
||||
n=(n+DVD_BLK_SIZE-1)/DVD_BLK_SIZE; |
||||
FillU32Palindrome(&tmpi2->size,n*DVD_BLK_SIZE); |
||||
FillU32Palindrome(&tmpi2->loc,*_cur_blk); |
||||
tmpc->long_dir_blks=n; |
||||
FillU32Palindrome(&dir_blk_buf2->size,n*DVD_BLK_SIZE); |
||||
FillU32Palindrome(&dir_blk_buf2->loc,*_cur_blk); |
||||
FillU16Palindrome(&tmpi2->vol_seq_num,1); |
||||
Date2ISO1(&tmpi2->date,tmpde->datetime); |
||||
if (write) |
||||
"%X:%s\n",*_cur_blk,tmpde->full_name; |
||||
if (write) |
||||
FBlkWrite(out_file,dir_blk_buf2,*_cur_blk<<2,n<<2); |
||||
*_cur_blk+=n; |
||||
|
||||
Free(dir_blk_buf); |
||||
Free(dir_blk_buf2); |
||||
Free(buf); |
||||
return tmpi->name_len; |
||||
} |
||||
|
||||
I64 DVDTableLen(CDirEntry *tmpde,I64 *size1,I64 *size2,I64 cur_depth) |
||||
{//Returns depth |
||||
CDirEntry *tmpde1=tmpde->sub; |
||||
I64 max_depth=cur_depth,i; |
||||
while (tmpde1) { |
||||
if (tmpde1->attr & RS_ATTR_DIR) { |
||||
*size1+=sizeof(CISO1PathEntry)-2+ (StrLen(tmpde1->name)+1)&-0x2; |
||||
*size2+=sizeof(CISO1PathEntry)-2+StrLen(tmpde1->name)<<1; |
||||
i=DVDTableLen(tmpde1,size1,size2,cur_depth+1); |
||||
if (i>max_depth) max_depth=i; |
||||
} |
||||
tmpde1=tmpde1->next; |
||||
} |
||||
return max_depth; |
||||
} |
||||
|
||||
U0 DVDFillPathTable(CDirEntry *tmpde, |
||||
CISO1PathEntry **_itabbuf,CISO1PathEntry **_itabbuf2, |
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free, |
||||
I64 cur_level,I64 output_level) |
||||
{ |
||||
U8 *ptr1,*ptr2; |
||||
I64 i; |
||||
CISO1PathEntry *tabbuf=*_itabbuf,*tabbuf2=*_itabbuf2; |
||||
CDirEntry *tmpde1=tmpde->sub,*tmpde2; |
||||
CCDVDUserData *tmpc; |
||||
|
||||
if (cur_level==output_level) { |
||||
while (tmpde1) { |
||||
if (tmpde1->attr & RS_ATTR_DIR) { |
||||
tmpc=tmpde1->user_data; |
||||
tmpc->path_entry_num=*first_free; |
||||
tabbuf->name_len=StrLen(tmpde1->name); |
||||
if (big_endian) { |
||||
tabbuf->blk=EndianU32(tmpc->loc); |
||||
tabbuf->parent_entry_num=EndianU16(parent_entry_num); |
||||
} else { |
||||
tabbuf->blk=tmpc->loc; |
||||
tabbuf->parent_entry_num=parent_entry_num; |
||||
} |
||||
StrCpy(&tabbuf->name,tmpde1->name); |
||||
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+ |
||||
(StrLen(tmpde1->name)+1) & -0x2; |
||||
|
||||
tabbuf2->name_len=StrLen(tmpde1->name)<<1; |
||||
if (big_endian) { |
||||
tabbuf2->blk=EndianU32(tmpc->loc+tmpc->short_dir_blks); |
||||
tabbuf2->parent_entry_num=EndianU16(parent_entry_num); |
||||
} else { |
||||
tabbuf2->blk=tmpc->loc+tmpc->short_dir_blks; |
||||
tabbuf2->parent_entry_num=parent_entry_num; |
||||
} |
||||
ptr1=&tabbuf2->name; |
||||
ptr2=&tmpde1->name; |
||||
for (i=0;i<tabbuf2->name_len;i=i+2) { |
||||
ptr1++; |
||||
*ptr1++=*ptr2++; |
||||
} |
||||
tabbuf2(U8 *)+=sizeof(CISO1PathEntry)-2+ |
||||
StrLen(tmpde1->name)<<1; |
||||
*first_free+=1; |
||||
} |
||||
tmpde1=tmpde1->next; |
||||
} |
||||
*_itabbuf=tabbuf; |
||||
*_itabbuf2=tabbuf2; |
||||
} |
||||
tmpde1=tmpde->sub; |
||||
while (tmpde1) { |
||||
tmpde2=tmpde1->next; |
||||
if (tmpde1->attr & RS_ATTR_DIR) { |
||||
tmpc=tmpde1->user_data; |
||||
DVDFillPathTable(tmpde1,_itabbuf,_itabbuf2,tmpc->path_entry_num, |
||||
big_endian,first_free,cur_level+1,output_level); |
||||
} |
||||
tmpde1=tmpde2; |
||||
} |
||||
} |
||||
|
||||
public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask, |
||||
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL) |
||||
{//See $LK,"::/Misc/DoDistro.HC"$ |
||||
//Use "C:/Distro/*" if you want all files in the C:/Distro directory. |
||||
//Default flags are "+r" recurse. |
||||
CISO1PriDesc *iso_pri=CAlloc(DVD_BLK_SIZE), |
||||
*iso_boot=CAlloc(DVD_BLK_SIZE), |
||||
*iso_sup=CAlloc(DVD_BLK_SIZE), |
||||
*iso_term=CAlloc(DVD_BLK_SIZE); |
||||
CDirEntry *headdir=CAlloc(sizeof(CDirEntry)); |
||||
I64 i,j,stage2_blk=(20<<2+1<<2+DVD_BOOT_LOADER_SIZE/BLK_SIZE)>>2, |
||||
stage2_size,cur_blk=0,tabsize,tabsize2,first_free,max_depth,fuf_flags=0; |
||||
U32 *d; |
||||
CElTorito *et=CAlloc(DVD_BLK_SIZE); |
||||
U8 *filename,*stage2_filename, |
||||
*stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE), |
||||
*zero_buf=CAlloc(DVD_BLK_SIZE); |
||||
CISO1PathEntry *tabbuf=NULL,*tabbuf2=NULL,*itabbuf,*itabbuf2; |
||||
CFile *out_file=NULL; |
||||
CISO1DirEntry *tmpi; |
||||
CCDVDUserData *tmpc; |
||||
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r"); |
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); |
||||
|
||||
if (!_filename) |
||||
_filename=blkdev.dft_iso_filename; |
||||
filename=ExtDft(_filename,"ISO"); |
||||
|
||||
if (_stage2_filename) |
||||
stage2_filename=FileNameAbs(_stage2_filename); |
||||
else |
||||
stage2_filename=NULL; |
||||
|
||||
headdir->attr=RS_ATTR_DIR; |
||||
headdir->sub=FilesFind(src_files_find_mask,fuf_flags); |
||||
headdir->datetime=Now; |
||||
headdir->user_data=CAlloc(sizeof(CCDVDUserData)); |
||||
tmpc=headdir->user_data; |
||||
tmpc->path_entry_num=1; |
||||
|
||||
cur_blk=20<<2>>2; |
||||
if (stage2_filename) //preboot and bootloader |
||||
cur_blk+=1+DVD_BOOT_LOADER_SIZE/DVD_BLK_SIZE; |
||||
DVDFileCreate2(out_file,headdir,&iso_pri->root_dir_record, |
||||
&iso_sup->root_dir_record,&cur_blk,headdir,FALSE, |
||||
stage2_filename,&stage2_blk); |
||||
tabsize=sizeof(CISO1PathEntry); |
||||
tabsize2=sizeof(CISO1PathEntry); |
||||
max_depth=DVDTableLen(headdir,&tabsize,&tabsize2,1); |
||||
FillU32Palindrome(&iso_pri->path_table_size,tabsize); |
||||
FillU32Palindrome(&iso_sup->path_table_size,tabsize2); |
||||
tabsize=(tabsize+DVD_BLK_SIZE-1)/DVD_BLK_SIZE; |
||||
cur_blk+=tabsize<<1; |
||||
tabsize2=(tabsize2+DVD_BLK_SIZE-1)/DVD_BLK_SIZE; |
||||
cur_blk+=tabsize2<<1; |
||||
|
||||
if (FileAttr(filename) & RS_ATTR_CONTIGUOUS) |
||||
out_file=FOpen(filename,"wc",cur_blk<<2); |
||||
else |
||||
out_file=FOpen(filename,"w",cur_blk<<2); |
||||
cur_blk=0; |
||||
if (!out_file) |
||||
goto cf_done; |
||||
|
||||
while (cur_blk<20<<2>>2) |
||||
FBlkWrite(out_file,zero_buf,cur_blk++<<2,4); |
||||
|
||||
iso_pri->type=ISO1T_PRI_VOL_DESC; |
||||
StrCpy(iso_pri->id,"CD001"); |
||||
iso_pri->version=1; |
||||
FillU16Palindrome(&iso_pri->vol_set_size,1); |
||||
FillU16Palindrome(&iso_pri->vol_seq_num,1); |
||||
FillU16Palindrome(&iso_pri->log_block_size,DVD_BLK_SIZE); |
||||
iso_pri->file_structure_version=1; |
||||
|
||||
iso_sup->type=ISO1T_SUPPLEMENTARY_DESC; |
||||
StrCpy(iso_sup->id,"CD001"); |
||||
iso_sup->version=1; |
||||
FillU16Palindrome(&iso_sup->vol_set_size,1); |
||||
FillU16Palindrome(&iso_sup->vol_seq_num,1); |
||||
FillU16Palindrome(&iso_sup->log_block_size,DVD_BLK_SIZE); |
||||
iso_sup->file_structure_version=1; |
||||
|
||||
iso_boot->type=ISO1T_BOOT_RECORD; |
||||
StrCpy(iso_boot->id,"CD001"); |
||||
iso_boot->version=1; |
||||
StrCpy(iso_boot(U8 *)+7,"EL TORITO SPECIFICATION"); |
||||
|
||||
cur_blk=20<<2>>2; |
||||
|
||||
if (stage2_filename) { |
||||
d=iso_boot(U8 *)+0x47; |
||||
*d=cur_blk; |
||||
et->w[0]=1; |
||||
StrCpy(&et->w[2],"TempleOS"); |
||||
et->w[15]=0xAA55; |
||||
j=0; |
||||
for (i=0;i<16;i++) //Checksum |
||||
j+=et->w[i]; |
||||
et->w[14]=-j; |
||||
et->bootable=0x88; |
||||
et->media_type=0;//0=no emu 2=1.44meg 4=hard drive |
||||
et->sect_cnt=4; //5 seems like the limit, 4 is safer |
||||
et->load_rba=cur_blk+1; |
||||
"%X: Pre Boot Blk\n",cur_blk; |
||||
FBlkWrite(out_file,et,cur_blk++<<2,4); |
||||
"%X: Boot Stage 1\n",cur_blk; |
||||
cur_blk+=DVD_BOOT_LOADER_SIZE/DVD_BLK_SIZE; |
||||
} |
||||
|
||||
DVDFileCreate2(out_file,headdir,&iso_pri->root_dir_record, |
||||
&iso_sup->root_dir_record,&cur_blk,headdir,TRUE, |
||||
stage2_filename,&stage2_blk); |
||||
|
||||
tabbuf=CAlloc(tabsize*DVD_BLK_SIZE); |
||||
iso_pri->type_l_path_table=cur_blk; |
||||
tabbuf->name_len=2; //Fill-in adam entry |
||||
tmpi=&iso_pri->root_dir_record; |
||||
tabbuf->blk=tmpi->loc.little; |
||||
tabbuf->parent_entry_num=1; |
||||
tabbuf2=CAlloc(tabsize2*DVD_BLK_SIZE); |
||||
iso_sup->type_l_path_table=cur_blk+tabsize; |
||||
tabbuf2->name_len=2; //Fill-in adam entry |
||||
tmpi=&iso_sup->root_dir_record; |
||||
tabbuf2->blk=tmpi->loc.little; |
||||
tabbuf2->parent_entry_num=1; |
||||
itabbuf=tabbuf+1; |
||||
itabbuf2=tabbuf2+1; |
||||
first_free=2; |
||||
for (i=1;i<=max_depth;i++) |
||||
DVDFillPathTable(headdir,&itabbuf,&itabbuf2,1,FALSE,&first_free,1,i); |
||||
"%X: Path Table 0\n",cur_blk; |
||||
FBlkWrite(out_file,tabbuf,cur_blk<<2,tabsize<<2); |
||||
cur_blk+=tabsize; |
||||
"%X: Path Table 1\n",cur_blk; |
||||
FBlkWrite(out_file,tabbuf2,cur_blk<<2,tabsize2<<2); |
||||
cur_blk+=tabsize2; |
||||
|
||||
MemSet(tabbuf,0,tabsize*DVD_BLK_SIZE); |
||||
iso_pri->type_m_path_table=EndianU32(cur_blk); |
||||
tabbuf->name_len=2; //Fill-in adam entry |
||||
tmpi=&iso_pri->root_dir_record; |
||||
tabbuf->blk=tmpi->loc.big; |
||||
tabbuf->parent_entry_num=EndianU16(1); |
||||
MemSet(tabbuf2,0,tabsize2*DVD_BLK_SIZE); |
||||
iso_sup->type_m_path_table=EndianU32(cur_blk+tabsize); |
||||
tabbuf2->name_len=2; //Fill-in adam entry |
||||
tmpi=&iso_sup->root_dir_record; |
||||
tabbuf2->blk=tmpi->loc.big; |
||||
tabbuf2->parent_entry_num=EndianU16(1); |
||||
itabbuf=tabbuf+1; |
||||
itabbuf2=tabbuf2+1; |
||||
first_free=2; |
||||
for (i=1;i<=max_depth;i++) |
||||
DVDFillPathTable(headdir,&itabbuf,&itabbuf2,1,TRUE,&first_free,1,i); |
||||
"%X: Path Table 2\n",cur_blk; |
||||
FBlkWrite(out_file,tabbuf,cur_blk<<2,tabsize<<2); |
||||
cur_blk+=tabsize; |
||||
"%X: Path Table 3\n",cur_blk; |
||||
FBlkWrite(out_file,tabbuf2,cur_blk<<2,tabsize2<<2); |
||||
cur_blk+=tabsize2; |
||||
|
||||
DirTreeDel2(headdir); |
||||
FillU32Palindrome(&iso_pri->vol_space_size,cur_blk); |
||||
FillU32Palindrome(&iso_sup->vol_space_size,cur_blk); |
||||
FBlkWrite(out_file,iso_pri,16<<2,4); |
||||
|
||||
iso_term->type=ISO1T_TERMINATOR; |
||||
StrCpy(iso_term->id,"CD001"); |
||||
iso_term->version=1; |
||||
if (stage2_filename) { |
||||
FBlkWrite(out_file,iso_boot,17<<2,4); |
||||
FBlkWrite(out_file,iso_sup,18<<2,4); |
||||
FBlkWrite(out_file,iso_term,19<<2,4); |
||||
stage2_size=(Size(stage2_filename,"+s")+DVD_BLK_SIZE-1)/DVD_BLK_SIZE; |
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START); |
||||
*(BDVD_BLK_CNT-BDVD_START+stage1_buf)(U16 *)=stage2_size; |
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk; |
||||
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n", |
||||
stage2_blk,stage2_blk+stage2_size-1; |
||||
FBlkWrite(out_file,stage1_buf, |
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE); |
||||
} else { |
||||
FBlkWrite(out_file,iso_sup,17<<2,4); |
||||
FBlkWrite(out_file,iso_term,18<<2,4); |
||||
} |
||||
|
||||
cf_done: |
||||
FClose(out_file); |
||||
Free(tabbuf); |
||||
Free(tabbuf2); |
||||
Free(stage2_filename); |
||||
Free(filename); |
||||
Free(zero_buf); |
||||
Free(stage1_buf); |
||||
Free(et); |
||||
Free(iso_pri); |
||||
Free(iso_boot); |
||||
Free(iso_sup); |
||||
Free(iso_term); |
||||
return cur_blk; |
||||
} |
@ -1,386 +0,0 @@
|
||||
#help_index "Graphics/Windows BMP Files" |
||||
|
||||
#define BMP_COLORS_NUM 16 |
||||
|
||||
class CFileBMP |
||||
{ |
||||
U16 type; |
||||
U32 file_size; |
||||
U32 reserved; |
||||
U32 data_offset; |
||||
|
||||
U32 header_size; |
||||
U32 width; |
||||
U32 height; |
||||
U16 planes; |
||||
U16 bit_cnt; |
||||
U32 compression; |
||||
U32 image_size; |
||||
U32 x_pixs_per_meter; |
||||
U32 y_pixs_per_meter; |
||||
U32 colors_used; |
||||
U32 important_colors; |
||||
|
||||
U0 end; |
||||
|
||||
CBGR24 palette[BMP_COLORS_NUM]; |
||||
}; |
||||
|
||||
public CFileBMP *BMP4To(CDC *dc) |
||||
{//To Windows 4-bit BMP. |
||||
U8 *src,*ptr; |
||||
CBGR48 palette[COLORS_NUM]; |
||||
I64 i,x,y,w=dc->width>>1, |
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1; |
||||
CFileBMP *bmp =CAlloc(size); |
||||
bmp->type ='BM'; |
||||
bmp->planes =1; |
||||
bmp->file_size=size; |
||||
bmp->data_offset=sizeof(CFileBMP); |
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size); |
||||
bmp->width =dc->width; |
||||
bmp->height =dc->height; |
||||
bmp->bit_cnt =4; |
||||
bmp->image_size=dc->width*dc->height>>1; |
||||
GrPaletteGet(palette); |
||||
#assert COLORS_NUM==BMP_COLORS_NUM |
||||
for (i=0;i<BMP_COLORS_NUM;i++) { |
||||
bmp->palette[i].b=palette[i].b>>8; |
||||
bmp->palette[i].g=palette[i].g>>8; |
||||
bmp->palette[i].r=palette[i].r>>8; |
||||
bmp->palette[i].pad=0; |
||||
} |
||||
ptr=bmp(U8 *)+bmp->data_offset; |
||||
for (y=dc->height-1;y>=0;y--) { |
||||
src=y*dc->width_internal+dc->body; |
||||
for (x=0;x<w;x++) { |
||||
*ptr|=(*src++&15)<<4; |
||||
*ptr|=*src++&15; |
||||
ptr++; |
||||
} |
||||
} |
||||
return bmp; |
||||
} |
||||
|
||||
public CFileBMP *BMPRLE4To(CDC *dc) |
||||
{//To Windows RLE4 bit BMP. |
||||
U8 *src,*ptr,*start; |
||||
I64 i,x,y,w=dc->width,cnt,pattern; |
||||
CBGR48 palette[COLORS_NUM]; |
||||
CFileBMP *bmp =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height); |
||||
bmp->type ='BM'; |
||||
bmp->planes =1; |
||||
bmp->data_offset=sizeof(CFileBMP); |
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size); |
||||
bmp->width =dc->width; |
||||
bmp->height =dc->height; |
||||
bmp->bit_cnt =4; |
||||
bmp->compression=2; //RLE4 |
||||
GrPaletteGet(palette); |
||||
#assert COLORS_NUM==BMP_COLORS_NUM |
||||
for (i=0;i<BMP_COLORS_NUM;i++) { |
||||
bmp->palette[i].b=palette[i].b>>8; |
||||
bmp->palette[i].g=palette[i].g>>8; |
||||
bmp->palette[i].r=palette[i].r>>8; |
||||
bmp->palette[i].pad=0; |
||||
} |
||||
start=ptr=bmp(U8 *)+bmp->data_offset; |
||||
for (y=dc->height-1;y>=0;y--) { |
||||
src=y*dc->width_internal+dc->body; |
||||
x=0; |
||||
while (x<w) { |
||||
pattern=(src[0]&15)<<4+src[1]&15; |
||||
if (x+1<w && src[0]&15==src[1]&15) { |
||||
src+=2; |
||||
cnt=2; |
||||
x+=2; |
||||
while (x<w && cnt<U8_MAX) { |
||||
if (*src&15==pattern&15) { |
||||
src++; |
||||
cnt++; |
||||
x++; |
||||
} else |
||||
break; |
||||
} |
||||
} else { |
||||
src+=2; |
||||
if (x+1<w) |
||||
cnt=2; |
||||
else |
||||
cnt=1; |
||||
x+=2; |
||||
} |
||||
*ptr++=cnt; |
||||
*ptr++=pattern; |
||||
} |
||||
*ptr(U16 *)++=0; |
||||
} |
||||
bmp->image_size=ptr-start; |
||||
bmp->file_size=sizeof(CFileBMP)+bmp->image_size; |
||||
return bmp; |
||||
} |
||||
|
||||
public CFileBMP *BMP24To(CDC *dc) |
||||
{//To Windows 24-bit BMP. |
||||
U8 *src; |
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CBGR24); |
||||
CBGR24 *bgr; |
||||
CFileBMP *bmp =CAlloc(size); |
||||
bmp->type ='BM'; |
||||
bmp->planes =1; |
||||
bmp->file_size=size; |
||||
bmp->data_offset=offset(CFileBMP.end); |
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size); |
||||
bmp->width =dc->width; |
||||
bmp->height =dc->height; |
||||
bmp->bit_cnt =32; |
||||
bmp->image_size=dc->width*dc->height<<2; |
||||
|
||||
bgr=bmp(U8 *)+bmp->data_offset; |
||||
for (y=dc->height-1;y>=0;y--) { |
||||
src=y*dc->width_internal+dc->body; |
||||
for (x=0;x<dc->width;x++) { |
||||
i=*src++; |
||||
if (i&BLUE) bgr->b=0x7F; |
||||
if (i&GREEN) bgr->g=0x7F; |
||||
if (i&RED) bgr->r=0x7F; |
||||
if (i&8) { |
||||
if (bgr->b) bgr->b=0xFF; |
||||
if (bgr->g) bgr->g=0xFF; |
||||
if (bgr->r) bgr->r=0xFF; |
||||
} |
||||
bgr(U8 *)+=4; |
||||
} |
||||
} |
||||
return bmp; |
||||
} |
||||
|
||||
public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4) |
||||
{//Window's BMP Files. |
||||
I64 size; |
||||
CFileBMP *bmp; |
||||
if (bits==4) { |
||||
if (IsDotZ(filename)) //.Z compression is better than RLE |
||||
bmp=BMP4To(dc); |
||||
else { |
||||
bmp=BMPRLE4To(dc); |
||||
if (bmp->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) { |
||||
Free(bmp); |
||||
bmp=BMP4To(dc); |
||||
} |
||||
} |
||||
} else if (bits==24) |
||||
bmp=BMP24To(dc); |
||||
else { |
||||
"Format Not Supported.\n"; |
||||
return 0; |
||||
} |
||||
size=bmp->file_size; |
||||
FileWrite(filename,bmp,bmp->file_size); |
||||
Free(bmp); |
||||
return size; |
||||
} |
||||
|
||||
U8 *BMPPaletteNew(CFileBMP *bmp) |
||||
{ |
||||
I64 i,j,best,score,best_score; |
||||
CBGR48 palette[COLORS_NUM]; |
||||
U8 *res=CAlloc(BMP_COLORS_NUM*sizeof(U8)); |
||||
GrPaletteGet(palette); |
||||
#assert COLORS_NUM==BMP_COLORS_NUM |
||||
for (i=0;i<BMP_COLORS_NUM;i++) { |
||||
best=i; |
||||
best_score=I64_MAX; |
||||
for (j=0;j<BMP_COLORS_NUM;j++) { |
||||
score=SqrI64(bmp->palette[i].r-palette[j].r>>8)+ |
||||
SqrI64(bmp->palette[i].g-palette[j].g>>8)+ |
||||
SqrI64(bmp->palette[i].b-palette[j].b>>8); |
||||
if (score<best_score) { |
||||
best=j; |
||||
best_score=score; |
||||
} |
||||
} |
||||
res[i]=best; |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
U8 ms_paint_palette[BMP_COLORS_NUM]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15}; |
||||
|
||||
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability) |
||||
{ |
||||
I64 res,k; |
||||
if (dither_probability) { |
||||
k=RandU32; |
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0])) |
||||
res=8; |
||||
else |
||||
res=0; |
||||
if (ptr->r>=k.u8[1]) res|=RED; |
||||
if (ptr->g>=k.u8[2]) res|=GREEN; |
||||
if (ptr->b>=k.u8[3]) res|=BLUE; |
||||
} else { |
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) { |
||||
res=8; |
||||
if (ptr->r>=0x80) res|=RED; |
||||
if (ptr->g>=0x80) res|=GREEN; |
||||
if (ptr->b>=0x80) res|=BLUE; |
||||
} else { |
||||
res=0; |
||||
if (ptr->r>=0x40) res|=RED; |
||||
if (ptr->g>=0x40) res|=GREEN; |
||||
if (ptr->b>=0x40) res|=BLUE; |
||||
} |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE, |
||||
Bool use_ms_paint_palette=FALSE) |
||||
{//Window's BMP Files. |
||||
I64 i,j,cnt; |
||||
U8 *palette_map,*ptr; |
||||
Bool rle; |
||||
CFileBMP *bmp; |
||||
CDC *res=NULL; |
||||
if (ptr=FileRead(filename)) { |
||||
bmp=ptr; |
||||
if (0<bmp->width<I32_MAX && 0<bmp->height<I32_MAX) { |
||||
res=DCNew(bmp->width,bmp->height); |
||||
ptr+=bmp->data_offset; |
||||
if (bmp->compression==2) |
||||
rle=TRUE; |
||||
else |
||||
rle=FALSE; |
||||
if (use_ms_paint_palette) |
||||
palette_map=ms_paint_palette; |
||||
else |
||||
palette_map=BMPPaletteNew(bmp); |
||||
if (bmp->bit_cnt==4) { |
||||
for (i=bmp->height-1;i>=0;i--) |
||||
if (rle) {//We don't support full RLE4, just our own subset |
||||
j=0; |
||||
while (cnt=*ptr++) { |
||||
if (cnt==1) { |
||||
res->color=palette_map[*ptr++&15]; |
||||
GrPlot(res,j++,i); |
||||
} else { |
||||
if (cnt==2 && *ptr>>4!=*ptr&15) { |
||||
res->color=palette_map[*ptr&15]; |
||||
GrPlot(res,j+1,i); |
||||
res->color=palette_map[*ptr>>4]; |
||||
GrPlot(res,j,i); |
||||
ptr++; |
||||
j+=2; |
||||
} else { |
||||
res->color=palette_map[*ptr++&15]; |
||||
while (cnt--) |
||||
GrPlot(res,j++,i); |
||||
} |
||||
} |
||||
} |
||||
ptr++; |
||||
} else |
||||
for (j=0;j<(bmp->width+7)&~7;) { |
||||
res->color=palette_map[*ptr&15]; |
||||
GrPlot(res,j+1,i); |
||||
res->color=palette_map[*ptr>>4]; |
||||
GrPlot(res,j,i); |
||||
ptr++; |
||||
j+=2; |
||||
} |
||||
if (!use_ms_paint_palette) |
||||
Free(palette_map); |
||||
} else if (bmp->bit_cnt==24) { |
||||
for (i=bmp->height-1;i>=0;i--) { |
||||
for (j=0;j<bmp->width;j++,ptr+=3) { |
||||
res->color=BMP24Color(ptr,dither_probability); |
||||
GrPlot(res,j,i); |
||||
} |
||||
ptr+=bmp->width&3; |
||||
} |
||||
if (!use_ms_paint_palette) |
||||
Free(palette_map); |
||||
} else if (bmp->bit_cnt>=32) { |
||||
for (i=bmp->height-1;i>=0;i--) |
||||
for (j=0;j<bmp->width;j++,ptr+=4) { |
||||
res->color=BMP24Color(ptr,dither_probability); |
||||
GrPlot(res,j,i); |
||||
} |
||||
if (!use_ms_paint_palette) |
||||
Free(palette_map); |
||||
} else { |
||||
"Format Not Supported.\n"; |
||||
DCDel(res); |
||||
res=NULL; |
||||
} |
||||
} else |
||||
"Invalid BMP File\n"; |
||||
Free(bmp); |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\ |
||||
"DolDoc/Output;StdOut/DolDoc" |
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE, |
||||
Bool use_ms_paint_palette=FALSE) |
||||
{//Put a BMP file into a document as a sprite. |
||||
CDC *dc=BMPRead(filename,dither_probability,use_ms_paint_palette); |
||||
U8 *elems=DC2Sprite(dc); |
||||
DocSprite(doc,elems); |
||||
Free(elems); |
||||
DCDel(dc); |
||||
} |
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/Scrn" |
||||
public I64 BMPScrnCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE) |
||||
{//Capture scrn as BMP file. |
||||
CDC *dc=DCScrnCapture(include_zoom); |
||||
I64 size=BMPWrite(filename,dc,bits); |
||||
DCDel(dc); |
||||
return size; |
||||
} |
||||
|
||||
public I64 GR2BMPLst(U8 *files_find_mask,U8 *fu_flags=NULL, |
||||
U8 *out_print_fmt="~:/Tmp/VID%05d.BMP.Z",F64 fps=30000.0/1001) |
||||
{/*Cvt movie from GR lst to BMP lst |
||||
"+d" will delete GRLst files. |
||||
*/ |
||||
I64 res=0,fuf_flags=0; |
||||
CDirEntry *tmpde,*tmpde1; |
||||
CDC *dc,*base=DCNew(GR_WIDTH,GR_HEIGHT); |
||||
U8 *st,*last_st; |
||||
CDate cdt=I64_MIN; |
||||
Bool old_silent; |
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F"); |
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); |
||||
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND); |
||||
last_st=MStrPrint(out_print_fmt,0); |
||||
progress1_max=LinkedLstCnt(tmpde); |
||||
while (tmpde) { |
||||
dc=GRRead(tmpde->full_name); |
||||
GrBlot(base,dc->x0,dc->y0,dc); |
||||
if (cdt==I64_MIN) |
||||
cdt=dc->cdt; |
||||
while (cdt<=dc->cdt) { |
||||
st=MStrPrint(out_print_fmt,res++); |
||||
BMPWrite(st,base); |
||||
Free(st); |
||||
cdt+=CDATE_FREQ/fps; |
||||
} |
||||
if (fuf_flags&FUF_DEL) { |
||||
old_silent=Silent; |
||||
Del(tmpde->full_name); |
||||
Silent(old_silent); |
||||
} |
||||
DCDel(dc); |
||||
progress1++; |
||||
tmpde=tmpde->next; |
||||
} |
||||
progress1=progress1_max=0; |
||||
DirTreeDel(tmpde1); |
||||
Free(last_st); |
||||
DCDel(base); |
||||
return res; |
||||
} |
@ -1,21 +0,0 @@
|
||||
Cd(__DIR__);; |
||||
|
||||
#help_index "Snd" |
||||
class CSndWaveCtrl |
||||
{ |
||||
I64 sample_rate,sample_bits,channels; |
||||
F64 freq_multiplier,amp_multiplier; |
||||
F64 phase,last_y,last_dydt,next_y; |
||||
}; |
||||
|
||||
public U0 SndTaskEndCB() |
||||
{//Will turn-off snd when a task gets killed. |
||||
Snd; |
||||
Exit; |
||||
} |
||||
|
||||
#include "SndMath" |
||||
#include "SndMusic" |
||||
#include "SndEffects" |
||||
#include "SndFile" |
||||
Cd("..");; |