summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gameinfo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gameinfo.c b/src/gameinfo.c
index 10959a6..3713d6c 100644
--- a/src/gameinfo.c
+++ b/src/gameinfo.c
@@ -82,6 +82,21 @@ bool gameinfo_init(void) {
#else
#error TODO(linux): grab window handle and title from SDL (a bit involved...)
#endif
+
+ // SUPER crude algorithm to force uppercase titles like HALF-LIFE 2 or
+ // PORTAL 2 to (almost-)titlecase. will refine later, as needed
+ bool hasupper = false, haslower = false;
+ for (char *p = title; *p && (!hasupper || !haslower); ++p) {
+ haslower |= *p >= 'a' && *p <= 'z';
+ hasupper |= *p >= 'A' && *p <= 'Z';
+ }
+ if (hasupper && !haslower) {
+ int casebit = 0;
+ for (char *p = title; *p; ++p) {
+ if (*p >= 'A' && *p <= 'Z') *p |= casebit;
+ casebit = (*p == ' ' || *p == '-') << 5; // ? 32 : 0
+ }
+ }
}
return true;
}