- system backend cleanup.

This is mainly for running CI on Linux and macOS. Windws is already working.
This commit is contained in:
Christoph Oelckers 2020-04-22 19:57:14 +02:00
parent a40578a0a4
commit 12e69adec3
44 changed files with 384 additions and 381 deletions

View File

@ -203,9 +203,9 @@ if( MSVC )
# Function-level linking # Function-level linking
# Disable run-time type information # Disable run-time type information
if ( HAVE_VULKAN ) if ( HAVE_VULKAN )
set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN" ) set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN /D_HAVE_SOFTPOLY" )
else() else()
set( ALL_C_FLAGS "/GF /Gy /permissive-" ) set( ALL_C_FLAGS "/GF /Gy /permissive- /D_HAVE_SOFTPOLY" )
endif() endif()
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall # Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
@ -241,9 +241,9 @@ if( MSVC )
else() else()
set( REL_LINKER_FLAGS "" ) set( REL_LINKER_FLAGS "" )
if ( HAVE_VULKAN ) if ( HAVE_VULKAN )
set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN" ) set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN -D_HAVE_SOFTPOLY" )
else() else()
set( ALL_C_FLAGS "-ffp-contract=off" ) set( ALL_C_FLAGS "-ffp-contract=off -D_HAVE_SOFTPOLY" )
endif() endif()
if ( UNIX ) if ( UNIX )

View File

@ -486,3 +486,4 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length)
if (data) delete[] data; if (data) delete[] data;
return retval; return retval;
} }

View File

@ -144,7 +144,6 @@ struct FISoundChannel
class SoundStream; class SoundStream;
void S_SetSoundPaused(int state);
#endif #endif

View File

@ -8,6 +8,8 @@ struct SystemCallbacks
bool (*NetGame)(); bool (*NetGame)();
bool (*WantNativeMouse)(); bool (*WantNativeMouse)();
bool (*CaptureModeInGame)(); bool (*CaptureModeInGame)();
void (*CrashInfo)(char* buffer, size_t bufflen, const char* lfstr);
}; };
extern SystemCallbacks *sysCallbacks; extern SystemCallbacks *sysCallbacks;

View File

@ -0,0 +1,22 @@
#pragma once
#include "zstring.h"
#ifdef __unix__
FString GetUserFile (const char *path);
#endif
FString M_GetAppDataPath(bool create);
FString M_GetCachePath(bool create);
FString M_GetAutoexecPath();
FString M_GetConfigPath(bool for_reading);
FString M_GetScreenshotsPath();
FString M_GetSavegamesPath();
FString M_GetDocumentsPath();
FString M_GetDemoPath();
FString M_GetNormalizedPath(const char* path);
#ifdef __APPLE__
FString M_GetMacAppSupportPath(const bool create = true);
void M_GetMacSearchDirectories(FString& user_docs, FString& user_app_support, FString& local_app_support);
#endif // __APPLE__

View File

@ -0,0 +1,24 @@
#pragma once
struct FStartupInfo
{
FString Name;
uint32_t FgColor; // Foreground color for title banner
uint32_t BkColor; // Background color for title banner
FString Song;
int Type;
int LoadLights = -1;
int LoadBrightmaps = -1;
enum
{
DefaultStartup,
DoomStartup,
HereticStartup,
HexenStartup,
StrifeStartup,
};
};
extern FStartupInfo GameStartupInfo;

View File

@ -791,14 +791,14 @@ const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *i
if (iwadType == -1) return nullptr; if (iwadType == -1) return nullptr;
//gameiwad = iwadType; //gameiwad = iwadType;
const FIWADInfo *iwad_info = &mIWadInfos[iwadType]; const FIWADInfo *iwad_info = &mIWadInfos[iwadType];
if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name; if (GameStartupInfo.Name.IsEmpty()) GameStartupInfo.Name = iwad_info->Name;
if (DoomStartupInfo.BkColor == 0 && DoomStartupInfo.FgColor == 0) if (GameStartupInfo.BkColor == 0 && GameStartupInfo.FgColor == 0)
{ {
DoomStartupInfo.BkColor = iwad_info->BkColor; GameStartupInfo.BkColor = iwad_info->BkColor;
DoomStartupInfo.FgColor = iwad_info->FgColor; GameStartupInfo.FgColor = iwad_info->FgColor;
} }
if (DoomStartupInfo.Type == 0) DoomStartupInfo.Type = iwad_info->StartupType; if (GameStartupInfo.Type == 0) GameStartupInfo.Type = iwad_info->StartupType;
if (DoomStartupInfo.Song.IsEmpty()) DoomStartupInfo.Song = iwad_info->Song; if (GameStartupInfo.Song.IsEmpty()) GameStartupInfo.Song = iwad_info->Song;
I_SetIWADInfo(); I_SetIWADInfo();
return iwad_info; return iwad_info;
} }

View File

