Andrey Akhmichin
3 years ago
37 changed files with 384 additions and 2634 deletions
@ -1,163 +0,0 @@
@@ -1,163 +0,0 @@
|
||||
//======== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ========
|
||||
//
|
||||
// The copyright to the contents herein is the property of Valve, L.L.C.
|
||||
// The contents may be used and/or copied only with the written permission of
|
||||
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
|
||||
// the agreement/contract under which the contents have been supplied.
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $Workfile: $
|
||||
// $Date: $
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// $Log: $
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#include <windows.h> |
||||
#include <dsound.h> |
||||
#include <mmsystem.h> |
||||
#include "r_studioint.h" |
||||
|
||||
extern engine_studio_api_t IEngineStudio; |
||||
|
||||
#define RENDERTYPE_UNDEFINED 0 |
||||
#define RENDERTYPE_SOFTWARE 1 |
||||
#define RENDERTYPE_HARDWARE 2 |
||||
|
||||
#define ENGINE_LAUNCHER_API_VERSION 1 |
||||
|
||||
LPDIRECTSOUND lpDS = NULL; |
||||
LPDIRECTSOUNDBUFFER lpDSBuf = NULL; |
||||
LPHWAVEOUT lpHW = NULL; |
||||
|
||||
static HMODULE hEngine = 0; |
||||
|
||||
typedef struct engine_api_s |
||||
{ |
||||
int version; |
||||
int rendertype; |
||||
int size; |
||||
|
||||
// Functions
|
||||
void ( *unused1 ) ( void ); |
||||
void ( *unused2 ) ( void ); |
||||
void ( *unused3 ) ( void ); |
||||
void ( *unused4 ) ( void ); |
||||
void ( *unused5 ) ( void ); |
||||
void ( *unused6 ) ( void ); |
||||
void ( *unused7 ) ( void ); |
||||
void ( *unused8 ) ( void ); |
||||
void ( *unused9 ) ( void ); |
||||
void ( *unused10 ) ( void ); |
||||
void ( *unused11 ) ( void ); |
||||
void ( *unused12 ) ( void ); |
||||
void ( *unused13 ) ( void ); |
||||
void ( *unused14 ) ( void ); |
||||
void ( *unused15 ) ( void ); |
||||
void ( *unused16 ) ( void ); |
||||
void ( *unused17 ) ( void ); |
||||
void ( *unused18 ) ( void ); |
||||
void ( *unused19 ) ( void ); |
||||
void ( *unused20 ) ( void ); |
||||
void ( *unused21 ) ( void ); |
||||
void ( *unused22 ) ( void ); |
||||
void ( *unused23 ) ( void ); |
||||
void ( *unused24 ) ( void ); |
||||
void ( *unused25 ) ( void ); |
||||
void ( *unused26 ) ( void ); |
||||
void ( *unused27 ) ( void ); |
||||
void ( *unused28 ) ( void ); |
||||
void ( *unused29 ) ( void ); |
||||
void ( *unused30 ) ( void ); |
||||
void ( *unused31 ) ( void ); |
||||
void ( *unused32 ) ( void ); |
||||
void ( *unused33 ) ( void ); |
||||
void ( *unused34 ) ( void ); |
||||
|
||||
void ( *S_GetDSPointer ) ( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf ); |
||||
void *( *S_GetWAVPointer ) ( void ); |
||||
|
||||
void ( *unused35 ) ( void ); |
||||
void ( *unused36 ) ( void ); |
||||
void ( *unused37 ) ( void ); |
||||
void ( *unused38 ) ( void ); |
||||
void ( *unused39 ) ( void ); |
||||
void ( *unused40 ) ( void ); |
||||
void ( *unused41 ) ( void ); |
||||
void ( *unused42 ) ( void ); |
||||
void ( *unused43 ) ( void ); |
||||
void ( *unused44 ) ( void ); |
||||
void ( *unused45 ) ( void ); |
||||
void ( *unused46 ) ( void ); |
||||
void ( *unused47 ) ( void ); |
||||
void ( *unused48 ) ( void ); |
||||
void ( *unused49 ) ( void ); |
||||
void ( *unused50 ) ( void ); |
||||
void ( *unused51 ) ( void ); |
||||
void ( *unused52 ) ( void ); |
||||
void ( *unused53 ) ( void ); |
||||
void ( *unused54 ) ( void ); |
||||
void ( *unused55 ) ( void ); |
||||
} engine_api_t; |
||||
|
||||
static engine_api_t engineapi; |
||||
|
||||
typedef int (*engine_api_func)( int version, int size, struct engine_api_s *api ); |
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Get launcher/engine interface from engine module
|
||||
// Input : hMod -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int Eng_LoadFunctions( HMODULE hMod ) |
||||
{ |
||||
engine_api_func pfnEngineAPI; |
||||
|
||||
pfnEngineAPI = ( engine_api_func )GetProcAddress( hMod, "Sys_EngineAPI" ); |
||||
if( !pfnEngineAPI ) |
||||
return 0; |
||||
|
||||
if( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) ) |
||||
return 0; |
||||
|
||||
// All is okay
|
||||
return 1; |
||||
} |
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Load proper engine .dll and get pointer to either DSound and primary buffer or HWAVEOUT ( NT 4.0, e.g. )
|
||||
//-----------------------------------------------------------------------------
|
||||
void LoadSoundAPIs( void ) |
||||
{ |
||||
hEngine = ::LoadLibrary( IEngineStudio.IsHardware() ? "hw.dll" : "sw.dll" ); |
||||
if( hEngine ) |
||||
{ |
||||
if( Eng_LoadFunctions( hEngine ) ) |
||||
{ |
||||
if( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer ) |
||||
{ |
||||
engineapi.S_GetDSPointer(&lpDS, &lpDSBuf); |
||||
lpHW = (HWAVEOUT FAR *)engineapi.S_GetWAVPointer(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Close engine library, release sound pointers
|
||||
//-----------------------------------------------------------------------------
|
||||
void ShutdownSoundAPIs( void ) |
||||
{ |
||||
if( hEngine ) |
||||
{ |
||||
FreeLibrary( hEngine ); |
||||
hEngine = 0; |
||||
} |
||||
|
||||
lpDS = 0; |
||||
lpDSBuf = 0; |
||||
lpHW = 0; |
||||
} |
@ -1,621 +0,0 @@
@@ -1,621 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="engine" - Package Owner=<4> |
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00 |
||||
# ** DO NOT EDIT ** |
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101 |
||||
|
||||
CFG=engine - Win32 Release |
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE, |
||||
!MESSAGE use the Export Makefile command and run |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "engine.mak". |
||||
!MESSAGE |
||||
!MESSAGE You can specify a configuration when running NMAKE |
||||
!MESSAGE by defining the macro CFG on the command line. For example: |
||||
!MESSAGE |
||||
!MESSAGE NMAKE /f "engine.mak" CFG="engine - Win32 Release" |
||||
!MESSAGE |
||||
!MESSAGE Possible choices for configuration are: |
||||
!MESSAGE |
||||
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Application") |
||||
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Application") |
||||
!MESSAGE |
||||
|
||||
# Begin Project |
||||
# PROP AllowPerConfigDependencies 0 |
||||
# PROP Scc_ProjName "" |
||||
# PROP Scc_LocalPath "" |
||||
CPP=cl.exe |
||||
MTL=midl.exe |
||||
RSC=rc.exe |
||||
|
||||
!IF "$(CFG)" == "engine - Win32 Release" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 0 |
||||
# PROP BASE Output_Dir ".\Release" |
||||
# PROP BASE Intermediate_Dir ".\Release" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 0 |
||||
# PROP Output_Dir "..\temp\engine\!release" |
||||
# PROP Intermediate_Dir "..\temp\engine\!release" |
||||
# PROP Ignore_Export_Lib 1 |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c |
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c |
||||
# SUBTRACT CPP /Fr /YX |
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32 |
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 |
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG" |
||||
# ADD RSC /l 0x409 /d "NDEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /opt:nowin98 |
||||
# ADD LINK32 msvcrt.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib mpeg.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc" /out:"..\temp\engine\!release/xash.dll" /libpath:"./common/soundlib" /opt:nowin98 |
||||
# SUBTRACT LINK32 /debug /nodefaultlib |
||||
# Begin Custom Build |
||||
TargetDir=\Xash3D\src_main\temp\engine\!release |
||||
InputPath=\Xash3D\src_main\temp\engine\!release\xash.dll |
||||
SOURCE="$(InputPath)" |
||||
|
||||
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
||||
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll" |
||||
|
||||
# End Custom Build |
||||
|
||||
!ELSEIF "$(CFG)" == "engine - Win32 Debug" |
||||
|
||||
# PROP BASE Use_MFC 0 |
||||
# PROP BASE Use_Debug_Libraries 1 |
||||
# PROP BASE Output_Dir ".\Debug" |
||||
# PROP BASE Intermediate_Dir ".\Debug" |
||||
# PROP BASE Target_Dir "" |
||||
# PROP Use_MFC 0 |
||||
# PROP Use_Debug_Libraries 1 |
||||
# PROP Output_Dir "..\temp\engine\!debug" |
||||
# PROP Intermediate_Dir "..\temp\engine\!debug" |
||||
# PROP Ignore_Export_Lib 1 |
||||
# PROP Target_Dir "" |
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c |
||||
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FAs /FR /FD /c |
||||
# SUBTRACT CPP /YX |
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32 |
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 |
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG" |
||||
# ADD RSC /l 0x409 /d "_DEBUG" |
||||
BSC32=bscmake.exe |
||||
# ADD BASE BSC32 /nologo |
||||
# ADD BSC32 /nologo |
||||
LINK32=link.exe |
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 |
||||
# ADD LINK32 msvcrtd.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib mpeg_dbg.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"..\temp\engine\!debug/xash.dll" /pdbtype:sept /libpath:"./common/soundlib" |
||||
# SUBTRACT LINK32 /incremental:no /map /nodefaultlib |
||||
# Begin Custom Build |
||||
TargetDir=\Xash3D\src_main\temp\engine\!debug |
||||
InputPath=\Xash3D\src_main\temp\engine\!debug\xash.dll |
||||
SOURCE="$(InputPath)" |
||||
|
||||
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" |
||||
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll" |
||||
|
||||
# End Custom Build |
||||
|
||||
!ENDIF |
||||
|
||||
# Begin Target |
||||
|
||||
# Name "engine - Win32 Release" |
||||
# Name "engine - Win32 Debug" |
||||
# Begin Group "Source Files" |
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\avikit.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\build.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_cmds.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_demo.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_events.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_frame.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_game.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_main.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_menu.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_parse.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_pmove.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_remap.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_scrn.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_tent.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_video.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_view.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\cmd.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\common.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\con_utils.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\console.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\crclib.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\crtlib.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\cvar.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\filesystem.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\gamma.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_backend.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_beams.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_cull.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_decals.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_draw.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_image.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_mirror.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_refrag.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rlight.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rmain.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rmath.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rmisc.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rpart.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_rsurf.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_sprite.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_studio.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_vidnt.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_warp.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\host.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\hpak.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_bmp.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_dds.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_main.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_quant.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_tga.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_utils.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\img_wad.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\infostring.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\input.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\keys.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\library.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\mathlib.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\matrixlib.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\mod_studio.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\model.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_buffer.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_chan.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_encode.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_huff.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\network.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\pm_surface.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\pm_trace.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\random.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_backend.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_dsp.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_load.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_main.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_mix.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_mouth.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_stream.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_utils.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\s_vox.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\soundlib\snd_main.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\soundlib\snd_mp3.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\soundlib\snd_utils.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\soundlib\snd_wav.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_client.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_cmds.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_custom.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_frame.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_game.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_init.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_main.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_move.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_phys.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_pmove.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_save.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\sv_world.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\sys_con.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\sys_win.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\titles.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_clip.cpp |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_draw.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_font.cpp |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_input.cpp |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_int.cpp |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_surf.cpp |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\world.c |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\zone.c |
||||
# End Source File |
||||
# End Group |
||||
# Begin Group "Header Files" |
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\cl_tent.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\client.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\common.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\crtlib.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\filesystem.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_export.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\gl_local.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\imagelib\imagelib.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\library.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\mathlib.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\mod_local.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_buffer.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\net_encode.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\protocol.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\server\server.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\sound.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\soundlib\soundlib.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_draw.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vgui\vgui_main.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\client\vox.h |
||||
# End Source File |
||||
# Begin Source File |
||||
|
||||
SOURCE=.\common\world.h |
||||
# End Source File |
||||
# End Group |
||||
# End Target |
||||
# End Project |
@ -0,0 +1,167 @@
@@ -0,0 +1,167 @@
|
||||
# encoding: utf-8 |
||||
# compiler_optimizations.py -- main entry point for configuring C/C++ compilers |
||||
# Copyright (C) 2021 a1batross |
||||
# 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. |
||||
|
||||
try: from fwgslib import get_flags_by_type, get_flags_by_compiler |
||||
except: from waflib.extras.fwgslib import get_flags_by_type, get_flags_by_compiler |
||||
from waflib.Configure import conf |
||||
from waflib import Logs |
||||
|
||||
''' |
||||
Flags can be overriden and new types can be added |
||||
by importing this as normal Python module |
||||
|
||||
Example: |
||||
#!/usr/bin/env python |
||||
from waflib.extras import compiler_optimizations |
||||
|
||||
compiler_optimizations.VALID_BUILD_TYPES += 'gottagofast' |
||||
compiler_optimizations.CFLAGS['gottagofast'] = { |
||||
'gcc': ['-Ogentoo'] |
||||
} |
||||
''' |
||||
|
||||
VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none'] |
||||
|
||||
LINKFLAGS = { |
||||
'common': { |
||||
'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries |
||||
'gcc': ['-Wl,--no-undefined'], |
||||
'owcc': ['-Wl,option stack=512k'] |
||||
}, |
||||
'sanitize': { |
||||
'clang': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'], |
||||
'gcc': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'], |
||||
}, |
||||
'debug': { |
||||
'msvc': ['/INCREMENTAL', '/SAFESEH:NO'] |
||||
} |
||||
} |
||||
|
||||
CFLAGS = { |
||||
'common': { |
||||
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP |
||||
'msvc': ['/D_USING_V110_SDK71_', '/FS', '/Zc:threadSafeInit-', '/MT'], |
||||
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden', '-fno-threadsafe-statics'], |
||||
'gcc': ['-g', '-fvisibility=hidden'], |
||||
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3'] |
||||
}, |
||||
'fast': { |
||||
'msvc': ['/O2', '/Oy', '/Zi'], |
||||
'gcc': { |
||||
'3': ['-O3', '-fomit-frame-pointer'], |
||||
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'] |
||||
}, |
||||
'clang': ['-Ofast'], |
||||
'default': ['-O3'] |
||||
}, |
||||
'fastnative': { |
||||
'msvc': ['/O2', '/Oy', '/Zi'], |
||||
'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'], |
||||
'clang': ['-Ofast', '-march=native'], |
||||
'default': ['-O3'] |
||||
}, |
||||
'release': { |
||||
'msvc': ['/O2', '/Zi'], |
||||
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'], |
||||
'default': ['-O3'] |
||||
}, |
||||
'debug': { |
||||
'msvc': ['/Od', '/ZI'], |
||||
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'], |
||||
'default': ['-O0'] |
||||
}, |
||||
'sanitize': { |
||||
'msvc': ['/Od', '/RTC1', '/Zi'], |
||||
'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address', '-pthread'], |
||||
'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address', '-pthread'], |
||||
'default': ['-O0'] |
||||
}, |
||||
'nooptimize': { |
||||
'msvc': ['/Od', '/Zi'], |
||||
'default': ['-O0'] |
||||
} |
||||
} |
||||
|
||||
LTO_CFLAGS = { |
||||
'msvc': ['/GL'], |
||||
'gcc': ['-flto'], |
||||
'clang': ['-flto'] |
||||
} |
||||
|
||||
LTO_LINKFLAGS = { |
||||
'msvc': ['/LTCG'], |
||||
'gcc': ['-flto'], |
||||
'clang': ['-flto'] |
||||
} |
||||
|
||||
POLLY_CFLAGS = { |
||||
'gcc': ['-fgraphite-identity'], |
||||
'clang': ['-mllvm', '-polly'] |
||||
# msvc sosat :( |
||||
} |
||||
|
||||
def options(opt): |
||||
grp = opt.add_option_group('Compiler optimization options') |
||||
|
||||
grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default=None, |
||||
help = 'build type: debug, release or none(custom flags)') |
||||
|
||||
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False, |
||||
help = 'enable Link Time Optimization if possible [default: %default]') |
||||
|
||||
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False, |
||||
help = 'enable polyhedral optimization if possible [default: %default]') |
||||
|
||||
def configure(conf): |
||||
conf.start_msg('Build type') |
||||
if conf.options.BUILD_TYPE == None: |
||||
conf.end_msg('not set', color='RED') |
||||
conf.fatal('Set a build type, for example "-T release"') |
||||
elif not conf.options.BUILD_TYPE in VALID_BUILD_TYPES: |
||||
conf.end_msg(conf.options.BUILD_TYPE, color='RED') |
||||
conf.fatal('Invalid build type. Valid are: %s' % ', '.join(VALID_BUILD_TYPES)) |
||||
conf.end_msg(conf.options.BUILD_TYPE) |
||||
|
||||
conf.msg('LTO build', 'yes' if conf.options.LTO else 'no') |
||||
conf.msg('PolyOpt build', 'yes' if conf.options.POLLY else 'no') |
||||
|
||||
# -march=native should not be used |
||||
if conf.options.BUILD_TYPE.startswith('fast'): |
||||
Logs.warn('WARNING: \'%s\' build type should not be used in release builds', conf.options.BUILD_TYPE) |
||||
|
||||
try: |
||||
conf.env.CC_VERSION[0] |
||||
except IndexError: |
||||
conf.env.CC_VERSION = (0,) |
||||
|
||||
@conf |
||||
def get_optimization_flags(conf): |
||||
'''Returns a list of compile flags, |
||||
depending on build type and options set by user |
||||
|
||||
NOTE: it doesn't filter out unsupported flags |
||||
|
||||
:returns: tuple of cflags and linkflags |
||||
''' |
||||
linkflags = conf.get_flags_by_type(LINKFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0]) |
||||
|
||||
cflags = conf.get_flags_by_type(CFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0]) |
||||
|
||||
if conf.options.LTO: |
||||
linkflags+= conf.get_flags_by_compiler(LTO_LINKFLAGS, conf.env.COMPILER_CC) |
||||
cflags += conf.get_flags_by_compiler(LTO_CFLAGS, conf.env.COMPILER_CC) |
||||
|
||||
if conf.options.POLLY: |
||||
cflags += conf.get_flags_by_compiler(POLLY_CFLAGS, conf.env.COMPILER_CC) |
||||
|
||||
return cflags, linkflags |
Loading…
Reference in new issue