Implemented json write funcs for netmessages

This commit is contained in:
Jordan Cristiano 2015-06-24 23:59:39 -04:00
parent 65a03fdf79
commit fea8bf485c
31 changed files with 281 additions and 30 deletions

View File

@ -1,6 +1,7 @@
#include "net_disconnect.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -23,6 +24,9 @@ namespace NetHandlers
bool Net_Disconnect_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_Disconnect* data)
{
jsonbuf.StartObject("net_disconnect");
jsonbuf.WriteString("message", data->message);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "net_file.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -27,6 +28,11 @@ namespace NetHandlers
bool Net_File_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_File* data)
{
jsonbuf.StartObject("net_file");
jsonbuf.WriteUInt32("transferId", data->transferID);
jsonbuf.WriteString("filename", data->filename);
jsonbuf.WriteBool("isRequest", data->isRequest);
jsonbuf.EndObject();
return true;
}

View File

@ -1,5 +1,6 @@
#include "net_nop.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -20,6 +21,8 @@ namespace NetHandlers
bool Net_NOP_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_NOP* data)
{
jsonbuf.StartObject("net_nop");
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "net_setconvar.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -35,6 +36,17 @@ namespace NetHandlers
bool Net_SetConVar_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_SetConVar* data)
{
jsonbuf.StartObject("net_setconvar");
jsonbuf.StartArray("cvars");
for (cvar_t& cvar : data->cvars)
{
jsonbuf.StartObject();
jsonbuf.WriteString("name", cvar.name);
jsonbuf.WriteString("value", cvar.value);
jsonbuf.EndObject();
}
jsonbuf.EndArray();
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "net_signonstate.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -26,6 +27,10 @@ namespace NetHandlers
bool Net_SignonState_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_SignonState* data)
{
jsonbuf.StartObject("net_signonstate");
jsonbuf.WriteUInt32("signonState", data->signonState);
jsonbuf.WriteUInt32("spawnCount", data->spawnCount);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "net_stringcmd.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -23,6 +24,9 @@ namespace NetHandlers
bool Net_StringCmd_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_StringCmd* data)
{
jsonbuf.StartObject("net_stringcmd");
jsonbuf.WriteString("command", data->command);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "net_tick.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -27,6 +28,11 @@ namespace NetHandlers
bool Net_Tick_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::Net_Tick* data)
{
jsonbuf.StartObject("net_tick");
jsonbuf.WriteInt32("tick", data->tick);
jsonbuf.WriteUInt32("hostFrameTime", data->hostFrameTime);
jsonbuf.WriteUInt32("hostFrameTimeStdDev", data->hostFrameTimeStdDev);
jsonbuf.EndObject();
return true;
}

View File

