Skip to content

Commit 3922904

Browse files
committed
yikes! actions!
1 parent 48e8f79 commit 3922904

11 files changed

Lines changed: 399 additions & 163 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -3,109 +3,19 @@ name: Build
33
on: [push, pull_request]
44

55
jobs:
6-
build-linux-i386:
6+
build-wasm:
77
runs-on: ubuntu-latest
88

99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Build linux-i386
11+
- name: Build wasm
1212
run: |
13-
scripts/build-ubuntu-i386.sh
14-
15-
build-linux-amd64:
16-
runs-on: ubuntu-20.04
17-
18-
steps:
19-
- uses: actions/checkout@v2
20-
- name: Build linux-amd64
21-
run: |
22-
scripts/build-ubuntu-amd64.sh
23-
24-
build-android-armv7a:
25-
runs-on: ubuntu-20.04
26-
27-
steps:
28-
- uses: actions/checkout@v2
29-
- name: Build android-armv7a
30-
run: |
31-
scripts/build-android-armv7a.sh
32-
33-
build-windows-i386:
34-
runs-on: windows-2019
35-
36-
steps:
37-
- uses: actions/checkout@v2
38-
- name: Build windows-i386
39-
run: |
40-
git submodule init && git submodule update
41-
./waf.bat configure -T debug --32bits
42-
./waf.bat build
43-
44-
build-windows-amd64:
45-
runs-on: windows-2019
46-
47-
steps:
48-
- uses: actions/checkout@v2
49-
- name: Build windows-amd64
50-
run: |
51-
git submodule init && git submodule update
52-
./waf.bat configure -T debug
53-
./waf.bat build
54-
55-
build-dedicated-windows-i386:
56-
runs-on: windows-2019
57-
58-
steps:
59-
- uses: actions/checkout@v2
60-
- name: Build dedicated windows-i386
61-
run: |
62-
git submodule init && git submodule update
63-
./waf.bat configure -T debug -d
64-
./waf.bat build
65-
66-
build-dedicated-windows-amd64:
67-
runs-on: windows-2019
68-
69-
steps:
70-
- uses: actions/checkout@v2
71-
- name: Build dedicated windows-amd64
72-
run: |
73-
git submodule init && git submodule update
74-
./waf.bat configure -T debug -d
75-
./waf.bat build
76-
77-
build-dedicated-linux-i386:
78-
runs-on: ubuntu-20.04
79-
80-
steps:
81-
- uses: actions/checkout@v2
82-
- name: Build dedicated linux-i386
83-
run: |
84-
scripts/build-ubuntu-i386.sh -d
85-
86-
build-dedicated-linux-amd64:
87-
runs-on: ubuntu-20.04
88-
89-
steps:
90-
- uses: actions/checkout@v2
91-
- name: Build dedicated linux-amd64
92-
run: |
93-
scripts/build-ubuntu-amd64.sh -d
94-
95-
build-macos-amd64:
96-
runs-on: macos-latest
97-
98-
steps:
99-
- uses: actions/checkout@v2
100-
- name: Build macos-amd64
101-
run: |
102-
scripts/build-macos-amd64.sh
103-
104-
build-dedicated-macos-amd64:
105-
runs-on: macos-latest
106-
107-
steps:
108-
- uses: actions/checkout@v2
109-
- name: Build dedicated macos-amd64
110-
run: |
111-
scripts/build-macos-amd64.sh -d
13+
source emscripten/get_emscripten.sh
14+
emmake emscripten/build.sh
15+
cd build/install/
16+
zip -r ../../out.zip *
17+
- name: Upload artifact
18+
uses: actions/upload-artifact@v4
19+
with:
20+
name: release.zip
21+
path: out.zip

.github/workflows/tests.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,45 @@ use docker, something like this, there might be some missing libs idk:
1515
```sh
1616
docker run --rm -it -v.:/source-engine debian
1717

18+
apt update
19+
apt install git curl wget python3 xz-utils llvm binutils -y
20+
1821
# activate emsdk
1922
cd /
2023
git clone https://github.com/emscripten-core/emsdk.git
2124
cd emsdk
25+
git checkout 2d480a1b7c7a34a354188d93f3e89190a44a1d21
2226
./emsdk install latest
2327
./emsdk activate latest
2428
source ./emsdk_env.sh
2529

2630
cd /source-engine
27-
./build_emscripten.sh
31+
32+
# patch and rebuild sdl2
33+
embuilder --pic build sdl2 sdl2-mt
34+
sed -Ei 's/freq = EM_ASM_INT/freq = MAIN_THREAD_EM_ASM_INT/' /emsdk/upstream/emscripten/cache/ports/sdl2/SDL-release-2.32.0/src/audio/emscripten/SDL_emscriptenaudio.c
35+
embuilder --force --pic build sdl2 sdl2-mt
36+
37+
# patch glMapBufferRange to allow some "unsupported" parameters
38+
patch /emsdk/upstream/emscripten/src/lib/libwebgl.js emscripten/libwebgl.patch
39+
40+
emmake ./build_emscripten.sh
2841
```
29-
then download packed game data (yikes.pw/portal/chunks/mapName.bsp for each map) and put it to ./build/install/chunks/
42+
then download packed game data (yikes.pw/portal/chunks/mapName.data for each map) and put it to ./build/install/chunks/
43+
44+
## packing game data
45+
first of all, you'll need to build engine from https://github.com/nillerusr/source-engine for your native arch
46+
add that printf to ./filesystem/basefilesystem.cpp
47+
48+
```cpp
49+
FileHandle_t CBaseFileSystem::OpenForRead( const char *pFileNameT, const char *pOptions, unsigned flags, const char *pathID, char **ppszResolvedFilename )
50+
{
51+
printf("OpenForRead %s %s\n", pFileNameT, pathID);
52+
VPROF( "CBaseFileSystem::OpenForRead" );
53+
```
54+
55+
and lauch it via emscripten/get_logs.sh script, make sure to edit map list
56+
57+
after that, use emscripten/repackage.js script to make .data chunks
3058
31-
i'll upload tool to pack game data later, it's too messy right now
59+
edit `knownMaps` and `baseGamePath` variables, make sure to unpack all .vpks
File renamed without changes.
692 KB
Binary file not shown.

