From 309a997554bc5d4df02621da8b92996270ed1ac2 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Sat, 27 Aug 2016 15:22:19 -0500 Subject: [PATCH] makefile.wat has BUILD_ROOT --- makefile.wat | 39 +++++++++++++++++++++++---------------- src/lib/16_ca.c | 41 +++++++++++++++++++++++++++++++++++++++-- src/lib/16_ca.h | 2 ++ 3 files changed, 64 insertions(+), 18 deletions(-) diff --git a/makefile.wat b/makefile.wat index a2041fc3..f1117ccc 100755 --- a/makefile.wat +++ b/makefile.wat @@ -53,6 +53,7 @@ DUMP=*type TARGET_OS = dos +BUILD_ROOT=$+$(%__CWD__) #EXMMTESTDIR=16$(DIRSEP)exmmtest$(DIRSEP) PDIR=..$(DIRSEP) SRC=src$(DIRSEP) @@ -229,21 +230,27 @@ vgmsnd.lib: $(VGMSNDOBJ) # library deps 16-bit huge $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu && .$(DIRSEP)make.sh + cd $(BUILD_ROOT) $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos && .$(DIRSEP)make.sh + cd $(BUILD_ROOT) $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vgatty.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh + cd $(BUILD_ROOT) $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga && .$(DIRSEP)make.sh + cd $(BUILD_ROOT) $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250$(DIRSEP)dos86h$(DIRSEP)8250.lib: cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250 && .$(DIRSEP)make.sh + cd $(BUILD_ROOT) joytest.exe: - cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)joystick && .$(DIRSEP)make.sh && $(COPYCOMMAND) dos86h$(DIRSEP)test.exe $(PDIR)$(PDIR)$(PDIR)$(PDIR)$(PDIR)joytest.exe + cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)joystick && .$(DIRSEP)make.sh && $(COPYCOMMAND) dos86h$(DIRSEP)test.exe $(BUILD_ROOT)$(DIRSEP)joytest.exe + cd $(BUILD_ROOT) #$(DOSLIBLIBS): .symbolic # @cd $(DOSLIB) # @.$(DIRSEP)buildall.sh -# @cd $(PDIR)$(PDIR)$(PDIR) +# @cd $(BUILD_ROOT) modex16.$(OBJ): $(SRCLIB)modex16.c $(SRCLIB)modex16.h bakapee.$(OBJ): $(SRCLIB)bakapee.c $(SRCLIB)bakapee.h @@ -307,7 +314,7 @@ clean: .symbolic @echo $(OBJ) #@cd $(DOSLIB) #@./buildall.sh clean - #@cd $(PDIR)$(PDIR)$(PDIR) + #@cd $(BUILD_ROOT) # @$(COPYCOMMAND) $(SRC)exmmtest.c $(EXMMTESTDIR)$(SRC) # @$(COPYCOMMAND) $(SRCLIB)16_mm.* $(EXMMTESTDIR)$(SRCLIB) # @$(COPYCOMMAND) $(SRCLIB)16_head.* $(EXMMTESTDIR)$(SRCLIB) @@ -352,15 +359,15 @@ vomitchan: .symbolic mkdl: .symbolic @cd $(DOSLIB) @./buildall.sh - @cd $(PDIR)$(PDIR)$(PDIR) + @cd $(BUILD_ROOT) uplibs: .symbolic @cd $(JSMNLIB) @git pull - @cd $(PDIR)$(PDIR)$(PDIR) + @cd $(BUILD_ROOT) @cd $(DOSLIB) @git pull - @cd $(PDIR)$(PDIR)$(PDIR) + @cd $(BUILD_ROOT) reinitlibs: .symbolic @rm -rf $(SRCLIB)doslib @@ -377,12 +384,12 @@ initlibs: .symbolic @cd $(SRCLIB) @git clone https://github.com/joncampbell123/doslib.git @git clone https://github.com/zserge/jsmn.git - @cd $(PDIR)$(PDIR) + @cd $(BUILD_ROOT) @cd 16 @git clone https://github.com/FlatRockSoft/CatacombApocalypse.git @git clone https://github.com/id-Software/wolf3d.git @git clone https://github.com/keendreams/keen.git - @cd $(PDIR) + @cd $(BUILD_ROOT) @cp $(SRCLIB)doslib/make-lowercase . ## @@ -392,25 +399,25 @@ xlib: .symbolic @cd 16$(DIRSEP)xlib @wmake -h clean @wmake -h all - @cd $(PDIR)$(PDIR) + @cd $(BUILD_ROOT) mx: .symbolic @cd 16$(DIRSEP)xw # @wmake clean @wmake -h all - @cd $(PDIR)$(PDIR) + @cd $(BUILD_ROOT) mx_: .symbolic @cd 16$(DIRSEP)xw_ @wmake -h -f makefile all - @cd $(PDIR)$(PDIR) + @cd $(BUILD_ROOT) vrs: .symbolic @cd $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga #@make clean @make all - @mv pcx2vrl ../../../../../ - @mv pcxsscut ../../../../../ - @mv vrl2vrs ../../../../../ - @mv vrsdump ../../../../../ - @cd ../../../../../ + @mv pcx2vrl $(BUILD_ROOT)$(DIRSEP) + @mv pcxsscut $(BUILD_ROOT)$(DIRSEP) + @mv vrl2vrs $(BUILD_ROOT)$(DIRSEP) + @mv vrsdump $(BUILD_ROOT)$(DIRSEP) + @cd $(BUILD_ROOT) diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index af7b7a11..25463ac7 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -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; @@ -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