@ -279,7 +279,7 @@ FGameTexture *Advisory;
FTextureID Page; FTextureID Page;
const char *Subtitle; const char *Subtitle;
bool nospriterename; bool nospriterename;
FStartupInfo DoomStartupInfo; FStartupInfo GameStartupInfo;
FString lastIWAD; FString lastIWAD;
int restart = 0; int restart = 0;
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
@ -1795,44 +1795,44 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
else if (!nextKey.CompareNoCase("STARTUPTITLE")) else if (!nextKey.CompareNoCase("STARTUPTITLE"))
{ {
sc.MustGetString(); sc.MustGetString();
DoomStartupInfo.Name = sc.String; GameStartupInfo.Name = sc.String;
} }
else if (!nextKey.CompareNoCase("STARTUPCOLORS")) else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
{ {
sc.MustGetString(); sc.MustGetString();
DoomStartupInfo.FgColor = V_GetColor(NULL, sc); GameStartupInfo.FgColor = V_GetColor(NULL, sc);
sc.MustGetStringName(","); sc.MustGetStringName(",");
sc.MustGetString(); sc.MustGetString();
DoomStartupInfo.BkColor = V_GetColor(NULL, sc); GameStartupInfo.BkColor = V_GetColor(NULL, sc);
} }
else if (!nextKey.CompareNoCase("STARTUPTYPE")) else if (!nextKey.CompareNoCase("STARTUPTYPE"))
{ {
sc.MustGetString(); sc.MustGetString();
FString sttype = sc.String; FString sttype = sc.String;
if (!sttype.CompareNoCase("DOOM")) if (!sttype.CompareNoCase("DOOM"))
DoomStartupInfo.Type = FStartupInfo::DoomStartup; GameStartupInfo.Type = FStartupInfo::DoomStartup;
else if (!sttype.CompareNoCase("HERETIC")) else if (!sttype.CompareNoCase("HERETIC"))
DoomStartupInfo.Type = FStartupInfo::HereticStartup; GameStartupInfo.Type = FStartupInfo::HereticStartup;
else if (!sttype.CompareNoCase("HEXEN")) else if (!sttype.CompareNoCase("HEXEN"))
DoomStartupInfo.Type = FStartupInfo::HexenStartup; GameStartupInfo.Type = FStartupInfo::HexenStartup;
else if (!sttype.CompareNoCase("STRIFE")) else if (!sttype.CompareNoCase("STRIFE"))
DoomStartupInfo.Type = FStartupInfo::StrifeStartup; GameStartupInfo.Type = FStartupInfo::StrifeStartup;
else DoomStartupInfo.Type = FStartupInfo::DefaultStartup; else GameStartupInfo.Type = FStartupInfo::DefaultStartup;
} }
else if (!nextKey.CompareNoCase("STARTUPSONG")) else if (!nextKey.CompareNoCase("STARTUPSONG"))
{ {
sc.MustGetString(); sc.MustGetString();
DoomStartupInfo.Song = sc.String; GameStartupInfo.Song = sc.String;
} }
else if (!nextKey.CompareNoCase("LOADLIGHTS")) else if (!nextKey.CompareNoCase("LOADLIGHTS"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
DoomStartupInfo.LoadLights = !!sc.Number; GameStartupInfo.LoadLights = !!sc.Number;
} }
else if (!nextKey.CompareNoCase("LOADBRIGHTMAPS")) else if (!nextKey.CompareNoCase("LOADBRIGHTMAPS"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
DoomStartupInfo.LoadBrightmaps = !!sc.Number; GameStartupInfo.LoadBrightmaps = !!sc.Number;
} }
else else
{ {
@ -1956,13 +1956,13 @@ static void AddAutoloadFiles(const char *autoname)
// [SP] Dialog reaction - load lights.pk3 and brightmaps.pk3 based on user choices // [SP] Dialog reaction - load lights.pk3 and brightmaps.pk3 based on user choices
if (!(gameinfo.flags & GI_SHAREWARE)) if (!(gameinfo.flags & GI_SHAREWARE))
{ {
if (DoomStartupInfo.LoadLights == 1 || (DoomStartupInfo.LoadLights != 0 && autoloadlights)) if (GameStartupInfo.LoadLights == 1 || (GameStartupInfo.LoadLights != 0 && autoloadlights))
{ {
const char *lightswad = BaseFileSearch ("lights.pk3", NULL, false, GameConfig); const char *lightswad = BaseFileSearch ("lights.pk3", NULL, false, GameConfig);
if (lightswad) if (lightswad)
D_AddFile (allwads, lightswad, true, -1, GameConfig); D_AddFile (allwads, lightswad, true, -1, GameConfig);
} }
if (DoomStartupInfo.LoadBrightmaps == 1 || (DoomStartupInfo.LoadBrightmaps != 0 && autoloadbrightmaps)) if (GameStartupInfo.LoadBrightmaps == 1 || (GameStartupInfo.LoadBrightmaps != 0 && autoloadbrightmaps))
{ {
const char *bmwad = BaseFileSearch ("brightmaps.pk3", NULL, false, GameConfig); const char *bmwad = BaseFileSearch ("brightmaps.pk3", NULL, false, GameConfig);
if (bmwad) if (bmwad)
@ -2627,6 +2627,7 @@ bool System_WantNativeMouse()
static bool System_CaptureModeInGame() static bool System_CaptureModeInGame()
{ {
if (demoplayback || paused) return false;
switch (mouse_capturemode) switch (mouse_capturemode)
{ {
default: default:
@ -2639,6 +2640,59 @@ static bool System_CaptureModeInGame()
} }
} }
//==========================================================================
//
// DoomSpecificInfo
//
// Called by the crash logger to get application-specific information.
//
//==========================================================================
void System_CrashInfo(char* buffer, size_t bufflen, const char *lfstr)
{
const char* arg;
char* const buffend = buffer + bufflen - 2; // -2 for CRLF at end
int i;
buffer += mysnprintf(buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
buffer += snprintf(buffer, buffend - buffer, "%sCommand line:", lfstr);
for (i = 0; i < Args->NumArgs(); ++i)
{
buffer += snprintf(buffer, buffend - buffer, " %s", Args->GetArg(i));
}
for (i = 0; (arg = fileSystem.GetResourceFileName(i)) != NULL; ++i)
{
buffer += mysnprintf(buffer, buffend - buffer, "%sWad %d: %s", lfstr, i, arg);
}
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
{
buffer += mysnprintf(buffer, buffend - buffer, "%s%sNot in a level.", lfstr, lfstr);
}
else
{
buffer += mysnprintf(buffer, buffend - buffer, "%s%sCurrent map: %s", lfstr, lfstr, primaryLevel->MapName.GetChars());
if (!viewactive)
{
buffer += mysnprintf(buffer, buffend - buffer, "%s%sView not active.", lfstr, lfstr);
}
else
{
auto& vp = r_viewpoint;
buffer += mysnprintf(buffer, buffend - buffer, "%s%sviewx = %f", lfstr, lfstr, vp.Pos.X);
buffer += mysnprintf(buffer, buffend - buffer, "%sviewy = %f", lfstr, vp.Pos.Y);
buffer += mysnprintf(buffer, buffend - buffer, "%sviewz = %f", lfstr, vp.Pos.Z);
buffer += mysnprintf(buffer, buffend - buffer, "%sviewangle = %f", lfstr, vp.Angles.Yaw);
}
}
buffer += mysnprintf(buffer, buffend - buffer, "%s", lfstr);
*buffer = 0;
}
static void PatchTextures() static void PatchTextures()
{ {
@ -2788,6 +2842,7 @@ static int D_DoomMain_Internal (void)
System_NetGame, System_NetGame,
System_WantNativeMouse, System_WantNativeMouse,
System_CaptureModeInGame, System_CaptureModeInGame,
System_CrashInfo,
}; };
sysCallbacks = &syscb; sysCallbacks = &syscb;
@ -3323,7 +3378,7 @@ static int D_DoomMain_Internal (void)
void I_ShowFatalError(const char* message); void I_ShowFatalError(const char* message);
int D_DoomMain() int GameMain()
{ {
int ret = 0; int ret = 0;
GameTicRate = TICRATE; GameTicRate = TICRATE;
@ -3406,10 +3461,10 @@ void D_Cleanup()
TexAnim.DeleteAll(); TexAnim.DeleteAll();
TexMan.DeleteAll(); TexMan.DeleteAll();
// delete DoomStartupInfo data // delete GameStartupInfo data
DoomStartupInfo.Name = ""; GameStartupInfo.Name = "";
DoomStartupInfo.BkColor = DoomStartupInfo.FgColor = DoomStartupInfo.Type = 0; GameStartupInfo.BkColor = GameStartupInfo.FgColor = GameStartupInfo.Type = 0;
DoomStartupInfo.LoadLights = DoomStartupInfo.LoadBrightmaps = -1; GameStartupInfo.LoadLights = GameStartupInfo.LoadBrightmaps = -1;
GC::FullGC(); // clean up before taking down the object list. GC::FullGC(); // clean up before taking down the object list.
@ -3566,12 +3621,12 @@ void I_UpdateWindowTitle()
if (level.LevelName && level.LevelName.GetChars()[0]) if (level.LevelName && level.LevelName.GetChars()[0])
{ {
FString titlestr; FString titlestr;
titlestr.Format("%s - %s", level.LevelName.GetChars(), DoomStartupInfo.Name.GetChars()); titlestr.Format("%s - %s", level.LevelName.GetChars(), GameStartupInfo.Name.GetChars());
I_SetWindowTitle(titlestr.GetChars()); I_SetWindowTitle(titlestr.GetChars());
break; break;
} }
case 2: case 2:
I_SetWindowTitle(DoomStartupInfo.Name.GetChars()); I_SetWindowTitle(GameStartupInfo.Name.GetChars());
break; break;
default: default:
I_SetWindowTitle(NULL); I_SetWindowTitle(NULL);

View File

@ -30,6 +30,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "gametype.h" #include "gametype.h"
#include "startupinfo.h"
struct event_t; struct event_t;
@ -45,8 +46,6 @@ struct CRestartException
char dummy; char dummy;
}; };
int D_DoomMain (void);
void D_Display (); void D_Display ();
@ -73,25 +72,6 @@ struct WadStuff
FString Name; FString Name;
}; };
struct FStartupInfo
{
FString Name;
uint32_t FgColor; // Foreground color for title banner
uint32_t BkColor; // Background color for title banner
FString Song;
int Type;
int LoadLights = -1;
int LoadBrightmaps = -1;
enum
{
DefaultStartup,
DoomStartup,
HereticStartup,
HexenStartup,
StrifeStartup,
};
};
struct FIWADInfo struct FIWADInfo
{ {
FString Name; // Title banner text for this IWAD FString Name; // Title banner text for this IWAD
@ -126,8 +106,6 @@ struct FFoundWadInfo
} }
}; };
extern FStartupInfo DoomStartupInfo;
//========================================================================== //==========================================================================
// //
// IWAD identifier class // IWAD identifier class

View File

@ -196,7 +196,7 @@ void G_DeferedInitNew (const char *mapname, int newskill)
gameaction = ga_newgame2; gameaction = ga_newgame2;
} }
void G_DeferedInitNew (FGameStartup *gs) void G_DeferedInitNew (FNewGameStartup *gs)
{ {
if (gs->PlayerClass != NULL) playerclass = gs->PlayerClass; if (gs->PlayerClass != NULL) playerclass = gs->PlayerClass;
d_mapname = AllEpisodes[gs->Episode].mEpisodeMap; d_mapname = AllEpisodes[gs->Episode].mEpisodeMap;

View File

@ -15,8 +15,8 @@ void G_InitNew (const char *mapname, bool bTitleLevel);
// A normal game starts at map 1, // A normal game starts at map 1,
// but a warp test can start elsewhere // but a warp test can start elsewhere
void G_DeferedInitNew (const char *mapname, int skill = -1); void G_DeferedInitNew (const char *mapname, int skill = -1);
struct FGameStartup; struct FNewGameStartup;
void G_DeferedInitNew (FGameStartup *gs); void G_DeferedInitNew (FNewGameStartup *gs);
enum enum
{ {

View File

@ -44,23 +44,6 @@ void M_LoadDefaults ();
bool M_SaveDefaults (const char *filename); bool M_SaveDefaults (const char *filename);
void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, size_t sublen); void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection, size_t sublen);
// Get special directory paths (defined in m_specialpaths.cpp)
#ifdef __unix__
FString GetUserFile (const char *path); // Prepends ~/.zdoom to path
#endif
FString M_GetAppDataPath(bool create);
FString M_GetCachePath(bool create);
FString M_GetAutoexecPath();
FString M_GetCajunPath(const char *filename);
FString M_GetConfigPath(bool for_reading);
FString M_GetScreenshotsPath();
FString M_GetSavegamesPath();
FString M_GetDocumentsPath();
#ifdef __APPLE__
FString M_GetMacAppSupportPath(const bool create = true);
void M_GetMacSearchDirectories(FString& user_docs, FString& user_app_support, FString& local_app_support);
#endif // __APPLE__
#include "i_specialpaths.h"
#endif #endif

View File

@ -107,7 +107,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DMenu, MenuTime, GetMenuTime)
ACTION_RETURN_INT(MenuTime); ACTION_RETURN_INT(MenuTime);
} }
FGameStartup GameStartupInfo; FNewGameStartup NewGameStartupInfo;
EMenuState menuactive; EMenuState menuactive;
bool M_DemoNoPlay; bool M_DemoNoPlay;
FButtonStatus MenuButtons[NUM_MKEYS]; FButtonStatus MenuButtons[NUM_MKEYS];
@ -461,12 +461,12 @@ void M_SetMenu(FName menu, int param)
break; break;
case NAME_Episodemenu: case NAME_Episodemenu:
// sent from the player class menu // sent from the player class menu
GameStartupInfo.Skill = -1; NewGameStartupInfo.Skill = -1;
GameStartupInfo.Episode = -1; NewGameStartupInfo.Episode = -1;
GameStartupInfo.PlayerClass = NewGameStartupInfo.PlayerClass =
param == -1000? nullptr : param == -1000? nullptr :
param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars(); param == -1? "Random" : GetPrintableDisplayName(PlayerClasses[param].Type).GetChars();
M_StartupEpisodeMenu(&GameStartupInfo); // needs player class name from class menu (later) M_StartupEpisodeMenu(&NewGameStartupInfo); // needs player class name from class menu (later)
break; break;
case NAME_Skillmenu: case NAME_Skillmenu:
@ -479,14 +479,14 @@ void M_SetMenu(FName menu, int param)
return; return;
} }
GameStartupInfo.Episode = param; NewGameStartupInfo.Episode = param;
M_StartupSkillMenu(&GameStartupInfo); // needs player class name from class menu (later) M_StartupSkillMenu(&NewGameStartupInfo); // needs player class name from class menu (later)
break; break;
case NAME_StartgameConfirm: case NAME_StartgameConfirm:
{ {
// sent from the skill menu for a skill that needs to be confirmed // sent from the skill menu for a skill that needs to be confirmed
GameStartupInfo.Skill = param; NewGameStartupInfo.Skill = param;
const char *msg = AllSkills[param].MustConfirmText; const char *msg = AllSkills[param].MustConfirmText;
if (*msg==0) msg = GStrings("NIGHTMARE"); if (*msg==0) msg = GStrings("NIGHTMARE");
@ -497,10 +497,10 @@ void M_SetMenu(FName menu, int param)
case NAME_Startgame: case NAME_Startgame:
// sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu // sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu
// Now we can finally start the game. Ugh... // Now we can finally start the game. Ugh...
GameStartupInfo.Skill = param; NewGameStartupInfo.Skill = param;
case NAME_StartgameConfirmed: case NAME_StartgameConfirmed:
G_DeferedInitNew (&GameStartupInfo); G_DeferedInitNew (&NewGameStartupInfo);
if (gamestate == GS_FULLCONSOLE) if (gamestate == GS_FULLCONSOLE)
{ {
gamestate = GS_HIDECONSOLE; gamestate = GS_HIDECONSOLE;

View File

@ -47,14 +47,14 @@ enum EMenuKey
}; };
struct FGameStartup struct FNewGameStartup
{ {
const char *PlayerClass; const char *PlayerClass;
int Episode; int Episode;
int Skill; int Skill;
}; };
extern FGameStartup GameStartupInfo; extern FNewGameStartup NewGameStartupInfo;
struct FSaveGameNode struct FSaveGameNode
{ {
@ -345,8 +345,8 @@ void M_ActivateMenu(DMenu *menu);
void M_ClearMenus (); void M_ClearMenus ();
void M_PreviousMenu (); void M_PreviousMenu ();
void M_ParseMenuDefs(); void M_ParseMenuDefs();
void M_StartupEpisodeMenu(FGameStartup *gs); void M_StartupEpisodeMenu(FNewGameStartup *gs);
void M_StartupSkillMenu(FGameStartup *gs); void M_StartupSkillMenu(FNewGameStartup *gs);
void M_StartControlPanel (bool makeSound, bool scaleoverride = false); void M_StartControlPanel (bool makeSound, bool scaleoverride = false);
void M_SetMenu(FName menu, int param = -1); void M_SetMenu(FName menu, int param = -1);
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None); void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);

View File

@ -1113,7 +1113,7 @@ void M_ParseMenuDefs()
// //
//============================================================================= //=============================================================================
void M_StartupEpisodeMenu(FGameStartup *gs) void M_StartupEpisodeMenu(FNewGameStartup *gs)
{ {
// Build episode menu // Build episode menu
bool success = false; bool success = false;
@ -1670,7 +1670,7 @@ DEFINE_ACTION_FUNCTION(DMenu, UpdateSkinOptions)
//============================================================================= //=============================================================================
extern int restart; extern int restart;
void M_StartupSkillMenu(FGameStartup *gs) void M_StartupSkillMenu(FNewGameStartup *gs)
{ {
static int done = -1; static int done = -1;
bool success = false; bool success = false;

View File

@ -35,19 +35,14 @@
#import <Carbon/Carbon.h> #import <Carbon/Carbon.h>
#include "c_buttons.h"
#include "c_console.h" #include "c_console.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "d_event.h" #include "d_event.h"
#include "c_buttons.h"
#include "d_gui.h" #include "d_gui.h"
#include "dikeys.h" #include "dikeys.h"
#include "doomdef.h"
#include "doomstat.h"
#include "v_video.h" #include "v_video.h"
#include "events.h"
#include "g_game.h"
#include "g_levellocals.h"
#include "i_interface.h" #include "i_interface.h"
@ -61,7 +56,7 @@ CVAR(Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
extern int paused, chatmodeon; extern int paused, chatmodeon;
extern constate_e ConsoleState; extern constate_e ConsoleState;
extern bool ToggleFullscreen;
bool GUICapture; bool GUICapture;
@ -77,22 +72,17 @@ size_t s_skipMouseMoves;
void CheckGUICapture() void CheckGUICapture()
{ {
bool wantCapture = (MENU_Off == menuactive) bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
? (c_down == ConsoleState || c_falling == ConsoleState || chatmodeon)
: (MENU_On == menuactive || MENU_OnNoPause == menuactive);
// [ZZ] check active event handlers that want the UI processing if (wantCapt != GUICapture)
if (!wantCapture && primaryLevel->localEventManager->CheckUiProcessors())
{ {
wantCapture = true; GUICapture = wantCapt;
if (wantCapt && Keyboard != NULL)
{
buttonMap.ResetButtonStates();
}
} }
if (wantCapture != GUICapture)
{
GUICapture = wantCapture;
buttonMap.ResetButtonStates();
}
} }
void SetCursorPosition(const NSPoint position) void SetCursorPosition(const NSPoint position)
@ -160,7 +150,7 @@ void CheckNativeMouse()
{ {
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame(); bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
wantNative = (!m_use_mouse || MENU_WaitKey != menuactive) wantNative = (!m_use_mouse || MENU_WaitKey != menuactive)
&& (!captureModeInGame || GUICapture || paused || demoplayback); && (!captureModeInGame || GUICapture);
} }
} }
else else

View File

@ -36,12 +36,13 @@
#include <IOKit/hid/IOHIDLib.h> #include <IOKit/hid/IOHIDLib.h>
#include "d_event.h" #include "d_event.h"
#include "doomdef.h"
#include "i_system.h" #include "i_system.h"
#include "m_argv.h" #include "m_argv.h"
#include "m_joy.h" #include "m_joy.h"
#include "templates.h" #include "templates.h"
#include "v_text.h" #include "v_text.h"
#include "printf.h"
#include "keydef.h"
EXTERN_CVAR(Bool, joy_axespolling) EXTERN_CVAR(Bool, joy_axespolling)

View File

@ -32,19 +32,18 @@
*/ */
#include "i_common.h" #include "i_common.h"
#include "s_sound.h" #include "s_soundinternal.h"
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include "c_console.h" #include "c_console.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "d_main.h"
#include "i_system.h" #include "i_system.h"
#include "m_argv.h" #include "m_argv.h"
#include "st_console.h" #include "st_console.h"
#include "version.h" #include "version.h"
#include "engineerrors.h" #include "printf.h"
#include "s_music.h" #include "s_music.h"
@ -59,7 +58,7 @@ EXTERN_CVAR(Int, vid_defwidth )
EXTERN_CVAR(Int, vid_defheight) EXTERN_CVAR(Int, vid_defheight)
EXTERN_CVAR(Bool, vid_vsync ) EXTERN_CVAR(Bool, vid_vsync )
int GameMain();
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -169,7 +168,7 @@ int DoMain(int argc, char** argv)
progdir = [[exePath stringByDeletingLastPathComponent] UTF8String]; progdir = [[exePath stringByDeletingLastPathComponent] UTF8String];
progdir += "/"; progdir += "/";
auto ret = D_DoomMain(); auto ret = GameMain();
FConsoleWindow::DeleteInstance(); FConsoleWindow::DeleteInstance();
return ret; return ret;
} }

View File

@ -33,6 +33,7 @@
#include "i_common.h" #include "i_common.h"
#include <fnmatch.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include "i_system.h" #include "i_system.h"

View File

@ -44,21 +44,24 @@
#include "v_video.h" #include "v_video.h"
#include "bitmap.h" #include "bitmap.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "doomstat.h"
#include "hardware.h" #include "hardware.h"
#include "i_system.h" #include "i_system.h"
#include "m_argv.h" #include "m_argv.h"
#include "m_png.h" #include "m_png.h"
#include "swrenderer/r_swrenderer.h"
#include "st_console.h" #include "st_console.h"
#include "v_text.h" #include "v_text.h"
#include "version.h" #include "version.h"
#include "engineerrors.h" #include "printf.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"
#ifdef HAVE_VULKAN
#include "vulkan/system/vk_framebuffer.h" #include "vulkan/system/vk_framebuffer.h"
#endif
#ifdef HAVE_SOFTPOLY
#include "rendering/polyrenderer/backend/poly_framebuffer.h" #include "rendering/polyrenderer/backend/poly_framebuffer.h"
#endif
extern bool ToggleFullscreen;
@implementation NSWindow(ExitAppOnClose) @implementation NSWindow(ExitAppOnClose)
@ -441,6 +444,8 @@ public:
} }
else else
#endif #endif
#ifdef HAVE_SOFTPOLY
if (vid_preferbackend == 2) if (vid_preferbackend == 2)
{ {
SetupOpenGLView(ms_window, OpenGLProfile::Legacy); SetupOpenGLView(ms_window, OpenGLProfile::Legacy);
@ -448,6 +453,7 @@ public:
fb = new PolyFrameBuffer(nullptr, vid_fullscreen); fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
} }
else else
#endif
{ {
SetupOpenGLView(ms_window, OpenGLProfile::Core); SetupOpenGLView(ms_window, OpenGLProfile::Core);
} }
@ -461,6 +467,7 @@ public:
fb->SetMode(vid_fullscreen, vid_hidpi); fb->SetMode(vid_fullscreen, vid_hidpi);
fb->SetSize(fb->GetClientWidth(), fb->GetClientHeight()); fb->SetSize(fb->GetClientWidth(), fb->GetClientHeight());
#ifdef HAVE_VULKAN
// This lame hack is a temporary workaround for strange performance issues // This lame hack is a temporary workaround for strange performance issues
// with fullscreen window and Core Animation's Metal layer // with fullscreen window and Core Animation's Metal layer
// It is somehow related to initial window level and flags // It is somehow related to initial window level and flags
@ -470,6 +477,7 @@ public:
fb->SetMode(false, vid_hidpi); fb->SetMode(false, vid_hidpi);
fb->SetMode(true, vid_hidpi); fb->SetMode(true, vid_hidpi);
} }
#endif
return fb; return fb;
} }
@ -480,8 +488,9 @@ public:
} }
private: private:
#ifdef HAVE_VULKAN
VulkanDevice *m_vulkanDevice = nullptr; VulkanDevice *m_vulkanDevice = nullptr;
#endif
static CocoaWindow* ms_window; static CocoaWindow* ms_window;
static bool ms_isVulkanEnabled; static bool ms_isVulkanEnabled;

