Nuke st_start.h from orbit

This commit is contained in:
Magnus Norddahl 2025-08-08 13:54:59 +02:00
commit e4aac749dc
31 changed files with 58 additions and 896 deletions

View file

@ -53,7 +53,7 @@ add_definitions( -DTHIS_IS_GZDOOM )
if( WIN32 )
add_definitions( -D_WIN32 )
add_definitions( -D_WIN32 -DNOMINMAX -DWIN32_LEAN_AND_MEAN )
set( PROJECT_LIBRARIES
psapi
@ -389,7 +389,6 @@ set( PLAT_WIN32_SOURCES
common/platform/win32/i_mainwindow.cpp
common/platform/win32/i_system.cpp
common/platform/win32/i_specialpaths.cpp
common/platform/win32/st_start.cpp
common/platform/win32/base_sysfb.cpp
common/platform/win32/win32basevideo.cpp
common/platform/win32/i_crash.cpp
@ -414,8 +413,7 @@ set( PLAT_SDL_SOURCES
common/platform/posix/sdl/i_input.cpp
common/platform/posix/sdl/i_joystick.cpp
common/platform/posix/sdl/i_main.cpp
common/platform/posix/sdl/i_system.cpp
common/platform/posix/sdl/st_start.cpp )
common/platform/posix/sdl/i_system.cpp )
set( PLAT_UNIX_SOURCES
common/platform/posix/unix/i_specialpaths.cpp
common/platform/posix/unix/gtk_dialogs.cpp )
@ -429,8 +427,7 @@ set( PLAT_COCOA_SOURCES
common/platform/posix/cocoa/i_main.mm
common/platform/posix/cocoa/i_system.mm
common/platform/posix/cocoa/i_video.mm
common/platform/posix/cocoa/st_console.mm
common/platform/posix/cocoa/st_start.mm )
common/platform/posix/cocoa/st_console.mm )
if( WIN32 )
set( SYSTEM_SOURCES_DIR common/platform/win32 )

View file

