From 341ca9dd3ac0f7fb281cd12dc126ab721cef5730 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Tue, 5 Nov 2019 20:48:34 +0100
Subject: [PATCH] - removed the EDuke revision data and replaced it with
 Demolition's own.

---
 source/CMakeLists.txt                  |   1 -
 source/blood/src/startwin.game.cpp     | 674 -------------------------
 source/build/include/startwin.editor.h |  19 -
 source/build/src/rev.cpp               |   8 -
 source/duke3d/src/gameexec.cpp         |   3 +-
 source/duke3d/src/savegame.cpp         |   3 +-
 source/rr/src/savegame.cpp             |   3 +-
 7 files changed, 6 insertions(+), 705 deletions(-)
 delete mode 100644 source/blood/src/startwin.game.cpp
 delete mode 100644 source/build/include/startwin.editor.h
 delete mode 100644 source/build/src/rev.cpp

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 76ead7de1..3c5555eff 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -746,7 +746,6 @@ set (PCH_SOURCES
 	build/src/palette.cpp
 	build/src/polymost.cpp
 	build/src/pragmas.cpp
-	build/src/rev.cpp
 	build/src/screenshot.cpp
 	build/src/scriptfile.cpp
 	build/src/sdlayer.cpp
diff --git a/source/blood/src/startwin.game.cpp b/source/blood/src/startwin.game.cpp
deleted file mode 100644
index 137bc38c4..000000000
--- a/source/blood/src/startwin.game.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-//-------------------------------------------------------------------------
-/*
-Copyright (C) 2010-2019 EDuke32 developers and contributors
-Copyright (C) 2019 Nuke.YKT
-
-This file is part of NBlood.
-
-NBlood is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*/
-//-------------------------------------------------------------------------
-
-#include "ns.h"	// Must come before everything else!
-
-#ifndef _WIN32
-#error Only for Windows
-#endif
-
-#include "renderlayer.h"
-
-#ifdef STARTUP_SETUP_WINDOW
-
-#define NEED_WINDOWSX_H
-#define NEED_COMMCTRL_H
-#define ONLY_USERDEFS
-
-#include "_control.h"
-#include "build.h"
-#include "cache1d.h"
-//#include "cmdline.h"
-#include "common_game.h"
-#include "compat.h"
-#include "control.h"
-#include "config.h"
-//#include "gamecontrol.h"
-//#include "game.h"
-//#include "grpscan.h"
-//#include "inv.h"
-#include "blood.h"
-#include "globals.h"
-#include "keyboard.h"
-#include "startwin.game.h"
-#include "windows_inc.h"
-
-#pragma warning(disable:4244) // There's just a bit too much of these in here...
-
-BEGIN_BLD_NS
-
-
-#define TAB_CONFIG 0
-#define TAB_MESSAGES 1
-
-typedef struct {
-	int32_t fullscreen;
-	int32_t xdim;
-	int32_t ydim;
-	int32_t bpp;
-} ud_setup_t;
-
-static struct
-{
-	ud_setup_t shared;
-    INICHAIN const * ini;
-    char *gamedir;
-}
-settings;
-
-static HWND startupdlg;
-static HWND pages[3];
-static int done = -1;
-static int mode = TAB_CONFIG;
-
-static BUILDVFS_FIND_REC *finddirs;
-
-static inline void clearfilenames(void)
-{
-    klistfree(finddirs);
-    finddirs = NULL;
-}
-
-static inline void getfilenames(char const *path)
-{
-    clearfilenames();
-    finddirs = klistpath(path,"*",BUILDVFS_FIND_DIR);
-}
-
-#define POPULATE_VIDEO 1
-#define POPULATE_CONFIG 2
-#define POPULATE_GAME 4
-#define POPULATE_GAMEDIRS 8
-
-#ifdef INPUT_MOUSE
-#undef INPUT_MOUSE
-#endif
-
-#define INPUT_KB 0
-#define INPUT_MOUSE 1
-#define INPUT_JOYSTICK 2
-#define INPUT_ALL 3
-
-// Thanks, Microsoft for not providing alternatives for the dialog control macros. :(
-#undef SNDMSG
-#define SNDMSG ::SendMessageA
-
-const char *controlstrings[] = { "Keyboard only", "Keyboard and mouse", "Keyboard and joystick", "All supported devices" };
-
-static void PopulateForm(int32_t pgs)
-{
-    char buf[512];
-
-    if (pgs & POPULATE_GAMEDIRS)
-    {
-        HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR);
-
-        getfilenames("/");
-        (void)ComboBox_ResetContent(hwnd);
-        int const r = ComboBox_AddString(hwnd, "None");
-        (void)ComboBox_SetItemData(hwnd, r, 0);
-        (void)ComboBox_SetCurSel(hwnd, r);
-        auto dirs = finddirs;
-        for (int i=1, j=1; dirs != NULL; dirs=dirs->next)
-        {
-            if (Bstrcasecmp(dirs->name, "autoload") == 0)
-            {
-                j++;
-                continue;
-            }
-
-            (void)ComboBox_AddString(hwnd, dirs->name);
-            (void)ComboBox_SetItemData(hwnd, i, j);
-            if (Bstrcasecmp(dirs->name, settings.gamedir) == 0)
-                (void)ComboBox_SetCurSel(hwnd, i);
-
-            i++;
-            j++;
-        }
-    }
-
-    if (pgs & POPULATE_VIDEO)
-    {
-        HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
-        int mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
-
-        if (mode < 0 || (settings.shared.bpp < 15))
-        {
-            int CONSTEXPR cd[] = { 32, 24, 16, 15, 8, 0 };
-            int i;
-
-            for (i=0; cd[i];)
-            {
-                if (cd[i] >= settings.shared.bpp) i++;
-                else break;
-            }
-            for (; cd[i]; i++)
-            {
-                mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, cd[i], settings.shared.fullscreen, 1);
-                if (mode < 0) continue;
-                settings.shared.bpp = cd[i];
-                break;
-            }
-        }
-
-        Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.shared.fullscreen) ? BST_CHECKED : BST_UNCHECKED));
-        //Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.polymer) ? BST_CHECKED : BST_UNCHECKED));
-
-        (void)ComboBox_ResetContent(hwnd);
-
-        for (int i=0; i<validmodecnt; i++)
-        {
-            if (validmode[i].fs != (settings.shared.fullscreen)) continue;
-            if ((validmode[i].bpp < 15)) continue;
-
-            // all modes get added to the 3D mode list
-            Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
-            int const j = ComboBox_AddString(hwnd, buf);
-            (void)ComboBox_SetItemData(hwnd, j, i);
-            if (i == mode)(void)ComboBox_SetCurSel(hwnd, j);
-        }
-    }
-
-
-    if (pgs & POPULATE_GAME)
-    {
-        HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCDATA);
-
-        for (auto fg = pINIChain; fg; fg=fg->pNext)
-        {
-            if (fg->pDescription)
-                Bsprintf(buf, "%s\t%s", fg->pDescription->pzName, fg->zName);
-            else
-                Bsprintf(buf, "%s", fg->zName);
-            int const j = ListBox_AddString(hwnd, buf);
-            (void)ListBox_SetItemData(hwnd, j, (LPARAM)fg);
-            if (settings.ini == fg)
-                (void)ListBox_SetCurSel(hwnd, j);
-        }
-    }
-}
-
-static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    switch (uMsg)
-    {
-    case WM_COMMAND:
-        switch (LOWORD(wParam))
-        {
-        case IDCFULLSCREEN:
-            settings.shared.fullscreen = !settings.shared.fullscreen;
-            PopulateForm(POPULATE_VIDEO);
-            return TRUE;
-        //case IDCPOLYMER:
-        //    settings.polymer = !settings.polymer;
-        //    if (settings.shared.bpp == 8) settings.shared.bpp = 32;
-        //    PopulateForm(POPULATE_VIDEO);
-        //    return TRUE;
-        case IDCVMODE:
-            if (HIWORD(wParam) == CBN_SELCHANGE)
-            {
-                int i = ComboBox_GetCurSel((HWND)lParam);
-                if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
-                if (i != CB_ERR)
-                {
-                    settings.shared.xdim = validmode[i].xdim;
-                    settings.shared.ydim = validmode[i].ydim;
-                    settings.shared.bpp  = validmode[i].bpp;
-                }
-            }
-            return TRUE;
-        case IDCALWAYSSHOW:
-            displaysetup = !!IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
-            return TRUE;
-        case IDCAUTOLOAD:
-            noautoload = (IsDlgButtonChecked(hwndDlg, IDCAUTOLOAD) != BST_CHECKED);
-            return TRUE;
-
-        case IDCGAMEDIR:
-            if (HIWORD(wParam) == CBN_SELCHANGE)
-            {
-                int i = ComboBox_GetCurSel((HWND)lParam);
-                if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
-                if (i != CB_ERR)
-                {
-                    if (i==0)
-                        settings.gamedir = NULL;
-                    else
-                    {
-                        BUILDVFS_FIND_REC *dir = finddirs;
-                        for (int j = 1; dir != NULL; dir = dir->next, j++)
-                        {
-                            if (j == i)
-                            {
-                                settings.gamedir = dir->name;
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-            return TRUE;
-        case IDCDATA:
-        {
-            if (HIWORD(wParam) != LBN_SELCHANGE) break;
-            intptr_t i = ListBox_GetCurSel((HWND)lParam);
-            if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
-            if (i != CB_ERR)
-            {
-                settings.ini = (INICHAIN const *)i;
-            }
-            return TRUE;
-        }
-        default:
-            break;
-        }
-        break;
-    default:
-        break;
-    }
-    return FALSE;
-}
-
-
-static void SetPage(int pageNum)
-{
-    HWND tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
-    auto const cur = SendMessageA(tab, TCM_GETCURSEL, 0, 0);
-    ShowWindow(pages[cur], SW_HIDE);
-    SendMessageA(tab, TCM_SETCURSEL, pageNum, 0);
-    ShowWindow(pages[pageNum], SW_SHOW);
-    mode = pageNum;
-
-    SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
-}
-
-static void EnableConfig(bool n)
-{
-    //EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
-    EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
-    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCDATA), n);
-    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
-    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR), n);
-    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUT), n);
-    //EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), n);
-    EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
-}
-
-static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    static HBITMAP hbmp = NULL;
-
-    switch (uMsg)
-    {
-    case WM_INITDIALOG:
-    {
-        // Fetch the positions (in screen coordinates) of all the windows we need to tweak
-        RECT chrome = {};
-        AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
-        RECT rdlg;
-        GetWindowRect(hwndDlg, &rdlg);
-
-        // Knock off the non-client area of the main dialogue to give just the client area
-        rdlg.left -= chrome.left;
-        rdlg.top -= chrome.top;
-        rdlg.right -= chrome.right;
-        rdlg.bottom -= chrome.bottom;
-
-        RECT rtab;
-        GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
-
-        // Translate them to client-relative coordinates wrt the main dialogue window
-        rtab.right -= rtab.left - 1;
-        rtab.bottom -= rtab.top - 1;
-        rtab.left  -= rdlg.left;
-        rtab.top -= rdlg.top;
-
-        RECT rcancel;
-        GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
-
-        rcancel.right -= rcancel.left - 1;
-        rcancel.bottom -= rcancel.top - 1;
-        rcancel.left -= rdlg.left;
-        rcancel.top -= rdlg.top;
-
-        RECT rstart;
-        GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
-
-        rstart.right -= rstart.left - 1;
-        rstart.bottom -= rstart.top - 1;
-        rstart.left -= rdlg.left;
-        rstart.top -= rdlg.top;
-
-        // And then convert the main dialogue coordinates to just width/length
-        rdlg.right -= rdlg.left - 1;
-        rdlg.bottom -= rdlg.top - 1;
-        rdlg.left = 0;
-        rdlg.top = 0;
-
-        // Load the bitmap into the bitmap control and fetch its dimensions
-        hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
-
-        HWND hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_BITMAP);
-        SendMessageA(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
-
-        RECT r;
-        GetClientRect(hwnd, &r);
-
-        int const xoffset = r.right;
-        int const yoffset = r.bottom - rdlg.bottom;
-
-        // Shift and resize the controls that require it
-        rtab.left += xoffset;
-        rtab.bottom += yoffset;
-        rcancel.left += xoffset;
-        rcancel.top += yoffset;
-        rstart.left += xoffset;
-        rstart.top += yoffset;
-        rdlg.right += xoffset;
-        rdlg.bottom += yoffset;
-
-        // Move the controls to their new positions
-        MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
-        MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
-        MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
-
-        // Move the main dialogue to the centre of the screen
-        HDC hdc = GetDC(NULL);
-        rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
-        rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
-        ReleaseDC(NULL, hdc);
-        MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
-                   rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
-
-        // Add tabs to the tab control
-        {
-            static char textSetup[] = "Setup";
-            static char textMessageLog[] = "Message Log";
-
-            hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
-
-            TCITEMA tab = {};
-            tab.mask = TCIF_TEXT;
-            tab.pszText = textSetup;
-            SendMessageA(hwnd, TCM_INSERTITEMA, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
-            tab.mask = TCIF_TEXT;
-            tab.pszText = textMessageLog;
-            SendMessageA(hwnd, TCM_INSERTITEMA, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
-
-            // Work out the position and size of the area inside the tab control for the pages
-            ZeroMemory(&r, sizeof(r));
-            GetClientRect(hwnd, &r);
-            SendMessageA(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
-            r.right -= r.left-1;
-            r.bottom -= r.top-1;
-            r.top += rtab.top;
-            r.left += rtab.left;
-
-            // Create the pages and position them in the tab control, but hide them
-            pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
-            SetWindowPos(pages[TAB_CONFIG], hwnd, r.left, r.top, r.right, r.bottom, SWP_HIDEWINDOW);
-
-            pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
-            SetWindowPos(pages[TAB_MESSAGES], hwnd, r.left, r.top, r.right, r.bottom, SWP_HIDEWINDOW);
-
-            // Tell the editfield acting as the console to exclude the width of the scrollbar
-            GetClientRect(pages[TAB_MESSAGES], &r);
-            r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
-            r.left = r.top = 0;
-            SendMessageA(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
-
-            // Set a tab stop in the game data listbox
-            {
-                DWORD tabs[1] = { 150 };
-                (void)ListBox_SetTabStops(GetDlgItem(pages[TAB_CONFIG], IDCDATA), 1, tabs);
-            }
-
-            SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
-            SetWindowTextA(hwndDlg, apptitle);
-        }
-        return FALSE;
-    }
-
-    case WM_NOTIFY:
-    {
-        auto nmhdr = (LPNMHDR)lParam;
-        if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
-        int const cur = SendMessageA(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
-        switch (nmhdr->code)
-        {
-            case TCN_SELCHANGING:
-            case TCN_SELCHANGE:
-                if (cur < 0 || !pages[cur])
-                    break;
-                ShowWindow(pages[cur], nmhdr->code == TCN_SELCHANGING ? SW_HIDE : SW_SHOW);
-                return TRUE;
-        }
-        break;
-    }
-
-    case WM_CLOSE:
-        if (mode == TAB_CONFIG) done = 0;
-        else quitevent++;
-        return TRUE;
-
-    case WM_DESTROY:
-        if (hbmp)
-        {
-            DeleteObject(hbmp);
-            hbmp = NULL;
-        }
-
-        if (pages[TAB_CONFIG])
-        {
-            DestroyWindow(pages[TAB_CONFIG]);
-            pages[TAB_CONFIG] = NULL;
-        }
-
-        startupdlg = NULL;
-        return TRUE;
-
-    case WM_COMMAND:
-        switch (LOWORD(wParam))
-        {
-        case WIN_STARTWIN_CANCEL:
-            if (mode == TAB_CONFIG) done = 0;
-            else quitevent++;
-            return TRUE;
-        case WIN_STARTWIN_START:
-            done = 1;
-            return TRUE;
-        }
-        return FALSE;
-
-    case WM_CTLCOLORSTATIC:
-        if ((HWND)lParam == pages[TAB_MESSAGES])
-            return (BOOL)(intptr_t)GetSysColorBrush(COLOR_WINDOW);
-        break;
-
-    default:
-        break;
-    }
-
-    return FALSE;
-}
-
-
-int32_t startwin_open(void)
-{
-    if (startupdlg) return 1;
-    INITCOMMONCONTROLSEX icc = { sizeof(icc), ICC_TAB_CLASSES };
-    InitCommonControlsEx(&icc);
-    startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
-    if (startupdlg)
-    {
-        SetPage(TAB_MESSAGES);
-        EnableConfig(0);
-        return 0;
-    }
-    return -1;
-}
-
-int32_t startwin_close(void)
-{
-    if (!startupdlg) return 1;
-    DestroyWindow(startupdlg);
-    startupdlg = NULL;
-    return 0;
-}
-
-int32_t startwin_puts(const char *buf)
-{
-    if (!startupdlg) return 1;
-
-    const HWND edctl = pages[TAB_MESSAGES];
-
-    if (!edctl) return -1;
-
-    static HWND dactrl = NULL;
-    if (!dactrl) dactrl = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
-
-    int const vis = ((int)SendMessageA(dactrl, TCM_GETCURSEL,0,0) == TAB_MESSAGES);
-
-    if (vis)
-        SendMessageA(edctl, WM_SETREDRAW, FALSE, 0);
-
-    int const curlen = SendMessageA(edctl, WM_GETTEXTLENGTH, 0,0);
-    SendMessageA(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
-
-    int const   numlines = SendMessageA(edctl, EM_GETLINECOUNT, 0, 0);
-    static bool newline  = false;
-    const char *p        = buf;
-
-    while (*p)
-    {
-        if (newline)
-        {
-            SendMessageA(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
-            newline = false;
-        }
-        const char *q = p;
-        while (*q && *q != '\n') q++;
-        static char workbuf[1024];
-        Bmemcpy(workbuf, p, q-p);
-        if (*q == '\n')
-        {
-            if (!q[1])
-            {
-                newline = true;
-                workbuf[q-p] = 0;
-            }
-            else
-            {
-                workbuf[q-p] = '\r';
-                workbuf[q-p+1] = '\n';
-                workbuf[q-p+2] = 0;
-            }
-            p = q+1;
-        }
-        else
-        {
-            workbuf[q-p] = 0;
-            p = q;
-        }
-        SendMessageA(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
-    }
-
-    int const newnumlines = SendMessageA(edctl, EM_GETLINECOUNT, 0, 0);
-    SendMessageA(edctl, EM_LINESCROLL, 0, newnumlines - numlines);
-
-    if (vis)
-        SendMessageA(edctl, WM_SETREDRAW, TRUE, 0);
-
-    return 0;
-}
-
-int32_t startwin_settitle(const char *str)
-{
-    if (!startupdlg) return 1;
-    SetWindowTextA(startupdlg, str);
-    return 0;
-}
-
-int32_t startwin_idle(void *v)
-{
-    if (!startupdlg || !IsWindow(startupdlg)) return 0;
-    if (IsDialogMessage(startupdlg, (MSG *)v)) return 1;
-    return 0;
-}
-
-int32_t startwin_run(void)
-{
-    if (!startupdlg) return 1;
-
-    done = -1;
-
-    SetPage(TAB_CONFIG);
-    EnableConfig(1);
-
-	settings.shared = { ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP };
-    settings.ini = pINISelected;
-    settings.gamedir = g_modDir;
-
-    PopulateForm(-1);
-
-    do
-    {
-        MSG msg;
-
-        switch (GetMessage(&msg, NULL, 0,0))
-        {
-        case 0:
-            done = 1;
-            break;
-        case -1:
-            return -1;
-        default:
-            if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg))
-                break;
-            TranslateMessage(&msg);
-            DispatchMessage(&msg);
-            break;
-        }
-    }
-    while (done < 0);
-
-    SetPage(TAB_MESSAGES);
-    EnableConfig(0);
-
-    if (done)
-    {
-		ScreenWidth = settings.shared.xdim;
-		ScreenHeight = settings.shared.ydim;
-		ScreenMode = settings.shared.fullscreen;
-		ScreenBPP = settings.shared.bpp;
-		pINISelected = settings.ini;
-        Bstrcpy(g_modDir, (gNoSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
-    }
-
-    return done;
-}
-
-END_BLD_NS
-
-#endif // STARTUP_SETUP_WINDOW
-
diff --git a/source/build/include/startwin.editor.h b/source/build/include/startwin.editor.h
deleted file mode 100644
index c0fff2210..000000000
--- a/source/build/include/startwin.editor.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// resource ids
-#define WIN_STARTWIN		1000
-#define WIN_STARTWINPAGE_CONFIG 2000
-#define WIN_STARTWIN_BITMAP	100	// banner bitmap
-#define WIN_STARTWIN_TABCTL	101
-#define WIN_STARTWIN_CANCEL	IDCANCEL
-#define WIN_STARTWIN_START	IDOK
-
-#define WIN_STARTWIN_MESSAGES	104	// output list box
-
-#define RSRC_ICON		100
-#define RSRC_BMP		200
-
-// config page
-#define IDCFULLSCREEN	100
-#define IDC2DVMODE	101
-#define IDC3DVMODE	102
-#define IDCALWAYSSHOW	103
-
diff --git a/source/build/src/rev.cpp b/source/build/src/rev.cpp
deleted file mode 100644
index 90d129216..000000000
--- a/source/build/src/rev.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// This file's main purpose is to be recompiled unconditionally so the timestamp gets updated, even for a partial recompile.
-
-#if !defined REV
-# define REV "r(?)"
-#endif
-
-const char* s_buildRev = REV;
-const char* s_buildTimestamp = __DATE__ " " __TIME__;
diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp
index 3492f4f12..f394f87cf 100644
--- a/source/duke3d/src/gameexec.cpp
+++ b/source/duke3d/src/gameexec.cpp
@@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include "gameconfigfile.h"
 #include "files.h"
 #include "base64.h"
+#include "version.h"
 
 #include "vfs.h"
 
@@ -3805,7 +3806,7 @@ badindex:
                                     Bstrcpy(apStrings[q], g_player[vm.playerNum].user_name);
                                     break;
                                 case STR_VERSION:
-                                    Bsprintf(tempbuf, HEAD2 " %s", s_buildRev);
+                                    Bsprintf(tempbuf, HEAD2 " %s", GetGitDescription());
                                     Bstrcpy(apStrings[q], tempbuf);
                                     break;
                                 case STR_GAMETYPE: Bstrcpy(apStrings[q], g_gametypeNames[ud.coop]); break;
diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp
index 38d3f9132..a0f5eeae2 100644
--- a/source/duke3d/src/savegame.cpp
+++ b/source/duke3d/src/savegame.cpp
@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include "sjson.h"
 #include "i_specialpaths.h"
 #include "gamecontrol.h"
+#include "version.h"
 
 #include "vfs.h"
 
@@ -1708,7 +1709,7 @@ int32_t sv_saveandmakesnapshot(buildvfs_FILE fil, char const *name, int8_t spot,
         Bstrncpyz(h.savename, "EDuke32 demo", sizeof(h.savename));
         if (t>=0 && (st = localtime(&t)))
             Bsnprintf(h.savename, sizeof(h.savename), "Demo %04d%02d%02d %s",
-                      st->tm_year+1900, st->tm_mon+1, st->tm_mday, s_buildRev);
+                      st->tm_year+1900, st->tm_mon+1, st->tm_mday, GetGitDescription());
     }
 
 
diff --git a/source/rr/src/savegame.cpp b/source/rr/src/savegame.cpp
index b2d4cca44..73921033e 100644
--- a/source/rr/src/savegame.cpp
+++ b/source/rr/src/savegame.cpp
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include "savegame.h"
 #include "i_specialpaths.h"
 #include "gamecontrol.h"
+#include "version.h"
 
 BEGIN_RR_NS
 
@@ -1365,7 +1366,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t
         Bstrncpyz(h.savename, "EDuke32 demo", sizeof(h.savename));
         if (t>=0 && (st = localtime(&t)))
             Bsnprintf(h.savename, sizeof(h.savename), "Demo %04d%02d%02d %s",
-                      st->tm_year+1900, st->tm_mon+1, st->tm_mday, s_buildRev);
+                      st->tm_year+1900, st->tm_mon+1, st->tm_mday, GetGitDescription());
     }