View File

@ -32,12 +32,13 @@
*/ */
#include "i_common.h" #include "i_common.h"
#include "startupinfo.h"
#include "d_main.h"
#include "st_console.h" #include "st_console.h"
#include "v_text.h" #include "v_text.h"
#include "version.h" #include "version.h"
#include "palentry.h"
#include "v_video.h"
#include "v_font.h"
static NSColor* RGB(const uint8_t red, const uint8_t green, const uint8_t blue) static NSColor* RGB(const uint8_t red, const uint8_t green, const uint8_t blue)
{ {
@ -339,17 +340,17 @@ void FConsoleWindow::SetTitleText()
// It's used in graphical startup screen, with Hexen style in particular // It's used in graphical startup screen, with Hexen style in particular
// Native OS X backend doesn't implement this yet // Native OS X backend doesn't implement this yet
if (DoomStartupInfo.FgColor == DoomStartupInfo.BkColor) if (GameStartupInfo.FgColor == GameStartupInfo.BkColor)
{ {
DoomStartupInfo.FgColor = ~DoomStartupInfo.FgColor; GameStartupInfo.FgColor = ~GameStartupInfo.FgColor;
} }
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect]; NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
[titleText setStringValue:[NSString stringWithCString:DoomStartupInfo.Name [titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name
encoding:NSISOLatin1StringEncoding]]; encoding:NSISOLatin1StringEncoding]];
[titleText setAlignment:NSCenterTextAlignment]; [titleText setAlignment:NSCenterTextAlignment];
[titleText setTextColor:RGB(DoomStartupInfo.FgColor)]; [titleText setTextColor:RGB(GameStartupInfo.FgColor)];
[titleText setBackgroundColor:RGB(DoomStartupInfo.BkColor)]; [titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]]; [titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
[titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; [titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
[titleText setSelectable:NO]; [titleText setSelectable:NO];

View File

@ -36,10 +36,9 @@
#import <Foundation/NSRunLoop.h> #import <Foundation/NSRunLoop.h>
#include "c_cvars.h" #include "c_cvars.h"
#include "doomtype.h"
#include "st_console.h" #include "st_console.h"
#include "st_start.h" #include "st_start.h"
#include "engineerrors.h" #include "printf.h"
FStartupScreen *StartScreen; FStartupScreen *StartScreen;

View File

@ -36,9 +36,10 @@
#import <Foundation/NSFileManager.h> #import <Foundation/NSFileManager.h>
#include "cmdlib.h" #include "cmdlib.h"
#include "m_misc.h"
#include "version.h" // for GAMENAME #include "version.h" // for GAMENAME
#include "i_specialpaths.h"
FString M_GetMacAppSupportPath(const bool create);
static FString GetSpecialPath(const NSSearchPathDirectory kind, const BOOL create = YES, const NSSearchPathDomainMask domain = NSUserDomainMask) static FString GetSpecialPath(const NSSearchPathDirectory kind, const BOOL create = YES, const NSSearchPathDomainMask domain = NSUserDomainMask)
{ {
@ -199,7 +200,7 @@ FString M_GetScreenshotsPath()
{ {
path += "/" GAME_DIR "/Screenshots/"; path += "/" GAME_DIR "/Screenshots/";
} }
CreatePath(path);
return path; return path;
} }
@ -240,5 +241,45 @@ FString M_GetDocumentsPath()
path += "/" GAME_DIR "/"; path += "/" GAME_DIR "/";
} }
CreatePath(path);
return path;
}
//===========================================================================
//
// M_GetDemoPath macOS
//
// Returns the path to the default demo directory.
//
//===========================================================================
FString M_GetDemoPath()
{
FString path = GetSpecialPath(NSDocumentDirectory);
if (path.IsNotEmpty())
{
path += "/" GAME_DIR "/Demos/";
}
return path;
}
//===========================================================================
//
// M_NormalizedPath
//
// Normalizes the given path and returns the result.
//
//===========================================================================
FString M_GetNormalizedPath(const char* path)
{
NSString *str = [NSString stringWithUTF8String:path];
NSString *out;
if ([str completePathIntoString:&out caseSensitive:NO matchesIntoArray:nil filterTypes:nil])
{
return out.UTF8String;
}
return path; return path;
} }