@ -67,7 +67,6 @@
#include "vm.h"
#include "common/widgets/errorwindow.h"
#include "common/scripting/dap/GameEventEmit.h"
#include "st_start.h"
#include <algorithm>
#define LEFTMARGIN 8
@ -442,7 +441,6 @@ void I_CloseMainWindow();
void ShowFatalError(const char* text)
{
DeleteStartupScreen();
S_StopMusic(true);
I_CloseMainWindow();

View file

@ -1,5 +1,4 @@
#include "i_interface.h"
#include "st_start.h"
#include "gamestate.h"
#include "startupinfo.h"
#include "c_cvars.h"
@ -17,7 +16,6 @@ static_assert(sizeof(void*) == 8,
"that lead to a bad user experience.");
// Some global engine variables taken out of the backend code.
FStartupScreen* StartWindow;
SystemCallbacks sysCallbacks;
FString endoomName;
bool batchrun;

View file

@ -51,7 +51,9 @@
/* [Petteri] Use Winsock for Win32: */
#ifdef __WIN32__
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
# include <windows.h>
# include <winsock.h>
#else
@ -70,7 +72,7 @@
#include "i_system.h"
#include "m_argv.h"
#include "m_crc32.h"
#include "st_start.h"
#include "common/widgets/netstartwindow.h"
#include "engineerrors.h"
#include "cmdlib.h"
#include "printf.h"
@ -386,27 +388,27 @@ static void I_NetLog(const char* text, ...)
// Gracefully closes the net window so that any error messaging can be properly displayed.
static void I_NetError(const char* error)
{
StartWindow->NetClose();
NetStartWindow::NetClose();
I_FatalError("%s", error);
}
static void I_NetInit(const char* msg, bool host)
{
StartWindow->NetInit(msg, host);
NetStartWindow::NetInit(msg, host);
}
// todo: later these must be dispatched by the main menu, not the start screen.
// Updates the general status of the lobby.
static void I_NetMessage(const char* msg)
{
StartWindow->NetMessage(msg);
NetStartWindow::NetMessage(msg);
}
// Listen for incoming connections while the lobby is active. The main thread needs to be locked up
// here to prevent the engine from continuing to start the game until everyone is ready.
static bool I_NetLoop(bool (*loopCallback)(void*), void* data)
{
return StartWindow->NetLoop(loopCallback, data);
return NetStartWindow::NetLoop(loopCallback, data);
}
// A new client has just entered the game, so add them to the player list.
@ -419,28 +421,28 @@ static void I_NetClientConnected(int client, unsigned int charLimit = 0u)
if (client == consoleplayer)
flags |= CFL_CONSOLEPLAYER;
StartWindow->NetConnect(client, name, flags, Connected[client].Status);
NetStartWindow::NetConnect(client, name, flags, Connected[client].Status);
}
// A client changed ready state.
static void I_NetClientUpdated(int client)
{
StartWindow->NetUpdate(client, Connected[client].Status);
NetStartWindow::NetUpdate(client, Connected[client].Status);
}
static void I_NetClientDisconnected(int client)
{
StartWindow->NetDisconnect(client);
NetStartWindow::NetDisconnect(client);
}
static void I_NetUpdatePlayers(int current, int limit)
{
StartWindow->NetProgress(current, limit);
NetStartWindow::NetProgress(current, limit);
}
static bool I_ShouldStartNetGame()
{
return StartWindow->ShouldStartNet();
return NetStartWindow::ShouldStartNet();
}
static void I_GetKickClients(TArray<int>& clients)
@ -448,7 +450,7 @@ static void I_GetKickClients(TArray<int>& clients)
clients.Clear();
int c = -1;
while ((c = StartWindow->GetNetKickClient()) != -1)
while ((c = NetStartWindow::GetNetKickClient()) != -1)
clients.Push(c);
}
@ -457,13 +459,13 @@ static void I_GetBanClients(TArray<int>& clients)
clients.Clear();
int c = -1;
while ((c = StartWindow->GetNetBanClient()) != -1)
while ((c = NetStartWindow::GetNetBanClient()) != -1)
clients.Push(c);
}
void I_NetDone()
{
StartWindow->NetDone();
NetStartWindow::NetDone();
}
void I_ClearClient(size_t client)

View file

@ -1,117 +0,0 @@
#pragma once
/*
** st_start.h
** Interface for the startup screen.
**
**---------------------------------------------------------------------------
** Copyright 2006-2007 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
** The startup screen interface is based on a mix of Heretic and Hexen.
** Actual implementation is system-specific.
*/
#include <stdint.h>
class FStartupScreen
{
public:
static FStartupScreen *CreateInstance(int max_progress);
FStartupScreen(int max_progress)
{
MaxPos = max_progress;
CurPos = 0;
NotchPos = 0;
}
virtual ~FStartupScreen() = default;
virtual void Progress(int advance = 1) {}
virtual void AppendStatusLine(const char* status) {}
virtual void LoadingStatus(const char* message, int colors) {}
virtual void NetInit(const char* message, bool host) {}
virtual void NetMessage(const char* message) {}
virtual void NetConnect(int client, const char* name, unsigned flags, int status) {}
virtual void NetUpdate(int client, int status) {}
virtual void NetDisconnect(int client) {}
virtual void NetProgress(int cur, int limit) {}
virtual void NetDone() {}
virtual void NetClose() {}
virtual bool ShouldStartNet() { return false; }
virtual int GetNetKickClient() { return -1; }
virtual int GetNetBanClient() { return -1; }
virtual bool NetLoop(bool (*loopCallback)(void *), void *data) { return false; }
protected:
int MaxPos, CurPos, NotchPos;
};
class FBasicStartupScreen : public FStartupScreen
{
public:
FBasicStartupScreen(int max_progress);
~FBasicStartupScreen();
void Progress(int advance = 1) override;
void NetInit(const char* message, bool host) override;
void NetMessage(const char* message) override;
void NetConnect(int client, const char* name, unsigned flags, int status) override;
void NetUpdate(int client, int status) override;
void NetDisconnect(int client) override;
void NetProgress(int cur, int limit) override;
void NetDone() override;
void NetClose() override;
bool ShouldStartNet() override;
int GetNetKickClient() override;
int GetNetBanClient() override;
bool NetLoop(bool (*loopCallback)(void*), void* data) override;
};
extern FStartupScreen *StartWindow;
//===========================================================================
//
// DeleteStartupScreen
//
// Makes sure the startup screen has been deleted before quitting.
//
//===========================================================================
inline void DeleteStartupScreen()
{
if (StartWindow != nullptr)
{
delete StartWindow;
StartWindow = nullptr;
}
}

