Files
firestorm/Gameleap/code/mw4/Code/MW4/nglog.hpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

167 lines
5.6 KiB
C++

// nglog.h - Interface between game module and the ngLog logging layers.
// This is a public layer that can have game-specific dependencies.
// --------------------------------------------------------------------------
// Jason Keimig
// jkeimig@netgamesusa.com
//
// 05 Jan 00
//
/*
* *****************************************************************
* * *
* * Copyright (c) NetGames USA, Inc. 1999, 2000 *
* * *
* * All Rights Reserved. Unpublished rights reserved under the *
* * copyright laws of the United States. *
* * *
* * The software contained on this media is proprietary to and *
* * embodies the confidential technology of NetGames USA, Inc. *
* * Possession, use, duplication or dissemination of the *
* * software and media is authorized only pursuant to a valid *
* * written license from NetGames USA, Inc. *
* * *
* * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
* * by the U.S. Government is subject to restrictions as set *
* * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
* * or in FAR 52.227-19, as applicable. *
* * *
* *****************************************************************
*/
#include <windows.h>
#include <stdio.h>
#if !defined(NO_LOG)
//
// Everything below is expected by the library.
// *** DO NOT ALTER!! ***
//
// Batcher exit code conditions
typedef enum {
EXIT_PROCERR, // Error in getting process exit code
EXIT_NGWSERR, // Batcher is reporting problems
EXIT_RUNNING, // Batcher is still running
EXIT_OKAY // No problems at all
} log_exit_t;
// Logging styles
typedef enum {
STYLE_NONE, // Don't log anything
STYLE_APPEND, // Create/append to any existing log file.
STYLE_NEW, // Create/overwrite any existing log file.
STYLE_ROTATE, // If logname exists, create unique identifier
// and create new logfile with this unique name.
STYLE_NGSTATS, // Use unique names and individual logs for each map.
// Also forces a call to the ngStats backend processor.
STYLE_CONTINUE // Keep current file and just append to it. This
// requires that the logfile has already been
// opened and created with the initial settings
// (i.e. append, rotate, etc.).
} log_style_t;
// Log flushing semantics
typedef enum {
FLUSH_NOW, // Flush on every write.
FLUSH_BUFFER, // Flush after "nglog_buffer" lines written.
FLUSH_SYSTEM // Wait for system to write out buffer.
} log_flush_t;
// Message types
typedef enum {
MSG_INFO, // Progress information
MSG_ERROR, // Internal error
MSG_CRITICAL // Higher-level error
} log_message_t;
// Logging information
typedef struct {
int buffer; // Number of lines to buffer for flushing.
int flush; // Log flushing format.
char *game_name; // Name of game.
char *game_version; // Version of game.
char *game_author; // Author of game.
char *game_url; // Where to find more info on game.
int h_start; // Start of game secret (offset into game secret array)
int h_len; // Length of game secret (length of real secret)
unsigned char *h_refs;// Pointer to Game Secret beginning address.
int id; // Unique ID for worldstats (i.e. UDP port #)
char logname[512]; // Filename to use (under certain log styles)
char ngS_cfg[1024]; // Config file name for ngStats.
int ngS_exec; // Whether or not to call ngStats after every log close.
char ngS_logdir[1024];// Directory to place ngStats logs.
char ngS_name[64]; // Name of ngStats executable.
char ngWS_name[64]; // Name of ngWorldStats gamename.
char path[512]; // Path to root where logs stored and ngWS/ngS can be called.
int style; // Log style format.
int worldstats; // Do we want worldstats enabled?
} nglog_base;
// ngLog-Library exported functions
typedef struct nglog_export_s
{
char *(*LibVersion)(void);
int (*LibShutdown)(void);
char *(*logStart)(nglog_base *, char **);
int (*statusNGWS)(PROCESS_INFORMATION *);
void (*gameEnd)(char *, PROCESS_INFORMATION *);
void (*gameStart)(void);
void (*gameString)(char *);
void (*plChat)(int, char *);
void (*plConnect)(int, char *, unsigned char *, int);
void (*plDeath)(char *, int, int, int, int);
void (*plDisconn)(int, char *);
void (*plEntered)(char *, int, char *);
void (*plRename)(char *, int, char *, char *, int);
void (*plRespawn)(int);
void (*itemPickup)(char *, int, int, int);
void (*itemUse)(char *, int, int, int);
void (*itemExpire)(char *, int);
void (*itemDrop)(char *, int, int, int);
} nglog_export_t;
// ngLog-Library imported functions
typedef struct nglog_import_s
{
// Handle messages passed from the ngLog library
void (*MsgDump)(int, char *, ...);
// Get game-specific time info
char *(*TimeDump)(void);
} nglog_import_t;
// ngLog-Library reference
typedef struct nglog_library_s
{
char path[1024]; // Path to the library
#if defined(WIN32)||defined(_WIN32)
HANDLE handle; // Win32-specific handle to the ngLog Library
#else
void *handle; // Unix "handle" to the ngLog Library
#endif
nglog_export_t *fn; // Functions exported from the ngLog Library
int users; // Number of instances using the library
} nglog_library_t;
#endif // !defined(NO_LOG)