View File

@ -34,11 +34,9 @@
*/ */
#include "cmdlib.h" #include "cmdlib.h"
#include "d_main.h"
#include "version.h" #include "version.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "m_argv.h" #include "m_argv.h"
#include "m_misc.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "engineerrors.h" #include "engineerrors.h"
@ -385,8 +383,10 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
defaultiwad = wad.Name; defaultiwad = wad.Name;
GameConfig->DoGameSetup("Doom"); GameConfig->ArchiveGlobalData();
M_SaveDefaults(NULL); GameConfig->WriteConfigFile();
delete GameConfig;
GameConfig = nullptr;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

View File

@ -39,10 +39,9 @@
#include "hardware.h" #include "hardware.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "v_text.h" #include "v_text.h"
#include "doomstat.h"
#include "m_argv.h" #include "m_argv.h"
#include "engineerrors.h" #include "c_console.h"
#include "swrenderer/r_swrenderer.h" #include "printf.h"
IVideo *Video; IVideo *Video;

View File

@ -36,7 +36,6 @@
#include <SDL.h> #include <SDL.h>
#include "bitmap.h" #include "bitmap.h"
#include "v_palette.h"
#include "textures.h" #include "textures.h"
bool I_SetCursor(FGameTexture *cursorpic) bool I_SetCursor(FGameTexture *cursorpic)

