mirror of
https://github.com/celisej567/source-engine.git
synced 2025-12-31 21:48:22 +03:00
Compare commits
11 Commits
misalign-f
...
vpc-parser
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28a52e7ef1 | ||
|
|
fb55975a75 | ||
|
|
1233e05fcb | ||
|
|
cd72eac63d | ||
|
|
29c83b7867 | ||
|
|
1b98e8994e | ||
|
|
31586ce622 | ||
|
|
889829e5b4 | ||
|
|
7a69af7b00 | ||
|
|
6e5ef80a0e | ||
|
|
18e088f8ff |
25
README.md
25
README.md
@@ -1,20 +1,27 @@
|
||||
# source-engine
|
||||
The main purpose of this repository is to port the engine for other platforms.
|
||||
|
||||
# Goals
|
||||
* fixing bugs
|
||||
* NEON support
|
||||
* ~~NEON support~~
|
||||
* DXVK support
|
||||
* remove unnecessary dependencies
|
||||
* Elbrus port
|
||||
* Arm(android) port
|
||||
* ~~Arm(android) port~~
|
||||
* improve performance
|
||||
* replace current buildsystem with waf
|
||||
* ~~replace current buildsystem with waf~~
|
||||
* rewrite achivement system( to work without steam )
|
||||
# How to Build?
|
||||
1. Clone repo ( ```git clone https://github.com/nillerusr/source-engine```)
|
||||
2. Run ```git submodule init && git submodule update```
|
||||
* 64-bit support
|
||||
|
||||
# How to Build?
|
||||
Clone repo and change directory:
|
||||
```
|
||||
git clone https://github.com/nillerusr/source-engine --recursive --depth 1
|
||||
cd source-engine
|
||||
```
|
||||
On Linux:
|
||||
|
||||
dependencies:
|
||||
fontconfig, freetype2, OpenAL, SDL2, libbz2, libcurl, libjpeg, libpng, zlib
|
||||
```
|
||||
./waf configure -T debug
|
||||
./waf build
|
||||
@@ -25,5 +32,5 @@ export ANDROID_NDK=/path/to/ndk
|
||||
./waf configure -T debug --android=armeabi-v7a,4.9,21
|
||||
./waf build
|
||||
```
|
||||
On Windows:
|
||||
**TODO(WAF is not configured for Windows. Use VPC as temporary solution)**
|
||||
On Windows/MacOS:
|
||||
**TODO(WAF is not configured for Windows/MacOS. Use VPC as temporary solution)**
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "tier1/utllinkedlist.h"
|
||||
#include "tier1/convar.h"
|
||||
#include <EGL/egl.h>
|
||||
|
||||
// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
|
||||
#include "tier0/memdbgon.h"
|
||||
@@ -57,8 +58,14 @@ COpenGLEntryPoints *gGL = NULL;
|
||||
const int kBogusSwapInterval = INT_MAX;
|
||||
|
||||
#ifdef ANDROID
|
||||
static void *gl4es = NULL;
|
||||
void *(*_glGetProcAddress)( const char * );
|
||||
static void *l_gl4es = NULL;
|
||||
static void *l_egl = NULL;
|
||||
|
||||
typedef void *(*t_glGetProcAddress)( const char * );
|
||||
t_glGetProcAddress _glGetProcAddress;
|
||||
|
||||
typedef EGLBoolean (*t_eglBindAPI)(EGLenum api);
|
||||
t_eglBindAPI _eglBindAPI;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -238,7 +245,7 @@ public:
|
||||
|
||||
virtual void IncWindowRefCount();
|
||||
virtual void DecWindowRefCount();
|
||||
|
||||
|
||||
// Get the next N events. The function returns the number of events that were filled into your array.
|
||||
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
|
||||
#ifdef LINUX
|
||||
@@ -374,7 +381,7 @@ private:
|
||||
Uint32 m_MouseButtonDownTimeStamp;
|
||||
int m_MouseButtonDownX;
|
||||
int m_MouseButtonDownY;
|
||||
|
||||
|
||||
double m_flPrevGLSwapWindowTime;
|
||||
};
|
||||
|
||||
@@ -544,23 +551,51 @@ InitReturnVal_t CSDLMgr::Init()
|
||||
m_MouseButtonDownTimeStamp = 0;
|
||||
m_MouseButtonDownX = 0;
|
||||
m_MouseButtonDownY = 0;
|
||||
|
||||
|
||||
m_bExpectSyntheticMouseMotion = false;
|
||||
m_nMouseTargetX = 0;
|
||||
m_nMouseTargetY = 0;
|
||||
m_nWarpDelta = 0;
|
||||
m_bRawInput = false;
|
||||
|
||||
|
||||
m_flPrevGLSwapWindowTime = 0.0f;
|
||||
|
||||
|
||||
memset(m_pixelFormatAttribs, '\0', sizeof (m_pixelFormatAttribs));
|
||||
|
||||
int *attCursor = m_pixelFormatAttribs;
|
||||
|
||||
#define SET_GL_ATTR(key,value) \
|
||||
*(attCursor++) = (int) (key); \
|
||||
*(attCursor++) = (int) (value);
|
||||
#define SET_GL_ATTR(key,value) \
|
||||
*(attCursor++) = (int) (key); \
|
||||
*(attCursor++) = (int) (value);
|
||||
|
||||
#ifdef ANDROID
|
||||
bool m_bOGL = false;
|
||||
|
||||
l_egl = dlopen("libEGL.so", RTLD_LAZY);
|
||||
|
||||
if( l_egl )
|
||||
{
|
||||
_eglBindAPI = (t_eglBindAPI)dlsym(l_egl, "eglBindAPI");
|
||||
|
||||
if( _eglBindAPI && _eglBindAPI(EGL_OPENGL_API) )
|
||||
{
|
||||
Msg("OpenGL support found!\n");
|
||||
m_bOGL = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( m_bOGL )
|
||||
{
|
||||
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
|
||||
SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
l_gl4es = dlopen("libgl4es.so", RTLD_LAZY);
|
||||
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_gl4es, "gl4es_glGetProcAddress");
|
||||
}
|
||||
#endif
|
||||
SET_GL_ATTR(SDL_GL_RED_SIZE, 8);
|
||||
SET_GL_ATTR(SDL_GL_GREEN_SIZE, 8);
|
||||
SET_GL_ATTR(SDL_GL_BLUE_SIZE, 8);
|
||||
@@ -586,9 +621,9 @@ InitReturnVal_t CSDLMgr::Init()
|
||||
// to really actually make a window, we just resize the one we built here.
|
||||
if ( !CreateHiddenGameWindow( "", 640, 480 ) )
|
||||
Error( "CreateGameWindow failed" );
|
||||
|
||||
|
||||
SDL_HideWindow( m_Window );
|
||||
|
||||
|
||||
return INIT_OK;
|
||||
}
|
||||
|
||||
@@ -724,7 +759,7 @@ bool CSDLMgr::CreateHiddenGameWindow( const char *pTitle, int width, int height
|
||||
#if defined( DX_TO_GL_ABSTRACTION )
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
#endif
|
||||
m_Window = SDL_CreateWindow( pTitle, x, y, width, height, flags );
|
||||
m_Window = SDL_CreateWindow( pTitle, x, y, width, height, flags );
|
||||
|
||||
if (m_Window == NULL)
|
||||
Error( "Failed to create SDL window: %s", SDL_GetError() );
|
||||
@@ -760,13 +795,11 @@ bool CSDLMgr::CreateHiddenGameWindow( const char *pTitle, int width, int height
|
||||
SDL_GL_MakeCurrent(m_Window, m_GLContext);
|
||||
|
||||
#ifdef ANDROID
|
||||
gl4es = dlopen("libgl4es.so", RTLD_LAZY);
|
||||
|
||||
if( gl4es )
|
||||
if( l_gl4es )
|
||||
{
|
||||
_glGetProcAddress = dlsym(gl4es, "gl4es_GetProcAddress" );
|
||||
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_gl4es, "gl4es_GetProcAddress" );
|
||||
void (*initialize_gl4es)( );
|
||||
initialize_gl4es = dlsym(gl4es, "initialize_gl4es" );
|
||||
initialize_gl4es = (void(*)())dlsym(l_gl4es, "initialize_gl4es" );
|
||||
initialize_gl4es();
|
||||
}
|
||||
#endif
|
||||
@@ -1836,9 +1869,6 @@ void CSDLMgr::PumpWindowsMessageLoop()
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// FIXME(nillerusr): SDL posts SDL_QUIT when map loaded on android, idk why.
|
||||
#ifndef ANDROID
|
||||
case SDL_QUIT:
|
||||
{
|
||||
CCocoaEvent theEvent;
|
||||
@@ -1846,7 +1876,6 @@ void CSDLMgr::PumpWindowsMessageLoop()
|
||||
PostEvent( theEvent );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1388,6 +1388,7 @@ bool CGameServer::FinishCertificateCheck( netadr_t &adr, int nAuthProtocol, cons
|
||||
if ( AllowDebugDedicatedServerOutsideSteam() )
|
||||
return true;
|
||||
|
||||
/*
|
||||
if ( !Host_IsSinglePlayerGame() || sv.IsDedicated()) // PROTOCOL_HASHEDCDKEY isn't allowed for multiplayer servers
|
||||
{
|
||||
RejectConnection( adr, clientChallenge, "#GameUI_ServerCDKeyAuthInvalid" );
|
||||
@@ -1398,7 +1399,7 @@ bool CGameServer::FinishCertificateCheck( netadr_t &adr, int nAuthProtocol, cons
|
||||
{
|
||||
RejectConnection( adr, clientChallenge, "#GameUI_ServerInvalidCDKey" );
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
int nHashCount = 0;
|
||||
|
||||
|
||||
@@ -358,27 +358,7 @@ void CEngine::Frame( void )
|
||||
// Calculate how long we need to wait.
|
||||
int nSleepMS = (int)( ( m_flMinFrameTime - m_flFrameTime ) * 1000 - fBusyWaitMS );
|
||||
if ( nSleepMS > 0 )
|
||||
{
|
||||
ThreadSleep( nSleepMS );
|
||||
}
|
||||
else
|
||||
{
|
||||
// On x86, busy-wait using PAUSE instruction which encourages
|
||||
// power savings by idling for ~10 cycles (also yielding to
|
||||
// the other logical hyperthread core if the CPU supports it)
|
||||
for (int i = 2000; i >= 0; --i)
|
||||
{
|
||||
#if defined(POSIX)
|
||||
#ifdef __arm__
|
||||
raise(SIGINT);
|
||||
#else
|
||||
__asm( "pause" ); __asm( "pause" ); __asm( "pause" ); __asm( "pause" );
|
||||
#endif
|
||||
#elif defined(IS_WINDOWS_PC)
|
||||
_asm { pause }; _asm { pause }; _asm { pause }; _asm { pause };
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Go back to the top of the loop and see if it is time yet.
|
||||
}
|
||||
|
||||
2
ivp
2
ivp
Submodule ivp updated: 64e06cde5f...82849306f7
181
scripts/waifulib/vpc_parser.py
Normal file
181
scripts/waifulib/vpc_parser.py
Normal file
@@ -0,0 +1,181 @@
|
||||
# It looks like shit, but I'm not particularly worried about such scripts.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
token_list = [
|
||||
re.compile(r'&&'),
|
||||
re.compile(r'\|\|'),
|
||||
re.compile(r'\!'),
|
||||
re.compile(r'[a-zA-Z0-9_.]*')
|
||||
]
|
||||
|
||||
match_statement = re.compile(r'\[.*\]')
|
||||
|
||||
def compute_statement( defines, statement ):
|
||||
vars = {}
|
||||
for define in defines:
|
||||
d=define.split('=')[0]
|
||||
vars.update({d:True})
|
||||
|
||||
def t( op ):
|
||||
if op == '1': return True
|
||||
elif op == '0': return False
|
||||
elif op not in vars: return False
|
||||
|
||||
return vars[op]
|
||||
|
||||
pos = 0
|
||||
|
||||
statement = re.sub(r'\[|\]| |\$', '', statement)
|
||||
|
||||
l = []
|
||||
|
||||
final = True
|
||||
final_init = False
|
||||
|
||||
while pos < len(statement):
|
||||
for token in token_list:
|
||||
r = token.search(statement, pos)
|
||||
if r and r.start() == pos:
|
||||
l += [r.group(0)]
|
||||
pos = r.end()
|
||||
|
||||
k = 0
|
||||
for i in range(len(l)):
|
||||
j = i-k
|
||||
if l[j] == '!' and j+1 < len(l):
|
||||
df = l[j+1]
|
||||
if df in vars:
|
||||
vars[df] = not vars[df]
|
||||
else: vars.update({df:True})
|
||||
del l[j]
|
||||
k += 1
|
||||
|
||||
k = 0
|
||||
for i in range(len(l)):
|
||||
j = i-k
|
||||
if l[j] == '&&' and j+1 < len(l) and j-1 >= 0:
|
||||
val = 0
|
||||
if t(l[j-1]) and t(l[j+1]):
|
||||
val = 1
|
||||
del l[j+1], l[j], l[j-1]
|
||||
l.insert(j, str(val))
|
||||
k += 2
|
||||
|
||||
k = 0
|
||||
for i in range(len(l)):
|
||||
j = i-k
|
||||
if l[j] == '||' and j+1 < len(l) and j-1 >= 0:
|
||||
val = 0
|
||||
if t(l[j-1]) or t(l[j+1]):
|
||||
val = 1
|
||||
del l[j+1], l[j], l[j-1]
|
||||
l.insert(j, str(val))
|
||||
k += 2
|
||||
|
||||
return t(l[0])
|
||||
|
||||
def project_key(l):
|
||||
for k in l.keys():
|
||||
if '$Project' in k:
|
||||
return k
|
||||
|
||||
def fix_dos_path( path ):
|
||||
|
||||
path = path.replace('\\', '/')
|
||||
p = path.split('/')
|
||||
|
||||
filename = p[-1]
|
||||
find_path = '/'.join(p[0:len(p)-1])
|
||||
if find_path == '': find_path = './'
|
||||
else: find_path += '/'
|
||||
|
||||
dirlist = os.listdir(find_path)
|
||||
for file in dirlist:
|
||||
if file == filename:
|
||||
return find_path+file
|
||||
elif file.lower() == filename.lower():
|
||||
return find_path+file
|
||||
return find_path+filename
|
||||
|
||||
def parse_vpcs( env ,vpcs, basedir ):
|
||||
back_path = os.path.abspath('.')
|
||||
os.chdir(env.SUBPROJECT_PATH[0])
|
||||
|
||||
sources = []
|
||||
defines = []
|
||||
includes = []
|
||||
|
||||
for vpc in vpcs:
|
||||
f=open(vpc, 'r').read().replace('\\\n', ';')
|
||||
|
||||
l = f.split('\n')
|
||||
|
||||
iBrackets = 0
|
||||
|
||||
next_br = False
|
||||
ret = {}
|
||||
cur_key = ''
|
||||
|
||||
for i in l:
|
||||
if i == '': continue
|
||||
|
||||
s = match_statement.search(i)
|
||||
if s and not compute_statement(env.DEFINES+defines, s.group(0)):
|
||||
continue
|
||||
|
||||
if i.startswith('$') and iBrackets == 0:
|
||||
ret.update({i:[]})
|
||||
cur_key = i
|
||||
next_br = True
|
||||
elif i == '{':
|
||||
iBrackets += 1
|
||||
next_br = False
|
||||
elif i == '}':
|
||||
iBrackets -= 1
|
||||
elif iBrackets > 0:
|
||||
ret[cur_key].append(i)
|
||||
|
||||
if next_br:
|
||||
next_br = False
|
||||
|
||||
key = project_key(ret)
|
||||
l=ret[key]
|
||||
|
||||
for i in l:
|
||||
if '-$File' in i and '.h"' not in i:
|
||||
for k in i.split(';'):
|
||||
k = k.replace('$SRCDIR', basedir)
|
||||
s = fix_dos_path(k.split('"')[1])
|
||||
|
||||
for j in range(len(sources)):
|
||||
if sources[j] == s:
|
||||
del sources[j]
|
||||
break
|
||||
|
||||
elif '$File' in i and '.h"' not in i:
|
||||
for j in i.split(';'):
|
||||
j = j.replace('$SRCDIR', basedir)
|
||||
s = fix_dos_path(j.split('"')[1])
|
||||
sources.append(s)
|
||||
|
||||
for i in ret['$Configuration']:
|
||||
if '$PreprocessorDefinitions' in i:
|
||||
i = i.replace('$BASE', '')
|
||||
s = i.split('"')[1]
|
||||
s = re.split(';|,', s)
|
||||
for j in s:
|
||||
if j != '' and j not in defines:
|
||||
defines.append(j)
|
||||
if '$AdditionalIncludeDirectories' in i:
|
||||
i = i.replace('$BASE', '').replace('$SRCDIR', basedir)
|
||||
s = i.split('"')[1]
|
||||
s = re.split(';|,', s)
|
||||
for j in s:
|
||||
j = j.replace('\\','/')
|
||||
if j != '' and j not in includes:
|
||||
includes.append(j)
|
||||
os.chdir(back_path)
|
||||
|
||||
return {'defines':defines, 'includes':includes, 'sources': sources}
|
||||
Reference in New Issue
Block a user