View file

@ -34,7 +34,9 @@
#ifdef _WIN32
#ifndef _WINNT_
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif

View file

@ -34,7 +34,9 @@
*/
// Caution: LzmaDec also pulls in windows.h!
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "LzmaDec.h"
#include "Xz.h"
// CRC table needs to be generated prior to reading XZ compressed files.

View file

@ -1,174 +0,0 @@
/*
** st_start.mm
**
**---------------------------------------------------------------------------
** Copyright 2015 Alexey Lysiuk
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <unistd.h>
#import <Foundation/NSRunLoop.h>
#include "c_cvars.h"
#include "st_console.h"
#include "st_start.h"
#include "printf.h"
#include "engineerrors.h"
// ---------------------------------------------------------------------------
FBasicStartupScreen::FBasicStartupScreen(int maxProgress)
: FStartupScreen(maxProgress)
{
FConsoleWindow& consoleWindow = FConsoleWindow::GetInstance();
consoleWindow.SetProgressBar(true);
#if 0
// Testing code, please do not remove
consoleWindow.AddText("----------------------------------------------------------------\n");
consoleWindow.AddText("1234567890 !@#$%^&*() ,<.>/?;:'\" [{]}\\| `~-_=+ "
"This is very very very long message needed to trigger word wrapping...\n\n");
consoleWindow.AddText("Multiline...\n\tmessage...\n\t\twith...\n\t\t\ttabs.\n\n");
consoleWindow.AddText(TEXTCOLOR_BRICK "TEXTCOLOR_BRICK\n" TEXTCOLOR_TAN "TEXTCOLOR_TAN\n");
consoleWindow.AddText(TEXTCOLOR_GRAY "TEXTCOLOR_GRAY & TEXTCOLOR_GREY\n");
consoleWindow.AddText(TEXTCOLOR_GREEN "TEXTCOLOR_GREEN\n" TEXTCOLOR_BROWN "TEXTCOLOR_BROWN\n");
consoleWindow.AddText(TEXTCOLOR_GOLD "TEXTCOLOR_GOLD\n" TEXTCOLOR_RED "TEXTCOLOR_RED\n");
consoleWindow.AddText(TEXTCOLOR_BLUE "TEXTCOLOR_BLUE\n" TEXTCOLOR_ORANGE "TEXTCOLOR_ORANGE\n");
consoleWindow.AddText(TEXTCOLOR_WHITE "TEXTCOLOR_WHITE\n" TEXTCOLOR_YELLOW "TEXTCOLOR_YELLOW\n");
consoleWindow.AddText(TEXTCOLOR_UNTRANSLATED "TEXTCOLOR_UNTRANSLATED\n");
consoleWindow.AddText(TEXTCOLOR_BLACK "TEXTCOLOR_BLACK\n" TEXTCOLOR_LIGHTBLUE "TEXTCOLOR_LIGHTBLUE\n");
consoleWindow.AddText(TEXTCOLOR_CREAM "TEXTCOLOR_CREAM\n" TEXTCOLOR_OLIVE "TEXTCOLOR_OLIVE\n");
consoleWindow.AddText(TEXTCOLOR_DARKGREEN "TEXTCOLOR_DARKGREEN\n" TEXTCOLOR_DARKRED "TEXTCOLOR_DARKRED\n");
consoleWindow.AddText(TEXTCOLOR_DARKBROWN "TEXTCOLOR_DARKBROWN\n" TEXTCOLOR_PURPLE "TEXTCOLOR_PURPLE\n");
consoleWindow.AddText(TEXTCOLOR_DARKGRAY "TEXTCOLOR_DARKGRAY\n" TEXTCOLOR_CYAN "TEXTCOLOR_CYAN\n");
consoleWindow.AddText(TEXTCOLOR_ICE "TEXTCOLOR_ICE\n" TEXTCOLOR_FIRE "TEXTCOLOR_FIRE\n");
consoleWindow.AddText(TEXTCOLOR_SAPPHIRE "TEXTCOLOR_SAPPHIRE\n" TEXTCOLOR_TEAL "TEXTCOLOR_TEAL\n");
consoleWindow.AddText(TEXTCOLOR_NORMAL "TEXTCOLOR_NORMAL\n" TEXTCOLOR_BOLD "TEXTCOLOR_BOLD\n");
consoleWindow.AddText(TEXTCOLOR_CHAT "TEXTCOLOR_CHAT\n" TEXTCOLOR_TEAMCHAT "TEXTCOLOR_TEAMCHAT\n");
consoleWindow.AddText("----------------------------------------------------------------\n");
#endif // _DEBUG
}
FBasicStartupScreen::~FBasicStartupScreen()
{
FConsoleWindow::GetInstance().SetProgressBar(false);
}
void FBasicStartupScreen::Progress(int advance)
{
CurPos = min(CurPos + advance, MaxPos);
FConsoleWindow::GetInstance().Progress(CurPos, MaxPos);
}
void FBasicStartupScreen::NetInit(const char* const message, const bool host)
{
FConsoleWindow::GetInstance().NetInit(message, host);
}
void FBasicStartupScreen::NetMessage(const char* const message)
{
FConsoleWindow::GetInstance().NetMessage(message);
}
void FBasicStartupScreen::NetConnect(const int client, const char* const name, const unsigned flags, const int status)
{
FConsoleWindow::GetInstance().NetConnect(client, name, flags, status);
}
void FBasicStartupScreen::NetUpdate(const int client, const int status)
{
FConsoleWindow::GetInstance().NetUpdate(client, status);
}
void FBasicStartupScreen::NetDisconnect(const int client)
{
FConsoleWindow::GetInstance().NetDisconnect(client);
}
void FBasicStartupScreen::NetProgress(const int cur, const int limit)
{
FConsoleWindow::GetInstance().NetProgress(cur, limit);
}
void FBasicStartupScreen::NetDone()
{
FConsoleWindow::GetInstance().NetDone();
}
void FBasicStartupScreen::NetClose()
{
FConsoleWindow::GetInstance().NetClose();
}
bool FBasicStartupScreen::ShouldStartNet()
{
return FConsoleWindow::GetInstance().ShouldStartNet();
}
int FBasicStartupScreen::GetNetKickClient()
{
return FConsoleWindow::GetInstance().GetNetKickClient();
}
int FBasicStartupScreen::GetNetBanClient()
{
return FConsoleWindow::GetInstance().GetNetBanClient();
}
bool FBasicStartupScreen::NetLoop(bool (*loopCallback)(void*), void* const data)
{
while (true)
{
if (loopCallback(data))
{
break;
}
[[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
// Do not poll to often
usleep(50000);
}
return true;
}
// ---------------------------------------------------------------------------
FStartupScreen *FStartupScreen::CreateInstance(const int maxProgress)
{
return new FBasicStartupScreen(maxProgress);
}

View file

@ -67,7 +67,6 @@
#include "v_font.h"
#include "c_cvars.h"
#include "palutil.h"
#include "st_start.h"
#include "printf.h"
#include "launcherwindow.h"

View file

@ -1,338 +0,0 @@
/*
** st_start.cpp
** Handles the startup screen.
**
**---------------------------------------------------------------------------
** Copyright 2006-2007 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
// HEADER FILES ------------------------------------------------------------
#include <unistd.h>
#include <sys/time.h>
#include <termios.h>
#include "st_start.h"
#include "i_system.h"
#include "c_cvars.h"
#include "engineerrors.h"
// MACROS ------------------------------------------------------------------
// TYPES -------------------------------------------------------------------
class FTTYStartupScreen : public FStartupScreen
{
public:
FTTYStartupScreen(int max_progress);
~FTTYStartupScreen();
void Progress(int amount = 1) override;
void NetInit(const char* message, bool host) override;
void NetMessage(const char* message) override;
void NetConnect(int client, const char* name, unsigned flags, int status) override;
void NetUpdate(int client, int status) override;
void NetDisconnect(int client) override;
void NetProgress(int cur, int limit) override;
void NetDone() override;
void NetClose() override;
bool ShouldStartNet() override;
int GetNetKickClient() override;
int GetNetBanClient() override;
bool NetLoop(bool (*loopCallback)(void*), void* data) override;
protected:
bool DidNetInit;
int NetMaxPos, NetCurPos;
const char *TheNetMessage;
termios OldTermIOS;
};
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
extern void RedrawProgressBar(int CurPos, int MaxPos);
extern void CleanProgressBar();
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static const char SpinnyProgressChars[4] = { '|', '/', '-', '\\' };
// CODE --------------------------------------------------------------------
//==========================================================================
//
// FStartupScreen :: CreateInstance
//
// Initializes the startup screen for the detected game.
// Sets the size of the progress bar and displays the startup screen.
//
//==========================================================================
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
{
return new FTTYStartupScreen(max_progress);
}
//===========================================================================
//
// FTTYStartupScreen Constructor
//
// Sets the size of the progress bar and displays the startup screen.
//
//===========================================================================
FTTYStartupScreen::FTTYStartupScreen(int max_progress)
: FStartupScreen(max_progress)
{
DidNetInit = false;
NetMaxPos = 0;
NetCurPos = 0;
TheNetMessage = NULL;
}
//===========================================================================
//
// FTTYStartupScreen Destructor
//
// Called just before entering graphics mode to deconstruct the startup
// screen.
//
//===========================================================================
FTTYStartupScreen::~FTTYStartupScreen()
{
NetDone(); // Just in case it wasn't called yet and needs to be.
}
//===========================================================================
//
// FTTYStartupScreen :: Progress
//
//===========================================================================
void FTTYStartupScreen::Progress(int advance)
{
CurPos = min(CurPos + advance, MaxPos);
RedrawProgressBar(CurPos, MaxPos);
}
//===========================================================================
//
// FTTYStartupScreen :: NetInit
//
// Sets stdin for unbuffered I/O, displays the given message, and shows
// a progress meter.
//
//===========================================================================
void FTTYStartupScreen::NetInit(const char* message, bool host)
{
if (!DidNetInit)
{
termios rawtermios;
CleanProgressBar();
fprintf (stderr, "Press 'Q' to abort network game synchronization.");
// Set stdin to raw mode so we can get keypresses in ST_CheckNetAbort()
// immediately without waiting for an EOL.
tcgetattr (STDIN_FILENO, &OldTermIOS);
rawtermios = OldTermIOS;
rawtermios.c_lflag &= ~(ICANON | ECHO);
tcsetattr (STDIN_FILENO, TCSANOW, &rawtermios);
DidNetInit = true;
}
fprintf(stderr, "\n%s.", message);
fflush (stderr);
TheNetMessage = message;
NetCurPos = 0;
}
void FTTYStartupScreen::NetMessage(const char* message)
{
TheNetMessage = message;
}
void FTTYStartupScreen::NetConnect(int client, const char* name, unsigned flags, int status)
{
}
void FTTYStartupScreen::NetUpdate(int client, int status)
{
}
void FTTYStartupScreen::NetDisconnect(int client)
{
}
//===========================================================================
//
// FTTYStartupScreen :: NetProgress
//
// Sets the network progress meter.
//
//===========================================================================
void FTTYStartupScreen::NetProgress(int cur, int limit)
{
int i;
NetMaxPos = limit;
NetCurPos = cur;
if (NetMaxPos == 0)
{
// Spinny-type progress meter, because we're a guest waiting for the host.
fprintf(stderr, "\r%s: %c", TheNetMessage, SpinnyProgressChars[NetCurPos & 3]);
fflush(stderr);
}
else if (NetMaxPos > 1)
{
// Dotty-type progress meter.
fprintf(stderr, "\r%s: ", TheNetMessage);
for (i = 0; i < NetCurPos; ++i)
{
fputc('.', stderr);
}
fprintf(stderr, "%*c[%2d/%2d]", NetMaxPos + 1 - NetCurPos, ' ', NetCurPos, NetMaxPos);
fflush(stderr);
}
}
//===========================================================================
//
// FTTYStartupScreen :: NetDone
//
// Restores the old stdin tty settings.
//
//===========================================================================
void FTTYStartupScreen::NetDone()
{
CurPos = MaxPos;
CleanProgressBar();
// Restore stdin settings
if (DidNetInit)
{
tcsetattr (STDIN_FILENO, TCSANOW, &OldTermIOS);
printf ("\n");
DidNetInit = false;
}
}
void FTTYStartupScreen::NetClose()
{
// TODO: Implement this
}
bool FTTYStartupScreen::ShouldStartNet()
{
return false;
}
int FTTYStartupScreen::GetNetKickClient()
{
return -1;
}
int FTTYStartupScreen::GetNetBanClient()
{
return -1;
}
//===========================================================================
//
// FTTYStartupScreen :: NetLoop
//
// The timer_callback function is called at least two times per second
// and passed the userdata value. It should return true to stop the loop and
// return control to the caller or false to continue the loop.
//
// ST_NetLoop will return true if the loop was halted by the callback and
// false if the loop was halted because the user wants to abort the
// network synchronization.
//
//===========================================================================
bool FTTYStartupScreen::NetLoop(bool (*loopCallback)(void *), void *data)
{
fd_set rfds;
struct timeval tv;
int retval;
char k;
bool stdin_eof = false;
for (;;)
{
// Don't flood the network with packets on startup.
tv.tv_sec = 0;
tv.tv_usec = 500000;
FD_ZERO (&rfds);
if (!stdin_eof)
{
FD_SET (STDIN_FILENO, &rfds);
}
retval = select (1, &rfds, NULL, NULL, &tv);
if (retval == -1)
{
// Error
}
else if (retval == 0)
{
if (loopCallback (data))
{
fputc ('\n', stderr);
return true;
}
}
else
{
ssize_t amt = read (STDIN_FILENO, &k, 1); // Check input on stdin
if (amt == 0)
{
// EOF. Stop reading
stdin_eof = true;
}
else if (amt == 1)
{
if (k == 'q' || k == 'Q')
{
fprintf (stderr, "\nNetwork game synchronization aborted.");
return false;
}
}
}
}
}

View file

@ -32,7 +32,9 @@
**
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <GL/gl.h>
#include "wglext.h"

View file

@ -32,7 +32,9 @@
**
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>

View file

@ -19,7 +19,9 @@
** 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <cstdint>
#include <string>

View file

@ -33,7 +33,9 @@
// HEADER FILES ------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define DIRECTINPUT_VERSION 0x800
#include <windows.h>
#include <dinput.h>

View file

@ -35,7 +35,9 @@
// DI3 only supports up to 4 mouse buttons, and I want the joystick to
// be read using DirectInput instead of winmm.
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define __BYTEBOOL__
#ifndef __GNUC__
#define INITGUID

View file

@ -33,7 +33,9 @@
// HEADER FILES ------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define DIRECTINPUT_VERSION 0x800
#include <windows.h>
#include <dinput.h>

View file

@ -32,7 +32,9 @@
**
*/
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>
#include <objbase.h>
@ -72,7 +74,6 @@
#include "s_music.h"
#include "stats.h"
#include "st_start.h"
#include "i_interface.h"
#include "startupinfo.h"
#include "printf.h"