View File

@ -31,24 +31,17 @@
** **
*/ */
#include <SDL.h> #include <SDL.h>
#include "doomtype.h"
#include "doomdef.h"
#include "doomstat.h"
#include "m_argv.h" #include "m_argv.h"
#include "v_video.h" #include "v_video.h"
#include "d_main.h"
#include "d_event.h" #include "d_event.h"
#include "d_gui.h" #include "d_gui.h"
#include "c_buttons.h" #include "c_buttons.h"
#include "c_console.h" #include "c_console.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "dikeys.h" #include "dikeys.h"
#include "events.h"
#include "g_game.h"
#include "g_levellocals.h"
#include "utf8.h" #include "utf8.h"
#include "engineerrors.h" #include "keydef.h"
#include "i_interface.h" #include "i_interface.h"
@ -58,8 +51,6 @@ static void I_CheckNativeMouse ();
bool GUICapture; bool GUICapture;
static bool NativeMouse = true; static bool NativeMouse = true;
extern int paused;
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
@ -174,25 +165,15 @@ static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
static void I_CheckGUICapture () static void I_CheckGUICapture ()
{ {
bool wantCapt; bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
if (menuactive == MENU_Off)
{
wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
}
else
{
wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
}
// [ZZ] check active event handlers that want the UI processing
if (!wantCapt && primaryLevel->localEventManager->CheckUiProcessors())
wantCapt = true;
if (wantCapt != GUICapture) if (wantCapt != GUICapture)
{ {
GUICapture = wantCapt; GUICapture = wantCapt;
buttonMap.ResetButtonStates(); if (wantCapt && Keyboard != NULL)
{
buttonMap.ResetButtonStates();
}
} }
} }
@ -256,10 +237,9 @@ static void MouseRead ()
static void I_CheckNativeMouse () static void I_CheckNativeMouse ()
{ {
bool focus = SDL_GetKeyboardFocus() != NULL; bool focus = SDL_GetKeyboardFocus() != NULL;
bool fs = screen->IsFullscreen();
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame(); bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
bool wantNative = !focus || (!use_mouse || GUICapture || paused || demoplayback || !captureModeInGame); bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame);
if (wantNative != NativeMouse) if (wantNative != NativeMouse)
{ {

View File

@ -33,6 +33,7 @@
#include <SDL.h> #include <SDL.h>
#include "basics.h" #include "basics.h"
#include "cmdlib.h"
#include "templates.h" #include "templates.h"
#include "m_joy.h" #include "m_joy.h"
#include "keydef.h" #include "keydef.h"

View File

@ -43,19 +43,11 @@
#include "engineerrors.h" #include "engineerrors.h"
#include "m_argv.h" #include "m_argv.h"
#include "d_main.h"
#include "c_console.h" #include "c_console.h"
#include "version.h" #include "version.h"
#include "filesystem.h"
#include "g_level.h"
#include "g_levellocals.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "r_utility.h"
#include "doomstat.h"
#include "vm.h"
#include "engineerrors.h" #include "engineerrors.h"
#include "i_system.h" #include "i_system.h"
#include "g_game.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -74,6 +66,7 @@ void Linux_I_FatalError(const char* errortext);
#endif #endif
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
int GameMain();
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -91,62 +84,10 @@ FArgs *Args;
static int DoomSpecificInfo (char *buffer, char *end) static int GetCrashInfo (char *buffer, char *end)
{ {
const char *arg; if (sysCallbacks && sysCallbacks->CrashInfo) sysCallbacks->CrashInfo(buffer, end - buffer, "\n");
int size = end-buffer-2; return strlen(buffer);
int i, p;
p = 0;
p += snprintf (buffer+p, size-p, GAMENAME" version %s (%s)\n", GetVersionString(), GetGitHash());
#ifdef __VERSION__
p += snprintf (buffer+p, size-p, "Compiler version: %s\n", __VERSION__);
#endif
// If Args is nullptr, then execution is at either
// * early stage of initialization, additional info contains only default values
// * late stage of shutdown, most likely main() was done, and accessing global variables is no longer safe
if (Args)
{
p += snprintf(buffer + p, size - p, "\nCommand line:");
for (i = 0; i < Args->NumArgs(); ++i)
{
p += snprintf(buffer + p, size - p, " %s", Args->GetArg(i));
}
p += snprintf(buffer + p, size - p, "\n");
for (i = 0; (arg = fileSystem.GetResourceFileName(i)) != NULL; ++i)
{
p += snprintf(buffer + p, size - p, "\nWad %d: %s", i, arg);
}
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
{
p += snprintf(buffer + p, size - p, "\n\nNot in a level.");
}
else
{
p += snprintf(buffer + p, size - p, "\n\nCurrent map: %s", primaryLevel->MapName.GetChars());
if (!viewactive)
{
p += snprintf(buffer + p, size - p, "\n\nView not active.");
}
else
{
auto& vp = r_viewpoint;
p += snprintf(buffer + p, size - p, "\n\nviewx = %f", vp.Pos.X);
p += snprintf(buffer + p, size - p, "\nviewy = %f", vp.Pos.Y);
p += snprintf(buffer + p, size - p, "\nviewz = %f", vp.Pos.Z);
p += snprintf(buffer + p, size - p, "\nviewangle = %f", vp.Angles.Yaw.Degrees);
}
}
}
buffer[p++] = '\n';
buffer[p++] = '\0';
return p;
} }
void I_DetectOS() void I_DetectOS()
@ -161,7 +102,7 @@ int main (int argc, char **argv)
#if !defined (__APPLE__) #if !defined (__APPLE__)
{ {
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS }; int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo); cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", GetCrashInfo);
} }
#endif // !__APPLE__ #endif // !__APPLE__
@ -203,7 +144,7 @@ int main (int argc, char **argv)
I_StartupJoysticks(); I_StartupJoysticks();
const int result = D_DoomMain(); const int result = GameMain();
SDL_Quit(); SDL_Quit();

View File

@ -1,35 +1,59 @@
//----------------------------------------------------------------------------- /*
// ** i_system.cpp
// Copyright 1993-1996 id Software ** Main startup code
// Copyright 1999-2016 Randy Heit **
// **---------------------------------------------------------------------------
// This program is free software: you can redistribute it and/or modify ** Copyright 1999-2016 Randy Heit
// it under the terms of the GNU General Public License as published by ** Copyright 2019-2020 Christoph Oelckers
// the Free Software Foundation, either version 3 of the License, or ** All rights reserved.
// (at your option) any later version. **
// ** Redistribution and use in source and binary forms, with or without
// This program is distributed in the hope that it will be useful, ** modification, are permitted provided that the following conditions
// but WITHOUT ANY WARRANTY; without even the implied warranty of ** are met:
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
// GNU General Public License for more details. ** 1. Redistributions of source code must retain the above copyright
// ** notice, this list of conditions and the following disclaimer.
// You should have received a copy of the GNU General Public License ** 2. Redistributions in binary form must reproduce the above copyright
// along with this program. If not, see http://www.gnu.org/licenses/ ** 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 <dirent.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fnmatch.h>
#include <unistd.h>
#include <stdarg.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <SDL.h> #include <SDL.h>
#include "d_main.h"
#include "i_system.h"
#include "version.h"
#include "x86.h" #include "x86.h"
#include "version.h"
#include "cmdlib.h"
#include "m_argv.h"
#include "i_sound.h"
#ifndef NO_GTK #ifndef NO_GTK
bool I_GtkAvailable (); bool I_GtkAvailable ();

View File

@ -33,8 +33,6 @@
// HEADER FILES ------------------------------------------------------------ // HEADER FILES ------------------------------------------------------------
#include "doomtype.h"
#include "i_module.h" #include "i_module.h"
#include "i_system.h" #include "i_system.h"
#include "i_video.h" #include "i_video.h"
@ -43,22 +41,22 @@
#include "version.h" #include "version.h"
#include "c_console.h" #include "c_console.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "s_sound.h" #include "printf.h"
#include "hardware.h" #include "hardware.h"
#include "gl_sysfb.h" #include "gl_sysfb.h"
#include "gl_system.h" #include "gl_system.h"
#include "r_defs.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"
#include "gl/shaders/gl_shader.h"
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
#include "rendering/vulkan/system/vk_framebuffer.h" #include "rendering/vulkan/system/vk_framebuffer.h"
#endif #endif
#ifdef HAVE_SOFTPOLY
#include "rendering/polyrenderer/backend/poly_framebuffer.h" #include "rendering/polyrenderer/backend/poly_framebuffer.h"
#endif
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -76,7 +74,7 @@
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern double refreshfreq;
extern IVideo *Video; extern IVideo *Video;
EXTERN_CVAR (Int, vid_adapter) EXTERN_CVAR (Int, vid_adapter)
@ -261,6 +259,7 @@ bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
} }
#endif #endif
#if HAVE_SOFTPOLY
namespace namespace
{ {
SDL_Renderer* polyrendertarget = nullptr; SDL_Renderer* polyrendertarget = nullptr;
@ -409,7 +408,7 @@ void I_PolyPresentDeinit()
polyrendertarget = nullptr; polyrendertarget = nullptr;
} }
} }
#endif
SDLVideo::SDLVideo () SDLVideo::SDLVideo ()
@ -428,7 +427,9 @@ SDLVideo::SDLVideo ()
} }
#endif // !SDL2_STATIC_LIBRARY #endif // !SDL2_STATIC_LIBRARY
#ifdef HAVE_SOFTPOLY
Priv::softpolyEnabled = vid_preferbackend == 2; Priv::softpolyEnabled = vid_preferbackend == 2;
#endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
Priv::vulkanEnabled = vid_preferbackend == 1 Priv::vulkanEnabled = vid_preferbackend == 1
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface; && Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
@ -443,10 +444,25 @@ SDLVideo::SDLVideo ()
} }
} }
#endif #endif
#ifdef HAVE_SOFTPOLY
if (Priv::softpolyEnabled) if (Priv::softpolyEnabled)
{ {
Priv::CreateWindow(SDL_WINDOW_HIDDEN); Priv::CreateWindow(SDL_WINDOW_HIDDEN);
} }
#endif
// Get refresh rate for current display.
SDL_DisplayMode display;
if(SDL_GetCurrentDisplayMode(vid_adapter, &display) == 0)
{
refreshfreq = display.refresh_rate;
}
else
{
fprintf(stderr, "Failed to get refresh rate: %s\n", SDL_GetError());
return;
}
} }
SDLVideo::~SDLVideo () SDLVideo::~SDLVideo ()
@ -482,11 +498,12 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
} }
#endif #endif
#ifdef HAVE_SOFTPOLY
if (Priv::softpolyEnabled) if (Priv::softpolyEnabled)
{ {
fb = new PolyFrameBuffer(nullptr, vid_fullscreen); fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
} }
#endif
if (fb == nullptr) if (fb == nullptr)
{ {
fb = new OpenGLRenderer::OpenGLFrameBuffer(0, vid_fullscreen); fb = new OpenGLRenderer::OpenGLFrameBuffer(0, vid_fullscreen);
@ -518,6 +535,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
{ {
int width = 0; int width = 0;
#ifdef HAVE_SOFTPOLY
if (Priv::softpolyEnabled) if (Priv::softpolyEnabled)
{ {
if (polyrendertarget) if (polyrendertarget)
@ -526,6 +544,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
SDL_GetWindowSize(Priv::window, &width, nullptr); SDL_GetWindowSize(Priv::window, &width, nullptr);
return width; return width;
} }
#endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
assert(Priv::vulkanEnabled); assert(Priv::vulkanEnabled);
@ -538,7 +557,8 @@ int SystemBaseFrameBuffer::GetClientWidth()
int SystemBaseFrameBuffer::GetClientHeight() int SystemBaseFrameBuffer::GetClientHeight()
{ {
int height = 0; int height = 0;
#ifdef HAVE_SOFTPOLY
if (Priv::softpolyEnabled) if (Priv::softpolyEnabled)
{ {
if (polyrendertarget) if (polyrendertarget)
@ -547,6 +567,7 @@ int SystemBaseFrameBuffer::GetClientHeight()
SDL_GetWindowSize(Priv::window, nullptr, &height); SDL_GetWindowSize(Priv::window, nullptr, &height);
return height; return height;
} }
#endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
assert(Priv::vulkanEnabled); assert(Priv::vulkanEnabled);
@ -588,7 +609,7 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
} }
win_w = w; win_w = w;
win_h = h; win_h = h;
if (vid_fullscreen ) if (vid_fullscreen)
{ {
vid_fullscreen = false; vid_fullscreen = false;
} }

View File

@ -39,7 +39,6 @@
#include <termios.h> #include <termios.h>
#include "st_start.h" #include "st_start.h"
#include "doomdef.h"
#include "i_system.h" #include "i_system.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "engineerrors.h" #include "engineerrors.h"

View File

@ -55,10 +55,11 @@ typedef enum
#endif #endif
#include "c_cvars.h" #include "c_cvars.h"
#include "d_main.h"
#include "i_module.h" #include "i_module.h"
#include "i_system.h" #include "i_system.h"
#include "version.h" #include "version.h"
#include "startupinfo.h"
#include "cmdlib.h"
EXTERN_CVAR (Bool, queryiwad); EXTERN_CVAR (Bool, queryiwad);

View File

@ -11,7 +11,6 @@ void S_Start();
void S_Shutdown(); void S_Shutdown();
void S_UpdateSounds(AActor* listenactor); void S_UpdateSounds(AActor* listenactor);
void S_SetSoundPaused(int state);
void S_PrecacheLevel(FLevelLocals* l); void S_PrecacheLevel(FLevelLocals* l);

View File

@ -44,7 +44,9 @@
#include "version.h" #include "version.h"
#include "printf.h" #include "printf.h"
#include "win32glvideo.h" #include "win32glvideo.h"
#ifdef HAVE_SOFTPOLY
#include "win32polyvideo.h" #include "win32polyvideo.h"
#endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
#include "win32vulkanvideo.h" #include "win32vulkanvideo.h"
#endif #endif
@ -129,10 +131,13 @@ void I_InitGraphics ()
// are the active app. Huh? // are the active app. Huh?
} }
#ifdef HAVE_SOFTPOLY
if (vid_preferbackend == 2) if (vid_preferbackend == 2)
{ {
Video = new Win32PolyVideo(); Video = new Win32PolyVideo();
} }
else
#endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
else if (vid_preferbackend == 1) else if (vid_preferbackend == 1)
{ {
@ -147,15 +152,16 @@ void I_InitGraphics ()
Video = new Win32GLVideo(); Video = new Win32GLVideo();
} }
} }
#endif
else else
#endif
{ {
Video = new Win32GLVideo(); Video = new Win32GLVideo();
} }
#ifdef HAVE_SOFTPOLY
if (Video == NULL) if (Video == NULL)
Video = new Win32PolyVideo(); Video = new Win32PolyVideo();
#endif
// we somehow STILL don't have a display!! // we somehow STILL don't have a display!!
if (Video == NULL) if (Video == NULL)
I_FatalError ("Failed to initialize display"); I_FatalError ("Failed to initialize display");

