more tweaks to binlogs
This commit is contained in:
parent
44a17fe646
commit
45b67b6e2c
|
@ -202,21 +202,12 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...)
|
|||
}
|
||||
case BinLog_NativeError:
|
||||
{
|
||||
int file;
|
||||
int err = va_arg(ap, int);
|
||||
const char *msg = va_arg(ap, const char *);
|
||||
short len = (short)strlen(msg);
|
||||
fwrite(&err, sizeof(int), 1, fp);
|
||||
fwrite(&len, sizeof(short), 1, fp);
|
||||
fwrite(msg, sizeof(char), len+1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BinLog_CallPubFunc:
|
||||
|
@ -236,13 +227,21 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...)
|
|||
}
|
||||
case BinLog_SetLine:
|
||||
{
|
||||
int file;
|
||||
int line = va_arg(ap, int);
|
||||
fwrite(&line, sizeof(int), 1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BinLog_FormatString:
|
||||
{
|
||||
int file;
|
||||
int param = va_arg(ap, int);
|
||||
int maxlen = va_arg(ap, int);
|
||||
const char *str = va_arg(ap, const char *);
|
||||
|
@ -251,56 +250,29 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...)
|
|||
fwrite(&maxlen, sizeof(int), 1, fp);
|
||||
fwrite(&len, sizeof(short), 1, fp);
|
||||
fwrite(str, sizeof(char), len+1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BinLog_NativeParams:
|
||||
{
|
||||
int file;
|
||||
cell *params = va_arg(ap, cell *);
|
||||
cell num = params[0] / sizeof(cell);
|
||||
fwrite(&num, sizeof(cell), 1, fp);
|
||||
for (cell i=1; i<=num; i++)
|
||||
fwrite(&(params[i]), sizeof(cell), 1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BinLog_GetString:
|
||||
{
|
||||
int file;
|
||||
cell addr = va_arg(ap, cell);
|
||||
const char *str = va_arg(ap, const char *);
|
||||
short len = (short)strlen(str);
|
||||
fwrite(&addr, sizeof(cell), 1, fp);
|
||||
fwrite(&len, sizeof(short), 1, fp);
|
||||
fwrite(str, sizeof(char), len+1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BinLog_SetString:
|
||||
{
|
||||
int file;
|
||||
cell addr = va_arg(ap, cell);
|
||||
int maxlen = va_arg(ap, int);
|
||||
const char *str = va_arg(ap, const char *);
|
||||
|
@ -309,14 +281,6 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...)
|
|||
fwrite(&maxlen, sizeof(int), 1, fp);
|
||||
fwrite(&len, sizeof(short), 1, fp);
|
||||
fwrite(str, sizeof(char), len+1, fp);
|
||||
if (debug)
|
||||
{
|
||||
file = LookupFile(dbg, amx->cip);
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
} else {
|
||||
file = 0;
|
||||
fwrite(&file, sizeof(int), 1, fp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -38,28 +38,19 @@
|
|||
* float gametime
|
||||
* int32 plugin id
|
||||
* <extra info>
|
||||
* Following operation codes will have an extra int for filename
|
||||
* If filename is 0 skip as plugin was not in debug mode, if -1 there was an error.
|
||||
* NativeCall
|
||||
* NativeRet
|
||||
* NativeError
|
||||
* CallPubFunc
|
||||
* FormatString
|
||||
* NativeParams
|
||||
* GetString
|
||||
* SetString
|
||||
* ]
|
||||
* If filename id is 0 skip as plugin was not in debug mode, if -1 there was an error.
|
||||
*/
|
||||
|
||||
enum BinLogOp
|
||||
{
|
||||
BinLog_Start=1,
|
||||
BinLog_End,
|
||||
BinLog_NativeCall, //<int32 native id> <int32_t num_params>
|
||||
BinLog_NativeCall, //<int32 native id> <int32_t num_params> <int32_t filename id>
|
||||
BinLog_NativeError, //<int32 errornum> <str[int16] string>
|
||||
BinLog_NativeRet, //<cell value>
|
||||
BinLog_CallPubFunc, //<int32 public id>
|
||||
BinLog_SetLine, //<int32 line no#>
|
||||
BinLog_NativeRet, //<cell value> <int32_t filename id>
|
||||
BinLog_CallPubFunc, //<int32 public id> <int32_t filename id>
|
||||
BinLog_SetLine, //<int32 line no#> <int32_t filename id>
|
||||
BinLog_Registered, //<string title> <string version>
|
||||
BinLog_FormatString, //<int32 param#> <int32 maxlen> <str[int16] string>
|
||||
BinLog_NativeParams, //<int32 num> <cell ...>
|
||||
|
|
Loading…
Reference in New Issue
Block a user