Compare commits
1 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
989958e185 |
@@ -7,7 +7,8 @@ task:
|
|||||||
- pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace
|
- pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
- ./scripts/cirrus/build_freebsd.sh
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: freebsd-15-amd64
|
name: freebsd-15-amd64
|
||||||
@@ -18,4 +19,5 @@ task:
|
|||||||
- pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace
|
- pkg install -y pkgconf git sdl2 python fontconfig libvorbis opusfile bzip2 libbacktrace
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
- ./scripts/cirrus/build_freebsd.sh
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|||||||
24
.github/workflows/c-cpp.yml
vendored
@@ -15,39 +15,35 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
# Linux build specifically want oldest Ubuntu as possible
|
# Linux build specifically want oldest Ubuntu as possible
|
||||||
# to be crossdistribution compatible, otherwise use ubuntu-latest
|
# to be crossdistribution compatible, otherwise use ubuntu-latest
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: i386
|
targetarch: i386
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: arm64
|
targetarch: arm64
|
||||||
cross: true
|
cross: true
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: armhf
|
targetarch: armhf
|
||||||
cross: true
|
cross: true
|
||||||
- os: ubuntu-24.04 # riscv64 would benefit from having latest compilers
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: riscv64
|
targetarch: riscv64
|
||||||
cross: true
|
cross: true
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
targetos: linux
|
||||||
targetarch: ppc64el
|
targetarch: ppc64el
|
||||||
cross: true
|
cross: true
|
||||||
# - os: ubuntu-aarch64-22.04
|
# - os: ubuntu-aarch64-20.04
|
||||||
# targetos: linux
|
# targetos: linux
|
||||||
# targetarch: aarch64
|
# targetarch: aarch64
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
targetos: linux
|
|
||||||
targetarch: e2k-8c
|
|
||||||
cross: true
|
|
||||||
- os: ubuntu-latest
|
|
||||||
targetos: android
|
targetos: android
|
||||||
targetarch: multiarch
|
targetarch: multiarch
|
||||||
# - os: ubuntu-22.04
|
# - os: ubuntu-20.04
|
||||||
# targetos: motomagx
|
# targetos: motomagx
|
||||||
# targetarch: armv6
|
# targetarch: armv6
|
||||||
|
|
||||||
@@ -70,7 +66,7 @@ jobs:
|
|||||||
targetos: apple
|
targetos: apple
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
env:
|
env:
|
||||||
SDL_VERSION: 2.32.0
|
SDL_VERSION: 2.30.12
|
||||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
GH_CROSSCOMPILING: ${{ matrix.cross }}
|
GH_CROSSCOMPILING: ${{ matrix.cross }}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
9
.gitmodules
vendored
@@ -27,16 +27,13 @@
|
|||||||
url = https://github.com/FWGS/MultiEmulator
|
url = https://github.com/FWGS/MultiEmulator
|
||||||
[submodule "3rdparty/libogg/libogg"]
|
[submodule "3rdparty/libogg/libogg"]
|
||||||
path = 3rdparty/libogg/libogg
|
path = 3rdparty/libogg/libogg
|
||||||
url = https://github.com/xiph/ogg.git
|
url = https://gitlab.xiph.org/xiph/ogg.git
|
||||||
[submodule "3rdparty/vorbis/vorbis-src"]
|
[submodule "3rdparty/vorbis/vorbis-src"]
|
||||||
path = 3rdparty/vorbis/vorbis-src
|
path = 3rdparty/vorbis/vorbis-src
|
||||||
url = https://github.com/xiph/vorbis.git
|
url = https://gitlab.xiph.org/xiph/vorbis.git
|
||||||
[submodule "3rdparty/opusfile/opusfile"]
|
[submodule "3rdparty/opusfile/opusfile"]
|
||||||
path = 3rdparty/opusfile/opusfile
|
path = 3rdparty/opusfile/opusfile
|
||||||
url = https://github.com/xiph/opusfile.git
|
url = https://gitlab.xiph.org/xiph/opusfile.git
|
||||||
[submodule "3rdparty/libbacktrace/libbacktrace"]
|
[submodule "3rdparty/libbacktrace/libbacktrace"]
|
||||||
path = 3rdparty/libbacktrace/libbacktrace
|
path = 3rdparty/libbacktrace/libbacktrace
|
||||||
url = https://github.com/ianlancetaylor/libbacktrace
|
url = https://github.com/ianlancetaylor/libbacktrace
|
||||||
[submodule "3rdparty/maintui"]
|
|
||||||
path = 3rdparty/maintui
|
|
||||||
url = https://github.com/numas13/xash3d-maintui.git
|
|
||||||
|
|||||||
2
3rdparty/MultiEmulator
vendored
2
3rdparty/extras/xash-extras
vendored
2
3rdparty/gl4es/gl4es
vendored
6
3rdparty/libbacktrace/wscript
vendored
@@ -2,7 +2,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from waflib import TaskGen
|
from waflib import TaskGen
|
||||||
from waflib.Tools.c_config import DEFKEYS
|
|
||||||
|
|
||||||
FRAGMENT_ATOMIC='''int i;
|
FRAGMENT_ATOMIC='''int i;
|
||||||
int main(void) {
|
int main(void) {
|
||||||
@@ -139,8 +138,6 @@ def configure(conf):
|
|||||||
msg='Checking for in parallel'
|
msg='Checking for in parallel'
|
||||||
)
|
)
|
||||||
|
|
||||||
conf.env[DEFKEYS].sort()
|
|
||||||
|
|
||||||
conf.write_config_header()
|
conf.write_config_header()
|
||||||
|
|
||||||
conf.define('BACKTRACE_SUPPORTED', 1)
|
conf.define('BACKTRACE_SUPPORTED', 1)
|
||||||
@@ -151,7 +148,8 @@ def configure(conf):
|
|||||||
conf.write_config_header('backtrace-supported.h')
|
conf.write_config_header('backtrace-supported.h')
|
||||||
|
|
||||||
@TaskGen.feature('frandomseed')
|
@TaskGen.feature('frandomseed')
|
||||||
@TaskGen.after_method('propagate_uselib_vars')
|
@TaskGen.after_method('process_source')
|
||||||
|
@TaskGen.before_method('apply_link')
|
||||||
def process_frandom_seed(ctx):
|
def process_frandom_seed(ctx):
|
||||||
tasks = getattr(ctx, 'compiled_tasks', [])
|
tasks = getattr(ctx, 'compiled_tasks', [])
|
||||||
|
|
||||||
|
|||||||
1
3rdparty/maintui
vendored
2
3rdparty/mainui
vendored
@@ -2,27 +2,23 @@
|
|||||||
|
|
||||||
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
||||||
|
|
||||||
## [a1batross](https://github.com/a1batross)
|
### [a1batross](https://github.com/a1batross)
|
||||||
|
|
||||||
Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
* Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
||||||
|
* Boosty page: https://boosty.to/a1ba
|
||||||
|
|
||||||
* [Boosty page](https://boosty.to/a1ba)
|
### [nekonomicon](https://github.com/nekonomicon)
|
||||||
|
|
||||||
## [nekonomicon](https://github.com/nekonomicon)
|
* [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).
|
||||||
|
* Boosty page: https://boosty.to/nekonomicon
|
||||||
|
|
||||||
[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).
|
### [Velaron](https://github.com/Velaron)
|
||||||
|
* [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).
|
||||||
|
* BuyMeACoffee page: https://www.buymeacoffee.com/velaron
|
||||||
|
|
||||||
* [Boosty page](https://boosty.to/nekonomicon)
|
### [SNMetamorph](https://github.com/SNMetamorph)
|
||||||
|
* [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).
|
||||||
## [Velaron](https://github.com/Velaron)
|
* BTC: `16GAzK3qei5AwBW7sggXp3yNcFHBtdpxXj`
|
||||||
|
* ETH (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
[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).
|
* USDT (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
|
* USDC (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
* [BuyMeACoffee page](https://www.buymeacoffee.com/velaron)
|
|
||||||
|
|
||||||
## [SNMetamorph](https://github.com/SNMetamorph)
|
|
||||||
|
|
||||||
[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).
|
|
||||||
|
|
||||||
* [Boosty page](https://boosty.to/snmetamorph)
|
|
||||||
* [Other donation methods](https://snmetamorph.github.io/donate)
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
@@ -2,19 +2,10 @@
|
|||||||
|
|
||||||
|Name |Version |Why not working |What was made for that
|
|Name |Version |Why not working |What was made for that
|
||||||
|---- |------- |--------------- |----------------------
|
|---- |------- |--------------- |----------------------
|
||||||
|Area 51 |Update 1 |Uses outdated BSP31 map format and custom HLFX SDK libraries. |You can try [this tool](https://hlfx.ru/forum/showthread.php?threadid=5250) to convert maps but there no warranty if it works.
|
|Blue Shift |The latest steam release |Uses vgui2 library which xash3d does not support |Recreated source code here: https://github.com/FWGS/hlsdk-xash3d/tree/bshift
|
||||||
|Arrange Mod: Rebirth |v150 |No idea yet. |
|
|Counter Strike |1.6(The latest steam release) |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|Blue Shift |The latest steam release |Uses vgui2 library which xash3d does not support. |Recreated source code here: https://github.com/FWGS/hlsdk-xash3d/tree/bshift.
|
|Counter Strike: Condition Zero |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|Counter Strike |Beta 6.5- |Uses an old WON HL 1.0.0.16- interface. |
|
|Counter Strike: Condition Zero - Deleted scenes |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
| |1.4 |Has encrypted blob instead of normal client.dll. |You can try [this tool](https://aluigi.altervista.org/papers/hldlldec.zip) to decrypt client.dll but there no warranty if it works.
|
|Day of Defeat |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
| |1.5 |Has encrypted blob instead of normal client.dll. |Decrypted blob here: https://csm.dev/threads/cs-1-5-client-dll-decrypted-patched-for-usage.38845.
|
|Sven-Coop |5.0+ |Uses custom GoldSrc engine |
|
||||||
| |1.6(The latest steam release) |Uses vgui2 library which xash3d does not support. |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface. Recreated Client Source Code here: https://github.com/Velaron/cs16-client.
|
|
||||||
|Counter Strike: Condition Zero |The latest steam release |Uses vgui2 library which xash3d does not support. |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface. Recreated Client Source Code here: https://github.com/Velaron/cs16-client.
|
|
||||||
|Counter Strike: Condition Zero - Deleted scenes |The latest steam release |Uses vgui2 library which xash3d does not support. Uses new sequences code on engine-side that was never used in any other mods before. |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface.
|
|
||||||
|Day of Defeat |The latest steam release |Uses vgui2 library which xash3d does not support. |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface.
|
|
||||||
|Half-Life: Extended |Day One demo |Uses many hooks to GoldSource engine and version check. |Just wait new version or use more old version.
|
|
||||||
|Icon of Hell |Beta 0.99 |Uses outdated BSP31 map format and paranoia 2 libraries. |You can try [this tool](https://hlfx.ru/forum/showthread.php?threadid=5250) to convert maps and use Paranoia 2: The Savior 1.51 libraries but there no warranty if it works.
|
|
||||||
|Paranoia 2: The Savior |All builds older 1.51 |Uses an old renderer interface and engine features. |
|
|
||||||
|Rebellion |1.0 |Uses an old WON HL 1.0.0.16- interface. |Recreated source code here: https://github.com/FWGS/hlsdk-xash3d/tree/rebellion.
|
|
||||||
|Sven-Coop |5.0+ |Uses custom GoldSrc engine. |
|
|
||||||
|Time Shadows |Beta 0.1 |Uses Direct3D renderer. |
|
|
||||||
|
|||||||
@@ -32,18 +32,12 @@ Version 1.9 mirrored on github - https://github.com/solidi/hl-mods/tree/master/c
|
|||||||
## Cold Ice Ressurection
|
## Cold Ice Ressurection
|
||||||
Mirrored on github - https://github.com/solidi/hl-mods/tree/master/cir
|
Mirrored on github - https://github.com/solidi/hl-mods/tree/master/cir
|
||||||
|
|
||||||
## Counter-Life
|
|
||||||
Available on ModDB - https://www.moddb.com/mods/counter-life/downloads/cl-version-1-source-code
|
|
||||||
|
|
||||||
## Cthulhu
|
## Cthulhu
|
||||||
Uploaded to github by Oleg Cherkasky - https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK
|
Uploaded to github by Oleg Cherkasky - https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK
|
||||||
|
|
||||||
## Deathmatch Classic
|
## Deathmatch Classic
|
||||||
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||||
|
|
||||||
## Delta Particles
|
|
||||||
Available on ModDB - https://www.moddb.com/mods/half-life-delta/downloads/delta-particles-full-sources-maps-and-c-code
|
|
||||||
|
|
||||||
## Earth Special Forces
|
## Earth Special Forces
|
||||||
Alpha 2.0 - https://www.gamers-desire.de/details/2830
|
Alpha 2.0 - https://www.gamers-desire.de/details/2830
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,11 @@
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
1. Make sure your PSVita is [set up to run homebrew applications](https://vita.hacks.guide/).
|
1. Make sure your PSVita is [set up to run homebrew applications](https://vita.hacks.guide/).
|
||||||
2. Install [kubridge](https://github.com/TheOfficialFloW/kubridge/releases/). It is recommended to use kubridge version `0.1`, because other versions aren't tested, we don't know are they suitable or not.
|
2. Install [kubridge](https://github.com/TheOfficialFloW/kubridge/releases/) by copying `kubridge.suprx` to your taiHEN plugins folder (usually `ux0:/tai`) and add it to your `config.txt`, for example:
|
||||||
|
|
||||||
Worth to notice, we got reports that automatic plugins management app EasyPlugin have issues with installing kubridge plugin, so it's better to install it manually: by copying `kubridge.suprx` to your taiHEN plugins folder (usually `ux0:/tai`, but could be `ur0:/tai`) and add it to your `config.txt`, for example:
|
|
||||||
```
|
```
|
||||||
*KERNEL
|
*KERNEL
|
||||||
ux0:tai/kubridge.skprx
|
ux0:tai/kubridge.skprx
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install `libshacccg.suprx` by following [this guide](https://cimmerian.gitbook.io/vita-troubleshooting-guide/shader-compiler/extract-libshacccg.suprx).
|
3. Install `libshacccg.suprx` by following [this guide](https://cimmerian.gitbook.io/vita-troubleshooting-guide/shader-compiler/extract-libshacccg.suprx).
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|||||||
@@ -1,149 +0,0 @@
|
|||||||
# Touch controls configuring
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
Thanks to mittorn, we have the ability to fully customize the controls in Xash3D. The new config allows you to not only add and change control buttons, but also create custom menus. There is also a built-in visual editor available, which simplifies the customization process without the need for manual file editing.
|
|
||||||
|
|
||||||
## Editor mode usage
|
|
||||||
|
|
||||||
1. Launch Xash3D and start the game.
|
|
||||||
2. To enter the edit mode, click on the gear icon (command `touch_enableedit`).
|
|
||||||
3. In the edit mode, the grid is displayed. The number of cells can be changed with the command `touch_grid_count` (default is 50). The grid can be disabled with the command `touch_grid_enable 0`.
|
|
||||||
|
|
||||||
*Touch controls layout editor*
|
|
||||||

|
|
||||||
|
|
||||||
*Touch profiles window*
|
|
||||||

|
|
||||||
|
|
||||||
*Touch buttons parameters window*
|
|
||||||

|
|
||||||
|
|
||||||
## Layout editor features
|
|
||||||
|
|
||||||
* **Moving buttons**: click on a button, drag it to the desired location, and release.
|
|
||||||
* **Resizing buttons**: place your first finger on the top left corner of the button, and use your second finger to resize it.
|
|
||||||
* **Hiding/showing buttons**: select the button (it will turn red), then use the menu:
|
|
||||||
* **Close**: closes the editing mode (`touch_disableedit`).
|
|
||||||
* **Reset**: resets the button to its default values.
|
|
||||||
* **Hide/Show**: hides or shows the button (`touch_hide <name>` / `touch_show <name>`).
|
|
||||||
|
|
||||||
## Working with configuration files / console
|
|
||||||
|
|
||||||
All changes made in the visual editor are automatically saved to the touch profile file. The files are located in the `touch_profiles` folder inside game directory. The file name depends on the selected profile.
|
|
||||||
|
|
||||||
### Common commands in configuration files
|
|
||||||
|
|
||||||
```
|
|
||||||
// Comment: lines starting with // are ignored.
|
|
||||||
|
|
||||||
// Swipe zones for movement. Specify how far you need to swipe to speed up.
|
|
||||||
// The default values are set to be optimal for a small swipe to immediately walk quickly.
|
|
||||||
touch_forwardzone "0.060000" ; touch_sidezone "0.060000"
|
|
||||||
|
|
||||||
// Sensitivity settings (pitch - horizontal, yaw - vertical).
|
|
||||||
touch_pitch ; touch_yaw
|
|
||||||
|
|
||||||
// Grid settings (see above).
|
|
||||||
touch_grid_count ; touch_grid_enable
|
|
||||||
|
|
||||||
// Draws a border around the button.
|
|
||||||
touch_set_stroke <thickness> <c> <v> <e> <t>
|
|
||||||
(<r> - red; <g> - green; <b> - blue; <a> - alpha/transparency)
|
|
||||||
|
|
||||||
// Show (1) or hide (0) client buttons.
|
|
||||||
touch_setclientonly
|
|
||||||
|
|
||||||
// Removes all buttons from the screen.
|
|
||||||
touch_removeall
|
|
||||||
|
|
||||||
// Shows all available buttons in the configuration file.
|
|
||||||
touch_list
|
|
||||||
|
|
||||||
// Saves the config after editing. You can specify a new file name.
|
|
||||||
touch_config_file command.cfg
|
|
||||||
```
|
|
||||||
|
|
||||||
*The full list of buttons in the standard `touch.cfg` file, displayed in the console when using `touch_list`.*
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Adding new buttons
|
|
||||||
|
|
||||||
To add a new button, use the console command:
|
|
||||||
|
|
||||||
```
|
|
||||||
touch_addbutton "digits" "touch/key_1.png" "toggle_digits" 0.340000 0.782222 0.400000 0.888889 255 255 255 100 0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters of `touch_addbutton` command
|
|
||||||
|
|
||||||
| Parameter | Description |
|
|
||||||
| --- | --- |
|
|
||||||
| `"digits"` | Unique name of the button. |
|
|
||||||
| `"touch/key_1.png"` | Path to the icon file (`.png` format). If the icon is not needed, leave `""`. |
|
|
||||||
| `"toggle_digits"` | Command to execute after clicking (for example, `"buy"` for purchase). |
|
|
||||||
| `0.340000` | X coordinate of the upper-left corner of the button. |
|
|
||||||
| `0.782222` | Y coordinate of the upper-left corner of the button. |
|
|
||||||
| `0.400000` | X coordinate of the lower-right corner of the button. |
|
|
||||||
| `0.888889` | Y coordinate of the lower-right corner of the button. |
|
|
||||||
| `255 255 255` | Button color in RGB format. |
|
|
||||||
| `100` | Button transparency (0 - fully transparent, 255 - fully opaque). |
|
|
||||||
| `0` | Flags (see next section). |
|
|
||||||
|
|
||||||
## List of flags
|
|
||||||
|
|
||||||
Flags define the behavior of the button. Their values are powers of two:
|
|
||||||
|
|
||||||
| Flag | Value | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| `TOUCH_FL_HIDE` | 1 | Hides the button (not displayed in the game, but visible in the editor). |
|
|
||||||
| `TOUCH_FL_NOEDIT` | 2 | Disables editing of the button in the editor. |
|
|
||||||
| `TOUCH_FL_CLIENT` | 4 | The button is client-side (not saved in the main control file). |
|
|
||||||
| `TOUCH_FL_MP` | 8 | The button is displayed only in multiplayer. |
|
|
||||||
| `TOUCH_FL_SP` | 16 | The button is displayed only in singleplayer. |
|
|
||||||
| `TOUCH_FL_DEF_SHOW` | 32 | The button is always displayed on startup. |
|
|
||||||
| `TOUCH_FL_DEF_HIDE` | 64 | The button is always hidden on startup. |
|
|
||||||
| `TOUCH_FL_DRAW_ADDITIVE` | 128 | The button colors are added together in blend mode. |
|
|
||||||
| `TOUCH_FL_STROKE` | 256 | Enables outline stroke around the button. |
|
|
||||||
|
|
||||||
Flags can be combined by adding their values together. For example, `5 = 1 + 4` is the combination of `TOUCH_FL_HIDE` and `TOUCH_FL_CLIENT` flags, which is a hidden client button.
|
|
||||||
|
|
||||||
*In the image below, the `spray`, `scores`, `messagemode` buttons are displayed simultaneously with the flag 8 and `loadquick`, `savequick` with the flag 16, and each is displayed in the corresponding game mode.*
|
|
||||||

|
|
||||||
|
|
||||||
## Useful commands
|
|
||||||
|
|
||||||
* `touch_hide <pattern>`: hides buttons by pattern.
|
|
||||||
* `touch_setcommand`: changes the command bound to a button.
|
|
||||||
* `touch_settexture`: quickly changes the button image.
|
|
||||||
* `touch_setcolor`: sets the button color.
|
|
||||||
* `touch_exportconfig`: exports the current configuration, including aspect ratio.
|
|
||||||
|
|
||||||
## Usage examples
|
|
||||||
|
|
||||||
* `touch_hide menu*` hides all buttons with names starting with `menu`.
|
|
||||||
* `touch_setcolor "attack" 255 160 0 128` changes the color of the primary fire button from opaque white to translucent orange, similar to the color of the HUD in Half-Life.
|
|
||||||
|
|
||||||
*Result of executing this command*
|
|
||||||

|
|
||||||
|
|
||||||
* Example of adding a new button with a custom icon (the `lastinv` command is used - quick change between weapons)
|
|
||||||

|
|
||||||
|
|
||||||
*View of this button in layout editor*
|
|
||||||

|
|
||||||
|
|
||||||
## Tips
|
|
||||||
|
|
||||||
* To prevent the `look` and `move` buttons from interfering with editing other elements, place them before the others in the configuration file.
|
|
||||||
* And vice versa, to make a button appear on top of others, place it at the end of the configuration file.
|
|
||||||
* You can assign commands to buttons that change other buttons, see the previous section "Usage examples".
|
|
||||||
* After editing each parameter of each individual button in the Touch Buttons section, do not forget to press Save, otherwise the applied parameters will not be saved.
|
|
||||||
* To create your own icon for the button, you can use any graphics editor (for Android, Photo Editor by iudesk is suitable). Saving conditions:
|
|
||||||
* Image format - `.png` with transparency (e.g. alpha channel)
|
|
||||||
* Aspect ratio / size - 1:1 / 256x256
|
|
||||||
* Path to the icons location - `touch/gfx` inside game directory.
|
|
||||||
|
|
||||||
### Additional links
|
|
||||||
* [Handy palette for selecting color in RGB format](https://www.rapidtables.com/web/color/RGB_Color.html)
|
|
||||||
15
README.md
@@ -1,7 +1,6 @@
|
|||||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) \
|
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](http://fwgsdiscord.mentality.rip/) [](https://t.me/flyingwithgauss) \
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
|
||||||
|
|
||||||
Xash3D ([pronounced](https://ipa-reader.com/?text=ks%C9%91%CA%82) `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
Xash3D ([pronounced](https://ipa-reader.com/?text=ks%C9%91%CA%82) `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ For additional info, run Xash3D with `-help` command line key.
|
|||||||
## Build instructions
|
## Build instructions
|
||||||
We are using Waf build system. If you have some Waf-related questions, I recommend you to read [Waf Book](https://waf.io/book/).
|
We are using Waf build system. If you have some Waf-related questions, I recommend you to read [Waf Book](https://waf.io/book/).
|
||||||
|
|
||||||
**NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!**
|
NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
If your CPU is x86 compatible and you're on Windows or Linux, we are building 32-bit code by default. This was done to maintain compatibility with Steam releases of Half-Life and based on it's engine games.
|
If your CPU is x86 compatible and you're on Windows or Linux, we are building 32-bit code by default. This was done to maintain compatibility with Steam releases of Half-Life and based on it's engine games.
|
||||||
@@ -66,21 +65,21 @@ This repository contains our fork of HLSDK and restored source code for Half-Lif
|
|||||||
* Only for 32-bit engine on 64-bit x86 operating system:
|
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||||
* Enable i386 on your system: `$ sudo dpkg --add-architecture i386`.
|
* Enable i386 on your system: `$ sudo dpkg --add-architecture i386`.
|
||||||
* Install `aptitude` ([why?](https://github.com/FWGS/xash3d-fwgs/issues/1828#issuecomment-2415131759)): `$ sudo apt update && sudo apt upgrade && sudo apt install aptitude`
|
* Install `aptitude` ([why?](https://github.com/FWGS/xash3d-fwgs/issues/1828#issuecomment-2415131759)): `$ sudo apt update && sudo apt upgrade && sudo apt install aptitude`
|
||||||
* Install development tools: `$ sudo aptitude --without-recommends install git build-essential gcc-multilib g++-multilib libsdl2-dev:i386 libfreetype-dev:i386 libopus-dev:i386 libbz2-dev:i386 libvorbis-dev:i386 libopusfile-dev:i386 libogg-dev:i386`.
|
* Install development tools: `$ sudo aptitude --without-recommends install git build-essential gcc-multilib g++-multilib libsdl2-dev:i386 libfreetype-dev:i386 libopus-dev:i386 libbz2-dev:i386`.
|
||||||
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig`.
|
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig`.
|
||||||
|
|
||||||
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||||
* Install development tools: `$ sudo apt install git build-essential python libsdl2-dev libfreetype6-dev libopus-dev libbz2-dev libvorbis-dev libopusfile-dev libogg-dev`.
|
* Install development tools: `$ sudo apt install git build-essential python libsdl2-dev libfreetype6-dev libopus-dev libbz2-dev`.
|
||||||
|
|
||||||
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||||
|
|
||||||
##### RedHat/Fedora
|
##### RedHat/Fedora
|
||||||
* Only for 32-bit engine on 64-bit x86 operating system:
|
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||||
* Install development tools: `$ sudo dnf install git gcc gcc-c++ glibc-devel.i686 SDL2-devel.i686 opus-devel.i686 freetype-devel.i686 bzip2-devel.i686 libvorbis-devel.i686 opusfile-devel.i686 libogg-devel.i686`.
|
* Install development tools: `$ sudo dnf install git gcc gcc-c++ glibc-devel.i686 SDL2-devel.i686 opus-devel.i686 freetype-devel.i686 bzip2-devel.i686`.
|
||||||
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig`.
|
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig`.
|
||||||
|
|
||||||
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||||
* Install development tools: `$ sudo dnf install git gcc gcc-c++ SDL2-devel opus-devel freetype-devel bzip2-devel libvorbis-devel opusfile-devel libogg-devel`.
|
* Install development tools: `$ sudo dnf install git gcc gcc-c++ SDL2-devel opus-devel freetype-devel bzip2-devel`.
|
||||||
|
|
||||||
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,49 @@
|
|||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.6)
|
||||||
|
|
||||||
# Only used to build Android project
|
# Only used to build Android project
|
||||||
|
|
||||||
project(XASH_ANDROID)
|
project(XASH_ANDROID)
|
||||||
|
|
||||||
# armeabi-v7a requires cpufeatures library
|
# armeabi-v7a requires cpufeatures library
|
||||||
if(ANDROID)
|
include(AndroidNdkModules)
|
||||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
android_ndk_import_module_cpufeatures()
|
||||||
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
|
||||||
target_link_libraries(cpufeatures dl)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPython)
|
find_package(PythonInterp 2.7 REQUIRED)
|
||||||
|
|
||||||
|
get_filename_component(C_COMPILER_ID ${CMAKE_C_COMPILER} NAME_WE)
|
||||||
|
get_filename_component(CXX_COMPILER_ID ${CMAKE_CXX_COMPILER} NAME_WE)
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
set(BUILD_TYPE "debug")
|
set(BUILD_TYPE "debug")
|
||||||
else()
|
else()
|
||||||
set(BUILD_TYPE "release")
|
set(BUILD_TYPE "release")
|
||||||
list(APPEND WAF_EXTRA_ARGS --enable-poly-opt --enable-lto --enable-limited-debuginfo)
|
list(APPEND WAF_EXTRA_ARGS --enable-poly-opt --enable-lto)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID_ABI STREQUAL "x86")
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
# HACKHACK: I don't know why but engine gets built as 64-bit binary here
|
set(64BIT ON CACHE BOOL "" FORCE)
|
||||||
list(APPEND WAF_EXTRA_ARGS -4)
|
list(APPEND WAF_EXTRA_ARGS -8) # only required for x86 when testing this cmakelist under linux
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
|
||||||
|
set(WAF_CC "${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
|
||||||
|
set(WAF_CXX "${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||||
|
|
||||||
# not cleanest way to get upper directory
|
# not cleanest way to get upper directory
|
||||||
set(ENGINE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
set(ENGINE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
||||||
|
|
||||||
set(WAF_CC "${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
|
execute_process(
|
||||||
set(WAF_CXX "${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET}")
|
COMMAND ${CMAKE_COMMAND} -E env
|
||||||
set(WAF ${Python_EXECUTABLE} ${ENGINE_SOURCE_DIR}waf -t ${ENGINE_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/xash3d-fwgs)
|
CC=${WAF_CC} CXX=${WAF_CXX}
|
||||||
|
AR=${CMAKE_AR} STRIP=${CMAKE_STRIP}
|
||||||
|
${PYTHON_EXECUTABLE} waf configure -T ${BUILD_TYPE} -o "${CMAKE_CURRENT_BINARY_DIR}/xash3d-fwgs" ${WAF_EXTRA_ARGS} cmake
|
||||||
|
--check-c-compiler=${C_COMPILER_ID} --check-cxx-compiler=${CXX_COMPILER_ID}
|
||||||
|
-s "${ENGINE_SOURCE_DIR}/SDL" --skip-sdl2-sanity-check --enable-bundled-deps
|
||||||
|
WORKING_DIRECTORY "${ENGINE_SOURCE_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/hlsdk-portable" hlsdk-portable)
|
||||||
|
|
||||||
# try to build minimal SDL. Enable features as we're gonna use them
|
# try to build minimal SDL. Enable features as we're gonna use them
|
||||||
set(SDL_RENDER OFF)
|
set(SDL_RENDER OFF)
|
||||||
@@ -46,50 +56,5 @@ set(SDL_VULKAN OFF)
|
|||||||
set(SDL_OFFSCREEN OFF)
|
set(SDL_OFFSCREEN OFF)
|
||||||
set(SDL_STATIC OFF)
|
set(SDL_STATIC OFF)
|
||||||
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/SDL" SDL)
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/SDL" SDL)
|
||||||
|
add_subdirectory("${ENGINE_SOURCE_DIR}/" xash3d-fwgs)
|
||||||
include(ExternalProject)
|
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/mainui" mainui)
|
||||||
|
|
||||||
# gradle passes backslashes to cmake, how does this even work for everybody else?
|
|
||||||
string(REPLACE "\\" "/" CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
||||||
|
|
||||||
ExternalProject_Add(
|
|
||||||
Xash3DFWGS
|
|
||||||
SOURCE_DIR ${ENGINE_SOURCE_DIR}
|
|
||||||
INSTALL_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
BUILD_IN_SOURCE TRUE
|
|
||||||
DEPENDS SDL2
|
|
||||||
BUILD_ALWAYS TRUE
|
|
||||||
LOG_CONFIGURE TRUE
|
|
||||||
LOG_BUILD TRUE
|
|
||||||
LOG_INSTALL TRUE
|
|
||||||
LOG_OUTPUT_ON_FAILURE TRUE
|
|
||||||
LOG_MERGED_STDOUTERR TRUE
|
|
||||||
|
|
||||||
# USES_TERMINAL_CONFIGURE TRUE
|
|
||||||
# USES_TERMINAL_BUILD TRUE
|
|
||||||
# USES_TERMINAL_INSTALL TRUE
|
|
||||||
|
|
||||||
# NOTE: setting up WAFLOCK is important to avoid possible race conditions
|
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
ANDROID_NDK=${ANDROID_NDK}
|
|
||||||
BUILD_CMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} configure -T ${BUILD_TYPE} --android=${ANDROID_ABI},,${CMAKE_SYSTEM_VERSION}
|
|
||||||
-s "${ENGINE_SOURCE_DIR}/3rdparty/SDL" --enable-bundled-deps ${WAF_EXTRA_ARGS}
|
|
||||||
|
|
||||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} build -v
|
|
||||||
|
|
||||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E env
|
|
||||||
WAFLOCK=.lock-waf_android_${ANDROID_ABI}_build
|
|
||||||
${WAF} install --destdir=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/hlsdk-portable" hlsdk-portable)
|
|
||||||
|
|
||||||
# a1ba: without this, xash3d target will be ignored as nothing depends on it
|
|
||||||
add_dependencies(client Xash3DFWGS)
|
|
||||||
add_dependencies(server Xash3DFWGS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "su.xash.engine"
|
namespace = "su.xash.engine"
|
||||||
ndkVersion = "28.0.13004108"
|
ndkVersion = "27.2.12479018"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "su.xash"
|
applicationId = "su.xash"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package su.xash.engine.ui.library
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.ActivityNotFoundException
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -11,7 +10,6 @@ import android.view.MenuInflater
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.view.MenuProvider
|
import androidx.core.view.MenuProvider
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
@@ -75,16 +73,11 @@ class LibraryFragment : Fragment(), MenuProvider {
|
|||||||
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
|
override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.action_browse -> {
|
R.id.action_browse -> {
|
||||||
try {
|
startActivity(
|
||||||
startActivity(
|
Intent(Intent.ACTION_VIEW).setDataAndType(
|
||||||
Intent(Intent.ACTION_VIEW).setDataAndType(
|
null, "vnd.android.document/directory"
|
||||||
null, "vnd.android.document/directory"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
catch(e: ActivityNotFoundException) {
|
|
||||||
Toast.makeText(getActivity(), R.string.library_fragment_no_file_manager, Toast.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.action_install -> {
|
R.id.action_install -> {
|
||||||
|
|||||||
@@ -33,5 +33,4 @@
|
|||||||
<string name="preferences_client_package">Client package</string>
|
<string name="preferences_client_package">Client package</string>
|
||||||
<string name="preferences_server_package">Server package</string>
|
<string name="preferences_server_package">Server package</string>
|
||||||
<string name="preferences_use_icons">Use icons instead of backgrounds</string>
|
<string name="preferences_use_icons">Use icons instead of backgrounds</string>
|
||||||
<string name="library_fragment_no_file_manager">File manager is missing</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -21,6 +21,3 @@ kotlin.code.style=official
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
|
||||||
# Enable verbose output for CMake
|
|
||||||
android.native.buildOutput=verbose
|
|
||||||
|
|||||||
@@ -140,13 +140,13 @@ Default build-depended cvar and constant values
|
|||||||
|
|
||||||
// Platform overrides
|
// Platform overrides
|
||||||
#if XASH_NSWITCH
|
#if XASH_NSWITCH
|
||||||
#define DEFAULT_TOUCH_ENABLE "1"
|
#define DEFAULT_TOUCH_ENABLE "0"
|
||||||
#define DEFAULT_M_IGNORE "1"
|
#define DEFAULT_M_IGNORE "1"
|
||||||
#define DEFAULT_MODE_WIDTH 1280
|
#define DEFAULT_MODE_WIDTH 1280
|
||||||
#define DEFAULT_MODE_HEIGHT 720
|
#define DEFAULT_MODE_HEIGHT 720
|
||||||
#define DEFAULT_ALLOWCONSOLE 1
|
#define DEFAULT_ALLOWCONSOLE 1
|
||||||
#elif XASH_PSVITA
|
#elif XASH_PSVITA
|
||||||
#define DEFAULT_TOUCH_ENABLE "1"
|
#define DEFAULT_TOUCH_ENABLE "0"
|
||||||
#define DEFAULT_M_IGNORE "1"
|
#define DEFAULT_M_IGNORE "1"
|
||||||
#define DEFAULT_MODE_WIDTH 960
|
#define DEFAULT_MODE_WIDTH 960
|
||||||
#define DEFAULT_MODE_HEIGHT 544
|
#define DEFAULT_MODE_HEIGHT 544
|
||||||
@@ -158,7 +158,7 @@ Default build-depended cvar and constant values
|
|||||||
#define DEFAULT_M_IGNORE "1"
|
#define DEFAULT_M_IGNORE "1"
|
||||||
#endif // !XASH_MOBILE_PLATFORM && !XASH_NSWITCH
|
#endif // !XASH_MOBILE_PLATFORM && !XASH_NSWITCH
|
||||||
|
|
||||||
#if (XASH_ANDROID && !XASH_TERMUX) || XASH_IOS || XASH_EMSCRIPTEN
|
#if XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
|
||||||
// this means that libraries are provided with engine, but not in game data
|
// this means that libraries are provided with engine, but not in game data
|
||||||
// You need add library loading code to library.c when adding new platform
|
// You need add library loading code to library.c when adding new platform
|
||||||
#define XASH_INTERNAL_GAMELIBS
|
#define XASH_INTERNAL_GAMELIBS
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ typedef struct netadr_s
|
|||||||
static inline netadrtype_t NET_NetadrType( const netadr_t *a )
|
static inline netadrtype_t NET_NetadrType( const netadr_t *a )
|
||||||
{
|
{
|
||||||
if( a->type == NA_IP6 || a->type == NA_MULTICAST_IP6 )
|
if( a->type == NA_IP6 || a->type == NA_MULTICAST_IP6 )
|
||||||
return (netadrtype_t)a->type;
|
return a->type;
|
||||||
|
|
||||||
if( a->ip6_0[0] || a->ip6_0[1] )
|
if( a->ip6_0[0] || a->ip6_0[1] )
|
||||||
return NA_UNDEFINED;
|
return NA_UNDEFINED;
|
||||||
|
|
||||||
return (netadrtype_t)a->type;
|
return a->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void NET_NetadrSetType( netadr_t *a, netadrtype_t type )
|
static inline void NET_NetadrSetType( netadr_t *a, netadrtype_t type )
|
||||||
|
|||||||
@@ -86,4 +86,8 @@ GNU General Public License for more details.
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#if defined XASH_SDL && !defined REF_DLL
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // PORT_H
|
#endif // PORT_H
|
||||||
|
|||||||
@@ -13,19 +13,13 @@
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#include <sys/types.h> // off_t
|
#include <sys/types.h> // off_t
|
||||||
#ifdef STDINT_H
|
|
||||||
#include STDINT_H
|
#include STDINT_H
|
||||||
#else // !STDINT_H
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif // !STDINT_H
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
typedef uint8_t byte;
|
typedef uint8_t byte;
|
||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
typedef vec_t vec2_t[2];
|
typedef vec_t vec2_t[2];
|
||||||
#ifndef vec3_t // SDK renames it to Vector
|
|
||||||
typedef vec_t vec3_t[3];
|
typedef vec_t vec3_t[3];
|
||||||
#endif
|
|
||||||
typedef vec_t vec4_t[4];
|
typedef vec_t vec4_t[4];
|
||||||
typedef vec_t quat_t[4];
|
typedef vec_t quat_t[4];
|
||||||
typedef byte rgba_t[4]; // unsigned byte colorpack
|
typedef byte rgba_t[4]; // unsigned byte colorpack
|
||||||
@@ -50,7 +44,6 @@ typedef int qboolean;
|
|||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
#define BIT64( n ) ( 1ULL << ( n ))
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
|
|
||||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||||
@@ -67,8 +60,6 @@ typedef int qboolean;
|
|||||||
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
||||||
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
||||||
|
|
||||||
#undef EXPORT
|
|
||||||
|
|
||||||
#if defined( __GNUC__ )
|
#if defined( __GNUC__ )
|
||||||
#if defined( __i386__ )
|
#if defined( __i386__ )
|
||||||
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
||||||
@@ -91,10 +82,8 @@ typedef int qboolean;
|
|||||||
#define NORETURN __attribute__(( noreturn ))
|
#define NORETURN __attribute__(( noreturn ))
|
||||||
#define NONNULL __attribute__(( nonnull ))
|
#define NONNULL __attribute__(( nonnull ))
|
||||||
#define RETURNS_NONNULL __attribute__(( returns_nonnull ))
|
#define RETURNS_NONNULL __attribute__(( returns_nonnull ))
|
||||||
#if __clang__ || __MCST__
|
#if __clang__
|
||||||
// clang has bugged returns_nonnull for functions pointers, it's ignored and generates a warning about objective-c? O_o
|
#define PFN_RETURNS_NONNULL // clang has bugged returns_nonnull for functions pointers, it's ignored and generates a warning about objective-c? O_o
|
||||||
// lcc doesn't support it at all
|
|
||||||
#define PFN_RETURNS_NONNULL
|
|
||||||
#else
|
#else
|
||||||
#define PFN_RETURNS_NONNULL RETURNS_NONNULL
|
#define PFN_RETURNS_NONNULL RETURNS_NONNULL
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -152,6 +152,19 @@ void CL_PlayCDTrack_f( void )
|
|||||||
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
|
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
CL_ScreenshotGetName
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size )
|
||||||
|
{
|
||||||
|
if( lastnum < 0 || lastnum > 9999 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -257,6 +270,7 @@ void CL_GenericShot_f( void )
|
|||||||
case scrshot_normal:
|
case scrshot_normal:
|
||||||
case scrshot_snapshot:
|
case scrshot_snapshot:
|
||||||
{
|
{
|
||||||
|
const char *fmt;
|
||||||
string checkname;
|
string checkname;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -268,18 +282,15 @@ void CL_GenericShot_f( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( type == scrshot_snapshot )
|
if( type == scrshot_snapshot )
|
||||||
|
{
|
||||||
|
fmt = "../%s_%04d.png";
|
||||||
FS_AllowDirectPaths( true );
|
FS_AllowDirectPaths( true );
|
||||||
|
}
|
||||||
|
else fmt = "scrshots/%s_shot%04d.png";
|
||||||
|
|
||||||
for( i = 0; i < 9999; i++ )
|
for( i = 0; i < 9999; i++ )
|
||||||
{
|
{
|
||||||
int ret;
|
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname )))
|
||||||
|
|
||||||
if( type == scrshot_snapshot )
|
|
||||||
ret = Q_snprintf( checkname, sizeof( checkname ), "../%s_%04d.png", clgame.mapname, i );
|
|
||||||
else
|
|
||||||
ret = Q_snprintf( checkname, sizeof( checkname ), "scrshots/%s_shot%04d.png", clgame.mapname, i );
|
|
||||||
|
|
||||||
if( ret <= 0 )
|
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
||||||
FS_AllowDirectPaths( false );
|
FS_AllowDirectPaths( false );
|
||||||
|
|||||||
@@ -642,7 +642,9 @@ static void CL_ReadDemoUserCmd( qboolean discard )
|
|||||||
pcmd->sendsize = 1;
|
pcmd->sendsize = 1;
|
||||||
|
|
||||||
// always delta'ing from null
|
// always delta'ing from null
|
||||||
MSG_ReadDeltaUsercmd( &buf, &nullcmd, &pcmd->cmd );
|
cl.cmd = &pcmd->cmd;
|
||||||
|
|
||||||
|
MSG_ReadDeltaUsercmd( &buf, &nullcmd, cl.cmd );
|
||||||
|
|
||||||
// make sure what interp info contain angles from different frames
|
// make sure what interp info contain angles from different frames
|
||||||
// or lerping will stop working
|
// or lerping will stop working
|
||||||
@@ -654,16 +656,13 @@ static void CL_ReadDemoUserCmd( qboolean discard )
|
|||||||
|
|
||||||
// record update
|
// record update
|
||||||
a->starttime = demo.timestamp;
|
a->starttime = demo.timestamp;
|
||||||
VectorCopy( pcmd->cmd.viewangles, a->viewangles );
|
VectorCopy( cl.cmd->viewangles, a->viewangles );
|
||||||
demo.lasttime = demo.timestamp;
|
demo.lasttime = demo.timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: we need to have the current outgoing sequence correct
|
// NOTE: we need to have the current outgoing sequence correct
|
||||||
// so we can do prediction correctly during playback
|
// so we can do prediction correctly during playback
|
||||||
cls.netchan.outgoing_sequence = outgoing_sequence;
|
cls.netchan.outgoing_sequence = outgoing_sequence;
|
||||||
|
|
||||||
// save last usercmd
|
|
||||||
cl.cmd = pcmd->cmd;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,7 +1145,8 @@ void CL_DemoInterpolateAngles( void )
|
|||||||
QuaternionSlerp( q2, q1, frac, q );
|
QuaternionSlerp( q2, q1, frac, q );
|
||||||
QuaternionAngle( q, cl.viewangles );
|
QuaternionAngle( q, cl.viewangles );
|
||||||
}
|
}
|
||||||
else VectorCopy( cl.cmd.viewangles, cl.viewangles );
|
else if( cl.cmd != NULL )
|
||||||
|
VectorCopy( cl.cmd->viewangles, cl.viewangles );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -405,11 +405,7 @@ void CL_ParseReliableEvent( sizebuf_t *msg, connprotocol_t proto )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
||||||
{
|
args.angles[PITCH] *= -3.0f;
|
||||||
args.angles[PITCH] *= 3.0f;
|
|
||||||
if( !FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
|
||||||
args.angles[PITCH] = -args.angles[PITCH];
|
|
||||||
}
|
|
||||||
|
|
||||||
CL_QueueEvent( FEV_RELIABLE|FEV_SERVER, event_index, delay, &args );
|
CL_QueueEvent( FEV_RELIABLE|FEV_SERVER, event_index, delay, &args );
|
||||||
}
|
}
|
||||||
@@ -481,9 +477,7 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
|
|||||||
|
|
||||||
if( state->number > 0 && state->number <= cl.maxclients )
|
if( state->number > 0 && state->number <= cl.maxclients )
|
||||||
{
|
{
|
||||||
args.angles[PITCH] *= 3.0f;
|
args.angles[PITCH] *= -3.0f;
|
||||||
if( !FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
|
||||||
args.angles[PITCH] = -args.angles[PITCH];
|
|
||||||
CL_CalcPlayerVelocity( state->number, args.velocity );
|
CL_CalcPlayerVelocity( state->number, args.velocity );
|
||||||
args.ducking = ( state->usehull == 1 );
|
args.ducking = ( state->usehull == 1 );
|
||||||
}
|
}
|
||||||
@@ -493,11 +487,7 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
|
|||||||
if( args.entindex != 0 )
|
if( args.entindex != 0 )
|
||||||
{
|
{
|
||||||
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
||||||
{
|
args.angles[PITCH] /= -3.0f;
|
||||||
args.angles[PITCH] /= 3.0f;
|
|
||||||
if( !FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
|
||||||
args.angles[PITCH] = -args.angles[PITCH];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ static int CL_CalcTabStop( const cl_font_t *font, int x )
|
|||||||
return stop;
|
return stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_t *font, int flags )
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags )
|
||||||
{
|
{
|
||||||
wrect_t *rc;
|
wrect_t *rc;
|
||||||
float w, h;
|
float w, h;
|
||||||
@@ -231,7 +231,7 @@ int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_
|
|||||||
return font->charWidths[number];
|
return font->charWidths[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_t *font, int flags )
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags )
|
||||||
{
|
{
|
||||||
rgba_t current_color;
|
rgba_t current_color;
|
||||||
int draw_len = 0;
|
int draw_len = 0;
|
||||||
@@ -287,7 +287,7 @@ int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_
|
|||||||
return draw_len;
|
return draw_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_DrawStringf( cl_font_t *font, float x, float y, const rgba_t color, int flags, const char *fmt, ... )
|
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
char buf[MAX_VA_STRING];
|
char buf[MAX_VA_STRING];
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if XASH_SDL == 2
|
|
||||||
#include <SDL.h> // SDL_GetWindowPosition
|
|
||||||
#elif XASH_SDL == 3
|
|
||||||
#include <SDL3/SDL.h> // SDL_GetWindowPosition
|
|
||||||
#endif // XASH_SDL
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
@@ -1690,7 +1684,7 @@ get actual screen info
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
{
|
{
|
||||||
qboolean apply_scale_factor = false; // we don't want floating point inaccuracies
|
qboolean apply_scale_factor = false;
|
||||||
float scale_factor = hud_scale.value;
|
float scale_factor = hud_scale.value;
|
||||||
|
|
||||||
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
||||||
@@ -1708,7 +1702,7 @@ int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
|||||||
if( hud_scale.value >= 320.0f && hud_scale.value >= hud_scale_minimal_width.value )
|
if( hud_scale.value >= 320.0f && hud_scale.value >= hud_scale_minimal_width.value )
|
||||||
{
|
{
|
||||||
scale_factor = refState.width / hud_scale.value;
|
scale_factor = refState.width / hud_scale.value;
|
||||||
apply_scale_factor = scale_factor > 1.0f;
|
apply_scale_factor = true;
|
||||||
}
|
}
|
||||||
else if( scale_factor && scale_factor != 1.0f )
|
else if( scale_factor && scale_factor != 1.0f )
|
||||||
{
|
{
|
||||||
@@ -1772,7 +1766,7 @@ static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, c
|
|||||||
|| !Q_stricmp( szName, "sensitivity" ))
|
|| !Q_stricmp( szName, "sensitivity" ))
|
||||||
flags |= FCVAR_PRIVILEGED;
|
flags |= FCVAR_PRIVILEGED;
|
||||||
|
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
static int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||||
@@ -2085,7 +2079,6 @@ GetWindowCenterX
|
|||||||
static int GAME_EXPORT pfnGetWindowCenterX( void )
|
static int GAME_EXPORT pfnGetWindowCenterX( void )
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
if( m_ignore.value )
|
if( m_ignore.value )
|
||||||
{
|
{
|
||||||
@@ -2095,7 +2088,7 @@ static int GAME_EXPORT pfnGetWindowCenterX( void )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_SDL >= 2
|
#if XASH_SDL == 2
|
||||||
SDL_GetWindowPosition( host.hWnd, &x, NULL );
|
SDL_GetWindowPosition( host.hWnd, &x, NULL );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2111,7 +2104,6 @@ GetWindowCenterY
|
|||||||
static int GAME_EXPORT pfnGetWindowCenterY( void )
|
static int GAME_EXPORT pfnGetWindowCenterY( void )
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
if( m_ignore.value )
|
if( m_ignore.value )
|
||||||
{
|
{
|
||||||
@@ -2121,7 +2113,7 @@ static int GAME_EXPORT pfnGetWindowCenterY( void )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_SDL >= 2
|
#if XASH_SDL == 2
|
||||||
SDL_GetWindowPosition( host.hWnd, NULL, &y );
|
SDL_GetWindowPosition( host.hWnd, NULL, &y );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3414,7 +3406,7 @@ static void GAME_EXPORT NetAPI_Status( net_status_t *status )
|
|||||||
status->latency = (connected) ? cl.frames[cl.parsecountmod].latency : 0.0;
|
status->latency = (connected) ? cl.frames[cl.parsecountmod].latency : 0.0;
|
||||||
status->remote_address = cls.netchan.remote_address;
|
status->remote_address = cls.netchan.remote_address;
|
||||||
status->packet_loss = packet_loss;
|
status->packet_loss = packet_loss;
|
||||||
NET_GetLocalAddress( &status->local_address, NULL ); // NetAPI doesn't know about IPv6
|
status->local_address = net_local;
|
||||||
status->rate = rate.value;
|
status->rate = rate.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ pfnCvar_RegisterVariable
|
|||||||
*/
|
*/
|
||||||
static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
static cvar_t *GAME_EXPORT pfnCvar_RegisterGameUIVariable( const char *szName, const char *szValue, int flags )
|
||||||
{
|
{
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_GAMEUIDLL ));
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_GAMEUIDLL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
static int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||||
@@ -1273,16 +1273,16 @@ static void pfnEnableTextInput( int enable )
|
|||||||
Key_EnableTextInput( enable, false );
|
Key_EnableTextInput( enable, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfnGetRenderers( unsigned int num, char *short_name, size_t size1, char *long_name, size_t size2 )
|
static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 )
|
||||||
{
|
{
|
||||||
if( num >= ref.num_renderers )
|
if( num >= ref.numRenderers )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( short_name && size1 )
|
if( shortName && size1 )
|
||||||
Q_strncpy( short_name, ref.short_names[num], size1 );
|
Q_strncpy( shortName, ref.shortNames[num], size1 );
|
||||||
|
|
||||||
if( long_name && size2 )
|
if( readableName && size2 )
|
||||||
Q_strncpy( long_name, ref.long_names[num], size2 );
|
Q_strncpy( readableName, ref.readableNames[num], size2 );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ CVAR_DEFINE_AUTO( hud_scale_minimal_width, "640", FCVAR_ARCHIVE|FCVAR_LATCH, "if
|
|||||||
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
||||||
CVAR_DEFINE_AUTO( cl_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
CVAR_DEFINE_AUTO( cl_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
||||||
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
||||||
CVAR_DEFINE_AUTO( cl_cmdrate, "30", FCVAR_ARCHIVE, "Max number of command packets sent to server per second" );
|
CVAR_DEFINE_AUTO( cl_cmdrate, "60", FCVAR_ARCHIVE, "Max number of command packets sent to server per second" );
|
||||||
CVAR_DEFINE( cl_interp, "ex_interp", "0.1", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "Interpolate object positions starting this many seconds in past" );
|
CVAR_DEFINE( cl_interp, "ex_interp", "0.1", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "Interpolate object positions starting this many seconds in past" );
|
||||||
CVAR_DEFINE_AUTO( cl_nointerp, "0", 0, "disable interpolation of entities and players" );
|
CVAR_DEFINE_AUTO( cl_nointerp, "0", 0, "disable interpolation of entities and players" );
|
||||||
static CVAR_DEFINE_AUTO( cl_dlmax, "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed outcoming fragment size" );
|
static CVAR_DEFINE_AUTO( cl_dlmax, "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed outcoming fragment size" );
|
||||||
static CVAR_DEFINE_AUTO( cl_upmax, "508", FCVAR_ARCHIVE, "max allowed incoming fragment size" );
|
static CVAR_DEFINE_AUTO( cl_upmax, "1200", FCVAR_ARCHIVE, "max allowed incoming fragment size" );
|
||||||
|
|
||||||
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
||||||
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
||||||
@@ -94,10 +94,11 @@ static CVAR_DEFINE_AUTO( name, username, FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_PRIN
|
|||||||
static CVAR_DEFINE_AUTO( model, "", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player model ('player' is a singleplayer model)" );
|
static CVAR_DEFINE_AUTO( model, "", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player model ('player' is a singleplayer model)" );
|
||||||
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
||||||
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
||||||
CVAR_DEFINE_AUTO( rate, "25000", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
||||||
|
|
||||||
static CVAR_DEFINE_AUTO( cl_ticket_generator, "revemu2013", FCVAR_ARCHIVE, "you wouldn't steal a car" );
|
static CVAR_DEFINE_AUTO( cl_ticket_generator, "revemu2013", FCVAR_ARCHIVE, "you wouldn't steal a car" );
|
||||||
|
|
||||||
|
|
||||||
client_t cl;
|
client_t cl;
|
||||||
client_static_t cls;
|
client_static_t cls;
|
||||||
clgame_static_t clgame;
|
clgame_static_t clgame;
|
||||||
@@ -673,7 +674,7 @@ static void CL_CreateCmd( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// demo always have commands so don't overwrite them
|
// demo always have commands so don't overwrite them
|
||||||
if( !cls.demoplayback ) cl.cmd = pcmd->cmd;
|
if( !cls.demoplayback ) cl.cmd = &pcmd->cmd;
|
||||||
|
|
||||||
// predict all unacknowledged movements
|
// predict all unacknowledged movements
|
||||||
CL_PredictMovement( false );
|
CL_PredictMovement( false );
|
||||||
@@ -1008,7 +1009,7 @@ static void CL_WriteSteamTicket( sizebuf_t *send )
|
|||||||
const char *s;
|
const char *s;
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
char buf[768] = { 0 }; // setti and steamemu return 768
|
char buf[768] = { 0 }; // setti and steamemu return 768
|
||||||
int i = sizeof( buf );
|
size_t i = sizeof( buf );
|
||||||
|
|
||||||
if( !Q_strcmp( cl_ticket_generator.string, "null" ))
|
if( !Q_strcmp( cl_ticket_generator.string, "null" ))
|
||||||
{
|
{
|
||||||
@@ -1027,7 +1028,24 @@ static void CL_WriteSteamTicket( sizebuf_t *send )
|
|||||||
CRC32_Init( &crc );
|
CRC32_Init( &crc );
|
||||||
CRC32_ProcessBuffer( &crc, s, Q_strlen( s ));
|
CRC32_ProcessBuffer( &crc, s, Q_strlen( s ));
|
||||||
crc = CRC32_Final( crc );
|
crc = CRC32_Final( crc );
|
||||||
i = GenerateRevEmu2013( buf, s, crc );
|
|
||||||
|
if( !Q_stricmp( cl_ticket_generator.string, "revemu2013" ))
|
||||||
|
i = GenerateRevEmu2013( buf, crc );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "sc2009" ))
|
||||||
|
i = GenerateSC2009( buf, crc );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "oldrevemu" ))
|
||||||
|
i = GenerateOldRevEmu( buf, crc );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "steamemu" ))
|
||||||
|
i = GenerateSteamEmu( buf, crc );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "revemu" ))
|
||||||
|
i = GenerateRevEmu( buf, crc );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "setti" ))
|
||||||
|
i = GenerateSetti( buf );
|
||||||
|
else if( !Q_stricmp( cl_ticket_generator.string, "avsmp" ))
|
||||||
|
i = GenerateAVSMP( buf, crc, true );
|
||||||
|
else
|
||||||
|
Con_Printf( "%s: unknown generator %s, supported are: null, revemu2003, sc2009, oldrevemu, steamemu, revemu, setti, avsmp\n", __func__, cl_ticket_generator.string );
|
||||||
|
|
||||||
MSG_WriteBytes( send, buf, i );
|
MSG_WriteBytes( send, buf, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1165,11 +1183,7 @@ Returns bandwidth test fragment size
|
|||||||
*/
|
*/
|
||||||
static int CL_GetTestFragmentSize( void )
|
static int CL_GetTestFragmentSize( void )
|
||||||
{
|
{
|
||||||
// const int fragmentSizes[CL_TEST_RETRIES] = { 64000, 32000, 10666, 5200, 1400 };
|
const int fragmentSizes[CL_TEST_RETRIES] = { 64000, 32000, 10666, 5200, 1400 };
|
||||||
|
|
||||||
// it turns out, even if we pass the bandwidth test, it doesn't mean we can use such large fragments
|
|
||||||
// as a temporary solution, use smaller fragment sizes
|
|
||||||
const int fragmentSizes[CL_TEST_RETRIES] = { 1400, 1200, 1000, 800, 508 };
|
|
||||||
if( cls.connect_retry >= 0 && cls.connect_retry < CL_TEST_RETRIES )
|
if( cls.connect_retry >= 0 && cls.connect_retry < CL_TEST_RETRIES )
|
||||||
return bound( FRAGMENT_MIN_SIZE, fragmentSizes[cls.connect_retry], FRAGMENT_MAX_SIZE );
|
return bound( FRAGMENT_MIN_SIZE, fragmentSizes[cls.connect_retry], FRAGMENT_MAX_SIZE );
|
||||||
else
|
else
|
||||||
@@ -3677,7 +3691,7 @@ void CL_Shutdown( void )
|
|||||||
{
|
{
|
||||||
Con_Printf( "%s()\n", __func__ );
|
Con_Printf( "%s()\n", __func__ );
|
||||||
|
|
||||||
if( host.status != HOST_CRASHED && cls.initialized )
|
if( !host.crashed && cls.initialized )
|
||||||
{
|
{
|
||||||
Host_WriteOpenGLConfig ();
|
Host_WriteOpenGLConfig ();
|
||||||
Host_WriteVideoConfig ();
|
Host_WriteVideoConfig ();
|
||||||
|
|||||||
@@ -92,11 +92,6 @@ static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned i
|
|||||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GAME_EXPORT pfnSetCustomClientID( const char *id )
|
|
||||||
{
|
|
||||||
// deprecated
|
|
||||||
}
|
|
||||||
|
|
||||||
static const mobile_engfuncs_t gMobileEngfuncs =
|
static const mobile_engfuncs_t gMobileEngfuncs =
|
||||||
{
|
{
|
||||||
MOBILITY_API_VERSION,
|
MOBILITY_API_VERSION,
|
||||||
@@ -111,7 +106,7 @@ static const mobile_engfuncs_t gMobileEngfuncs =
|
|||||||
pfnDrawScaledCharacter,
|
pfnDrawScaledCharacter,
|
||||||
Sys_Warn,
|
Sys_Warn,
|
||||||
Sys_GetNativeObject,
|
Sys_GetNativeObject,
|
||||||
pfnSetCustomClientID,
|
ID_SetCustomClientID,
|
||||||
pfnParseFileSafe
|
pfnParseFileSafe
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,7 @@ static void CL_ParseNewMovevars( sizebuf_t *msg )
|
|||||||
R_SetupSky( clgame.movevars.skyName );
|
R_SetupSky( clgame.movevars.skyName );
|
||||||
|
|
||||||
clgame.oldmovevars = clgame.movevars;
|
clgame.oldmovevars = clgame.movevars;
|
||||||
|
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||||
// FIXME: set world wave height when entities will be allocated
|
|
||||||
if( clgame.entities )
|
|
||||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
|
||||||
|
|
||||||
// keep features an actual!
|
// keep features an actual!
|
||||||
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
||||||
|
|||||||
@@ -973,7 +973,7 @@ void CL_MoveSpectatorCamera( void )
|
|||||||
|
|
||||||
CL_SetUpPlayerPrediction( false, true );
|
CL_SetUpPlayerPrediction( false, true );
|
||||||
CL_SetSolidPlayers( cl.playernum );
|
CL_SetSolidPlayers( cl.playernum );
|
||||||
CL_RunUsercmd( &cls.spectator_state, &cls.spectator_state, &cl.cmd, true, &time, (uint)( time * 100.0 ));
|
CL_RunUsercmd( &cls.spectator_state, &cls.spectator_state, cl.cmd, true, &time, (uint)( time * 100.0 ));
|
||||||
|
|
||||||
VectorCopy( cls.spectator_state.client.velocity, cl.simvel );
|
VectorCopy( cls.spectator_state.client.velocity, cl.simvel );
|
||||||
VectorCopy( cls.spectator_state.client.origin, cl.simorg );
|
VectorCopy( cls.spectator_state.client.origin, cl.simorg );
|
||||||
|
|||||||
@@ -955,6 +955,7 @@ void GAME_EXPORT R_BloodSprite( const vec3_t org, int colorIndex, int modelIndex
|
|||||||
if( pTemp->entity.curstate.frame > 8.0f )
|
if( pTemp->entity.curstate.frame > 8.0f )
|
||||||
pTemp->entity.curstate.frame = pTemp->frameMax;
|
pTemp->entity.curstate.frame = pTemp->frameMax;
|
||||||
|
|
||||||
|
pTemp->entity.baseline.origin[2] += COM_RandomFloat( 4.0f, 16.0f ) * size;
|
||||||
pTemp->entity.angles[2] = COM_RandomFloat( 0.0f, 360.0f );
|
pTemp->entity.angles[2] = COM_RandomFloat( 0.0f, 360.0f );
|
||||||
pTemp->bounceFactor = 0.0f;
|
pTemp->bounceFactor = 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ static void V_SetRefParams( ref_params_t *fd )
|
|||||||
|
|
||||||
// get pointers to movement vars and user cmd
|
// get pointers to movement vars and user cmd
|
||||||
fd->movevars = &clgame.movevars;
|
fd->movevars = &clgame.movevars;
|
||||||
fd->cmd = &cl.cmd;
|
fd->cmd = cl.cmd;
|
||||||
|
|
||||||
// setup viewport
|
// setup viewport
|
||||||
fd->viewport[0] = clgame.viewport[0];
|
fd->viewport[0] = clgame.viewport[0];
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ typedef struct
|
|||||||
cl_local_data_t local;
|
cl_local_data_t local;
|
||||||
|
|
||||||
// player final info
|
// player final info
|
||||||
usercmd_t cmd; // cl.commands[outgoing_sequence].cmd
|
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
vec3_t viewheight;
|
vec3_t viewheight;
|
||||||
vec3_t punchangle;
|
vec3_t punchangle;
|
||||||
@@ -807,11 +807,11 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
void CL_FreeFont( cl_font_t *font );
|
void CL_FreeFont( cl_font_t *font );
|
||||||
void CL_SetFontRendermode( cl_font_t *font );
|
void CL_SetFontRendermode( cl_font_t *font );
|
||||||
int CL_DrawCharacter( float x, float y, int number, const rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||||
int CL_DrawString( float x, float y, const char *s, const rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
|
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
|
||||||
int CL_DrawStringf( cl_font_t *font, float x, float y, const rgba_t color, int flags, const char *fmt, ... ) FORMAT_CHECK( 6 );
|
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... ) FORMAT_CHECK( 6 );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -844,21 +844,19 @@ void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int he
|
|||||||
void CL_DisableScissor( scissor_state_t *scissor );
|
void CL_DisableScissor( scissor_state_t *scissor );
|
||||||
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
||||||
|
|
||||||
static inline cl_entity_t *CL_EDICT_NUM( int index )
|
static inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
if( !clgame.entities ) // not in game yet
|
if( !clgame.entities )
|
||||||
{
|
{
|
||||||
Host_Error( "%s: clgame.entities is NULL\n", __func__ );
|
Host_Error( "%s: clgame.entities is NULL\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( index < 0 || index >= clgame.maxEntities )
|
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
||||||
{
|
return clgame.entities + n;
|
||||||
Host_Error( "%s: bad number %i\n", __func__, index );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return clgame.entities + index;
|
Host_Error( "%s: bad number %i\n", __func__, n );
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||||
@@ -869,7 +867,10 @@ static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
|||||||
if( index < 0 || index >= clgame.maxEntities )
|
if( index < 0 || index >= clgame.maxEntities )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return clgame.entities + index;
|
if( index == 0 )
|
||||||
|
return clgame.entities;
|
||||||
|
|
||||||
|
return CL_EDICT_NUM( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline model_t *CL_ModelHandle( int modelindex )
|
static inline model_t *CL_ModelHandle( int modelindex )
|
||||||
@@ -879,7 +880,7 @@ static inline model_t *CL_ModelHandle( int modelindex )
|
|||||||
|
|
||||||
static inline qboolean CL_IsThirdPerson( void )
|
static inline qboolean CL_IsThirdPerson( void )
|
||||||
{
|
{
|
||||||
return clgame.dllFuncs.CL_IsThirdPerson();
|
return clgame.dllFuncs.CL_IsThirdPerson() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline cl_entity_t *CL_GetLocalPlayer( void )
|
static inline cl_entity_t *CL_GetLocalPlayer( void )
|
||||||
@@ -1107,7 +1108,7 @@ int Con_UtfMoveRight( char *str, int pos, int length );
|
|||||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
||||||
cl_font_t *Con_GetCurFont( void );
|
cl_font_t *Con_GetCurFont( void );
|
||||||
cl_font_t *Con_GetFont( int num );
|
cl_font_t *Con_GetFont( int num );
|
||||||
int Con_DrawString( int x, int y, const char *string, const rgba_t setColor ); // legacy, use cl_font.c
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
||||||
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||||
void Con_CharEvent( int key );
|
void Con_CharEvent( int key );
|
||||||
void Key_Console( int key );
|
void Key_Console( int key );
|
||||||
@@ -1214,6 +1215,7 @@ void OSK_Draw( void );
|
|||||||
//
|
//
|
||||||
void ID_Init( void );
|
void ID_Init( void );
|
||||||
const char *ID_GetMD5( void );
|
const char *ID_GetMD5( void );
|
||||||
|
void GAME_EXPORT ID_SetCustomClientID( const char *id );
|
||||||
|
|
||||||
extern rgba_t g_color_table[8];
|
extern rgba_t g_color_table[8];
|
||||||
extern triangleapi_t gTriApi;
|
extern triangleapi_t gTriApi;
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ Con_DrawString
|
|||||||
client version of routine
|
client version of routine
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
int Con_DrawString( int x, int y, const char *string, const rgba_t setColor )
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor )
|
||||||
{
|
{
|
||||||
return CL_DrawString( x, y, string, setColor, con.curFont, FONT_DRAW_UTF8 );
|
return CL_DrawString( x, y, string, setColor, con.curFont, FONT_DRAW_UTF8 );
|
||||||
}
|
}
|
||||||
@@ -843,14 +843,11 @@ If no console is visible, the notify window will pop up.
|
|||||||
*/
|
*/
|
||||||
void Con_Print( const char *txt )
|
void Con_Print( const char *txt )
|
||||||
{
|
{
|
||||||
static qboolean cr_pending = false;
|
static int cr_pending = 0;
|
||||||
static qboolean colorstring = false;
|
static char buf[MAX_PRINT_MSG];
|
||||||
static char buf[MAX_PRINT_MSG];
|
qboolean norefresh = false;
|
||||||
static int lastlength = 0;
|
static int lastlength = 0;
|
||||||
static int bufpos = 0;
|
static int bufpos = 0;
|
||||||
static int charpos = 0;
|
|
||||||
|
|
||||||
qboolean norefresh = false;
|
|
||||||
int c, mask = 0;
|
int c, mask = 0;
|
||||||
|
|
||||||
// client not running
|
// client not running
|
||||||
@@ -876,7 +873,7 @@ void Con_Print( const char *txt )
|
|||||||
if( cr_pending )
|
if( cr_pending )
|
||||||
{
|
{
|
||||||
Con_DeleteLastLine();
|
Con_DeleteLastLine();
|
||||||
cr_pending = false;
|
cr_pending = 0;
|
||||||
}
|
}
|
||||||
c = *txt;
|
c = *txt;
|
||||||
|
|
||||||
@@ -889,42 +886,23 @@ void Con_Print( const char *txt )
|
|||||||
{
|
{
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
cr_pending = true;
|
cr_pending = 1;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
buf[bufpos++] = c | mask;
|
buf[bufpos++] = c | mask;
|
||||||
|
if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 ))
|
||||||
if( IsColorString( txt ))
|
|
||||||
{
|
|
||||||
// first color string character
|
|
||||||
colorstring = true;
|
|
||||||
}
|
|
||||||
else if( colorstring )
|
|
||||||
{
|
|
||||||
// second color string character
|
|
||||||
colorstring = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// not a color string, move char counter
|
|
||||||
charpos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(( bufpos >= sizeof( buf ) - 1 ) || charpos >= ( con.linewidth - 1 ))
|
|
||||||
{
|
{
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -940,7 +918,6 @@ void Con_Print( const char *txt )
|
|||||||
Con_AddLine( buf, bufpos, lastlength != 0 );
|
Con_AddLine( buf, bufpos, lastlength != 0 );
|
||||||
lastlength = 0;
|
lastlength = 0;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
charpos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pump messages to avoid window hanging
|
// pump messages to avoid window hanging
|
||||||
@@ -1267,16 +1244,45 @@ static void Field_CharEvent( field_t *edit, int ch )
|
|||||||
Field_DrawInputLine
|
Field_DrawInputLine
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void Field_DrawInputLine( int x, int y, const field_t *edit )
|
static void Field_DrawInputLine( int x, int y, field_t *edit )
|
||||||
{
|
{
|
||||||
int curPos;
|
int len, cursorChar;
|
||||||
char str[MAX_SYSPATH];
|
int drawLen;
|
||||||
const byte *colorDefault = g_color_table[ColorIndex( COLOR_DEFAULT )];
|
int prestep, curPos;
|
||||||
const int prestep = bound( 0, edit->scroll, sizeof( edit->buffer ) - 1 );
|
char str[MAX_SYSPATH];
|
||||||
const int drawLen = bound( 0, edit->widthInChars, sizeof( str ));
|
byte *colorDefault;
|
||||||
const int cursorCharPos = bound( 0, edit->cursor - prestep, sizeof( str ));
|
|
||||||
|
|
||||||
Q_strncpy( str, edit->buffer + prestep, drawLen );
|
drawLen = edit->widthInChars;
|
||||||
|
len = Q_strlen( edit->buffer ) + 1;
|
||||||
|
colorDefault = g_color_table[ColorIndex( COLOR_DEFAULT )];
|
||||||
|
|
||||||
|
// guarantee that cursor will be visible
|
||||||
|
if( len <= drawLen )
|
||||||
|
{
|
||||||
|
prestep = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( edit->scroll + drawLen > len )
|
||||||
|
{
|
||||||
|
edit->scroll = len - drawLen;
|
||||||
|
if( edit->scroll < 0 ) edit->scroll = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
prestep = edit->scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( prestep + drawLen > len )
|
||||||
|
drawLen = len - prestep;
|
||||||
|
|
||||||
|
// extract <drawLen> characters from the field at <prestep>
|
||||||
|
drawLen = Q_min( drawLen, MAX_SYSPATH - 1 );
|
||||||
|
|
||||||
|
memcpy( str, edit->buffer + prestep, drawLen );
|
||||||
|
str[drawLen] = 0;
|
||||||
|
|
||||||
|
// save char for overstrike
|
||||||
|
cursorChar = str[edit->cursor - prestep];
|
||||||
|
|
||||||
// draw it
|
// draw it
|
||||||
CL_DrawString( x, y, str, colorDefault, con.curFont, FONT_DRAW_UTF8 );
|
CL_DrawString( x, y, str, colorDefault, con.curFont, FONT_DRAW_UTF8 );
|
||||||
@@ -1285,7 +1291,7 @@ static void Field_DrawInputLine( int x, int y, const field_t *edit )
|
|||||||
if((int)( host.realtime * 4 ) & 1 ) return; // off blink
|
if((int)( host.realtime * 4 ) & 1 ) return; // off blink
|
||||||
|
|
||||||
// calc cursor position
|
// calc cursor position
|
||||||
str[cursorCharPos] = 0;
|
str[edit->cursor - prestep] = 0;
|
||||||
CL_DrawStringLen( con.curFont, str, &curPos, NULL, FONT_DRAW_UTF8 );
|
CL_DrawStringLen( con.curFont, str, &curPos, NULL, FONT_DRAW_UTF8 );
|
||||||
|
|
||||||
if( host.key_overstrike )
|
if( host.key_overstrike )
|
||||||
@@ -1461,16 +1467,6 @@ Handles history and console scrollback
|
|||||||
*/
|
*/
|
||||||
void Key_Console( int key )
|
void Key_Console( int key )
|
||||||
{
|
{
|
||||||
// exit the console by pressing MINUS on NSwitch
|
|
||||||
// or both Back(Select)/Start buttons for everyone else
|
|
||||||
if( key == K_BACK_BUTTON || key == K_START_BUTTON || key == K_ESCAPE )
|
|
||||||
{
|
|
||||||
if( cls.state == ca_active && !cl.background )
|
|
||||||
Key_SetKeyDest( key_game );
|
|
||||||
else UI_SetActiveMenu( true );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ctrl-L clears screen
|
// ctrl-L clears screen
|
||||||
if( key == 'l' && Key_IsDown( K_CTRL ))
|
if( key == 'l' && Key_IsDown( K_CTRL ))
|
||||||
{
|
{
|
||||||
@@ -1579,6 +1575,16 @@ void Key_Console( int key )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exit the console by pressing MINUS on NSwitch
|
||||||
|
// or both Back(Select)/Start buttons for everyone else
|
||||||
|
if( key == K_BACK_BUTTON || key == K_START_BUTTON )
|
||||||
|
{
|
||||||
|
if( cls.state == ca_active && !cl.background )
|
||||||
|
Key_SetKeyDest( key_game );
|
||||||
|
else UI_SetActiveMenu( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// pass to the normal editline routine
|
// pass to the normal editline routine
|
||||||
Field_KeyDownEvent( &con.input, key );
|
Field_KeyDownEvent( &con.input, key );
|
||||||
}
|
}
|
||||||
@@ -2002,7 +2008,7 @@ void Con_DrawVersion( void )
|
|||||||
int start, height = refState.height;
|
int start, height = refState.height;
|
||||||
string curbuild;
|
string curbuild;
|
||||||
|
|
||||||
if( !scr_drawversion.value )
|
if( !scr_drawversion.value || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( cls.key_dest == key_menu )
|
if( cls.key_dest == key_menu )
|
||||||
@@ -2014,9 +2020,6 @@ void Con_DrawVersion( void )
|
|||||||
{
|
{
|
||||||
qboolean draw_version;
|
qboolean draw_version;
|
||||||
|
|
||||||
if( CL_IsDevOverviewMode() == 2 || net_graph.value )
|
|
||||||
return;
|
|
||||||
|
|
||||||
draw_version = cls.scrshot_action == scrshot_normal
|
draw_version = cls.scrshot_action == scrshot_normal
|
||||||
|| cls.scrshot_action == scrshot_snapshot
|
|| cls.scrshot_action == scrshot_snapshot
|
||||||
|| host.force_draw_version_time > host.realtime;
|
|| host.force_draw_version_time > host.realtime;
|
||||||
@@ -2132,31 +2135,20 @@ void Con_CharEvent( int key )
|
|||||||
|
|
||||||
static int Con_LoadSimpleConback( const char *name, int flags )
|
static int Con_LoadSimpleConback( const char *name, int flags )
|
||||||
{
|
{
|
||||||
int i;
|
const char *paths[] = {
|
||||||
|
"gfx/shell/%s.dds",
|
||||||
|
"gfx/shell/%s.bmp",
|
||||||
|
"gfx/shell/%s.tga",
|
||||||
|
"cached/%s640",
|
||||||
|
"cached/%s",
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
for( i = 0; i < 5; i++ )
|
for( i = 0; i < ARRAYSIZE( paths ); i++ )
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
|
|
||||||
switch( i )
|
Q_snprintf( path, sizeof( path ), paths[i], name );
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
Q_snprintf( path, sizeof( path ), "gfx/shell/%s.dds", name );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Q_snprintf( path, sizeof( path ), "gfx/shell/%s.bmp", name );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Q_snprintf( path, sizeof( path ), "gfx/shell/%s.tga", name );
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Q_snprintf( path, sizeof( path ), "cached/%s640", name );
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Q_snprintf( path, sizeof( path ), "cached/%s", name );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( g_fsapi.FileExists( path, false ))
|
if( g_fsapi.FileExists( path, false ))
|
||||||
{
|
{
|
||||||
int gl_texturenum = ref.dllFuncs.GL_LoadTexture( path, NULL, 0, flags );
|
int gl_texturenum = ref.dllFuncs.GL_LoadTexture( path, NULL, 0, flags );
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ GNU General Public License for more details.
|
|||||||
#if !XASH_WIN32
|
#if !XASH_WIN32
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char id_md5[33];
|
static char id_md5[33];
|
||||||
|
static char id_customid[MAX_STRING];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================================================
|
==========================================================
|
||||||
@@ -365,10 +365,10 @@ static int ID_GetKeyData( HKEY hRootKey, char *subKey, char *value, LPBYTE data,
|
|||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
|
||||||
if( RegOpenKeyExA( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS )
|
if( RegOpenKeyEx( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( RegQueryValueExA( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS )
|
if( RegQueryValueEx( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
return 0;
|
return 0;
|
||||||
@@ -377,14 +377,13 @@ static int ID_GetKeyData( HKEY hRootKey, char *subKey, char *value, LPBYTE data,
|
|||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
static int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYTE data, DWORD cbData)
|
||||||
static int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYTE data, DWORD cbData )
|
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
if( RegCreateKeyA( hRootKey, subKey, &hKey ) != ERROR_SUCCESS )
|
if( RegCreateKey( hRootKey, subKey, &hKey ) != ERROR_SUCCESS )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( RegSetValueExA( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS )
|
if( RegSetValueEx( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
return 0;
|
return 0;
|
||||||
@@ -396,7 +395,7 @@ static int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value
|
|||||||
|
|
||||||
#define BUFSIZE 4096
|
#define BUFSIZE 4096
|
||||||
|
|
||||||
static int ID_RunWMIC( char *buffer, const wchar_t *cmdline )
|
static int ID_RunWMIC(char *buffer, const char *cmdline)
|
||||||
{
|
{
|
||||||
HANDLE g_IN_Rd = NULL;
|
HANDLE g_IN_Rd = NULL;
|
||||||
HANDLE g_IN_Wr = NULL;
|
HANDLE g_IN_Wr = NULL;
|
||||||
@@ -404,92 +403,75 @@ static int ID_RunWMIC( char *buffer, const wchar_t *cmdline )
|
|||||||
HANDLE g_OUT_Wr = NULL;
|
HANDLE g_OUT_Wr = NULL;
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
wchar_t *cmdline_copy;
|
SECURITY_ATTRIBUTES saAttr;
|
||||||
|
|
||||||
PROCESS_INFORMATION pi = { 0 };
|
STARTUPINFO si = {0};
|
||||||
SECURITY_ATTRIBUTES saAttr =
|
|
||||||
{
|
PROCESS_INFORMATION pi = {0};
|
||||||
.nLength = sizeof( SECURITY_ATTRIBUTES ),
|
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||||
.bInheritHandle = TRUE,
|
saAttr.bInheritHandle = TRUE;
|
||||||
.lpSecurityDescriptor = NULL,
|
saAttr.lpSecurityDescriptor = NULL;
|
||||||
};
|
|
||||||
|
|
||||||
CreatePipe( &g_IN_Rd, &g_IN_Wr, &saAttr, 0 );
|
CreatePipe( &g_IN_Rd, &g_IN_Wr, &saAttr, 0 );
|
||||||
CreatePipe( &g_OUT_Rd, &g_OUT_Wr, &saAttr, 0 );
|
CreatePipe( &g_OUT_Rd, &g_OUT_Wr, &saAttr, 0 );
|
||||||
SetHandleInformation( g_IN_Wr, HANDLE_FLAG_INHERIT, 0 );
|
SetHandleInformation( g_IN_Wr, HANDLE_FLAG_INHERIT, 0 );
|
||||||
|
|
||||||
STARTUPINFO si =
|
si.cb = sizeof(STARTUPINFO);
|
||||||
{
|
si.dwFlags = STARTF_USESTDHANDLES;
|
||||||
.cb = sizeof( STARTUPINFO ),
|
si.hStdInput = g_IN_Rd;
|
||||||
.dwFlags = STARTF_USESTDHANDLES,
|
si.hStdOutput = g_OUT_Wr;
|
||||||
.hStdInput = g_IN_Rd,
|
si.hStdError = g_OUT_Wr;
|
||||||
.hStdOutput = g_OUT_Wr,
|
si.wShowWindow = SW_HIDE;
|
||||||
.hStdError = g_OUT_Wr,
|
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||||
.wShowWindow = SW_HIDE,
|
|
||||||
.dwFlags = STARTF_USESTDHANDLES,
|
|
||||||
};
|
|
||||||
|
|
||||||
cmdline_copy = malloc( wcslen( cmdline ) * sizeof( *cmdline_copy ));
|
CreateProcess( NULL, (char*)cmdline, NULL, NULL, true, CREATE_NO_WINDOW , NULL, NULL, &si, &pi );
|
||||||
|
|
||||||
if( !CreateProcessW( NULL, cmdline_copy, NULL, NULL, true, CREATE_NO_WINDOW, NULL, NULL, &si, &pi ))
|
CloseHandle( g_OUT_Wr );
|
||||||
goto err;
|
CloseHandle( g_IN_Wr );
|
||||||
|
|
||||||
WaitForSingleObject( pi.hProcess, 500 );
|
WaitForSingleObject( pi.hProcess, 500 );
|
||||||
|
|
||||||
bSuccess = ReadFile( g_OUT_Rd, buffer, BUFSIZE, &dwRead, NULL );
|
bSuccess = ReadFile( g_OUT_Rd, buffer, BUFSIZE, &dwRead, NULL );
|
||||||
buffer[BUFSIZE-1] = 0;
|
buffer[BUFSIZE-1] = 0;
|
||||||
|
|
||||||
TerminateProcess( pi.hProcess, 0 );
|
|
||||||
|
|
||||||
CloseHandle( pi.hProcess );
|
|
||||||
CloseHandle( pi.hThread );
|
|
||||||
|
|
||||||
err:
|
|
||||||
CloseHandle( g_IN_Wr );
|
|
||||||
CloseHandle( g_OUT_Wr );
|
|
||||||
CloseHandle( g_IN_Rd );
|
CloseHandle( g_IN_Rd );
|
||||||
CloseHandle( g_OUT_Rd );
|
CloseHandle( g_OUT_Rd );
|
||||||
|
|
||||||
free( cmdline_copy );
|
|
||||||
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ID_ProcessWMIC( bloomfilter_t *value, const wchar_t *cmdline )
|
static int ID_ProcessWMIC( bloomfilter_t *value, const char *cmdline )
|
||||||
{
|
{
|
||||||
char buffer[BUFSIZE], token[BUFSIZE], *pbuf;
|
char buffer[BUFSIZE], token[BUFSIZE], *pbuf;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if( !ID_RunWMIC( buffer, cmdline ))
|
if( !ID_RunWMIC( buffer, cmdline ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
||||||
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token )))
|
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
|
||||||
{
|
{
|
||||||
if( !ID_VerifyHEX( token ))
|
if( !ID_VerifyHEX( token ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*value |= BloomFilter_ProcessStr( token );
|
*value |= BloomFilter_ProcessStr( token );
|
||||||
count++;
|
count ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ID_CheckWMIC( bloomfilter_t value, const wchar_t *cmdline )
|
static int ID_CheckWMIC( bloomfilter_t value, const char *cmdline )
|
||||||
{
|
{
|
||||||
char buffer[BUFSIZE], token[BUFSIZE], *pbuf;
|
char buffer[BUFSIZE], token[BUFSIZE], *pbuf;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if( !ID_RunWMIC( buffer, cmdline ))
|
if( !ID_RunWMIC( buffer, cmdline ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
||||||
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token )))
|
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
|
||||||
{
|
{
|
||||||
bloomfilter_t filter;
|
bloomfilter_t filter;
|
||||||
|
|
||||||
if( !ID_VerifyHEX( token ))
|
if( !ID_VerifyHEX( token ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
filter = BloomFilter_ProcessStr( token );
|
filter = BloomFilter_ProcessStr( token );
|
||||||
@@ -505,10 +487,6 @@ static int ID_CheckWMIC( bloomfilter_t value, const wchar_t *cmdline )
|
|||||||
char *IOS_GetUDID( void );
|
char *IOS_GetUDID( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_PSVITA
|
|
||||||
int PSVita_GetPSID( char *buf, const size_t buflen );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bloomfilter_t ID_GenerateRawId( void )
|
static bloomfilter_t ID_GenerateRawId( void )
|
||||||
{
|
{
|
||||||
bloomfilter_t value = 0;
|
bloomfilter_t value = 0;
|
||||||
@@ -530,22 +508,14 @@ static bloomfilter_t ID_GenerateRawId( void )
|
|||||||
count += ID_ProcessNetDevices( &value );
|
count += ID_ProcessNetDevices( &value );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
count += ID_ProcessWMIC( &value, L"wmic path win32_physicalmedia get SerialNumber " );
|
count += ID_ProcessWMIC( &value, "wmic path win32_physicalmedia get SerialNumber " );
|
||||||
count += ID_ProcessWMIC( &value, L"wmic bios get serialnumber " );
|
count += ID_ProcessWMIC( &value, "wmic bios get serialnumber " );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_IOS
|
#if XASH_IOS
|
||||||
{
|
{
|
||||||
value |= BloomFilter_ProcessStr(IOS_GetUDID());
|
value |= BloomFilter_ProcessStr(IOS_GetUDID());
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if XASH_PSVITA
|
|
||||||
{
|
|
||||||
char data[16];
|
|
||||||
PSVita_GetPSID( data, sizeof( data ));
|
|
||||||
value |= BloomFilter_Process( data, sizeof( data ));
|
|
||||||
count ++;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -574,8 +544,8 @@ static uint ID_CheckRawId( bloomfilter_t filter )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
count += ID_CheckWMIC( filter, L"wmic path win32_physicalmedia get SerialNumber" );
|
count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" );
|
||||||
count += ID_CheckWMIC( filter, L"wmic bios get serialnumber" );
|
count += ID_CheckWMIC( filter, "wmic bios get serialnumber" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_IOS
|
#if XASH_IOS
|
||||||
@@ -585,15 +555,6 @@ static uint ID_CheckRawId( bloomfilter_t filter )
|
|||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if XASH_PSVITA
|
|
||||||
{
|
|
||||||
char data[16];
|
|
||||||
PSVita_GetPSID( data, sizeof( data ));
|
|
||||||
value = BloomFilter_Process( data, sizeof( data ));
|
|
||||||
count += (filter & value) == value;
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if 0
|
#if 0
|
||||||
Msg( "%s: %d\n", __func__, count );
|
Msg( "%s: %d\n", __func__, count );
|
||||||
#endif
|
#endif
|
||||||
@@ -629,9 +590,25 @@ static void ID_Check( void )
|
|||||||
|
|
||||||
const char *ID_GetMD5( void )
|
const char *ID_GetMD5( void )
|
||||||
{
|
{
|
||||||
|
if( id_customid[0] )
|
||||||
|
return id_customid;
|
||||||
return id_md5;
|
return id_md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
ID_SetCustomClientID
|
||||||
|
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void GAME_EXPORT ID_SetCustomClientID( const char *id )
|
||||||
|
{
|
||||||
|
if( !id )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_strncpy( id_customid, id, sizeof( id_customid ) );
|
||||||
|
}
|
||||||
|
|
||||||
void ID_Init( void )
|
void ID_Init( void )
|
||||||
{
|
{
|
||||||
MD5Context_t hash = { 0 };
|
MD5Context_t hash = { 0 };
|
||||||
|
|||||||
@@ -13,17 +13,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if XASH_SDL == 2
|
|
||||||
#include <SDL.h>
|
|
||||||
#elif XASH_SDL == 3
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "vgui_draw.h"
|
#include "vgui_draw.h"
|
||||||
#include "cursor_type.h"
|
#include "cursor_type.h"
|
||||||
|
|
||||||
|
#if XASH_SDL
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
void* in_mousecursor;
|
void* in_mousecursor;
|
||||||
@@ -206,58 +205,50 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_SetRelativeMouseMode( qboolean set )
|
static void IN_SetRelativeMouseMode( qboolean set, qboolean verbose )
|
||||||
{
|
{
|
||||||
static qboolean s_bRawInput;
|
static qboolean s_bRawInput;
|
||||||
qboolean verbose = m_grab_debug.value ? true : false;
|
|
||||||
|
|
||||||
if( set && !s_bRawInput )
|
if( set && !s_bRawInput )
|
||||||
{
|
{
|
||||||
#if XASH_SDL >= 2
|
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
|
||||||
#if XASH_SDL == 2
|
#if XASH_SDL == 2
|
||||||
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
SDL_SetRelativeMouseMode( SDL_TRUE );
|
SDL_SetRelativeMouseMode( SDL_TRUE );
|
||||||
#else // XASH_SDL != 2
|
#endif
|
||||||
SDL_SetWindowRelativeMouseMode( host.hWnd, true );
|
|
||||||
#endif // XASH_SDL != 2
|
|
||||||
#endif // XASH_SDL >= 2
|
|
||||||
s_bRawInput = true;
|
s_bRawInput = true;
|
||||||
if( verbose )
|
if( verbose )
|
||||||
Con_Printf( "%s: true\n", __func__ );
|
Con_Printf( "%s: true\n", __func__ );
|
||||||
}
|
}
|
||||||
else if( !set && s_bRawInput )
|
else if( !set && s_bRawInput )
|
||||||
{
|
{
|
||||||
#if XASH_SDL >= 2
|
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
|
||||||
#if XASH_SDL == 2
|
#if XASH_SDL == 2
|
||||||
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||||
#else // XASH_SDL != 2
|
#endif
|
||||||
SDL_SetWindowRelativeMouseMode( host.hWnd, false );
|
|
||||||
#endif // XASH_SDL != 2
|
|
||||||
#endif // XASH_SDL >= 2
|
|
||||||
|
|
||||||
s_bRawInput = false;
|
s_bRawInput = false;
|
||||||
if( verbose )
|
if( verbose )
|
||||||
Con_Printf( "%s: false\n", __func__ );
|
Con_Printf( "%s: false\n", __func__ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_SetMouseGrab( qboolean set )
|
static void IN_SetMouseGrab( qboolean set, qboolean verbose )
|
||||||
{
|
{
|
||||||
static qboolean s_bMouseGrab;
|
static qboolean s_bMouseGrab;
|
||||||
qboolean verbose = m_grab_debug.value ? true : false;
|
|
||||||
|
|
||||||
if( set && !s_bMouseGrab )
|
if( set && !s_bMouseGrab )
|
||||||
{
|
{
|
||||||
Platform_SetMouseGrab( true );
|
#if XASH_SDL
|
||||||
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
||||||
|
#endif
|
||||||
s_bMouseGrab = true;
|
s_bMouseGrab = true;
|
||||||
if( verbose )
|
if( verbose )
|
||||||
Con_Printf( "%s: true\n", __func__ );
|
Con_Printf( "%s: true\n", __func__ );
|
||||||
}
|
}
|
||||||
else if( !set && s_bMouseGrab )
|
else if( !set && s_bMouseGrab )
|
||||||
{
|
{
|
||||||
Platform_SetMouseGrab( false );
|
#if XASH_SDL
|
||||||
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
|
#endif
|
||||||
|
|
||||||
s_bMouseGrab = false;
|
s_bMouseGrab = false;
|
||||||
if( verbose )
|
if( verbose )
|
||||||
@@ -267,7 +258,7 @@ void IN_SetMouseGrab( qboolean set )
|
|||||||
|
|
||||||
static void IN_CheckMouseState( qboolean active )
|
static void IN_CheckMouseState( qboolean active )
|
||||||
{
|
{
|
||||||
qboolean use_raw_input;
|
qboolean use_raw_input, verbose;
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
use_raw_input = ( m_rawinput.value && clgame.client_dll_uses_sdl ) || clgame.dllFuncs.pfnLookEvent != NULL;
|
use_raw_input = ( m_rawinput.value && clgame.client_dll_uses_sdl ) || clgame.dllFuncs.pfnLookEvent != NULL;
|
||||||
@@ -275,18 +266,20 @@ static void IN_CheckMouseState( qboolean active )
|
|||||||
use_raw_input = true; // always use SDL code
|
use_raw_input = true; // always use SDL code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
verbose = m_grab_debug.value ? true : false;
|
||||||
|
|
||||||
if( m_ignore.value )
|
if( m_ignore.value )
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
if( active && use_raw_input && !host.mouse_visible && cls.state == ca_active )
|
if( active && use_raw_input && !host.mouse_visible && cls.state == ca_active )
|
||||||
IN_SetRelativeMouseMode( true );
|
IN_SetRelativeMouseMode( true, verbose );
|
||||||
else
|
else
|
||||||
IN_SetRelativeMouseMode( false );
|
IN_SetRelativeMouseMode( false, verbose );
|
||||||
|
|
||||||
if( active && !host.mouse_visible && cls.state == ca_active )
|
if( active && !host.mouse_visible && cls.state == ca_active )
|
||||||
IN_SetMouseGrab( true );
|
IN_SetMouseGrab( true, verbose );
|
||||||
else
|
else
|
||||||
IN_SetMouseGrab( false );
|
IN_SetMouseGrab( false, verbose );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -339,7 +332,7 @@ static void IN_MouseMove( void )
|
|||||||
if( !in_mouseinitialized )
|
if( !in_mouseinitialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Touch_WantVisibleCursor( ))
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
Touch_KeyEvent( 0, 0 );
|
Touch_KeyEvent( 0, 0 );
|
||||||
@@ -370,7 +363,7 @@ void IN_MouseEvent( int key, int down )
|
|||||||
else ClearBits( in_mstate, BIT( key ));
|
else ClearBits( in_mstate, BIT( key ));
|
||||||
|
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
if( Touch_WantVisibleCursor( ))
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
Touch_KeyEvent( K_MOUSE1 + key, down );
|
Touch_KeyEvent( K_MOUSE1 + key, down );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ uint IN_CollectInputDevices( void );
|
|||||||
void IN_LockInputDevices( qboolean lock );
|
void IN_LockInputDevices( qboolean lock );
|
||||||
void IN_EngineAppendMove( float frametime, usercmd_t *cmd, qboolean active );
|
void IN_EngineAppendMove( float frametime, usercmd_t *cmd, qboolean active );
|
||||||
|
|
||||||
void IN_SetRelativeMouseMode( qboolean set );
|
|
||||||
void IN_SetMouseGrab( qboolean set );
|
|
||||||
|
|
||||||
extern convar_t m_yaw;
|
extern convar_t m_yaw;
|
||||||
extern convar_t m_pitch;
|
extern convar_t m_pitch;
|
||||||
//
|
//
|
||||||
@@ -77,6 +74,7 @@ void Touch_ResetDefaultButtons( void );
|
|||||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||||
void Touch_KeyEvent( int key, int down );
|
void Touch_KeyEvent( int key, int down );
|
||||||
qboolean Touch_WantVisibleCursor( void );
|
qboolean Touch_WantVisibleCursor( void );
|
||||||
|
qboolean Touch_Emulated( void );
|
||||||
void Touch_NotifyResize( void );
|
void Touch_NotifyResize( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -726,8 +726,18 @@ void GAME_EXPORT Key_Event( int key, int down )
|
|||||||
return; // handled in client.dll
|
return; // handled in client.dll
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case key_message:
|
||||||
break;
|
Key_Message( key );
|
||||||
|
return;
|
||||||
|
case key_console:
|
||||||
|
if( cls.state == ca_active && !cl.background )
|
||||||
|
Key_SetKeyDest( key_game );
|
||||||
|
else UI_SetActiveMenu( true );
|
||||||
|
return;
|
||||||
|
case key_menu:
|
||||||
|
UI_KeyEvent( key, true );
|
||||||
|
return;
|
||||||
|
default: return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -433,8 +433,6 @@ static const ref_api_t gEngfuncs =
|
|||||||
&clgame.drawFuncs,
|
&clgame.drawFuncs,
|
||||||
|
|
||||||
&g_fsapi,
|
&g_fsapi,
|
||||||
|
|
||||||
R_GetWindowHandle,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void R_UnloadProgs( void )
|
static void R_UnloadProgs( void )
|
||||||
@@ -574,7 +572,7 @@ static void R_GetRendererName( char *dest, size_t size, const char *opt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean R_LoadRenderer( const char *refopt, qboolean quiet )
|
static qboolean R_LoadRenderer( const char *refopt )
|
||||||
{
|
{
|
||||||
string refdll;
|
string refdll;
|
||||||
|
|
||||||
@@ -585,8 +583,7 @@ static qboolean R_LoadRenderer( const char *refopt, qboolean quiet )
|
|||||||
if( !R_LoadProgs( refdll ))
|
if( !R_LoadProgs( refdll ))
|
||||||
{
|
{
|
||||||
R_Shutdown();
|
R_Shutdown();
|
||||||
if( !quiet )
|
Sys_Warn( S_ERROR "Can't initialize %s renderer!\n", refdll );
|
||||||
Sys_Warn( S_ERROR "Can't initialize %s renderer!\n", refdll );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,7 +622,7 @@ static void SetFullscreenModeFromCommandLine( void )
|
|||||||
static void R_CollectRendererNames( void )
|
static void R_CollectRendererNames( void )
|
||||||
{
|
{
|
||||||
// ordering is important!
|
// ordering is important!
|
||||||
static const char *short_names[] =
|
static const char *shortNames[] =
|
||||||
{
|
{
|
||||||
#if XASH_REF_GL_ENABLED
|
#if XASH_REF_GL_ENABLED
|
||||||
"gl",
|
"gl",
|
||||||
@@ -648,7 +645,7 @@ static void R_CollectRendererNames( void )
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ordering is important here too!
|
// ordering is important here too!
|
||||||
static const char *long_names[ARRAYSIZE( short_names )] =
|
static const char *readableNames[ARRAYSIZE( shortNames )] =
|
||||||
{
|
{
|
||||||
#if XASH_REF_GL_ENABLED
|
#if XASH_REF_GL_ENABLED
|
||||||
"OpenGL",
|
"OpenGL",
|
||||||
@@ -670,9 +667,9 @@ static void R_CollectRendererNames( void )
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
ref.num_renderers = ARRAYSIZE( short_names );
|
ref.numRenderers = ARRAYSIZE( shortNames );
|
||||||
ref.short_names = short_names;
|
ref.shortNames = shortNames;
|
||||||
ref.long_names = long_names;
|
ref.readableNames = readableNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_Init( void )
|
qboolean R_Init( void )
|
||||||
@@ -733,44 +730,28 @@ qboolean R_Init( void )
|
|||||||
requested_cvar[0] = 0;
|
requested_cvar[0] = 0;
|
||||||
|
|
||||||
if( Sys_GetParmFromCmdLine( "-ref", requested_cmdline ))
|
if( Sys_GetParmFromCmdLine( "-ref", requested_cmdline ))
|
||||||
success = R_LoadRenderer( requested_cmdline, false );
|
success = R_LoadRenderer( requested_cmdline );
|
||||||
|
|
||||||
if( !success && COM_CheckString( r_refdll.string ) && Q_stricmp( requested_cmdline, r_refdll.string ))
|
if( !success && COM_CheckString( r_refdll.string ) && Q_stricmp( requested_cmdline, r_refdll.string ))
|
||||||
{
|
{
|
||||||
Q_strncpy( requested_cvar, r_refdll.string, sizeof( requested_cvar ));
|
Q_strncpy( requested_cvar, r_refdll.string, sizeof( requested_cvar ));
|
||||||
|
success = R_LoadRenderer( requested_cvar );
|
||||||
// do not show scary messages to user if renderer set in config cannot be loaded
|
|
||||||
// as game data could be copied from one platform to another, where this renderer
|
|
||||||
// might not be supported (ref_gl on Android for example)
|
|
||||||
success = R_LoadRenderer( requested_cvar, !host_developer.value );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < ref.num_renderers; i++ )
|
for( i = 0; i < ref.numRenderers && !success; i++ )
|
||||||
{
|
{
|
||||||
// skip renderer that was requested but failed to load
|
// skip renderer that was requested but failed to load
|
||||||
if( !Q_strcmp( requested_cmdline, ref.short_names[i] ))
|
if( !Q_strcmp( requested_cmdline, ref.shortNames[i] ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !Q_strcmp( requested_cvar, ref.short_names[i] ))
|
if( !Q_strcmp( requested_cvar, ref.shortNames[i] ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// do not show bruteforcing attempts, however, warn user about falling back
|
success = R_LoadRenderer( ref.shortNames[i] );
|
||||||
// to software mode
|
|
||||||
if( !Q_strcmp( "soft", ref.short_names[i] ) && !host_developer.value )
|
|
||||||
Sys_Warn( "Can't initialize any hardware accelerated renderer. Falling back to software rendering...\n" );
|
|
||||||
|
|
||||||
success = R_LoadRenderer( ref.short_names[i], !host_developer.value );
|
|
||||||
|
|
||||||
if( success )
|
|
||||||
{
|
|
||||||
// remember last valid renderer
|
|
||||||
Cvar_DirectSet( &r_refdll, ref.short_names[i] );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ struct ref_state_s
|
|||||||
{
|
{
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
int num_renderers;
|
int numRenderers;
|
||||||
ref_interface_t dllFuncs;
|
ref_interface_t dllFuncs;
|
||||||
|
|
||||||
// depends on build configuration
|
// depends on build configuration
|
||||||
const char **short_names;
|
const char **shortNames;
|
||||||
const char **long_names;
|
const char **readableNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct ref_state_s ref;
|
extern struct ref_state_s ref;
|
||||||
|
|||||||
@@ -56,10 +56,12 @@ loading and unpack to wav any known sound
|
|||||||
*/
|
*/
|
||||||
wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size )
|
wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size )
|
||||||
{
|
{
|
||||||
const char *ext = COM_FileExtension( filename );
|
const char *ext = COM_FileExtension( filename );
|
||||||
string loadname;
|
string path, loadname;
|
||||||
qboolean anyformat = true;
|
qboolean anyformat = true;
|
||||||
const loadwavfmt_t *format;
|
fs_offset_t filesize = 0;
|
||||||
|
const loadwavfmt_t *format;
|
||||||
|
byte *f;
|
||||||
|
|
||||||
Sound_Reset(); // clear old sounddata
|
Sound_Reset(); // clear old sounddata
|
||||||
Q_strncpy( loadname, filename, sizeof( loadname ));
|
Q_strncpy( loadname, filename, sizeof( loadname ));
|
||||||
@@ -68,7 +70,7 @@ wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size )
|
|||||||
{
|
{
|
||||||
// we needs to compare file extension with list of supported formats
|
// we needs to compare file extension with list of supported formats
|
||||||
// and be sure what is real extension, not a filename with dot
|
// and be sure what is real extension, not a filename with dot
|
||||||
for( format = sound.loadformats; format && format->ext; format++ )
|
for( format = sound.loadformats; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( format->ext, ext ))
|
if( !Q_stricmp( format->ext, ext ))
|
||||||
{
|
{
|
||||||
@@ -84,42 +86,28 @@ wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size )
|
|||||||
goto load_internal;
|
goto load_internal;
|
||||||
|
|
||||||
// now try all the formats in the selected list
|
// now try all the formats in the selected list
|
||||||
for( format = sound.loadformats; format && format->ext; format++)
|
for( format = sound.loadformats; format && format->formatstring; format++)
|
||||||
{
|
{
|
||||||
if( anyformat || !Q_stricmp( ext, format->ext ))
|
if( anyformat || !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
qboolean success = false;
|
Q_snprintf( path, sizeof( path ),
|
||||||
fs_offset_t filesize = 0;
|
format->formatstring, loadname, "", format->ext );
|
||||||
byte *f;
|
|
||||||
string path;
|
|
||||||
|
|
||||||
Q_snprintf( path, sizeof( path ), DEFAULT_SOUNDPATH "%s.%s", loadname, format->ext );
|
|
||||||
|
|
||||||
f = FS_LoadFile( path, &filesize, false );
|
f = FS_LoadFile( path, &filesize, false );
|
||||||
if( f && filesize > 0 )
|
if( f && filesize > 0 )
|
||||||
{
|
{
|
||||||
success = format->loadfunc( path, f, filesize );
|
if( format->loadfunc( path, f, filesize ))
|
||||||
Mem_Free( f ); // release buffer
|
{
|
||||||
|
Mem_Free(f); // release buffer
|
||||||
|
return SoundPack(); // loaded
|
||||||
|
}
|
||||||
|
else Mem_Free(f); // release buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
if( success )
|
|
||||||
return SoundPack(); // loaded
|
|
||||||
|
|
||||||
Q_snprintf( path, sizeof( path ), "%s.%s", loadname, format->ext );
|
|
||||||
f = FS_LoadFile( path, &filesize, false );
|
|
||||||
if( f && filesize > 0 )
|
|
||||||
{
|
|
||||||
success = format->loadfunc( path, f, filesize );
|
|
||||||
Mem_Free( f ); // release buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
if( success )
|
|
||||||
return SoundPack();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
load_internal:
|
load_internal:
|
||||||
for( format = sound.loadformats; format && format->ext; format++ )
|
for( format = sound.loadformats; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( anyformat || !Q_stricmp( ext, format->ext ))
|
if( anyformat || !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
@@ -160,7 +148,7 @@ open and reading basic info from sound stream
|
|||||||
stream_t *FS_OpenStream( const char *filename )
|
stream_t *FS_OpenStream( const char *filename )
|
||||||
{
|
{
|
||||||
const char *ext = COM_FileExtension( filename );
|
const char *ext = COM_FileExtension( filename );
|
||||||
string loadname;
|
string path, loadname;
|
||||||
qboolean anyformat = true;
|
qboolean anyformat = true;
|
||||||
const streamfmt_t *format;
|
const streamfmt_t *format;
|
||||||
stream_t *stream = NULL;
|
stream_t *stream = NULL;
|
||||||
@@ -172,7 +160,7 @@ stream_t *FS_OpenStream( const char *filename )
|
|||||||
{
|
{
|
||||||
// we needs to compare file extension with list of supported formats
|
// we needs to compare file extension with list of supported formats
|
||||||
// and be sure what is real extension, not a filename with dot
|
// and be sure what is real extension, not a filename with dot
|
||||||
for( format = sound.streamformat; format && format->ext; format++ )
|
for( format = sound.streamformat; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( format->ext, ext ))
|
if( !Q_stricmp( format->ext, ext ))
|
||||||
{
|
{
|
||||||
@@ -184,13 +172,12 @@ stream_t *FS_OpenStream( const char *filename )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now try all the formats in the selected list
|
// now try all the formats in the selected list
|
||||||
for( format = sound.streamformat; format && format->ext; format++)
|
for( format = sound.streamformat; format && format->formatstring; format++)
|
||||||
{
|
{
|
||||||
if( anyformat || !Q_stricmp( ext, format->ext ))
|
if( anyformat || !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
string path;
|
Q_snprintf( path, sizeof( path ),
|
||||||
|
format->formatstring, loadname, "", format->ext );
|
||||||
Q_snprintf( path, sizeof( path ), "%s.%s", loadname, format->ext );
|
|
||||||
|
|
||||||
if(( stream = format->openfunc( path )) != NULL )
|
if(( stream = format->openfunc( path )) != NULL )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ static void LZSS_BuildHash( lzss_state_t *state, const byte *source )
|
|||||||
{
|
{
|
||||||
lzss_list_t *list;
|
lzss_list_t *list;
|
||||||
lzss_node_t *node;
|
lzss_node_t *node;
|
||||||
unsigned int targetindex = (uintptr_t)source & ( state->window_size - 1 );
|
unsigned int targetindex = (uint)source & ( state->window_size - 1 );
|
||||||
|
|
||||||
node = &state->hash_node[targetindex];
|
node = &state->hash_node[targetindex];
|
||||||
|
|
||||||
@@ -900,7 +900,7 @@ float GAME_EXPORT pfnTime( void )
|
|||||||
qboolean COM_IsSafeFileToDownload( const char *filename )
|
qboolean COM_IsSafeFileToDownload( const char *filename )
|
||||||
{
|
{
|
||||||
char lwrfilename[4096];
|
char lwrfilename[4096];
|
||||||
const char *last;
|
const char *first, *last;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
size_t len;
|
size_t len;
|
||||||
int i;
|
int i;
|
||||||
@@ -934,27 +934,25 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < len; i++ )
|
|
||||||
{
|
|
||||||
if( !isprint( filename[i] ))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strnlwr( filename, lwrfilename, sizeof( lwrfilename ));
|
Q_strnlwr( filename, lwrfilename, sizeof( lwrfilename ));
|
||||||
ext = COM_FileExtension( lwrfilename );
|
ext = COM_FileExtension( lwrfilename );
|
||||||
|
|
||||||
if( Q_strpbrk( lwrfilename, "\\:~" ) || Q_strstr( lwrfilename, ".." ))
|
if( Q_strpbrk( lwrfilename, "\\:~" ) || Q_strstr( lwrfilename, ".." ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( lwrfilename[0] == '/' )
|
if( lwrfilename[0] == '/' )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
first = Q_strchr( lwrfilename, '.' );
|
||||||
last = Q_strrchr( lwrfilename, '.' );
|
last = Q_strrchr( lwrfilename, '.' );
|
||||||
|
|
||||||
if( last == NULL )
|
if( first == NULL || last == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( Q_strlen( last ) != 4 )
|
if( first != last )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( Q_strlen( first ) != 4 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( file_exts ); i++ )
|
for( i = 0; i < ARRAYSIZE( file_exts ); i++ )
|
||||||
@@ -1133,7 +1131,6 @@ void Test_RunCommon( void )
|
|||||||
{
|
{
|
||||||
Msg( "Checking COM_IsSafeFileToDownload...\n" );
|
Msg( "Checking COM_IsSafeFileToDownload...\n" );
|
||||||
|
|
||||||
TASSERT_EQi( COM_IsSafeFileToDownload( "models/bsg_props/[hl-lab.ru]bush.mdl" ), true );
|
|
||||||
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD5AAB5E8B307672DA86FBD10AC302BC732" ), true );
|
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD5AAB5E8B307672DA86FBD10AC302BC732" ), true );
|
||||||
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD56f1ffd8c96bd64c9c27955309f6ecfe6" ), false );
|
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD56f1ffd8c96bd64c9c27955309f6ecfe6" ), false );
|
||||||
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD5AAB5E8B307672DA86FBD10AC302B.exe" ), false );
|
TASSERT_EQi( COM_IsSafeFileToDownload( "!MD5AAB5E8B307672DA86FBD10AC302B.exe" ), false );
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ typedef struct host_parm_s
|
|||||||
qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands
|
qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands
|
||||||
qboolean apply_opengl_config; // when true apply only to opengl cvars and ignore all other commands
|
qboolean apply_opengl_config; // when true apply only to opengl cvars and ignore all other commands
|
||||||
qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc
|
qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc
|
||||||
|
qboolean crashed; // set to true if crashed
|
||||||
#if XASH_DLL_LOADER
|
#if XASH_DLL_LOADER
|
||||||
qboolean enabledll;
|
qboolean enabledll;
|
||||||
#endif
|
#endif
|
||||||
@@ -357,7 +358,6 @@ typedef struct host_parm_s
|
|||||||
int window_center_y;
|
int window_center_y;
|
||||||
string gamedll;
|
string gamedll;
|
||||||
string clientlib;
|
string clientlib;
|
||||||
string menulib;
|
|
||||||
} host_parm_t;
|
} host_parm_t;
|
||||||
|
|
||||||
extern host_parm_t host;
|
extern host_parm_t host;
|
||||||
@@ -790,7 +790,7 @@ void Con_NPrintf( int idx, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
|||||||
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
||||||
void UI_NPrintf( int idx, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
void UI_NPrintf( int idx, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
||||||
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
|
||||||
const char *Info_ValueForKey( const char *s, const char *key ) RETURNS_NONNULL NONNULL;
|
const char *Info_ValueForKey( const char *s, const char *key );
|
||||||
void Info_RemovePrefixedKeys( char *start, char prefix );
|
void Info_RemovePrefixedKeys( char *start, char prefix );
|
||||||
qboolean Info_RemoveKey( char *s, const char *key );
|
qboolean Info_RemoveKey( char *s, const char *key );
|
||||||
qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int maxsize );
|
qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int maxsize );
|
||||||
|
|||||||
@@ -103,16 +103,10 @@ Cvar_BuildAutoDescription
|
|||||||
build cvar auto description that based on the setup flags
|
build cvar auto description that based on the setup flags
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags )
|
static const char *Cvar_BuildAutoDescription( int flags )
|
||||||
{
|
{
|
||||||
static char desc[256];
|
static char desc[256];
|
||||||
|
|
||||||
if( FBitSet( flags, FCVAR_GLCONFIG ))
|
|
||||||
{
|
|
||||||
Q_snprintf( desc, sizeof( desc ), CVAR_GLCONFIG_DESCRIPTION, szName );
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
desc[0] = '\0';
|
desc[0] = '\0';
|
||||||
|
|
||||||
if( FBitSet( flags, FCVAR_EXTDLL ))
|
if( FBitSet( flags, FCVAR_EXTDLL ))
|
||||||
@@ -153,7 +147,7 @@ static qboolean Cvar_UpdateInfo( convar_t *var, const char *value, qboolean noti
|
|||||||
{
|
{
|
||||||
if( FBitSet( var->flags, FCVAR_USERINFO ))
|
if( FBitSet( var->flags, FCVAR_USERINFO ))
|
||||||
{
|
{
|
||||||
if( Host_IsDedicated() )
|
if ( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
// g-cont. this is a very strange behavior...
|
// g-cont. this is a very strange behavior...
|
||||||
char *info = SV_Serverinfo();
|
char *info = SV_Serverinfo();
|
||||||
@@ -432,9 +426,8 @@ convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *
|
|||||||
if( COM_CheckStringEmpty( var->desc ))
|
if( COM_CheckStringEmpty( var->desc ))
|
||||||
{
|
{
|
||||||
// directly set value
|
// directly set value
|
||||||
size_t len = Q_strlen( value ) + 1;
|
freestring( var->string );
|
||||||
var->string = Mem_Realloc( cvar_pool, var->string, len );
|
var->string = copystringpool( cvar_pool, value );
|
||||||
Q_strncpy( var->string, value, len );
|
|
||||||
var->value = Q_atof( var->string );
|
var->value = Q_atof( var->string );
|
||||||
SetBits( var->flags, flags );
|
SetBits( var->flags, flags );
|
||||||
|
|
||||||
@@ -448,22 +441,23 @@ convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *
|
|||||||
Cvar_DirectSet( var, value );
|
Cvar_DirectSet( var, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_ALLOCATED ) && Q_strcmp( var_desc, var->desc ))
|
if( FBitSet( var->flags, FCVAR_ALLOCATED ) && var_desc != NULL && Q_strcmp( var_desc, var->desc ))
|
||||||
{
|
{
|
||||||
size_t len = Q_strlen( var_desc ) + 1;
|
|
||||||
|
|
||||||
if( !FBitSet( flags, FCVAR_GLCONFIG ))
|
if( !FBitSet( flags, FCVAR_GLCONFIG ))
|
||||||
Con_Reportf( "%s change description from %s to %s\n", var->name, var->desc, var_desc );
|
Con_Reportf( "%s change description from %s to %s\n", var->name, var->desc, var_desc );
|
||||||
|
|
||||||
// update description if needs
|
// update description if needs
|
||||||
var->desc = Mem_Realloc( cvar_pool, var->desc, len );
|
freestring( var->desc );
|
||||||
Q_strncpy( var->desc, var_desc, len );
|
var->desc = copystringpool( cvar_pool, var_desc );
|
||||||
}
|
}
|
||||||
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate a new cvar
|
// allocate a new cvar
|
||||||
|
|
||||||
|
if( !var_desc )
|
||||||
|
var_desc = Cvar_BuildAutoDescription( flags );
|
||||||
|
|
||||||
var = Mem_Malloc( cvar_pool, sizeof( *var ));
|
var = Mem_Malloc( cvar_pool, sizeof( *var ));
|
||||||
var->name = copystringpool( cvar_pool, name );
|
var->name = copystringpool( cvar_pool, name );
|
||||||
var->string = copystringpool( cvar_pool, value );
|
var->string = copystringpool( cvar_pool, value );
|
||||||
@@ -606,10 +600,9 @@ Cvar_Set2
|
|||||||
static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
const char *pszValue;
|
||||||
qboolean dll_variable = false;
|
qboolean dll_variable = false;
|
||||||
qboolean force = false;
|
qboolean force = false;
|
||||||
const char *fixed_string;
|
|
||||||
size_t fixed_string_len;
|
|
||||||
|
|
||||||
if( !Cvar_ValidateVarName( var_name, false ))
|
if( !Cvar_ValidateVarName( var_name, false ))
|
||||||
{
|
{
|
||||||
@@ -673,20 +666,19 @@ static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
|||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_string = Cvar_ValidateString( var, value );
|
pszValue = Cvar_ValidateString( var, value );
|
||||||
|
|
||||||
// nothing to change
|
// nothing to change
|
||||||
if( !Q_strcmp( fixed_string, var->string ))
|
if( !Q_strcmp( pszValue, var->string ))
|
||||||
return var;
|
return var;
|
||||||
|
|
||||||
// fill it cls.userinfo, svs.serverinfo
|
// fill it cls.userinfo, svs.serverinfo
|
||||||
if( !Cvar_UpdateInfo( var, fixed_string, true ))
|
if( !Cvar_UpdateInfo( var, pszValue, true ))
|
||||||
return var;
|
return var;
|
||||||
|
|
||||||
// and finally change the cvar itself
|
// and finally changed the cvar itself
|
||||||
fixed_string_len = Q_strlen( fixed_string ) + 1;
|
freestring( var->string );
|
||||||
var->string = Mem_Realloc( cvar_pool, var->string, fixed_string_len );
|
var->string = copystringpool( cvar_pool, pszValue );
|
||||||
Q_strncpy( var->string, fixed_string, fixed_string_len );
|
|
||||||
var->value = Q_atof( var->string );
|
var->value = Q_atof( var->string );
|
||||||
|
|
||||||
// tell engine about changes
|
// tell engine about changes
|
||||||
@@ -703,8 +695,7 @@ way to change value for many cvars
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT Cvar_DirectSet( convar_t *var, const char *value )
|
void GAME_EXPORT Cvar_DirectSet( convar_t *var, const char *value )
|
||||||
{
|
{
|
||||||
const char *fixed_string;
|
const char *pszValue;
|
||||||
size_t fixed_string_len;
|
|
||||||
|
|
||||||
if( unlikely( !var )) return; // ???
|
if( unlikely( !var )) return; // ???
|
||||||
|
|
||||||
@@ -734,20 +725,19 @@ void GAME_EXPORT Cvar_DirectSet( convar_t *var, const char *value )
|
|||||||
value = var->def_string; // reset to default value
|
value = var->def_string; // reset to default value
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_string = Cvar_ValidateString( var, value );
|
pszValue = Cvar_ValidateString( var, value );
|
||||||
|
|
||||||
// nothing to change
|
// nothing to change
|
||||||
if( !Q_strcmp( fixed_string, var->string ))
|
if( !Q_strcmp( pszValue, var->string ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fill it cls.userinfo, svs.serverinfo
|
// fill it cls.userinfo, svs.serverinfo
|
||||||
if( !Cvar_UpdateInfo( var, fixed_string, true ))
|
if( !Cvar_UpdateInfo( var, pszValue, true ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// and finally change the cvar itself
|
// and finally changed the cvar itself
|
||||||
fixed_string_len = Q_strlen( fixed_string ) + 1;
|
freestring( var->string );
|
||||||
var->string = Mem_Realloc( cvar_pool, var->string, fixed_string_len );
|
var->string = copystringpool( cvar_pool, pszValue );
|
||||||
Q_strncpy( var->string, fixed_string, fixed_string_len );
|
|
||||||
var->value = Q_atof( var->string );
|
var->value = Q_atof( var->string );
|
||||||
|
|
||||||
// tell engine about changes
|
// tell engine about changes
|
||||||
@@ -781,8 +771,7 @@ can set any protected cvars
|
|||||||
*/
|
*/
|
||||||
void Cvar_FullSet( const char *var_name, const char *value, int flags )
|
void Cvar_FullSet( const char *var_name, const char *value, int flags )
|
||||||
{
|
{
|
||||||
convar_t *var = Cvar_FindVar( var_name );
|
convar_t *var = Cvar_FindVar( var_name );
|
||||||
size_t len = Q_strlen( value ) + 1;
|
|
||||||
|
|
||||||
if( !var )
|
if( !var )
|
||||||
{
|
{
|
||||||
@@ -790,8 +779,8 @@ void Cvar_FullSet( const char *var_name, const char *value, int flags )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var->string = Mem_Realloc( cvar_pool, var->string, len );
|
freestring( var->string );
|
||||||
Q_strncpy( var->string, value, len );
|
var->string = copystringpool( cvar_pool, value );
|
||||||
var->value = Q_atof( var->string );
|
var->value = Q_atof( var->string );
|
||||||
SetBits( var->flags, flags );
|
SetBits( var->flags, flags );
|
||||||
|
|
||||||
@@ -1215,7 +1204,7 @@ static void Cvar_List_f( void )
|
|||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))
|
if( FBitSet( var->flags, FCVAR_EXTENDED|FCVAR_ALLOCATED ))
|
||||||
Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, var->desc );
|
Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, var->desc );
|
||||||
else Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, Cvar_BuildAutoDescription( var->name, var->flags ));
|
else Con_Printf( " %-*s %s ^3%s^7\n", 32, var->name, value, Cvar_BuildAutoDescription( var->flags ));
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ void Cvar_DirectSet( convar_t *var, const char *value );
|
|||||||
void Cvar_DirectSetValue( convar_t *var, float value );
|
void Cvar_DirectSetValue( convar_t *var, float value );
|
||||||
void Cvar_Set( const char *var_name, const char *value );
|
void Cvar_Set( const char *var_name, const char *value );
|
||||||
void Cvar_SetValue( const char *var_name, float value );
|
void Cvar_SetValue( const char *var_name, float value );
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags ) RETURNS_NONNULL;
|
|
||||||
float Cvar_VariableValue( const char *var_name );
|
float Cvar_VariableValue( const char *var_name );
|
||||||
int Cvar_VariableInteger( const char *var_name );
|
int Cvar_VariableInteger( const char *var_name );
|
||||||
const char *Cvar_VariableString( const char *var_name ) RETURNS_NONNULL;
|
const char *Cvar_VariableString( const char *var_name ) RETURNS_NONNULL;
|
||||||
|
|||||||
@@ -16,12 +16,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if XASH_SDL == 2
|
|
||||||
#include <SDL.h> // SDL_GetBasePath
|
|
||||||
#elif XASH_SDL == 3
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
@@ -211,7 +205,7 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size )
|
|||||||
return true;
|
return true;
|
||||||
Sys_Error( "couldn't find %s data directory", XASH_ENGINE_NAME );
|
Sys_Error( "couldn't find %s data directory", XASH_ENGINE_NAME );
|
||||||
return false;
|
return false;
|
||||||
#elif ( XASH_SDL >= 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
#elif ( XASH_SDL == 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
||||||
path = SDL_GetBasePath();
|
path = SDL_GetBasePath();
|
||||||
|
|
||||||
#if XASH_APPLE
|
#if XASH_APPLE
|
||||||
@@ -264,7 +258,8 @@ static qboolean FS_DetermineReadOnlyRootDirectory( char *out, size_t size )
|
|||||||
|
|
||||||
void FS_CheckConfig( void )
|
void FS_CheckConfig( void )
|
||||||
{
|
{
|
||||||
if( fs_mount_lv.value || fs_mount_hd.value || fs_mount_addon.value || fs_mount_l10n.value )
|
// only used to prevent rescan after reading config.cfg when user hasn't enabled any addon directories
|
||||||
|
if( fs_mount_lv.value || fs_mount_hd.value || fs_mount_addon.value || fs_mount_l10n.value || Q_stricmp( ui_language.string, "english" ))
|
||||||
FS_Rescan_f();
|
FS_Rescan_f();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,15 +319,13 @@ void FS_Init( const char *basedir )
|
|||||||
Cvar_RegisterVariable( &fs_mount_lv );
|
Cvar_RegisterVariable( &fs_mount_lv );
|
||||||
Cvar_RegisterVariable( &fs_mount_addon );
|
Cvar_RegisterVariable( &fs_mount_addon );
|
||||||
Cvar_RegisterVariable( &fs_mount_l10n );
|
Cvar_RegisterVariable( &fs_mount_l10n );
|
||||||
|
Cvar_RegisterVariable( &ui_language );
|
||||||
|
|
||||||
if( !Sys_GetParmFromCmdLine( "-dll", host.gamedll ))
|
if( !Sys_GetParmFromCmdLine( "-dll", host.gamedll ))
|
||||||
host.gamedll[0] = 0;
|
host.gamedll[0] = 0;
|
||||||
|
|
||||||
if( !Sys_GetParmFromCmdLine( "-clientlib", host.clientlib ))
|
if( !Sys_GetParmFromCmdLine( "-clientlib", host.clientlib ))
|
||||||
host.clientlib[0] = 0;
|
host.clientlib[0] = 0;
|
||||||
|
|
||||||
if( !Sys_GetParmFromCmdLine( "-menulib", host.menulib ))
|
|
||||||
host.menulib[0] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
#ifdef XASH_SDL
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif // XASH_SDL
|
||||||
#include <stdarg.h> // va_args
|
#include <stdarg.h> // va_args
|
||||||
#if !XASH_WIN32
|
#if !XASH_WIN32
|
||||||
#include <unistd.h> // fork
|
#include <unistd.h> // fork
|
||||||
@@ -137,8 +140,7 @@ static void Sys_PrintUsage( const char *exename )
|
|||||||
|
|
||||||
"\nCommon options:\n"
|
"\nCommon options:\n"
|
||||||
O("-dev [level] ", "set log verbosity 0-2")
|
O("-dev [level] ", "set log verbosity 0-2")
|
||||||
O("-log [file name] ", "write log to \"engine.log\" or [file name] if specified")
|
O("-log ", "write log to \"engine.log\"")
|
||||||
O("-logtime ", "enable writing timestamps to the log file")
|
|
||||||
O("-nowriteconfig ", "disable config save")
|
O("-nowriteconfig ", "disable config save")
|
||||||
O("-noch ", "disable crashhandler")
|
O("-noch ", "disable crashhandler")
|
||||||
#if XASH_WIN32 // !!!!
|
#if XASH_WIN32 // !!!!
|
||||||
@@ -174,7 +176,6 @@ static void Sys_PrintUsage( const char *exename )
|
|||||||
O("-dll <path> ", "override server DLL path")
|
O("-dll <path> ", "override server DLL path")
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
O("-clientlib <path> ", "override client DLL path")
|
O("-clientlib <path> ", "override client DLL path")
|
||||||
O("-menulib <path> ", "override menu DLL path")
|
|
||||||
O("-console ", "run engine with console enabled")
|
O("-console ", "run engine with console enabled")
|
||||||
O("-toconsole ", "run engine witn console open")
|
O("-toconsole ", "run engine witn console open")
|
||||||
O("-oldfont ", "enable unused Quake font in Half-Life")
|
O("-oldfont ", "enable unused Quake font in Half-Life")
|
||||||
@@ -539,6 +540,13 @@ static void Host_MemStats_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Host_Minimize_f( void )
|
||||||
|
{
|
||||||
|
#ifdef XASH_SDL
|
||||||
|
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Host_RegisterDecal
|
Host_RegisterDecal
|
||||||
@@ -689,17 +697,17 @@ static qboolean Host_Autosleep( double dt, double scale )
|
|||||||
static double timewindow; // allocate a time window for sleeps
|
static double timewindow; // allocate a time window for sleeps
|
||||||
static int counter; // for debug
|
static int counter; // for debug
|
||||||
static double realsleeptime;
|
static double realsleeptime;
|
||||||
const double sleeptime = sleep * 0.000001;
|
const double sleeptime = sleep * 0.001;
|
||||||
|
|
||||||
if( dt < targetframetime * scale )
|
if( dt < targetframetime * scale )
|
||||||
{
|
{
|
||||||
// if we have allocated time window, try to sleep
|
// if we have allocated time window, try to sleep
|
||||||
if( timewindow > realsleeptime )
|
if( timewindow > realsleeptime )
|
||||||
{
|
{
|
||||||
// Platform_Sleep isn't guaranteed to sleep an exact amount of microseconds
|
// Platform_Sleep isn't guaranteed to sleep an exact amount of milliseconds
|
||||||
// so we measure the real sleep time and use it to decrease the window
|
// so we measure the real sleep time and use it to decrease the window
|
||||||
double t1 = Sys_DoubleTime(), t2;
|
double t1 = Sys_DoubleTime(), t2;
|
||||||
Platform_NanoSleep( sleep * 1000 ); // in usec!
|
Platform_Sleep( sleep ); // in msec!
|
||||||
t2 = Sys_DoubleTime();
|
t2 = Sys_DoubleTime();
|
||||||
realsleeptime = t2 - t1;
|
realsleeptime = t2 - t1;
|
||||||
|
|
||||||
@@ -1227,14 +1235,6 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
Cvar_Getf( "host_ver", FCVAR_READ_ONLY, "detailed info about this build", "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), g_buildcommit);
|
Cvar_Getf( "host_ver", FCVAR_READ_ONLY, "detailed info about this build", "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), g_buildcommit);
|
||||||
Cvar_Getf( "host_lowmemorymode", FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)", "%i", XASH_LOW_MEMORY );
|
Cvar_Getf( "host_lowmemorymode", FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)", "%i", XASH_LOW_MEMORY );
|
||||||
|
|
||||||
Cvar_Get( "host_hl25_extended_structs",
|
|
||||||
#if SUPPORT_HL25_EXTENDED_STRUCTS
|
|
||||||
"1",
|
|
||||||
#else
|
|
||||||
"0",
|
|
||||||
#endif
|
|
||||||
FCVAR_READ_ONLY, "indicates if engine was compiled with extended msurface_t struct" );
|
|
||||||
|
|
||||||
Mod_Init();
|
Mod_Init();
|
||||||
NET_Init();
|
NET_Init();
|
||||||
NET_InitMasters();
|
NET_InitMasters();
|
||||||
@@ -1269,7 +1269,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
Cmd_AddRestrictedCommand( "quit", Sys_Quit_f, "quit the game" );
|
Cmd_AddRestrictedCommand( "quit", Sys_Quit_f, "quit the game" );
|
||||||
Cmd_AddRestrictedCommand( "exit", Sys_Quit_f, "quit the game" );
|
Cmd_AddRestrictedCommand( "exit", Sys_Quit_f, "quit the game" );
|
||||||
}
|
}
|
||||||
else Cmd_AddRestrictedCommand( "minimize", Platform_Minimize_f, "minimize main window to tray" );
|
else Cmd_AddRestrictedCommand( "minimize", Host_Minimize_f, "minimize main window to tray" );
|
||||||
|
|
||||||
host.errorframe = 0;
|
host.errorframe = 0;
|
||||||
|
|
||||||
@@ -1345,7 +1345,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
#endif // XASH_ANDROID
|
#endif // XASH_ANDROID
|
||||||
|
|
||||||
// main window message loop
|
// main window message loop
|
||||||
while( host.status != HOST_CRASHED )
|
while( !host.crashed )
|
||||||
{
|
{
|
||||||
newtime = Sys_DoubleTime ();
|
newtime = Sys_DoubleTime ();
|
||||||
COM_Frame( newtime - oldtime );
|
COM_Frame( newtime - oldtime );
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
|
|||||||
|
|
||||||
if( pResource->nDownloadSize < HPAK_ENTRY_MIN_SIZE || pResource->nDownloadSize > HPAK_ENTRY_MAX_SIZE )
|
if( pResource->nDownloadSize < HPAK_ENTRY_MIN_SIZE || pResource->nDownloadSize > HPAK_ENTRY_MAX_SIZE )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "%s: invalid size %s\n", name, Q_memprint( pResource->nDownloadSize ));
|
Con_Printf( S_ERROR "%s: invalid size %s\n", name, Q_pretifymem( pResource->nDownloadSize, 2 ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de
|
|||||||
if( dataDir[i].disksize < HPAK_ENTRY_MIN_SIZE || dataDir[i].disksize > HPAK_ENTRY_MAX_SIZE )
|
if( dataDir[i].disksize < HPAK_ENTRY_MIN_SIZE || dataDir[i].disksize > HPAK_ENTRY_MAX_SIZE )
|
||||||
{
|
{
|
||||||
// odd max size
|
// odd max size
|
||||||
Con_DPrintf( S_ERROR "%s: lump %i has invalid size %s\n", __func__, i, Q_memprint( dataDir[i].disksize ));
|
Con_DPrintf( S_ERROR "%s: lump %i has invalid size %s\n", __func__, i, Q_pretifymem( dataDir[i].disksize, 2 ));
|
||||||
Mem_Free( dataDir );
|
Mem_Free( dataDir );
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
if( delete ) FS_Delete( pakname );
|
if( delete ) FS_Delete( pakname );
|
||||||
@@ -462,7 +462,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de
|
|||||||
if( !quiet )
|
if( !quiet )
|
||||||
{
|
{
|
||||||
Con_Printf( "%i: %s %s %s: ", i, COM_ResourceTypeFromIndex( pRes->type ),
|
Con_Printf( "%i: %s %s %s: ", i, COM_ResourceTypeFromIndex( pRes->type ),
|
||||||
Q_memprint( pRes->nDownloadSize ), pRes->szFileName );
|
Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
|
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ typedef enum
|
|||||||
|
|
||||||
typedef struct loadformat_s
|
typedef struct loadformat_s
|
||||||
{
|
{
|
||||||
|
const char *formatstring;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize );
|
qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||||
image_hint_t hint;
|
image_hint_t hint;
|
||||||
@@ -52,6 +53,7 @@ typedef struct loadformat_s
|
|||||||
|
|
||||||
typedef struct saveformat_s
|
typedef struct saveformat_s
|
||||||
{
|
{
|
||||||
|
const char *formatstring;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
qboolean (*savefunc)( const char *name, rgbdata_t *pix );
|
qboolean (*savefunc)( const char *name, rgbdata_t *pix );
|
||||||
} savepixformat_t;
|
} savepixformat_t;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ static const loadpixformat_t *Image_GetLoadFormatForExtension( const char *ext )
|
|||||||
if( !COM_CheckStringEmpty( ext ))
|
if( !COM_CheckStringEmpty( ext ))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for( format = image.loadformats; format->ext; format++ )
|
for( format = image.loadformats; format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( ext, format->ext ))
|
if( !Q_stricmp( ext, format->ext ))
|
||||||
return format;
|
return format;
|
||||||
@@ -237,7 +237,7 @@ static qboolean Image_ProbeLoadBuffer( const loadpixformat_t *fmt, const char *n
|
|||||||
// bruteforce all loaders
|
// bruteforce all loaders
|
||||||
if( !fmt )
|
if( !fmt )
|
||||||
{
|
{
|
||||||
for( fmt = image.loadformats; fmt->ext; fmt++ )
|
for( fmt = image.loadformats; fmt->formatstring; fmt++ )
|
||||||
{
|
{
|
||||||
if( Image_ProbeLoadBuffer_( fmt, name, buf, size, override_hint ))
|
if( Image_ProbeLoadBuffer_( fmt, name, buf, size, override_hint ))
|
||||||
return true;
|
return true;
|
||||||
@@ -256,7 +256,7 @@ static qboolean Image_ProbeLoad_( const loadpixformat_t *fmt, const char *name,
|
|||||||
string path;
|
string path;
|
||||||
byte *f;
|
byte *f;
|
||||||
|
|
||||||
Q_snprintf( path, sizeof( path ), "%s%s.%s", name, suffix, fmt->ext );
|
Q_snprintf( path, sizeof( path ), fmt->formatstring, name, suffix, fmt->ext );
|
||||||
f = FS_LoadFile( path, &filesize, false );
|
f = FS_LoadFile( path, &filesize, false );
|
||||||
|
|
||||||
if( f )
|
if( f )
|
||||||
@@ -274,7 +274,7 @@ static qboolean Image_ProbeLoad( const loadpixformat_t *fmt, const char *name, c
|
|||||||
if( !fmt )
|
if( !fmt )
|
||||||
{
|
{
|
||||||
// bruteforce all formats to allow implicit extension
|
// bruteforce all formats to allow implicit extension
|
||||||
for( fmt = image.loadformats; fmt->ext; fmt++ )
|
for( fmt = image.loadformats; fmt->formatstring; fmt++ )
|
||||||
{
|
{
|
||||||
if( Image_ProbeLoad_( fmt, name, suffix, override_hint ))
|
if( Image_ProbeLoad_( fmt, name, suffix, override_hint ))
|
||||||
return true;
|
return true;
|
||||||
@@ -417,13 +417,14 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix )
|
|||||||
picBuffer = pix->buffer;
|
picBuffer = pix->buffer;
|
||||||
|
|
||||||
// save all sides seperately
|
// save all sides seperately
|
||||||
for( format = image.saveformats; format && format->ext; format++ )
|
for( format = image.saveformats; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( ext, format->ext ))
|
if( !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
for( i = 0; i < 6; i++ )
|
for( i = 0; i < 6; i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "%s%s.%s", savename, box[i].suf, format->ext );
|
Q_snprintf( path, sizeof( path ),
|
||||||
|
format->formatstring, savename, box[i].suf, format->ext );
|
||||||
if( !format->savefunc( path, pix )) break; // there were errors
|
if( !format->savefunc( path, pix )) break; // there were errors
|
||||||
pix->buffer += pix->size; // move pointer
|
pix->buffer += pix->size; // move pointer
|
||||||
}
|
}
|
||||||
@@ -441,11 +442,12 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( format = image.saveformats; format && format->ext; format++ )
|
for( format = image.saveformats; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( ext, format->ext ))
|
if( !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "%s.%s", savename, format->ext );
|
Q_snprintf( path, sizeof( path ),
|
||||||
|
format->formatstring, savename, "", format->ext );
|
||||||
if( format->savefunc( path, pix ))
|
if( format->savefunc( path, pix ))
|
||||||
{
|
{
|
||||||
// clear any force flags
|
// clear any force flags
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
short p, a, b, c, pa, pb, pc;
|
short p, a, b, c, pa, pb, pc;
|
||||||
byte *buf_p, *pixbuf, *raw, *prior, *idat_buf = NULL, *uncompressed_buffer = NULL;
|
byte *buf_p, *pixbuf, *raw, *prior, *idat_buf = NULL, *uncompressed_buffer = NULL;
|
||||||
byte *pallete = NULL, *trns = NULL;
|
byte *pallete = NULL, *trns = NULL;
|
||||||
uint chunk_len, trns_len = 0, plte_len = 0, crc32, crc32_check, oldsize = 0, newsize = 0, rowsize;
|
uint chunk_len, trns_len, plte_len, crc32, crc32_check, oldsize = 0, newsize = 0, rowsize;
|
||||||
uint uncompressed_size, pixel_size, pixel_count, i, y, filter_type, chunk_sign, r_alpha, g_alpha, b_alpha;
|
uint uncompressed_size, pixel_size, pixel_count, i, y, filter_type, chunk_sign, r_alpha, g_alpha, b_alpha;
|
||||||
qboolean has_iend_chunk = false;
|
qboolean has_iend_chunk = false;
|
||||||
z_stream stream = {0};
|
z_stream stream = {0};
|
||||||
|
|||||||
@@ -90,23 +90,23 @@ static byte palette_hl[768] =
|
|||||||
// stub
|
// stub
|
||||||
static const loadpixformat_t load_null[] =
|
static const loadpixformat_t load_null[] =
|
||||||
{
|
{
|
||||||
{ NULL, NULL, IL_HINT_NO }
|
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const loadpixformat_t load_game[] =
|
static const loadpixformat_t load_game[] =
|
||||||
{
|
{
|
||||||
{ "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
|
{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
|
||||||
{ "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
|
{ "%s%s.%s", "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
|
||||||
{ "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
|
{ "%s%s.%s", "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
|
||||||
{ "png", Image_LoadPNG, IL_HINT_NO }, // NightFire 007 menus
|
{ "%s%s.%s", "png", Image_LoadPNG, IL_HINT_NO }, // NightFire 007 menus
|
||||||
{ "mip", Image_LoadMIP, IL_HINT_NO }, // hl textures from wad or buffer
|
{ "%s%s.%s", "mip", Image_LoadMIP, IL_HINT_NO }, // hl textures from wad or buffer
|
||||||
{ "mdl", Image_LoadMDL, IL_HINT_HL }, // hl studio model skins
|
{ "%s%s.%s", "mdl", Image_LoadMDL, IL_HINT_HL }, // hl studio model skins
|
||||||
{ "spr", Image_LoadSPR, IL_HINT_HL }, // hl sprite frames
|
{ "%s%s.%s", "spr", Image_LoadSPR, IL_HINT_HL }, // hl sprite frames
|
||||||
{ "lmp", Image_LoadLMP, IL_HINT_NO }, // hl menu images (cached.wad etc)
|
{ "%s%s.%s", "lmp", Image_LoadLMP, IL_HINT_NO }, // hl menu images (cached.wad etc)
|
||||||
{ "fnt", Image_LoadFNT, IL_HINT_HL }, // hl console font (fonts.wad etc)
|
{ "%s%s.%s", "fnt", Image_LoadFNT, IL_HINT_HL }, // hl console font (fonts.wad etc)
|
||||||
{ "pal", Image_LoadPAL, IL_HINT_NO }, // install studio\sprite palette
|
{ "%s%s.%s", "pal", Image_LoadPAL, IL_HINT_NO }, // install studio\sprite palette
|
||||||
{ "ktx2", Image_LoadKTX2, IL_HINT_NO }, // ktx2 for world and studio models
|
{ "%s%s.%s", "ktx2", Image_LoadKTX2, IL_HINT_NO }, // ktx2 for world and studio models
|
||||||
{ NULL, NULL, IL_HINT_NO }
|
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -119,16 +119,16 @@ static const loadpixformat_t load_game[] =
|
|||||||
// stub
|
// stub
|
||||||
static const savepixformat_t save_null[] =
|
static const savepixformat_t save_null[] =
|
||||||
{
|
{
|
||||||
{ NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Xash3D normal instance
|
// Xash3D normal instance
|
||||||
static const savepixformat_t save_game[] =
|
static const savepixformat_t save_game[] =
|
||||||
{
|
{
|
||||||
{ "tga", Image_SaveTGA }, // tga screenshots
|
{ "%s%s.%s", "tga", Image_SaveTGA }, // tga screenshots
|
||||||
{ "bmp", Image_SaveBMP }, // bmp levelshots or screenshots
|
{ "%s%s.%s", "bmp", Image_SaveBMP }, // bmp levelshots or screenshots
|
||||||
{ "png", Image_SavePNG }, // png screenshots
|
{ "%s%s.%s", "png", Image_SavePNG }, // png screenshots
|
||||||
{ NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
void Image_Setup( void )
|
void Image_Setup( void )
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
|
|
||||||
if( filesize > sizeof( pal ))
|
if( filesize > sizeof( pal ))
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "%s: (%s) have invalid size (%li should be less or equal than %zu)\n", __func__, name, (long)filesize, sizeof( pal ));
|
Con_DPrintf( S_ERROR "%s: (%s) have invalid size (%li should be less or equal than %d)\n", __func__, name, (long)filesize, sizeof( pal ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if( filesize < sizeof( pal ) && buffer != NULL )
|
else if( filesize < sizeof( pal ) && buffer != NULL )
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
|
|||||||
|
|
||||||
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
||||||
{
|
{
|
||||||
#if ( XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE ) && XASH_X86
|
#if ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
||||||
Q_snprintf( out, size, "%s.%s", name, ext );
|
Q_snprintf( out, size, "%s.%s", name, ext );
|
||||||
#elif XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE
|
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
||||||
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
||||||
#else
|
#else
|
||||||
Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), ext );
|
Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), ext );
|
||||||
@@ -185,12 +185,16 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
|||||||
{
|
{
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
#ifdef XASH_INTERNAL_GAMELIBS // assuming library loader knows where to get libraries
|
||||||
Q_strncpy( out, "server", size );
|
Q_strncpy( out, "server", size );
|
||||||
#elif XASH_X86 && XASH_WIN32
|
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
||||||
|
|
||||||
|
#if XASH_WIN32
|
||||||
Q_strncpy( out, GI->game_dll, size );
|
Q_strncpy( out, GI->game_dll, size );
|
||||||
#elif XASH_X86 && XASH_APPLE
|
#elif XASH_APPLE
|
||||||
Q_strncpy( out, GI->game_dll_osx, size );
|
Q_strncpy( out, GI->game_dll_osx, size );
|
||||||
#elif XASH_X86 && XASH_LINUX && !XASH_ANDROID
|
#else // XASH_LINUX
|
||||||
Q_strncpy( out, GI->game_dll_linux, size );
|
Q_strncpy( out, GI->game_dll_linux, size );
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
string dllpath;
|
string dllpath;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
@@ -199,7 +203,7 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
|||||||
Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll, sizeof( dllpath ) );
|
||||||
#elif XASH_APPLE
|
#elif XASH_APPLE
|
||||||
Q_strncpy( dllpath, GI->game_dll_osx, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll_osx, sizeof( dllpath ) );
|
||||||
#else
|
#else // XASH_APPLE
|
||||||
Q_strncpy( dllpath, GI->game_dll_linux, sizeof( dllpath ) );
|
Q_strncpy( dllpath, GI->game_dll_linux, sizeof( dllpath ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -224,14 +228,7 @@ void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t si
|
|||||||
switch( eLibType )
|
switch( eLibType )
|
||||||
{
|
{
|
||||||
case LIBRARY_GAMEUI:
|
case LIBRARY_GAMEUI:
|
||||||
if( COM_CheckStringEmpty( host.menulib ))
|
COM_GenerateClientLibraryPath( "menu", out, size );
|
||||||
{
|
|
||||||
Q_strncpy( out, host.menulib, size );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
COM_GenerateClientLibraryPath( "menu", out, size );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case LIBRARY_CLIENT:
|
case LIBRARY_CLIENT:
|
||||||
if( COM_CheckStringEmpty( host.clientlib ))
|
if( COM_CheckStringEmpty( host.clientlib ))
|
||||||
|
|||||||
@@ -129,11 +129,10 @@ typedef struct
|
|||||||
dclipnode32_t *clipnodes_out; // temporary 32-bit array to hold clipnodes
|
dclipnode32_t *clipnodes_out; // temporary 32-bit array to hold clipnodes
|
||||||
|
|
||||||
// misc stuff
|
// misc stuff
|
||||||
int lightmap_samples; // samples per lightmap (1 or 3)
|
int lightmap_samples; // samples per lightmap (1 or 3)
|
||||||
int version; // model version
|
int version; // model version
|
||||||
qboolean isworld;
|
qboolean isworld;
|
||||||
qboolean isbsp30ext;
|
qboolean isbsp30ext;
|
||||||
qboolean need_clipnode_remap; // try to fit 32-bit clipnodes into 16-bit types
|
|
||||||
} dbspmodel_t;
|
} dbspmodel_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -1580,8 +1579,8 @@ static void CountClipNodes16_r( mclipnode16_t *src, hull_t *hull, int nodenum )
|
|||||||
// leaf?
|
// leaf?
|
||||||
if( nodenum < 0 ) return;
|
if( nodenum < 0 ) return;
|
||||||
|
|
||||||
if( hull->lastclipnode == MAX_MAP_CLIPNODES_HLBSP )
|
if( hull->lastclipnode == MAX_MAP_CLIPNODES )
|
||||||
Host_Error( "%s: MAX_MAP_CLIPNODES_HLBSP limit exceeded\n", __func__ );
|
Host_Error( "MAX_MAP_CLIPNODES limit exceeded\n" );
|
||||||
hull->lastclipnode++;
|
hull->lastclipnode++;
|
||||||
|
|
||||||
CountClipNodes16_r( src, hull, src[nodenum].children[0] );
|
CountClipNodes16_r( src, hull, src[nodenum].children[0] );
|
||||||
@@ -1593,25 +1592,25 @@ static void CountClipNodes32_r( mclipnode32_t *src, hull_t *hull, int nodenum )
|
|||||||
// leaf?
|
// leaf?
|
||||||
if( nodenum < 0 ) return;
|
if( nodenum < 0 ) return;
|
||||||
|
|
||||||
if( hull->lastclipnode == MAX_MAP_CLIPNODES_BSP2 )
|
if( hull->lastclipnode == MAX_MAP_CLIPNODES )
|
||||||
Host_Error( "%s: MAX_MAP_CLIPNODES_BSP2 limit exceeded\n", __func__ );
|
Host_Error( "MAX_MAP_CLIPNODES limit exceeded\n" );
|
||||||
hull->lastclipnode++;
|
hull->lastclipnode++;
|
||||||
|
|
||||||
CountClipNodes32_r( src, hull, src[nodenum].children[0] );
|
CountClipNodes32_r( src, hull, src[nodenum].children[0] );
|
||||||
CountClipNodes32_r( src, hull, src[nodenum].children[1] );
|
CountClipNodes32_r( src, hull, src[nodenum].children[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CountDClipNodes_r( dclipnode32_t *src, hull_t *hull, int nodenum, const int max_clipnodes )
|
static void CountDClipNodes_r( dclipnode32_t *src, hull_t *hull, int nodenum )
|
||||||
{
|
{
|
||||||
// leaf?
|
// leaf?
|
||||||
if( nodenum < 0 ) return;
|
if( nodenum < 0 ) return;
|
||||||
|
|
||||||
if( hull->lastclipnode == max_clipnodes )
|
if( hull->lastclipnode == MAX_MAP_CLIPNODES )
|
||||||
Host_Error( "%s: MAX_MAP_CLIPNODES (%d) limit exceeded\n", __func__, max_clipnodes );
|
Host_Error( "MAX_MAP_CLIPNODES limit exceeded\n" );
|
||||||
hull->lastclipnode++;
|
hull->lastclipnode++;
|
||||||
|
|
||||||
CountDClipNodes_r( src, hull, src[nodenum].children[0], max_clipnodes );
|
CountDClipNodes_r( src, hull, src[nodenum].children[0] );
|
||||||
CountDClipNodes_r( src, hull, src[nodenum].children[1], max_clipnodes );
|
CountDClipNodes_r( src, hull, src[nodenum].children[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1629,17 +1628,8 @@ static int RemapClipNodes_r( dbspmodel_t *bmod, dclipnode32_t *srcnodes, hull_t
|
|||||||
return nodenum;
|
return nodenum;
|
||||||
|
|
||||||
// emit a clipnode
|
// emit a clipnode
|
||||||
if( bmod->version == QBSP2_VERSION )
|
if( hull->lastclipnode == MAX_MAP_CLIPNODES )
|
||||||
{
|
Host_Error( "MAX_MAP_CLIPNODES limit exceeded\n" );
|
||||||
if( hull->lastclipnode == MAX_MAP_CLIPNODES_BSP2 )
|
|
||||||
Host_Error( "%s: MAX_MAP_CLIPNODES_BSP2 limit exceeded\n", __func__ );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( hull->lastclipnode == MAX_MAP_CLIPNODES_HLBSP )
|
|
||||||
Host_Error( "%s: MAX_MAP_CLIPNODES_HLBSP limit exceeded\n", __func__ );
|
|
||||||
}
|
|
||||||
|
|
||||||
src = srcnodes + nodenum;
|
src = srcnodes + nodenum;
|
||||||
|
|
||||||
c = hull->lastclipnode;
|
c = hull->lastclipnode;
|
||||||
@@ -1735,9 +1725,19 @@ static void Mod_MakeHull0( model_t *mod, const dbspmodel_t *bmod )
|
|||||||
Mod_SetupHull
|
Mod_SetupHull
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, int headnode, int hullnum, model_t *world )
|
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, poolhandle_t mempool, int headnode, int hullnum )
|
||||||
{
|
{
|
||||||
hull_t *hull = &mod->hulls[hullnum];
|
hull_t *hull = &mod->hulls[hullnum];
|
||||||
|
|
||||||
|
// assume no hull
|
||||||
|
hull->firstclipnode = hull->lastclipnode = 0;
|
||||||
|
hull->planes = NULL; // hull is missed
|
||||||
|
|
||||||
|
if(( headnode == -1 ) || ( hullnum != 1 && headnode == 0 ))
|
||||||
|
return; // hull missed
|
||||||
|
|
||||||
|
if( headnode >= mod->numclipnodes )
|
||||||
|
return; // ZHLT weird empty hulls
|
||||||
|
|
||||||
switch( hullnum )
|
switch( hullnum )
|
||||||
{
|
{
|
||||||
@@ -1761,75 +1761,13 @@ static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, int headnode, int hu
|
|||||||
if( VectorIsNull( hull->clip_mins ) && VectorIsNull( hull->clip_maxs ))
|
if( VectorIsNull( hull->clip_mins ) && VectorIsNull( hull->clip_maxs ))
|
||||||
return; // no hull specified
|
return; // no hull specified
|
||||||
|
|
||||||
// assume no hull
|
CountDClipNodes_r( bmod->clipnodes_out, hull, headnode );
|
||||||
hull->firstclipnode = hull->lastclipnode = 0;
|
|
||||||
hull->planes = NULL; // hull is missed
|
|
||||||
|
|
||||||
if( headnode >= mod->numclipnodes )
|
|
||||||
return; // ZHLT weird empty hulls
|
|
||||||
|
|
||||||
// take a simpler route if we don't need clipnodes remapping
|
|
||||||
if( !bmod->need_clipnode_remap )
|
|
||||||
{
|
|
||||||
hull->planes = mod->planes;
|
|
||||||
|
|
||||||
// some map "optimizers" (you know who you are!) put -1 here
|
|
||||||
hull->firstclipnode = Q_max( 0, headnode );
|
|
||||||
hull->lastclipnode = mod->numclipnodes - 1;
|
|
||||||
|
|
||||||
// only allocate clipnodes array for the base model, only for first hull
|
|
||||||
if( mod == world && hullnum == 1 )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if( bmod->version == QBSP2_VERSION )
|
|
||||||
{
|
|
||||||
hull->clipnodes32 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes32 ) * mod->numclipnodes );
|
|
||||||
|
|
||||||
for( i = 0; i < mod->numclipnodes; i++ )
|
|
||||||
{
|
|
||||||
hull->clipnodes32[i].planenum = bmod->clipnodes_out[i].planenum;
|
|
||||||
hull->clipnodes32[i].children[0] = bmod->clipnodes_out[i].children[0];
|
|
||||||
hull->clipnodes32[i].children[1] = bmod->clipnodes_out[i].children[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hull->clipnodes16 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes16 ) * mod->numclipnodes );
|
|
||||||
|
|
||||||
for( i = 0; i < mod->numclipnodes; i++ )
|
|
||||||
{
|
|
||||||
hull->clipnodes16[i].planenum = bmod->clipnodes_out[i].planenum;
|
|
||||||
hull->clipnodes16[i].children[0] = bmod->clipnodes_out[i].children[0];
|
|
||||||
hull->clipnodes16[i].children[1] = bmod->clipnodes_out[i].children[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( bmod->version == QBSP2_VERSION )
|
|
||||||
hull->clipnodes32 = world->hulls[1].clipnodes32;
|
|
||||||
else
|
|
||||||
hull->clipnodes16 = world->hulls[1].clipnodes16;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(( headnode == -1 ) || ( hullnum != 1 && headnode == 0 ))
|
|
||||||
return; // hull missed
|
|
||||||
|
|
||||||
// fit array to real count
|
// fit array to real count
|
||||||
if( bmod->version == QBSP2_VERSION )
|
if( bmod->version == QBSP2_VERSION )
|
||||||
{
|
hull->clipnodes32 = Mem_Malloc( mempool, sizeof( *hull->clipnodes32 ) * hull->lastclipnode );
|
||||||
CountDClipNodes_r( bmod->clipnodes_out, hull, headnode, MAX_MAP_CLIPNODES_BSP2 );
|
|
||||||
hull->clipnodes32 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes32 ) * hull->lastclipnode );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
hull->clipnodes16 = Mem_Malloc( mempool, sizeof( *hull->clipnodes16 ) * hull->lastclipnode );
|
||||||
CountDClipNodes_r( bmod->clipnodes_out, hull, headnode, MAX_MAP_CLIPNODES_HLBSP );
|
|
||||||
hull->clipnodes16 = Mem_Malloc( world->mempool, sizeof( *hull->clipnodes16 ) * hull->lastclipnode );
|
|
||||||
}
|
|
||||||
|
|
||||||
hull->planes = mod->planes; // share planes
|
hull->planes = mod->planes; // share planes
|
||||||
hull->lastclipnode = 0; // restart counting
|
hull->lastclipnode = 0; // restart counting
|
||||||
@@ -1913,19 +1851,28 @@ for embedded submodels
|
|||||||
*/
|
*/
|
||||||
static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
|
static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
|
||||||
{
|
{
|
||||||
const qboolean colored = FBitSet( mod->flags, MODEL_COLORED_LIGHTING ) ? true : false;
|
qboolean colored = false;
|
||||||
const qboolean qbsp2 = FBitSet( mod->flags, MODEL_QBSP2 ) ? true : false;
|
qboolean qbsp2 = false;
|
||||||
|
poolhandle_t mempool;
|
||||||
|
char *ents;
|
||||||
|
dmodel_t *bm;
|
||||||
const char *name = mod->name;
|
const char *name = mod->name;
|
||||||
model_t *world = mod; // submodels might want to share hulls
|
int i, j;
|
||||||
int i;
|
|
||||||
|
ents = mod->entities;
|
||||||
|
mempool = mod->mempool;
|
||||||
|
if( FBitSet( mod->flags, MODEL_COLORED_LIGHTING ))
|
||||||
|
colored = true;
|
||||||
|
|
||||||
|
if( FBitSet( mod->flags, MODEL_QBSP2 ))
|
||||||
|
qbsp2 = true;
|
||||||
|
|
||||||
mod->numframes = 2; // regular and alternate animation
|
mod->numframes = 2; // regular and alternate animation
|
||||||
|
|
||||||
// set up the submodels
|
// set up the submodels
|
||||||
for( i = 0; i < mod->numsubmodels; i++ )
|
for( i = 0; i < mod->numsubmodels; i++ )
|
||||||
{
|
{
|
||||||
dmodel_t *bm = &mod->submodels[i];
|
bm = &mod->submodels[i];
|
||||||
int j;
|
|
||||||
|
|
||||||
// hull 0 is just shared across all bmodels
|
// hull 0 is just shared across all bmodels
|
||||||
mod->hulls[0].firstclipnode = bm->headnode[0];
|
mod->hulls[0].firstclipnode = bm->headnode[0];
|
||||||
@@ -1939,7 +1886,7 @@ static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
|
|||||||
|
|
||||||
// but hulls1-3 is build individually for a each given submodel
|
// but hulls1-3 is build individually for a each given submodel
|
||||||
for( j = 1; j < MAX_MAP_HULLS; j++ )
|
for( j = 1; j < MAX_MAP_HULLS; j++ )
|
||||||
Mod_SetupHull( bmod, mod, bm->headnode[j], j, world );
|
Mod_SetupHull( bmod, mod, mempool, bm->headnode[j], j );
|
||||||
|
|
||||||
mod->firstmodelsurface = bm->firstface;
|
mod->firstmodelsurface = bm->firstface;
|
||||||
mod->nummodelsurfaces = bm->numfaces;
|
mod->nummodelsurfaces = bm->numfaces;
|
||||||
@@ -1960,7 +1907,7 @@ static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
|
|||||||
char temp[MAX_VA_STRING];
|
char temp[MAX_VA_STRING];
|
||||||
|
|
||||||
Q_snprintf( temp, sizeof( temp ), "*%i", i );
|
Q_snprintf( temp, sizeof( temp ), "*%i", i );
|
||||||
Mod_FindModelOrigin( world->entities, temp, bm->origin );
|
Mod_FindModelOrigin( ents, temp, bm->origin );
|
||||||
|
|
||||||
// mark models that have origin brushes
|
// mark models that have origin brushes
|
||||||
if( !VectorIsNull( bm->origin ))
|
if( !VectorIsNull( bm->origin ))
|
||||||
@@ -3487,12 +3434,7 @@ static void Mod_LoadClipnodes( model_t *mod, dbspmodel_t *bmod )
|
|||||||
|
|
||||||
if(( bmod->version == QBSP2_VERSION ) || ( bmod->version == HLBSP_VERSION && bmod->isbsp30ext && bmod->numclipnodes >= MAX_MAP_CLIPNODES_HLBSP ))
|
if(( bmod->version == QBSP2_VERSION ) || ( bmod->version == HLBSP_VERSION && bmod->isbsp30ext && bmod->numclipnodes >= MAX_MAP_CLIPNODES_HLBSP ))
|
||||||
{
|
{
|
||||||
dclipnode32_t *in = bmod->clipnodes32;
|
dclipnode32_t *in = bmod->clipnodes32;
|
||||||
|
|
||||||
// bsp30ext allows for extended total amount of clipnodes, but the limit is still 16-bit per submodel
|
|
||||||
// therefore we need to remap them
|
|
||||||
if( bmod->version == HLBSP_VERSION )
|
|
||||||
bmod->need_clipnode_remap = true;
|
|
||||||
|
|
||||||
for( i = 0; i < bmod->numclipnodes; i++, out++, in++ )
|
for( i = 0; i < bmod->numclipnodes; i++, out++, in++ )
|
||||||
{
|
{
|
||||||
@@ -3512,7 +3454,7 @@ static void Mod_LoadClipnodes( model_t *mod, dbspmodel_t *bmod )
|
|||||||
out->children[0] = (unsigned short)in->children[0];
|
out->children[0] = (unsigned short)in->children[0];
|
||||||
out->children[1] = (unsigned short)in->children[1];
|
out->children[1] = (unsigned short)in->children[1];
|
||||||
|
|
||||||
// aguirRe QBSP 'broken' clipnodes
|
// Arguire QBSP 'broken' clipnodes
|
||||||
if( out->children[0] >= bmod->numclipnodes )
|
if( out->children[0] >= bmod->numclipnodes )
|
||||||
out->children[0] -= 65536;
|
out->children[0] -= 65536;
|
||||||
if( out->children[1] >= bmod->numclipnodes )
|
if( out->children[1] >= bmod->numclipnodes )
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded );
|
|||||||
//
|
//
|
||||||
void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded );
|
void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded );
|
||||||
qboolean Mod_TestBmodelLumps( file_t *f, const char *name, const byte *mod_base, qboolean silent, dlump_t *entities );
|
qboolean Mod_TestBmodelLumps( file_t *f, const char *name, const byte *mod_base, qboolean silent, dlump_t *entities );
|
||||||
int Mod_FatPVS( const vec3_t org, float radius, byte *visbuffer, int visbytes, qboolean merge, qboolean fullvis, qboolean phs );
|
int Mod_FatPVS( const vec3_t org, float radius, byte *visbuffer, int visbytes, qboolean merge, qboolean fullvis, qboolean false );
|
||||||
qboolean Mod_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
qboolean Mod_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||||
int Mod_CheckLump( const char *filename, const int lump, int *lumpsize );
|
int Mod_CheckLump( const char *filename, const int lump, int *lumpsize );
|
||||||
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize );
|
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize );
|
||||||
|
|||||||
@@ -382,7 +382,8 @@ static void Mod_StudioCalcRotations( int boneused[], int numbones, const byte *p
|
|||||||
for( j = numbones - 1; j >= 0; j-- )
|
for( j = numbones - 1; j >= 0; j-- )
|
||||||
{
|
{
|
||||||
i = boneused[j];
|
i = boneused[j];
|
||||||
R_StudioCalcBones( frame, s, &pbone[i], &panim[i], adj, pos[i], q[i] );
|
R_StudioCalcBoneQuaternion( frame, s, &pbone[i], &panim[i], adj, q[i] );
|
||||||
|
R_StudioCalcBonePosition( frame, s, &pbone[i], &panim[i], adj, pos[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
if( pseqdesc->motiontype & STUDIO_X ) pos[pseqdesc->motionbone][0] = 0.0f;
|
||||||
@@ -723,7 +724,7 @@ void Mod_StudioComputeBounds( void *buffer, vec3_t mins, vec3_t maxs, qboolean i
|
|||||||
{
|
{
|
||||||
for( k = 0; k < pseqdesc->numframes; k++ )
|
for( k = 0; k < pseqdesc->numframes; k++ )
|
||||||
{
|
{
|
||||||
R_StudioCalcBones( k, 0, &pbones[j], panim, NULL, pos, NULL );
|
R_StudioCalcBonePosition( k, 0, &pbones[j], panim, NULL, pos );
|
||||||
Mod_StudioBoundVertex( vert_mins, vert_maxs, &bone_count, pos );
|
Mod_StudioBoundVertex( vert_mins, vert_maxs, &bone_count, pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
|
|||||||
int nBitsLeft = nBits;
|
int nBitsLeft = nBits;
|
||||||
|
|
||||||
// get output dword-aligned.
|
// get output dword-aligned.
|
||||||
while((( uintptr_t )pOut & 3) != 0 && nBitsLeft >= 8 )
|
while((( uint32_t )pOut & 3) != 0 && nBitsLeft >= 8 )
|
||||||
{
|
{
|
||||||
*pOut = (byte)MSG_ReadUBitLong( sb, 8 );
|
*pOut = (byte)MSG_ReadUBitLong( sb, 8 );
|
||||||
++pOut;
|
++pOut;
|
||||||
@@ -873,7 +873,7 @@ static void Test_Buffer_Write( void )
|
|||||||
MSG_Init( &sb, __func__, testdata, sizeof( testdata ));
|
MSG_Init( &sb, __func__, testdata, sizeof( testdata ));
|
||||||
TASSERT_EQi( sb.iCurBit, 0 );
|
TASSERT_EQi( sb.iCurBit, 0 );
|
||||||
TASSERT_EQi( sb.nDataBits, sizeof( testdata ) << 3 );
|
TASSERT_EQi( sb.nDataBits, sizeof( testdata ) << 3 );
|
||||||
TASSERT_EQp( sb.pData, (void *)testdata );
|
TASSERT_EQi( sb.pData, testdata );
|
||||||
TASSERT_EQi( sb.bOverflow, false );
|
TASSERT_EQi( sb.bOverflow, false );
|
||||||
|
|
||||||
MSG_WriteBytes( &sb, "asdf", 4 );
|
MSG_WriteBytes( &sb, "asdf", 4 );
|
||||||
@@ -929,7 +929,7 @@ static void Test_Buffer_Read( void )
|
|||||||
MSG_StartReading( &sb, (void *)g_testbuf, -1, 0, g_testbuf_bits );
|
MSG_StartReading( &sb, (void *)g_testbuf, -1, 0, g_testbuf_bits );
|
||||||
TASSERT_EQi( sb.iCurBit, 0 );
|
TASSERT_EQi( sb.iCurBit, 0 );
|
||||||
TASSERT_EQi( sb.nDataBits, g_testbuf_bits );
|
TASSERT_EQi( sb.nDataBits, g_testbuf_bits );
|
||||||
TASSERT_EQp( sb.pData, (void *)g_testbuf );
|
TASSERT_EQi( sb.pData, g_testbuf );
|
||||||
TASSERT_EQi( sb.bOverflow, false );
|
TASSERT_EQi( sb.bOverflow, false );
|
||||||
|
|
||||||
MSG_ReadBytes( &sb, buf, 4 );
|
MSG_ReadBytes( &sb, buf, 4 );
|
||||||
|
|||||||
@@ -844,16 +844,7 @@ static int HTTP_FileProcessStream( httpfile_t *curfile )
|
|||||||
|
|
||||||
if( curfile->downloaded >= curfile->size )
|
if( curfile->downloaded >= curfile->size )
|
||||||
{
|
{
|
||||||
// chunked files are finalized in FileSaveReceivedData
|
HTTP_FreeFile( curfile, false ); // success
|
||||||
if( curfile->compressed && !curfile->chunked )
|
|
||||||
{
|
|
||||||
curfile->pfn_process = HTTP_FileDecompress;
|
|
||||||
curfile->success = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HTTP_FreeFile( curfile, false ); // success
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ static CVAR_DEFINE_AUTO( net_resolve_debug, "0", FCVAR_PRIVILEGED, "print resolv
|
|||||||
CVAR_DEFINE( net_clockwindow, "clockwindow", "0.5", FCVAR_PRIVILEGED, "timewindow to execute client moves" );
|
CVAR_DEFINE( net_clockwindow, "clockwindow", "0.5", FCVAR_PRIVILEGED, "timewindow to execute client moves" );
|
||||||
|
|
||||||
netadr_t net_local;
|
netadr_t net_local;
|
||||||
static netadr_t net6_local;
|
netadr_t net6_local;
|
||||||
|
|
||||||
// cvars equivalents for IPv6
|
// cvars equivalents for IPv6
|
||||||
static CVAR_DEFINE( net_ip6name, "ip6", "localhost", FCVAR_PRIVILEGED, "network ip6 address" );
|
static CVAR_DEFINE( net_ip6name, "ip6", "localhost", FCVAR_PRIVILEGED, "network ip6 address" );
|
||||||
@@ -721,6 +721,39 @@ qboolean NET_CompareBaseAdr( const netadr_t a, const netadr_t b )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
NET_CompareClassBAdr
|
||||||
|
|
||||||
|
Compare local masks
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
qboolean NET_CompareClassBAdr( const netadr_t a, const netadr_t b )
|
||||||
|
{
|
||||||
|
netadrtype_t type_a = NET_NetadrType( &a );
|
||||||
|
netadrtype_t type_b = NET_NetadrType( &b );
|
||||||
|
|
||||||
|
if( type_a != type_b )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( type_a == NA_LOOPBACK )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if( type_a == NA_IP )
|
||||||
|
{
|
||||||
|
if( a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: we don't check for IPv6 here
|
||||||
|
// this check is very dumb and only used for LAN restriction
|
||||||
|
// Actual check is in IsReservedAdr
|
||||||
|
|
||||||
|
// for real mask compare use NET_CompareAdrByMask
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
NET_CompareAdrByMask
|
NET_CompareAdrByMask
|
||||||
@@ -1512,7 +1545,7 @@ static int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t
|
|||||||
total_sent += size;
|
total_sent += size;
|
||||||
len -= size;
|
len -= size;
|
||||||
packet_number++;
|
packet_number++;
|
||||||
Platform_NanoSleep( 100 * 1000 );
|
Platform_Sleep( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return total_sent;
|
return total_sent;
|
||||||
@@ -1791,12 +1824,12 @@ static void NET_OpenIP( qboolean change_port, int *sockets, const char *net_ifac
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
NET_DetermineLocalAddress
|
NET_GetLocalAddress
|
||||||
|
|
||||||
Returns the servers' ip address as a string.
|
Returns the servers' ip address as a string.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
static void NET_DetermineLocalAddress( void )
|
static void NET_GetLocalAddress( void )
|
||||||
{
|
{
|
||||||
char hostname[512];
|
char hostname[512];
|
||||||
char buff[512];
|
char buff[512];
|
||||||
@@ -1910,7 +1943,7 @@ void NET_Config( qboolean multiplayer, qboolean changeport )
|
|||||||
// get our local address, if possible
|
// get our local address, if possible
|
||||||
if( bFirst )
|
if( bFirst )
|
||||||
{
|
{
|
||||||
NET_DetermineLocalAddress();
|
NET_GetLocalAddress();
|
||||||
bFirst = false;
|
bFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2006,32 +2039,6 @@ static void NET_ClearLagData( qboolean bClient, qboolean bServer )
|
|||||||
if( bServer ) NET_ClearLaggedList( &net.lagdata[NS_SERVER] );
|
if( bServer ) NET_ClearLaggedList( &net.lagdata[NS_SERVER] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
NET_GetLocalAddress
|
|
||||||
|
|
||||||
get local server addresses
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void NET_GetLocalAddress( netadr_t *ip4, netadr_t *ip6 )
|
|
||||||
{
|
|
||||||
if( ip4 )
|
|
||||||
{
|
|
||||||
if( net.allow_ip )
|
|
||||||
*ip4 = net_local;
|
|
||||||
else
|
|
||||||
memset( ip4, 0, sizeof( *ip4 ));
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ip6 )
|
|
||||||
{
|
|
||||||
if( net.allow_ip6 )
|
|
||||||
*ip6 = net6_local;
|
|
||||||
else
|
|
||||||
memset( ip6, 0, sizeof( *ip6 ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
NET_Init
|
NET_Init
|
||||||
@@ -2053,7 +2060,6 @@ void NET_Init( void )
|
|||||||
Cvar_RegisterVariable( &net_fakelag );
|
Cvar_RegisterVariable( &net_fakelag );
|
||||||
Cvar_RegisterVariable( &net_fakeloss );
|
Cvar_RegisterVariable( &net_fakeloss );
|
||||||
Cvar_RegisterVariable( &net_resolve_debug );
|
Cvar_RegisterVariable( &net_resolve_debug );
|
||||||
Cvar_RegisterVariable( &net_clockwindow );
|
|
||||||
|
|
||||||
Q_snprintf( cmd, sizeof( cmd ), "%i", PORT_SERVER );
|
Q_snprintf( cmd, sizeof( cmd ), "%i", PORT_SERVER );
|
||||||
Cvar_FullSet( "hostport", cmd, FCVAR_READ_ONLY );
|
Cvar_FullSet( "hostport", cmd, FCVAR_READ_ONLY );
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ void NET_Config( qboolean net_enable, qboolean changeport );
|
|||||||
const char *NET_AdrToString( const netadr_t a ) RETURNS_NONNULL;
|
const char *NET_AdrToString( const netadr_t a ) RETURNS_NONNULL;
|
||||||
const char *NET_BaseAdrToString( const netadr_t a ) RETURNS_NONNULL;
|
const char *NET_BaseAdrToString( const netadr_t a ) RETURNS_NONNULL;
|
||||||
qboolean NET_IsReservedAdr( netadr_t a );
|
qboolean NET_IsReservedAdr( netadr_t a );
|
||||||
|
qboolean NET_CompareClassBAdr( const netadr_t a, const netadr_t b );
|
||||||
qboolean NET_StringToAdr( const char *string, netadr_t *adr );
|
qboolean NET_StringToAdr( const char *string, netadr_t *adr );
|
||||||
qboolean NET_StringToFilterAdr( const char *s, netadr_t *adr, uint *prefixlen );
|
qboolean NET_StringToFilterAdr( const char *s, netadr_t *adr, uint *prefixlen );
|
||||||
net_gai_state_t NET_StringToAdrNB( const char *string, netadr_t *adr, qboolean v6only );
|
net_gai_state_t NET_StringToAdrNB( const char *string, netadr_t *adr, qboolean v6only );
|
||||||
@@ -82,8 +83,6 @@ static inline qboolean NET_IsLocalAddress( netadr_t adr )
|
|||||||
return NET_NetadrType( &adr ) == NA_LOOPBACK;
|
return NET_NetadrType( &adr ) == NA_LOOPBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NET_GetLocalAddress( netadr_t *ip4, netadr_t *ip6 );
|
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
int CL_GetSplitSize( void );
|
int CL_GetSplitSize( void );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -290,6 +290,8 @@ typedef struct netchan_s
|
|||||||
} netchan_t;
|
} netchan_t;
|
||||||
|
|
||||||
extern netadr_t net_from;
|
extern netadr_t net_from;
|
||||||
|
extern netadr_t net_local;
|
||||||
|
extern netadr_t net6_local;
|
||||||
extern sizebuf_t net_message;
|
extern sizebuf_t net_message;
|
||||||
extern byte net_message_buffer[NET_MAX_MESSAGE];
|
extern byte net_message_buffer[NET_MAX_MESSAGE];
|
||||||
extern convar_t sv_lan;
|
extern convar_t sv_lan;
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "soundlib.h"
|
#include "soundlib.h"
|
||||||
|
#if XASH_SDL
|
||||||
|
#include <SDL_audio.h>
|
||||||
|
#endif // XASH_SDL
|
||||||
|
|
||||||
// global sound variables
|
// global sound variables
|
||||||
sndlib_t sound;
|
sndlib_t sound;
|
||||||
@@ -28,15 +31,19 @@ sndlib_t sound;
|
|||||||
static const loadwavfmt_t load_game[] =
|
static const loadwavfmt_t load_game[] =
|
||||||
{
|
{
|
||||||
#ifndef XASH_DEDICATED
|
#ifndef XASH_DEDICATED
|
||||||
{ "wav", Sound_LoadWAV },
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "wav", Sound_LoadWAV },
|
||||||
{ "mp3", Sound_LoadMPG },
|
{ "%s%s.%s", "wav", Sound_LoadWAV },
|
||||||
{ "ogg", Sound_LoadOggVorbis },
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "mp3", Sound_LoadMPG },
|
||||||
{ "opus", Sound_LoadOggOpus },
|
{ "%s%s.%s", "mp3", Sound_LoadMPG },
|
||||||
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "ogg", Sound_LoadOggVorbis },
|
||||||
|
{ "%s%s.%s", "ogg", Sound_LoadOggVorbis },
|
||||||
|
{ DEFAULT_SOUNDPATH "%s%s.%s", "opus", Sound_LoadOggOpus },
|
||||||
|
{ "%s%s.%s", "opus", Sound_LoadOggOpus },
|
||||||
#else // we only need extensions
|
#else // we only need extensions
|
||||||
{ "wav" },
|
{ NULL, "wav" },
|
||||||
{ "mp3" },
|
{ NULL, "mp3" },
|
||||||
{ "ogg" },
|
{ NULL, "ogg" },
|
||||||
{ "opus" },
|
{ NULL, "opus" },
|
||||||
#endif
|
#endif
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
@@ -51,15 +58,15 @@ static const loadwavfmt_t load_game[] =
|
|||||||
static const streamfmt_t stream_game[] =
|
static const streamfmt_t stream_game[] =
|
||||||
{
|
{
|
||||||
#ifndef XASH_DEDICATED
|
#ifndef XASH_DEDICATED
|
||||||
{ "mp3", Stream_OpenMPG, Stream_ReadMPG, Stream_SetPosMPG, Stream_GetPosMPG, Stream_FreeMPG },
|
{ "%s%s.%s", "mp3", Stream_OpenMPG, Stream_ReadMPG, Stream_SetPosMPG, Stream_GetPosMPG, Stream_FreeMPG },
|
||||||
{ "wav", Stream_OpenWAV, Stream_ReadWAV, Stream_SetPosWAV, Stream_GetPosWAV, Stream_FreeWAV },
|
{ "%s%s.%s", "wav", Stream_OpenWAV, Stream_ReadWAV, Stream_SetPosWAV, Stream_GetPosWAV, Stream_FreeWAV },
|
||||||
{ "ogg", Stream_OpenOggVorbis, Stream_ReadOggVorbis, Stream_SetPosOggVorbis, Stream_GetPosOggVorbis, Stream_FreeOggVorbis },
|
{ "%s%s.%s", "ogg", Stream_OpenOggVorbis, Stream_ReadOggVorbis, Stream_SetPosOggVorbis, Stream_GetPosOggVorbis, Stream_FreeOggVorbis },
|
||||||
{ "opus", Stream_OpenOggOpus, Stream_ReadOggOpus, Stream_SetPosOggOpus, Stream_GetPosOggOpus, Stream_FreeOggOpus },
|
{ "%s%s.%s", "opus", Stream_OpenOggOpus, Stream_ReadOggOpus, Stream_SetPosOggOpus, Stream_GetPosOggOpus, Stream_FreeOggOpus },
|
||||||
#else // we only need extensions
|
#else // we only need extensions
|
||||||
{ "mp3" },
|
{ NULL, "mp3" },
|
||||||
{ "wav" },
|
{ NULL, "wav" },
|
||||||
{ "ogg" },
|
{ NULL, "ogg" },
|
||||||
{ "opus" },
|
{ NULL, "opus" },
|
||||||
#endif
|
#endif
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
@@ -381,6 +388,31 @@ static qboolean Sound_ResampleInternal( wavdata_t *sc, int outrate, int outwidth
|
|||||||
if( FBitSet( sc->flags, SOUND_LOOPED ))
|
if( FBitSet( sc->flags, SOUND_LOOPED ))
|
||||||
sc->loopStart = sc->loopStart / stepscale;
|
sc->loopStart = sc->loopStart / stepscale;
|
||||||
|
|
||||||
|
#if 0 && XASH_SDL // slow but somewhat accurate (wasn't updated to channel manipulation!!!)
|
||||||
|
{
|
||||||
|
const SDL_AudioFormat infmt = inwidth == 1 ? AUDIO_S8 : AUDIO_S16;
|
||||||
|
const SDL_AudioFormat outfmt = outwidth == 1 ? AUDIO_S8 : AUDIO_S16;
|
||||||
|
SDL_AudioCVT cvt;
|
||||||
|
|
||||||
|
// SDL_AudioCVT does conversion in place, original buffer is used for it
|
||||||
|
if( SDL_BuildAudioCVT( &cvt, infmt, inchannels, inrate, outfmt, outchannels, outrate ) > 0 && cvt.needed )
|
||||||
|
{
|
||||||
|
sc->buffer = (byte *)Mem_Realloc( host.soundpool, sc->buffer, oldsize * cvt.len_mult );
|
||||||
|
cvt.len = oldsize;
|
||||||
|
cvt.buf = sc->buffer;
|
||||||
|
|
||||||
|
if( !SDL_ConvertAudio( &cvt ))
|
||||||
|
{
|
||||||
|
t2 = Sys_DoubleTime();
|
||||||
|
Con_Reportf( "Sound_Resample: from [%d bit %d Hz] to [%d bit %d Hz] (took %.3fs through SDL)\n", inwidth * 8, inrate, outwidth * 8, outrate, t2 - t1 );
|
||||||
|
sc->rate = outrate;
|
||||||
|
sc->width = outwidth;
|
||||||
|
return false; // HACKHACK: return false so Sound_Process won't reallocate buffer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sound.tempbuffer = (byte *)Mem_Realloc( host.soundpool, sound.tempbuffer, sc->size );
|
sound.tempbuffer = (byte *)Mem_Realloc( host.soundpool, sound.tempbuffer, sc->size );
|
||||||
|
|
||||||
if( inrate == outrate ) // no resampling, just copy data
|
if( inrate == outrate ) // no resampling, just copy data
|
||||||
@@ -449,7 +481,7 @@ qboolean Sound_SupportedFileFormat( const char *fileext )
|
|||||||
const loadwavfmt_t *format;
|
const loadwavfmt_t *format;
|
||||||
if( COM_CheckStringEmpty( fileext ))
|
if( COM_CheckStringEmpty( fileext ))
|
||||||
{
|
{
|
||||||
for( format = sound.loadformats; format && format->ext; format++ )
|
for( format = sound.loadformats; format && format->formatstring; format++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( format->ext, fileext ))
|
if( !Q_stricmp( format->ext, fileext ))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
typedef struct loadwavfmt_s
|
typedef struct loadwavfmt_s
|
||||||
{
|
{
|
||||||
|
const char *formatstring;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize );
|
qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||||
} loadwavfmt_t;
|
} loadwavfmt_t;
|
||||||
|
|
||||||
typedef struct streamfmt_s
|
typedef struct streamfmt_s
|
||||||
{
|
{
|
||||||
|
const char *formatstring;
|
||||||
const char *ext;
|
const char *ext;
|
||||||
|
|
||||||
stream_t *(*openfunc)( const char *filename );
|
stream_t *(*openfunc)( const char *filename );
|
||||||
|
|||||||
@@ -31,14 +31,15 @@ GNU General Public License for more details.
|
|||||||
#define XASH_COLORIZE_CONSOLE 0
|
#define XASH_COLORIZE_CONSOLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct logdata_s {
|
typedef struct {
|
||||||
char title[64];
|
char title[64];
|
||||||
qboolean log_active;
|
qboolean log_active;
|
||||||
qboolean log_time;
|
char log_path[MAX_SYSPATH];
|
||||||
char log_path[MAX_SYSPATH];
|
FILE *logfile;
|
||||||
FILE *logfile;
|
int logfileno;
|
||||||
int logfileno;
|
} LogData;
|
||||||
} s_ld;
|
|
||||||
|
static LogData s_ld;
|
||||||
|
|
||||||
void Sys_DestroyConsole( void )
|
void Sys_DestroyConsole( void )
|
||||||
{
|
{
|
||||||
@@ -77,19 +78,14 @@ static void Sys_FlushLogfile( void )
|
|||||||
|
|
||||||
void Sys_InitLog( void )
|
void Sys_InitLog( void )
|
||||||
{
|
{
|
||||||
const char *mode;
|
const char *mode;
|
||||||
|
|
||||||
if( Sys_CheckParm( "-log" ))
|
if( Sys_CheckParm( "-log" ))
|
||||||
{
|
{
|
||||||
if( !Sys_GetParmFromCmdLine( "-log", s_ld.log_path ) || !isalnum( s_ld.log_path[0] ))
|
|
||||||
Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path ));
|
|
||||||
|
|
||||||
COM_DefaultExtension( s_ld.log_path, ".log", sizeof( s_ld.log_path ));
|
|
||||||
s_ld.log_active = true;
|
s_ld.log_active = true;
|
||||||
|
Q_strncpy( s_ld.log_path, "engine.log", sizeof( s_ld.log_path ));
|
||||||
}
|
}
|
||||||
|
|
||||||
s_ld.log_time = Sys_CheckParm( "-logtime" );
|
|
||||||
|
|
||||||
if( host.change_game && host.type != HOST_DEDICATED )
|
if( host.change_game && host.type != HOST_DEDICATED )
|
||||||
mode = "a";
|
mode = "a";
|
||||||
else mode = "w";
|
else mode = "w";
|
||||||
@@ -105,7 +101,7 @@ void Sys_InitLog( void )
|
|||||||
|
|
||||||
if ( !s_ld.logfile )
|
if ( !s_ld.logfile )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "%s: can't create log file %s: %s\n", __func__, s_ld.log_path, strerror( errno ));
|
Con_Reportf( S_ERROR "Sys_InitLog: can't create log file %s: %s\n", s_ld.log_path, strerror( errno ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +267,7 @@ void Sys_PrintLog( const char *pMsg )
|
|||||||
const struct tm *crt_tm;
|
const struct tm *crt_tm;
|
||||||
char logtime[32] = "";
|
char logtime[32] = "";
|
||||||
static char lastchar;
|
static char lastchar;
|
||||||
qboolean print_time = false;
|
qboolean print_time = true;
|
||||||
size_t len, logtime_len = 0;
|
size_t len, logtime_len = 0;
|
||||||
|
|
||||||
if( !lastchar || lastchar == '\n' )
|
if( !lastchar || lastchar == '\n' )
|
||||||
@@ -279,9 +275,11 @@ void Sys_PrintLog( const char *pMsg )
|
|||||||
if( time( &crt_time ) >= 0 )
|
if( time( &crt_time ) >= 0 )
|
||||||
{
|
{
|
||||||
crt_tm = localtime( &crt_time );
|
crt_tm = localtime( &crt_time );
|
||||||
print_time = crt_tm != NULL;
|
if( crt_tm == NULL )
|
||||||
|
print_time = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else print_time = false;
|
||||||
|
|
||||||
if( print_time )
|
if( print_time )
|
||||||
{
|
{
|
||||||
@@ -297,23 +295,17 @@ void Sys_PrintLog( const char *pMsg )
|
|||||||
// save last char to detect when line was not ended
|
// save last char to detect when line was not ended
|
||||||
lastchar = len > 0 ? pMsg[len - 1] : 0;
|
lastchar = len > 0 ? pMsg[len - 1] : 0;
|
||||||
|
|
||||||
// spew to engine.log
|
if( !s_ld.logfile )
|
||||||
if( s_ld.logfile )
|
return;
|
||||||
{
|
|
||||||
if( s_ld.log_time && print_time )
|
|
||||||
{
|
|
||||||
logtime_len = strftime( logtime, sizeof( logtime ), "[%Y:%m:%d|%H:%M:%S] ", crt_tm ); //full time
|
|
||||||
logtime_len = Q_min( logtime_len, sizeof( logtime ) - 1 ); // just in case
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logtime[0] = '\0';
|
|
||||||
logtime_len = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Sys_PrintLogfile( s_ld.logfileno, logtime, logtime_len, pMsg, false );
|
if( print_time )
|
||||||
Sys_FlushLogfile();
|
{
|
||||||
|
logtime_len = strftime( logtime, sizeof( logtime ), "[%Y:%m:%d|%H:%M:%S] ", crt_tm ); //full time
|
||||||
|
logtime_len = Q_min( logtime_len, sizeof( logtime ) - 1 ); // just in case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sys_PrintLogfile( s_ld.logfileno, logtime, logtime_len, pMsg, false );
|
||||||
|
Sys_FlushLogfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
sys_win.c - platform dependent code (which haven't moved to platform dir yet)
|
sys_win.c - platform dependent code
|
||||||
Copyright (C) 2011 Uncle Mike
|
Copyright (C) 2011 Uncle Mike
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -23,10 +23,8 @@ GNU General Public License for more details.
|
|||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_SDL == 2
|
#ifdef XASH_SDL
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#elif XASH_SDL == 3
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_POSIX
|
#if XASH_POSIX
|
||||||
@@ -74,16 +72,17 @@ Sys_DebugBreak
|
|||||||
*/
|
*/
|
||||||
void Sys_DebugBreak( void )
|
void Sys_DebugBreak( void )
|
||||||
{
|
{
|
||||||
qboolean was_grabbed = false;
|
#if XASH_SDL
|
||||||
|
int was_grabbed = host.hWnd != NULL && SDL_GetWindowGrab( host.hWnd );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !Sys_DebuggerPresent( ))
|
if( !Sys_DebuggerPresent( ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( host.hWnd ) // so annoying
|
#if XASH_SDL
|
||||||
{
|
if( was_grabbed ) // so annoying...
|
||||||
was_grabbed = Platform_GetMouseGrab();
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
Platform_SetMouseGrab( false );
|
#endif // XASH_SDL
|
||||||
}
|
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
@@ -92,8 +91,10 @@ void Sys_DebugBreak( void )
|
|||||||
INLINE_NANOSLEEP1(); // sometimes signal comes with delay, let it interrupt nanosleep
|
INLINE_NANOSLEEP1(); // sometimes signal comes with delay, let it interrupt nanosleep
|
||||||
#endif // !_MSC_VER
|
#endif // !_MSC_VER
|
||||||
|
|
||||||
|
#if XASH_SDL
|
||||||
if( was_grabbed )
|
if( was_grabbed )
|
||||||
Platform_SetMouseGrab( true );
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
@@ -125,34 +126,23 @@ returns username for current profile
|
|||||||
*/
|
*/
|
||||||
const char *Sys_GetCurrentUser( void )
|
const char *Sys_GetCurrentUser( void )
|
||||||
{
|
{
|
||||||
// TODO: move to platform
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
static wchar_t sw_userName[MAX_STRING];
|
static string s_userName;
|
||||||
DWORD size = ARRAYSIZE( sw_userName );
|
unsigned long size = sizeof( s_userName );
|
||||||
|
|
||||||
if( GetUserNameW( sw_userName, &size ) && sw_userName[0] != 0 )
|
if( GetUserName( s_userName, &size ))
|
||||||
{
|
|
||||||
static char s_userName[MAX_STRING * 4];
|
|
||||||
|
|
||||||
// set length to -1, so it will null terminate
|
|
||||||
WideCharToMultiByte( CP_UTF8, 0, sw_userName, -1, s_userName, sizeof( s_userName ), NULL, NULL );
|
|
||||||
return s_userName;
|
return s_userName;
|
||||||
}
|
|
||||||
#elif XASH_PSVITA
|
#elif XASH_PSVITA
|
||||||
static string username;
|
static string username;
|
||||||
sceAppUtilSystemParamGetString( SCE_SYSTEM_PARAM_ID_USERNAME, username, sizeof( username ) - 1 );
|
sceAppUtilSystemParamGetString( SCE_SYSTEM_PARAM_ID_USERNAME, username, sizeof( username ) - 1 );
|
||||||
if( COM_CheckStringEmpty( username ))
|
if( COM_CheckStringEmpty( username ))
|
||||||
return username;
|
return username;
|
||||||
#elif XASH_POSIX && !XASH_ANDROID && !XASH_NSWITCH
|
#elif XASH_POSIX && !XASH_ANDROID && !XASH_NSWITCH
|
||||||
static string username;
|
uid_t uid = geteuid();
|
||||||
struct passwd *pw = getpwuid( geteuid( ));
|
struct passwd *pw = getpwuid( uid );
|
||||||
|
|
||||||
// POSIX standard says pw _might_ point to static area, so let's make a copy
|
if( pw )
|
||||||
if( pw && COM_CheckString( pw->pw_name ))
|
return pw->pw_name;
|
||||||
{
|
|
||||||
Q_strncpy( username, pw->pw_name, sizeof( username ));
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return "Player";
|
return "Player";
|
||||||
}
|
}
|
||||||
@@ -403,7 +393,7 @@ void Sys_Error( const char *error, ... )
|
|||||||
|
|
||||||
if( !Host_IsDedicated() )
|
if( !Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
#if XASH_SDL >= 2
|
#if XASH_SDL == 2
|
||||||
if( host.hWnd ) SDL_HideWindow( host.hWnd );
|
if( host.hWnd ) SDL_HideWindow( host.hWnd );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ extern struct tests_stats_s tests_stats;
|
|||||||
_TASSERT( !(exp), Msg( S_ERROR "assert failed at %s:%i\n", __FILE__, __LINE__ ) )
|
_TASSERT( !(exp), Msg( S_ERROR "assert failed at %s:%i\n", __FILE__, __LINE__ ) )
|
||||||
#define TASSERT_EQi( val1, val2 ) \
|
#define TASSERT_EQi( val1, val2 ) \
|
||||||
_TASSERT( ( val1 ) != ( val2 ), Msg( S_ERROR "assert failed at %s:%i, \"%d\" != \"%d\"\n", __FILE__, __LINE__, val1, val2 ))
|
_TASSERT( ( val1 ) != ( val2 ), Msg( S_ERROR "assert failed at %s:%i, \"%d\" != \"%d\"\n", __FILE__, __LINE__, val1, val2 ))
|
||||||
#define TASSERT_EQp( val1, val2 ) \
|
|
||||||
_TASSERT( ( val1 ) != ( val2 ), Msg( S_ERROR "assert failed at %s:%i, \"%p\" != \"%p\"\n", __FILE__, __LINE__, val1, val2 ))
|
|
||||||
#define TASSERT_STR( str1, str2 ) \
|
#define TASSERT_STR( str1, str2 ) \
|
||||||
_TASSERT( Q_strcmp(( str1 ), ( str2 )), Msg( S_ERROR "assert failed at %s:%i, \"%s\" != \"%s\"\n", __FILE__, __LINE__, ( str1 ), ( str2 )))
|
_TASSERT( Q_strcmp(( str1 ), ( str2 )), Msg( S_ERROR "assert failed at %s:%i, \"%s\" != \"%s\"\n", __FILE__, __LINE__, ( str1 ), ( str2 )))
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ typedef struct memheader_s
|
|||||||
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
|
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
|
||||||
} memheader_t;
|
} memheader_t;
|
||||||
|
|
||||||
STATIC_CHECK_SIZEOF( memheader_t, 24, 40 );
|
|
||||||
|
|
||||||
typedef struct mempool_s
|
typedef struct mempool_s
|
||||||
{
|
{
|
||||||
struct memheader_s *chain; // chain of individual memory allocations
|
struct memheader_s *chain; // chain of individual memory allocations
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ typedef struct ui_extendedfuncs_s {
|
|||||||
|
|
||||||
// new engine extended api start here
|
// new engine extended api start here
|
||||||
// returns 1 if there are more in list, otherwise 0
|
// returns 1 if there are more in list, otherwise 0
|
||||||
int (*pfnGetRenderers)( unsigned int num, char *short_name, size_t size1, char *long_name, size_t size2 );
|
int (*pfnGetRenderers)( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 );
|
||||||
double (*pfnDoubleTime)( void );
|
double (*pfnDoubleTime)( void );
|
||||||
char *(*pfnParseFile)( char *data, char *buf, const int size, unsigned int flags, int *len );
|
char *(*pfnParseFile)( char *data, char *buf, const int size, unsigned int flags, int *len );
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
|
#if !defined(XASH_DEDICATED)
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
@@ -22,9 +25,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#if XASH_SDL
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif // XASH_SDL
|
|
||||||
|
|
||||||
struct jnimethods_s
|
struct jnimethods_s
|
||||||
{
|
{
|
||||||
@@ -38,9 +39,6 @@ struct jnimethods_s
|
|||||||
|
|
||||||
void Android_Init( void )
|
void Android_Init( void )
|
||||||
{
|
{
|
||||||
memset( &jni, 0, sizeof( jni ));
|
|
||||||
|
|
||||||
#if XASH_SDL
|
|
||||||
jni.env = (JNIEnv *)SDL_AndroidGetJNIEnv();
|
jni.env = (JNIEnv *)SDL_AndroidGetJNIEnv();
|
||||||
jni.activity = (jobject)SDL_AndroidGetActivity();
|
jni.activity = (jobject)SDL_AndroidGetActivity();
|
||||||
jni.actcls = (*jni.env)->GetObjectClass( jni.env, jni.activity );
|
jni.actcls = (*jni.env)->GetObjectClass( jni.env, jni.activity );
|
||||||
@@ -53,7 +51,6 @@ void Android_Init( void )
|
|||||||
SDL_SetHint( SDL_HINT_ANDROID_BLOCK_ON_PAUSE, "0" );
|
SDL_SetHint( SDL_HINT_ANDROID_BLOCK_ON_PAUSE, "0" );
|
||||||
SDL_SetHint( SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO, "0" );
|
SDL_SetHint( SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO, "0" );
|
||||||
SDL_SetHint( SDL_HINT_ANDROID_TRAP_BACK_BUTTON, "1" );
|
SDL_SetHint( SDL_HINT_ANDROID_TRAP_BACK_BUTTON, "1" );
|
||||||
#endif // !XASH_SDL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -137,3 +134,5 @@ void Platform_ShellExecute( const char *path, const char *parms )
|
|||||||
SDL_OpenURL( path );
|
SDL_OpenURL( path );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ GNU General Public License for more details.
|
|||||||
#ifndef ANDROID_LIB_H
|
#ifndef ANDROID_LIB_H
|
||||||
#define ANDROID_LIB_H
|
#define ANDROID_LIB_H
|
||||||
|
|
||||||
#if !XASH_TERMUX
|
|
||||||
#define Platform_POSIX_LoadLibrary( x ) ANDROID_LoadLibrary(( x ))
|
#define Platform_POSIX_LoadLibrary( x ) ANDROID_LoadLibrary(( x ))
|
||||||
#endif // !XASH_TERMUX
|
|
||||||
|
|
||||||
#define Platform_POSIX_GetProcAddress( x, y ) ANDROID_GetProcAddress(( x ), ( y ))
|
#define Platform_POSIX_GetProcAddress( x, y ) ANDROID_GetProcAddress(( x ), ( y ))
|
||||||
|
|
||||||
void *ANDROID_LoadLibrary( const char *dllname );
|
void *ANDROID_LoadLibrary( const char *dllname );
|
||||||
|
|||||||
@@ -80,11 +80,27 @@ void Platform_RunEvents( void )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
|
||||||
|
{
|
||||||
|
*x = *y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GAME_EXPORT Platform_SetMousePos(int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Platform_EnableTextInput( qboolean enable )
|
void Platform_EnableTextInput( qboolean enable )
|
||||||
{
|
{
|
||||||
keystate.chars = enable;
|
keystate.chars = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Platform_PreCreateMove( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Platform_MouseMove( float *x, float *y )
|
void Platform_MouseMove( float *x, float *y )
|
||||||
{
|
{
|
||||||
static int lx,ly;
|
static int lx,ly;
|
||||||
|
|||||||
@@ -15,11 +15,24 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
|
void Platform_GetClipboardText( char *buffer, size_t size )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform_SetClipboardText( const char *buffer, size_t size )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform_Vibrate(float life, char flags)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Platform_ShellExecute( const char *path, const char *parms )
|
void Platform_ShellExecute( const char *path, const char *parms )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile int ticks=0;
|
volatile int ticks=0;
|
||||||
|
|
||||||
#if XASH_TIMER == TIMER_DOS
|
#if XASH_TIMER == TIMER_DOS
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ GNU General Public License for more details.
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void Platform_Minimize_f( void )
|
|
||||||
{
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
Android_SwapBuffers
|
Android_SwapBuffers
|
||||||
@@ -147,10 +142,17 @@ static qboolean vsync;
|
|||||||
|
|
||||||
void GL_UpdateSwapInterval( void )
|
void GL_UpdateSwapInterval( void )
|
||||||
{
|
{
|
||||||
if( FBitSet( gl_vsync.flags, FCVAR_CHANGED ))
|
// disable VSync while level is loading
|
||||||
|
if( cls.state < ca_active )
|
||||||
{
|
{
|
||||||
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
// setup vsync here
|
||||||
vsync = gl_vsync.value;
|
vsync = false;
|
||||||
|
SetBits( gl_vsync->flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
else if( FBitSet( gl_vsync->flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
ClearBits( gl_vsync->flags, FCVAR_CHANGED );
|
||||||
|
vsync = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,9 +545,4 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
|
||||||
{
|
|
||||||
return REF_WINDOW_TYPE_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void Evdev_Autodetect_f( void )
|
|||||||
|
|
||||||
for( i = 0; i < evdev.devices; i++ )
|
for( i = 0; i < evdev.devices; i++ )
|
||||||
{
|
{
|
||||||
if( !Q_strncmp( evdev.paths[i], path, sizeof( evdev.paths[i] )))
|
if( !Q_strncmp( evdev.paths[i], path, sizeof( evdev.paths[i] ))
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ qboolean SNDDMA_Init( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dma.buffer = Mem_Calloc( sndpool, samples * 2 ); //allocate pcm frame buffer
|
dma.buffer = Mem_Malloc( sndpool, samples * 2 ); //allocate pcm frame buffer
|
||||||
dma.samplepos = 0;
|
dma.samplepos = 0;
|
||||||
dma.samples = samples;
|
dma.samples = samples;
|
||||||
dma.format.width = 2;
|
dma.format.width = 2;
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ struct fb_s
|
|||||||
|
|
||||||
#define DEFAULT_FBDEV "/dev/fb0"
|
#define DEFAULT_FBDEV "/dev/fb0"
|
||||||
|
|
||||||
void Platform_Minimize_f( void )
|
|
||||||
{
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
Android_SwapBuffers
|
Android_SwapBuffers
|
||||||
@@ -65,7 +60,7 @@ qboolean R_Init_Video( const int type )
|
|||||||
|
|
||||||
if( fb.fd < 0 )
|
if( fb.fd < 0 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "failed to open framebuffer device: %s\n", strerror(errno));
|
Con_Printf( S_ERROR, "failed to open framebuffer device: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Sys_CheckParm( "-ttygfx" ) )
|
if( Sys_CheckParm( "-ttygfx" ) )
|
||||||
@@ -134,7 +129,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
|
|||||||
Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height );
|
Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height );
|
||||||
|
|
||||||
VID_SetDisplayTransform( &render_w, &render_h );
|
VID_SetDisplayTransform( &render_w, &render_h );
|
||||||
R_SaveVideoMode( width, height, render_w, render_h, false );
|
R_SaveVideoMode( width, height, render_w, render_h );
|
||||||
|
|
||||||
return rserr_ok;
|
return rserr_ok;
|
||||||
}
|
}
|
||||||
@@ -166,10 +161,17 @@ void* GL_GetProcAddress( const char *name ) // RenderAPI requirement
|
|||||||
|
|
||||||
void GL_UpdateSwapInterval( void )
|
void GL_UpdateSwapInterval( void )
|
||||||
{
|
{
|
||||||
if( FBitSet( gl_vsync.flags, FCVAR_CHANGED ))
|
// disable VSync while level is loading
|
||||||
|
if( cls.state < ca_active )
|
||||||
|
{
|
||||||
|
// setup fb vsync here
|
||||||
|
fb.vsync = false;
|
||||||
|
SetBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
else if( FBitSet( gl_vsync.flags, FCVAR_CHANGED ))
|
||||||
{
|
{
|
||||||
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||||
fb.vsync = gl_vsync.value;
|
fb.vsync = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,9 +248,41 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref_window_type_t R_GetWindowHandle( void **handle, ref_window_type_t type )
|
// unrelated stubs
|
||||||
|
void Platform_GetClipboardText( char *buffer, size_t size )
|
||||||
{
|
{
|
||||||
return REF_WINDOW_TYPE_NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Platform_SetClipboardText( const char *buffer, size_t size )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform_PreCreateMove( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// will be implemented later
|
||||||
|
void Platform_RunEvents( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
|
||||||
|
{
|
||||||
|
*x = *y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GAME_EXPORT Platform_SetMousePos(int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform_Vibrate( float life, char flags )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ GNU General Public License for more details.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
double Platform_DoubleTime( void );
|
double Platform_DoubleTime( void );
|
||||||
void Platform_Sleep( int msec );
|
|
||||||
void Platform_ShellExecute( const char *path, const char *parms );
|
void Platform_ShellExecute( const char *path, const char *parms );
|
||||||
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow );
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow );
|
||||||
void Platform_SetStatus( const char *status );
|
void Platform_SetStatus( const char *status );
|
||||||
@@ -58,7 +57,6 @@ char *Posix_Input( void );
|
|||||||
#if XASH_SDL
|
#if XASH_SDL
|
||||||
void SDLash_Init( const char *basedir );
|
void SDLash_Init( const char *basedir );
|
||||||
void SDLash_Shutdown( void );
|
void SDLash_Shutdown( void );
|
||||||
void SDLash_NanoSleep( int nsec );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_ANDROID
|
#if XASH_ANDROID
|
||||||
@@ -72,9 +70,6 @@ void Android_Shutdown( void );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
void Win32_Init( qboolean con_showalways );
|
|
||||||
void Win32_Shutdown( void );
|
|
||||||
qboolean Win32_NanoSleep( int nsec );
|
|
||||||
void Wcon_CreateConsole( qboolean con_showalways );
|
void Wcon_CreateConsole( qboolean con_showalways );
|
||||||
void Wcon_DestroyConsole( void );
|
void Wcon_DestroyConsole( void );
|
||||||
void Wcon_InitConsoleCommands( void );
|
void Wcon_InitConsoleCommands( void );
|
||||||
@@ -129,7 +124,7 @@ static inline void Platform_Init( qboolean con_showalways, const char *basedir )
|
|||||||
#elif XASH_DOS
|
#elif XASH_DOS
|
||||||
DOS_Init( );
|
DOS_Init( );
|
||||||
#elif XASH_WIN32
|
#elif XASH_WIN32
|
||||||
Win32_Init( con_showalways );
|
Wcon_CreateConsole( con_showalways );
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
Linux_Init( );
|
Linux_Init( );
|
||||||
#endif
|
#endif
|
||||||
@@ -144,7 +139,7 @@ static inline void Platform_Shutdown( void )
|
|||||||
#elif XASH_DOS
|
#elif XASH_DOS
|
||||||
DOS_Shutdown( );
|
DOS_Shutdown( );
|
||||||
#elif XASH_WIN32
|
#elif XASH_WIN32
|
||||||
Win32_Shutdown( );
|
Wcon_DestroyConsole( );
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
Linux_Shutdown( );
|
Linux_Shutdown( );
|
||||||
#endif
|
#endif
|
||||||
@@ -170,22 +165,16 @@ static inline void Platform_SetupSigtermHandling( void )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline qboolean Platform_NanoSleep( int nsec )
|
static inline void Platform_Sleep( int msec )
|
||||||
{
|
{
|
||||||
#if XASH_SDL == 3
|
#if XASH_TIMER == TIMER_SDL
|
||||||
SDLash_NanoSleep( nsec );
|
SDL_Delay( msec );
|
||||||
return true;
|
#elif XASH_TIMER == TIMER_POSIX
|
||||||
// SDL2 doesn't have nanosleep, so use low-level functions here
|
usleep( msec * 1000 );
|
||||||
#elif XASH_POSIX
|
#elif XASH_TIMER == TIMER_WIN32
|
||||||
struct timespec ts = {
|
Sleep( msec );
|
||||||
.tv_sec = 0,
|
|
||||||
.tv_nsec = nsec, // just don't put large numbers here
|
|
||||||
};
|
|
||||||
return nanosleep( &ts, NULL ) == 0;
|
|
||||||
#elif XASH_WIN32
|
|
||||||
return Win32_NanoSleep( nsec );
|
|
||||||
#else
|
#else
|
||||||
return false;
|
// stub
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,13 +199,8 @@ static inline void Sys_RestoreCrashHandler( void )
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
#if XASH_SDL >= 2
|
|
||||||
void Platform_Vibrate( float life, char flags ); // left for compatibility
|
void Platform_Vibrate( float life, char flags ); // left for compatibility
|
||||||
void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags );
|
void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags );
|
||||||
#else
|
|
||||||
static inline void Platform_Vibrate( float life, char flags ) {}
|
|
||||||
static inline void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags ) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@@ -225,58 +209,51 @@ static inline void Platform_Vibrate2( float time, int low_freq, int high_freq, u
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
#if XASH_SDL // only SDL based backends implements these functions
|
// Gamepad support
|
||||||
void Platform_PreCreateMove( void );
|
#if XASH_SDL
|
||||||
void GAME_EXPORT Platform_GetMousePos( int *x, int *y );
|
|
||||||
void GAME_EXPORT Platform_SetMousePos( int x, int y );
|
|
||||||
qboolean Platform_GetMouseGrab( void );
|
|
||||||
void Platform_SetMouseGrab( qboolean enable );
|
|
||||||
void Platform_SetCursorType( VGUI_DefaultCursor type );
|
|
||||||
int Platform_GetClipboardText( char *buffer, size_t size );
|
|
||||||
void Platform_SetClipboardText( const char *buffer );
|
|
||||||
#else
|
|
||||||
static inline void Platform_PreCreateMove( void ) { }
|
|
||||||
static inline void GAME_EXPORT Platform_SetMousePos( int x, int y ) { }
|
|
||||||
static inline void Platform_SetMouseGrab( qboolean enable ) { }
|
|
||||||
static inline void Platform_SetCursorType( VGUI_DefaultCursor type ) { }
|
|
||||||
static inline int Platform_GetClipboardText( char *buffer, size_t size ) { return 0; }
|
|
||||||
static inline void Platform_SetClipboardText( const char *buffer ) { }
|
|
||||||
static inline qboolean Platform_GetMouseGrab( void ) { return false; }
|
|
||||||
static inline void GAME_EXPORT Platform_GetMousePos( int *x, int *y )
|
|
||||||
{
|
|
||||||
if( x ) *x = 0;
|
|
||||||
if( y ) *y = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if XASH_SDL || XASH_DOS
|
|
||||||
void Platform_RunEvents( void );
|
|
||||||
void Platform_MouseMove( float *x, float *y );
|
|
||||||
#else
|
|
||||||
static inline void Platform_RunEvents( void ) { }
|
|
||||||
static inline void Platform_MouseMove( float *x, float *y )
|
|
||||||
{
|
|
||||||
if( x ) *x = 0.0f;
|
|
||||||
if( y ) *y = 0.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if XASH_SDL >= 2 || XASH_PSVITA || XASH_DOS || XASH_USE_EVDEV
|
|
||||||
void Platform_EnableTextInput( qboolean enable );
|
|
||||||
#else
|
|
||||||
static inline void Platform_EnableTextInput( qboolean enable ) { }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if XASH_SDL >= 2
|
|
||||||
int Platform_JoyInit( void ); // returns number of connected gamepads, negative if error
|
int Platform_JoyInit( void ); // returns number of connected gamepads, negative if error
|
||||||
void Platform_JoyShutdown( void );
|
void Platform_JoyShutdown( void );
|
||||||
void Platform_CalibrateGamepadGyro( void );
|
void Platform_CalibrateGamepadGyro( void );
|
||||||
key_modifier_t Platform_GetKeyModifiers( void );
|
|
||||||
#else
|
#else
|
||||||
static inline int Platform_JoyInit( void ) { return 0; }
|
static inline int Platform_JoyInit( void )
|
||||||
static inline void Platform_JoyShutdown( void ) { }
|
{
|
||||||
static inline void Platform_CalibrateGamepadGyro( void ) { }
|
return 0;
|
||||||
static inline key_modifier_t Platform_GetKeyModifiers( void ) { return KeyModifier_None; }
|
}
|
||||||
|
|
||||||
|
static inline void Platform_JoyShutdown( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void Platform_CalibrateGamepadGyro( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Text input
|
||||||
|
void Platform_EnableTextInput( qboolean enable );
|
||||||
|
key_modifier_t Platform_GetKeyModifiers( void );
|
||||||
|
// System events
|
||||||
|
void Platform_RunEvents( void );
|
||||||
|
// Mouse
|
||||||
|
void Platform_GetMousePos( int *x, int *y );
|
||||||
|
void Platform_SetMousePos( int x, int y );
|
||||||
|
void Platform_PreCreateMove( void );
|
||||||
|
void Platform_MouseMove( float *x, float *y );
|
||||||
|
void Platform_SetCursorType( VGUI_DefaultCursor type );
|
||||||
|
// Clipboard
|
||||||
|
int Platform_GetClipboardText( char *buffer, size_t size );
|
||||||
|
void Platform_SetClipboardText( const char *buffer );
|
||||||
|
|
||||||
|
#if XASH_SDL == 12
|
||||||
|
#define SDL_SetWindowGrab( wnd, state ) SDL_WM_GrabInput( (state) )
|
||||||
|
#define SDL_MinimizeWindow( wnd ) SDL_WM_IconifyWindow()
|
||||||
|
#define SDL_IsTextInputActive() host.textmode
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !XASH_SDL
|
||||||
|
#define SDL_VERSION_ATLEAST( x, y, z ) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void Platform_SetTimer( float time )
|
static inline void Platform_SetTimer( float time )
|
||||||
@@ -329,8 +306,7 @@ void GL_SwapBuffers( void );
|
|||||||
void *SW_LockBuffer( void );
|
void *SW_LockBuffer( void );
|
||||||
void SW_UnlockBuffer( void );
|
void SW_UnlockBuffer( void );
|
||||||
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
|
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
|
||||||
void Platform_Minimize_f( void );
|
|
||||||
qboolean R_GetWindowHandle( void **handle, int type );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// in_evdev.c
|
// in_evdev.c
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ GNU General Public License for more details.
|
|||||||
// have backtrace() and backtrace_symbols() calls, which replace for us
|
// have backtrace() and backtrace_symbols() calls, which replace for us
|
||||||
// platform-specific code
|
// platform-specific code
|
||||||
#if HAVE_EXECINFO
|
#if HAVE_EXECINFO
|
||||||
|
#include "common.h"
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "common.h"
|
|
||||||
#include "input.h"
|
|
||||||
|
|
||||||
void Sys_Crash( int signal, siginfo_t *si, void *context )
|
void Sys_Crash( int signal, siginfo_t *si, void *context )
|
||||||
{
|
{
|
||||||
@@ -71,15 +70,16 @@ void Sys_Crash( int signal, siginfo_t *si, void *context )
|
|||||||
|
|
||||||
// put MessageBox as Sys_Error
|
// put MessageBox as Sys_Error
|
||||||
Msg( "%s\n", message );
|
Msg( "%s\n", message );
|
||||||
#if !XASH_DEDICATED
|
#ifdef XASH_SDL
|
||||||
IN_SetMouseGrab( false );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
host.status = HOST_CRASHED;
|
host.crashed = true;
|
||||||
Platform_MessageBox( "Xash Error", message, false );
|
Platform_MessageBox( "Xash Error", message, false );
|
||||||
|
|
||||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
CL_Crashed();
|
CL_Crashed();
|
||||||
|
host.status = HOST_CRASHED;
|
||||||
|
|
||||||
Sys_Quit( "crashed" );
|
Sys_Quit( "crashed" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "backtrace.h"
|
#include "backtrace.h"
|
||||||
#include "input.h"
|
|
||||||
|
|
||||||
static struct backtrace_state *g_bt_state;
|
static struct backtrace_state *g_bt_state;
|
||||||
static qboolean enable_libbacktrace;
|
static qboolean enable_libbacktrace;
|
||||||
@@ -111,10 +111,8 @@ static int Sys_BacktracePrintFull( void *data, uintptr_t pc, const char *filenam
|
|||||||
module_name = dlinfo.dli_fname;
|
module_name = dlinfo.dli_fname;
|
||||||
else module_name = NULL;
|
else module_name = NULL;
|
||||||
|
|
||||||
if( filename && lineno >= 0 && function )
|
if( filename && lineno && function )
|
||||||
{
|
{
|
||||||
filename = COM_FileWithoutPath( filename );
|
|
||||||
|
|
||||||
if( module_name )
|
if( module_name )
|
||||||
Sys_AppendPrint( pd, "%2d: %s (%s:%d) (%s)\n", pd->idx++, function, filename, lineno, module_name );
|
Sys_AppendPrint( pd, "%2d: %s (%s:%d) (%s)\n", pd->idx++, function, filename, lineno, module_name );
|
||||||
else
|
else
|
||||||
@@ -160,19 +158,21 @@ void Sys_CrashLibbacktrace( int signal, siginfo_t *si, void *context )
|
|||||||
pd.message_size = sizeof( message ) - len;
|
pd.message_size = sizeof( message ) - len;
|
||||||
pd.len = 0;
|
pd.len = 0;
|
||||||
|
|
||||||
backtrace_full( g_bt_state, 1, Sys_BacktracePrintFull, Sys_BacktracePrintError, &pd );
|
if( g_bt_state )
|
||||||
|
backtrace_full( g_bt_state, 0, Sys_BacktracePrintFull, Sys_BacktracePrintError, &pd );
|
||||||
|
|
||||||
// put MessageBox as Sys_Error
|
// put MessageBox as Sys_Error
|
||||||
Msg( "%s\n", message );
|
Msg( "%s\n", message );
|
||||||
#if !XASH_DEDICATED
|
#ifdef XASH_SDL
|
||||||
IN_SetMouseGrab( false );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
host.status = HOST_CRASHED;
|
host.crashed = true;
|
||||||
Platform_MessageBox( "Xash Error", message, false );
|
Platform_MessageBox( "Xash Error", message, false );
|
||||||
|
|
||||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
CL_Crashed();
|
CL_Crashed();
|
||||||
|
host.status = HOST_CRASHED;
|
||||||
|
|
||||||
Sys_Quit( "crashed" );
|
Sys_Quit( "crashed" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ GNU General Public License for more details.
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include "input.h"
|
|
||||||
|
|
||||||
void Sys_Crash( int signal, siginfo_t *si, void *context );
|
void Sys_Crash( int signal, siginfo_t *si, void *context );
|
||||||
void Sys_CrashLibbacktrace( int signal, siginfo_t *si, void *context );
|
void Sys_CrashLibbacktrace( int signal, siginfo_t *si, void *context );
|
||||||
@@ -193,15 +192,16 @@ void Sys_Crash( int signal, siginfo_t *si, void *context )
|
|||||||
|
|
||||||
// put MessageBox as Sys_Error
|
// put MessageBox as Sys_Error
|
||||||
Msg( "%s\n", message );
|
Msg( "%s\n", message );
|
||||||
#if !XASH_DEDICATED
|
#ifdef XASH_SDL
|
||||||
IN_SetMouseGrab( false );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
host.status = HOST_CRASHED;
|
host.crashed = true;
|
||||||
Platform_MessageBox( "Xash Error", message, false );
|
Platform_MessageBox( "Xash Error", message, false );
|
||||||
|
|
||||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
CL_Crashed();
|
CL_Crashed();
|
||||||
|
host.status = HOST_CRASHED;
|
||||||
|
|
||||||
Sys_Quit( "crashed" );
|
Sys_Quit( "crashed" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void Posix_Daemonize( void )
|
|||||||
static void Posix_SigtermCallback( int signal )
|
static void Posix_SigtermCallback( int signal )
|
||||||
{
|
{
|
||||||
string reason;
|
string reason;
|
||||||
Q_snprintf( reason, sizeof( reason ), "caught signal %d", signal );
|
Con_Printf( reason, sizeof( reason ), "caught signal %d", signal );
|
||||||
Sys_Quit( reason );
|
Sys_Quit( reason );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,10 +174,5 @@ double Platform_DoubleTime( void )
|
|||||||
#endif
|
#endif
|
||||||
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
|
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Sleep( int msec )
|
|
||||||
{
|
|
||||||
usleep( msec * 1000 );
|
|
||||||
}
|
|
||||||
#endif // XASH_TIMER == TIMER_POSIX
|
#endif // XASH_TIMER == TIMER_POSIX
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "xash3d_mathlib.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -75,7 +74,6 @@ static const vrtld_export_t aux_exports[] =
|
|||||||
VRTLD_EXPORT_SYMBOL( stpcpy ),
|
VRTLD_EXPORT_SYMBOL( stpcpy ),
|
||||||
VRTLD_EXPORT_SYMBOL( rand ),
|
VRTLD_EXPORT_SYMBOL( rand ),
|
||||||
VRTLD_EXPORT_SYMBOL( srand ),
|
VRTLD_EXPORT_SYMBOL( srand ),
|
||||||
VRTLD_EXPORT_SYMBOL( rintf ),
|
|
||||||
VRTLD_EXPORT_SYMBOL( sceGxmMapMemory ), // needed by vgl_shim
|
VRTLD_EXPORT_SYMBOL( sceGxmMapMemory ), // needed by vgl_shim
|
||||||
VRTLD_EXPORT( "dlopen", vrtld_dlopen ),
|
VRTLD_EXPORT( "dlopen", vrtld_dlopen ),
|
||||||
VRTLD_EXPORT( "dlclose", vrtld_dlclose ),
|
VRTLD_EXPORT( "dlclose", vrtld_dlclose ),
|
||||||
@@ -203,19 +201,3 @@ qboolean PSVita_GetBasePath( char *buf, const size_t buflen )
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PSVita_GetPSID( char *buf, const size_t buflen )
|
|
||||||
{
|
|
||||||
SceKernelOpenPsId id;
|
|
||||||
const int datasize = Q_min( buflen, sizeof( id ));
|
|
||||||
|
|
||||||
if( sceKernelGetOpenPsId( &id ) < 0 )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memcpy( buf, &id.id[0], datasize );
|
|
||||||
return datasize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
host_sdl2.c - SDL event system handlers
|
events.c - SDL event system handlers
|
||||||
Copyright (C) 2015-2025 a1batross
|
Copyright (C) 2015-2017 a1batross
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -12,6 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
#if defined( XASH_SDL ) && !XASH_DEDICATED
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@@ -20,10 +21,75 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "vgui_draw.h"
|
#include "vgui_draw.h"
|
||||||
#include "platform_sdl2.h"
|
#include "events.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
|
|
||||||
|
#if !SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
#define SDL_SCANCODE_A SDLK_a
|
||||||
|
#define SDL_SCANCODE_Z SDLK_z
|
||||||
|
#define SDL_SCANCODE_1 SDLK_1
|
||||||
|
#define SDL_SCANCODE_9 SDLK_9
|
||||||
|
#define SDL_SCANCODE_F1 SDLK_F1
|
||||||
|
#define SDL_SCANCODE_F12 SDLK_F12
|
||||||
|
#define SDL_SCANCODE_GRAVE SDLK_BACKQUOTE
|
||||||
|
#define SDL_SCANCODE_0 SDLK_0
|
||||||
|
#define SDL_SCANCODE_BACKSLASH SDLK_BACKSLASH
|
||||||
|
#define SDL_SCANCODE_LEFTBRACKET SDLK_LEFTBRACKET
|
||||||
|
#define SDL_SCANCODE_RIGHTBRACKET SDLK_RIGHTBRACKET
|
||||||
|
#define SDL_SCANCODE_EQUALS SDLK_EQUALS
|
||||||
|
#define SDL_SCANCODE_MINUS SDLK_MINUS
|
||||||
|
#define SDL_SCANCODE_TAB SDLK_TAB
|
||||||
|
#define SDL_SCANCODE_RETURN SDLK_RETURN
|
||||||
|
#define SDL_SCANCODE_ESCAPE SDLK_ESCAPE
|
||||||
|
#define SDL_SCANCODE_SPACE SDLK_SPACE
|
||||||
|
#define SDL_SCANCODE_BACKSPACE SDLK_BACKSPACE
|
||||||
|
#define SDL_SCANCODE_UP SDLK_UP
|
||||||
|
#define SDL_SCANCODE_LEFT SDLK_LEFT
|
||||||
|
#define SDL_SCANCODE_DOWN SDLK_DOWN
|
||||||
|
#define SDL_SCANCODE_RIGHT SDLK_RIGHT
|
||||||
|
#define SDL_SCANCODE_LALT SDLK_LALT
|
||||||
|
#define SDL_SCANCODE_RALT SDLK_RALT
|
||||||
|
#define SDL_SCANCODE_LCTRL SDLK_LCTRL
|
||||||
|
#define SDL_SCANCODE_RCTRL SDLK_RCTRL
|
||||||
|
#define SDL_SCANCODE_LSHIFT SDLK_LSHIFT
|
||||||
|
#define SDL_SCANCODE_RSHIFT SDLK_RSHIFT
|
||||||
|
#define SDL_SCANCODE_LGUI SDLK_LMETA
|
||||||
|
#define SDL_SCANCODE_RGUI SDLK_RMETA
|
||||||
|
#define SDL_SCANCODE_INSERT SDLK_INSERT
|
||||||
|
#define SDL_SCANCODE_DELETE SDLK_DELETE
|
||||||
|
#define SDL_SCANCODE_PAGEDOWN SDLK_PAGEDOWN
|
||||||
|
#define SDL_SCANCODE_PAGEUP SDLK_PAGEUP
|
||||||
|
#define SDL_SCANCODE_HOME SDLK_HOME
|
||||||
|
#define SDL_SCANCODE_END SDLK_END
|
||||||
|
#define SDL_SCANCODE_KP_1 SDLK_KP1
|
||||||
|
#define SDL_SCANCODE_KP_2 SDLK_KP2
|
||||||
|
#define SDL_SCANCODE_KP_3 SDLK_KP3
|
||||||
|
#define SDL_SCANCODE_KP_4 SDLK_KP4
|
||||||
|
#define SDL_SCANCODE_KP_5 SDLK_KP5
|
||||||
|
#define SDL_SCANCODE_KP_6 SDLK_KP6
|
||||||
|
#define SDL_SCANCODE_KP_7 SDLK_KP7
|
||||||
|
#define SDL_SCANCODE_KP_8 SDLK_KP8
|
||||||
|
#define SDL_SCANCODE_KP_9 SDLK_KP9
|
||||||
|
#define SDL_SCANCODE_KP_0 SDLK_KP0
|
||||||
|
#define SDL_SCANCODE_KP_PERIOD SDLK_KP_PERIOD
|
||||||
|
#define SDL_SCANCODE_KP_ENTER SDLK_KP_ENTER
|
||||||
|
#define SDL_SCANCODE_KP_PLUS SDLK_KP_PLUS
|
||||||
|
#define SDL_SCANCODE_KP_MINUS SDLK_KP_MINUS
|
||||||
|
#define SDL_SCANCODE_KP_DIVIDE SDLK_KP_DIVIDE
|
||||||
|
#define SDL_SCANCODE_KP_MULTIPLY SDLK_KP_MULTIPLY
|
||||||
|
#define SDL_SCANCODE_NUMLOCKCLEAR SDLK_NUMLOCK
|
||||||
|
#define SDL_SCANCODE_CAPSLOCK SDLK_CAPSLOCK
|
||||||
|
#define SDL_SCANCODE_SLASH SDLK_SLASH
|
||||||
|
#define SDL_SCANCODE_PERIOD SDLK_PERIOD
|
||||||
|
#define SDL_SCANCODE_SEMICOLON SDLK_SEMICOLON
|
||||||
|
#define SDL_SCANCODE_APOSTROPHE SDLK_QUOTE
|
||||||
|
#define SDL_SCANCODE_COMMA SDLK_COMMA
|
||||||
|
#define SDL_SCANCODE_PRINTSCREEN SDLK_PRINT
|
||||||
|
#define SDL_SCANCODE_UNKNOWN SDLK_UNKNOWN
|
||||||
|
#define SDL_GetScancodeName( x ) "unknown"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
SDLash_KeyEvent
|
SDLash_KeyEvent
|
||||||
@@ -33,7 +99,11 @@ SDLash_KeyEvent
|
|||||||
static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
||||||
{
|
{
|
||||||
int down = key.state != SDL_RELEASED;
|
int down = key.state != SDL_RELEASED;
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
int keynum = key.keysym.scancode;
|
int keynum = key.keysym.scancode;
|
||||||
|
#else
|
||||||
|
int keynum = key.keysym.sym;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if XASH_ANDROID
|
#if XASH_ANDROID
|
||||||
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
||||||
@@ -56,11 +126,24 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
// ignore printable keys, they are coming through SDL_TEXTINPUT
|
// ignore printable keys, they are coming through SDL_TEXTINPUT
|
||||||
if(( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
|
if(( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
|
||||||
|| ( keynum >= SDL_SCANCODE_1 && keynum <= SDL_SCANCODE_0 )
|
|| ( keynum >= SDL_SCANCODE_1 && keynum <= SDL_SCANCODE_0 )
|
||||||
|| ( keynum >= SDL_SCANCODE_KP_1 && keynum <= SDL_SCANCODE_KP_0 ))
|
|| ( keynum >= SDL_SCANCODE_KP_1 && keynum <= SDL_SCANCODE_KP_0 ))
|
||||||
return;
|
return;
|
||||||
|
#else
|
||||||
|
if( keynum >= SDLK_KP0 && keynum <= SDLK_KP9 )
|
||||||
|
keynum -= SDLK_KP0 + '0';
|
||||||
|
|
||||||
|
if( isprint( keynum ))
|
||||||
|
{
|
||||||
|
if( FBitSet( SDL_GetModState(), KMOD_SHIFT ))
|
||||||
|
keynum = Key_ToUpper( keynum );
|
||||||
|
|
||||||
|
CL_CharEvent( keynum );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DECLARE_KEY_RANGE( min, max, repl ) \
|
#define DECLARE_KEY_RANGE( min, max, repl ) \
|
||||||
@@ -139,6 +222,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
}
|
}
|
||||||
case SDL_SCANCODE_PAUSE: keynum = K_PAUSE; break;
|
case SDL_SCANCODE_PAUSE: keynum = K_PAUSE; break;
|
||||||
case SDL_SCANCODE_SCROLLLOCK: keynum = K_SCROLLLOCK; break;
|
case SDL_SCANCODE_SCROLLLOCK: keynum = K_SCROLLLOCK; break;
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
case SDL_SCANCODE_APPLICATION: keynum = K_WIN; break; // (compose key) ???
|
case SDL_SCANCODE_APPLICATION: keynum = K_WIN; break; // (compose key) ???
|
||||||
// don't console spam on known functional buttons, not used in engine
|
// don't console spam on known functional buttons, not used in engine
|
||||||
case SDL_SCANCODE_MUTE:
|
case SDL_SCANCODE_MUTE:
|
||||||
@@ -148,6 +232,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
case SDL_SCANCODE_BRIGHTNESSUP:
|
case SDL_SCANCODE_BRIGHTNESSUP:
|
||||||
case SDL_SCANCODE_SELECT:
|
case SDL_SCANCODE_SELECT:
|
||||||
return;
|
return;
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
case SDL_SCANCODE_UNKNOWN:
|
case SDL_SCANCODE_UNKNOWN:
|
||||||
{
|
{
|
||||||
if( down ) Con_Reportf( "%s: Unknown scancode\n", __func__ );
|
if( down ) Con_Reportf( "%s: Unknown scancode\n", __func__ );
|
||||||
@@ -174,8 +259,10 @@ static void SDLash_MouseEvent( SDL_MouseButtonEvent button )
|
|||||||
{
|
{
|
||||||
int down;
|
int down;
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( button.which == SDL_TOUCH_MOUSEID )
|
if( button.which == SDL_TOUCH_MOUSEID )
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if( button.state == SDL_RELEASED )
|
if( button.state == SDL_RELEASED )
|
||||||
down = 0;
|
down = 0;
|
||||||
@@ -201,6 +288,14 @@ static void SDLash_MouseEvent( SDL_MouseButtonEvent button )
|
|||||||
case SDL_BUTTON_X2:
|
case SDL_BUTTON_X2:
|
||||||
IN_MouseEvent( 4, down );
|
IN_MouseEvent( 4, down );
|
||||||
break;
|
break;
|
||||||
|
#if ! SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
case SDL_BUTTON_WHEELUP:
|
||||||
|
IN_MWheelEvent( -1 );
|
||||||
|
break;
|
||||||
|
case SDL_BUTTON_WHEELDOWN:
|
||||||
|
IN_MWheelEvent( 1 );
|
||||||
|
break;
|
||||||
|
#endif // ! SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
default:
|
default:
|
||||||
Con_Printf( "Unknown mouse button ID: %d\n", button.button );
|
Con_Printf( "Unknown mouse button ID: %d\n", button.button );
|
||||||
}
|
}
|
||||||
@@ -212,6 +307,7 @@ SDLash_InputEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
static void SDLash_InputEvent( SDL_TextInputEvent input )
|
static void SDLash_InputEvent( SDL_TextInputEvent input )
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
@@ -232,6 +328,7 @@ static void SDLash_InputEvent( SDL_TextInputEvent input )
|
|||||||
CL_CharEvent( ch );
|
CL_CharEvent( ch );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // SDL_VERSION_AT_LEAST( 2, 0, 0 )
|
||||||
|
|
||||||
static void SDLash_ActiveEvent( int gain )
|
static void SDLash_ActiveEvent( int gain )
|
||||||
{
|
{
|
||||||
@@ -297,6 +394,7 @@ static void SDLash_EventHandler( SDL_Event *event )
|
|||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
Sys_Quit( "caught SDL_QUIT" );
|
Sys_Quit( "caught SDL_QUIT" );
|
||||||
break;
|
break;
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
IN_MWheelEvent( event->wheel.y );
|
IN_MWheelEvent( event->wheel.y );
|
||||||
break;
|
break;
|
||||||
@@ -366,12 +464,10 @@ static void SDLash_EventHandler( SDL_Event *event )
|
|||||||
case SDL_CONTROLLERBUTTONUP:
|
case SDL_CONTROLLERBUTTONUP:
|
||||||
case SDL_CONTROLLERDEVICEADDED:
|
case SDL_CONTROLLERDEVICEADDED:
|
||||||
case SDL_CONTROLLERDEVICEREMOVED:
|
case SDL_CONTROLLERDEVICEREMOVED:
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 14 )
|
|
||||||
case SDL_CONTROLLERTOUCHPADDOWN:
|
case SDL_CONTROLLERTOUCHPADDOWN:
|
||||||
case SDL_CONTROLLERTOUCHPADMOTION:
|
case SDL_CONTROLLERTOUCHPADMOTION:
|
||||||
case SDL_CONTROLLERTOUCHPADUP:
|
case SDL_CONTROLLERTOUCHPADUP:
|
||||||
case SDL_CONTROLLERSENSORUPDATE:
|
case SDL_CONTROLLERSENSORUPDATE:
|
||||||
#endif
|
|
||||||
SDLash_HandleGameControllerEvent( event );
|
SDLash_HandleGameControllerEvent( event );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -432,6 +528,14 @@ static void SDLash_EventHandler( SDL_Event *event )
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
case SDL_VIDEORESIZE:
|
||||||
|
VID_SaveWindowSize( event->resize.w, event->resize.h );
|
||||||
|
break;
|
||||||
|
case SDL_ACTIVEEVENT:
|
||||||
|
SDLash_ActiveEvent( event->active.gain );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +549,7 @@ void Platform_RunEvents( void )
|
|||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
while( host.status != HOST_CRASHED && !host.shutdown_issued && SDL_PollEvent( &event ) )
|
while( !host.crashed && !host.shutdown_issued && SDL_PollEvent( &event ) )
|
||||||
SDLash_EventHandler( &event );
|
SDLash_EventHandler( &event );
|
||||||
|
|
||||||
#if XASH_PSVITA
|
#if XASH_PSVITA
|
||||||
@@ -469,3 +573,5 @@ void Platform_PreCreateMove( void )
|
|||||||
SDL_ShowCursor( SDL_TRUE );
|
SDL_ShowCursor( SDL_TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined( XASH_SDL ) && !XASH_DEDICATED
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
platform_sdl2.h - SDL backend internal header
|
events.h - SDL backend internal header
|
||||||
Copyright (C) 2015-2018 a1batross
|
Copyright (C) 2015-2018 a1batross
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -18,7 +18,7 @@ GNU General Public License for more details.
|
|||||||
#define KEYWRAPPER_H
|
#define KEYWRAPPER_H
|
||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
// window management
|
// window management
|
||||||
void VID_RestoreScreenResolution( void );
|
void VID_RestoreScreenResolution( void );
|
||||||
@@ -19,21 +19,19 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "vgui_draw.h"
|
#include "vgui_draw.h"
|
||||||
#include "platform_sdl2.h"
|
#include "events.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
|
|
||||||
|
#if !SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
#define SDL_WarpMouseInWindow( win, x, y ) SDL_WarpMouse( ( x ), ( y ) )
|
||||||
|
#else
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
SDL_Cursor *cursors[dc_last];
|
SDL_Cursor *cursors[dc_last];
|
||||||
} cursors;
|
} cursors;
|
||||||
|
#endif
|
||||||
static struct
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
qboolean pushed;
|
|
||||||
} in_visible_cursor_pos;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
@@ -91,6 +89,7 @@ Platform_GetClipobardText
|
|||||||
*/
|
*/
|
||||||
int Platform_GetClipboardText( char *buffer, size_t size )
|
int Platform_GetClipboardText( char *buffer, size_t size )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
int textLength;
|
int textLength;
|
||||||
char *sdlbuffer = SDL_GetClipboardText();
|
char *sdlbuffer = SDL_GetClipboardText();
|
||||||
|
|
||||||
@@ -106,6 +105,10 @@ int Platform_GetClipboardText( char *buffer, size_t size )
|
|||||||
}
|
}
|
||||||
SDL_free( sdlbuffer );
|
SDL_free( sdlbuffer );
|
||||||
return textLength;
|
return textLength;
|
||||||
|
#else // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
buffer[0] = 0;
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -116,7 +119,9 @@ Platform_SetClipobardText
|
|||||||
*/
|
*/
|
||||||
void Platform_SetClipboardText( const char *buffer )
|
void Platform_SetClipboardText( const char *buffer )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
SDL_SetClipboardText( buffer );
|
SDL_SetClipboardText( buffer );
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_PSVITA
|
#if !XASH_PSVITA
|
||||||
@@ -129,7 +134,9 @@ SDLash_EnableTextInput
|
|||||||
*/
|
*/
|
||||||
void Platform_EnableTextInput( qboolean enable )
|
void Platform_EnableTextInput( qboolean enable )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
enable ? SDL_StartTextInput() : SDL_StopTextInput();
|
enable ? SDL_StartTextInput() : SDL_StopTextInput();
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !XASH_PSVITA
|
#endif // !XASH_PSVITA
|
||||||
@@ -142,6 +149,7 @@ SDLash_InitCursors
|
|||||||
*/
|
*/
|
||||||
void SDLash_InitCursors( void )
|
void SDLash_InitCursors( void )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( cursors.initialized )
|
if( cursors.initialized )
|
||||||
SDLash_FreeCursors();
|
SDLash_FreeCursors();
|
||||||
|
|
||||||
@@ -160,6 +168,7 @@ void SDLash_InitCursors( void )
|
|||||||
cursors.cursors[dc_no] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
cursors.cursors[dc_no] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
||||||
cursors.cursors[dc_hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
cursors.cursors[dc_hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||||
cursors.initialized = true;
|
cursors.initialized = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -170,6 +179,7 @@ SDLash_FreeCursors
|
|||||||
*/
|
*/
|
||||||
void SDLash_FreeCursors( void )
|
void SDLash_FreeCursors( void )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for( ; i < ARRAYSIZE( cursors.cursors ); i++ )
|
for( ; i < ARRAYSIZE( cursors.cursors ); i++ )
|
||||||
@@ -180,6 +190,7 @@ void SDLash_FreeCursors( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
cursors.initialized = false;
|
cursors.initialized = false;
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,6 +203,11 @@ void Platform_SetCursorType( VGUI_DefaultCursor type )
|
|||||||
{
|
{
|
||||||
qboolean visible;
|
qboolean visible;
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
if( !cursors.initialized )
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case dc_user:
|
case dc_user:
|
||||||
@@ -204,58 +220,32 @@ void Platform_SetCursorType( VGUI_DefaultCursor type )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// never disable cursor in touch emulation mode
|
// never disable cursor in touch emulation mode
|
||||||
if( !visible && Touch_WantVisibleCursor( ))
|
if( !visible && Touch_Emulated( ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
host.mouse_visible = visible;
|
host.mouse_visible = visible;
|
||||||
VGui_UpdateInternalCursorState( type );
|
VGui_UpdateInternalCursorState( type );
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( host.mouse_visible )
|
if( host.mouse_visible )
|
||||||
{
|
{
|
||||||
if( cursors.initialized )
|
SDL_SetCursor( cursors.cursors[type] );
|
||||||
SDL_SetCursor( cursors.cursors[type] );
|
|
||||||
|
|
||||||
SDL_ShowCursor( true );
|
SDL_ShowCursor( true );
|
||||||
|
|
||||||
// restore the last mouse position
|
|
||||||
if( in_visible_cursor_pos.pushed )
|
|
||||||
{
|
|
||||||
SDL_WarpMouseInWindow( host.hWnd, in_visible_cursor_pos.x, in_visible_cursor_pos.y );
|
|
||||||
in_visible_cursor_pos.pushed = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// save last mouse position and warp it to the center
|
|
||||||
if( !in_visible_cursor_pos.pushed )
|
|
||||||
{
|
|
||||||
SDL_GetMouseState( &in_visible_cursor_pos.x, &in_visible_cursor_pos.y );
|
|
||||||
SDL_WarpMouseInWindow( host.hWnd, host.window_center_x, host.window_center_y );
|
|
||||||
in_visible_cursor_pos.pushed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_ShowCursor( false );
|
SDL_ShowCursor( false );
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
|
if( host.mouse_visible )
|
||||||
/*
|
{
|
||||||
========================
|
SDL_ShowCursor( true );
|
||||||
Platform_GetMouseGrab
|
}
|
||||||
========================
|
else
|
||||||
*/
|
{
|
||||||
qboolean Platform_GetMouseGrab( void )
|
SDL_ShowCursor( false );
|
||||||
{
|
}
|
||||||
return SDL_GetWindowGrab( host.hWnd );
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================
|
|
||||||
Platform_SetMouseGrab
|
|
||||||
========================
|
|
||||||
*/
|
|
||||||
void Platform_SetMouseGrab( qboolean enable )
|
|
||||||
{
|
|
||||||
SDL_SetWindowGrab( host.hWnd, enable );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -266,6 +256,7 @@ Platform_GetKeyModifiers
|
|||||||
*/
|
*/
|
||||||
key_modifier_t Platform_GetKeyModifiers( void )
|
key_modifier_t Platform_GetKeyModifiers( void )
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
SDL_Keymod modFlags;
|
SDL_Keymod modFlags;
|
||||||
key_modifier_t resultFlags;
|
key_modifier_t resultFlags;
|
||||||
|
|
||||||
@@ -293,4 +284,7 @@ key_modifier_t Platform_GetKeyModifiers( void )
|
|||||||
SetBits( resultFlags, KeyModifier_LeftSuper );
|
SetBits( resultFlags, KeyModifier_LeftSuper );
|
||||||
|
|
||||||
return resultFlags;
|
return resultFlags;
|
||||||
|
#else
|
||||||
|
return KeyModifier_None;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||