X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_ca.c;h=25463ac732dff8703683b1d0f659af0aac7345ac;hb=c48c2f1e1f84ca6eaa064e6e88884c7e9c8d303b;hp=e1555f2f4566e11090f186df3242573f09ef3e1d;hpb=8fcc1b7400d579226abb162e0e6121fc5cb04cc5;p=16.git diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index e1555f2f..25463ac7 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -235,7 +235,7 @@ boolean CA_FarRead(int handle, byte huge *dest, dword length, mminfo_t *mm) //fat=segm*0xfffflu; //length-=fat; // printf("CA_FarRead doesn't support 64K reads yet!\n"); - return 0;//todo: EXPAND!!! + return 0;//TODO: EXPAND!!! } //if(!fat&&!segm) @@ -377,6 +377,38 @@ boolean CA_ReadFile(char *filename, memptr *ptr, mminfo_t *mm) size = filelength(handle); if(!CA_FarRead(handle,*ptr,size, mm)) + { + close (handle); + return false; + } + close (handle); + return true; +} + + +/* +========================== += += CA_WriteFile += += Writes a file from a memory buffer += +========================== +*/ + +boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm) +{ + int handle; + sdword size; + //long size; + + handle = open(filename,O_CREAT | O_BINARY | O_WRONLY, + S_IREAD | S_IWRITE | S_IFREG); + + if (handle == -1) + return false; + + if (!CA_FarWrite (handle,ptr,length, mm)) { close(handle); return false; @@ -888,7 +920,7 @@ asm mov ds,ax = ====================== */ - +////++++ enable! /*void CAL_SetupGrFile (void) { int handle; @@ -1945,9 +1977,14 @@ void CA_ClearAllMarks (void) ====================== */ /*++++ -void CA_FreeGraphics (void) +void CA_SetGrPurge (void) { - int i; + int i; + +// +// free graphics +// + CA_ClearMarks (); for (i=0;i