Skip to content

Commit

Permalink
Merge branch 'master' into windows
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyDOGE committed Jul 27, 2022
2 parents edbe1ba + a53fff8 commit 90cd6e0
Show file tree
Hide file tree
Showing 3,089 changed files with 37,921 additions and 844,102 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build tests

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
build-linux-32:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Build linux-i386
run: |
scripts/build-ubuntu-i386.sh
build-linux-64:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Build linux-amd64
run: |
scripts/build-ubuntu-amd64.sh
build-android-armv7a:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Build android-armv7a
run: |
scripts/build-android-armv7a.sh
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*.vpc.*
*.project
*obj_*
build/
.waf*
.lock-waf*
__pycache__
Expand All @@ -29,4 +28,11 @@ Release_*/
*.ilk
ValveETWProviderEvents.h
game/client/*/client.lib
game/server/*/server.lib
game/server/*/server.lib
.DS_Store
build*/
android/
.cache/
.ccache/
waf3*/
.vscode/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "ivp"]
path = ivp
url = https://github.com/nillerusr/source-physics
[submodule "lib"]
path = lib
url = https://github.com/nillerusr/source-engine-libs
49 changes: 17 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
# source-engine
Welcome to source engine:)

# Goals
* fixing bugs
* ~~NEON support~~
* DXVK support
* remove unnecessary dependencies
* Elbrus port
* ~~Arm(android) port~~
* improve performance
* ~~replace current buildsystem with waf~~
* rewrite achivement system( to work without steam )
* 64-bit support
Discord: https://discord.gg/hZRB7WMgGw

# How to Build?
Clone repo and change directory:
```
git clone https://github.com/nillerusr/source-engine --recursive --depth 1
cd source-engine
```
On Linux:
# Current tasks
- [x] NEON support
- [x] remove unnecessary dependencies
- [x] Arm(android) port
- [x] replace current buildsystem with waf
- [x] rewrite achivement system( to work without steam )
- [x] 64-bit support
- [ ] improve performance
- [ ] fixing bugs
- [ ] dxvk-native support
- [ ] Elbrus port
- [ ] rewrite serverbrowser to work without steam
- [ ] Windows build support for waf

dependencies:
fontconfig, freetype2, OpenAL, SDL2, libbz2, libcurl, libjpeg, libpng, zlib
```
./waf configure -T debug
./waf build
```
On Linux for Android(**Note: only Android NDK r10e is supported**):
```
export ANDROID_NDK=/path/to/ndk
./waf configure -T debug --android=armeabi-v7a,4.9,21
./waf build
```
On Windows/MacOS:
**TODO(WAF is not configured for Windows/MacOS. Use VPC as temporary solution)**

# [How to Build?](https://github.com/nillerusr/source-engine/wiki/How-to-build)
4 changes: 4 additions & 0 deletions appframework/glmdisplaydb_linuxwin.inl
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,13 @@ void GLMDisplayInfo::PopulateModes( void )
// Add double of everything also - Retina proofing hopefully.
m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) );
}

m_modes->AddToTail( new GLMDisplayMode( w, w * ((float)m_info.m_displayPixelHeight/m_info.m_displayPixelWidth), 0 ) );
}
}

m_modes->AddToTail( new GLMDisplayMode( m_info.m_displayPixelWidth / 2, m_info.m_displayPixelHeight / 2, 0 ) );

m_modes->Sort( DisplayModeSortFunction );

// remove dupes.
Expand Down
14 changes: 7 additions & 7 deletions appframework/glmrendererinfo_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bool GLMDetectScaledResolveMode( uint osComboVersion, bool hasSLGU )
kCGLPFADoubleBuffer, kCGLPFANoRecovery, kCGLPFAAccelerated,
kCGLPFADepthSize, 0,
kCGLPFAColorSize, 32,
kCGLPFARendererID, info->m_rendererID,
kCGLPFARendererID, (unsigned int)info->m_rendererID,
0
};

Expand Down Expand Up @@ -859,7 +859,7 @@ void GetDriverInfoString_NV( char *driverNameBuf, int driverNameBufLen )
{
// grab the OS version

long vMajor = 0; long vMinor = 0; long vMinorMinor = 0;
SInt32 vMajor = 0; SInt32 vMinor = 0; SInt32 vMinorMinor = 0;

OSStatus gestalt_err = 0;
gestalt_err = Gestalt(gestaltSystemVersionMajor, &vMajor);
Expand Down Expand Up @@ -1374,19 +1374,19 @@ void GetDriverInfoString_NV( char *driverNameBuf, int driverNameBufLen )
{
int modeIndex=0;
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayMode);
CFNumberGetValue(number, kCFNumberLongType, &modeIndex);
CFNumberGetValue(number, kCFNumberIntType, &modeIndex);

// grab the width and height, I am unclear on whether this is the displayed FB width or the display device width.
int screenWidth=0;
int screenHeight=0;
int refreshHz=0;

number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayWidth);
CFNumberGetValue(number, kCFNumberLongType, &screenWidth);
CFNumberGetValue(number, kCFNumberIntType, &screenWidth);
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayHeight);
CFNumberGetValue(number, kCFNumberLongType, &screenHeight);
CFNumberGetValue(number, kCFNumberIntType, &screenHeight);
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayRefreshRate);
CFNumberGetValue(number, kCFNumberLongType, &refreshHz);
CFNumberGetValue(number, kCFNumberIntType, &refreshHz);