emscripten/fonts/dejavusans.ttf

742 KB
Binary file not shown.
335 KB
Binary file not shown.

emscripten/get_emscripten.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apt update
2+
apt install git curl wget python3 xz-utils llvm binutils -y
3+
4+
# activate emsdk
5+
git clone https://github.com/emscripten-core/emsdk.git
6+
pushd emsdk
7+
git checkout 2d480a1b7c7a34a354188d93f3e89190a44a1d21
8+
./emsdk install latest
9+
./emsdk activate latest
10+
source ./emsdk_env.sh
11+
popd
12+
13+
# patch and rebuild sdl2
14+
embuilder --pic build sdl2 sdl2-mt
15+
sed -Ei 's/freq = EM_ASM_INT/freq = MAIN_THREAD_EM_ASM_INT/' emsdk/upstream/emscripten/cache/ports/sdl2/SDL-release-2.32.0/src/audio/emscripten/SDL_emscriptenaudio.c
16+
embuilder --force --pic build sdl2 sdl2-mt
17+
18+
# patch glMapBufferRange to allow some "unsupported" parameters
19+
patch emsdk/upstream/emscripten/src/lib/libwebgl.js emscripten/libwebgl.patch

emscripten/get_logs.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
maps=$(cat <<EOF
2+
background01
3+
d1_trainstation_01
4+
d1_trainstation_02
5+
d1_trainstation_03
6+
d1_trainstation_04
7+
d1_trainstation_05
8+
d1_trainstation_06
9+
background02
10+
d1_canals_01
11+
d1_canals_01a
12+
d1_canals_02
13+
d1_canals_03
14+
d1_canals_05
15+
d1_canals_06
16+
d1_canals_07
17+
d1_canals_08
18+
d1_canals_09
19+
d1_canals_10
20+
d1_canals_11
21+
d1_canals_12
22+
d1_canals_13
23+
d1_eli_01
24+
d1_eli_02
25+
background03
26+
d1_town_01
27+
d1_town_01a
28+
d1_town_02
29+
d1_town_02a
30+
d1_town_03
31+
d1_town_04
32+
d1_town_05
33+
background04
34+
d2_coast_01
35+
d2_coast_03
36+
d2_coast_04
37+
d2_coast_05
38+
d2_coast_07
39+
d2_coast_08
40+
d2_coast_09
41+
d2_coast_10
42+
d2_coast_11
43+
d2_coast_12
44+
d2_prison_01
45+
d2_prison_02
46+
d2_prison_03
47+
d2_prison_04
48+
d2_prison_05
49+
d2_prison_06
50+
d2_prison_07
51+
d2_prison_08
52+
background05
53+
d3_c17_01
54+
d3_c17_02
55+
d3_c17_03
56+
d3_c17_04
57+
d3_c17_05
58+
d3_c17_06a
59+
d3_c17_06b
60+
d3_c17_07
61+
d3_c17_08
62+
d3_c17_09
63+
d3_c17_10a
64+
d3_c17_10b
65+
d3_c17_11
66+
d3_c17_12
67+
background06
68+
d3_citadel_01
69+
d3_citadel_02
70+
d3_citadel_03
71+
d3_citadel_04
72+
d3_citadel_05
73+
d3_breen_01
74+
EOF
75+
)
76+
77+
for map in $maps; do
78+
DISPLAY=:0 ./hl2_launcher -game hl2 +map $map 2>&1 > map-$map.txt &
79+
pid=$!
80+
sleep 20
81+
kill $pid
82+
echo processed $map
83+
sleep 5
84+
done

emscripten/libwebgl.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@@ -4160,18 +4160,9 @@
2+
3+
glMapBufferRange__deps: ['$emscriptenWebGLGetBufferBinding', '$emscriptenWebGLValidateMapBufferTarget', 'malloc'],
4+
glMapBufferRange: (target, offset, length, access) => {
5+
- if ((access & (0x1/*GL_MAP_READ_BIT*/ | 0x20/*GL_MAP_UNSYNCHRONIZED_BIT*/)) != 0) {
6+
+ if ((access & (0x1/*GL_MAP_READ_BIT*/)) != 0) {
7+
err("glMapBufferRange access does not support MAP_READ or MAP_UNSYNCHRONIZED");
8+
- return 0;
9+
- }
10+
-
11+
- if ((access & 0x2/*GL_MAP_WRITE_BIT*/) == 0) {
12+
- err("glMapBufferRange access must include MAP_WRITE");
13+
- return 0;
14+
- }
15+
-
16+
- if ((access & (0x4/*GL_MAP_INVALIDATE_BUFFER_BIT*/ | 0x8/*GL_MAP_INVALIDATE_RANGE_BIT*/)) == 0) {
17+
- err("glMapBufferRange access must include INVALIDATE_BUFFER or INVALIDATE_RANGE");
18+
+ GL.recordError(0x501 /* GL_INVALID_VALUE */);
19+
return 0;
20+
}

0 commit comments

Comments
 (0)