- 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
# Disable run-time type information
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()
set( ALL_C_FLAGS "/GF /Gy /permissive-" )
set( ALL_C_FLAGS "/GF /Gy /permissive- /D_HAVE_SOFTPOLY" )
endif()
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
@ -241,9 +241,9 @@ if( MSVC )
else()
set( REL_LINKER_FLAGS "" )
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()
set( ALL_C_FLAGS "-ffp-contract=off" )
set( ALL_C_FLAGS "-ffp-contract=off -D_HAVE_SOFTPOLY" )
endif()
if ( UNIX )

View file

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

View file

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

View file

@ -8,6 +8,8 @@ struct SystemCallbacks
bool (*NetGame)();
bool (*WantNativeMouse)();
bool (*CaptureModeInGame)();
void (*CrashInfo)(char* buffer, size_t bufflen, const char* lfstr);
};
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;
//gameiwad = iwadType;
const FIWADInfo *iwad_info = &mIWadInfos[iwadType];
if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name;
if (DoomStartupInfo.BkColor == 0 && DoomStartupInfo.FgColor == 0)
if (GameStartupInfo.Name.IsEmpty()) GameStartupInfo.Name = iwad_info->Name;
if (GameStartupInfo.BkColor == 0 && GameStartupInfo.FgColor == 0)
{
DoomStartupInfo.BkColor = iwad_info->BkColor;
DoomStartupInfo.FgColor = iwad_info->FgColor;
GameStartupInfo.BkColor = iwad_info->BkColor;
GameStartupInfo.FgColor = iwad_info->FgColor;
}
if (DoomStartupInfo.Type == 0) DoomStartupInfo.Type = iwad_info->StartupType;
if (DoomStartupInfo.Song.IsEmpty()) DoomStartupInfo.Song = iwad_info->Song;
if (GameStartupInfo.Type == 0) GameStartupInfo.Type = iwad_info->StartupType;
if (GameStartupInfo.Song.IsEmpty()) GameStartupInfo.Song = iwad_info->Song;
I_SetIWADInfo();
return iwad_info;
}

View file