GLMPRINTF(( "-D- GLMDisplayDB::GetModeInfo sees mode-index=%d, width=%d, height=%d on CGID %08x (display index %d on rendererindex %d)",
modeIndex,
Expand Down Expand Up @@ -1574,7 +1574,7 @@ void GetDriverInfoString_NV( char *driverNameBuf, int driverNameBufLen )

void GLMDisplayInfo::Dump( int which )
{
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, cg-id=%08x display-mask=%08x pixwidth=%d pixheight=%d", which, (int)this, m_info.m_cgDisplayID, m_info.m_glDisplayMask, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, cg-id=%08x display-mask=%08x pixwidth=%d pixheight=%d", which, (int)(intp)this, m_info.m_cgDisplayID, m_info.m_glDisplayMask, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));

FOR_EACH_VEC( *m_modes, i )
{
Expand Down
26 changes: 24 additions & 2 deletions appframework/sdlmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

#include "tier1/utllinkedlist.h"
#include "tier1/convar.h"
#ifdef TOGLES
#include <EGL/egl.h>
#endif

// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
#include "tier0/memdbgon.h"
Expand Down Expand Up @@ -63,10 +65,16 @@ static void *l_egl = NULL;
static void *l_gles = NULL;

typedef void *(*t_glGetProcAddress)( const char * );
t_glGetProcAddress _glGetProcAddress;

typedef EGLBoolean (*t_eglBindAPI)(EGLenum api);
typedef EGLBoolean (*t_eglInitialize)(EGLDisplay display, EGLint *major, EGLint *minor);
typedef EGLDisplay (*t_eglGetDisplay)(NativeDisplayType native_display);
typedef char const *(*t_eglQueryString)(EGLDisplay display, EGLint name);

t_eglBindAPI _eglBindAPI;
t_glGetProcAddress _glGetProcAddress;
t_eglInitialize _eglInitialize;
t_eglGetDisplay _eglGetDisplay;
t_eglQueryString _eglQueryString;
#endif

/*
Expand Down Expand Up @@ -594,11 +602,25 @@ InitReturnVal_t CSDLMgr::Init()
l_gles = dlopen("libGLESv3.so", RTLD_LAZY);

if( l_egl )
{
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
}

SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SET_GL_ATTR(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SET_GL_ATTR(SDL_GL_CONTEXT_MINOR_VERSION, 0);

_eglInitialize = (t_eglInitialize)dlsym(l_egl, "eglInitialize");
_eglGetDisplay = (t_eglGetDisplay)dlsym(l_egl, "eglGetDisplay");
_eglQueryString = (t_eglQueryString)dlsym(l_egl, "eglQueryString");

if( _eglInitialize && _eglInitialize && _eglQueryString )
{
EGLDisplay display = _eglGetDisplay(EGL_DEFAULT_DISPLAY);
if( _eglInitialize(display, NULL, NULL) != -1
&& strstr(_eglQueryString(display, EGL_EXTENSIONS) ,"EGL_KHR_gl_colorspace") )
SET_GL_ATTR(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1)
}
#elif ANDROID
bool m_bOGL = false;

Expand Down
6 changes: 3 additions & 3 deletions bitmap/colorconversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
Expand Down Expand Up @@ -435,7 +434,8 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
// pRows = (Alpha3BitRows*) & ( pAlphaBlock->stuff[0] );
const DWORD mask = 0x00000007; // bits = 00 00 01 11

DWORD bits = *( (DWORD*) & ( pAlphaBlock->stuff[0] ));
DWORD bits;
memcpy( &bits, &(pAlphaBlock->stuff[0]), sizeof(DWORD) );

gBits[0][0] = (BYTE)( bits & mask );
bits >>= 3;
Expand All @@ -454,7 +454,7 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
gBits[1][3] = (BYTE)( bits & mask );

// now for last two rows:
bits = *( (DWORD*) & ( pAlphaBlock->stuff[3] )); // last 3 bytes
memcpy( &bits, &(pAlphaBlock->stuff[3]), sizeof(DWORD) );

gBits[2][0] = (BYTE)( bits & mask );
bits >>= 3;
Expand Down
Loading

0 comments on commit 90cd6e0

Please sign in to comment.