├── .builds ├── alpine.yml ├── debian-arm64.yml ├── debian.yml ├── freebsd.yml ├── netbsd.yml └── openbsd.yml ├── .cirrus.yml ├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ └── c-cpp.yml ├── .gitignore ├── .gitmodules ├── 3rdparty ├── bzip2 │ └── wscript ├── extras │ └── wscript ├── gl4es │ └── wscript ├── libbacktrace │ └── wscript ├── libogg │ └── wscript ├── opus │ └── wscript ├── opusfile │ └── wscript └── vorbis │ └── wscript ├── CONTRIBUTING.md ├── Documentation ├── bug-compatibility.md ├── cross-compiling-for-windows-with-wine.md ├── debugging-using-minidumps.md ├── donate.md ├── engine-porting-guide.md ├── environment-variables.md ├── extensions │ ├── console-scripting.md │ ├── entity-tools.md │ ├── expanded-common-structures.md │ ├── input-interface-ru.md │ ├── input-interface.md │ ├── library-naming.md │ ├── mp3-loops.md │ ├── native-object.md │ └── sounds.lst.md ├── gameinfo.md ├── goldsrc-protocol-support.md ├── hd-textures.md ├── images │ ├── editor.jpg │ ├── example1.jpg │ ├── example2.jpg │ ├── example3.jpg │ ├── example4.jpg │ ├── example5.jpg │ ├── touch-buttons.jpg │ └── touch-profiles.jpg ├── mod-porting-guide.md ├── musl.md ├── nat-bypass-usage.md ├── not-supported-mod-list-and-reasons-why.md ├── opensource-mods.md ├── ports.md ├── psvita.md ├── public-servers-rules-and-recommendations.md ├── supported-mod-list.md └── touch-controls.md ├── README.md ├── android ├── .gitignore ├── app │ ├── CMakeLists.txt │ ├── build.gradle.kts │ ├── proguard-rules.pro │ └── src │ │ ├── asan │ │ ├── jniLibs │ │ │ ├── arm64-v8a │ │ │ │ └── libclang_rt.asan-aarch64-android.so │ │ │ ├── armeabi-v7a │ │ │ │ └── libclang_rt.asan-arm-android.so │ │ │ ├── x86 │ │ │ │ └── libclang_rt.asan-i686-android.so │ │ │ └── x86_64 │ │ │ │ └── libclang_rt.asan-x86_64-android.so │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── resources │ │ │ └── lib │ │ │ ├── arm64-v8a │ │ │ └── wrap.sh │ │ │ ├── armeabi-v7a │ │ │ └── wrap.sh │ │ │ ├── x86 │ │ │ └── wrap.sh │ │ │ └── x86_64 │ │ │ └── wrap.sh │ │ ├── continuous │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ │ ├── debug │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── su │ │ │ └── xash │ │ │ └── engine │ │ │ ├── AndroidBug5497Workaround.java │ │ │ ├── DedicatedActivity.kt │ │ │ ├── DedicatedService.kt │ │ │ ├── MainActivity.kt │ │ │ ├── MainApplication.kt │ │ │ ├── XashActivity.java │ │ │ ├── XashDocumentsProvider.java │ │ │ ├── adapters │ │ │ └── GameAdapter.kt │ │ │ ├── model │ │ │ ├── BackgroundBitmap.kt │ │ │ ├── Game.kt │ │ │ └── ModDatabase.kt │ │ │ ├── ui │ │ │ ├── library │ │ │ │ ├── LibraryFragment.kt │ │ │ │ └── LibraryViewModel.kt │ │ │ ├── settings │ │ │ │ ├── AppSettingsFragment.kt │ │ │ │ ├── AppSettingsPreferenceFragment.kt │ │ │ │ ├── GameSettingsFragment.kt │ │ │ │ └── GameSettingsPreferenceFragment.kt │ │ │ └── setup │ │ │ │ ├── SetupFragment.kt │ │ │ │ ├── SetupViewModel.kt │ │ │ │ └── pages │ │ │ │ ├── LocationPageFragment.kt │ │ │ │ └── WelcomePageFragment.kt │ │ │ ├── util │ │ │ └── TGAReader.java │ │ │ └── workers │ │ │ └── FileCopyWorker.kt │ │ └── res │ │ ├── drawable │ │ ├── ic_baseline_add_24.xml │ │ ├── ic_baseline_delete_24.xml │ │ ├── ic_baseline_folder_open_24.xml │ │ ├── ic_baseline_key_24.xml │ │ ├── ic_baseline_person_24.xml │ │ ├── ic_baseline_play_arrow_24.xml │ │ ├── ic_baseline_settings_24.xml │ │ ├── ic_baseline_terminal_24.xml │ │ ├── steam_button_gradient.xml │ │ ├── steam_icon.xml │ │ └── steam_logo.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── card_game.xml │ │ ├── edit_text_preference.xml │ │ ├── fragment_app_settings.xml │ │ ├── fragment_game_settings.xml │ │ ├── fragment_library.xml │ │ ├── fragment_setup.xml │ │ ├── fragment_steam_login.xml │ │ ├── list_preference.xml │ │ ├── page_location.xml │ │ ├── page_welcome.xml │ │ ├── steam_guard_dialog.xml │ │ └── switch_preference.xml │ │ ├── menu │ │ ├── menu_game_settings.xml │ │ └── menu_library.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ ├── ic_launcher_foreground.xml │ │ ├── ic_launcher_monochrome.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_foreground.png │ │ ├── navigation │ │ └── nav_graph.xml │ │ ├── values-es │ │ └── strings.xml │ │ ├── values-it │ │ └── strings.xml │ │ ├── values-pt-rBR │ │ └── strings.xml │ │ ├── values-ru │ │ └── strings.xml │ │ ├── values-tr │ │ └── strings.xml │ │ ├── values-uk │ │ └── strings.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml │ │ └── xml │ │ ├── app_preferences.xml │ │ └── game_preferences.xml ├── build.gradle.kts ├── debug.keystore ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── moddb │ └── v1.json └── settings.gradle.kts ├── common ├── backends.h ├── beamdef.h ├── bspfile.h ├── cl_entity.h ├── com_image.h ├── com_model.h ├── con_nprint.h ├── const.h ├── cvardef.h ├── defaults.h ├── demo_api.h ├── dlight.h ├── enginefeatures.h ├── entity_state.h ├── entity_types.h ├── event_api.h ├── event_args.h ├── event_flags.h ├── gameinfo.h ├── hltv.h ├── ivoicetweak.h ├── kbutton.h ├── lightstyle.h ├── mathlib.h ├── net_api.h ├── netadr.h ├── particledef.h ├── pmtrace.h ├── port.h ├── qfont.h ├── r_efx.h ├── r_studioint.h ├── ref_params.h ├── render_api.h ├── screenfade.h ├── studio_event.h ├── synctype.h ├── triangleapi.h ├── usercmd.h ├── wadfile.h ├── weaponinfo.h ├── wrect.h └── xash3d_types.h ├── engine ├── alias.h ├── anorms.h ├── cdll_exp.h ├── cdll_int.h ├── client │ ├── avi │ │ ├── avi.h │ │ ├── avi_stub.c │ │ └── avi_win.c │ ├── cl_cmds.c │ ├── cl_custom.c │ ├── cl_debug.c │ ├── cl_demo.c │ ├── cl_efrag.c │ ├── cl_efx.c │ ├── cl_events.c │ ├── cl_font.c │ ├── cl_frame.c │ ├── cl_game.c │ ├── cl_gameui.c │ ├── cl_main.c │ ├── cl_mobile.c │ ├── cl_netgraph.c │ ├── cl_parse.c │ ├── cl_parse_48.c │ ├── cl_parse_gs.c │ ├── cl_pmove.c │ ├── cl_qparse.c │ ├── cl_remap.c │ ├── cl_render.c │ ├── cl_scrn.c │ ├── cl_securedstub.c │ ├── cl_tent.c │ ├── cl_tent.h │ ├── cl_video.c │ ├── cl_view.c │ ├── client.h │ ├── console.c │ ├── gamma.c │ ├── identification.c │ ├── in_joy.c │ ├── in_touch.c │ ├── input.c │ ├── input.h │ ├── keys.c │ ├── mod_dbghulls.c │ ├── ref_common.c │ ├── ref_common.h │ ├── s_dsp.c │ ├── s_load.c │ ├── s_main.c │ ├── s_mix.c │ ├── s_mouth.c │ ├── s_stream.c │ ├── s_utils.c │ ├── s_vox.c │ ├── sound.h │ ├── soundlib │ │ ├── libmpg │ │ │ ├── dct36.c │ │ │ ├── dct64.c │ │ │ ├── fmt123.h │ │ │ ├── format.c │ │ │ ├── frame.c │ │ │ ├── frame.h │ │ │ ├── getbits.h │ │ │ ├── huffman.h │ │ │ ├── index.c │ │ │ ├── index.h │ │ │ ├── layer3.c │ │ │ ├── libmpg.c │ │ │ ├── libmpg.dsp │ │ │ ├── libmpg.h │ │ │ ├── mpeghead.h │ │ │ ├── mpg123.c │ │ │ ├── mpg123.h │ │ │ ├── parse.c │ │ │ ├── reader.c │ │ │ ├── reader.h │ │ │ ├── sample.h │ │ │ ├── synth.c │ │ │ ├── synth.h │ │ │ └── tabinit.c │ │ ├── ogg_filestream.c │ │ ├── ogg_filestream.h │ │ ├── snd_main.c │ │ ├── snd_mp3.c │ │ ├── snd_ogg_opus.c │ │ ├── snd_ogg_vorbis.c │ │ └── snd_wav.c │ ├── titles.c │ ├── vgui │ │ ├── vgui_draw.c │ │ └── vgui_draw.h │ ├── vid_common.c │ ├── vid_common.h │ ├── voice.c │ ├── voice.h │ └── vox.h ├── common │ ├── base_cmd.c │ ├── base_cmd.h │ ├── cfgscript.c │ ├── cmd.c │ ├── com_strings.h │ ├── common.c │ ├── common.h │ ├── con_utils.c │ ├── custom.c │ ├── cvar.c │ ├── cvar.h │ ├── dedicated.c │ ├── filesystem_engine.c │ ├── host.c │ ├── host_state.c │ ├── hpak.c │ ├── hpak.h │ ├── imagelib │ │ ├── imagelib.h │ │ ├── img_bmp.c │ │ ├── img_bmp.h │ │ ├── img_dds.c │ │ ├── img_dds.h │ │ ├── img_ktx2.c │ │ ├── img_ktx2.h │ │ ├── img_main.c │ │ ├── img_png.c │ │ ├── img_png.h │ │ ├── img_quant.c │ │ ├── img_tga.c │ │ ├── img_tga.h │ │ ├── img_utils.c │ │ └── img_wad.c │ ├── infostring.c │ ├── ipv6text.c │ ├── ipv6text.h │ ├── launcher.c │ ├── lib_common.c │ ├── library.h │ ├── masterlist.c │ ├── mod_alias.c │ ├── mod_bmodel.c │ ├── mod_local.h │ ├── mod_sprite.c │ ├── mod_studio.c │ ├── model.c │ ├── munge.c │ ├── net_buffer.c │ ├── net_buffer.h │ ├── net_chan.c │ ├── net_encode.c │ ├── net_encode.h │ ├── net_http.c │ ├── net_ws.c │ ├── net_ws.h │ ├── net_ws_private.h │ ├── netchan.h │ ├── pm_local.h │ ├── pm_surface.c │ ├── pm_trace.c │ ├── protocol.h │ ├── soundlib │ │ ├── snd_utils.c │ │ └── soundlib.h │ ├── sounds.c │ ├── sys_con.c │ ├── system.c │ ├── system.h │ ├── tests.h │ ├── whereami.c │ ├── whereami.h │ ├── world.c │ ├── world.h │ └── zone.c ├── cursor_type.h ├── custom.h ├── customentity.h ├── edict.h ├── eiface.h ├── key_modifiers.h ├── keydefs.h ├── menu_int.h ├── mobility_int.h ├── physint.h ├── platform │ ├── android │ │ ├── android.c │ │ ├── dlsym-weak.c │ │ ├── dlsym-weak.h │ │ ├── lib_android.c │ │ ├── lib_android.h │ │ └── linker.h │ ├── apple │ │ ├── lib_ios.c │ │ └── lib_ios.h │ ├── dos │ │ ├── in_dos.c │ │ ├── ld.sh │ │ ├── objcopy.sh │ │ ├── sys_dos.c │ │ └── vid_dos.c │ ├── emscripten │ │ ├── lib_em.c │ │ └── lib_em.h │ ├── irix │ │ ├── dladdr.c │ │ ├── dladdr.h │ │ └── xash-exec │ ├── linux │ │ ├── in_evdev.c │ │ ├── s_alsa.c │ │ ├── sys_linux.c │ │ └── vid_fbdev.c │ ├── misc │ │ ├── kmalloc.c │ │ ├── lib_static.c │ │ ├── sbrk.c │ │ └── swap.h │ ├── nswitch │ │ ├── icon.jpg │ │ ├── sys_nswitch.c │ │ └── xash3d-fwgs.nacp │ ├── platform.h │ ├── posix │ │ ├── con_posix.c │ │ ├── crash_glibc.c │ │ ├── crash_libbacktrace.c │ │ ├── crash_posix.c │ │ ├── lib_posix.c │ │ ├── net.h │ │ └── sys_posix.c │ ├── psvita │ │ ├── in_psvita.c │ │ ├── net_psvita.h │ │ ├── sce_sys │ │ │ ├── icon0.png │ │ │ └── livearea │ │ │ │ └── contents │ │ │ │ ├── bg.png │ │ │ │ ├── startup.png │ │ │ │ └── template.xml │ │ └── sys_psvita.c │ ├── sdl1 │ │ ├── host_sdl1.c │ │ ├── in_sdl1.c │ │ ├── platform_sdl1.h │ │ ├── s_sdl1.c │ │ ├── sys_sdl1.c │ │ └── vid_sdl1.c │ ├── sdl2 │ │ ├── host_sdl2.c │ │ ├── in_sdl2.c │ │ ├── joy_sdl2.c │ │ ├── platform_sdl2.h │ │ ├── s_sdl2.c │ │ ├── sys_sdl2.c │ │ └── vid_sdl2.c │ ├── sdl3 │ │ ├── in_sdl3.c │ │ ├── platform_sdl3.h │ │ └── sys_sdl3.c │ ├── stub │ │ ├── net_stub.h │ │ └── s_stub.c │ └── win32 │ │ ├── con_win.c │ │ ├── crash_win.c │ │ ├── lib_custom_win.c │ │ ├── lib_win.c │ │ ├── lib_win.h │ │ ├── net.h │ │ └── sys_win.c ├── progdefs.h ├── ref_api.h ├── server │ ├── server.h │ ├── sv_client.c │ ├── sv_cmds.c │ ├── sv_custom.c │ ├── sv_filter.c │ ├── sv_frame.c │ ├── sv_game.c │ ├── sv_init.c │ ├── sv_log.c │ ├── sv_main.c │ ├── sv_move.c │ ├── sv_phys.c │ ├── sv_pmove.c │ ├── sv_query.c │ ├── sv_save.c │ └── sv_world.c ├── shake.h ├── sprite.h ├── studio.h ├── vgui_api.h ├── warpsin.h └── wscript ├── filesystem ├── VFileSystem009.cpp ├── VFileSystem009.h ├── android.c ├── dir.c ├── exports.txt ├── filesystem.c ├── filesystem.h ├── filesystem_internal.h ├── fscallback.h ├── pak.c ├── tests │ ├── caseinsensitive.c │ ├── interface.cpp │ └── no-init.c ├── wad.c ├── wscript └── zip.c ├── game_launch ├── game.cpp ├── game.rc ├── icon-xash-material.ico ├── icon-xash-material.png └── wscript ├── pm_shared ├── pm_defs.h ├── pm_info.h └── pm_movevars.h ├── public ├── build.c ├── build.h ├── build_vcs.c ├── buildenums.h ├── crclib.c ├── crclib.h ├── crtlib.c ├── crtlib.h ├── dllhelpers.c ├── getopt.c ├── getopt.h ├── matrixlib.c ├── miniz.c ├── miniz.h ├── pstdint.h ├── tests │ ├── test_atoi.c │ ├── test_build.c │ ├── test_efp.c │ ├── test_filebase.c │ ├── test_fileext.c │ ├── test_parsefile.c │ ├── test_strings.c │ └── test_validate_target.c ├── utflib.c ├── utflib.h ├── wscript ├── xash3d_mathlib.c └── xash3d_mathlib.h ├── ref ├── gl │ ├── exports.txt │ ├── gl2_shim │ │ ├── fragment.glsl.inc │ │ ├── gl2_shim.c │ │ ├── gl2_shim.h │ │ └── vertex.glsl.inc │ ├── gl_alias.c │ ├── gl_backend.c │ ├── gl_beams.c │ ├── gl_context.c │ ├── gl_cull.c │ ├── gl_decals.c │ ├── gl_draw.c │ ├── gl_export.h │ ├── gl_frustum.c │ ├── gl_frustum.h │ ├── gl_image.c │ ├── gl_local.h │ ├── gl_opengl.c │ ├── gl_rlight.c │ ├── gl_rmain.c │ ├── gl_rmath.c │ ├── gl_rmisc.c │ ├── gl_rpart.c │ ├── gl_rsurf.c │ ├── gl_sprite.c │ ├── gl_studio.c │ ├── gl_triapi.c │ ├── gl_warp.c │ ├── vgl_shim │ │ ├── vgl_shaders │ │ │ ├── fragment.cg.inc │ │ │ └── vertex.cg.inc │ │ ├── vgl_shim.c │ │ ├── vgl_shim.h │ │ └── wscript │ └── wscript ├── null │ ├── r_context.c │ └── wscript └── soft │ ├── adivtab.h │ ├── r_aclip.c │ ├── r_beams.c │ ├── r_bsp.c │ ├── r_context.c │ ├── r_decals.c │ ├── r_draw.c │ ├── r_edge.c │ ├── r_glblit.c │ ├── r_image.c │ ├── r_light.c │ ├── r_local.h │ ├── r_main.c │ ├── r_math.c │ ├── r_misc.c │ ├── r_part.c │ ├── r_polyse.c │ ├── r_rast.c │ ├── r_scan.c │ ├── r_sprite.c │ ├── r_studio.c │ ├── r_surf.c │ ├── r_trialias.c │ ├── r_triapi.c │ └── wscript ├── scripts ├── cirrus │ └── build_freebsd.sh ├── flatpak │ ├── run.sh │ ├── su.xash.Engine.Compat.i386.desktop │ └── su.xash.Engine.Compat.i386.yml ├── fwgs.pfx ├── gha │ ├── build_android.sh │ ├── build_apple.sh │ ├── build_linux-e2k.sh │ ├── build_linux.sh │ ├── build_motomagx.sh │ ├── build_nswitch.sh │ ├── build_nswitch_docker.sh │ ├── build_psvita.sh │ ├── build_win32.sh │ ├── deps_android.sh │ ├── deps_apple.sh │ ├── deps_linux-e2k.sh │ ├── deps_linux.sh │ ├── deps_motomagx.sh │ ├── deps_nswitch.sh │ ├── deps_psvita.sh │ ├── deps_win32.sh │ └── linux │ │ ├── AppRun │ │ └── xash3d-fwgs.desktop ├── lib-e2k.sh ├── lib.sh ├── makepak.py ├── sailfish │ ├── build.sh │ ├── deploy.sh │ ├── harbour-xash3d-fwgs.desktop │ ├── harbour-xash3d-fwgs.spec │ └── run.sh ├── waifulib │ ├── compiler_optimizations.py │ ├── nswitch.py │ ├── owcc.py │ ├── psp.py │ ├── psvita.py │ ├── sdl2.py │ ├── vgui.py │ ├── xcompile.py │ ├── xshlib.py │ └── zip.py └── xashds@.service ├── uncrustify.cfg ├── utils ├── mdldec │ ├── Makefile │ ├── mdldec.c │ ├── mdldec.h │ ├── qc.c │ ├── qc.h │ ├── res │ │ └── activities.txt │ ├── settings.h │ ├── smd.c │ ├── smd.h │ ├── texture.c │ ├── texture.h │ ├── utils.c │ ├── utils.h │ ├── version.h │ └── wscript ├── run-fuzzer │ ├── run-fuzzer.c │ └── wscript └── xar │ ├── wscript │ └── xar.c ├── waf ├── waf.bat └── wscript /.builds/alpine.yml: -------------------------------------------------------------------------------- 1 | image: alpine/latest 2 | packages: 3 | - build-base 4 | - sdl2-dev 5 | - freetype-dev 6 | - fontconfig-dev 7 | - opus-dev 8 | - bzip2-dev 9 | sources: 10 | - https://git.sr.ht/~a1batross/xash3d-fwgs 11 | tasks: 12 | - client: | 13 | cd xash3d-fwgs 14 | ./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin 15 | - server: | 16 | cd xash3d-fwgs 17 | ./waf configure --reconfigure --dedicated build install --destdir=bin 18 | - run-tests: | 19 | cd xash3d-fwgs/bin 20 | export SDL_VIDEODRIVER=wayland 21 | ./xash3d -runtests 22 | ./xash -runtests 23 | rm -rf valve/gameinfo.txt test_* 24 | - package: | 25 | cd xash3d-fwgs/bin 26 | tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 * 27 | artifacts: 28 | - xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2 29 | -------------------------------------------------------------------------------- /.builds/debian-arm64.yml: -------------------------------------------------------------------------------- 1 | image: debian/sid 2 | arch: amd64 3 | packages: 4 | - build-essential 5 | - python-is-python3 6 | - libsdl2-dev 7 | - libfreetype-dev 8 | - libfontconfig-dev 9 | - libopus-dev 10 | - libbz2-dev 11 | sources: 12 | - https://git.sr.ht/~a1batross/xash3d-fwgs 13 | tasks: 14 | - client: | 15 | cd xash3d-fwgs 16 | ./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin 17 | - server: | 18 | cd xash3d-fwgs 19 | ./waf configure --reconfigure --dedicated build install --destdir=bin 20 | - run-tests: | 21 | cd xash3d-fwgs/bin 22 | export SDL_VIDEODRIVER=wayland 23 | ./xash3d -runtests 24 | ./xash -runtests 25 | rm -rf valve/gameinfo.txt test_* 26 | - package: | 27 | cd xash3d-fwgs/bin 28 | tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 * 29 | artifacts: 30 | - xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2 31 | 32 | -------------------------------------------------------------------------------- /.builds/debian.yml: -------------------------------------------------------------------------------- 1 | image: debian/sid 2 | packages: 3 | - build-essential 4 | - python-is-python3 5 | - libsdl2-dev 6 | - libfreetype-dev 7 | - libfontconfig-dev 8 | - libopus-dev 9 | - libbz2-dev 10 | sources: 11 | - https://git.sr.ht/~a1batross/xash3d-fwgs 12 | tasks: 13 | - client: | 14 | cd xash3d-fwgs 15 | ./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin 16 | - server: | 17 | cd xash3d-fwgs 18 | ./waf configure --reconfigure --dedicated build install --destdir=bin 19 | - run-tests: | 20 | cd xash3d-fwgs/bin 21 | export SDL_VIDEODRIVER=wayland 22 | ./xash3d -runtests 23 | ./xash -runtests 24 | rm -rf valve/gameinfo.txt test_* 25 | - package: | 26 | cd xash3d-fwgs/bin 27 | tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 * 28 | artifacts: 29 | - xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2 30 | 31 | -------------------------------------------------------------------------------- /.builds/freebsd.yml: -------------------------------------------------------------------------------- 1 | image: freebsd/latest 2 | packages: 3 | - lang/python 4 | - devel/pkgconf 5 | - devel/sdl20 6 | - print/freetype2 7 | - x11-fonts/fontconfig 8 | - audio/opus 9 | - archivers/bzip2 10 | sources: 11 | - https://git.sr.ht/~a1batross/xash3d-fwgs 12 | tasks: 13 | - client: | 14 | cd xash3d-fwgs 15 | ./waf configure --enable-tests --enable-engine-tests build install --destdir=bin 16 | - server: | 17 | cd xash3d-fwgs 18 | ./waf configure --reconfigure --dedicated build install --destdir=bin 19 | - run-tests: | 20 | cd xash3d-fwgs/bin 21 | export SDL_VIDEODRIVER=wayland 22 | ./xash3d -runtests 23 | ./xash -runtests 24 | rm -rf valve/gameinfo.txt test_* 25 | - package: | 26 | cd xash3d-fwgs/bin 27 | tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 * 28 | artifacts: 29 | - xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2 30 | 31 | -------------------------------------------------------------------------------- /.builds/netbsd.yml: -------------------------------------------------------------------------------- 1 | image: netbsd/latest 2 | packages: 3 | - python311 4 | - SDL2 5 | - freetype2 6 | - fontconfig 7 | - libopus 8 | - pkgconf 9 | - bzip2 10 | sources: 11 | - https://git.sr.ht/~a1batross/xash3d-fwgs 12 | tasks: 13 | - client: | 14 | cd xash3d-fwgs 15 | python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin 16 | - server: | 17 | cd xash3d-fwgs 18 | python3.11 waf configure --reconfigure --dedicated build install --destdir=bin 19 | - run-tests: | 20 | cd xash3d-fwgs/bin 21 | export SDL_VIDEODRIVER=wayland 22 | ./xash3d -runtests 23 | ./xash -runtests 24 | rm -rf valve/gameinfo.txt test_* 25 | - package: | 26 | cd xash3d-fwgs/bin 27 | tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 * 28 | artifacts: 29 | - xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2 30 | 31 | -------------------------------------------------------------------------------- /.builds/openbsd.yml: -------------------------------------------------------------------------------- 1 | image: openbsd/latest 2 | packages: 3 | - python3 4 | - sdl2 5 | - opus 6 | - bzip2 7 | sources: 8 | - https://git.sr.ht/~a1batross/xash3d-fwgs 9 | tasks: 10 | - client: | 11 | cd xash3d-fwgs 12 | python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin 13 | - server: | 14 | cd xash3d-fwgs 15 | python3 waf configure --reconfigure --dedicated build install --destdir=bin 16 | - run-tests: | 17 | cd xash3d-fwgs/bin 18 | export SDL_VIDEODRIVER=wayland 19 | ./xash3d -runtests 20 | ./xash -runtests 21 | rm -rf valve/gameinfo.txt test_* 22 | - package: | 23 | cd xash3d-fwgs/bin 24 | tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 * 25 | artifacts: 26 | - xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2 27 | 28 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | task: 2 | name: freebsd-14-amd64 3 | freebsd_instance: 4 | image_family: freebsd-14-2 5 | setup_script: 6 | - pkg update 7 | - pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace 8 | - git submodule update --init --recursive 9 | test_script: 10 | - ./scripts/cirrus/build_freebsd.sh 11 | 12 | task: 13 | name: freebsd-15-amd64 14 | freebsd_instance: 15 | image_family: freebsd-15-0-snap 16 | setup_script: 17 | - pkg update 18 | - pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace 19 | - git submodule update --init --recursive 20 | test_script: 21 | - ./scripts/cirrus/build_freebsd.sh 22 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.c text eol=lf diff=cpp 2 | *.h text eol=lf diff=cpp 3 | wscript text eol=lf diff=python 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/donate.md 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "mainui"] 2 | path = 3rdparty/mainui 3 | url = https://github.com/FWGS/mainui_cpp 4 | [submodule "ref_gl/nanogl"] 5 | path = 3rdparty/nanogl 6 | url = https://github.com/FWGS/nanogl 7 | [submodule "ref_gl/gl-wes-v2"] 8 | path = 3rdparty/gl-wes-v2 9 | url = https://github.com/FWGS/gl-wes-v2 10 | [submodule "ref_gl/gl4es"] 11 | path = 3rdparty/gl4es/gl4es 12 | url = https://github.com/ptitSeb/gl4es 13 | [submodule "vgui_support"] 14 | path = 3rdparty/vgui_support 15 | url = https://github.com/FWGS/vgui_support 16 | [submodule "opus"] 17 | path = 3rdparty/opus/opus 18 | url = https://github.com/xiph/opus 19 | [submodule "3rdparty/xash-extras"] 20 | path = 3rdparty/extras/xash-extras 21 | url = https://github.com/FWGS/xash-extras 22 | [submodule "3rdparty/bzip2/bzip2"] 23 | path = 3rdparty/bzip2/bzip2 24 | url = https://gitlab.com/bzip2/bzip2 25 | [submodule "3rdparty/MultiEmulator"] 26 | path = 3rdparty/MultiEmulator 27 | url = https://github.com/FWGS/MultiEmulator 28 | [submodule "3rdparty/libogg/libogg"] 29 | path = 3rdparty/libogg/libogg 30 | url = https://github.com/xiph/ogg.git 31 | [submodule "3rdparty/vorbis/vorbis-src"] 32 | path = 3rdparty/vorbis/vorbis-src 33 | url = https://github.com/xiph/vorbis.git 34 | [submodule "3rdparty/opusfile/opusfile"] 35 | path = 3rdparty/opusfile/opusfile 36 | url = https://github.com/xiph/opusfile.git 37 | [submodule "3rdparty/libbacktrace/libbacktrace"] 38 | path = 3rdparty/libbacktrace/libbacktrace 39 | url = https://github.com/ianlancetaylor/libbacktrace 40 | [submodule "3rdparty/maintui"] 41 | path = 3rdparty/maintui 42 | url = https://github.com/numas13/xash3d-maintui.git 43 | -------------------------------------------------------------------------------- /3rdparty/bzip2/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | def options(opt): 5 | pass 6 | 7 | def configure(conf): 8 | conf.define('_GNU_SOURCE', 1) 9 | conf.define('BZ_NO_STDIO', 1) 10 | 11 | if conf.env.DEST_OS == 'win32': 12 | conf.define('BZ_LCCWIN32', 1) 13 | else: 14 | conf.define('BZ_UNIX', 1) 15 | 16 | def build(bld): 17 | bld(features = 'subst', source = 'bzip2/bz_version.h.in', target = 'bzip2/bz_version.h', BZ_VERSION='1.1.0-fwgs', name = 'bz_version') 18 | 19 | bz_sources = ['bzip2/blocksort.c', 'bzip2/huffman.c', 'bzip2/crctable.c', 'bzip2/randtable.c', 'bzip2/compress.c', 'bzip2/decompress.c', 'bzip2/bzlib.c'] 20 | 21 | bld.stlib( 22 | source = bz_sources, 23 | target = 'bzip2', 24 | use = 'bz_version', 25 | includes = 'bzip2/', 26 | export_includes = 'bzip2/' 27 | ) 28 | -------------------------------------------------------------------------------- /3rdparty/extras/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | 6 | def options(opt): 7 | pass 8 | 9 | def configure(conf): 10 | if not conf.path.find_dir('xash-extras'): 11 | conf.fatal('Can\'t find xash-extras submodule.') 12 | return 13 | 14 | conf.load('zip') 15 | 16 | def build(bld): 17 | srcdir = bld.path.find_dir('xash-extras') 18 | 19 | if bld.env.DEST_OS in ['android']: 20 | install_path = bld.env.PREFIX 21 | else: 22 | install_path = os.path.join(bld.env.SHAREDIR, bld.env.GAMEDIR) 23 | 24 | bld(features='zip', 25 | name = 'extras.pk3', 26 | files = srcdir.ant_glob('**/*'), 27 | relative_to = srcdir, 28 | install_path = install_path) 29 | -------------------------------------------------------------------------------- /3rdparty/gl4es/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | 6 | def options(opt): 7 | pass 8 | 9 | def configure(conf): 10 | if not conf.path.find_dir('gl4es') or not conf.path.find_dir('gl4es/src'): 11 | conf.fatal('Can\'t find gl4es submodule. Run `git submodule update --init --recursive`.') 12 | return 13 | 14 | def build(bld): 15 | gl4es_srcdir = bld.path.find_node('gl4es/src') 16 | 17 | bld.stlib(source = gl4es_srcdir.ant_glob(['gl/*.c', 'gl/*/*.c', 'glx/hardext.c']), 18 | target = 'gl4es', 19 | includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'], 20 | defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'NO_LOADER', 'STATICLIB'], 21 | cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'], 22 | export_includes = '.') 23 | -------------------------------------------------------------------------------- /3rdparty/libogg/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | def options(opt): 5 | pass 6 | 7 | def configure(conf): 8 | if not conf.path.find_dir('libogg') or not conf.path.find_dir('libogg/src'): 9 | conf.fatal('Can\'t find libogg submodule. Run `git submodule update --init --recursive`.') 10 | return 11 | 12 | conf.env.INCLUDE_INTTYPES_H = 0 13 | conf.env.INCLUDE_SYS_TYPES_H = 0 14 | conf.env.INCLUDE_STDINT_H = 0 15 | 16 | if conf.check_cc(header_name='inttypes.h', mandatory = False): 17 | conf.env.INCLUDE_INTTYPES_H = 1 18 | elif conf.check_cc(header_name='sys/types.h', mandatory = False): 19 | conf.env.INCLUDE_SYS_TYPES_H = 1 20 | elif conf.check_cc(header_name='stdint.h', mandatory = False): 21 | conf.env.INCLUDE_STDINT_H = 1 22 | 23 | def build(bld): 24 | sources = bld.path.ant_glob([ 25 | 'libogg/src/*.c' 26 | ]) 27 | 28 | bld( 29 | features = 'subst', 30 | name = 'libogg_config_types', 31 | source = 'libogg/include/ogg/config_types.h.in', 32 | target = 'libogg/include/ogg/config_types.h', 33 | INCLUDE_INTTYPES_H = bld.env.INCLUDE_INTTYPES_H, 34 | INCLUDE_SYS_TYPES_H = bld.env.INCLUDE_SYS_TYPES_H, 35 | INCLUDE_STDINT_H = bld.env.INCLUDE_STDINT_H, 36 | SIZE16 = 'int16_t', 37 | USIZE16 = 'uint16_t', 38 | SIZE32 = 'int32_t', 39 | USIZE32 = 'uint32_t', 40 | SIZE64 = 'int64_t', 41 | USIZE64 = 'uint64_t' 42 | ) 43 | 44 | bld.stlib( 45 | source = sources, 46 | target = 'ogg', 47 | use = 'libogg_config_types', 48 | includes = 'libogg/include/', 49 | export_includes = 'libogg/include/' 50 | ) 51 | -------------------------------------------------------------------------------- /3rdparty/opusfile/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | def options(opt): 5 | pass 6 | 7 | def configure(conf): 8 | if not conf.path.find_dir('opusfile') or not conf.path.find_dir('opusfile/src'): 9 | conf.fatal('Can\'t find opusfile submodule. Run `git submodule update --init --recursive`.') 10 | return 11 | 12 | if conf.env.COMPILER_CC == 'msvc': 13 | conf.define('_CRT_SECURE_NO_WARNINGS', 1) 14 | conf.define('_CRT_SECURE_NO_DEPRECATE', 1) 15 | conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1) 16 | 17 | if conf.env.DEST_OS == 'android': 18 | # HACKHACK: set it to 32 here because opusfile can't be built on Android SDK < 24 19 | # with _FILE_OFFSET_BITS 64 (which it sets automatically in src/internal.h) 20 | # we are not (????) relying on this part of the API, so it should be harmless 21 | conf.define('_FILE_OFFSET_BITS', 32) 22 | 23 | def build(bld): 24 | sources = [ 25 | 'opusfile/src/info.c', 26 | 'opusfile/src/internal.c', 27 | 'opusfile/src/opusfile.c', 28 | 'opusfile/src/stream.c' 29 | ] 30 | 31 | bld.stlib( 32 | source = sources, 33 | target = 'opusfile', 34 | includes = 'opusfile/include/', 35 | use = 'ogg opus', 36 | export_includes = 'opusfile/include/' 37 | ) 38 | -------------------------------------------------------------------------------- /Documentation/bug-compatibility.md: -------------------------------------------------------------------------------- 1 | # Bug-compatibility in Xash3D FWGS 2 | 3 | Xash3D FWGS has special mode for games that rely on original engine bugs. In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games. 4 | 5 | At this time, we only have implemented GoldSrc bug-compatibility. It can be enabled with `-bugcomp` command line switch. 6 | 7 | When `-bugcomp` is specified without argument, it enables everything. This behavior might be changed or removed in future versions. 8 | 9 | When `-bugcomp` is specified with argument, it interpreted as flags separated with `+`. This way it's possible to combine multiple levels of bug-compatibility. 10 | 11 | ## GoldSrc bug-compatibility 12 | 13 | | Flag | Description | Games that require this flag | 14 | | ------- | ----------- | ---------------------------- | 15 | | `peoei` | Reverts `pfnPEntityOfEntIndex` behavior to GoldSrc, where it returns NULL for last player due to incorrect player index comparison | * Counter-Strike: Condition Zero - Deleted Scenes | 16 | | `gsmrf` | Rewrites message at the moment when Game DLL attempts to write an internal engine message, usually specific to GoldSrc protocol.
Right now only supports `svc_spawnstaticsound`, more messages added by request. | * MetaMod/AMXModX based mods | 17 | | `sp_attn_none` | Makes sounds with attenuation zero spatialized, i.e. have a stereo effect. | Possibly, every game that was made for GoldSrc. | 18 | | `get_game_dir_full` | Makes server return full path in server's `pfnGetGameDir` API function | Mods targetting engine before HL 1.1.1.1, according to MetaMod [documentation](http://metamod.org/engine_notes.html#GetGameDir) | 19 | -------------------------------------------------------------------------------- /Documentation/cross-compiling-for-windows-with-wine.md: -------------------------------------------------------------------------------- 1 | # Cross-compiling for Windows with Wine 2 | 3 | This can be useful to test engine in Wine without using virtual machines or dual-booting to Windows. 4 | 5 | 0. Clone and install https://github.com/mstorsjo/msvc-wine (you can skip CMake part) 6 | 1. Set environment variable MSVC_WINE_PATH to the path to installed MSVC toolchain 7 | 2. Pre-load wine: `wineserver -k; wineserver -p; wine64 wineboot` 8 | 3. Run `PKGCONFIG=/bin/false ./waf configure -T --enable-wine-msvc --sdl2=../SDL2_VC`. Configuration step will take more time than usual. 9 | 4. .. other typical steps to build from console ... 10 | 11 | > [!NOTE] 12 | > Notice the usage of PKGCONFIG=/bin/false here. We're disabling pkg-config so we don't accidentally pull 13 | > system-wide dependencies and force building them from source. In future builds we might set custom 14 | > directory to pull dependencies from, like ffmpeg... 15 | -------------------------------------------------------------------------------- /Documentation/debugging-using-minidumps.md: -------------------------------------------------------------------------------- 1 | # Debugging your mod using minidump files (Windows only) 2 | Minidump files is awesome instrument for debugging your mod after it's being released, or for catch specific crashes which are presented only in one specific configuration, but doesn't happens in other configurations or even on developer machine. It contains a lot of information useful for debugging, and therefore it size is not so small: around hundreds or even thousands of megabytes. But this is not a problem, since minidump files compresses very effectively using common algorithms. 3 | There are short algorithm, explaining how to use this debugging instrument: 4 | 5 | 1. User starts your mod with `-minidumps` startup parameter 6 | 2. Finally, crash happened on user's machine, and minidump file being written. This file has `.mdmp` extension and located in same folder, where mod folder located 7 | 3. User packs this minidump file to .zip/.7z archive, and somehow sends it to developer 8 | 4. Developer just opens minidump file in Visual Studio, then a virtual debugging session is opened and now reasons of crash is pretty easy to detect: you can see call stack, local function variables and global variables, information about exception and a lot of other information 9 | 10 | You can find more information about minidumps in this [awesome article](https://learn.microsoft.com/en-us/windows/win32/dxtecharts/crash-dump-analysis?source=recommendations#writing-a-minidump). 11 | -------------------------------------------------------------------------------- /Documentation/donate.md: -------------------------------------------------------------------------------- 1 | # Developers donation page 2 | 3 | On this page you can find links where you can support each developer individually, who has provided public sponsorship information. 4 | 5 | ## [a1batross](https://github.com/a1batross) 6 | 7 | Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization. 8 | 9 | * [Boosty page](https://boosty.to/a1ba) 10 | 11 | ## [nekonomicon](https://github.com/nekonomicon) 12 | 13 | [hlsdk-portable](https://github.com/FWGS/hlsdk-portable), [mdldec](../utils/mdldec), [opensource-mods.md](opensource-mods.md) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=nekonomicon) (*BSD/clang port, PNG support, etc). 14 | 15 | * [Boosty page](https://boosty.to/nekonomicon) 16 | 17 | ## [Velaron](https://github.com/Velaron) 18 | 19 | [cs16-client](https://github.com/Velaron/cs16-client) & [tf15-client](https://github.com/Velaron/tf15-client) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=Velaron) (Android port, voice chat, etc). 20 | 21 | * [BuyMeACoffee page](https://www.buymeacoffee.com/velaron) 22 | 23 | ## [SNMetamorph](https://github.com/SNMetamorph) 24 | 25 | [PrimeXT](https://github.com/SNMetamorph/PrimeXT) & [GoldSrc Monitor](https://github.com/SNMetamorph/goldsrc-monitor) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=SNMetamorph) (Windows port, voice chat, etc). 26 | 27 | * [Boosty page](https://boosty.to/snmetamorph) 28 | * [Other donation methods](https://snmetamorph.github.io/donate) 29 | -------------------------------------------------------------------------------- /Documentation/environment-variables.md: -------------------------------------------------------------------------------- 1 | ## Environment variables 2 | 3 | #### Xash3D FWGS 4 | 5 | The engine respects these environment variables: 6 | 7 | | Variable | Type | Description | 8 | | --------------------- | ---------- | ----------- | 9 | | `XASH3D_GAME` | _string_ | Overrides default game directory. Ignored if `-game` command line argument is set | 10 | | `XASH3D_BASEDIR` | _string_ | Sets path to base (root) directory, instead of current working directory | 11 | | `XASH3D_RODIR` | _string_ | Sets path to read-only base (root) directory. Ignored if `-rodir` command line argument is set | 12 | | `XASH3D_EXTRAS_PAK1` | _string_ | Archive file from specified path will be added to virtual filesystem search path in the lowest possible priority | 13 | | `XASH3D_EXTRAS_PAK2` | _string_ | Similar to `XASH3D_EXTRAS_PAK1` but next to it in priority list | 14 | 15 | Environment variables NOT listed in the table above are used internally, and aren't considered as stable interface. 16 | 17 | #### mdldec 18 | 19 | | Variable | Type | Description | 20 | | --------------------- | ---------- | ----------- | 21 | | `MDLDEC_ACT_PATH` | _string_ | If set, will read activities list from this path | 22 | -------------------------------------------------------------------------------- /Documentation/extensions/expanded-common-structures.md: -------------------------------------------------------------------------------- 1 | # Expanded structures that used by engine and mods 2 | To make porting and developing mods on 64-bit platforms less painful, we decided to expand size of several structures. 3 | This information important in case you are using codebase like XashXT, Paranoia 2: Savior and want to compile your mod for platform with 64-bit pointer size: you should replace old definitions with new ones, otherwise your mod will not work with Xash3D FWGS (typically, it's just crashing when starting map). 4 | | Structure name | Locates in file | Original size on 64-bit | Current size on 64-bit | 5 | |----------------|-----------------|-------------------------|------------------------| 6 | |`mfaceinfo_t` | `common/com_model.h` | 176 bytes | 304 bytes | 7 | |`decal_s` | `common/com_model.h` | 72 bytes | 88 bytes | 8 | |`mextrasurf_t` | `common/com_model.h` | 376 bytes | 504 bytes | 9 | -------------------------------------------------------------------------------- /Documentation/extensions/input-interface.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | 3 | Clients have different platform-depended input code now. 4 | It is bad because we cannot use same functions (if we won't rewrite almost half of SDL) on different platforms. 5 | 6 | ## Client part 7 | 8 | * Client will have ability to fully implement touch input. Drawing may be done by HUD. 9 | * Client will receive basic motion and look events from engine 10 | 11 | ### Client implementation 12 | 13 | #### Client will optionally export some functions to Engine: 14 | * `int IN_ClientTouchEvent ( int fingerID, float x, float y, float dx, float dy );` 15 | 16 | Return 1 if touch is active, 0 otherwise. 17 | 18 | * `void IN_ClientMoveEvent ( float forwardmove, float sidemove );` 19 | 20 | Client wil accumulate move values before creating commands and flush it on CreateMove. 21 | 22 | * `void IN_ClientLookEvent ( float relyaw, float relpitch );` 23 | 24 | Client will rotate camera when needed as in mouse implementation 25 | 26 | ## Engine part 27 | 28 | * Engine will handle platform events and call client functions. 29 | * Engine will implement fallback look and movement system when client interface not present 30 | 31 | ### Engine implementation 32 | 33 | #### Touch events 34 | 35 | Before calling ClientMove engine must get touch events. 36 | 37 | If client exported IN_ClientTouchEvent, event will be sent to client. 38 | 39 | Otherwise engine will draw own touch interface. 40 | 41 | #### Other events 42 | 43 | Engine touch interface and joystick support code will generate two types of events: 44 | * Move events (IN_ClientMoveEvent function) 45 | * Look events (IN_ClientLookEvent function) 46 | 47 | If client exported these functions, events will be sent to client before CreateMove 48 | Otherwise Look Event will be processed before CreateMove, but MoveEvent after. It will be applied to generated command 49 | -------------------------------------------------------------------------------- /Documentation/extensions/mp3-loops.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/extensions/mp3-loops.md -------------------------------------------------------------------------------- /Documentation/extensions/native-object.md: -------------------------------------------------------------------------------- 1 | # GetNativeObject API 2 | 3 | To be able to use platform-specific features or get optional engine interfaces, we've added a simple call to MobilityAPI on client DLL and PhysicsAPI for server DLL and extended MenuAPI for menu DLL. 4 | 5 | It's defined like this: 6 | 7 | ``` 8 | void *pfnGetNativeObject( const char *name ); 9 | ``` 10 | 11 | #### Cross-platform objects 12 | 13 | Only these objects are guaranteed to be available on all targets. 14 | 15 | | Object name | Interface | 16 | |-------------|-----------| 17 | | `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. | 18 | | `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use, outside of engine internals. For more info about current version look into `filesystem.h`. | 19 | 20 | #### Android-specific objects 21 | 22 | | Object name | Interface | 23 | |-------------|-----------| 24 | | `JNIEnv` | Allows interfacing with Java Native Interface. | 25 | | `ActivityClass` | Returns JNI object for engine Android activity class. | 26 | -------------------------------------------------------------------------------- /Documentation/goldsrc-protocol-support.md: -------------------------------------------------------------------------------- 1 | # Support for GoldSrc network protocol 2 | This feature is still work-in-progress, but for now it's available for all users, and we appreciate any bug-reports and contributions around it. 3 | 4 | For connecting to GoldSrc-based servers, use this command: 5 | ``` 6 | connect ip:port gs 7 | ``` 8 | 9 | But keep in mind, there are requirement for server to be able to accept connections from Xash3D-based clients: it should use Reunion. 10 | Without this requirement, you will just get "Steam validation rejected" error on connecting. 11 | 12 | That is because proper authorization with Steam API is not implemented in engine yet (but we have plans on it). 13 | 14 | Also, we encountered that some GoldSrc-based servers are recognizing Xash3D clients as "fake clients" and banning/kicking them. Maybe this problem will be 15 | solved along with better compatibility with GoldSrc behavior, but may be not - we don't know logic behind this fake client checks. 16 | -------------------------------------------------------------------------------- /Documentation/images/editor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/editor.jpg -------------------------------------------------------------------------------- /Documentation/images/example1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/example1.jpg -------------------------------------------------------------------------------- /Documentation/images/example2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/example2.jpg -------------------------------------------------------------------------------- /Documentation/images/example3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/example3.jpg -------------------------------------------------------------------------------- /Documentation/images/example4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/example4.jpg -------------------------------------------------------------------------------- /Documentation/images/example5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/example5.jpg -------------------------------------------------------------------------------- /Documentation/images/touch-buttons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/touch-buttons.jpg -------------------------------------------------------------------------------- /Documentation/images/touch-profiles.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/Documentation/images/touch-profiles.jpg -------------------------------------------------------------------------------- /Documentation/musl.md: -------------------------------------------------------------------------------- 1 | # Xash3D FWGS on `musl` 2 | 3 | Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to: 4 | 5 | ``` 6 | Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found 7 | ``` 8 | 9 | ... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this: 10 | 11 | ``` 12 | $ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ... 13 | ``` 14 | 15 | It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this. 16 | -------------------------------------------------------------------------------- /Documentation/public-servers-rules-and-recommendations.md: -------------------------------------------------------------------------------- 1 | As online community is growing, we don't want to keep bad or invalid servers on the Internet Games list. It's a common rules for all Xash3D server owners who are using default master server. 2 | 3 | 1. Breaking master server or clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub. 4 | 5 | 2. Changing settings, exploiting vulnerabilities of clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub. 6 | 7 | 2. Agressive advertisement and spam on other servers is prohibited in any way. 8 | 9 | 3. If your server is require downloading custom content, it should be available for everyone. Recommended way to deliver custom content is FastDL. 10 | 11 | 4. It's recommended to keep your server is up-to-date. You may use our public Debian/Ubuntu/Arch Linux [repository](https://github.com/FWGS/xash3d/wiki/How-to-set-up-a-Xash3D-Dedicated-Server-on-Debian-or-Ubuntu) to simplify updating process. 12 | 13 | Just follow these rules to not get banned on our master server. Good luck, have fun! 14 | 15 | 16 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | .externalNativeBuild 4 | .cxx/ 5 | .idea/ 6 | local.properties 7 | .project 8 | .classpath 9 | .gradle 10 | .settings 11 | release/ 12 | *.hprof 13 | .vscode/ 14 | *.bak -------------------------------------------------------------------------------- /android/app/src/asan/jniLibs/arm64-v8a/libclang_rt.asan-aarch64-android.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/asan/jniLibs/arm64-v8a/libclang_rt.asan-aarch64-android.so -------------------------------------------------------------------------------- /android/app/src/asan/jniLibs/armeabi-v7a/libclang_rt.asan-arm-android.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/asan/jniLibs/armeabi-v7a/libclang_rt.asan-arm-android.so -------------------------------------------------------------------------------- /android/app/src/asan/jniLibs/x86/libclang_rt.asan-i686-android.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/asan/jniLibs/x86/libclang_rt.asan-i686-android.so -------------------------------------------------------------------------------- /android/app/src/asan/jniLibs/x86_64/libclang_rt.asan-x86_64-android.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/asan/jniLibs/x86_64/libclang_rt.asan-x86_64-android.so -------------------------------------------------------------------------------- /android/app/src/asan/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Xash3D FWGS (Test) 4 | su.xash.engine.test.documents 5 | -------------------------------------------------------------------------------- /android/app/src/asan/resources/lib/arm64-v8a/wrap.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/system/bin/sh 3 | HERE=$(cd "$(dirname "$0")" && pwd) 4 | cmd=$1 5 | shift 6 | # This must be called *before* `LD_PRELOAD` is set. Otherwise, if this is a 32- 7 | # bit app running on a 64-bit device, the 64-bit getprop will fail to load 8 | # because it will preload a 32-bit ASan runtime. 9 | # https://github.com/android/ndk/issues/1744 10 | os_version=$(getprop ro.build.version.sdk) 11 | if [ "$os_version" -eq "27" ]; then 12 | cmd="$cmd -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable $@" 13 | elif [ "$os_version" -eq "28" ]; then 14 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable $@" 15 | else 16 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y $@" 17 | fi 18 | export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1 19 | ASAN_LIB=$(ls "$HERE"/libclang_rt.asan-*-android.so) 20 | if [ -f "$HERE/libc++_shared.so" ]; then 21 | # Workaround for https://github.com/android-ndk/ndk/issues/988. 22 | export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so" 23 | else 24 | export LD_PRELOAD="$ASAN_LIB" 25 | fi 26 | exec $cmd -------------------------------------------------------------------------------- /android/app/src/asan/resources/lib/armeabi-v7a/wrap.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/system/bin/sh 3 | HERE=$(cd "$(dirname "$0")" && pwd) 4 | cmd=$1 5 | shift 6 | # This must be called *before* `LD_PRELOAD` is set. Otherwise, if this is a 32- 7 | # bit app running on a 64-bit device, the 64-bit getprop will fail to load 8 | # because it will preload a 32-bit ASan runtime. 9 | # https://github.com/android/ndk/issues/1744 10 | os_version=$(getprop ro.build.version.sdk) 11 | if [ "$os_version" -eq "27" ]; then 12 | cmd="$cmd -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable $@" 13 | elif [ "$os_version" -eq "28" ]; then 14 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable $@" 15 | else 16 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y $@" 17 | fi 18 | export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1 19 | ASAN_LIB=$(ls "$HERE"/libclang_rt.asan-*-android.so) 20 | if [ -f "$HERE/libc++_shared.so" ]; then 21 | # Workaround for https://github.com/android-ndk/ndk/issues/988. 22 | export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so" 23 | else 24 | export LD_PRELOAD="$ASAN_LIB" 25 | fi 26 | exec $cmd -------------------------------------------------------------------------------- /android/app/src/asan/resources/lib/x86/wrap.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/system/bin/sh 3 | HERE=$(cd "$(dirname "$0")" && pwd) 4 | cmd=$1 5 | shift 6 | # This must be called *before* `LD_PRELOAD` is set. Otherwise, if this is a 32- 7 | # bit app running on a 64-bit device, the 64-bit getprop will fail to load 8 | # because it will preload a 32-bit ASan runtime. 9 | # https://github.com/android/ndk/issues/1744 10 | os_version=$(getprop ro.build.version.sdk) 11 | if [ "$os_version" -eq "27" ]; then 12 | cmd="$cmd -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable $@" 13 | elif [ "$os_version" -eq "28" ]; then 14 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable $@" 15 | else 16 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y $@" 17 | fi 18 | export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1 19 | ASAN_LIB=$(ls "$HERE"/libclang_rt.asan-*-android.so) 20 | if [ -f "$HERE/libc++_shared.so" ]; then 21 | # Workaround for https://github.com/android-ndk/ndk/issues/988. 22 | export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so" 23 | else 24 | export LD_PRELOAD="$ASAN_LIB" 25 | fi 26 | exec $cmd -------------------------------------------------------------------------------- /android/app/src/asan/resources/lib/x86_64/wrap.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/system/bin/sh 3 | HERE=$(cd "$(dirname "$0")" && pwd) 4 | cmd=$1 5 | shift 6 | # This must be called *before* `LD_PRELOAD` is set. Otherwise, if this is a 32- 7 | # bit app running on a 64-bit device, the 64-bit getprop will fail to load 8 | # because it will preload a 32-bit ASan runtime. 9 | # https://github.com/android/ndk/issues/1744 10 | os_version=$(getprop ro.build.version.sdk) 11 | if [ "$os_version" -eq "27" ]; then 12 | cmd="$cmd -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable $@" 13 | elif [ "$os_version" -eq "28" ]; then 14 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y -Xcompiler-option --debuggable $@" 15 | else 16 | cmd="$cmd -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y $@" 17 | fi 18 | export ASAN_OPTIONS=log_to_syslog=false,allow_user_segv_handler=1 19 | ASAN_LIB=$(ls "$HERE"/libclang_rt.asan-*-android.so) 20 | if [ -f "$HERE/libc++_shared.so" ]; then 21 | # Workaround for https://github.com/android-ndk/ndk/issues/988. 22 | export LD_PRELOAD="$ASAN_LIB $HERE/libc++_shared.so" 23 | else 24 | export LD_PRELOAD="$ASAN_LIB" 25 | fi 26 | exec $cmd -------------------------------------------------------------------------------- /android/app/src/continuous/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Xash3D FWGS (Test) 4 | su.xash.engine.test.documents 5 | -------------------------------------------------------------------------------- /android/app/src/debug/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Xash3D FWGS (Test) 4 | su.xash.engine.test.documents 5 | -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/DedicatedActivity.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine 2 | 3 | class DedicatedActivity { 4 | } -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/DedicatedService.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine 2 | 3 | import android.app.Service 4 | import android.content.Intent 5 | import android.os.IBinder 6 | 7 | class DedicatedService: Service() { 8 | override fun onBind(intent: Intent?): IBinder? { 9 | TODO("Not yet implemented") 10 | } 11 | } -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.navigation.NavController 6 | import androidx.navigation.fragment.NavHostFragment 7 | import androidx.navigation.ui.AppBarConfiguration 8 | import androidx.navigation.ui.navigateUp 9 | import androidx.navigation.ui.setupActionBarWithNavController 10 | import su.xash.engine.databinding.ActivityMainBinding 11 | 12 | class MainActivity : AppCompatActivity() { 13 | private lateinit var binding: ActivityMainBinding 14 | private lateinit var appBarConfiguration: AppBarConfiguration 15 | private lateinit var navController: NavController 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | 20 | binding = ActivityMainBinding.inflate(layoutInflater) 21 | setContentView(binding.root) 22 | 23 | setSupportActionBar(binding.toolbar) 24 | 25 | val navHostFragment = 26 | supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment 27 | navController = navHostFragment.navController 28 | appBarConfiguration = AppBarConfiguration(navController.graph) 29 | setupActionBarWithNavController(navController, appBarConfiguration) 30 | } 31 | 32 | override fun onSupportNavigateUp(): Boolean { 33 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import android.os.StrictMode 6 | import org.acra.config.httpSender 7 | import org.acra.data.StringFormat 8 | import org.acra.ktx.initAcra 9 | 10 | class MainApplication : Application() { 11 | override fun attachBaseContext(base: Context?) { 12 | super.attachBaseContext(base) 13 | 14 | if (!BuildConfig.DEBUG) { 15 | initAcra { 16 | buildConfigClass = BuildConfig::class.java 17 | reportFormat = StringFormat.JSON 18 | 19 | httpSender { 20 | uri = "http://bodis.pp.ua:5000/report" 21 | } 22 | } 23 | } else { 24 | // enable strict mode to detect memory leaks etc. 25 | StrictMode.enableDefaults(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/model/ModDatabase.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine.model 2 | 3 | import org.json.JSONArray 4 | import org.json.JSONObject 5 | import java.io.InputStream 6 | 7 | class ModDatabase(inputStream: InputStream) { 8 | val entries = mutableListOf() 9 | 10 | companion object { 11 | const val VERSION = 1 12 | 13 | fun getFilename(): String { 14 | return "v${VERSION}.json" 15 | } 16 | } 17 | 18 | init { 19 | inputStream.bufferedReader().use { 20 | val jsonArray = JSONArray(it.readText()) 21 | 22 | for (i in 0..("package_name")!! 16 | packageList.entries = arrayOf(getString(R.string.app_name)) 17 | packageList.entryValues = arrayOf(requireContext().packageName) 18 | 19 | if (packageList.value == null) { 20 | packageList.setValueIndex(0); 21 | } 22 | 23 | val separatePackages = findPreference("separate_libraries")!! 24 | val clientPackage = findPreference("client_package")!! 25 | val serverPackage = findPreference("server_package")!! 26 | separatePackages.setOnPreferenceChangeListener { _, newValue -> 27 | if (newValue == true) { 28 | packageList.isVisible = false 29 | clientPackage.isVisible = true 30 | serverPackage.isVisible = true 31 | } else { 32 | packageList.isVisible = true 33 | clientPackage.isVisible = false 34 | serverPackage.isVisible = false 35 | } 36 | 37 | true 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/ui/setup/SetupFragment.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine.ui.setup 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import androidx.fragment.app.activityViewModels 9 | import androidx.viewpager2.adapter.FragmentStateAdapter 10 | import su.xash.engine.databinding.FragmentSetupBinding 11 | import su.xash.engine.ui.setup.pages.LocationPageFragment 12 | import su.xash.engine.ui.setup.pages.WelcomePageFragment 13 | 14 | class SetupFragment : Fragment() { 15 | private var _binding: FragmentSetupBinding? = null 16 | private val binding get() = _binding!! 17 | private val setupViewModel: SetupViewModel by activityViewModels() 18 | 19 | private lateinit var setupPageAdapter: SetupPageAdapter 20 | 21 | override fun onCreateView( 22 | inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? 23 | ): View? { 24 | _binding = FragmentSetupBinding.inflate(inflater, container, false) 25 | return binding.root 26 | } 27 | 28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 29 | setupPageAdapter = SetupPageAdapter(this) 30 | binding.viewPager.isUserInputEnabled = false 31 | binding.viewPager.adapter = setupPageAdapter 32 | 33 | setupViewModel.pageNumber.observe(viewLifecycleOwner) { 34 | binding.viewPager.setCurrentItem(it, true) 35 | } 36 | } 37 | 38 | override fun onDestroyView() { 39 | super.onDestroyView() 40 | _binding = null 41 | } 42 | } 43 | 44 | class SetupPageAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) { 45 | val pages = listOf(WelcomePageFragment(), LocationPageFragment()) 46 | override fun getItemCount(): Int = 2 47 | override fun createFragment(position: Int): Fragment = pages[position] 48 | } 49 | -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/ui/setup/SetupViewModel.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine.ui.setup 2 | 3 | import android.app.Application 4 | import android.net.Uri 5 | import androidx.documentfile.provider.DocumentFile 6 | import androidx.lifecycle.AndroidViewModel 7 | import androidx.lifecycle.LiveData 8 | import androidx.lifecycle.MutableLiveData 9 | import su.xash.engine.MainApplication 10 | import su.xash.engine.model.Game 11 | 12 | class SetupViewModel(application: Application) : AndroidViewModel(application) { 13 | val pageNumber: LiveData get() = _pageNumber 14 | private val _pageNumber = MutableLiveData(0) 15 | 16 | fun checkIfGameDir(uri: Uri): Boolean { 17 | val ctx = getApplication().applicationContext 18 | val file = DocumentFile.fromTreeUri(ctx, uri)!! 19 | return Game.checkIfGamedir(file) 20 | } 21 | 22 | fun setPageNumber(pos: Int) { 23 | _pageNumber.value = pos 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/app/src/main/java/su/xash/engine/ui/setup/pages/WelcomePageFragment.kt: -------------------------------------------------------------------------------- 1 | package su.xash.engine.ui.setup.pages 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import androidx.fragment.app.activityViewModels 9 | import su.xash.engine.databinding.PageWelcomeBinding 10 | import su.xash.engine.ui.setup.SetupViewModel 11 | 12 | class WelcomePageFragment : Fragment() { 13 | private var _binding: PageWelcomeBinding? = null 14 | private val binding get() = _binding!! 15 | private val setupViewModel: SetupViewModel by activityViewModels() 16 | 17 | override fun onCreateView( 18 | inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? 19 | ): View? { 20 | _binding = PageWelcomeBinding.inflate(inflater, container, false) 21 | return binding.root 22 | } 23 | 24 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 25 | binding.pageButton.setOnClickListener { 26 | setupViewModel.setPageNumber(1) 27 | } 28 | setupViewModel.setPageNumber(0) 29 | } 30 | 31 | override fun onDestroyView() { 32 | super.onDestroyView() 33 | _binding = null 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_add_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_delete_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_folder_open_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_key_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_person_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_play_arrow_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_settings_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_baseline_terminal_24.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/steam_button_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/steam_icon.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 20 | 21 | 22 | 23 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/edit_text_preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/fragment_app_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/fragment_game_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 23 | 24 | 29 | 30 | 31 | 32 | 39 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/fragment_library.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/fragment_setup.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/list_preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/steam_guard_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 26 | 27 | 32 | 33 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/switch_preference.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 23 | -------------------------------------------------------------------------------- /android/app/src/main/res/menu/menu_game_settings.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/menu/menu_library.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 13 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_monochrome.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/navigation/nav_graph.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 15 | 18 | 21 | 22 | 26 | 29 | 30 | 34 | 38 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ok 4 | Cancelar 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Annulla 4 | Ok 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-tr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tamam 4 | İptal 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-uk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ок 4 | Скасувати 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F74843 4 | #C5C3C0 5 | #181A21 6 | #32353C 7 | #FB7E14 8 | #000000 9 | #151515 10 | #292929 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F74843 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/app_preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/game_preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | 11 | 15 | 16 | 21 | 22 | 28 | 29 | 35 | 36 | 42 | 43 | -------------------------------------------------------------------------------- /android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id("com.android.application") version "8.5.0" apply false 4 | id("org.jetbrains.kotlin.android") version "1.9.0" apply false 5 | } -------------------------------------------------------------------------------- /android/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/debug.keystore -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official 20 | # Enables namespacing of each library's R class so that its R class includes only the 21 | # resources declared in the library itself and none from the library's dependencies, 22 | # thereby reducing the size of the R class for that library 23 | android.nonTransitiveRClass=true 24 | 25 | # Enable verbose output for CMake 26 | android.native.buildOutput=verbose 27 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 22 13:23:17 EEST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | gradlePluginPortal() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | 16 | rootProject.name = "Xash3D FWGS" 17 | include(":app") 18 | -------------------------------------------------------------------------------- /common/backends.h: -------------------------------------------------------------------------------- 1 | /* 2 | backends.h - backend macro definitions 3 | Copyright (C) 2016 Mittorn 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifndef BACKENDS_H 16 | #define BACKENDS_H 17 | 18 | // video backends (XASH_VIDEO) 19 | #define VIDEO_NULL 0 20 | #define VIDEO_SDL 1 21 | #define VIDEO_FBDEV 3 22 | #define VIDEO_DOS 4 23 | 24 | // audio backends (XASH_SOUND) 25 | #define SOUND_NULL 0 26 | #define SOUND_SDL 1 27 | #define SOUND_ALSA 3 28 | 29 | // input (XASH_INPUT) 30 | #define INPUT_NULL 0 31 | #define INPUT_SDL 1 32 | #define INPUT_EVDEV 3 33 | 34 | // timer (XASH_TIMER) 35 | #define TIMER_NULL 0 // not used 36 | #define TIMER_SDL 1 37 | #define TIMER_POSIX 2 38 | #define TIMER_WIN32 3 39 | #define TIMER_DOS 4 40 | 41 | // messageboxes (XASH_MESSAGEBOX) 42 | #define MSGBOX_STDERR 0 43 | #define MSGBOX_SDL 1 44 | #define MSGBOX_WIN32 3 45 | #define MSGBOX_NSWITCH 4 46 | 47 | // library loading (XASH_LIB) 48 | #define LIB_NULL 0 49 | #define LIB_POSIX 1 50 | #define LIB_WIN32 2 51 | #define LIB_STATIC 3 52 | 53 | #endif /* BACKENDS_H */ 54 | -------------------------------------------------------------------------------- /common/beamdef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef BEAMDEF_H 17 | #define BEAMDEF_H 18 | 19 | #define FBEAM_STARTENTITY 0x00000001 20 | #define FBEAM_ENDENTITY 0x00000002 21 | #define FBEAM_FADEIN 0x00000004 22 | #define FBEAM_FADEOUT 0x00000008 23 | #define FBEAM_SINENOISE 0x00000010 24 | #define FBEAM_SOLID 0x00000020 25 | #define FBEAM_SHADEIN 0x00000040 26 | #define FBEAM_SHADEOUT 0x00000080 27 | #define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? 28 | #define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? 29 | #define FBEAM_ISACTIVE 0x40000000 30 | #define FBEAM_FOREVER 0x80000000 31 | 32 | typedef struct beam_s BEAM; 33 | struct beam_s 34 | { 35 | BEAM *next; 36 | int type; 37 | int flags; 38 | vec3_t source; 39 | vec3_t target; 40 | vec3_t delta; 41 | float t; // 0 .. 1 over lifetime of beam 42 | float freq; 43 | float die; 44 | float width; 45 | float amplitude; 46 | float r, g, b; 47 | float brightness; 48 | float speed; 49 | float frameRate; 50 | float frame; 51 | int segments; 52 | int startEntity; 53 | int endEntity; 54 | int modelIndex; 55 | int frameCount; 56 | struct model_s *pFollowModel; 57 | struct particle_s *particles; 58 | }; 59 | 60 | #endif//BEAMDEF_H 61 | -------------------------------------------------------------------------------- /common/con_nprint.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CON_NPRINT_H 16 | #define CON_NPRINT_H 17 | 18 | typedef struct con_nprint_s 19 | { 20 | int index; // Row # 21 | float time_to_live; // # of seconds before it dissappears 22 | float color[3]; // RGB colors ( 0.0 -> 1.0 scale ) 23 | } con_nprint_t; 24 | 25 | #endif//CON_NPRINT_H 26 | -------------------------------------------------------------------------------- /common/demo_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef DEMO_API_H 17 | #define DEMO_API_H 18 | 19 | typedef struct demo_api_s 20 | { 21 | int (*IsRecording)( void ); 22 | int (*IsPlayingback)( void ); 23 | int (*IsTimeDemo)( void ); 24 | void (*WriteBuffer)( int size, unsigned char *buffer ); 25 | } demo_api_t; 26 | 27 | #endif//DEMO_API_H 28 | -------------------------------------------------------------------------------- /common/dlight.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef DLIGHT_H 17 | #define DLIGHT_H 18 | 19 | typedef struct dlight_s 20 | { 21 | vec3_t origin; 22 | float radius; 23 | color24 color; 24 | float die; // stop lighting after this time 25 | float decay; // drop this each second 26 | float minlight; // don't add when contributing less 27 | int key; 28 | qboolean dark; // subtracts light instead of adding 29 | } dlight_t; 30 | 31 | #endif//DLIGHT_H 32 | -------------------------------------------------------------------------------- /common/entity_types.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef ENTITY_TYPES_H 17 | #define ENTITY_TYPES_H 18 | 19 | #define ET_NORMAL 0 20 | #define ET_PLAYER 1 21 | #define ET_TEMPENTITY 2 22 | #define ET_BEAM 3 23 | #define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes 24 | 25 | #endif//ENTITY_TYPES_H 26 | -------------------------------------------------------------------------------- /common/event_args.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef EVENT_ARGS_H 16 | #define EVENT_ARGS_H 17 | 18 | // Event was invoked with stated origin 19 | #define FEVENT_ORIGIN ( 1<<0 ) 20 | 21 | // Event was invoked with stated angles 22 | #define FEVENT_ANGLES ( 1<<1 ) 23 | 24 | typedef struct event_args_s 25 | { 26 | int flags; 27 | 28 | // Transmitted 29 | int entindex; 30 | 31 | float origin[3]; 32 | float angles[3]; 33 | float velocity[3]; 34 | 35 | int ducking; 36 | 37 | float fparam1; 38 | float fparam2; 39 | 40 | int iparam1; 41 | int iparam2; 42 | 43 | int bparam1; 44 | int bparam2; 45 | } event_args_t; 46 | 47 | #endif//EVENT_ARGS_H 48 | -------------------------------------------------------------------------------- /common/event_flags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef EVENT_FLAGS_H 17 | #define EVENT_FLAGS_H 18 | 19 | // Skip local host for event send. 20 | #define FEV_NOTHOST (1<<0) 21 | 22 | // Send the event reliably. You must specify the origin and angles and use 23 | // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything 24 | // that depends on the event origin/angles. I.e., the origin/angles are not 25 | // taken from the invoking edict for reliable events. 26 | #define FEV_RELIABLE (1<<1) 27 | 28 | // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC 29 | // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). 30 | #define FEV_GLOBAL (1<<2) 31 | 32 | // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate 33 | // 34 | #define FEV_UPDATE (1<<3) 35 | 36 | // Only send to entity specified as the invoker 37 | #define FEV_HOSTONLY (1<<4) 38 | 39 | // Only send if the event was created on the server. 40 | #define FEV_SERVER (1<<5) 41 | 42 | // Only issue event client side ( from shared code ) 43 | #define FEV_CLIENT (1<<6) 44 | 45 | #endif//EVENT_FLAGS_H 46 | -------------------------------------------------------------------------------- /common/ivoicetweak.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef IVOICETWEAK_H 17 | #define IVOICETWEAK_H 18 | 19 | // These provide access to the voice controls. 20 | typedef enum 21 | { 22 | MicrophoneVolume = 0, // values 0-1. 23 | OtherSpeakerScale // values 0-1. Scales how loud other players are. 24 | } VoiceTweakControl; 25 | 26 | typedef struct IVoiceTweak_s 27 | { 28 | // These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back 29 | // without sending to the server. 30 | int (*StartVoiceTweakMode)( void ); // Returns 0 on error. 31 | void (*EndVoiceTweakMode)( void ); 32 | 33 | // Get/set control values. 34 | void (*SetControlFloat)( VoiceTweakControl iControl, float value ); 35 | float (*GetControlFloat)( VoiceTweakControl iControl ); 36 | } IVoiceTweak; 37 | 38 | #endif//IVOICETWEAK_H 39 | -------------------------------------------------------------------------------- /common/kbutton.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1996-1997 Id Software, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | */ 20 | #ifndef KBUTTON_H 21 | #define KBUTTON_H 22 | 23 | // a1ba: copied from WinQuake/client.h 24 | // 25 | // cl_input 26 | // 27 | typedef struct 28 | { 29 | int down[2]; // key nums holding it down 30 | int state; // low bit is down state 31 | } kbutton_t; 32 | 33 | STATIC_CHECK_SIZEOF( kbutton_t, 12, 12 ); 34 | 35 | #endif // KBUTTON_H 36 | -------------------------------------------------------------------------------- /common/lightstyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | lightstyle.h - lighstyle description 3 | Copyright (C) 2011 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef LIGHTSTYLE_H 17 | #define LIGHTSTYLE_H 18 | 19 | typedef struct 20 | { 21 | char pattern[256]; 22 | float map[256]; 23 | int length; 24 | float value; 25 | qboolean interp; // allow to interpolate this lightstyle 26 | float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence 27 | } lightstyle_t; 28 | 29 | #endif//LIGHTSTYLE_H 30 | -------------------------------------------------------------------------------- /common/particledef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef PARTICLEDEF_H 17 | #define PARTICLEDEF_H 18 | 19 | typedef enum 20 | { 21 | pt_static, 22 | pt_grav, 23 | pt_slowgrav, 24 | pt_fire, 25 | pt_explode, 26 | pt_explode2, 27 | pt_blob, 28 | pt_blob2, 29 | pt_vox_slowgrav, 30 | pt_vox_grav, 31 | pt_clientcustom // Must have callback function specified 32 | } ptype_t; 33 | 34 | typedef struct particle_s 35 | { 36 | vec3_t org; 37 | short color; 38 | short packedColor; 39 | struct particle_s *next; 40 | vec3_t vel; 41 | float ramp; 42 | float die; 43 | ptype_t type; 44 | void (*deathfunc)( struct particle_s *particle ); 45 | 46 | // for pt_clientcusttom, we'll call this function each frame 47 | void (*callback)( struct particle_s *particle, float frametime ); 48 | 49 | // For deathfunc, etc. 50 | unsigned char context; 51 | } particle_t; 52 | 53 | #endif//PARTICLEDEF_H 54 | -------------------------------------------------------------------------------- /common/pmtrace.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef PM_TRACE_H 17 | #define PM_TRACE_H 18 | 19 | typedef struct 20 | { 21 | vec3_t normal; 22 | float dist; 23 | } pmplane_t; 24 | 25 | typedef struct pmtrace_s pmtrace_t; 26 | 27 | struct pmtrace_s 28 | { 29 | qboolean allsolid; // if true, plane is not valid 30 | qboolean startsolid; // if true, the initial point was in a solid area 31 | qboolean inopen, inwater; // End point is in empty space or in water 32 | float fraction; // time completed, 1.0 = didn't hit anything 33 | vec3_t endpos; // final position 34 | pmplane_t plane; // surface normal at impact 35 | int ent; // entity at impact 36 | vec3_t deltavelocity; // Change in player's velocity caused by impact. 37 | // Only run on server. 38 | int hitgroup; 39 | }; 40 | 41 | #endif//PM_TRACE_H 42 | -------------------------------------------------------------------------------- /common/qfont.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef QFONT_H 17 | #define QFONT_H 18 | 19 | // Font stuff 20 | 21 | #define NUM_GLYPHS 256 22 | 23 | typedef struct 24 | { 25 | short startoffset; 26 | short charwidth; 27 | } charinfo; 28 | 29 | typedef struct qfont_s 30 | { 31 | int width, height; 32 | int rowcount; 33 | int rowheight; 34 | charinfo fontinfo[NUM_GLYPHS]; 35 | byte data[4]; 36 | } qfont_t; 37 | 38 | #endif//QFONT_H 39 | -------------------------------------------------------------------------------- /common/screenfade.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef SCREENFADE_H 17 | #define SCREENFADE_H 18 | 19 | typedef struct screenfade_s 20 | { 21 | float fadeSpeed; // How fast to fade (tics / second) (+ fade in, - fade out) 22 | float fadeEnd; // When the fading hits maximum 23 | float fadeTotalEnd; // Total End Time of the fade (used for FFADE_OUT) 24 | float fadeReset; // When to reset to not fading (for fadeout and hold) 25 | byte fader, fadeg, fadeb, fadealpha; // Fade color 26 | int fadeFlags; // Fading flags 27 | } screenfade_t; 28 | 29 | #endif//SCREENFADE_H 30 | -------------------------------------------------------------------------------- /common/studio_event.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #pragma once 16 | #ifndef STUDIO_EVENT_H 17 | #define STUDIO_EVENT_H 18 | 19 | #define MAXEVENTSTRING 64 20 | 21 | typedef struct mstudioevent_s 22 | { 23 | // the frame at which this animation event occurs 24 | int32_t frame; 25 | 26 | // the script event type 27 | int32_t event; 28 | 29 | // was "type" 30 | int32_t unused; 31 | 32 | // options 33 | // could be path to sound WAVE files 34 | char options[MAXEVENTSTRING]; 35 | } mstudioevent_t; 36 | 37 | #endif // STUDIO_EVENT_H 38 | -------------------------------------------------------------------------------- /common/synctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | synctype.h -- shared synctype_t definition 3 | Copyright (C) 1996-1997 Id Software, Inc. 4 | Copyright (C) 2023 Alibek Omarov 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | 15 | See the GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | #ifndef SYNCTYPE_H 22 | #define SYNCTYPE_H 23 | typedef enum {ST_SYNC=0, ST_RAND } synctype_t; 24 | #endif 25 | -------------------------------------------------------------------------------- /common/usercmd.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef USERCMD_H 17 | #define USERCMD_H 18 | 19 | typedef struct usercmd_s 20 | { 21 | short lerp_msec; // Interpolation time on client 22 | byte msec; // Duration in ms of command 23 | vec3_t viewangles; // Command view angles 24 | 25 | // intended velocities 26 | float forwardmove; // Forward velocity 27 | float sidemove; // Sideways velocity 28 | float upmove; // Upward velocity 29 | byte lightlevel; // Light level at spot where we are standing. 30 | unsigned short buttons; // Attack and move buttons 31 | byte impulse; // Impulse command issued 32 | byte weaponselect; // Current weapon id 33 | 34 | // Experimental player impact stuff. 35 | int impact_index; 36 | vec3_t impact_position; 37 | } usercmd_t; 38 | 39 | #endif//USERCMD_H 40 | -------------------------------------------------------------------------------- /common/weaponinfo.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef WEAPONINFO_H 17 | #define WEAPONINFO_H 18 | 19 | // Info about weapons player might have in his/her possession 20 | typedef struct weapon_data_s 21 | { 22 | int m_iId; 23 | int m_iClip; 24 | 25 | float m_flNextPrimaryAttack; 26 | float m_flNextSecondaryAttack; 27 | float m_flTimeWeaponIdle; 28 | 29 | int m_fInReload; 30 | int m_fInSpecialReload; 31 | float m_flNextReload; 32 | float m_flPumpTime; 33 | float m_fReloadTime; 34 | 35 | float m_fAimedDamage; 36 | float m_fNextAimBonus; 37 | int m_fInZoom; 38 | int m_iWeaponState; 39 | 40 | int iuser1; 41 | int iuser2; 42 | int iuser3; 43 | int iuser4; 44 | float fuser1; 45 | float fuser2; 46 | float fuser3; 47 | float fuser4; 48 | } weapon_data_t; 49 | 50 | #endif//WEAPONINFO_H 51 | -------------------------------------------------------------------------------- /common/wrect.h: -------------------------------------------------------------------------------- 1 | /* 2 | wrect.h - rectangle definition 3 | Copyright (C) 2010 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef WRECT_H 17 | #define WRECT_H 18 | 19 | typedef struct wrect_s 20 | { 21 | int left, right, top, bottom; 22 | } wrect_t; 23 | 24 | #endif//WRECT_H 25 | -------------------------------------------------------------------------------- /engine/client/avi/avi.h: -------------------------------------------------------------------------------- 1 | /* 2 | avi.h -- common avi support header 3 | Copyright (C) 2018 a1batross, Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifndef AVI_H 16 | #define AVI_H 17 | 18 | // 19 | // avikit.c 20 | // 21 | typedef struct movie_state_s movie_state_t; 22 | int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ); 23 | byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame ); 24 | qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration ); 25 | qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info ); 26 | int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length ); 27 | void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet ); 28 | movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio ); 29 | int AVI_TimeToSoundPosition( movie_state_t *Avi, int time ); 30 | void AVI_CloseVideo( movie_state_t *Avi ); 31 | qboolean AVI_IsActive( movie_state_t *Avi ); 32 | void AVI_FreeVideo( movie_state_t *Avi ); 33 | movie_state_t *AVI_GetState( int num ); 34 | qboolean AVI_Initailize( void ); 35 | void AVI_Shutdown( void ); 36 | 37 | #endif // AVI_H 38 | -------------------------------------------------------------------------------- /engine/client/soundlib/libmpg/fmt123.h: -------------------------------------------------------------------------------- 1 | /* 2 | fmt123.h - compact version of famous library mpg123 3 | Copyright (C) 2017 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef FMT123_H 17 | #define FMT123_H 18 | 19 | #define MPG123_RATES 9 20 | #define MPG123_ENCODINGS 2 21 | 22 | enum mpg123_enc_enum 23 | { 24 | // 0000 0000 0000 1111 Some 8 bit integer encoding. */ 25 | MPG123_ENC_8 = 0x00f, 26 | // 0000 0000 0100 0000 Some 16 bit integer encoding. 27 | MPG123_ENC_16 = 0x040, 28 | // 0000 0000 1000 0000 Some signed integer encoding. 29 | MPG123_ENC_SIGNED = 0x080, 30 | // 0000 0000 1101 0000 signed 16 bit 31 | MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10), 32 | // 0000 0000 0110 0000 unsigned 16 bit 33 | MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16|0x20), 34 | // 0000 0000 0000 0001 unsigned 8 bit 35 | MPG123_ENC_UNSIGNED_8 = 0x01, 36 | // 0000 0000 1000 0010 signed 8 bit 37 | MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED|0x02), 38 | // 0000 0000 0000 0100 ulaw 8 bit 39 | MPG123_ENC_ULAW_8 = 0x04, 40 | // 0000 0000 0000 1000 alaw 8 bit 41 | MPG123_ENC_ALAW_8 = 0x08, 42 | }; 43 | 44 | #endif//FMT123_H 45 | -------------------------------------------------------------------------------- /engine/client/soundlib/libmpg/sample.h: -------------------------------------------------------------------------------- 1 | /* 2 | sample.h - compact version of famous library mpg123 3 | Copyright (C) 2017 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef SAMPLE_H 17 | #define SAMPLE_H 18 | 19 | // define the accurate rounding function. 20 | #ifdef IEEE_FLOAT 21 | // rhis function is only available for IEEE754 single-precision values 22 | // rhis is nearly identical to proper rounding, just -+0.5 is rounded to 0 23 | static _inline int16_t ftoi16( float x ) 24 | { 25 | union 26 | { 27 | float f; 28 | int32_t i; 29 | } u_fi; 30 | 31 | u_fi.f = x + 12582912.0f; // Magic Number: 2^23 + 2^22 32 | return (int16_t)u_fi.i; 33 | } 34 | 35 | #define REAL_TO_SHORT_ACCURATE( x ) ftoi16(x) 36 | #else 37 | // the "proper" rounding, plain C, a bit slow. 38 | #define REAL_TO_SHORT_ACCURATE( x ) (short)((x) > 0.0f ? (x) + 0.5f : (x) - 0.5f) 39 | #endif 40 | 41 | // now define the normal rounding. 42 | #ifdef ACCURATE_ROUNDING 43 | #define REAL_TO_SHORT( x ) REAL_TO_SHORT_ACCURATE( x ) 44 | #else 45 | #define REAL_TO_SHORT( x ) (short)( x ) 46 | #endif 47 | 48 | #endif//SAMPLE_H 49 | -------------------------------------------------------------------------------- /engine/client/soundlib/libmpg/synth.h: -------------------------------------------------------------------------------- 1 | /* 2 | synth.h - compact version of famous library mpg123 3 | Copyright (C) 2017 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef SYNTH_H 17 | #define SYNTH_H 18 | 19 | typedef int (*func_synth)( float*, int, mpg123_handle_t*, int ); 20 | typedef int (*func_synth_mono)( float*, mpg123_handle_t* ); 21 | typedef int (*func_synth_stereo)( float*, float*, mpg123_handle_t* ); 22 | 23 | enum synth_channel 24 | { 25 | c_plain = 0, 26 | c_stereo, 27 | c_m2s, 28 | c_mono, 29 | c_limit 30 | }; 31 | 32 | enum synth_resample 33 | { 34 | r_none = -1, 35 | r_1to1 = 0, 36 | r_limit 37 | }; 38 | 39 | enum synth_format 40 | { 41 | f_none = -1, 42 | f_16, 43 | f_limit 44 | }; 45 | 46 | typedef struct synth_s 47 | { 48 | func_synth plain[r_limit][f_limit]; 49 | func_synth_stereo stereo[r_limit][f_limit]; 50 | func_synth_mono mono2stereo[r_limit][f_limit]; 51 | func_synth_mono mono[r_limit][f_limit]; 52 | } synth_t; 53 | 54 | void init_synth( mpg123_handle_t *fr ); 55 | int set_synth_functions( mpg123_handle_t *fr ); 56 | 57 | #endif//SYNTH_H 58 | -------------------------------------------------------------------------------- /engine/client/soundlib/ogg_filestream.h: -------------------------------------------------------------------------------- 1 | /* 2 | ogg_filestream.h - helper struct for working with Ogg files 3 | Copyright (C) 2024 SNMetamorph 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef OGG_FILESTREAM_H 17 | #define OGG_FILESTREAM_H 18 | 19 | #include "xash3d_types.h" 20 | 21 | typedef struct ogg_filestream_s 22 | { 23 | const char *name; 24 | const byte *buffer; 25 | size_t filesize; 26 | size_t position; 27 | } ogg_filestream_t; 28 | 29 | size_t OggFilestream_Read( void *ptr, size_t blockSize, size_t nmemb, void *datasource ); 30 | int OggFilestream_Seek( void *datasource, int64_t offset, int whence ); 31 | long OggFilestream_Tell( void *datasource ); 32 | 33 | static inline void OggFilestream_Init( ogg_filestream_t *filestream, const char *name, const byte *buffer, size_t filesize ) 34 | { 35 | filestream->name = name; 36 | filestream->buffer = buffer; 37 | filestream->filesize = filesize; 38 | filestream->position = 0; 39 | } 40 | 41 | #endif // OGG_FILESTREAM_H 42 | -------------------------------------------------------------------------------- /engine/client/vgui/vgui_draw.h: -------------------------------------------------------------------------------- 1 | /* 2 | vgui_draw.h - vgui draw methods 3 | Copyright (C) 2011 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef VGUI_DRAW_H 17 | #define VGUI_DRAW_H 18 | 19 | // 20 | // vgui_draw.c 21 | // 22 | void VGui_RegisterCvars( void ); 23 | qboolean VGui_LoadProgs( HINSTANCE hInstance ); 24 | void VGui_Startup( int width, int height ); 25 | void VGui_Shutdown( void ); 26 | void VGui_Paint( void ); 27 | void VGui_RunFrame( void ); 28 | void VGui_MouseEvent( int key, int clicks ); 29 | void VGui_MWheelEvent( int y ); 30 | void VGui_KeyEvent( int key, int down ); 31 | void VGui_MouseMove( int x, int y ); 32 | qboolean VGui_IsActive( void ); 33 | void *VGui_GetPanel( void ); 34 | void VGui_ReportTextInput( const char *text ); 35 | void VGui_UpdateInternalCursorState( VGUI_DefaultCursor cursorType ); 36 | 37 | #endif // VGUI_DRAW_H 38 | -------------------------------------------------------------------------------- /engine/client/vid_common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef VID_COMMON 3 | #define VID_COMMON 4 | 5 | typedef struct vidmode_s 6 | { 7 | const char *desc; 8 | int width; 9 | int height; 10 | } vidmode_t; 11 | 12 | typedef enum window_mode_e 13 | { 14 | WINDOW_MODE_WINDOWED = 0, 15 | WINDOW_MODE_FULLSCREEN, 16 | WINDOW_MODE_BORDERLESS, 17 | WINDOW_MODE_COUNT, 18 | } window_mode_t; 19 | 20 | typedef struct 21 | { 22 | void* context; // handle to GL rendering context 23 | int safe; 24 | 25 | int desktopBitsPixel; 26 | int desktopHeight; 27 | 28 | qboolean initialized; // OpenGL subsystem started 29 | qboolean extended; // extended context allows to GL_Debug 30 | qboolean software; 31 | } glwstate_t; 32 | 33 | extern glwstate_t glw_state; 34 | 35 | #define VID_MIN_HEIGHT 200 36 | #define VID_MIN_WIDTH 320 37 | 38 | extern convar_t vid_fullscreen; 39 | extern convar_t vid_maximized; 40 | extern convar_t vid_highdpi; 41 | extern convar_t window_width; 42 | extern convar_t window_height; 43 | extern convar_t window_xpos; 44 | extern convar_t window_ypos; 45 | extern convar_t gl_msaa_samples; 46 | 47 | void R_SaveVideoMode( int w, int h, int render_w, int render_h, qboolean maximized ); 48 | void VID_SetDisplayTransform( int *render_w, int *render_h ); 49 | void VID_CheckChanges( void ); 50 | const char *VID_GetModeString( int vid_mode ); 51 | 52 | #endif // VID_COMMON 53 | -------------------------------------------------------------------------------- /engine/client/vox.h: -------------------------------------------------------------------------------- 1 | /* 2 | vox.h - sentences vox private header 3 | Copyright (C) 2010 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef VOX_H 17 | #define VOX_H 18 | 19 | #define CVOXWORDMAX 64 20 | #define SENTENCE_INDEX -99999 // unique sentence index 21 | 22 | typedef struct voxword_s 23 | { 24 | int volume; // increase percent, ie: 125 = 125% increase 25 | int pitch; // pitch shift up percent 26 | int start; // offset start of wave percent 27 | int end; // offset end of wave percent 28 | int cbtrim; // end of wave after being trimmed to 'end' 29 | int fKeepCached; // 1 if this word was already in cache before sentence referenced it 30 | int samplefrac; // if pitch shifting, this is position into wav * 256 31 | int timecompress; // % of wave to skip during playback (causes no pitch shift) 32 | sfx_t *sfx; // name and cache pointer 33 | } voxword_t; 34 | 35 | struct channel_s; 36 | void VOX_LoadWord( struct channel_s *pchan ); 37 | void VOX_FreeWord( struct channel_s *pchan ); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /engine/common/base_cmd.h: -------------------------------------------------------------------------------- 1 | /* 2 | base_cmd.h - command & cvar hashmap. Insipred by Doom III 3 | Copyright (C) 2016 a1batross 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef BASE_CMD_H 18 | #define BASE_CMD_H 19 | 20 | #define XASH_HASHED_VARS 21 | 22 | #ifdef XASH_HASHED_VARS 23 | 24 | #include "common.h" 25 | #include "cdll_int.h" 26 | 27 | typedef enum base_command_type 28 | { 29 | HM_DONTCARE = 0, 30 | HM_CVAR, 31 | HM_CMD, 32 | HM_CMDALIAS 33 | } base_command_type_e; 34 | 35 | typedef void base_command_t; 36 | 37 | void BaseCmd_Init( void ); 38 | void BaseCmd_Shutdown( void ); 39 | base_command_t *BaseCmd_Find( base_command_type_e type, const char *name ); 40 | void BaseCmd_FindAll( const char *name, cmd_t **cmd, cmdalias_t **alias, convar_t **cvar ); 41 | void BaseCmd_Insert ( base_command_type_e type, base_command_t *basecmd, const char *name ); 42 | void BaseCmd_Remove ( base_command_type_e type, const char *name ); 43 | void BaseCmd_Stats_f( void ); // to be registered later 44 | void BaseCmd_Test_f( void ); // to be registered later 45 | 46 | #endif // XASH_HASHED_VARS 47 | 48 | #endif // BASE_CMD_H 49 | -------------------------------------------------------------------------------- /engine/common/imagelib/img_tga.h: -------------------------------------------------------------------------------- 1 | /* 2 | img_tga.h - tga format reference 3 | Copyright (C) 2007 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifndef IMG_TGA_H 16 | #define IMG_TGA_H 17 | /* 18 | ======================================================================== 19 | 20 | .TGA image format (Truevision Targa) 21 | 22 | ======================================================================== 23 | */ 24 | #pragma pack( push, 1 ) 25 | typedef struct tga_s 26 | { 27 | uint8_t id_length; 28 | uint8_t colormap_type; 29 | uint8_t image_type; 30 | uint16_t colormap_index; 31 | uint16_t colormap_length; 32 | uint8_t colormap_size; 33 | uint16_t x_origin; 34 | uint16_t y_origin; 35 | uint16_t width; 36 | uint16_t height; 37 | uint8_t pixel_size; 38 | uint8_t attributes; 39 | } tga_t; 40 | #pragma pack( pop ) 41 | #endif // IMG_TGA_H 42 | 43 | -------------------------------------------------------------------------------- /engine/cursor_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | cursor_type.h - enumeration of possible mouse cursor types 3 | Copyright (C) 2022 FWGS Team 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef CURSOR_TYPE_H 18 | #define CURSOR_TYPE_H 19 | 20 | typedef enum 21 | { 22 | dc_user, 23 | dc_none, 24 | dc_arrow, 25 | dc_ibeam, 26 | dc_hourglass, 27 | dc_crosshair, 28 | dc_up, 29 | dc_sizenwse, 30 | dc_sizenesw, 31 | dc_sizewe, 32 | dc_sizens, 33 | dc_sizeall, 34 | dc_no, 35 | dc_hand, 36 | dc_last 37 | } VGUI_DefaultCursor; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /engine/customentity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef CUSTOMENTITY_H 17 | #define CUSTOMENTITY_H 18 | 19 | // Custom Entities 20 | 21 | // Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12) 22 | #define BEAMENT_ENTITY( x ) ((x) & 0xFFF) 23 | #define BEAMENT_ATTACHMENT( x ) (((x)>>12) & 0xF) 24 | 25 | // Beam types, encoded as a byte 26 | enum 27 | { 28 | BEAM_POINTS = 0, 29 | BEAM_ENTPOINT, 30 | BEAM_ENTS, 31 | BEAM_HOSE, 32 | }; 33 | 34 | #define BEAM_FSINE 0x10 35 | #define BEAM_FSOLID 0x20 36 | #define BEAM_FSHADEIN 0x40 37 | #define BEAM_FSHADEOUT 0x80 38 | 39 | #endif//CUSTOMENTITY_H 40 | -------------------------------------------------------------------------------- /engine/edict.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef EDICT_H 17 | #define EDICT_H 18 | 19 | #define MAX_ENT_LEAFS_32 24 // Orignally was 16 20 | #define MAX_ENT_LEAFS_16 48 21 | 22 | #include "progdefs.h" 23 | 24 | struct edict_s 25 | { 26 | qboolean free; 27 | int serialnumber; 28 | 29 | link_t area; // linked to a division node or leaf 30 | int headnode; // -1 to use normal leaf check 31 | 32 | int num_leafs; 33 | union 34 | { 35 | int leafnums32[MAX_ENT_LEAFS_32]; 36 | short leafnums16[MAX_ENT_LEAFS_16]; 37 | }; 38 | 39 | float freetime; // sv.time when the object was freed 40 | 41 | void* pvPrivateData; // Alloced and freed by engine, used by DLLs 42 | entvars_t v; // C exported fields from progs 43 | 44 | // other fields from progs come immediately after 45 | }; 46 | 47 | #endif//EDICT_H 48 | -------------------------------------------------------------------------------- /engine/key_modifiers.h: -------------------------------------------------------------------------------- 1 | /* 2 | key_modifiers.h - enumeration of possible key modifiers 3 | Copyright (C) 2022 FWGS Team 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef KEY_MODIFIERS_H 18 | #define KEY_MODIFIERS_H 19 | 20 | typedef enum 21 | { 22 | KeyModifier_None = 0, 23 | KeyModifier_LeftShift = (1 << 0), 24 | KeyModifier_RightShift = (1 << 1), 25 | KeyModifier_LeftCtrl = (1 << 2), 26 | KeyModifier_RightCtrl = (1 << 3), 27 | KeyModifier_LeftAlt = (1 << 4), 28 | KeyModifier_RightAlt = (1 << 5), 29 | KeyModifier_LeftSuper = (1 << 6), 30 | KeyModifier_RightSuper = (1 << 7), 31 | KeyModifier_NumLock = (1 << 8), 32 | KeyModifier_CapsLock = (1 << 9) 33 | } key_modifier_t; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /engine/platform/android/dlsym-weak.h: -------------------------------------------------------------------------------- 1 | /* 2 | dlsym-weak.h -- custom dlsym() function to override bionic libc bug on Android <5.0 3 | Copyright (C) 2015-2017 Flying With Gauss 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef DLSYM_WEAH_H 17 | #define DLSYM_WEAK_H 18 | 19 | // ------------ dlsym-weak.cpp ------------ // 20 | void* dlsym_weak(void* handle, const char* symbol); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /engine/platform/android/lib_android.h: -------------------------------------------------------------------------------- 1 | /* 2 | android_lib.h - dynamic library code for Android OS 3 | Copyright (C) 2018 Flying With Gauss 4 | 5 | This program is free software: you can redistribute it and/sor modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #if XASH_ANDROID 17 | #ifndef ANDROID_LIB_H 18 | #define ANDROID_LIB_H 19 | 20 | #if !XASH_TERMUX 21 | #define Platform_POSIX_LoadLibrary( x ) ANDROID_LoadLibrary(( x )) 22 | #endif // !XASH_TERMUX 23 | 24 | #define Platform_POSIX_GetProcAddress( x, y ) ANDROID_GetProcAddress(( x ), ( y )) 25 | 26 | void *ANDROID_LoadLibrary( const char *dllname ); 27 | void *ANDROID_GetProcAddress( void *hInstance, const char *name ); 28 | 29 | #endif // ANDROID_LIB_H 30 | #endif // XASH_ANDROID 31 | -------------------------------------------------------------------------------- /engine/platform/apple/lib_ios.h: -------------------------------------------------------------------------------- 1 | /* 2 | ios_lib.h - dynamic library code for iOS 3 | Copyright (C) 2017-2018 mittorn 4 | 5 | This program is free software: you can redistribute it and/sor modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #if TARGET_OS_IPHONE 17 | #ifndef IOS_LIB_H 18 | #define IOS_LIB_H 19 | 20 | #define Platform_POSIX_LoadLibrary( x ) IOS_LoadLibrary(( x )) 21 | 22 | void *IOS_LoadLibrary( const char *dllname ); 23 | 24 | #endif // IOS_LIB_H 25 | #endif // TARGET_OS_IPHONE 26 | -------------------------------------------------------------------------------- /engine/platform/dos/ld.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | out1=$2 3 | shift 2 4 | out=$1 5 | shift 1 6 | 7 | echo $* > $out 8 | rm -r $out.files 9 | mkdir $out.files 10 | cp --parents $* $out.files/ 11 | echo cp --parents $* $out.files/ 12 | 13 | #exit 0 -------------------------------------------------------------------------------- /engine/platform/dos/objcopy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd $3.files 3 | objxdef $(cat $3) |grep -v _lib_> syms.tmp 4 | objchg -m=$2_* -s=syms.tmp $(cat $3) 5 | wlib $3.a $(cat $3) 6 | cp $3.a $4 7 | cd .. -------------------------------------------------------------------------------- /engine/platform/emscripten/lib_em.c: -------------------------------------------------------------------------------- 1 | /* 2 | em_lib.h - dynamic library code for iOS 3 | Copyright (C) 2017-2018 mittorn 4 | 5 | This program is free software: you can redistribute it and/sor modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifdef __EMSCRIPTEN__ 16 | #include 17 | #include "common.h" 18 | #include "library.h" 19 | #include "filesystem.h" 20 | #include "server.h" 21 | 22 | void *EMSCRIPTEN_LoadLibrary( const char *dllname ) 23 | { 24 | void *pHandle = NULL; 25 | 26 | #ifdef EMSCRIPTEN_LIB_FS 27 | char path[MAX_SYSPATH], buf[MAX_VA_STRING]; 28 | string prefix; 29 | Q_strcpy(prefix, getenv( "LIBRARY_PREFIX" ) ); 30 | Q_snprintf( path, MAX_SYSPATH, "%s%s%s", prefix, dllname, getenv( "LIBRARY_SUFFIX" ) ); 31 | pHandle = dlopen( path, RTLD_LAZY ); 32 | if( !pHandle ) 33 | { 34 | Q_snprintf( buf, sizeof( buf ), "Loading %s:\n", path ); 35 | COM_PushLibraryError( buf ); 36 | COM_PushLibraryError( dlerror() ); 37 | } 38 | return pHandle; 39 | #else 40 | // get handle of preloaded library outside fs 41 | return EM_ASM_INT( return DLFCN.loadedLibNames[Pointer_stringify($0)], (int)dllname ); 42 | #endif 43 | } 44 | 45 | #endif // __EMSCRIPTEN__ 46 | -------------------------------------------------------------------------------- /engine/platform/emscripten/lib_em.h: -------------------------------------------------------------------------------- 1 | /* 2 | em_lib.h - dynamic library code for iOS 3 | Copyright (C) 2017-2018 mittorn 4 | 5 | This program is free software: you can redistribute it and/sor modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #include "build.h" 17 | #ifdef XASH_EMSCRIPTEN 18 | #ifndef EM_LIB_H 19 | #define EM_LIB_H 20 | 21 | #define Platform_POSIX_LoadLibrary( x ) EMSCRIPTEN_LoadLibrary(( x )) 22 | #ifndef EMSCRIPTEN_LIB_FS 23 | #define Platform_POSIX_FreeLibrary( x ) // nothing 24 | #endif // EMSCRIPTEN_LIB_FS 25 | 26 | void *EMSCRIPTEN_LoadLibrary( const char *dllname ); 27 | 28 | #endif // EM_LIB_H 29 | #endif // __EMSCRIPTEN__ 30 | -------------------------------------------------------------------------------- /engine/platform/irix/dladdr.c: -------------------------------------------------------------------------------- 1 | /* 2 | dladdr.c - dladdr implementation for SGI IRIX 3 | Copyright (C) 2022 Xav101 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | */ 13 | 14 | /* 15 | * From SGI IRIX's 'man dladdr' 16 | * 17 | * does not contain a prototype for dladdr or definition of 18 | * Dl_info. The #include in the SYNOPSIS line is traditional, 19 | * but contains no dladdr prototype and no IRIX library contains an 20 | * implementation. Write your own declaration based on the code below. 21 | * 22 | * The following code is dependent on internal interfaces that are not 23 | * part of the IRIX compatibility guarantee; however, there is no future 24 | * intention to change this interface, so on a practical level, the code 25 | * below is safe to use on IRIX. 26 | * 27 | * 28 | * 29 | * The following code has been reproduced from the manpage. 30 | */ 31 | 32 | #include "dladdr.h" 33 | 34 | int dladdr(void *address, Dl_info* dl) 35 | { 36 | void *v; 37 | v = _rld_new_interface(_RLD_DLADDR, address, dl); 38 | return (int)v; 39 | } 40 | -------------------------------------------------------------------------------- /engine/platform/irix/dladdr.h: -------------------------------------------------------------------------------- 1 | /* 2 | dladdr.h - dladdr prototypes for SGI IRIX 3 | Copyright (C) 2022 Xav101 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | */ 13 | 14 | /* See engine/platform/irix/dladdr.c for the requirement for this implementation */ 15 | 16 | #ifndef DLADDR_IRIX_H 17 | #define DLADDR_IRIX_H 18 | 19 | #include 20 | #ifndef _RLD_INTERFACE_DLFCN_H_DLADDR 21 | #define _RLD_INTERFACE_DLFCN_H_DLADDR 22 | typedef struct Dl_info { 23 | const char * dli_fname; 24 | void * dli_fbase; 25 | const char * dli_saddr; 26 | int dli_version; 27 | int dli_reserved1; 28 | long dli_reserved[4]; 29 | } Dl_info; 30 | #endif 31 | #define _RLD_DLADDR 14 32 | 33 | int dladdr(void *address, Dl_info* dl); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /engine/platform/irix/xash-exec: -------------------------------------------------------------------------------- 1 | #!/usr/sgug/bin/bash 2 | 3 | # Build path 4 | export LD_LIBRARYN32_PATH=$PWD/filesystem:$LD_LIBRARYN32_PATH 5 | 6 | # Install path 7 | export LD_LIBRARYN32_PATH=$PWD:$LD_LIBRARYN32_PATH 8 | 9 | exec $PWD/build/engine/xash 10 | -------------------------------------------------------------------------------- /engine/platform/misc/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | sbrk_swap.h - swap memory allocation 3 | Copyright (C) 2019 mittorn 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | //#include 16 | void *SWAP_Sbrk( size_t size ); 17 | void *SWAP_Malloc( size_t size ); 18 | void *SWAP_Calloc( size_t nelem, size_t size ); 19 | void SWAP_Free( void *cp ); 20 | void *SWAP_Realloc( void *cp, size_t size ); 21 | size_t SWAP_MallocUsableSize( void * cp ); 22 | -------------------------------------------------------------------------------- /engine/platform/nswitch/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/engine/platform/nswitch/icon.jpg -------------------------------------------------------------------------------- /engine/platform/nswitch/xash3d-fwgs.nacp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/engine/platform/nswitch/xash3d-fwgs.nacp -------------------------------------------------------------------------------- /engine/platform/posix/con_posix.c: -------------------------------------------------------------------------------- 1 | /* 2 | con_posix.c - reading from stdin 3 | Copyright (C) 2024 Flying With Gauss 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #include "platform/platform.h" 17 | 18 | #if !XASH_MOBILE_PLATFORM && !XASH_LOW_MEMORY 19 | // use with caution, running engine in Qt Creator may cause a freeze in read() call 20 | // I have never encountered this bug anywhere else, so still enable by default 21 | #include 22 | 23 | char *Posix_Input( void ) 24 | { 25 | fd_set rfds; 26 | static char line[1024]; 27 | static int len; 28 | struct timeval tv = { 0 }; 29 | 30 | if( !Host_IsDedicated( )) 31 | return NULL; 32 | 33 | FD_ZERO( &rfds ); 34 | FD_SET( 0, &rfds); // stdin 35 | while( select( 1, &rfds, NULL, NULL, &tv ) > 0 ) 36 | { 37 | if( read( 0, &line[len], 1 ) != 1 ) 38 | break; 39 | if( line[len] == '\n' || len > ( sizeof( line ) - 2 )) 40 | { 41 | line[ ++len ] = 0; 42 | len = 0; 43 | return line; 44 | } 45 | len++; 46 | tv.tv_sec = 0; 47 | tv.tv_usec = 0; 48 | } 49 | 50 | return NULL; 51 | } 52 | #endif // !XASH_MOBILE_PLATFORM && !XASH_LOW_MEMORY 53 | -------------------------------------------------------------------------------- /engine/platform/psvita/net_psvita.h: -------------------------------------------------------------------------------- 1 | /* 2 | net_psvita.h - psvita network stubs 3 | Copyright (C) 2021-2023 fgsfds 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef NET_PSVITA_H 18 | #define NET_PSVITA_H 19 | 20 | #include 21 | #include "platform/posix/net.h" 22 | 23 | /* we're missing IPv6 support; define some trash */ 24 | #define XASH_NO_IPV6_RESOLVE 1 25 | 26 | #ifndef IN6_IS_ADDR_V4MAPPED 27 | #define IN6_IS_ADDR_V4MAPPED( p ) ( 0 ) 28 | #endif 29 | 30 | #ifndef IPPROTO_IPV6 31 | #define IPPROTO_IPV6 41 32 | #endif 33 | 34 | #ifndef IPV6_MULTICAST_LOOP 35 | #define IPV6_MULTICAST_LOOP 19 36 | #endif 37 | 38 | #ifndef IPV6_V6ONLY 39 | #define IPV6_V6ONLY 26 40 | #endif 41 | 42 | #ifndef FIONBIO 43 | #define FIONBIO SO_NONBLOCK 44 | #endif 45 | 46 | /* ioctlsocket() is only used to set non-blocking on sockets */ 47 | 48 | static inline int ioctl_psvita( int fd, int req, unsigned int *arg ) 49 | { 50 | if ( req == FIONBIO ) 51 | { 52 | return setsockopt( fd, SOL_SOCKET, SO_NONBLOCK, arg, sizeof( *arg ) ); 53 | } 54 | return -ENOSYS; 55 | } 56 | 57 | #define ioctlsocket ioctl_psvita 58 | 59 | #endif // NET_PSVITA_H 60 | -------------------------------------------------------------------------------- /engine/platform/psvita/sce_sys/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/engine/platform/psvita/sce_sys/icon0.png -------------------------------------------------------------------------------- /engine/platform/psvita/sce_sys/livearea/contents/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/engine/platform/psvita/sce_sys/livearea/contents/bg.png -------------------------------------------------------------------------------- /engine/platform/psvita/sce_sys/livearea/contents/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/engine/platform/psvita/sce_sys/livearea/contents/startup.png -------------------------------------------------------------------------------- /engine/platform/psvita/sce_sys/livearea/contents/template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bg.png 6 | 7 | 8 | 9 | startup.png 10 | 11 | 12 | 13 | 14 | psla:dev 15 | 16 | Developer mode 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /engine/platform/sdl1/platform_sdl1.h: -------------------------------------------------------------------------------- 1 | /* 2 | platform_sdl1.h - SDL backend internal header 3 | Copyright (C) 2015-2018 a1batross 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef KEYWRAPPER_H 18 | #define KEYWRAPPER_H 19 | #ifdef XASH_SDL 20 | 21 | #include "platform.h" 22 | 23 | // window management 24 | void VID_RestoreScreenResolution( void ); 25 | qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode ); 26 | void VID_DestroyWindow( void ); 27 | void GL_InitExtensions( void ); 28 | qboolean GL_DeleteContext( void ); 29 | void VID_SaveWindowSize( int width, int height, qboolean maximized ); 30 | 31 | // 32 | // joy_sdl.c 33 | // 34 | void SDLash_HandleGameControllerEvent( SDL_Event *ev ); 35 | 36 | #endif // XASH_SDL 37 | #endif // KEYWRAPPER_H 38 | -------------------------------------------------------------------------------- /engine/platform/sdl1/sys_sdl1.c: -------------------------------------------------------------------------------- 1 | /* 2 | sys_sdl1.c - SDL1 system utils 3 | Copyright (C) 2018 a1batross 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #include 17 | #include "platform.h" 18 | #include "platform_sdl1.h" 19 | 20 | #if XASH_TIMER == TIMER_SDL 21 | double Platform_DoubleTime( void ) 22 | { 23 | static Uint64 g_PerformanceFrequency; 24 | static Uint64 g_ClockStart; 25 | Uint64 CurrentTime; 26 | 27 | if( !g_PerformanceFrequency ) 28 | { 29 | g_PerformanceFrequency = SDL_GetPerformanceFrequency(); 30 | g_ClockStart = SDL_GetPerformanceCounter(); 31 | } 32 | CurrentTime = SDL_GetPerformanceCounter(); 33 | return (double)( CurrentTime - g_ClockStart ) / (double)( g_PerformanceFrequency ); 34 | } 35 | 36 | void Platform_Sleep( int msec ) 37 | { 38 | SDL_Delay( msec ); 39 | } 40 | #endif // XASH_TIMER == TIMER_SDL 41 | 42 | #if XASH_MESSAGEBOX == MSGBOX_SDL 43 | void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ) 44 | { 45 | SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, title, message, parentMainWindow ? host.hWnd : NULL ); 46 | } 47 | #endif // XASH_MESSAGEBOX == MSGBOX_SDL 48 | 49 | void SDLash_Init( const char *basedir ) 50 | { 51 | if( SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO )) 52 | { 53 | Sys_Warn( "SDL_Init failed: %s", SDL_GetError() ); 54 | host.type = HOST_DEDICATED; 55 | } 56 | } 57 | 58 | void SDLash_Shutdown( void ) 59 | { 60 | SDL_Quit(); 61 | } 62 | -------------------------------------------------------------------------------- /engine/platform/sdl2/platform_sdl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | platform_sdl2.h - SDL backend internal header 3 | Copyright (C) 2015-2018 a1batross 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | #ifndef KEYWRAPPER_H 18 | #define KEYWRAPPER_H 19 | #ifdef XASH_SDL 20 | 21 | #include "platform.h" 22 | 23 | // window management 24 | void VID_RestoreScreenResolution( void ); 25 | qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode ); 26 | void VID_DestroyWindow( void ); 27 | void GL_InitExtensions( void ); 28 | qboolean GL_DeleteContext( void ); 29 | void VID_SaveWindowSize( int width, int height, qboolean maximized ); 30 | 31 | // 32 | // in_sdl.c 33 | // 34 | void SDLash_InitCursors( void ); 35 | void SDLash_FreeCursors( void ); 36 | 37 | // 38 | // joy_sdl.c 39 | // 40 | void SDLash_HandleGameControllerEvent( SDL_Event *ev ); 41 | 42 | #endif // XASH_SDL 43 | #endif // KEYWRAPPER_H 44 | -------------------------------------------------------------------------------- /engine/platform/sdl3/platform_sdl3.h: -------------------------------------------------------------------------------- 1 | /* 2 | platform_sdl3.h - SDL3 platform definitions 3 | Copyright (C) 2025 Er2off 4 | Copyright (C) 2025 Alibek Omarov 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | */ 16 | #ifndef PLATFORM_SDL3_H 17 | #define PLATFORM_SDL3_H 18 | 19 | #include 20 | #include "platform/platform.h" 21 | 22 | // 23 | // in_sdl3.c 24 | // 25 | void SDLash_InitCursors( void ); 26 | void SDLash_FreeCursors( void ); 27 | 28 | #endif // PLATFORM_SDL3_H 29 | -------------------------------------------------------------------------------- /engine/platform/win32/lib_win.h: -------------------------------------------------------------------------------- 1 | /* 2 | lib_win.h - common win32 dll definitions 3 | Copyright (C) 2022 Flying With Gauss 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #include "library.h" 17 | #include 18 | #include 19 | #include STDINT_H 20 | 21 | #define CALCULATE_ADDRESS( base, offset ) ((uint8_t *)( base ) + (uintptr_t)( offset )) 22 | 23 | FARPROC MemoryGetProcAddress( void *module, const char *name ); 24 | void MemoryFreeLibrary( void *hInstance ); 25 | void *MemoryLoadLibrary( const char *name ); 26 | -------------------------------------------------------------------------------- /engine/platform/win32/net.h: -------------------------------------------------------------------------------- 1 | /* 2 | net.h - WinSock to BSD sockets wrap 3 | Copyright (C) 2022 a1batross 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifndef NET_H 16 | #define NET_H 17 | 18 | #include 19 | typedef int WSAsize_t; 20 | 21 | #define HAVE_GETADDRINFO 22 | 23 | #endif // NET_H 24 | -------------------------------------------------------------------------------- /engine/shake.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef SHAKE_H 17 | #define SHAKE_H 18 | 19 | // Screen / View effects 20 | 21 | // screen shake 22 | extern int gmsgShake; 23 | 24 | // This structure is sent over the net to describe a screen shake event 25 | typedef struct 26 | { 27 | unsigned short amplitude; // FIXED 4.12 amount of shake 28 | unsigned short duration; // FIXED 4.12 seconds duration 29 | unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble) 30 | } ScreenShake; 31 | 32 | // Fade in/out 33 | extern int gmsgFade; 34 | 35 | #define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function 36 | #define FFADE_OUT 0x0001 // Fade out (not in) 37 | #define FFADE_MODULATE 0x0002 // Modulate (don't blend) 38 | #define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received 39 | #define FFADE_LONGFADE 0x0008 // used to indicate the fade can be longer than 16 seconds (added for czero) 40 | 41 | // This structure is sent over the net to describe a screen fade event 42 | typedef struct 43 | { 44 | unsigned short duration; // FIXED 4.12 seconds duration 45 | unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold) 46 | short fadeFlags; // flags 47 | byte r, g, b, a; // fade to color ( max alpha ) 48 | } ScreenFade; 49 | 50 | #endif // SHAKE_H 51 | -------------------------------------------------------------------------------- /filesystem/exports.txt: -------------------------------------------------------------------------------- 1 | GetFSAPI 2 | -------------------------------------------------------------------------------- /filesystem/tests/interface.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "port.h" 5 | #include "build.h" 6 | #include "VFileSystem009.h" 7 | #include "filesystem.h" 8 | 9 | #if XASH_POSIX 10 | #include 11 | #define LoadLibrary( x ) dlopen( x, RTLD_NOW ) 12 | #define GetProcAddress( x, y ) dlsym( x, y ) 13 | #define FreeLibrary( x ) dlclose( x ) 14 | typedef void *HMODULE; 15 | #elif XASH_WIN32 16 | #include 17 | #endif 18 | 19 | HMODULE g_hModule; 20 | FSAPI g_pfnGetFSAPI; 21 | pfnCreateInterface_t g_pfnCreateInterface; 22 | fs_api_t g_fs; 23 | fs_globals_t *g_nullglobals; 24 | 25 | static bool LoadFilesystem() 26 | { 27 | int temp = -1; 28 | 29 | g_hModule = LoadLibrary( "filesystem_stdio." OS_LIB_EXT ); 30 | if( !g_hModule ) 31 | return false; 32 | 33 | // check our C-style interface existence 34 | g_pfnGetFSAPI = reinterpret_cast( GetProcAddress( g_hModule, GET_FS_API )); 35 | if( !g_pfnGetFSAPI ) 36 | return false; 37 | 38 | g_nullglobals = NULL; 39 | if( !g_pfnGetFSAPI( FS_API_VERSION, &g_fs, &g_nullglobals, NULL )) 40 | return false; 41 | 42 | if( !g_nullglobals ) 43 | return false; 44 | 45 | // check Valve-style interface existence 46 | g_pfnCreateInterface = reinterpret_cast( GetProcAddress( g_hModule, "CreateInterface" )); 47 | if( !g_pfnCreateInterface ) 48 | return false; 49 | 50 | if( !g_pfnCreateInterface( FILESYSTEM_INTERFACE_VERSION, &temp ) || temp != 0 ) 51 | return false; 52 | 53 | temp = -1; 54 | 55 | if( !g_pfnCreateInterface( FS_API_CREATEINTERFACE_TAG, &temp ) || temp != 0 ) 56 | return false; 57 | 58 | return true; 59 | } 60 | 61 | int main() 62 | { 63 | if( !LoadFilesystem() ) 64 | return EXIT_FAILURE; 65 | 66 | return EXIT_SUCCESS; 67 | } 68 | -------------------------------------------------------------------------------- /game_launch/game.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDI_ICON1 101 4 | 5 | #define VER_FILEVERSION 1,00 6 | #define VER_FILEVERSION_STR "1.00" 7 | #define VER_PRODUCTVERSION 1,00 8 | #define VER_PRODUCTVERSION_STR "1.00" 9 | 10 | #define VER_FILEFLAGSMASK VS_FF_PRERELEASE | VS_FF_PATCHED 11 | #define VER_FILEFLAGS VS_FF_PRERELEASE 12 | #define VER_FILEOS VOS__WINDOWS32 13 | #define VER_FILETYPE VFT_DLL 14 | #define VER_FILESUBTYPE VFT2_UNKNOWN 15 | 16 | #define VER_COMPANYNAME_STR "Flying With Gauss" 17 | #define VER_LEGALCOPYRIGHT_STR "Flying With Gauss" 18 | #define VER_PRODUCTNAME_STR "Xash3D Launcher" 19 | 20 | #define VER_ANSICP 21 | 22 | #define VER_FILEDESCRIPTION_STR "Xash3D FWGS Launcher" 23 | #define VER_ORIGINALFILENAME_STR "xash.exe" 24 | #define VER_INTERNALNAME_STR "xash" 25 | 26 | #include 27 | 28 | IDI_ICON1 ICON DISCARDABLE "icon-xash-material.ico" 29 | -------------------------------------------------------------------------------- /game_launch/icon-xash-material.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/game_launch/icon-xash-material.ico -------------------------------------------------------------------------------- /game_launch/icon-xash-material.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/game_launch/icon-xash-material.png -------------------------------------------------------------------------------- /game_launch/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # a1batross, mittorn, 2018 4 | 5 | from waflib import Logs 6 | import os 7 | import sys 8 | 9 | top = '.' 10 | 11 | def options(opt): 12 | grp = opt.add_option_group('Game launcher options') 13 | 14 | grp.add_option('--disable-menu-changegame', action = 'store_true', dest = 'DISABLE_MENU_CHANGEGAME', default = False, 15 | help = 'disable changing the game from the menu [default: %(default)s]') 16 | 17 | def configure(conf): 18 | if conf.env.DEST_OS == 'win32': 19 | conf.load('winres') 20 | 21 | conf.define('XASH_DISABLE_MENU_CHANGEGAME', conf.options.DISABLE_MENU_CHANGEGAME) 22 | 23 | def build(bld): 24 | source = ['game.cpp'] 25 | 26 | if bld.env.DEST_OS == 'win32': 27 | source += ['game.rc'] 28 | 29 | # Half-Life 25th anniversary update doesn't have server library explicitly linked to libm 30 | if bld.env.DEST_OS == 'linux': 31 | bld.env.LDFLAGS += ['-Wl,--no-as-needed', '-lm'] 32 | 33 | bld.program(source = source, 34 | target = 'xash3d', # hl.exe 35 | use = 'sdk_includes DL USER32 SHELL32 werror', 36 | rpath = bld.env.DEFAULT_RPATH, 37 | install_path = bld.env.BINDIR, 38 | subsystem = bld.env.MSVC_SUBSYSTEM 39 | ) 40 | -------------------------------------------------------------------------------- /pm_shared/pm_info.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PM_INFO_H 16 | #define PM_INFO_H 17 | 18 | #define MAX_PHYSINFO_STRING 256 19 | 20 | #endif//PM_INFO_H 21 | -------------------------------------------------------------------------------- /public/build_vcs.c: -------------------------------------------------------------------------------- 1 | /* 2 | build_vcs.c - info from VCS 3 | Copyright (C) 2025 Alibek Omarov 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | const char *g_buildcommit = XASH_BUILD_COMMIT; 17 | const char *g_buildbranch = XASH_BUILD_BRANCH; 18 | const char *g_buildcommit_date = XASH_BUILD_COMMIT_DATE; 19 | const char *g_build_date = __DATE__; 20 | -------------------------------------------------------------------------------- /public/dllhelpers.c: -------------------------------------------------------------------------------- 1 | /* 2 | dllhelpers.c - dll exports helpers 3 | Copyright (C) 2024 Alibek Omarov 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #include "crtlib.h" 16 | 17 | void ClearExports( const dllfunc_t *funcs, size_t num_funcs ) 18 | { 19 | size_t i; 20 | 21 | for( i = 0; i < num_funcs; i++ ) 22 | *(funcs[i].func) = NULL; 23 | } 24 | 25 | qboolean ValidateExports( const dllfunc_t *funcs, size_t num_funcs ) 26 | { 27 | size_t i; 28 | 29 | for( i = 0; i < num_funcs; i++ ) 30 | { 31 | if( *(funcs[i].func) == NULL ) 32 | return false; 33 | } 34 | 35 | return true; 36 | } 37 | -------------------------------------------------------------------------------- /public/getopt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef GETOPT_H 3 | #define GETOPT_H 4 | #if XASH_WIN32 5 | extern int opterr; 6 | extern int optind; 7 | extern int optopt; 8 | extern int optreset; 9 | extern char *optarg; 10 | 11 | int getopt( int nargc, char * const nargv[], const char *ostr ); 12 | #endif // XASH_WIN32 13 | #endif // GETOPT_H 14 | -------------------------------------------------------------------------------- /public/tests/test_efp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "crtlib.h" 3 | #include 4 | 5 | static int Test_ExtractFilePath( void ) 6 | { 7 | char dst[64]; 8 | const char *strings[] = 9 | { 10 | "dir/file", "dir", 11 | "bark\\meow", "bark", 12 | "nopath", "", 13 | "knee/deep/in/paths", "knee/deep/in", 14 | // yes, it removes the behavior/ even if it might be technically a directory 15 | "keep/the/original/func/behavior/", "keep/the/original/func", 16 | "backslashes\\are\\annoying\\af", "backslashes\\are\\annoying", 17 | "", "" 18 | }; 19 | size_t i; 20 | 21 | for( i = 0; i < sizeof( strings ) / sizeof( strings[0] ); i += 2 ) 22 | { 23 | COM_ExtractFilePath( strings[i], dst ); 24 | if( Q_strcmp( dst, strings[i+1] )) 25 | { 26 | printf( "%s %s %s\n", strings[i], strings[i+1], dst ); 27 | return (i >> 1) + 1; 28 | } 29 | } 30 | 31 | return 0; 32 | } 33 | 34 | int main( void ) 35 | { 36 | if( Test_ExtractFilePath( )) 37 | return EXIT_FAILURE; 38 | 39 | return EXIT_SUCCESS; 40 | } 41 | -------------------------------------------------------------------------------- /public/tests/test_fileext.c: -------------------------------------------------------------------------------- 1 | #include "crtlib.h" 2 | 3 | int main( int argc, char **argv ) 4 | { 5 | int i; 6 | const char *strings[] = 7 | { 8 | "test.txt", "txt", 9 | "path/to/file.wad", "wad", 10 | "noext", "", 11 | "dir/", "", 12 | "dir.pk3dir/", "", 13 | "https.proto://is_this_an_url?", "", 14 | "inside.wad/AAATRIGGER", "", 15 | "c:/games/gamedir/liblist.cum", "cum", 16 | }; 17 | 18 | for( i = 0; i < sizeof( strings ) / sizeof( strings[0] ); i += 2 ) 19 | { 20 | if( Q_strcmp( COM_FileExtension( strings[i] ), strings[i + 1] )) 21 | return i; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /public/tests/test_parsefile.c: -------------------------------------------------------------------------------- 1 | #include "crtlib.h" 2 | 3 | static const char *test_file = 4 | "q asdf \"qwerty\" \"f \\\"f\" meowmeow\n" 5 | "// comment \"stuff ignored\"\n" 6 | "bark // ignore\n" 7 | "bashlikecomment #notignored test\n" 8 | "#ignore comment\n" 9 | "thisshall #be ignored\n" 10 | "test_sentinel\n"; 11 | 12 | int main( void ) 13 | { 14 | int i; 15 | char *file = (char *)test_file; 16 | struct test 17 | { 18 | int bufsize; 19 | const char *expected; 20 | int expected_len; 21 | int flags; 22 | } testdata[] = 23 | { 24 | { 5, "q", 1 }, 25 | { 5, "asdf", 4 }, 26 | { 5, "qwer", -1 }, 27 | { 5, "f \"f", 4 }, 28 | { 5, "meow", -1 }, 29 | { 5, "bark", 4 }, 30 | { 32, "bashlikecomment", 15 }, 31 | { 32, "#notignored", 11 }, 32 | { 32, "test", 4, PFILE_IGNOREHASHCMT }, 33 | { 32, "thisshall", 9, PFILE_IGNOREHASHCMT }, 34 | { 32, "test_sentinel", 13, PFILE_IGNOREHASHCMT }, 35 | }; 36 | 37 | for( i = 0; i < sizeof( testdata ) / sizeof( testdata[0] ); i++ ) 38 | { 39 | string buf; 40 | int len; 41 | 42 | file = COM_ParseFileSafe( file, buf, testdata[i].bufsize, testdata[i].flags, &len, NULL ); 43 | 44 | if( file == NULL ) 45 | return i; 46 | 47 | if( !( !Q_strcmp( buf, testdata[i].expected ) && len == testdata[i].expected_len )) 48 | return i; 49 | } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /public/tests/test_strings.c: -------------------------------------------------------------------------------- 1 | #include "crtlib.h" 2 | 3 | static int Test_Strcpycatcmp( void ) 4 | { 5 | char buf[] = "meowmeowmeow", buf2[] = "barkbark"; 6 | char dst[64]; 7 | 8 | if( Q_strncpy( dst, buf, sizeof( dst )) != sizeof( buf ) - 1 ) 9 | return 1; 10 | 11 | if( Q_strcmp( dst, buf )) 12 | return 2; 13 | 14 | if( Q_strcmp( dst, buf )) 15 | return 4; 16 | 17 | if( !Q_strcmp( dst, buf2 )) 18 | return 5; 19 | 20 | if( Q_strncat( dst, buf2, sizeof( dst )) != sizeof( buf ) + sizeof( buf2 ) - 2 ) 21 | return 6; 22 | 23 | if( Q_strcmp( dst, "meowmeowmeowbarkbark" )) 24 | return 7; 25 | 26 | if( Q_strncmp( dst, buf, sizeof( buf ) - 1 )) 27 | return 8; 28 | 29 | return 0; 30 | } 31 | 32 | static int Test_Strnlwr( void ) 33 | { 34 | string s; 35 | 36 | Q_strnlwr( "ASDFGKJ", s, sizeof( s )); 37 | 38 | if( Q_strcmp( s, "asdfgkj" )) 39 | return 1; 40 | 41 | Q_strnlwr( "qwertyuiop", s, sizeof( s )); 42 | 43 | if( Q_strcmp( s, "qwertyuiop" )) 44 | return 2; 45 | 46 | return 0; 47 | } 48 | 49 | static int Test_FixSlashes( void ) 50 | { 51 | string s = "path\\with\\back\\slashes"; 52 | string s2 = "path/with/fwd/slashes"; 53 | string s3 = "path\\with/mixed\\slashes"; 54 | 55 | COM_FixSlashes( s ); 56 | 57 | if( Q_strcmp( s, "path/with/back/slashes" )) 58 | return 1; 59 | 60 | COM_FixSlashes( s2 ); 61 | 62 | if( Q_strcmp( s2, "path/with/fwd/slashes" )) 63 | return 2; 64 | 65 | COM_FixSlashes( s3 ); 66 | 67 | if( Q_strcmp( s3, "path/with/mixed/slashes" )) 68 | return 3; 69 | 70 | return 0; 71 | } 72 | 73 | int main( void ) 74 | { 75 | int ret = Test_Strcpycatcmp(); 76 | 77 | if( ret > 0 ) 78 | return ret; 79 | 80 | ret = Test_Strnlwr(); 81 | 82 | if( ret > 0 ) 83 | return ret + 16; 84 | 85 | ret = Test_FixSlashes(); 86 | 87 | if( ret > 0 ) 88 | return ret + 48; 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /public/tests/test_validate_target.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "build.h" 3 | #include "buildenums.h" 4 | #include "crtlib.h" 5 | 6 | #ifndef VALIDATE_TARGET 7 | #error 8 | #endif 9 | 10 | int main( void ) 11 | { 12 | string buf; 13 | 14 | if( Q_snprintf( buf, sizeof( buf ), "%s-%s", Q_buildos( ), Q_buildarch( )) < 0 ) 15 | return 1; 16 | 17 | if( Q_strcmp( buf, VALIDATE_TARGET ) != 0 ) 18 | return 2; 19 | 20 | return EXIT_SUCCESS; 21 | } 22 | -------------------------------------------------------------------------------- /public/utflib.h: -------------------------------------------------------------------------------- 1 | /* 2 | utflib.h - small unicode conversion library 3 | Copyright (C) 2024 Alibek Omarov 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #ifndef UTFLIB_H 16 | #define UTFLIB_H 17 | 18 | #include STDINT_H 19 | #include 20 | 21 | typedef struct utfstate_s 22 | { 23 | uint32_t uc; 24 | uint8_t len; 25 | uint8_t k; 26 | } utfstate_t; 27 | 28 | // feed utf8 characters one by one 29 | // if it returns 0, feed more 30 | // utfstate_t must be zero initialized 31 | uint32_t Q_DecodeUTF8( utfstate_t *s, uint32_t ch ); 32 | uint32_t Q_DecodeUTF16( utfstate_t *s, uint32_t ch ); 33 | size_t Q_EncodeUTF8( char dst[4], uint32_t ch ); 34 | 35 | size_t Q_UTF8Length( const char *s ); 36 | 37 | // srcsize in byte pairs 38 | size_t Q_UTF16ToUTF8( char *dst, size_t dstsize, const uint16_t *src, size_t srcsize ); 39 | 40 | // function to convert Unicode codepoints into CP1251 or CP1252 41 | uint32_t Q_UnicodeToCP1251( uint32_t uc ); 42 | uint32_t Q_UnicodeToCP1252( uint32_t uc ); 43 | 44 | #endif // UTFLIB_H 45 | -------------------------------------------------------------------------------- /ref/gl/exports.txt: -------------------------------------------------------------------------------- 1 | GetRefAPI 2 | -------------------------------------------------------------------------------- /ref/gl/gl2_shim/fragment.glsl.inc: -------------------------------------------------------------------------------- 1 | "#if VER <= 300\n" 2 | "#define layout(x)\n" 3 | "#endif\n" 4 | "#if VER < 300\n" 5 | "#define out attribute\n" 6 | "#define in varying\n" 7 | "#define texture texture2D\n" 8 | "#endif\n" 9 | "#if VER >= 130 || VER == 100\n" 10 | "precision mediump float;\n" 11 | "#endif\n" 12 | "#if VER == 100\n" 13 | "#define PREC mediump\n" 14 | "#else\n" 15 | "#define PREC\n" 16 | "#endif\n" 17 | "#if ATTR_TEXCOORD0\n" 18 | "uniform sampler2D uTex0;\n" 19 | "#endif\n" 20 | "#if ATTR_TEXCOORD1\n" 21 | "uniform sampler2D uTex1;\n" 22 | "#endif\n" 23 | "#if FEAT_ALPHA_TEST\n" 24 | "uniform float uAlphaTest;\n" 25 | "#endif\n" 26 | "#if FEAT_FOG\n" 27 | "uniform PREC vec4 uFog;\n" 28 | "#endif\n" 29 | "uniform PREC vec4 uColor;\n" 30 | "#if ATTR_COLOR\n" 31 | "in PREC vec4 vColor;\n" 32 | "#endif\n" 33 | "#if ATTR_TEXCOORD0\n" 34 | "in PREC vec2 vTexCoord0;\n" 35 | "#endif\n" 36 | "#if ATTR_TEXCOORD1\n" 37 | "in PREC vec2 vTexCoord1;\n" 38 | "#endif\n" 39 | "#if ATTR_NORMAL\n" 40 | "in PREC vec2 vNormal;\n" 41 | "#endif\n" 42 | "#if VER >= 300\n" 43 | "out vec4 oFragColor;\n" 44 | "#else\n" 45 | "#define oFragColor gl_FragColor\n" 46 | "#endif\n" 47 | "void main()\n" 48 | "{\n" 49 | "#if ATTR_COLOR\n" 50 | "PREC vec4 c = vColor;\n" 51 | "#else\n" 52 | "PREC vec4 c = uColor;\n" 53 | "#endif\n" 54 | "#if ATTR_TEXCOORD0\n" 55 | "c = c * texture(uTex0, vTexCoord0);\n" 56 | "#endif\n" 57 | "#if ATTR_TEXCOORD1\n" 58 | "c = c * texture(uTex1, vTexCoord1);\n" 59 | "#endif\n" 60 | "#if FEAT_ALPHA_TEST\n" 61 | "if(c.a <= uAlphaTest)\n" 62 | "discard;\n" 63 | "#endif\n" 64 | "#if FEAT_FOG\n" 65 | "float fogDist = gl_FragCoord.z / gl_FragCoord.w;\n" 66 | "float fogRate = clamp(exp(-uFog.w * fogDist), 0.0, 1.0);\n" 67 | "c.rgb = mix(uFog.rgb, c.rgb, fogRate);\n" 68 | "#endif\n" 69 | "oFragColor = c;\n" 70 | "}\n" 71 | -------------------------------------------------------------------------------- /ref/gl/gl2_shim/gl2_shim.h: -------------------------------------------------------------------------------- 1 | /* 2 | vgl_shim.h - vitaGL custom immediate mode shim 3 | Copyright (C) 2023 fgsfds 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | 18 | // max verts in a single frame 19 | #define GL2_MAX_VERTS 32768 20 | 21 | int GL2_ShimInit( void ); 22 | void GL2_ShimInstall( void ); 23 | void GL2_ShimShutdown( void ); 24 | void GL2_ShimEndFrame( void ); 25 | -------------------------------------------------------------------------------- /ref/gl/gl2_shim/vertex.glsl.inc: -------------------------------------------------------------------------------- 1 | "#if VER <= 300\n" 2 | "#define layout(x)\n" 3 | "#endif\n" 4 | "#if VER < 300\n" 5 | "#define in attribute\n" 6 | "#define out varying\n" 7 | "#endif\n" 8 | "\n" 9 | "layout(location = LOC_ATTR_POSITION) in vec3 inPosition;\n" 10 | "#if ATTR_COLOR\n" 11 | "layout(location = LOC_ATTR_COLOR) in vec4 inColor;\n" 12 | "#endif\n" 13 | "#if ATTR_TEXCOORD0\n" 14 | "layout(location = LOC_ATTR_TEXCOORD0) in vec2 inTexCoord0;\n" 15 | "#endif\n" 16 | "#if ATTR_TEXCOORD1\n" 17 | "layout(location = LOC_ATTR_TEXCOORD1) in vec2 inTexCoord1;\n" 18 | "#endif\n" 19 | "\n" 20 | "#if ATTR_NORMAL\n" 21 | "in vec3 inNormal;\n" 22 | "#endif\n" 23 | "#if ATTR_COLOR\n" 24 | "out vec4 vColor;\n" 25 | "#endif\n" 26 | "#if ATTR_TEXCOORD0\n" 27 | "out vec2 vTexCoord0;\n" 28 | "#endif\n" 29 | "#if ATTR_TEXCOORD1\n" 30 | "out vec2 vTexCoord1;\n" 31 | "#endif\n" 32 | "#if ATTR_NORMAL\n" 33 | "out vec3 vNormal;\n" 34 | "#endif\n" 35 | "\n" 36 | "uniform mat4 uMVP;\n" 37 | "\n" 38 | "void main()\n" 39 | "{\n" 40 | "gl_Position = uMVP * vec4(inPosition,1.0);\n" 41 | "#if ATTR_COLOR\n" 42 | "vColor = inColor;\n" 43 | "#endif\n" 44 | "#if ATTR_NORMAL\n" 45 | "vNormal = inNormal;\n" 46 | "#endif\n" 47 | "#if ATTR_TEXCOORD0\n" 48 | "vTexCoord0 = inTexCoord0;\n" 49 | "#endif\n" 50 | "#if ATTR_TEXCOORD1\n" 51 | "vTexCoord1 = inTexCoord1;\n" 52 | "#endif\n" 53 | "}\n" 54 | -------------------------------------------------------------------------------- /ref/gl/gl_frustum.h: -------------------------------------------------------------------------------- 1 | /* 2 | gl_frustum.cpp - frustum test implementation 3 | Copyright (C) 2016 Uncle Mike 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #ifndef GL_FRUSTUM_H 17 | #define GL_FRUSTUM_H 18 | 19 | // don't change this order 20 | #define FRUSTUM_LEFT 0 21 | #define FRUSTUM_RIGHT 1 22 | #define FRUSTUM_BOTTOM 2 23 | #define FRUSTUM_TOP 3 24 | #define FRUSTUM_FAR 4 25 | #define FRUSTUM_NEAR 5 26 | #define FRUSTUM_PLANES 6 27 | 28 | typedef struct gl_frustum_s 29 | { 30 | mplane_t planes[FRUSTUM_PLANES]; 31 | unsigned int clipFlags; 32 | } gl_frustum_t; 33 | 34 | void GL_FrustumInitProj( gl_frustum_t *out, float flZNear, float flZFar, float flFovX, float flFovY ); 35 | void GL_FrustumInitOrtho( gl_frustum_t *out, float xLeft, float xRight, float yTop, float yBottom, float flZNear, float flZFar ); 36 | 37 | // cull methods 38 | qboolean GL_FrustumCullBox( gl_frustum_t *out, const vec3_t mins, const vec3_t maxs, int userClipFlags ); 39 | qboolean GL_FrustumCullSphere( gl_frustum_t *out, const vec3_t centre, float radius, int userClipFlags ); 40 | 41 | #endif//GL_FRUSTUM_H 42 | -------------------------------------------------------------------------------- /ref/gl/vgl_shim/vgl_shaders/fragment.cg.inc: -------------------------------------------------------------------------------- 1 | R""( 2 | 3 | #if ATTR_TEXCOORD0 4 | uniform sampler2D uTex0 : TEXUNIT0; 5 | #endif 6 | #if ATTR_TEXCOORD1 7 | uniform sampler2D uTex1 : TEXUNIT1; 8 | #endif 9 | #if FEAT_ALPHA_TEST 10 | uniform float uAlphaTest; 11 | #endif 12 | #if FEAT_FOG 13 | // color + density, mode always GL_EXP 14 | uniform float4 uFog; 15 | #endif 16 | 17 | float4 main( 18 | uniform float4 uColor 19 | #if ATTR_COLOR 20 | , float4 vColor : COLOR 21 | #endif 22 | #if ATTR_TEXCOORD0 23 | , float2 vTexCoord0 : TEXCOORD0 24 | #endif 25 | #if ATTR_TEXCOORD1 26 | , float2 vTexCoord1 : TEXCOORD1 27 | #endif 28 | #if ATTR_NORMAL 29 | , float3 vNormal : TEXCOORD2 30 | #endif 31 | #if FEAT_FOG 32 | , float4 vPosition : WPOS 33 | #endif 34 | ) { 35 | #if ATTR_COLOR 36 | float4 c = vColor; 37 | #else 38 | float4 c = uColor; 39 | #endif 40 | #if ATTR_TEXCOORD0 41 | c *= tex2D(uTex0, vTexCoord0); 42 | #endif 43 | #if ATTR_TEXCOORD1 44 | c *= tex2D(uTex1, vTexCoord1); 45 | #endif 46 | #if FEAT_ALPHA_TEST 47 | if (c.a <= uAlphaTest) 48 | discard; 49 | #endif 50 | #if FEAT_FOG 51 | float fogDist = vPosition.z / vPosition.w; 52 | float fogRate = clamp(exp(-uFog.w * fogDist), 0.f, 1.f); 53 | c.rgb = lerp(uFog.rgb, c.rgb, fogRate); 54 | #endif 55 | return c; 56 | } 57 | 58 | )"" 59 | -------------------------------------------------------------------------------- /ref/gl/vgl_shim/vgl_shaders/vertex.cg.inc: -------------------------------------------------------------------------------- 1 | R""( 2 | 3 | // has to be called this for VGL to fill it in automatically 4 | uniform float4x4 gl_ModelViewProjectionMatrix; 5 | 6 | void main( 7 | float3 inPosition 8 | #if ATTR_COLOR 9 | , float4 inColor 10 | #endif 11 | #if ATTR_NORMAL 12 | , float3 inNormal 13 | #endif 14 | #if ATTR_TEXCOORD0 15 | , float2 inTexCoord0 16 | #endif 17 | #if ATTR_TEXCOORD1 18 | , float2 inTexCoord1 19 | #endif 20 | , float4 out vPosition : POSITION 21 | #if ATTR_COLOR 22 | , float4 out vColor : COLOR 23 | #endif 24 | #if ATTR_TEXCOORD0 25 | , float2 out vTexCoord0 : TEXCOORD0 26 | #endif 27 | #if ATTR_TEXCOORD1 28 | , float2 out vTexCoord1 : TEXCOORD1 29 | #endif 30 | #if ATTR_NORMAL 31 | , float3 out vNormal : TEXCOORD2 32 | #endif 33 | ) { 34 | vPosition = mul(gl_ModelViewProjectionMatrix, float4(inPosition, 1.f)); 35 | #if ATTR_COLOR 36 | vColor = inColor; 37 | #endif 38 | #if ATTR_NORMAL 39 | vNormal = inNormal; 40 | #endif 41 | #if ATTR_TEXCOORD0 42 | vTexCoord0 = inTexCoord0; 43 | #endif 44 | #if ATTR_TEXCOORD1 45 | vTexCoord1 = inTexCoord1; 46 | #endif 47 | } 48 | 49 | )"" 50 | -------------------------------------------------------------------------------- /ref/gl/vgl_shim/vgl_shim.h: -------------------------------------------------------------------------------- 1 | /* 2 | vgl_shim.h - vitaGL custom immediate mode shim 3 | Copyright (C) 2023 fgsfds 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | 16 | #pragma once 17 | 18 | // max verts in a single frame 19 | #define VGL_MAX_VERTS 32768 20 | 21 | int VGL_ShimInit( void ); 22 | void VGL_ShimInstall( void ); 23 | void VGL_ShimShutdown( void ); 24 | void VGL_ShimEndFrame( void ); 25 | -------------------------------------------------------------------------------- /ref/gl/vgl_shim/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | 4 | import os 5 | 6 | def options(opt): 7 | pass 8 | 9 | def configure(conf): 10 | conf.define('REF_DLL', 1) 11 | 12 | def build(bld): 13 | bld.env.CFLAGS_cstlib.remove('-fno-PIC') 14 | bld.env.CFLAGS += ['-fPIC'] 15 | bld.stlib(source = bld.path.ant_glob('*.c'), 16 | target = 'vgl_shim', 17 | use = 'engine_includes sdk_includes werror', 18 | includes = '.') 19 | -------------------------------------------------------------------------------- /ref/null/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # mittorn, 2018 4 | 5 | def options(opt): 6 | pass 7 | 8 | def configure(conf): 9 | pass 10 | 11 | def build(bld): 12 | bld.shlib( 13 | source = 'r_context.c', 14 | target = 'ref_null', 15 | defines = 'REF_DLL', 16 | use = 'engine_includes sdk_includes werror', 17 | install_path = bld.env.LIBDIR 18 | ) 19 | -------------------------------------------------------------------------------- /ref/soft/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # mittorn, 2018 4 | 5 | from waflib import Logs 6 | import os 7 | 8 | top = '.' 9 | 10 | def options(opt): 11 | return 12 | 13 | def configure(conf): 14 | return 15 | 16 | def build(bld): 17 | libs = [ 'engine_includes', 'werror' ] 18 | # on PSVita do not link any libraries that are already in the main executable, but add the includes target 19 | if bld.env.DEST_OS == 'psvita': 20 | libs += [ 'sdk_includes' ] 21 | else: 22 | libs += [ 'public', 'M' ] 23 | 24 | bld.shlib(source = bld.path.ant_glob('*.c'), 25 | target = 'ref_soft', 26 | includes = '.', 27 | defines = 'REF_DLL=1', 28 | use = libs, 29 | install_path = bld.env.LIBDIR 30 | ) 31 | -------------------------------------------------------------------------------- /scripts/cirrus/build_freebsd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . scripts/lib.sh 4 | 5 | build_engine() 6 | { 7 | # Build engine 8 | cd "$CIRRUS_WORKING_DIR" || die 9 | 10 | ./waf configure --enable-utils --enable-all-renderers --enable-tests --enable-dedicated || die_configure 11 | ./waf build || die 12 | } 13 | 14 | rm -rf build # clean-up build directory 15 | 16 | build_engine 17 | -------------------------------------------------------------------------------- /scripts/flatpak/su.xash.Engine.Compat.i386.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=Game;Shooter; 3 | Comment=Half-Life compatible game engine 4 | Exec= 5 | Icon=su.xash.Engine.Compat.i386 6 | Keywords=first;person;shooter;multiplayer;half-life;halflife;singleplayer; 7 | Name=Xash3D FWGS 8 | PrefersNonDefaultGPU=true 9 | Terminal=false 10 | Type=Application 11 | -------------------------------------------------------------------------------- /scripts/fwgs.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/scripts/fwgs.pfx -------------------------------------------------------------------------------- /scripts/gha/build_android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | unset ANDROID_SDK_ROOT 4 | export JAVA_HOME=$GITHUB_WORKSPACE/jdk-17.0.7+7 5 | export ANDROID_HOME=$GITHUB_WORKSPACE/sdk 6 | export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin 7 | 8 | pushd android 9 | 10 | ./gradlew assembleContinuous --no-daemon || exit 1 11 | 12 | pushd app/build/outputs/apk/continuous 13 | 14 | $ANDROID_HOME/build-tools/34.0.0/apksigner sign \ 15 | --ks $GITHUB_WORKSPACE/android/debug.keystore \ 16 | --ks-key-alias androiddebugkey \ 17 | --ks-pass pass:android \ 18 | --key-pass pass:android \ 19 | --out app-continuous-signed.apk app-continuous-unsigned.apk || exit 1 20 | 21 | popd 22 | popd 23 | 24 | mkdir -p artifacts/ 25 | 26 | mv android/app/build/outputs/apk/continuous/app-continuous-signed.apk artifacts/xash3d-fwgs-android.apk 27 | tar -cJvf artifacts/xash3d-fwgs-android-mappings.tar.zst -C android/app/build/outputs/mapping/continuous '.' 28 | 29 | -------------------------------------------------------------------------------- /scripts/gha/build_apple.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . scripts/lib.sh 4 | 5 | cd $GITHUB_WORKSPACE || die 6 | 7 | pushd hlsdk || die 8 | ./waf configure build install --destdir=../bin || die 9 | popd 10 | 11 | ./waf configure --enable-utils --enable-tests --enable-lto --enable-tui build install --destdir=bin || die_configure 12 | 13 | cp -vr /Library/Frameworks/SDL2.framework bin 14 | 15 | mkdir -p artifacts/ 16 | tar -cJvf artifacts/xash3d-fwgs-apple-$ARCH.tar.xz -C bin . # skip the bin directory from resulting tar archive 17 | -------------------------------------------------------------------------------- /scripts/gha/build_linux-e2k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | . scripts/lib.sh 6 | . scripts/lib-e2k.sh 7 | 8 | export CC=${E2K_CROSS_COMPILER_PATH[$GH_CPU_ARCH]}/bin/lcc 9 | export CXX=${E2K_CROSS_COMPILER_PATH[$GH_CPU_ARCH]}/bin/l++ 10 | 11 | APP=xash3d-fwgs 12 | 13 | APPDIR=$APP-linux-$ARCH # FIXME: not conforms to libpublic's build arch strings but in parity with xashds directory name 14 | APPTARGZ=$APP-linux-$ARCH.tar.gz 15 | 16 | DS=xashds-linux 17 | DSDIR=$DS-$ARCH 18 | DSTARGZ=$DS-$ARCH.tar.gz 19 | 20 | build_engine() 21 | { 22 | # Build engine 23 | cd "$BUILDDIR" 24 | 25 | ./waf configure --enable-dedicated -s usr --enable-stbtt --enable-utils --enable-bundled-deps --enable-all-renderers || die_configure 26 | ./waf build || die_configure 27 | } 28 | 29 | make_client_tarball() 30 | { 31 | cd "$BUILDDIR" 32 | ./waf install --destdir="$APPDIR" 33 | tar -czvf "artifacts/$APPTARGZ" "$APPDIR" 34 | } 35 | 36 | make_server_tarball() 37 | { 38 | cd "$BUILDDIR" 39 | 40 | # FIXME: make an option for Waf to only install dedicated 41 | mkdir -p "$DSDIR" 42 | cp -v "$APPDIR"/xash "$APPDIR"/filesystem_stdio.so "$DSDIR" 43 | tar -czvf "artifacts/$DSTARGZ" "$DSDIR" 44 | } 45 | 46 | mkdir -p artifacts/ 47 | 48 | rm -rf build # clean-up build directory 49 | build_engine 50 | 51 | make_client_tarball 52 | make_server_tarball 53 | -------------------------------------------------------------------------------- /scripts/gha/build_motomagx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . scripts/lib.sh 4 | . /opt/toolchains/motomagx/setenv-z6.sh 5 | 6 | cd $GITHUB_WORKSPACE || die 7 | 8 | mkdir -p Xash/valve/cl_dlls 9 | mkdir -p Xash/valve/dlls 10 | 11 | pushd hlsdk || die 12 | ./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash || die 13 | popd 14 | 15 | ./waf configure -T fast --enable-magx build install --destdir=Xash/ || die 16 | 17 | cat > Xash/run.sh << 'EOF' 18 | mypath=${0%/*} 19 | LIBDIR1=/ezxlocal/download/mystuff/games/lib 20 | LIBDIR2=/mmc/mmca1/games/lib 21 | LIBDIR3=$mypath 22 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBDIR1:$LIBDIR2:$LIBDIR3 23 | export HOME=$mypath 24 | export SDL_QT_INVERT_ROTATION=1 25 | export SWAP_PATH=$HOME/xash.swap 26 | cd $mypath 27 | sleep 1 28 | 29 | exec $mypath/xash -dev $@ 30 | EOF 31 | 32 | mkdir -p artifacts/ 33 | 7z a -t7z artifacts/xash3d-fwgs-magx.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r Xash/ 34 | -------------------------------------------------------------------------------- /scripts/gha/build_nswitch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . scripts/lib.sh 4 | 5 | cd "$BUILDDIR" || die 6 | 7 | rm -rf artifacts build pkgtemp 8 | 9 | mkdir -p pkgtemp/xash3d/{valve,gearbox,bshift}/{dlls,cl_dlls} || die 10 | mkdir -p artifacts/ || die 11 | 12 | echo "Running build script in Docker container..." 13 | 14 | docker run --name xash-build --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./scripts/gha/build_nswitch_docker.sh || die 15 | 16 | echo "Packaging artifacts..." 17 | 18 | pushd pkgtemp || die 19 | 7z a -t7z ../artifacts/xash3d-fwgs-nswitch.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r xash3d/ 20 | popd 21 | -------------------------------------------------------------------------------- /scripts/gha/build_win32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . scripts/lib.sh 4 | 5 | # Build engine 6 | cd $BUILDDIR 7 | 8 | if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs 9 | AMD64="-8" 10 | fi 11 | 12 | # NOTE: to build with other version use --msvc_version during configuration 13 | # NOTE: sometimes you may need to add WinSDK to %PATH% 14 | # NOTE: --enable-msvcdeps only used for CI builds, enabling it non-English versions of MSVC causes useless console spam 15 | ./waf.bat configure -s "SDL2_VC" -T release --enable-utils --enable-tests --enable-lto --enable-msvcdeps --enable-tui $AMD64 || die_configure 16 | ./waf.bat build || die 17 | ./waf.bat install --destdir=. || die 18 | 19 | if [ "$ARCH" = "i386" ]; then 20 | cp SDL2_VC/lib/x86/SDL2.dll . # Install SDL2 21 | cp SDL2_VC/lib/x86/SDL2.pdb . 22 | elif [ "$ARCH" = "amd64" ]; then 23 | cp SDL2_VC/lib/x64/SDL2.dll . 24 | cp SDL2_VC/lib/x64/SDL2.pdb . 25 | else 26 | die 27 | fi 28 | 29 | WINSDK_LATEST=$(ls -1 "C:/Program Files (x86)/Windows Kits/10/bin" | grep -E '^10' | sort -rV | head -n1) 30 | echo "Latest installed Windows SDK is $WINSDK_LATEST" 31 | 32 | "C:/Program Files (x86)/Windows Kits/10/bin/$WINSDK_LATEST/x64/signtool.exe" \ 33 | sign //f scripts/fwgs.pfx //fd SHA256 //p "$FWGS_PFX_PASSWORD" *.dll *.exe 34 | 35 | if [ "$ARCH" = "i386" ]; then # VGUI is already signed 36 | cp 3rdparty/vgui_support/vgui-dev/lib/win32_vc6/vgui.dll . 37 | fi 38 | 39 | mkdir -p artifacts/ 40 | 7z a -t7z artifacts/xash3d-fwgs-win32-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on \ 41 | *.dll *.exe *.pdb activities.txt \ 42 | valve/ 43 | -------------------------------------------------------------------------------- /scripts/gha/deps_android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $GITHUB_WORKSPACE 4 | 5 | ANDROID_COMMANDLINE_TOOLS_VER="11076708" 6 | ANDROID_BUILD_TOOLS_VER="34.0.0" 7 | ANDROID_PLATFORM_VER="android-34" 8 | 9 | echo "Download JDK 17" 10 | wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz -qO- | tar -xzf - || exit 1 11 | export JAVA_HOME=$GITHUB_WORKSPACE/jdk-17.0.7+7 12 | export PATH=$PATH:$JAVA_HOME/bin 13 | 14 | echo "Download hlsdk-portable" 15 | git clone --depth 1 --recursive https://github.com/FWGS/hlsdk-portable -b mobile_hacks 3rdparty/hlsdk-portable || exit 1 16 | 17 | echo "Download SDL" 18 | pushd 3rdparty 19 | wget https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.tar.gz -qO- | tar -xzf - || exit 1 20 | mv SDL2-$SDL_VERSION SDL 21 | popd 22 | 23 | echo "Download Android SDK" 24 | mkdir -p sdk || exit 1 25 | pushd sdk 26 | wget https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_COMMANDLINE_TOOLS_VER}_latest.zip -qO sdk.zip || exit 1 27 | unzip -q sdk.zip || exit 1 28 | mv cmdline-tools tools 29 | mkdir -p cmdline-tools 30 | mv tools cmdline-tools/tools 31 | unset ANDROID_SDK_ROOT 32 | export ANDROID_HOME=$GITHUB_WORKSPACE/sdk 33 | export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin 34 | popd 35 | 36 | echo "Download all needed tools and Android NDK" 37 | yes | sdkmanager --licenses > /dev/null 2>/dev/null # who even reads licenses? :) 38 | sdkmanager --install build-tools\;${ANDROID_BUILD_TOOLS_VER} platform-tools platforms\;${ANDROID_PLATFORM_VER} 39 | -------------------------------------------------------------------------------- /scripts/gha/deps_apple.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $GITHUB_WORKSPACE 4 | 5 | wget https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.dmg -O SDL2.dmg 6 | hdiutil mount SDL2.dmg 7 | sudo cp -vr /Volumes/SDL2/SDL2.framework /Library/Frameworks 8 | 9 | git clone https://github.com/FWGS/hlsdk-portable hlsdk --depth=1 10 | -------------------------------------------------------------------------------- /scripts/gha/deps_linux-e2k.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cd "$GITHUB_WORKSPACE" 6 | 7 | . scripts/lib-e2k.sh 8 | 9 | wget "${E2K_CROSS_COMPILER_URL[$GH_CPU_ARCH]}" -O- | sudo tar -C / -xzvf - 10 | 11 | for i in ${E2K_PACKAGES_URLS[$GH_CPU_ARCH]}; do 12 | wget "$i" -O package.deb 13 | ar x package.deb data.tar.xz 14 | tar -xvf data.tar.xz 15 | rm package.deb data.tar.xz 16 | done 17 | -------------------------------------------------------------------------------- /scripts/gha/deps_motomagx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $GITHUB_WORKSPACE 4 | 5 | sudo dpkg --add-architecture i386 6 | sudo apt update 7 | sudo apt install libc6:i386 libstdc++6:i386 gcc-multilib g++-multilib p7zip-full 8 | 9 | sudo mkdir -p /opt/toolchains 10 | 11 | pushd /opt/toolchains/ 12 | sudo git clone https://github.com/a1batross/motomagx_toolchain motomagx --depth=1 13 | popd 14 | 15 | git clone https://github.com/FWGS/hlsdk-xash3d hlsdk -b mobile_hacks --depth=1 16 | -------------------------------------------------------------------------------- /scripts/gha/deps_nswitch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $GITHUB_WORKSPACE 4 | 5 | echo "Downloading devkitA64 docker container..." 6 | 7 | docker pull devkitpro/devkita64:latest || exit 1 8 | 9 | echo "Downloading libsolder..." 10 | 11 | rm -rf libsolder 12 | git clone https://github.com/fgsfdsfgs/libsolder.git --depth=1 || exit 1 13 | 14 | echo "Downloading HLSDK..." 15 | 16 | rm -rf hlsdk-xash3d hlsdk-portable 17 | git clone --recursive https://github.com/FWGS/hlsdk-portable || exit 1 18 | -------------------------------------------------------------------------------- /scripts/gha/deps_psvita.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $GITHUB_WORKSPACE 4 | 5 | # pinning cmake version to 3.28.3, because with cmake 4.x SDL vita fork doesn't building 6 | # it is known problem and cmake 4.x update breaks many CI pipelines around the world :) 7 | sudo apt-get update || exit 1 8 | sudo apt-get install cmake=3.28.3-1build7 9 | sudo ln -sf /usr/bin/cmake /usr/local/bin/cmake 10 | 11 | echo "Downloading vitasdk..." 12 | 13 | export VITASDK=/usr/local/vitasdk 14 | 15 | VITAGL_SRCREV="064db9efb15833e18777a3e768b8b1fb2abee78f" # lock vitaGL version to avoid compilation errors 16 | 17 | install_package() 18 | { 19 | ./vdpm $1 || exit 1 20 | } 21 | 22 | git clone https://github.com/vitasdk/vdpm.git --depth=1 || exit 1 23 | pushd vdpm 24 | ./bootstrap-vitasdk.sh || exit 1 25 | install_package taihen 26 | install_package kubridge 27 | install_package zlib 28 | install_package SceShaccCgExt 29 | install_package vitaShaRK 30 | install_package libmathneon 31 | popd 32 | 33 | echo "Downloading vitaGL..." 34 | 35 | git clone https://github.com/Rinnegatamante/vitaGL.git || exit 1 36 | pushd vitaGL 37 | git checkout $VITAGL_SRCREV || exit 1 38 | popd 39 | 40 | echo "Downloading vitaGL fork of SDL2..." 41 | 42 | git clone https://github.com/Northfear/SDL.git --depth=1 || exit 1 43 | 44 | echo "Downloading vita-rtld..." 45 | 46 | git clone https://github.com/fgsfdsfgs/vita-rtld.git --depth=1 || exit 1 47 | 48 | echo "Downloading HLSDK..." 49 | 50 | rm -rf hlsdk-xash3d hlsdk-portable 51 | git clone --recursive https://github.com/FWGS/hlsdk-portable || exit 1 52 | -------------------------------------------------------------------------------- /scripts/gha/deps_win32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-devel-$SDL_VERSION-VC.zip -o SDL2.zip 4 | unzip -q SDL2.zip 5 | mv SDL2-$SDL_VERSION SDL2_VC 6 | 7 | if [ "$GH_CPU_ARCH" = "i386" ]; then 8 | rustup target add i686-pc-windows-msvc 9 | fi 10 | -------------------------------------------------------------------------------- /scripts/gha/linux/AppRun: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$XASH3D_BASEDIR" = "" ]; then 4 | export XASH3D_BASEDIR="$PWD" 5 | fi 6 | echo "Xash3D FWGS installed as AppImage." 7 | echo "Base directory is $XASH3D_BASEDIR. Set XASH3D_BASEDIR environment variable to override this." 8 | 9 | export XASH3D_EXTRAS_PAK1="${APPDIR}/valve/extras.pk3" 10 | exec $DEBUGGER "${APPDIR}/xash3d" "$@" 11 | -------------------------------------------------------------------------------- /scripts/gha/linux/xash3d-fwgs.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=Game;Shooter; 3 | Comment=Half-Life compatible game engine 4 | Exec=AppRun 5 | Icon=xash3d-fwgs 6 | Keywords=first;person;shooter;multiplayer;half-life;halflife;singleplayer; 7 | Name=Xash3D FWGS 8 | # Doesn't pass validation with old desktop-file-utils 9 | #PrefersNonDefaultGPU=true 10 | Terminal=false 11 | Type=Application 12 | -------------------------------------------------------------------------------- /scripts/lib.sh: -------------------------------------------------------------------------------- 1 | die() 2 | { 3 | exit 1 4 | } 5 | 6 | die_configure() 7 | { 8 | cat build/config.log 9 | die 10 | } 11 | 12 | if [ -n "$TRAVIS_BUILD_DIR" ]; then 13 | BUILDDIR=$TRAVIS_BUILD_DIR 14 | elif [ -n "$GITHUB_WORKSPACE" ]; then 15 | BUILDDIR=$GITHUB_WORKSPACE 16 | fi 17 | 18 | if [ -n "$TRAVIS_CPU_ARCH" ]; then 19 | ARCH=$TRAVIS_CPU_ARCH 20 | elif [ -n "$GH_CPU_ARCH" ]; then 21 | ARCH=$GH_CPU_ARCH 22 | fi 23 | -------------------------------------------------------------------------------- /scripts/makepak.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import sys 3 | import struct 4 | import os 5 | 6 | #dummy class for stuffing the file headers into 7 | class FileEntry: 8 | pass 9 | 10 | #arguments are source directory, then target filename e.g. "pak1.pak" 11 | rootdir = sys.argv[1] 12 | pakfilename = sys.argv[2] 13 | 14 | pakfile = open(pakfilename,"wb") 15 | 16 | #write a dummy header to start with 17 | pakfile.write(struct.Struct("<4s2l").pack(b"PACK",0,0)) 18 | 19 | #walk the directory recursively, add the files and record the file entries 20 | offset = 12 21 | fileentries = [] 22 | for root, subFolders, files in os.walk(rootdir): 23 | for file in files: 24 | entry = FileEntry() 25 | impfilename = os.path.join(root,file) 26 | entry.filename = os.path.relpath(impfilename,rootdir).replace("\\","/") 27 | if(entry.filename.startswith(".")):continue 28 | print("pak: "+entry.filename) 29 | with open(impfilename, "rb") as importfile: 30 | pakfile.write(importfile.read()) 31 | entry.offset = offset 32 | entry.length = importfile.tell() 33 | offset = offset + entry.length 34 | fileentries.append(entry) 35 | tablesize = 0 36 | 37 | #after all the file data, write the list of entries 38 | for entry in fileentries: 39 | pakfile.write(struct.Struct("<56s").pack(entry.filename.encode("ascii"))) 40 | pakfile.write(struct.Struct(" 8 | LDFLAGS ?= -Wl,--no-undefined 9 | 10 | SYS = $(shell $(CC) -dumpmachine) 11 | 12 | ifneq (, $(findstring mingw, $(SYS))) 13 | EXT = .exe 14 | CFLAGS += -DHAVE_STRICMP -DHAVE_STRNICMP 15 | else 16 | EXT = 17 | CFLAGS += -DHAVE_STRCASECMP -DHAVE_STRNCASECMP 18 | endif 19 | 20 | APP = $(MODULE)$(EXT) 21 | 22 | SRC = mdldec.c \ 23 | qc.c \ 24 | smd.c \ 25 | texture.c \ 26 | utils.c \ 27 | ../../public/xash3d_mathlib.c \ 28 | ../../public/matrixlib.c \ 29 | ../../public/crtlib.c \ 30 | ../../public/getopt.c 31 | 32 | INCLUDE = -I. \ 33 | -I../../common \ 34 | -I../../engine \ 35 | -I../../engine/common \ 36 | -I../../engine/common/imagelib \ 37 | -I../../public 38 | 39 | LIBS = -lm 40 | 41 | OBJS = $(SRC:%.c=%.o) 42 | 43 | all: $(APP) 44 | 45 | $(APP): $(OBJS) 46 | $(CC) $(LDFLAGS) -o $(APP) $(OBJS) $(LIBS) 47 | 48 | .c.o: 49 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ 50 | 51 | .PHONY: all clean 52 | 53 | clean: 54 | $(RM) $(OBJS) 55 | $(RM) $(APP) 56 | -------------------------------------------------------------------------------- /utils/mdldec/mdldec.h: -------------------------------------------------------------------------------- 1 | /* 2 | mdldec.h - Half-Life Studio Model Decompiler 3 | Copyright (C) 2020 Andrey Akhmichin 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef MDLDEC_H 17 | #define MDLDEC_H 18 | 19 | extern char destdir[MAX_SYSPATH]; 20 | extern char modelfile[MAX_SYSPATH]; 21 | extern studiohdr_t *model_hdr; 22 | extern studiohdr_t *texture_hdr; 23 | extern studiohdr_t **anim_hdr; 24 | 25 | #endif // MDLDEC_H 26 | 27 | -------------------------------------------------------------------------------- /utils/mdldec/qc.h: -------------------------------------------------------------------------------- 1 | /* 2 | qc.h - Quake C script writer 3 | Copyright (C) 2020 Andrey Akhmichin 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef QC_H 17 | #define QC_H 18 | 19 | #define DEFAULT_SEQGROUPSIZE 64 20 | #define ACTIVITIES_FILE "activities.txt" 21 | 22 | qboolean LoadActivityList( const char *appname ); 23 | void WriteQCScript( void ); 24 | 25 | #endif // QC_H 26 | 27 | -------------------------------------------------------------------------------- /utils/mdldec/res/activities.txt: -------------------------------------------------------------------------------- 1 | ACT_RESET 2 | ACT_IDLE 3 | ACT_GUARD 4 | ACT_WALK 5 | ACT_RUN 6 | ACT_FLY 7 | ACT_SWIM 8 | ACT_HOP 9 | ACT_LEAP 10 | ACT_FALL 11 | ACT_LAND 12 | ACT_STRAFE_LEFT 13 | ACT_STRAFE_RIGHT 14 | ACT_ROLL_LEFT 15 | ACT_ROLL_RIGHT 16 | ACT_TURN_LEFT 17 | ACT_TURN_RIGHT 18 | ACT_CROUCH 19 | ACT_CROUCHIDLE 20 | ACT_STAND 21 | ACT_USE 22 | ACT_SIGNAL1 23 | ACT_SIGNAL2 24 | ACT_SIGNAL3 25 | ACT_TWITCH 26 | ACT_COWER 27 | ACT_SMALL_FLINCH 28 | ACT_BIG_FLINCH 29 | ACT_RANGE_ATTACK1 30 | ACT_RANGE_ATTACK2 31 | ACT_MELEE_ATTACK1 32 | ACT_MELEE_ATTACK2 33 | ACT_RELOAD 34 | ACT_ARM 35 | ACT_DISARM 36 | ACT_EAT 37 | ACT_DIESIMPLE 38 | ACT_DIEBACKWARD 39 | ACT_DIEFORWARD 40 | ACT_DIEVIOLENT 41 | ACT_BARNACLE_HIT 42 | ACT_BARNACLE_PULL 43 | ACT_BARNACLE_CHOMP 44 | ACT_BARNACLE_CHEW 45 | ACT_SLEEP 46 | ACT_INSPECT_FLOOR 47 | ACT_INSPECT_WALL 48 | ACT_IDLE_ANGRY 49 | ACT_WALK_HURT 50 | ACT_RUN_HURT 51 | ACT_HOVER 52 | ACT_GLIDE 53 | ACT_FLY_LEFT 54 | ACT_FLY_RIGHT 55 | ACT_DETECT_SCENT 56 | ACT_SNIFF 57 | ACT_BITE 58 | ACT_THREAT_DISPLAY 59 | ACT_FEAR_DISPLAY 60 | ACT_EXCITED 61 | ACT_SPECIAL_ATTACK1 62 | ACT_SPECIAL_ATTACK2 63 | ACT_COMBAT_IDLE 64 | ACT_WALK_SCARED 65 | ACT_RUN_SCARED 66 | ACT_VICTORY_DANCE 67 | ACT_DIE_HEADSHOT 68 | ACT_DIE_CHESTSHOT 69 | ACT_DIE_GUTSHOT 70 | ACT_DIE_BACKSHOT 71 | ACT_FLINCH_HEAD 72 | ACT_FLINCH_CHEST 73 | ACT_FLINCH_STOMACH 74 | ACT_FLINCH_LEFTARM 75 | ACT_FLINCH_RIGHTARM 76 | ACT_FLINCH_LEFTLEG 77 | ACT_FLINCH_RIGHTLEG 78 | -------------------------------------------------------------------------------- /utils/mdldec/settings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SETTINGS_H 3 | #define SETTINGS_H 4 | 5 | extern int globalsettings; 6 | 7 | enum 8 | { 9 | SETTINGS_LEGACYMOTION = BIT(0), 10 | SETTINGS_UVSHIFTING = BIT(1), 11 | SETTINGS_NOLOGS = BIT(2), 12 | SETTINGS_NOVALIDATION = BIT(3), 13 | SETTINGS_SEPARATEANIMSFOLDER = BIT(4), 14 | SETTINGS_SEPARATETEXTURESFOLDER = BIT(5), 15 | }; 16 | 17 | #endif // SETTINGS_H 18 | -------------------------------------------------------------------------------- /utils/mdldec/smd.h: -------------------------------------------------------------------------------- 1 | /* 2 | smd.h - Studio Model Data format writer 3 | Copyright (C) 2020 Andrey Akhmichin 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef SMD_H 17 | #define SMD_H 18 | 19 | #define SEQUENCEPATH "anims/" 20 | 21 | void WriteSMD( void ); 22 | 23 | #endif // SMD_H 24 | 25 | -------------------------------------------------------------------------------- /utils/mdldec/texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | texture.h - texture writer 3 | Copyright (C) 2020 Andrey Akhmichin 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef TEXTURE_H 17 | #define TEXTURE_H 18 | 19 | #define TEXTUREPATH "textures/" 20 | 21 | void WriteTextures( void ); 22 | 23 | #endif // TEXTURE_H 24 | 25 | -------------------------------------------------------------------------------- /utils/mdldec/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | utils.h - Useful helper functions 3 | Copyright (C) 2020 Andrey Akhmichin 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | */ 15 | #pragma once 16 | #ifndef UTILS_H 17 | #define UTILS_H 18 | 19 | qboolean MakeDirectory( const char *path ); 20 | qboolean MakeFullPath( const char *path ); 21 | void ExtractFileName( char *name, size_t size ); 22 | off_t GetSizeOfFile( FILE *fp ); 23 | byte *LoadFile( const char *filename, off_t *size ); 24 | void LogPutS( const char *str ); 25 | void LogPrintf( const char *szFmt, ... ); 26 | 27 | #endif // UTILS_H 28 | 29 | -------------------------------------------------------------------------------- /utils/mdldec/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef VERSION_H 3 | #define VERSION_H 4 | 5 | #define APP_VERSION "1.2" 6 | 7 | #endif // VERSION_H 8 | 9 | -------------------------------------------------------------------------------- /utils/mdldec/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # a1batross, mittorn, 2018 4 | 5 | def options(opt): 6 | # TODO: any options for mdldec? 7 | grp = opt.get_option_group('Utilities options') 8 | 9 | grp.add_option('--disable-utils-mdldec', action = 'store_true', dest = 'DISABLE_UTILS_MDLDEC', default = False, 10 | help = 'disable studio model decompiler utility [default: %(default)s]') 11 | 12 | def configure(conf): 13 | conf.env.DISABLE_UTILS_MDLDEC = conf.options.DISABLE_UTILS_MDLDEC 14 | 15 | def build(bld): 16 | if bld.env.DISABLE_UTILS_MDLDEC: 17 | return 18 | 19 | bld.program(source = bld.path.ant_glob('*.c'), 20 | target = 'mdldec', 21 | includes = '.', 22 | use = 'engine_includes public M werror', 23 | install_path = bld.env.BINDIR, 24 | subsystem = bld.env.CONSOLE_SUBSYSTEM 25 | ) 26 | 27 | bld.install_files(bld.env.SHAREDIR, 'res/activities.txt') 28 | -------------------------------------------------------------------------------- /utils/run-fuzzer/run-fuzzer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #if !defined LIB || !defined FUNC 6 | #error 7 | #endif 8 | 9 | typedef int (*FuzzFunc)(const char *Data, size_t Size); 10 | 11 | void *handle = NULL; 12 | FuzzFunc f = NULL; 13 | 14 | int LLVMFuzzerTestOneInput( const char *Data, size_t Size ) 15 | { 16 | if( !handle ) 17 | handle = dlopen( LIB, RTLD_NOW ); 18 | 19 | if( handle ) 20 | { 21 | if( !f ) 22 | f = dlsym( handle, FUNC ); 23 | 24 | if( f ) 25 | { 26 | return f( Data, Size ); 27 | } 28 | } 29 | 30 | fprintf( stderr, "Fail: %s\n", dlerror() ); 31 | 32 | abort(); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /utils/run-fuzzer/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # a1batross, mittorn, 2018 4 | 5 | def options(opt): 6 | pass 7 | 8 | def configure(conf): 9 | if conf.options.BUILD_TYPE not in ['sanitize', 'asan']: 10 | conf.fatal('useless without -T sanitize') 11 | 12 | if conf.env.COMPILER_CC != 'clang': 13 | conf.fatal('only clang is supported') 14 | 15 | conf.env.append_unique('CFLAGS', '-fsanitize=fuzzer') 16 | conf.env.append_unique('LINKFLAGS', '-fsanitize=fuzzer') 17 | 18 | def add_runner_target(bld, lib, func): 19 | source = bld.path.ant_glob('*.c') 20 | includes = '.' 21 | 22 | bld.program( 23 | source = source, 24 | target = 'run-fuzzer-' + func, 25 | includes = includes, 26 | use = 'DL werror', 27 | defines = ['FUNC="Fuzz_' + func + '"', 'LIB="' + lib + '"'], 28 | install_path = bld.env.BINDIR, 29 | subsystem = bld.env.CONSOLE_SUBSYSTEM 30 | ) 31 | 32 | def build(bld): 33 | add_runner_target(bld, 'libxash.so', 'Sound_LoadMPG') 34 | add_runner_target(bld, 'libxash.so', 'Sound_ParseID3Tag') 35 | add_runner_target(bld, 'libxash.so', 'Sound_LoadWAV') 36 | add_runner_target(bld, 'libxash.so', 'Image_LoadBMP') 37 | add_runner_target(bld, 'libxash.so', 'Image_LoadPNG') 38 | add_runner_target(bld, 'libxash.so', 'Image_LoadDDS') 39 | add_runner_target(bld, 'libxash.so', 'Image_LoadTGA') 40 | add_runner_target(bld, 'libxash.so', 'Mod_LoadModel') 41 | -------------------------------------------------------------------------------- /utils/xar/wscript: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # a1batross, mittorn, 2018 4 | 5 | def options(opt): 6 | pass 7 | 8 | def configure(conf): 9 | pass 10 | 11 | def build(bld): 12 | bld.program(source = bld.path.ant_glob('*.c'), 13 | target = 'xar', 14 | includes = '.', 15 | use = 'public filesystem_includes werror', 16 | rpath = bld.env.DEFAULT_RPATH, 17 | install_path = bld.env.BINDIR, 18 | subsystem = bld.env.CONSOLE_SUBSYSTEM 19 | ) 20 | -------------------------------------------------------------------------------- /waf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FWGS/xash3d-fwgs/05edde050d9df71c215884cd3a6a7f4c2c0c481a/waf --------------------------------------------------------------------------------