From 981ffd8bd2be618a691c663df8436244175b96ef Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 8 Sep 2016 12:10:31 -0500 Subject: [PATCH] bloody typedefstruct merging is going to be tricky wwww ca_loadfile and ca_readfile may be our tickets --- src/exmmtest.c | 4 ++-- src/lib/16_ca.c | 22 +++++++++++----------- src/lib/16_ca.h | 10 +++++----- src/vgacamm.c | 2 +- src/vrstest.c | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/exmmtest.c b/src/exmmtest.c index e1d4e558..f3871ead 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -107,10 +107,10 @@ main(int argc, char *argv[]) // if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm)) #ifdef FILEREAD printf(" read\n"); - if(CA_ReadFile(bakapee, &bigbuffer, &gvar.mm)) + if(CA_ReadFile(bakapee, &bigbuffer, &gvar)) #else printf(" load\n"); - if(CA_LoadFile(bakapee, &bigbuffer, &gvar.mm, &gvar.mmi)) + if(CA_LoadFile(bakapee, &bigbuffer, &gvar)) #endif baka=1; else diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 0b22ed14..55dca2cd 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -221,12 +221,12 @@ void CAL_GetGrChunkLength (int chunk) ========================== */ -boolean CA_FarRead(int handle, byte huge *dest, dword length, mminfo_t *mm) +boolean CA_FarRead(int handle, byte huge *dest, dword length, global_game_variables_t *gvar) { boolean flag; //dword fat=0; //word segm=0; - if(mm->EMSVer<0x40) + if(gvar->mm.EMSVer<0x40) if(length>0xfffflu) { printf("File is a fat bakapee\n"); @@ -293,12 +293,12 @@ End: ========================== */ -boolean CA_FarWrite(int handle, byte huge *source, dword length, mminfo_t *mm) +boolean CA_FarWrite(int handle, byte huge *source, dword length, global_game_variables_t *gvar) { boolean flag; //dword fat=0; //word segm=0; - if(mm->EMSVer<0x40) + if(gvar->mm.EMSVer<0x40) if(length>0xfffflu) { printf("File is a fat bakapee\n"); @@ -365,7 +365,7 @@ End: ========================== */ -boolean CA_ReadFile(char *filename, memptr *ptr, mminfo_t *mm) +boolean CA_ReadFile(char *filename, memptr *ptr, global_game_variables_t *gvar) { int handle; sdword size; @@ -375,7 +375,7 @@ boolean CA_ReadFile(char *filename, memptr *ptr, mminfo_t *mm) return false; size = filelength(handle); - if(!CA_FarRead(handle,*ptr,size, mm)) + if(!CA_FarRead(handle,*ptr,size, gvar)) { close (handle); return false; @@ -395,7 +395,7 @@ boolean CA_ReadFile(char *filename, memptr *ptr, mminfo_t *mm) ========================== */ -boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm) +boolean CA_WriteFile (char *filename, void far *ptr, long length, global_game_variables_t *gvar) { int handle; sdword size; @@ -407,7 +407,7 @@ boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm) if (handle == -1) return false; - if (!CA_FarWrite (handle,ptr,length, mm)) + if (!CA_FarWrite (handle,ptr,length, gvar)) { close(handle); return false; @@ -428,7 +428,7 @@ boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm) ========================== */ -boolean CA_LoadFile(char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi) +boolean CA_LoadFile(char *filename, memptr *ptr, global_game_variables_t *gvar) { int handle; sdword size; @@ -438,8 +438,8 @@ boolean CA_LoadFile(char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi) return false; size = filelength (handle); - MM_GetPtr(ptr,size, mm, mmi); - if(!CA_FarRead(handle,*ptr,size, mm)) + MM_GetPtr(ptr,size, &(gvar->mm), &(gvar->mmi)); //TODO: gvar parameters + if(!CA_FarRead(handle,*ptr,size, gvar)) { close(handle); return false; diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index 41649dbf..203cce95 100755 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -90,12 +90,12 @@ extern void (*finishcachebox) (void); void CA_OpenDebug (global_game_variables_t *gvar); void CA_CloseDebug (global_game_variables_t *gvar); -boolean CA_FarRead (int handle, byte huge *dest, dword length, mminfo_t *mm); -boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm); +boolean CA_FarRead (int handle, byte huge *dest, dword length, global_game_variables_t *gvar); +boolean CA_FarWrite (int handle, byte huge *source, dword length, global_game_variables_t *gvar); -boolean CA_ReadFile (char *filename, memptr *ptr, mminfo_t *mm); -boolean CA_WriteFile (char *filename, void far *ptr, long length, mminfo_t *mm); -boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi); +boolean CA_ReadFile (char *filename, memptr *ptr, global_game_variables_t *gvar); +boolean CA_WriteFile (char *filename, void far *ptr, long length, global_game_variables_t *gvar); +boolean CA_LoadFile (char *filename, memptr *ptr, global_game_variables_t *gvar); long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag); diff --git a/src/vgacamm.c b/src/vgacamm.c index e9c1c0ba..e77fbc6e 100755 --- a/src/vgacamm.c +++ b/src/vgacamm.c @@ -42,7 +42,7 @@ void main() { MM_Startup(&gvar.mm, &gvar.mmi); CA_Startup(&gvar); printf("loading\n"); - if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar.mm, &gvar.mmi)) baka=1; else baka=0; + if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar)) baka=1; else baka=0; // DOSLIB: check our environment probe_dos(); diff --git a/src/vrstest.c b/src/vrstest.c index c36b0ae8..0e9020d9 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -79,7 +79,7 @@ void main() { CA_Startup(&gvar); // What should be done by read_vrs: //sega = (mm.bufferseg); - if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar.mm, &gvar.mmi)) baka=1; else baka=0; + if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar)) baka=1; else baka=0; // Insert sanity cheks later vrs.buffer = bigbuffer; -- 2.39.5