- Timestamp:
- Oct 26, 1999, 7:53:43 PM (26 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/initterm.cpp
r951 r1456 1 /* $Id: initterm.cpp,v 1. 9 1999-09-15 23:26:06sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.10 1999-10-26 17:52:31 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 #include <odinlx.h> 36 36 #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/ 37 #include "initterm.h" 37 38 38 39 extern "C" { … … 40 41 void CDECL _ctordtorTerm( void ); 41 42 } 43 44 char ddrawPath[CCHMAXPATH] = ""; 42 45 43 46 /*-------------------------------------------------------------------*/ … … 72 75 switch (ulFlag) { 73 76 case 0 : 77 { 74 78 _ctordtorInit(); 79 80 DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath); 81 char *endofpath = strrchr(ddrawPath, '\\'); 82 if(endofpath) *(endofpath+1) = 0; 75 83 76 84 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ … … 89 97 90 98 break; 99 } 91 100 case 1 : 92 101 UnregisterLxDll(hModule); … … 106 115 { 107 116 _ctordtorTerm(); 117 CloseLogFile(); 108 118 DosExitList(EXLST_EXIT, cleanup); 109 119 return ; -
trunk/src/ddraw/makefile
r604 r1456 54 54 $(PDWIN32_INCLUDE)\win\d3d.h 55 55 56 misc.obj: misc.cpp 56 misc.obj: misc.cpp initterm.h 57 57 58 58 os2palette.obj: os2palette.cpp \ … … 84 84 rectangle.obj: rectangle.cpp 85 85 86 initterm.obj: initterm.cpp 86 initterm.obj: initterm.cpp initterm.h 87 87 88 88 clean: 89 $(RM) *.obj *.lib *.dll * ~ *.map *.pch89 $(RM) *.obj *.lib *.dll *.map *.pch 90 90 $(RM) $(PDWIN32_BIN)\$(TARGET).dll 91 91 $(RM) $(PDWIN32_LIB)\$(TARGET).lib -
trunk/src/ddraw/misc.cpp
r210 r1456 8 8 #include <string.h> 9 9 #include <stdarg.h> 10 #include "misc.h"11 10 #include <misc.h> 11 #include "initterm.h" 12 12 13 13 //#define PMPRINTF … … 235 235 236 236 237 #if 1 /*PLF Mon 97-09-08 20:04:28*/ 237 /***************************************************************************** 238 * Standard Version * 239 *****************************************************************************/ 240 238 241 static FILE *flog = NULL; /*PLF Mon 97-09-08 20:00:15*/ 239 242 static BOOL init = FALSE; 243 static BOOL fLogging = TRUE; 240 244 241 245 int SYSTEM EXPORT WriteLog(char *tekst, ...) 242 246 { 247 USHORT sel = RestoreOS2FS(); 243 248 va_list argptr; 249 244 250 if(!init) 245 251 { 246 252 init = TRUE; 247 if(!getenv("NODDRAWLOG")) 248 flog = fopen("DDRAW.log", "w"); 249 } 250 251 if(flog) 253 254 if(!getenv("NODDRAWLOG")) { 255 char logname[CCHMAXPATH]; 256 257 flog = fopen("DDRAW.log", "w"); 258 if(flog == NULL) {//probably running exe on readonly device 259 sprintf(logname, "%sddraw.log", ddrawPath); 260 flog = fopen(logname, "w"); 261 } 262 } 263 else 264 fLogging = FALSE; 265 } 266 267 if(fLogging && flog) 252 268 { 253 va_start(argptr, tekst); 254 vfprintf(flog, tekst, argptr); 255 va_end(argptr); 256 fflush(flog); 257 } 269 va_start(argptr, tekst); 270 vfprintf(flog, tekst, argptr); 271 va_end(argptr); 272 273 if(tekst[strlen(tekst)-1] != '\n') 274 fprintf(flog, "\n"); 275 } 276 277 SetFS(sel); 258 278 return 1; 259 279 } 260 #else /*PLF Mon 97-09-08 20:04:26*/ 261 /******************************************************************************/ 262 static BOOL init = FALSE; 263 static BOOL fLog = TRUE; 264 /******************************************************************************/ 265 int SYSTEM EXPORT WriteLog(char *tekst, ...) 266 { 267 ULONG Action, Wrote; 268 HFILE log; 269 APIRET rc; 270 char message[4096]; 271 va_list argptr; 272 ULONG openFlags = OPEN_ACTION_CREATE_IF_NEW; 273 274 if(fLog == FALSE) 275 return(FALSE); 276 277 if(!init) 278 { 279 init = TRUE; 280 openFlags |= OPEN_ACTION_REPLACE_IF_EXISTS; 281 if(getenv("NOWIN32LOG")) 282 fLog = FALSE; 283 } 284 else 285 openFlags |= OPEN_ACTION_OPEN_IF_EXISTS; 286 287 rc = DosOpen( "win32os2.log", 288 &log, /* file handle returned */ 289 &Action, 290 0L, 291 FILE_NORMAL, 292 openFlags, 293 OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE, 294 (PEAOP2)NULL); 295 296 rc = DosSetFilePtr(log, 0, FILE_END, &Wrote); 297 va_start(argptr, tekst); 298 vsprintf(message, tekst, argptr); 299 va_end(argptr); 300 301 rc = DosWrite(log, message, strlen(message), &Wrote); 302 303 DosClose(log); /*PLF Mon 97-09-08 20:01:43*/ 304 return(TRUE); 280 //****************************************************************************** 281 //NOTE: No need to save/restore FS, as our FS selectors have already been 282 // destroyed and FS == 0x150B. 283 //****************************************************************************** 284 void CloseLogFile() 285 { 286 fclose(flog); 287 flog = 0; 305 288 } 306 #endif /*PLF Mon 97-09-08 20:04:23*/307 /******************************************************************************/308 /******************************************************************************/309 310 311 289 #endif -
trunk/src/dsound/initterm.cpp
r951 r1456 1 /* $Id: initterm.cpp,v 1. 6 1999-09-15 23:26:06sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.7 1999-10-26 17:53:42 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 #include <odinlx.h> 36 36 #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/ 37 #include "initterm.h" 37 38 38 39 extern "C" { … … 40 41 void CDECL _ctordtorTerm( void ); 41 42 } 43 44 char dsoundPath[CCHMAXPATH] = ""; 42 45 43 46 /*-------------------------------------------------------------------*/ … … 72 75 switch (ulFlag) { 73 76 case 0 : 77 { 74 78 _ctordtorInit(); 79 80 DosQueryModuleName(hModule, CCHMAXPATH, dsoundPath); 81 char *endofpath = strrchr(dsoundPath, '\\'); 82 if(endofpath) *(endofpath+1) = 0; 75 83 76 84 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ … … 89 97 90 98 break; 99 } 91 100 case 1 : 92 101 UnregisterLxDll(hModule); … … 106 115 { 107 116 _ctordtorTerm(); 117 CloseLogFile(); 108 118 DosExitList(EXLST_EXIT, cleanup); 109 119 return ; -
trunk/src/dsound/makefile
r1421 r1456 1 # $Id: makefile,v 1. 8 1999-10-23 23:00:50sandervl Exp $1 # $Id: makefile,v 1.9 1999-10-26 17:53:43 sandervl Exp $ 2 2 3 3 # … … 55 55 56 56 misc.obj: misc.cpp \ 57 $(PDWIN32_INCLUDE)\misc.h 57 $(PDWIN32_INCLUDE)\misc.h initterm.h 58 58 59 initterm.obj: initterm.cpp 59 initterm.obj: initterm.cpp initterm.h 60 60 61 61 -
trunk/src/dsound/misc.cpp
r1421 r1456 1 /* $Id: misc.cpp,v 1.2 1999-10-26 17:53:43 sandervl Exp $ */ 1 2 #define INCL_BASE 2 3 #define INCL_WIN … … 8 9 #include <string.h> 9 10 #include <stdarg.h> 10 #include "misc.h"11 11 #include <misc.h> 12 #include "initterm.h" 12 13 13 14 //#define PMPRINTF … … 235 236 236 237 237 #if 1 /*PLF Mon 97-09-08 20:04:28*/ 238 /***************************************************************************** 239 * Standard Version * 240 *****************************************************************************/ 241 238 242 static FILE *flog = NULL; /*PLF Mon 97-09-08 20:00:15*/ 239 243 static BOOL init = FALSE; 244 static BOOL fLogging = TRUE; 240 245 241 246 int SYSTEM EXPORT WriteLog(char *tekst, ...) 242 247 { 248 USHORT sel = RestoreOS2FS(); 243 249 va_list argptr; 250 244 251 if(!init) 245 252 { 246 253 init = TRUE; 247 if(!getenv("NODSOUNDLOG")) 248 flog = fopen("DSOUND.log", "w"); 249 } 250 251 if(flog) 254 255 if(!getenv("NODSOUNDLOG")) { 256 char logname[CCHMAXPATH]; 257 258 flog = fopen("DSOUND.log", "w"); 259 if(flog == NULL) {//probably running exe on readonly device 260 sprintf(logname, "%sdsound.log", dsoundPath); 261 flog = fopen(logname, "w"); 262 } 263 } 264 else 265 fLogging = FALSE; 266 } 267 268 if(fLogging && flog) 252 269 { 253 va_start(argptr, tekst); 254 vfprintf(flog, tekst, argptr); 255 va_end(argptr); 256 fflush(flog); 257 } 270 va_start(argptr, tekst); 271 vfprintf(flog, tekst, argptr); 272 va_end(argptr); 273 274 if(tekst[strlen(tekst)-1] != '\n') 275 fprintf(flog, "\n"); 276 } 277 278 SetFS(sel); 258 279 return 1; 259 280 } 260 #else /*PLF Mon 97-09-08 20:04:26*/ 261 /******************************************************************************/ 262 static BOOL init = FALSE; 263 static BOOL fLog = TRUE; 264 /******************************************************************************/ 265 int SYSTEM EXPORT WriteLog(char *tekst, ...) 266 { 267 ULONG Action, Wrote; 268 HFILE log; 269 APIRET rc; 270 char message[4096]; 271 va_list argptr; 272 ULONG openFlags = OPEN_ACTION_CREATE_IF_NEW; 273 274 if(fLog == FALSE) 275 return(FALSE); 276 277 if(!init) 278 { 279 init = TRUE; 280 openFlags |= OPEN_ACTION_REPLACE_IF_EXISTS; 281 if(getenv("NOWIN32LOG")) 282 fLog = FALSE; 283 } 284 else 285 openFlags |= OPEN_ACTION_OPEN_IF_EXISTS; 286 287 rc = DosOpen( "win32os2.log", 288 &log, /* file handle returned */ 289 &Action, 290 0L, 291 FILE_NORMAL, 292 openFlags, 293 OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE, 294 (PEAOP2)NULL); 295 296 rc = DosSetFilePtr(log, 0, FILE_END, &Wrote); 297 va_start(argptr, tekst); 298 vsprintf(message, tekst, argptr); 299 va_end(argptr); 300 301 rc = DosWrite(log, message, strlen(message), &Wrote); 302 303 DosClose(log); /*PLF Mon 97-09-08 20:01:43*/ 304 return(TRUE); 281 //****************************************************************************** 282 //NOTE: No need to save/restore FS, as our FS selectors have already been 283 // destroyed and FS == 0x150B. 284 //****************************************************************************** 285 void CloseLogFile() 286 { 287 fclose(flog); 288 flog = 0; 305 289 } 306 #endif /*PLF Mon 97-09-08 20:04:23*/307 /******************************************************************************/308 /******************************************************************************/309 310 311 290 #endif
Note:
See TracChangeset
for help on using the changeset viewer.