@@ -41,7 +41,7 @@ void Message(const char *msg, ...)
41
41
char buf[1024 ] = {};
42
42
V_vsnprintf (buf, sizeof (buf) - 1 , msg, args);
43
43
44
- ConColorMsg ( Color (0 , 255 , 200 ), " [MultiAddonManager] %s" , buf);
44
+ LoggingSystem_Log ( 20 , LS_MESSAGE, Color (0 , 255 , 200 ), " [MultiAddonManager] %s" , buf);
45
45
46
46
va_end (args);
47
47
}
@@ -54,7 +54,7 @@ void Panic(const char *msg, ...)
54
54
char buf[1024 ] = {};
55
55
V_vsnprintf (buf, sizeof (buf) - 1 , msg, args);
56
56
57
- Warning ( " [MultiAddonManager] %s" , buf);
57
+ LoggingSystem_Log ( 20 , LS_WARNING, Color ( 255 , 255 , 0 ), " [MultiAddonManager] %s" , buf);
58
58
59
59
va_end (args);
60
60
}
@@ -124,7 +124,7 @@ bool MultiAddonManager::Load(PluginId id, ISmmAPI *ismm, char *error, size_t max
124
124
}
125
125
else if (sig_error == SIG_FOUND_MULTIPLE)
126
126
{
127
- Warning (" Signature for SendNetMessage occurs multiple times! Using first match but this might end up crashing!\n " );
127
+ Panic (" Signature for SendNetMessage occurs multiple times! Using first match but this might end up crashing!\n " );
128
128
}
129
129
130
130
g_pfnHostStateRequest = (HostStateRequest_t)pEngineModule->FindSignature (HostStateRequest_Sig, sizeof (HostStateRequest_Sig) - 1 , sig_error);
@@ -190,7 +190,7 @@ bool MultiAddonManager::Unload(char *error, size_t maxlen)
190
190
191
191
CUtlVector<std::string> g_vecMountedAddons;
192
192
193
- void BuildAddonPath (const char *pszAddon, char *buf, size_t len)
193
+ void MultiAddonManager:: BuildAddonPath (const char *pszAddon, char *buf, size_t len)
194
194
{
195
195
// The workshop is stored relative to the working directory for whatever reason
196
196
static CBufferStringGrowable<MAX_PATH> s_sWorkingDir;
@@ -199,7 +199,7 @@ void BuildAddonPath(const char *pszAddon, char *buf, size_t len)
199
199
V_snprintf (buf, len, " %ssteamapps/workshop/content/730/%s/%s.vpk" , s_sWorkingDir.Get (), pszAddon, pszAddon);
200
200
}
201
201
202
- bool MountAddon (const char *pszAddon, bool bAddToTail = false )
202
+ bool MultiAddonManager:: MountAddon (const char *pszAddon, bool bAddToTail = false )
203
203
{
204
204
if (!pszAddon || !*pszAddon)
205
205
return false ;
@@ -209,13 +209,13 @@ bool MountAddon(const char *pszAddon, bool bAddToTail = false)
209
209
210
210
if (!g_pFullFileSystem->FileExists (path))
211
211
{
212
- Panic (" Addon %s not found at %s\n " , pszAddon, path);
212
+ Panic (__FUNCTION__ " : Addon %s not found at %s\n " , pszAddon, path);
213
213
return false ;
214
214
}
215
215
216
216
if (g_vecMountedAddons.Find (pszAddon) != -1 )
217
217
{
218
- Panic (" Addon %s is already mounted\n " , pszAddon);
218
+ Panic (__FUNCTION__ " : Addon %s is already mounted\n " , pszAddon);
219
219
return false ;
220
220
}
221
221
@@ -227,7 +227,7 @@ bool MountAddon(const char *pszAddon, bool bAddToTail = false)
227
227
return true ;
228
228
}
229
229
230
- bool UnmountAddon (const char *pszAddon)
230
+ bool MultiAddonManager:: UnmountAddon (const char *pszAddon)
231
231
{
232
232
if (!pszAddon || !*pszAddon)
233
233
return false ;
@@ -245,19 +245,19 @@ bool UnmountAddon(const char *pszAddon)
245
245
return true ;
246
246
}
247
247
248
- void DownloadAddon (const char *pszAddon, bool bForce = false )
248
+ void MultiAddonManager:: DownloadAddon (const char *pszAddon, bool bForce = false )
249
249
{
250
250
if (!g_SteamAPI.SteamUGC ())
251
251
{
252
- Panic (" Cannot download addons as the Steam API is not initialized\n " );
252
+ Panic (__FUNCTION__ " : Cannot download addons as the Steam API is not initialized\n " );
253
253
return ;
254
254
}
255
255
256
256
PublishedFileId_t addon = V_StringToUint64 (pszAddon, 0 );
257
257
258
258
if (addon == 0 )
259
259
{
260
- Panic (" Invalid addon %s\n " , pszAddon);
260
+ Panic (__FUNCTION__ " : Invalid addon %s\n " , pszAddon);
261
261
return ;
262
262
}
263
263
@@ -271,16 +271,16 @@ void DownloadAddon(const char *pszAddon, bool bForce = false)
271
271
272
272
if (!g_SteamAPI.SteamUGC ()->DownloadItem (addon, true ))
273
273
{
274
- Panic (" Addon download for %lli failed to start, addon ID is invalid or server is not logged on Steam\n " , addon);
274
+ Panic (__FUNCTION__ " : Addon download for %lli failed to start, addon ID is invalid or server is not logged on Steam\n " , addon);
275
275
return ;
276
276
}
277
277
278
278
Message (" Addon download started for %lli\n " , addon);
279
279
}
280
280
281
- void RefreshAddons ()
281
+ void MultiAddonManager:: RefreshAddons ()
282
282
{
283
- Message (" Refreshing addons\n " );
283
+ Message (" Refreshing addons (%s) \n " , g_sExtraAddons );
284
284
285
285
// Remove our paths first in case addons were switched
286
286
FOR_EACH_VEC_BACK (g_vecMountedAddons, i)
@@ -311,7 +311,7 @@ void MultiAddonManager::OnAddonDownloaded(DownloadItemResult_t *pResult)
311
311
{
312
312
if (pResult->m_eResult != k_EResultOK)
313
313
{
314
- Panic (" Addon %lli download failed with status %i\n " , pResult->m_nPublishedFileId , pResult->m_eResult );
314
+ Panic (__FUNCTION__ " : Addon %lli download failed with status %i\n " , pResult->m_nPublishedFileId , pResult->m_eResult );
315
315
return ;
316
316
}
317
317
@@ -340,7 +340,7 @@ CON_COMMAND_F(mm_extra_addons, "The workshop IDs of extra addons separated by co
340
340
g_vecExtraAddons.PurgeAndDeleteElements ();
341
341
V_SplitString (g_sExtraAddons.c_str (), " ," , g_vecExtraAddons);
342
342
343
- RefreshAddons ();
343
+ g_MultiAddonManager. RefreshAddons ();
344
344
}
345
345
346
346
CON_COMMAND_F (mm_download_addon, " Download and mount an addon manually (server only)" , FCVAR_GAMEDLL | FCVAR_RELEASE | FCVAR_SPONLY)
@@ -450,7 +450,7 @@ ClientJoinInfo_t *GetPendingClient(INetChannel *pNetChan)
450
450
451
451
void MultiAddonManager::Hook_StartupServer (const GameSessionConfiguration_t &config, ISource2WorldSession *, const char *)
452
452
{
453
- Message (" Hook_StartupServer : %s\n " , g_pEngineServer->GetServerGlobals ()->mapname );
453
+ Message (__FUNCTION__ " : %s\n " , g_pEngineServer->GetServerGlobals ()->mapname );
454
454
455
455
g_pNetworkGameServer = g_pNetworkServerService->GetIGameServer ();
456
456
g_ClientsPendingAddon.RemoveAll ();
@@ -477,7 +477,7 @@ void FASTCALL Hook_SendNetMessage(INetChannel *pNetChan, INetworkSerializable *p
477
477
478
478
if (pPendingClient)
479
479
{
480
- Message (" Detour_SendNetMessage : Sending addon %s to client %lli\n " , g_vecExtraAddons[pPendingClient->addon ], pPendingClient->steamid );
480
+ Message (__FUNCTION__ " : Sending addon %s to client %lli\n " , g_vecExtraAddons[pPendingClient->addon ], pPendingClient->steamid );
481
481
482
482
CNETMsg_SignonState *pMsg = (CNETMsg_SignonState *)pData;
483
483
pMsg->set_addons (g_vecExtraAddons[pPendingClient->addon ]);
@@ -497,7 +497,7 @@ void* FASTCALL Hook_HostStateRequest(void *a1, void **pRequest)
497
497
// This offset hasn't changed in 6 years so it should be safe
498
498
CUtlString *sAddonString = (CUtlString *)(pRequest + 11 );
499
499
500
- Message (" Hook_HostStateRequest : appending \" %s\" to addon string \" %s\"\n " , g_sExtraAddons.c_str (), sAddonString ->Get ());
500
+ Message (__FUNCTION__ " : appending \" %s\" to addon string \" %s\"\n " , g_sExtraAddons.c_str (), sAddonString ->Get ());
501
501
502
502
// addons are simply comma-delimited, can have any number of them
503
503
if (!sAddonString ->IsEmpty ())
@@ -517,7 +517,7 @@ bool MultiAddonManager::Hook_ClientConnect( CPlayerSlot slot, const char *pszNam
517
517
if (g_vecExtraAddons.Count () == 0 )
518
518
RETURN_META_VALUE (MRES_IGNORED, true );
519
519
520
- Message (" Client %s (%lli) " , pszName, xuid);
520
+ Message (" Client %s (%lli) connected: \n " , pszName, xuid);
521
521
522
522
// Store the client's ID temporarily as they will get reconnected once an extra addon is sent
523
523
// This gets checked for in SendNetMessage so we don't repeatedly send the changelevel signon state for the same addon
@@ -529,7 +529,7 @@ bool MultiAddonManager::Hook_ClientConnect( CPlayerSlot slot, const char *pszNam
529
529
if (!pPendingClient)
530
530
{
531
531
// Client joined for the first time or after a timeout
532
- ConColorMsg ( Color ( 0 , 255 , 200 ), " connected for the first time , sending addon %s\n " , g_vecExtraAddons[0 ]);
532
+ Message ( " first connection , sending addon %s\n " , g_vecExtraAddons[0 ]);
533
533
AddPendingClient (xuid);
534
534
}
535
535
else if ((Plat_FloatTime () - pPendingClient->signon_timestamp ) < g_flRejoinTimeout)
@@ -540,17 +540,17 @@ bool MultiAddonManager::Hook_ClientConnect( CPlayerSlot slot, const char *pszNam
540
540
541
541
if (pPendingClient->addon < g_vecExtraAddons.Count ())
542
542
{
543
- ConColorMsg ( Color ( 0 , 255 , 200 ), " has reconnected within the interval, sending next addon %s\n " , g_vecExtraAddons[pPendingClient->addon ]);
543
+ Message ( " reconnected within the interval, sending next addon %s\n " , g_vecExtraAddons[pPendingClient->addon ]);
544
544
}
545
545
else
546
546
{
547
- ConColorMsg ( Color ( 0 , 255 , 200 ), " has reconnected within the interval and has all addons, allowing\n " );
547
+ Message ( " reconnected within the interval and has all addons, allowing\n " );
548
548
g_ClientsPendingAddon.FastRemove (index );
549
549
}
550
550
}
551
551
else
552
552
{
553
- ConColorMsg ( Color ( 0 , 255 , 200 ), " has reconnected after the timeout or did not receive the addon message, will resend addon %s\n " , g_vecExtraAddons[pPendingClient->addon ]);
553
+ Message ( " reconnected after the timeout or did not receive the addon message, will resend addon %s\n " , g_vecExtraAddons[pPendingClient->addon ]);
554
554
}
555
555
556
556
RETURN_META_VALUE (MRES_IGNORED, true );
0 commit comments