@ -279,7 +279,7 @@ FGameTexture *Advisory;
FTextureID Page;
const char *Subtitle;
bool nospriterename;
FStartupInfo DoomStartupInfo;
FStartupInfo GameStartupInfo;
FString lastIWAD;
int restart = 0;
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"))
{
sc.MustGetString();
DoomStartupInfo.Name = sc.String;
GameStartupInfo.Name = sc.String;
}
else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
{
sc.MustGetString();
DoomStartupInfo.FgColor = V_GetColor(NULL, sc);
GameStartupInfo.FgColor = V_GetColor(NULL, sc);
sc.MustGetStringName(",");
sc.MustGetString();
DoomStartupInfo.BkColor = V_GetColor(NULL, sc);
GameStartupInfo.BkColor = V_GetColor(NULL, sc);
}
else if (!nextKey.CompareNoCase("STARTUPTYPE"))
{
sc.MustGetString();
FString sttype = sc.String;
if (!sttype.CompareNoCase("DOOM"))
DoomStartupInfo.Type = FStartupInfo::DoomStartup;
GameStartupInfo.Type = FStartupInfo::DoomStartup;
else if (!sttype.CompareNoCase("HERETIC"))
DoomStartupInfo.Type = FStartupInfo::HereticStartup;
GameStartupInfo.Type = FStartupInfo::HereticStartup;
else if (!sttype.CompareNoCase("HEXEN"))
DoomStartupInfo.Type = FStartupInfo::HexenStartup;
GameStartupInfo.Type = FStartupInfo::HexenStartup;
else if (!sttype.CompareNoCase("STRIFE"))
DoomStartupInfo.Type = FStartupInfo::StrifeStartup;
else DoomStartupInfo.Type = FStartupInfo::DefaultStartup;
GameStartupInfo.Type = FStartupInfo::StrifeStartup;
else GameStartupInfo.Type = FStartupInfo::DefaultStartup;
}
else if (!nextKey.CompareNoCase("STARTUPSONG"))
{
sc.MustGetString();
DoomStartupInfo.Song = sc.String;
GameStartupInfo.Song = sc.String;
}
else if (!nextKey.CompareNoCase("LOADLIGHTS"))
{
sc.MustGetNumber();
DoomStartupInfo.LoadLights = !!sc.Number;
GameStartupInfo.LoadLights = !!sc.Number;
}
else if (!nextKey.CompareNoCase("LOADBRIGHTMAPS"))
{
sc.MustGetNumber();
DoomStartupInfo.LoadBrightmaps = !!sc.Number;
GameStartupInfo.LoadBrightmaps = !!sc.Number;
}
else
{
@ -1956,13 +1956,13 @@ static void AddAutoloadFiles(const char *autoname)
// [SP] Dialog reaction - load lights.pk3 and brightmaps.pk3 based on user choices
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);
if (lightswad)
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);
if (bmwad)
@ -2627,6 +2627,7 @@ bool System_WantNativeMouse()
static bool System_CaptureModeInGame()
{
if (demoplayback || paused) return false;
switch (mouse_capturemode)
{
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()
{
@ -2788,6 +2842,7 @@ static int D_DoomMain_Internal (void)
System_NetGame,
System_WantNativeMouse,
System_CaptureModeInGame,
System_CrashInfo,
};
sysCallbacks = &syscb;
@ -3323,7 +3378,7 @@ static int D_DoomMain_Internal (void)
void I_ShowFatalError(const char* message);
int D_DoomMain()
int GameMain()
{
int ret = 0;
GameTicRate = TICRATE;
@ -3406,10 +3461,10 @@ void D_Cleanup()
TexAnim.DeleteAll();
TexMan.DeleteAll();
// delete DoomStartupInfo data
DoomStartupInfo.Name = "";
DoomStartupInfo.BkColor = DoomStartupInfo.FgColor = DoomStartupInfo.Type = 0;
DoomStartupInfo.LoadLights = DoomStartupInfo.LoadBrightmaps = -1;
// delete GameStartupInfo data
GameStartupInfo.Name = "";
GameStartupInfo.BkColor = GameStartupInfo.FgColor = GameStartupInfo.Type = 0;
GameStartupInfo.LoadLights = GameStartupInfo.LoadBrightmaps = -1;
GC::FullGC(); // clean up before taking down the object list.
@ -3566,12 +3621,12 @@ void I_UpdateWindowTitle()
if (level.LevelName && level.LevelName.GetChars()[0])
{
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());
break;
}
case 2:
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
I_SetWindowTitle(GameStartupInfo.Name.GetChars());
break;
default:
I_SetWindowTitle(NULL);

View file

@ -30,6 +30,7 @@
#include "doomtype.h"
#include "gametype.h"
#include "startupinfo.h"
struct event_t;
@ -45,8 +46,6 @@ struct CRestartException
char dummy;
};
int D_DoomMain (void);
void D_Display ();
@ -73,25 +72,6 @@ struct WadStuff
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
{
FString Name; // Title banner text for this IWAD
@ -126,8 +106,6 @@ struct FFoundWadInfo
}
};
extern FStartupInfo DoomStartupInfo;
//==========================================================================
//
// IWAD identifier class

View file