View File

@ -74,7 +74,7 @@
#include "i_sound.h" #include "i_sound.h"
#include "d_gui.h" #include "d_gui.h"
#include "c_console.h" #include "c_console.h"
#include "s_sound.h" #include "s_soundinternal.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "hardware.h" #include "hardware.h"
#include "d_event.h" #include "d_event.h"
@ -87,8 +87,6 @@
#include "c_buttons.h" #include "c_buttons.h"
#include "cmdlib.h" #include "cmdlib.h"
int32_t refreshfreq = -1;
// Compensate for w32api's lack // Compensate for w32api's lack
#ifndef GET_XBUTTON_WPARAM #ifndef GET_XBUTTON_WPARAM
#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) #define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
@ -138,6 +136,7 @@ extern bool AppActive;
int SessionState = 0; int SessionState = 0;
int BlockMouseMove; int BlockMouseMove;
double refreshfreq;
static bool EventHandlerResultForNativeMouse; static bool EventHandlerResultForNativeMouse;

View File

@ -59,17 +59,13 @@
#include "hardware.h" #include "hardware.h"
#include "m_argv.h" #include "m_argv.h"
#include "d_main.h"
#include "i_module.h" #include "i_module.h"
#include "c_console.h" #include "c_console.h"
#include "version.h" #include "version.h"
#include "i_input.h" #include "i_input.h"
#include "filesystem.h" #include "filesystem.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_game.h" #include "s_soundinternal.h"
#include "r_utility.h"
#include "g_levellocals.h"
#include "s_sound.h"
#include "vm.h" #include "vm.h"
#include "i_system.h" #include "i_system.h"
#include "gstrings.h" #include "gstrings.h"
@ -77,6 +73,8 @@
#include "stats.h" #include "stats.h"
#include "st_start.h" #include "st_start.h"
#include "i_interface.h"
#include "startupinfo.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -96,6 +94,7 @@ void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
void DisplayCrashLog (); void DisplayCrashLog ();
void I_FlushBufferedConsoleStuff(); void I_FlushBufferedConsoleStuff();
void DestroyCustomCursor(); void DestroyCustomCursor();
int GameMain();
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -268,7 +267,7 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
w = rect.right; w = rect.right;
h = rect.bottom; h = rect.bottom;
if (DoomStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL) if (GameStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
{ {
bannerheight = GameTitleFontHeight + 5; bannerheight = GameTitleFontHeight + 5;
MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE); MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE);
@ -426,7 +425,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_DRAWITEM: case WM_DRAWITEM:
// Draw title banner. // Draw title banner.
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty()) if (wParam == IDC_STATIC_TITLE && GameStartupInfo.Name.IsNotEmpty())
{ {
const PalEntry *c; const PalEntry *c;
@ -436,7 +435,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Draw the background. // Draw the background.
rect = drawitem->rcItem; rect = drawitem->rcItem;
rect.bottom -= 1; rect.bottom -= 1;
c = (const PalEntry *)&DoomStartupInfo.BkColor; c = (const PalEntry *)&GameStartupInfo.BkColor;
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b)); hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
FillRect (drawitem->hDC, &drawitem->rcItem, hbr); FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
DeleteObject (hbr); DeleteObject (hbr);
@ -444,11 +443,11 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Calculate width of the title string. // Calculate width of the title string.
SetTextAlign (drawitem->hDC, TA_TOP); SetTextAlign (drawitem->hDC, TA_TOP);
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT)); oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
auto widename = DoomStartupInfo.Name.WideString(); auto widename = GameStartupInfo.Name.WideString();
GetTextExtentPoint32W (drawitem->hDC, widename.c_str(), (int)widename.length(), &size); GetTextExtentPoint32W (drawitem->hDC, widename.c_str(), (int)widename.length(), &size);
// Draw the title. // Draw the title.
c = (const PalEntry *)&DoomStartupInfo.FgColor; c = (const PalEntry *)&GameStartupInfo.FgColor;
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b)); SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
SetBkMode (drawitem->hDC, TRANSPARENT); SetBkMode (drawitem->hDC, TRANSPARENT);
TextOutW (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, widename.c_str(), (int)widename.length()); TextOutW (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, widename.c_str(), (int)widename.length());
@ -950,7 +949,7 @@ int DoMain (HINSTANCE hInstance)
CoInitialize (NULL); CoInitialize (NULL);
atexit (UnCOM); atexit (UnCOM);
int ret = D_DoomMain (); int ret = GameMain ();
DestroyCustomCursor(); DestroyCustomCursor();
if (ret == 1337) // special exit code for 'norun'. if (ret == 1337) // special exit code for 'norun'.
{ {
@ -998,55 +997,6 @@ void I_ShowFatalError(const char *msg)
} }
} }
//==========================================================================
//
// DoomSpecificInfo
//
// Called by the crash logger to get application-specific information.
//
//==========================================================================
void DoomSpecificInfo (char *buffer, size_t bufflen)
{
const char *arg;
char *const buffend = buffer + bufflen - 2; // -2 for CRLF at end
int i;
buffer += mysnprintf (buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
FString cmdline(GetCommandLineW());
buffer += mysnprintf (buffer, buffend - buffer, "\r\nCommand line: %s\r\n", cmdline.GetChars() );
for (i = 0; (arg = fileSystem.GetResourceFileName (i)) != NULL; ++i)
{
buffer += mysnprintf (buffer, buffend - buffer, "\r\nWad %d: %s", i, arg);
}
if (gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL)
{
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nNot in a level.");
}
else
{
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", primaryLevel->MapName.GetChars());
if (!viewactive)
{
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nView not active.");
}
else
{
auto &vp = r_viewpoint;
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nviewx = %f", vp.Pos.X);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewy = %f", vp.Pos.Y);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewz = %f", vp.Pos.Z);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewangle = %f", vp.Angles.Yaw);
}
}
*buffer++ = '\r';
*buffer++ = '\n';
*buffer++ = '\0';
}
// Here is how the error logging system works. // Here is how the error logging system works.
// //
// To catch exceptions that occur in secondary threads, CatchAllExceptions is // To catch exceptions that occur in secondary threads, CatchAllExceptions is
@ -1139,7 +1089,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384); char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384);
CrashPointers = *info; CrashPointers = *info;
DoomSpecificInfo (custominfo, 16384); if (sysCallbacks && sysCallbacks->CrashInfo && custominfo) sysCallbacks->CrashInfo(custominfo, 16384, "\r\n");
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow); CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
// If the main thread crashed, then make it clean up after itself. // If the main thread crashed, then make it clean up after itself.

