Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
Find a file
weliveinhell 6be8515147 yikes!
2025-06-07 08:31:17 +00:00
.github/workflows wscipt: fix cant find env cache togl 2023-11-08 22:06:10 +03:00
.vscode Update tasks.json 2023-01-16 07:54:17 -08:00
app/legion 1 2020-04-22 12:56:21 -04:00
appframework yikes! 2025-06-07 08:31:17 +00:00
bitmap add macos workflow, fix filesystem_async max thread count 2023-04-24 18:54:23 +00:00
choreoobjects add wscipt files to build vphysics and game 2021-04-06 22:31:58 +03:00
common fix crash in some cases 2023-10-23 19:52:35 +03:00
datacache datacache: disable async mode 2023-02-17 12:42:56 +03:00
datamodel Replace empty constructors with default constructors #88 2022-11-05 14:23:05 +03:00
dedicated dedicated(win32): fix crashes( now it works #310 #225 ) 2023-12-13 21:28:17 +03:00
dedicated_main dedicated(win32): fix build issues #322 2023-12-13 20:18:31 +03:00
devtools Fix an VPC error related to GUID for VS2019 project 2022-01-27 14:28:20 +02:00
dmserializers 1 2020-04-22 12:56:21 -04:00
dmxloader Replace empty constructors with default constructors #88 2022-11-05 14:23:05 +03:00
dx9sdk Replace empty constructors with default constructors #88 2022-11-05 14:23:05 +03:00
emscripten yikes! 2025-06-07 08:31:17 +00:00
engine yikes! 2025-06-07 08:31:17 +00:00
external Fix an VPC error related to GUID for VS2019 project 2022-01-27 14:28:20 +02:00
fgdlib 1 2020-04-22 12:56:21 -04:00
filesystem yikes! 2025-06-07 08:31:17 +00:00
game yikes! 2025-06-07 08:31:17 +00:00
gameui yikes! 2025-06-07 08:31:17 +00:00
gcsdk fix sln generation 2022-07-26 13:03:48 -07:00
hammer fix sln generation 2022-07-26 13:03:48 -07:00
hammer_launcher change output path in all vpc 2020-10-22 21:00:42 +03:00
inputsystem inputsystem: fix UB in touch events callback, make touch more responsive 2023-08-17 14:31:43 +03:00
ivp@47533475e0 ivp: update submodule 2023-12-24 04:24:44 +03:00
launcher yikes! 2025-06-07 08:31:17 +00:00
launcher_main yikes! 2025-06-07 08:31:17 +00:00
lib@86a66ee92d game(client): fix atlas generation for touch 2022-09-17 21:00:50 +03:00
linux 1 2020-04-22 12:56:21 -04:00
linux_sdk 1 2020-04-22 12:56:21 -04:00
materialsystem materialsystem: fix color correction on non-windows systems( fixes #137 , #295 related ) 2023-10-06 04:19:51 +03:00
mathlib yikes! 2025-06-07 08:31:17 +00:00
mdllib change output path in all vpc 2020-10-22 21:00:42 +03:00
mdlobjects 1 2020-04-22 12:56:21 -04:00
movieobjects 1 2020-04-22 12:56:21 -04:00
networksystem Fix compilation under MSVC(VS2019) 2022-01-13 16:18:38 +02:00
particles fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
public yikes! 2025-06-07 08:31:17 +00:00
raytrace 1 2020-04-22 12:56:21 -04:00
replay Fix VPC scripts for VS2019 2022-02-03 18:18:12 +02:00
scenefilecache fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
scripts fix build scripts for workflow 2023-11-08 21:58:33 +03:00
sdklauncher change output path in all vpc 2020-10-22 21:00:42 +03:00
serverbrowser yikes! 2025-06-07 08:31:17 +00:00
sfmobjects 1 2020-04-22 12:56:21 -04:00
soundemittersystem fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
soundsystem fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
sourcevr 1 2020-04-22 12:56:21 -04:00
stub_steam yikes! 2025-06-07 08:31:17 +00:00
studiorender win64: misc pointer truncation fixes 2023-01-16 11:56:05 +03:00
thirdparty@c5b901ecef move stub steam api from thirdparty submodule 2023-05-23 22:32:30 +00:00
tier0 yikes! 2025-06-07 08:31:17 +00:00
tier1 yikes! 2025-06-07 08:31:17 +00:00
tier2 add macos workflow, fix filesystem_async max thread count 2023-04-24 18:54:23 +00:00
tier3 yikes! 2025-06-07 08:31:17 +00:00
togl yikes! 2025-06-07 08:31:17 +00:00
togles yikes! 2025-06-07 08:31:17 +00:00
tools change output path in all vpc 2020-10-22 21:00:42 +03:00
tracker change output path in all vpc 2020-10-22 21:00:42 +03:00
unicode fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
unitlib workflows: add tests.yml 2022-08-17 12:54:11 +03:00
unittests unitests: add mathlib test 2023-04-23 23:45:09 +03:00
utils add macos workflow, fix filesystem_async max thread count 2023-04-24 18:54:23 +00:00
vgui2 yikes! 2025-06-07 08:31:17 +00:00
vguimatsurface yikes! 2025-06-07 08:31:17 +00:00
video yikes! 2025-06-07 08:31:17 +00:00
vpc_scripts Merge branch 'master' into windows 2022-07-27 12:58:56 +03:00
vphysics Replace empty constructors with default constructors #88 2022-11-05 14:23:05 +03:00
vpklib Merge branch 'master' into windows 2022-07-27 12:58:56 +03:00
vstdlib yikes! 2025-06-07 08:31:17 +00:00
vtf vtf: fix vtf loading for windows arm( and for other platforms ) 2023-08-14 18:26:28 +03:00
.gitignore yikes! 2025-06-07 08:31:17 +00:00
.gitmodules fix windows build scripts, add windows opus support 2022-07-28 14:27:56 +03:00
build_emscripten.sh yikes! 2025-06-07 08:31:17 +00:00
LICENSE add LICENSE file 2020-12-16 15:14:33 +03:00
README.md yikes! 2025-06-07 08:31:17 +00:00
thirdpartylegalnotices.txt add LICENSE file 2020-12-16 15:14:33 +03:00
waf update waf, enable gccdeps and msvcdeps 2023-11-24 11:28:25 +03:00
waf.bat fix loading libraries with lib prefix 2021-04-08 22:40:26 +03:00
wscript yikes! 2025-06-07 08:31:17 +00:00

Emscripten port for the source engine (only portal tested)

hosted on yikes.pw

i definitely broke something on another platforms, but that's okay!!

some notes

emscripten patching (im to lazy to fork it)

yeeeah so we need to patch glMapBufferRange to allow some "unsupported" parameters

libwebgl.js

  glMapBufferRange: (target, offset, length, access) => {
    if ((access & (0x1/*GL_MAP_READ_BIT*/ /*| 0x20*//*GL_MAP_UNSYNCHRONIZED_BIT*/)) != 0) {
      err("glMapBufferRange access does not support MAP_READ or MAP_UNSYNCHRONIZED");
      GL.recordError(0x501 /* GL_INVALID_VALUE */);
      return 0;
    }

    if ((access & 0x2/*GL_MAP_WRITE_BIT*/) == 0) {
      err("glMapBufferRange access must include MAP_WRITE");
      //return 0;
    }

    if ((access & (0x4/*GL_MAP_INVALIDATE_BUFFER_BIT*/ | 0x8/*GL_MAP_INVALIDATE_RANGE_BIT*/ | 0x10/*GL_MAP_FLUSH_EXPLICIT_BIT*/)) == 0) {
      err("glMapBufferRange access must include INVALIDATE_BUFFER or INVALIDATE_RANGE");
      //return 0;
    }

also patch libdylink.js to deal with dlopen() + load-time dynamic linking + source shenanigans

  $loadDynamicLibrary: function(libName, flags = {global: true, nodelete: true}, localScope, handle) {
#if DYLINK_DEBUG
    dbg(`loadDynamicLibrary: ${libName} handle: ${handle}`);
    dbg('existing:', Object.keys(LDSO.loadedLibsByName));
#endif
    // when loadDynamicLibrary did not have flags, libraries were loaded
    // globally & permanently

libName = libName.split('/')
libName = libName[libName.length - 1]

    var dso = LDSO.loadedLibsByName[libName];

/// ...

      if (handle) {
        LDSO.loadedLibsByHandle[handle] = dso;
      }
      return flags.loadAsync ? Promise.resolve(true) : true;
    } else if(runtimeInitialized) throw new Error(`library ${libName} not found`)

    // allocate new DSO
    dso = newDSO(libName, handle, 'loading');


building

before building copy your game data into __game_data/data folder and you should shrink it as much as you can you must fit it in 2GB, that's the limit of javascript's arrayBuffers

use docker, something like this, there might be some missing libs idk:

docker run --rm -it -v.:/source-engine debian

# activate emsdk
cd /
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh

cd /source-engine
bash build_emscripten.sh

to fix fonts in main menu

replace in platform/resource/sourceschemebase.res, near MenuLarge: "1" [$LINUX] to "1" [$POSIX] and it will break osx fonts probably (?)

script to remove non-english locales, we really want to reduce data size

for x in brazilian bulgarian czech danish dutch finnish french german greek hungarian italian japanese koreana korean latam norwegian polish portuguese romanian russian schinese spanish swedish tchinese thai turkish ukrainian vietnamese; do
	rm -f hl2/resource/*_$x.txt hl2/resource/closecaption_$x.dat portal/resource/*_$x.txt portal/resource/closecaption_$x.dat
done

repackage vpks for portal to reduce size

TODO: we need to manually pick exactly which files to delete, maybe some whitelist? because there is some missing textures in game

set -ex

# CHANGEME
src_gamedata_path=""
dst_game_data_path="THIS_REPO/__game_data/game"

repackage_vpk () {
	vpk_package_path="$1"
	vpk_package_name="$2"
	files_to_remove="$3"

	rm -rf $vpk_package_name
	mkdir $vpk_package_name
	cd $vpk_package_name

	vpkeditcli -e / -o . $src_gamedata_path/$vpk_package_path/$vpk_package_name\_dir.vpk
	cd $vpk_package_name
	rm -rf $files_to_remove
	cd ..
	vpkeditcli $vpk_package_name/
	rm -rf $vpk_package_name

	rm -rf $dst_game_data_path/$vpk_package_path/$vpk_package_name\_*
	mv $vpk_package_name\_* $dst_game_data_path/$vpk_package_path

	cd ..
	rmdir $vpk_package_name
}

repackage_vpk hl2 hl2_textures \
	"materials/models materials/gamepadui materials/building_template materials/concrete materials/matsys_regressiontest materials/nature materials/skybox materials/brick materials/composite materials/glass materials/metal materials/plaster materials/stone materials/tile materials/dev"

repackage_vpk portal portal_pak \
	"sound gamepadui materials/nature materials/gamepadui"

repackage_vpk hl2 hl2_misc \
	"models/humans models/props_buildings models/props_c17 models/props_canal models/props_citizen_tech models/props_combine models/props_debris models/props_docks models/props_foliage models/props_interiors models/props_junk models/props_lab models/props_pipes models/props_rooftop models/props_trainstation models/props_vehicles models/props_vents models/props_wasteland"