@ -196,7 +196,7 @@ void G_DeferedInitNew (const char *mapname, int newskill)
gameaction = ga_newgame2;
}
void G_DeferedInitNew (FGameStartup *gs)
void G_DeferedInitNew (FNewGameStartup *gs)
{
if (gs->PlayerClass != NULL) playerclass = gs->PlayerClass;
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,
// but a warp test can start elsewhere
void G_DeferedInitNew (const char *mapname, int skill = -1);
struct FGameStartup;
void G_DeferedInitNew (FGameStartup *gs);
struct FNewGameStartup;
void G_DeferedInitNew (FNewGameStartup *gs);
enum
{

View file

@ -44,23 +44,6 @@ void M_LoadDefaults ();
bool M_SaveDefaults (const char *filename);
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

View file

@ -107,7 +107,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DMenu, MenuTime, GetMenuTime)
ACTION_RETURN_INT(MenuTime);
}
FGameStartup GameStartupInfo;
FNewGameStartup NewGameStartupInfo;
EMenuState menuactive;
bool M_DemoNoPlay;
FButtonStatus MenuButtons[NUM_MKEYS];
@ -461,12 +461,12 @@ void M_SetMenu(FName menu, int param)
break;
case NAME_Episodemenu:
// sent from the player class menu
GameStartupInfo.Skill = -1;
GameStartupInfo.Episode = -1;
GameStartupInfo.PlayerClass =
NewGameStartupInfo.Skill = -1;
NewGameStartupInfo.Episode = -1;
NewGameStartupInfo.PlayerClass =
param == -1000? nullptr :
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;
case NAME_Skillmenu:
@ -479,14 +479,14 @@ void M_SetMenu(FName menu, int param)
return;
}
GameStartupInfo.Episode = param;
M_StartupSkillMenu(&GameStartupInfo); // needs player class name from class menu (later)
NewGameStartupInfo.Episode = param;
M_StartupSkillMenu(&NewGameStartupInfo); // needs player class name from class menu (later)
break;
case NAME_StartgameConfirm:
{
// 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;
if (*msg==0) msg = GStrings("NIGHTMARE");
@ -497,10 +497,10 @@ void M_SetMenu(FName menu, int param)
case NAME_Startgame:
// 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...
GameStartupInfo.Skill = param;
NewGameStartupInfo.Skill = param;
case NAME_StartgameConfirmed:
G_DeferedInitNew (&GameStartupInfo);
G_DeferedInitNew (&NewGameStartupInfo);
if (gamestate == GS_FULLCONSOLE)
{
gamestate = GS_HIDECONSOLE;

View file

@ -47,14 +47,14 @@ enum EMenuKey
};
struct FGameStartup
struct FNewGameStartup
{
const char *PlayerClass;
int Episode;
int Skill;
};
extern FGameStartup GameStartupInfo;
extern FNewGameStartup NewGameStartupInfo;
struct FSaveGameNode
{
@ -345,8 +345,8 @@ void M_ActivateMenu(DMenu *menu);
void M_ClearMenus ();
void M_PreviousMenu ();
void M_ParseMenuDefs();
void M_StartupEpisodeMenu(FGameStartup *gs);
void M_StartupSkillMenu(FGameStartup *gs);
void M_StartupEpisodeMenu(FNewGameStartup *gs);
void M_StartupSkillMenu(FNewGameStartup *gs);
void M_StartControlPanel (bool makeSound, bool scaleoverride = false);
void M_SetMenu(FName menu, int param = -1);
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
bool success = false;
@ -1670,7 +1670,7 @@ DEFINE_ACTION_FUNCTION(DMenu, UpdateSkinOptions)
//=============================================================================
extern int restart;
void M_StartupSkillMenu(FGameStartup *gs)
void M_StartupSkillMenu(FNewGameStartup *gs)
{
static int done = -1;
bool success = false;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -32,12 +32,13 @@
*/
#include "i_common.h"
#include "d_main.h"
#include "startupinfo.h"
#include "st_console.h"
#include "v_text.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)
{
@ -339,17 +340,17 @@ void FConsoleWindow::SetTitleText()
// It's used in graphical startup screen, with Hexen style in particular
// 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];
[titleText setStringValue:[NSString stringWithCString:DoomStartupInfo.Name
[titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name
encoding:NSISOLatin1StringEncoding]];
[titleText setAlignment:NSCenterTextAlignment];
[titleText setTextColor:RGB(DoomStartupInfo.FgColor)];
[titleText setBackgroundColor:RGB(DoomStartupInfo.BkColor)];
[titleText setTextColor:RGB(GameStartupInfo.FgColor)];
[titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
[titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
[titleText setSelectable:NO];

View file

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

View file

@ -36,9 +36,10 @@
#import <Foundation/NSFileManager.h>
#include "cmdlib.h"
#include "m_misc.h"
#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)
{
@ -199,7 +200,7 @@ FString M_GetScreenshotsPath()
{
path += "/" GAME_DIR "/Screenshots/";
}
CreatePath(path);
return path;
}
@ -240,5 +241,45 @@ FString M_GetDocumentsPath()
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;
}

View file

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

View file

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

View file

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

View file

@ -31,24 +31,17 @@
**
*/
#include <SDL.h>
#include "doomtype.h"
#include "doomdef.h"
#include "doomstat.h"
#include "m_argv.h"
#include "v_video.h"
#include "d_main.h"
#include "d_event.h"
#include "d_gui.h"
#include "c_buttons.h"
#include "c_console.h"
#include "c_dispatch.h"
#include "dikeys.h"
#include "events.h"
#include "g_game.h"
#include "g_levellocals.h"
#include "utf8.h"
#include "engineerrors.h"
#include "keydef.h"
#include "i_interface.h"
@ -58,8 +51,6 @@ static void I_CheckNativeMouse ();
bool GUICapture;
static bool NativeMouse = true;
extern int paused;
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, m_noprescale, 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 ()
{
bool wantCapt;
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;
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
if (wantCapt != GUICapture)
{
GUICapture = wantCapt;
buttonMap.ResetButtonStates();
if (wantCapt && Keyboard != NULL)
{
buttonMap.ResetButtonStates();
}
}
}
@ -256,10 +237,9 @@ static void MouseRead ()
static void I_CheckNativeMouse ()
{
bool focus = SDL_GetKeyboardFocus() != NULL;
bool fs = screen->IsFullscreen();
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)
{

View file

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

View file

@ -43,19 +43,11 @@
#include "engineerrors.h"
#include "m_argv.h"
#include "d_main.h"
#include "c_console.h"
#include "version.h"
#include "filesystem.h"
#include "g_level.h"
#include "g_levellocals.h"
#include "cmdlib.h"
#include "r_utility.h"
#include "doomstat.h"
#include "vm.h"
#include "engineerrors.h"
#include "i_system.h"
#include "g_game.h"
// MACROS ------------------------------------------------------------------
@ -74,6 +66,7 @@ void Linux_I_FatalError(const char* errortext);
#endif
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
int GameMain();
// 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;
int size = end-buffer-2;
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;
if (sysCallbacks && sysCallbacks->CrashInfo) sysCallbacks->CrashInfo(buffer, end - buffer, "\n");
return strlen(buffer);
}
void I_DetectOS()
@ -161,7 +102,7 @@ int main (int argc, char **argv)
#if !defined (__APPLE__)
{
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__
@ -203,7 +144,7 @@ int main (int argc, char **argv)
I_StartupJoysticks();
const int result = D_DoomMain();
const int result = GameMain();
SDL_Quit();

View file

@ -1,35 +1,59 @@
//-----------------------------------------------------------------------------
//
// Copyright 1993-1996 id Software
// Copyright 1999-2016 Randy Heit
//
// 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/
//
//-----------------------------------------------------------------------------
//
/*
** i_system.cpp
** Main startup code
**
**---------------------------------------------------------------------------
** Copyright 1999-2016 Randy Heit
** Copyright 2019-2020 Christoph Oelckers
** 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 <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 <time.h>
#include <unistd.h>
#include <SDL.h>
#include "d_main.h"
#include "i_system.h"
#include "version.h"
#include "x86.h"
#include "version.h"
#include "cmdlib.h"
#include "m_argv.h"
#include "i_sound.h"
#ifndef NO_GTK
bool I_GtkAvailable ();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -59,17 +59,13 @@
#include "hardware.h"
#include "m_argv.h"
#include "d_main.h"
#include "i_module.h"
#include "c_console.h"
#include "version.h"
#include "i_input.h"
#include "filesystem.h"
#include "cmdlib.h"
#include "g_game.h"
#include "r_utility.h"
#include "g_levellocals.h"
#include "s_sound.h"
#include "s_soundinternal.h"
#include "vm.h"
#include "i_system.h"
#include "gstrings.h"
@ -77,6 +73,8 @@
#include "stats.h"
#include "st_start.h"
#include "i_interface.h"
#include "startupinfo.h"
// MACROS ------------------------------------------------------------------
@ -96,6 +94,7 @@ void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
void DisplayCrashLog ();
void I_FlushBufferedConsoleStuff();
void DestroyCustomCursor();
int GameMain();
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -268,7 +267,7 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
w = rect.right;
h = rect.bottom;
if (DoomStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
if (GameStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
{
bannerheight = GameTitleFontHeight + 5;
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:
// Draw title banner.
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty())
if (wParam == IDC_STATIC_TITLE && GameStartupInfo.Name.IsNotEmpty())
{
const PalEntry *c;
@ -436,7 +435,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Draw the background.
rect = drawitem->rcItem;
rect.bottom -= 1;
c = (const PalEntry *)&DoomStartupInfo.BkColor;
c = (const PalEntry *)&GameStartupInfo.BkColor;
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
DeleteObject (hbr);
@ -444,11 +443,11 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Calculate width of the title string.
SetTextAlign (drawitem->hDC, TA_TOP);
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);
// Draw the title.
c = (const PalEntry *)&DoomStartupInfo.FgColor;
c = (const PalEntry *)&GameStartupInfo.FgColor;
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
SetBkMode (drawitem->hDC, TRANSPARENT);
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);
atexit (UnCOM);
int ret = D_DoomMain ();
int ret = GameMain ();
DestroyCustomCursor();
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.
//
// 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);
CrashPointers = *info;
DoomSpecificInfo (custominfo, 16384);
if (sysCallbacks && sysCallbacks->CrashInfo && custominfo) sysCallbacks->CrashInfo(custominfo, 16384, "\r\n");
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
// 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
{
bool pauseState = false;
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
(!captureModeInGame || GUICapture ||paused || demoplayback));
(!captureModeInGame || GUICapture));
}
}

View file

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

View file

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

View file

@ -117,18 +117,18 @@ FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
if (!Args->CheckParm("-nostartup"))
{
if (DoomStartupInfo.Type == FStartupInfo::HexenStartup ||
(gameinfo.gametype == GAME_Hexen && DoomStartupInfo.Type == FStartupInfo::DefaultStartup))
if (GameStartupInfo.Type == FStartupInfo::HexenStartup ||
(gameinfo.gametype == GAME_Hexen && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{
scr = new FHexenStartupScreen(max_progress, hr);
}
else if (DoomStartupInfo.Type == FStartupInfo::HereticStartup ||
(gameinfo.gametype == GAME_Heretic && DoomStartupInfo.Type == FStartupInfo::DefaultStartup))
else if (GameStartupInfo.Type == FStartupInfo::HereticStartup ||
(gameinfo.gametype == GAME_Heretic && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{
scr = new FHereticStartupScreen(max_progress, hr);
}
else if (DoomStartupInfo.Type == FStartupInfo::StrifeStartup ||
(gameinfo.gametype == GAME_Strife && DoomStartupInfo.Type == FStartupInfo::DefaultStartup))
else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup ||
(gameinfo.gametype == GAME_Strife && GameStartupInfo.Type == FStartupInfo::DefaultStartup))
{
scr = new FStrifeStartupScreen(max_progress, hr);
}
@ -354,7 +354,7 @@ void FBasicStartupScreen :: NetProgress(int count)
mysnprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos);
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 (DoomStartupInfo.Song.IsNotEmpty())
if (GameStartupInfo.Song.IsNotEmpty())
{
S_ChangeMusic(DoomStartupInfo.Song.GetChars(), true, true);
S_ChangeMusic(GameStartupInfo.Song.GetChars(), true, true);
}
else
{

View file

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