@ -4,13 +4,18 @@
#include <cstdint>
#include <sstream>
namespace base
{
class JsonWriterFile;
}
class bf_read;
class bf_write;
using BitRead = bf_read;
using BitWrite = bf_write;
class JsonRead;
class JsonWrite;
using JsonWrite = base::JsonWriterFile;
struct SourceGameContext
{

View File

@ -1,6 +1,7 @@
#include "svc_bspdecal.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
namespace NetHandlers
@ -48,6 +49,17 @@ namespace NetHandlers
bool SVC_BSPDecal_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_BSPDecal* data)
{
jsonbuf.StartObject("svc_bspdecal");
jsonbuf.StartObject("position");
jsonbuf.WriteFloat("x", data->position.x);
jsonbuf.WriteFloat("y", data->position.y);
jsonbuf.WriteFloat("z", data->position.z);
jsonbuf.EndObject();
jsonbuf.WriteUInt32("decalTextureIndex", data->decalTextureIndex);
jsonbuf.WriteUInt32("entIndex", data->entIndex);
jsonbuf.WriteUInt32("modelIndex", data->modelIndex);
jsonbuf.WriteBool("lowPriority", data->lowPriority);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_classinfo.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
using class_t = NetMsg::SVC_ClassInfo::class_t;
@ -51,6 +52,21 @@ namespace NetHandlers
bool SVC_ClassInfo_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_ClassInfo* data)
{
jsonbuf.StartObject("svc_classinfo");
jsonbuf.WriteInt32("numServerClasses", data->numServerClasses);
jsonbuf.WriteBool("createOnClient", data->createOnClient);
if (!data->createOnClient)
{
jsonbuf.StartArray("serverClasses");
for (class_t& serverClass : data->serverClasses)
{
jsonbuf.WriteUInt32("classId", serverClass.classID);
jsonbuf.WriteString("className", serverClass.className);
jsonbuf.WriteString("dataTableName", serverClass.dataTableName);
}
jsonbuf.EndArray();
}
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_createstringtable.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
#include "netcontants.h"
@ -86,6 +87,21 @@ namespace NetHandlers
bool SVC_CreateStringTable_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_CreateStringTable* data)
{
jsonbuf.StartObject("svc_createstringtable");
jsonbuf.WriteBool("isFilenames", data->isFileNames);
jsonbuf.WriteString("tableName", data->tableName);
jsonbuf.WriteUInt32("maxEntries", data->maxEntries);
jsonbuf.WriteUInt32("numEntries", data->numEntries);
jsonbuf.WriteInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBool("isUserDataFixedSize", data->isUserDataFixedSize);
jsonbuf.WriteUInt32("userDataSize", data->userDataSize);
jsonbuf.WriteUInt32("userDataSizeBits", data->userDataSizeBits);
if (context.protocol > 14)
{
jsonbuf.WriteBool("unk1", data->unk1);
}
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_crosshairangle.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include <iomanip>
namespace NetHandlers
@ -28,6 +29,13 @@ namespace NetHandlers
bool SVC_CrosshairAngle_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
{
jsonbuf.StartObject("svc_crosshairangle");
jsonbuf.StartObject("angle");
jsonbuf.WriteFloat("pitch", data->x);
jsonbuf.WriteFloat("yaw", data->y);
jsonbuf.WriteFloat("roll", data->z);
jsonbuf.EndObject();
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_entitymessage.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
#include "netmath.h"
@ -32,6 +33,12 @@ namespace NetHandlers
bool SVC_EntityMessage_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_EntityMessage* data)
{
jsonbuf.StartObject("svc_entitymessage");
jsonbuf.WriteUInt32("entIndex", data->entIndex);
jsonbuf.WriteUInt32("classId", data->classID);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_fixangle.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include <iomanip>
namespace NetHandlers
@ -30,6 +31,14 @@ namespace NetHandlers
bool SVC_FixAngle_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_FixAngle* data)
{
jsonbuf.StartObject("svc_fixangle");
jsonbuf.WriteBool("relative", data->relative);
jsonbuf.StartObject("angle");
jsonbuf.WriteFloat("pitch", data->x);
jsonbuf.WriteFloat("yaw", data->y);
jsonbuf.WriteFloat("roll", data->z);
jsonbuf.EndObject();
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_gameevent.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
#include "netmath.h"
@ -28,6 +29,10 @@ namespace NetHandlers
bool SVC_GameEvent_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_GameEvent* data)
{
jsonbuf.StartObject("svc_gameevent");
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_gameeventlist.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
#include "netmath.h"
@ -53,6 +54,26 @@ namespace NetHandlers
bool SVC_GameEventList_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_GameEventList* data)
{
jsonbuf.StartObject("svc_gameeventlist");
jsonbuf.StartArray("eventDescriptors");
for (const EventDescriptor& event : data->eventDescriptors)
{
jsonbuf.StartObject();
jsonbuf.WriteUInt32("id", event.id);
jsonbuf.WriteString("name", event.name);
jsonbuf.StartArray("values");
for (const EventValue& value : event.values)
{
jsonbuf.StartObject();
jsonbuf.WriteUInt32("type", value.type);
jsonbuf.WriteString("name", value.name);
jsonbuf.EndObject();
}
jsonbuf.EndArray();
jsonbuf.EndObject();
}
jsonbuf.EndArray();
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_getcvarvalue.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -25,6 +26,10 @@ namespace NetHandlers
bool SVC_GetCvarValue_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_GetCvarValue* data)
{
jsonbuf.StartObject("svc_getcvarvalue");
jsonbuf.WriteInt32("cookie", data->cookie);
jsonbuf.WriteString("cvarName", data->cvarName);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_menu.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
using DialogType = NetMsg::SVC_Menu::DialogType;
@ -41,6 +42,11 @@ namespace NetHandlers
bool SVC_Menu_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_Menu* data)
{
jsonbuf.StartObject("svc_menu");
jsonbuf.WriteInt32("dialogType", static_cast<int16_t>(data->type));
jsonbuf.WriteUInt32("dataLengthInBytes", data->dataLengthInBytes);
jsonbuf.WriteBytes("data", data->menuBinaryKeyValues.get(), data->dataLengthInBytes);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_packetentities.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
#include "netmath.h"
@ -54,6 +55,16 @@ namespace NetHandlers
bool SVC_PacketEntities_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_PacketEntities* data)
{
jsonbuf.StartObject("svc_packetentities");
jsonbuf.WriteInt32("maxEntries", data->maxEntries);
jsonbuf.WriteBool("isDelta", data->isDelta);
jsonbuf.WriteInt32("deltaFromTick", data->deltaFromTick);
jsonbuf.WriteUInt32("baselineIndex", data->baselineIndex);
jsonbuf.WriteUInt32("numUpdatedEntries", data->numUpdatedEntries);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBool("updateBaseline", data->updateBaseline);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_prefetch.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
namespace NetHandlers
@ -39,6 +40,10 @@ namespace NetHandlers
bool SVC_Prefetch_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_Prefetch* data)
{
jsonbuf.StartObject("svc_prefetch");
jsonbuf.WriteUInt32("type", data->type);
jsonbuf.WriteUInt32("soundIndex", data->soundIndex);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_print.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -23,6 +24,9 @@ namespace NetHandlers
bool SVC_Print_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_Print* data)
{
jsonbuf.StartObject("svc_print");
jsonbuf.WriteString("text", data->text);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_sendtable.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
namespace NetHandlers
@ -29,6 +30,11 @@ namespace NetHandlers
bool SVC_SendTable_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_SendTable* data)
{
jsonbuf.StartObject("svc_sendtable");
jsonbuf.WriteBool("needsDecoder", data->needsDecoder);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_serverinfo.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -73,6 +74,34 @@ namespace NetHandlers
bool SVC_ServerInfo_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_ServerInfo* data)
{
jsonbuf.StartObject("svc_serverinfo");
jsonbuf.WriteInt32("protocol", data->protocol);
jsonbuf.WriteUInt32("serverCount", data->serverCount);
jsonbuf.WriteBool("isHltv", data->isHLTV);
jsonbuf.WriteBool("isDedicated", data->isDedicated);
jsonbuf.WriteUInt32("clientCrc", data->clientCRC);
jsonbuf.WriteUInt32("maxClasses", data->maxClasses);
if (context.protocol <= 17)
{
jsonbuf.WriteUInt32("mapCRC", data->mapCRC);
}
else
{
jsonbuf.WriteBytes("unk1", data->unk1, sizeof(data->unk1));
}
jsonbuf.WriteUInt32("playerSlot", data->playerSlot);
jsonbuf.WriteUInt32("maxClients", data->maxClients);
jsonbuf.WriteFloat("tickInterval", data->tickInterval);
jsonbuf.WriteString("os", &data->os, 1);
jsonbuf.WriteString("gameDir", data->gameDir);
jsonbuf.WriteString("mapName", data->mapName);
jsonbuf.WriteString("skyName", data->skyName);
jsonbuf.WriteString("hostName", data->hostName);
if (context.protocol > 15)
{
jsonbuf.WriteBool("unk2", data->unk2);
}
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_setpause.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -23,6 +24,9 @@ namespace NetHandlers
bool SVC_SetPause_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_SetPause* data)
{
jsonbuf.StartObject("svc_setpause");
jsonbuf.WriteBool("isPaused", data->isPaused);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_setview.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
namespace NetHandlers
@ -24,6 +25,9 @@ namespace NetHandlers
bool SVC_SetView_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_SetView* data)
{
jsonbuf.StartObject("svc_setview");
jsonbuf.WriteUInt32("entIndex", data->entIndex);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_sounds.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
namespace NetHandlers
@ -47,6 +48,12 @@ namespace NetHandlers
bool SVC_Sounds_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_Sounds* data)
{
jsonbuf.StartObject("svc_sounds");
jsonbuf.WriteBool("reliableSound", data->reliableSound);
jsonbuf.WriteUInt32("numSounds", data->numSounds);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_tempentities.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netcontants.h"
#include "netmath.h"
@ -44,6 +45,11 @@ namespace NetHandlers
bool SVC_TempEntities_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_TempEntities* data)
{
jsonbuf.StartObject("svc_tempentities");
jsonbuf.WriteUInt32("numEntries", data->numEntries);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_updatestringtable.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
#include "netcontants.h"
@ -40,6 +41,12 @@ namespace NetHandlers
bool SVC_UpdateStringTable_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_UpdateStringTable* data)
{
jsonbuf.StartObject("svc_updatestringtable");
jsonbuf.WriteUInt32("tableId", data->tableID);
jsonbuf.WriteUInt32("numChangedEntries", data->numChangedEntries);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_usermessage.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
#include "netcontants.h"
#include <cassert>
@ -32,6 +33,11 @@ namespace NetHandlers
bool SVC_UserMessage_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_UserMessage* data)
{
jsonbuf.StartObject("svc_usermessage");
jsonbuf.WriteUInt32("msgType", data->msgType);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_voicedata.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
#include "netmath.h"
namespace NetHandlers
@ -31,6 +32,12 @@ namespace NetHandlers
bool SVC_VoiceData_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_VoiceData* data)
{
jsonbuf.StartObject("svc_voicedata");
jsonbuf.WriteUInt32("fromClientIndex", data->fromClientIndex);
jsonbuf.WriteBool("proximity", data->proximity);
jsonbuf.WriteUInt32("dataLengthInBits", data->dataLengthInBits);
jsonbuf.WriteBits("data", data->data.get(), data->dataLengthInBits);
jsonbuf.EndObject();
return true;
}

View File

@ -1,6 +1,7 @@
#include "svc_voiceinit.h"
#include "sourcesdk/bitbuf.h"
#include "base/bitfile.h"
#include "base/jsonfile.h"
namespace NetHandlers
{
@ -25,6 +26,10 @@ namespace NetHandlers
bool SVC_VoiceInit_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_VoiceInit* data)
{
jsonbuf.StartObject("svc_voiceinit");
jsonbuf.WriteString("voiceCodec", data->voiceCodec);
jsonbuf.WriteUInt32("quality", data->quality);
jsonbuf.EndObject();
return true;
}