Skip to content

Commit 53bd92f

Browse files
authored
BSD: Add support (nillerusr#140)
* BSD: Add support * BSD: other fixes There is still a bug when vgui haven't got text, maybe because of resources. Also there is bug where when trying to start new game caption names shows wrong. * BSD: Debugging * BSD: modify preprocessor and fix windows * BSD: Remove debugging and fix labels in gameui * BSD: Remove disabling some DX9 commands * BSD: Remove -g flag
1 parent 807eaae commit 53bd92f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+221
-178
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ waf3*/
3737
.vscode/
3838
.depproj/
3939
source-engine.sln
40+
hl2/
41+

appframework/glmdisplaydb_linuxwin.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ void GLMDisplayInfo::Dump( int which )
631631
{
632632
SDLAPP_FUNC;
633633

634-
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, pixwidth=%d pixheight=%d",
635-
which, (int)this, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
634+
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %p, pixwidth=%d pixheight=%d",
635+
which, this, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
636636

637637
FOR_EACH_VEC( *m_modes, i )
638638
{

appframework/sdlmgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class CSDLMgr : public ILauncherMgr
270270

271271
// Get the next N events. The function returns the number of events that were filled into your array.
272272
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
273-
#ifdef LINUX
273+
#if defined(LINUX) || defined(BSD)
274274
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
275275
#endif
276276

@@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
10041004
return nToWrite;
10051005
}
10061006

1007-
#ifdef LINUX
1007+
#if defined(LINUX) || defined(BSD)
10081008

10091009
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
10101010
{

common/freetype/config/ftconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#ifdef ANDROID
55
#include <sys/cdefs.h>
6-
#elif defined(OSX)
6+
#elif defined(OSX) || defined(BSD)
77
#include <stdint.h>
88
#else
99
#include <bits/wordsize.h>

common/vgui_surfacelib/FontManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "filesystem.h"
1818
#include "vguifont.h"
1919

20-
#if defined(LINUX) || defined(OSX)
20+
#ifdef POSIX
2121
#include <ft2build.h>
2222
#include FT_FREETYPE_H
2323
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
@@ -71,7 +71,7 @@ class CFontManager
7171
IFileSystem *FileSystem() { return m_pFileSystem; }
7272
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
7373

74-
#if defined(LINUX) || defined(OSX)
74+
#ifdef POSIX
7575
FT_Library GetFontLibraryHandle() { return library; }
7676
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
7777
#endif
@@ -96,7 +96,7 @@ class CFontManager
9696
CUtlVector<CFontAmalgam> m_FontAmalgams;
9797
CUtlVector<font_t *> m_Win32Fonts;
9898

99-
#if defined(LINUX) || defined(OSX)
99+
#ifdef POSIX
100100
FT_Library library;
101101
FontDataHelper m_pFontDataHelper;
102102
#endif

common/vgui_surfacelib/vguifont.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ struct newChar_t
2323
#ifdef WIN32
2424
#include "Win32Font.h"
2525
typedef CWin32Font font_t;
26-
#elif defined(LINUX) || defined(OSX)
26+
#elif defined(POSIX)
2727
#include "linuxfont.h"
2828
typedef CLinuxFont font_t;
2929
#else
3030
#error
3131
#endif
3232

3333

34-
#endif //VGUIFONT_H
34+
#endif //VGUIFONT_H

engine/bugreporter.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include <copyfile.h>
2121
#import <mach/mach_host.h>
2222
#import <sys/sysctl.h>
23+
#elif defined(BSD)
24+
# include <sys/sysctl.h>
25+
# include <sys/types.h>
26+
# include <fcntl.h>
27+
# define HW_MEMSIZE HW_PHYSMEM
2328
#elif defined(LINUX)
2429
#include <sys/types.h>
2530
#include <sys/stat.h>
@@ -105,7 +110,7 @@
105110
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
106111
#elif defined(OSX)
107112
#define BUG_REPOSITORY_URL "/Volumes/bugs"
108-
#elif defined(LINUX)
113+
#elif defined(LINUX) || defined(BSD)
109114
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
110115
#else
111116
//#error
@@ -139,7 +144,7 @@ unsigned long GetRam()
139144
MEMORYSTATUS stat;
140145
GlobalMemoryStatus( &stat );
141146
return (stat.dwTotalPhys / (1024 * 1024));
142-
#elif defined(OSX)
147+
#elif defined(OSX) || defined(BSD)
143148
int mib[2] = { CTL_HW, HW_MEMSIZE };
144149
u_int namelen = sizeof(mib) / sizeof(mib[0]);
145150
uint64_t memsize;
@@ -340,6 +345,12 @@ void DisplaySystemVersion( char *osversion, int maxlen )
340345

341346
fclose( fpKernelVer );
342347
}
348+
#elif BSD
349+
#ifdef __FreeBSD__
350+
osversion = (char *)"FreeBSD";
351+
#else
352+
osversion = (char *)"*BSD";
353+
#endif
343354
#endif
344355
}
345356

@@ -2246,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
22462257
}
22472258
}
22482259

2249-
#ifdef LINUX
2260+
#if defined(LINUX) || defined(BSD)
22502261
#define COPYFILE_ALL 0
22512262
#define BSIZE 65535
22522263
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )

engine/host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3947,7 +3947,7 @@ bool DLL_LOCAL Host_IsValidSignature( const char *pFilename, bool bAllowUnknown
39473947
#if defined( SWDS ) || defined(_X360)
39483948
return true;
39493949
#else
3950-
if ( sv.IsDedicated() || IsOSX() || IsLinux() )
3950+
if ( sv.IsDedicated() || IsOSX() || IsLinux() || IsBSD() )
39513951
{
39523952
// dedicated servers and Mac and Linux binaries don't check signatures
39533953
return true;

engine/sv_main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,6 +2714,14 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
27142714
event->SetString( "os", "LINUX" );
27152715
#elif defined ( OSX )
27162716
event->SetString( "os", "OSX" );
2717+
#elif defined(BSD)
2718+
event->SetString("os",
2719+
# ifdef __FreeBSD__
2720+
"FreeBSD"
2721+
# else
2722+
"BSD"
2723+
# endif
2724+
);
27172725
#else
27182726
#error
27192727
#endif

engine/sv_uploadgamestats.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
#include <sys/socket.h>
2222
#include <netinet/in.h>
2323
//$ #include <uuid/uuid.h>
24-
typedef unsigned char uuid_t[16];
2524
#ifdef OSX
2625
#include <uuid/uuid.h>
26+
#elif defined(BSD)
27+
#include <uuid.h>
2728
#else
2829
typedef unsigned char uuid_t[16];
2930
#endif
@@ -397,6 +398,9 @@ class CUploadGameStats : public IUploadGameStats
397398
uuid_t newId;
398399
#ifdef OSX
399400
uuid_generate( newId );
401+
#elif defined(BSD)
402+
uint32_t status;
403+
uuid_create( &newId, &status );
400404
#endif
401405
#else
402406
#error

0 commit comments

Comments
 (0)