View File

@ -268,9 +268,10 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
} }
else else
{ {
bool pauseState = false;
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame(); bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) && want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
(!captureModeInGame || GUICapture ||paused || demoplayback)); (!captureModeInGame || GUICapture));
} }
} }

View File

@ -38,6 +38,7 @@
#include <shlobj.h> #include <shlobj.h>
#include <Shlwapi.h> #include <Shlwapi.h>
#include "i_specialpaths.h"
#include "printf.h" #include "printf.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "findfile.h" #include "findfile.h"

View File

@ -59,16 +59,14 @@
#include <mmsystem.h> #include <mmsystem.h>
#include <richedit.h> #include <richedit.h>
#include <wincrypt.h> #include <wincrypt.h>
#include <shlwapi.h>
#include "hardware.h" #include "hardware.h"
#include "engineerrors.h" #include "printf.h"
#include "cmdlib.h"
#include "version.h" #include "version.h"
#include "m_misc.h"
#include "i_sound.h" #include "i_sound.h"
#include "resource.h" #include "resource.h"
#include "x86.h"
#include "stats.h" #include "stats.h"
#include "v_text.h" #include "v_text.h"
#include "utf8.h" #include "utf8.h"
@ -85,6 +83,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "i_system.h" #include "i_system.h"
#include "bitmap.h" #include "bitmap.h"
#include "cmdlib.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -98,7 +97,6 @@
// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
extern void CheckCPUID(CPUInfo *cpu);
extern void LayoutMainWindow(HWND hWnd, HWND pane); extern void LayoutMainWindow(HWND hWnd, HWND pane);
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -549,7 +547,10 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
filepart = WadList[i].Path; filepart = WadList[i].Path;
else else
filepart++; filepart++;
FStringf work("%s (%s)", WadList[i].Name.GetChars(), filepart);
FString work;
if (*filepart) work.Format("%s (%s)", WadList[i].Name.GetChars(), filepart);
else work = WadList[i].Name.GetChars();
std::wstring wide = work.WideString(); std::wstring wide = work.WideString();
SendMessage(ctrl, LB_ADDSTRING, 0, (LPARAM)wide.c_str()); SendMessage(ctrl, LB_ADDSTRING, 0, (LPARAM)wide.c_str());
SendMessage(ctrl, LB_SETITEMDATA, i, (LPARAM)i); SendMessage(ctrl, LB_SETITEMDATA, i, (LPARAM)i);
@ -651,8 +652,8 @@ bool I_SetCursor(FGameTexture *cursorpic)
return false; return false;
} }
// Fixme: This should get a raw image, not a texture. (Once raw images get implemented.) // Fixme: This should get a raw image, not a texture. (Once raw images get implemented.)
int lo = cursorpic->GetDisplayLeftOffset(); int lo = cursorpic->GetTexelLeftOffset();
int to = cursorpic->GetDisplayTopOffset(); int to = cursorpic->GetTexelTopOffset();
cursor = CreateAlphaCursor(image, lo, to); cursor = CreateAlphaCursor(image, lo, to);
if (cursor == NULL) if (cursor == NULL)

