finalized file format

added register op (working)
added msvc8 stuff (4better || 4worse)
This commit is contained in:
David Anderson 2006-03-15 13:43:06 +00:00
parent e208ff0664
commit 3699796bc6
7 changed files with 1644 additions and 14 deletions

View File

@ -33,6 +33,7 @@
#include "amxmodx.h"
#include "natives.h"
#include "debugger.h"
#include "binlog.h"
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
{
@ -1019,9 +1020,17 @@ static cell AMX_NATIVE_CALL register_plugin(AMX *amx, cell *params) /* 3 param *
CPluginMngr::CPlugin* a = g_plugins.findPluginFast(amx);
int i;
a->setTitle(get_amxstring(amx, params[1], 0, i));
a->setVersion(get_amxstring(amx, params[2], 0, i));
a->setAuthor(get_amxstring(amx, params[3], 0, i));
char *title = get_amxstring(amx, params[1], 0, i);
char *vers = get_amxstring(amx, params[2], 1, i);
char *author = get_amxstring(amx, params[3], 2, i);
#if defined BINLOG_ENABLED
g_BinLog.WriteOp(BinLog_Registered, a->getId(), title, vers);
#endif
a->setTitle(title);
a->setVersion(vers);
a->setAuthor(author);
return 1;
}

View File

@ -1,3 +1,4 @@
#include <time.h>
#include "amxmodx.h"
#include "binlog.h"
@ -53,6 +54,42 @@ void BinLog::Close()
//dummy function - logs are not kept open
}
void BinLog::WriteOp(BinLogOp op, int plug, ...)
{
FILE *fp = fopen(m_logfile.c_str(), "ab");
if (!fp)
return;
unsigned char c = static_cast<char>(op);
time_t t = time(NULL);
float gt = gpGlobals->time;
fwrite(&c, sizeof(char), 1, fp);
fwrite(&t, sizeof(time_t), 1, fp);
fwrite(&gt, sizeof(float), 1, fp);
fwrite(&plug, sizeof(int), 1, fp);
va_list ap;
va_start(ap, plug);
switch (c)
{
case BinLog_Registered:
{
const char *title = va_arg(ap, const char *);
const char *vers = va_arg(ap, const char *);
c = (char)strlen(title);
fwrite(&c, sizeof(char), 1, fp);
fwrite(title, sizeof(char), c+1, fp);
c = (char)strlen(vers);
fwrite(&c, sizeof(char), 1 ,fp);
fwrite(vers, sizeof(char), c+1, fp);
break;
}
};
va_end(ap);
}
void BinLog::CacheAllPlugins()
{
FILE *fp = fopen(m_dbfile.c_str(), "wb");
@ -78,16 +115,21 @@ void BinLog::CacheAllPlugins()
c = 1;
else
c = 0;
if (c && pl->isDebug())
c = 2;
fwrite(&c, sizeof(char), 1, fp);
len = (char)strlen(pl->getName());
fwrite(&len, sizeof(char), 1, fp);
len++;
fwrite(pl->getName(), sizeof(char), len, fp);
int objcount;
int natives, publics;
AMX *amx = pl->getAMX();
amx_NumNatives(amx, &objcount);
amx_NumNatives(amx, &natives);
amx_NumPublics(amx, &publics);
fwrite(&natives, sizeof(int), 1, fp);
fwrite(&publics, sizeof(int), 1, fp);
char name[34];
for (int i=0; i<objcount; i++)
for (int i=0; i<natives; i++)
{
amx_GetNative(amx, i, name);
len = (char)strlen(name);
@ -95,8 +137,7 @@ void BinLog::CacheAllPlugins()
len++;
fwrite(name, sizeof(char), len, fp);
}
amx_NumPublics(amx, &objcount);
for (int i=0; i<objcount; i++)
for (int i=0; i<publics; i++)
{
amx_GetPublic(amx, i, name);
len = (char)strlen(name);
@ -120,6 +161,9 @@ void BinLog::CacheAllPlugins()
fwrite(&magic, sizeof(int), 1, fp);
fwrite(&vers, sizeof(short), 1, fp);
fwrite(&c, sizeof(char), 1, fp);
fclose(fp);
WriteOp(BinLog_Start, -1);
}
#endif //BINLOG_ENABLED

View File

@ -25,15 +25,15 @@
* Format of bindb:
* int32_t magic
* int16_t version
* int16_t num plugins
* int32_t num plugins
* [
* int8_t status codes
* str[int8_t] filename
* int8_t valid/loaded?
* int16_t num natives
* int32_t num natives
* int32_t num publics
* [
* str[int8_t] native name
* ]
* int16_t num publics
* [
* str[int8_t] public name
* ]
@ -41,7 +41,7 @@
enum BinLogOp
{
BinLog_Start=0,
BinLog_Start=1,
BinLog_End,
BinLog_NativeCall, //<int16_t native id>
BinLog_CallPubFunc, //<int16_t public id>
@ -55,7 +55,7 @@ public:
bool Open();
void Close();
void CacheAllPlugins();
void WriteOp(BinLogOp op, ...);
void WriteOp(BinLogOp op, int plug, ...);
private:
String m_dbfile;
String m_logfile;

View File

@ -7,8 +7,10 @@ Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
JITDebug = JITDebug
JITDebugBinLog = JITDebugBinLog
JITMemtestRelease = JITMemtestRelease
JITRelease = JITRelease
JITReleaseBinLog = JITReleaseBinLog
MaximalSpeed = MaximalSpeed
MemtestDebug = MemtestDebug
MemtestRelease = MemtestRelease
@ -19,10 +21,14 @@ Global
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.Debug.Build.0 = Debug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebug.ActiveCfg = JITDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebug.Build.0 = JITDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebugBinLog.ActiveCfg = JITDebugBinLog|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebugBinLog.Build.0 = JITDebugBinLog|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITMemtestRelease.ActiveCfg = JITMemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITMemtestRelease.Build.0 = JITMemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITRelease.ActiveCfg = JITRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITRelease.Build.0 = JITRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITReleaseBinLog.ActiveCfg = JITReleaseBinLog|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITReleaseBinLog.Build.0 = JITReleaseBinLog|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MaximalSpeed.ActiveCfg = MaximalSpeed|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MaximalSpeed.Build.0 = MaximalSpeed|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MemtestDebug.ActiveCfg = MemtestDebug|Win32

View File

@ -580,6 +580,153 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITDebugBinLog|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;BINLOG_ENABLED"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
StructMemberAlignment="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\jitdebugbinlog/amxmodx.pch"
AssemblerListingLocation=".\jitdebugbinlog/"
ObjectFile=".\jitdebugbinlog/"
ProgramDataBaseFileName=".\jitdebugbinlog/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj ..\JIT\natives-x86.obj"
OutputFile="jitdebugbinlog/amxmodx_mm.dll"
Version="0.1"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="MSVCRT"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\jitdebugbinlog/amxx_mm.pdb"
ImportLibrary=".\jitdebugbinlog/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITReleaseBinLog|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="0"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32"
IgnoreStandardIncludePath="FALSE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\jitrelease/amxmodx.pch"
AssemblerListingLocation=".\jitrelease/"
ObjectFile=".\jitrelease/"
ProgramDataBaseFileName=".\jitrelease/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj ..\JIT\natives-x86.obj"
OutputFile="jitrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="MSVCRT"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\jitrelease/amxmodx_mm.pdb"
GenerateMapFile="TRUE"
ImportLibrary=".\jitrelease/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
@ -608,6 +755,9 @@
<File
RelativePath="..\amxxlog.cpp">
</File>
<File
RelativePath="..\binlog.cpp">
</File>
<File
RelativePath="..\CCmd.cpp">
</File>
@ -646,6 +796,12 @@
Name="VCCLCompilerTool"
AssemblerOutput="0"/>
</FileConfiguration>
<FileConfiguration
Name="JITReleaseBinLog|Win32">
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CVault.cpp">
@ -679,6 +835,12 @@
Name="VCCLCompilerTool"
AssemblerOutput="4"/>
</FileConfiguration>
<FileConfiguration
Name="JITReleaseBinLog|Win32">
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"/>
</FileConfiguration>
</File>
<File
RelativePath="..\md5.cpp">
@ -712,6 +874,12 @@
Name="VCCLCompilerTool"
AssemblerOutput="2"/>
</FileConfiguration>
<FileConfiguration
Name="JITReleaseBinLog|Win32">
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="2"/>
</FileConfiguration>
</File>
<File
RelativePath="..\strptime.cpp">
@ -757,6 +925,18 @@
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITDebugBinLog|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITReleaseBinLog|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
</Filter>
</Filter>
@ -778,6 +958,9 @@
<File
RelativePath="..\amxxlog.h">
</File>
<File
RelativePath="..\binlog.h">
</File>
<File
RelativePath="..\CCmd.h">
</File>
@ -961,6 +1144,18 @@
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITDebugBinLog|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITReleaseBinLog|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
<File
RelativePath="..\sdk\amxxmodule.h">

View File

@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxmodx", "amxmodx_mm.vcproj", "{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
JITDebug|Win32 = JITDebug|Win32
JITMemtestRelease|Win32 = JITMemtestRelease|Win32
JITRelease|Win32 = JITRelease|Win32
MaximalSpeed|Win32 = MaximalSpeed|Win32
MemtestDebug|Win32 = MemtestDebug|Win32
MemtestRelease|Win32 = MemtestRelease|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.Debug|Win32.ActiveCfg = Debug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.Debug|Win32.Build.0 = Debug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebug|Win32.ActiveCfg = JITDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITDebug|Win32.Build.0 = JITDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITMemtestRelease|Win32.ActiveCfg = JITMemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITMemtestRelease|Win32.Build.0 = JITMemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITRelease|Win32.ActiveCfg = JITRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.JITRelease|Win32.Build.0 = JITRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MaximalSpeed|Win32.ActiveCfg = MaximalSpeed|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MaximalSpeed|Win32.Build.0 = MaximalSpeed|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MemtestDebug|Win32.ActiveCfg = MemtestDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MemtestDebug|Win32.Build.0 = MemtestDebug|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MemtestRelease|Win32.ActiveCfg = MemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.MemtestRelease|Win32.Build.0 = MemtestRelease|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.Release|Win32.ActiveCfg = Release|Win32
{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff