diff options
author | 2025-04-30 22:55:05 +0100 | |
---|---|---|
committer | 2025-04-30 22:55:05 +0100 | |
commit | 7b7cb45f7c1ed307b585ab3506dc57854ec076a6 (patch) | |
tree | c09faf9f8462fd72ecdfc893e0c87aadc692a436 /src/sst.c | |
parent | 45a21380fcc2c9a0b9035814ab0f8cc38165bb64 (diff) | |
download | sst-7b7cb45f7c1ed307b585ab3506dc57854ec076a6.tar.gz sst-7b7cb45f7c1ed307b585ab3506dc57854ec076a6.zip |
Add some useful info printouts to debug builds
Specifically when building in debug mode, we now:
* Display all features on load, including skipped and internal ones,
sorted by internal name instead of display name.
* Print the names of all matched gametype tags after the feature list.
* Add an sst_dbg_getcmdcb command to get the address of a command
callback for quick breakpoint insertion or Ghidra lookup.
* Add an sst_dbg_sendtables command to dump out the full ServerClass
tree to help get names for entprops.txt. Note: this output is very
long so you'll likely need to log console output to a file to be able
to read it all.
There's a bunch of developer experience and debug help stuff I want to
get done eventually. This is just a very small piece, but it's a start.
Diffstat (limited to 'src/sst.c')
-rw-r--r-- | src/sst.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -287,12 +287,24 @@ static const char *updatenotes = "\ * Rewrote and optimised a whole bunch of internal stuff\n\ "; -enum { // used in generated code, must line up with +enum { // used in generated code, must line up with featmsgs arrays below REQFAIL = _FEAT_INTERNAL_STATUSES, NOGD, NOGLOBAL }; -static const char *const featmsgs[] = { // " +#ifdef SST_DBG +static const char *const _featmsgs[] = { + "%s: SKIP\n", + "%s: OK\n", + "%s: FAIL\n", + "%s: INCOMPAT\n", + "%s: REQFAIL\n", + "%s: NOGD\n", + "%s: NOGLOBAL\n" +}; +#define featmsgs (_featmsgs + 1) +#else +static const char *const featmsgs[] = { " [ OK! ] %s\n", " [ FAILED! ] %s (error in initialisation)\n", " [ unsupported ] %s (incompatible with this game or engine)\n", @@ -300,6 +312,7 @@ static const char *const featmsgs[] = { // " " [ unsupported ] %s (missing required gamedata entry)\n", " [ FAILED! ] %s (failed to access engine)\n" }; +#endif static inline void successbanner() { // called by generated code con_colourmsg(&(struct rgba){64, 255, 64, 255}, @@ -336,6 +349,19 @@ static void do_featureinit() { } // ... and now for the real magic! (n.b. this also registers feature cvars) initfeatures(); +#ifdef SST_DBG + struct rgba purple = {192, 128, 240, 255}; + con_colourmsg(&purple, "Matched gametype tags: "); + bool first = true; +#define PRINTTAG(x) \ +if (GAMETYPE_MATCHES(x)) { \ + con_colourmsg(&purple, "%s%s", first ? "" : ", ", #x); \ + first = false; \ +} + GAMETYPE_BASETAGS(PRINTTAG) +#undef PRINTTAG + con_colourmsg(&purple, "\n"); // xkcd 2109-compliant whitespace +#endif // if we're autoloaded and the external autoupdate script downloaded a new // version, let the user know about the cool new stuff! |