diff --git a/code/__defines/byond_tracy.dm b/code/__defines/byond_tracy.dm index 457636d295f5f..e1f5c42c07c1b 100644 --- a/code/__defines/byond_tracy.dm +++ b/code/__defines/byond_tracy.dm @@ -1,31 +1,33 @@ // Implements https://github.com/mafemergency/byond-tracy // Client https://github.com/wolfpld/tracy -// As of now, only 0.8.2 is supported as a client, this might change in the future however -// In case you need to start the capture as soon as the server boots, uncomment the following lines and recompile: -// /world/New() -// prof_init() -// . = ..() +#ifdef PROFILE_FROM_BOOT +/world/New() + profiler_init() + return ..() +#endif -/client/proc/profiler_start() - set name = "Start Tracy Profiler" + +/client/proc/profiler_init_verb() + set name = "Start Profiler" set category = "Debug" set desc = "Starts the tracy profiler, which will await the client connection." - switch(alert("Are you sure? Tracy will remain active until the server restarts.", "Tracy Init", "No", "Yes")) - if("Yes") - prof_init() + var/response = alert("Are you sure? The profiler will run until restart.", null, "No", "Yes") + if (response != "Yes") + return + profiler_init() -/** - * Starts Tracy - */ -/proc/prof_init() +/// Starts the profiler. +/proc/profiler_init() var/lib - - switch(world.system_type) - if(MS_WINDOWS) lib = "prof.dll" - if(UNIX) lib = "libprof.so" - else CRASH("Tracy initialization failed: unsupported platform or DLL not found.") - + switch (world.system_type) + if (MS_WINDOWS) + lib = "tracy.dll" + if (UNIX) + lib = "tracy.so" + else + CRASH("Tracy initialization failed: unsupported platform or DLL not found.") var/init = CALL_EXT(lib, "init")() - if("0" != init) CRASH("[lib] init error: [init]") + if(init != "0") + CRASH("[lib] init error: [init]") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 7fd8e6ac516af..f1cc03276b3e1 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -215,7 +215,7 @@ var/global/list/admin_verbs_debug = list( /client/proc/reload_webhooks, /client/proc/toggle_planet_repopulating, /client/proc/spawn_exoplanet, - /client/proc/profiler_start + /client/proc/profiler_init_verb ) var/global/list/admin_verbs_paranoid_debug = list( diff --git a/tracy.dll b/tracy.dll new file mode 100644 index 0000000000000..7c11dff70829f Binary files /dev/null and b/tracy.dll differ diff --git a/tracy.so b/tracy.so new file mode 100644 index 0000000000000..f9c8845b866e6 Binary files /dev/null and b/tracy.so differ