View file

@ -4,7 +4,6 @@
#include "startupinfo.h"
#include "gstrings.h"
#include "palentry.h"
#include "st_start.h"
#include "i_input.h"
#include "version.h"
#include "utf8.h"

View file

@ -5,7 +5,9 @@
#include <functional>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
// The WndProc used when the game view is active

View file

@ -33,7 +33,9 @@
// HEADER FILES ------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define DIRECTINPUT_VERSION 0x800
#include <windows.h>
#include <dinput.h>

View file

@ -33,7 +33,9 @@
// HEADER FILES ------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include "i_input.h"

View file

@ -58,7 +58,9 @@
#include <stdarg.h>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>
#include <richedit.h>

View file

@ -33,7 +33,9 @@
// HEADER FILES ------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <xinput.h>
#include <limits.h>

View file

@ -1,224 +0,0 @@
/*
** st_start.cpp
** Handles the startup screen.
**
**---------------------------------------------------------------------------
** Copyright 2006-2007 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
// HEADER FILES ------------------------------------------------------------
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#include "st_start.h"
#include "cmdlib.h"
#include "i_system.h"
#include "i_input.h"
#include "hardware.h"
#include "filesystem.h"
#include "m_argv.h"
#include "engineerrors.h"
#include "s_music.h"
#include "printf.h"
#include "startupinfo.h"
#include "i_interface.h"
#include "texturemanager.h"
#include "common/widgets/netstartwindow.h"
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void ST_Util_SizeWindowForBitmap (int scale);
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern HINSTANCE g_hInst;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
// CODE --------------------------------------------------------------------
//==========================================================================
//
// FStartupScreen :: CreateInstance
//
// Initializes the startup screen for the detected game.
// Sets the size of the progress bar and displays the startup screen.
//
//==========================================================================
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
{
return new FBasicStartupScreen(max_progress);
}
//==========================================================================
//
// FBasicStartupScreen Constructor
//
// Shows a progress bar at the bottom of the window.
//
//==========================================================================
FBasicStartupScreen::FBasicStartupScreen(int max_progress)
: FStartupScreen(max_progress)
{
}
//==========================================================================
//
// FBasicStartupScreen Destructor
//
// Called just before entering graphics mode to deconstruct the startup
// screen.
//
//==========================================================================
FBasicStartupScreen::~FBasicStartupScreen()
{
}
//==========================================================================
//
// FBasicStartupScreen :: Progress
//
// Bumps the progress meter one notch.
//
//==========================================================================
void FBasicStartupScreen::Progress(int advance)
{
CurPos = min(CurPos + advance, MaxPos);
}
//==========================================================================
//
// FBasicStartupScreen :: NetInit
//
// Shows the network startup pane if it isn't visible. Sets the message in
// the pane to the one provided. If numplayers is 0, then the progress bar
// is a scrolling marquee style. If numplayers is 1, then the progress bar
// is just a full bar. If numplayers is >= 2, then the progress bar is a
// normal one, and a progress count is also shown in the pane.
//
//==========================================================================
void FBasicStartupScreen::NetInit(const char *message, bool host)
{
NetStartWindow::NetInit(message, host);
}
void FBasicStartupScreen::NetMessage(const char* message)
{
NetStartWindow::NetMessage(message);
}
void FBasicStartupScreen::NetConnect(int client, const char* name, unsigned flags, int status)
{
NetStartWindow::NetConnect(client, name, flags, status);
}
void FBasicStartupScreen::NetUpdate(int client, int status)
{
NetStartWindow::NetUpdate(client, status);
}
void FBasicStartupScreen::NetDisconnect(int client)
{
NetStartWindow::NetDisconnect(client);
}
//==========================================================================
//
// FBasicStartupScreen :: NetProgress
//
// Sets the network progress meter. If count is 0, it gets bumped by 1.
// Otherwise, it is set to count.
//
//==========================================================================
void FBasicStartupScreen::NetProgress(int cur, int limit)
{
NetStartWindow::NetProgress(cur, limit);
}
//==========================================================================
//
// FBasicStartupScreen :: NetDone
//
// Removes the network startup pane.
//
//==========================================================================
void FBasicStartupScreen::NetDone()
{
NetStartWindow::NetDone();
}
void FBasicStartupScreen::NetClose()
{
NetStartWindow::NetClose();
}
bool FBasicStartupScreen::ShouldStartNet()
{
return NetStartWindow::ShouldStartNet();
}
int FBasicStartupScreen::GetNetKickClient()
{
return NetStartWindow::GetNetKickClient();
}
int FBasicStartupScreen::GetNetBanClient()
{
return NetStartWindow::GetNetBanClient();
}
//==========================================================================
//
// FBasicStartupScreen :: NetLoop
//
// The timer_callback function is called at least two times per second
// and passed the userdata value. It should return true to stop the loop and
// return control to the caller or false to continue the loop.
//
// ST_NetLoop will return true if the loop was halted by the callback and
// false if the loop was halted because the user wants to abort the
// network synchronization.
//
//==========================================================================
bool FBasicStartupScreen::NetLoop(bool (*loopCallback)(void*), void* data)
{
return NetStartWindow::NetLoop(loopCallback, data);
}

View file

@ -34,7 +34,9 @@
#include "i_module.h"
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else
#include <dlfcn.h>

View file

@ -1301,8 +1301,12 @@ void FString::Split(TArray<FString>& tokens, const char *delimiter, EmptyTokenTy
}
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
// Convert from and to Windows wide strings so that we can interface with the Unicode version of the Windows API.

View file

@ -6,7 +6,9 @@
#include "zstring.h"
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif

View file

@ -80,7 +80,7 @@
#include "sbar.h"
#include "decallib.h"
#include "version.h"
#include "st_start.h"
#include "common/widgets/netstartwindow.h"
#include "teaminfo.h"
#include "hardware.h"
#include "sbarinfo.h"
@ -3418,14 +3418,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
}
if (!batchrun && !RunningAsTool) Printf ("ST_Init: Init startup screen.\n");
if (!restart)
{
StartWindow = FStartupScreen::CreateInstance(max_progress);
}
else
{
StartWindow = new FStartupScreen(0);
}
CheckCmdLine();
@ -3453,7 +3445,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
SpriteFrames.Clear();
TexMan.AddTextures([]()
{
StartWindow->Progress();
if (StartScreen) StartScreen->Progress(1);
}, CheckForHacks, InitBuildTiles);
PatchTextures();
@ -3462,7 +3453,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
FixWideStatusBar();
StartWindow->Progress();
if (StartScreen) StartScreen->Progress(1);
V_InitFonts();
InitDoomFonts();
@ -3491,7 +3481,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
I_FatalError ("No player classes defined");
}
StartWindow->Progress();
if (StartScreen) StartScreen->Progress (1);
ParseGLDefs();
@ -3499,7 +3488,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
if (!batchrun && !RunningAsTool) Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
if (StartScreen) StartScreen->LoadingStatus ("Loading graphics", 0x3f);
if (StartScreen) StartScreen->Progress(1);
StartWindow->Progress();
R_Init ();
if (!batchrun && !RunningAsTool) Printf ("DecalLibrary: Load decals.\n");
@ -3640,7 +3628,6 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
if (RunningAsTool)
return 0;
StartWindow->Progress(max_progress);
if (StartScreen)
{
StartScreen->Progress(max_progress); // advance progress bar to the end.
@ -4065,7 +4052,6 @@ int GameMain()
I_ShutdownGraphics();
I_ShutdownInput();
M_SaveDefaultsFinal();
DeleteStartupScreen();
C_UninitCVars(); // must come last so that nothing will access the CVARs anymore after deletion.
if(ret != 1337)
{

View file

@ -48,7 +48,7 @@
#include "p_acs.h"
#include "p_trace.h"
#include "a_sharedglobal.h"
#include "st_start.h"
#include "common/widgets/netstartwindow.h"
#include "teaminfo.h"
#include "p_conversation.h"
#include "d_eventbase.h"

View file

@ -49,7 +49,6 @@
#include "r_data/r_interpolate.h"
#include "po_man.h"
#include "p_effect.h"
#include "st_start.h"
#include "v_font.h"
#include "swrenderer/r_renderer.h"
#include "serializer.h"

View file

@ -52,7 +52,9 @@
#include <stdarg.h>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <mmsystem.h>
#include <richedit.h>