View File

@ -1,28 +1,3 @@
//-----------------------------------------------------------------------------
//
// Copyright 1993-1996 id Software
// Copyright 1999-2016 Randy Heit
// Copyright 2002-2016 Christoph Oelckers
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 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, see http://www.gnu.org/licenses/
//
//-----------------------------------------------------------------------------
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_SYSTEM__ #ifndef __I_SYSTEM__

View File

@ -117,18 +117,18 @@ FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
if (!Args->CheckParm("-nostartup")) if (!Args->CheckParm("-nostartup"))
{ {
if (DoomStartupInfo.Type == FStartupInfo::HexenStartup || if (GameStartupInfo.Type == FStartupInfo::HexenStartup ||
(gameinfo.gametype == GAME_Hexen && DoomStartupInfo.Type == FStartupInfo::DefaultStartup)) (gameinfo.gametype == GAME_Hexen && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{ {
scr = new FHexenStartupScreen(max_progress, hr); scr = new FHexenStartupScreen(max_progress, hr);
} }
else if (DoomStartupInfo.Type == FStartupInfo::HereticStartup || else if (GameStartupInfo.Type == FStartupInfo::HereticStartup ||
(gameinfo.gametype == GAME_Heretic && DoomStartupInfo.Type == FStartupInfo::DefaultStartup)) (gameinfo.gametype == GAME_Heretic && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{ {
scr = new FHereticStartupScreen(max_progress, hr); scr = new FHereticStartupScreen(max_progress, hr);
} }
else if (DoomStartupInfo.Type == FStartupInfo::StrifeStartup || else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup ||
(gameinfo.gametype == GAME_Strife && DoomStartupInfo.Type == FStartupInfo::DefaultStartup)) (gameinfo.gametype == GAME_Strife && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{ {
scr = new FStrifeStartupScreen(max_progress, hr); scr = new FStrifeStartupScreen(max_progress, hr);
} }
@ -354,7 +354,7 @@ void FBasicStartupScreen :: NetProgress(int count)
mysnprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos); mysnprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos);
SetDlgItemTextA (NetStartPane, IDC_NETSTARTCOUNT, buf); SetDlgItemTextA (NetStartPane, IDC_NETSTARTCOUNT, buf);
SendDlgItemMessage (NetStartPane, IDC_NETSTARTPROGRESS, PBM_SETPOS, MIN(NetCurPos, NetMaxPos), 0); SendDlgItemMessage (NetStartPane, IDC_NETSTARTPROGRESS, PBM_SETPOS, std::min(NetCurPos, NetMaxPos), 0);
} }
} }

View File

@ -458,9 +458,9 @@ FHexenStartupScreen::FHexenStartupScreen(int max_progress, long& hr)
if (!batchrun) if (!batchrun)
{ {
if (DoomStartupInfo.Song.IsNotEmpty()) if (GameStartupInfo.Song.IsNotEmpty())
{ {
S_ChangeMusic(DoomStartupInfo.Song.GetChars(), true, true); S_ChangeMusic(GameStartupInfo.Song.GetChars(), true, true);
} }
else else
{ {

View File

@ -36,6 +36,7 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <vector> #include <vector>
#include "wglext.h" #include "wglext.h"
#include <vector>
#include "gl_sysfb.h" #include "gl_sysfb.h"
#include "hardware.h" #include "hardware.h"