Compare commits

...

644 Commits

Author SHA1 Message Date
Jan
e14f0743da
Merge pull request #411 from diamante0018/debug-regression
fix: wrong "bin" directory when using executable from $PATH
2025-04-23 02:14:12 +02:00
Jan
fb20cbf81c
fix: use platform specific calls to get executable dir 2025-04-23 00:50:30 +01:00
Jan
1cccfe352b
Merge pull request #415 from Laupetin/fix/redownload-premake-on-update
fix: redownload premake when version is outdated
2025-04-21 18:58:21 +02:00
Jan
dbcf7d86af
fix: redownload premake when version is outdated 2025-04-21 18:34:46 +02:00
Jan
f888d7a5d4
Merge pull request #414 from Laupetin/fix/generate-with-git-worktree
fix: make generate.sh work with git worktrees
2025-04-21 00:18:19 +02:00
Jan
74b9f7b010
Merge pull request #409 from diamante0018/chore/premake5
chore: update Premake5
2025-04-21 00:14:35 +02:00
Jan
ba4cb85639
fix: make generate.sh work with git worktrees 2025-04-20 23:54:11 +02:00
Jan
da90bbd356
Merge pull request #412 from Laupetin/chore/better-build-scripts
chore: replace x64 build scripts with generic ones
2025-04-20 17:54:29 +02:00
Jan
13b07c0fe4
chore: replace x64 build scripts with generic ones 2025-04-20 17:30:55 +02:00
Giulia Sanguineti
199446b09f
fix: make LinkerPaths use weakly_canonical to make path prefered 2025-04-20 17:09:06 +02:00
Giulia Sanguineti
37fe6b6a5c fix: min version for Premake5 2025-04-20 15:25:45 +02:00
Giulia Sanguineti
ea5d27a7f9 chore: update Premake5 2025-04-20 14:55:34 +02:00
Jan
38d948ebdd
Merge pull request #408 from Laupetin/refactor/zcg-code-style
refactor: zcg code style
2025-04-20 13:51:43 +02:00
Jan
9f8a933277
chore: update ZoneCodeGenerator code style 2025-04-20 09:45:37 +02:00
Jan
9f738da517
chore: remove duplicated alignment utility method 2025-04-20 09:45:36 +02:00
Jan
785cf8c025
chore: update code style in ZoneCodeGenerator entrypoint 2025-04-20 09:45:32 +02:00
Jan
0f3ee1fa79
Merge pull request #407 from Laupetin/dependabot/submodules/thirdparty/eigen-33f5f59
chore(deps): bump thirdparty/eigen from `11fd34c` to `33f5f59`
2025-04-19 11:54:54 +02:00
Jan
c8cd6826c1
Merge pull request #406 from Laupetin/dependabot/submodules/thirdparty/json-c67d538
chore(deps): bump thirdparty/json from `7ddea26` to `c67d538`
2025-04-19 11:54:41 +02:00
Jan
5afc24fd89
Merge pull request #405 from Laupetin/dependabot/submodules/thirdparty/catch2-4c8671c
chore(deps): bump thirdparty/catch2 from `2b60af8` to `4c8671c`
2025-04-19 11:54:28 +02:00
dependabot[bot]
598abe095b
chore(deps): bump thirdparty/eigen from 11fd34c to 33f5f59
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `11fd34c` to `33f5f59`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](11fd34cc1c...33f5f59614)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-version: 33f5f596143d0fce32316ec6fa4bd9f23b4dd9d2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 22:43:27 +00:00
dependabot[bot]
d6eee273ff
chore(deps): bump thirdparty/json from 7ddea26 to c67d538
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `7ddea26` to `c67d538`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](7ddea2686f...c67d538274)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-version: c67d538274502163b55e8fb54b5c27c17764722d
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 22:43:25 +00:00
dependabot[bot]
7edbe7378b
chore(deps): bump thirdparty/catch2 from 2b60af8 to 4c8671c
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `2b60af8` to `4c8671c`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](2b60af89e2...4c8671cfbb)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-version: 4c8671cfbbf0019d3827305d4d1c82a74eeb029a
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 22:43:23 +00:00
Jan
b83bafb0f8
Merge pull request #403 from Laupetin/dependabot/submodules/thirdparty/catch2-2b60af8
chore(deps): bump thirdparty/catch2 from `76f70b1` to `2b60af8`
2025-04-12 23:24:00 +02:00
Jan
e750e3ffd9
Merge pull request #402 from Laupetin/dependabot/submodules/thirdparty/json-7ddea26
chore(deps): bump thirdparty/json from `11aa5f9` to `7ddea26`
2025-04-12 23:23:44 +02:00
Jan
d5b6c6e9c2
Merge pull request #401 from Laupetin/dependabot/submodules/thirdparty/eigen-11fd34c
chore(deps): bump thirdparty/eigen from `b860042` to `11fd34c`
2025-04-12 23:23:32 +02:00
dependabot[bot]
d6c1ef775e
chore(deps): bump thirdparty/catch2 from 76f70b1 to 2b60af8
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `76f70b1` to `2b60af8`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](76f70b1403...2b60af89e2)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-version: 2b60af89e23d28eefc081bc930831ee9d45ea58b
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 22:49:13 +00:00
dependabot[bot]
c05d4ea34e
chore(deps): bump thirdparty/json from 11aa5f9 to 7ddea26
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `11aa5f9` to `7ddea26`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](11aa5f944d...7ddea2686f)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-version: 7ddea2686f091ea77a3f731ab74c59535db9f684
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 22:49:10 +00:00
dependabot[bot]
b2d9bf416d
chore(deps): bump thirdparty/eigen from b860042 to 11fd34c
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `b860042` to `11fd34c`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](b860042263...11fd34cc1c)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-version: 11fd34cc1c398f2c2311339ed3b008b1114544eb
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 22:49:08 +00:00
Jan
3134ec5a37
Merge pull request #400 from GoastcraftHD/main
Added MapEnts dumping for T6
2025-04-07 23:40:52 +02:00
Jan
0d35696940
chore: make map ents dumping add ents extension instead of replacing 2025-04-07 22:16:08 +01:00
GoastcraftHD
b215b22018 Fixed MapEnts dumping in wrong folder 2025-04-07 22:34:21 +02:00
GoastcraftHD
a447dd29fa
Fixed include order 2025-04-07 20:05:01 +02:00
GoastcraftHD
985996975b
Update SupportedAssetTypes.md 2025-04-07 12:05:56 +02:00
Simon Ickler
f235798cf6 Added MapEnts dumping for T6 2025-04-07 12:05:03 +02:00
Jan
0228e86980
Merge pull request #399 from Laupetin/fix/64-bit-compilation
fix: 64 bit compilation
2025-04-06 19:27:06 +02:00
Jan
01302cf061
fix: too large obj files for x64 on windows 2025-04-06 18:02:48 +01:00
Jan
6f31e8cc29
chore: fix compilation issues with x64 2025-04-06 18:02:47 +01:00
Jan
37d52ae8da
chore: add compilation scripts for x64 2025-04-06 17:44:26 +02:00
Jan
481d301545
chore: change c++ version to c++23 2025-04-06 17:43:50 +02:00
Jan
d3bb99e92c
Merge pull request #395 from Laupetin/fix/bad-xmodel-loading
fix: bad xmodel loading
2025-04-05 17:59:45 +02:00
Jan
cec70e783f
fix: not using lookup to common vertices when writing rigid bone data
no more pizza cheese problem
2025-04-05 17:36:29 +02:00
Jan
a2c8129a13
fix: messed up reordering of vertices for bone count 2025-04-05 16:30:58 +02:00
Jan
e13eb256bb
chore: update code style 2025-04-05 16:30:54 +02:00
Jan
aab510c917
Merge pull request #398 from Laupetin/fix/linux-folder-file-capitalization
fix: linux folder file capitalization
2025-04-05 13:07:14 +02:00
Jan
820fe47473
fix: always use lowercase extensions for xmodels 2025-04-05 12:42:55 +02:00
Jan
0366b24bd7
fix: game name in linker paths must be lowercase for linux 2025-04-05 12:42:52 +02:00
Jan
49f0794545
Merge pull request #397 from Laupetin/dependabot/submodules/thirdparty/json-11aa5f9
chore(deps): bump thirdparty/json from `11a835d` to `11aa5f9`
2025-04-05 08:51:42 +02:00
Jan
20911d552d
Merge pull request #396 from Laupetin/dependabot/submodules/thirdparty/eigen-b860042
chore(deps): bump thirdparty/eigen from `e0c99a8` to `b860042`
2025-04-05 08:51:27 +02:00
dependabot[bot]
1748f9e1a5
chore(deps): bump thirdparty/json from 11a835d to 11aa5f9
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `11a835d` to `11aa5f9`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](11a835df85...11aa5f944d)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-version: 11aa5f944d17ed5b96250ca133bf33c5ca8b0161
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-04 23:00:25 +00:00
dependabot[bot]
a37b5fee8c
chore(deps): bump thirdparty/eigen from e0c99a8 to b860042
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `e0c99a8` to `b860042`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](e0c99a8dd6...b860042263)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-version: b86004226361882ea6c9308c0a940007a049d1d5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-04 23:00:23 +00:00
Jan
42e2eb80b3
Merge pull request #394 from Laupetin/dependabot/submodules/thirdparty/eigen-e0c99a8
chore(deps): bump thirdparty/eigen from `6579e36` to `e0c99a8`
2025-03-29 00:27:10 +01:00
dependabot[bot]
885c57bfa5
chore(deps): bump thirdparty/eigen from 6579e36 to e0c99a8
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `6579e36` to `e0c99a8`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](6579e36eb4...e0c99a8dd6)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-28 22:45:27 +00:00
Jan
fa88b135f9
Merge pull request #393 from Laupetin/fix/rename-clipmap-asset-iw3-iw4-t5
fix: set clipmap asset name of non-pvs clipmap to clipmap_unused in IW3,IW4,T5
2025-03-27 17:43:53 +01:00
Jan
56c4eeb5cd
fix: set clipmap asset name of non-pvs clipmap to clipmap_unused in IW3,IW4,T5 2025-03-27 17:16:28 +01:00
Jan
0fcae6a55a
Merge pull request #391 from LJW-Dev/fix/T6-clipmap-asset
Update T6 asset loading code to use ASSET_TYPE_CLIPMAP_PVS.
2025-03-27 17:14:14 +01:00
LJW-Dev
f97f38dc31
Merge branch 'Laupetin:main' into fix/T6-clipmap-asset 2025-03-27 12:33:05 +08:00
LJW-Dev
95f5dca5e0 Updated zone loading code to only use ASSET_TYPE_CLIPMAP_PVS. 2025-03-27 12:32:43 +08:00
Jan
f2723255f5
Merge pull request #390 from Laupetin/dependabot/submodules/thirdparty/json-11a835d
chore(deps): bump thirdparty/json from `8215dba` to `11a835d`
2025-03-25 20:31:53 +01:00
dependabot[bot]
11cb93f736
chore(deps): bump thirdparty/json from 8215dba to 11a835d
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `8215dba` to `11a835d`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](8215dbafbd...11a835df85)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 18:54:35 +00:00
Jan
e40d688e11
Merge pull request #389 from Laupetin/dependabot/submodules/thirdparty/libtommath-e823b0c
chore(deps): bump thirdparty/libtommath from `5938524` to `e823b0c`
2025-03-25 19:53:42 +01:00
dependabot[bot]
2eeb20d1cd
chore(deps): bump thirdparty/libtommath from 5938524 to e823b0c
Bumps [thirdparty/libtommath](https://github.com/libtom/libtommath) from `5938524` to `e823b0c`.
- [Release notes](https://github.com/libtom/libtommath/releases)
- [Commits](5938524c60...e823b0c34c)

---
updated-dependencies:
- dependency-name: thirdparty/libtommath
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 18:25:18 +00:00
Jan
7b79504477
Merge pull request #388 from Laupetin/dependabot/submodules/thirdparty/eigen-ac2165c
chore(deps): bump thirdparty/eigen from `5fc6fc9` to `ac2165c`
2025-03-25 19:24:21 +01:00
dependabot[bot]
4cc7ab77d5
chore(deps): bump thirdparty/eigen from 5fc6fc9 to ac2165c
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `5fc6fc9` to `ac2165c`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](5fc6fc9881...ac2165c11f)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 18:00:47 +00:00
Jan
08fb6b0496
Merge pull request #386 from Laupetin/dependabot/submodules/thirdparty/catch2-76f70b1
chore(deps): bump thirdparty/catch2 from `914aeec` to `76f70b1`
2025-03-25 18:59:43 +01:00
dependabot[bot]
a871889c13
chore(deps): bump thirdparty/catch2 from 914aeec to 76f70b1
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `914aeec` to `76f70b1`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](914aeecfe2...76f70b1403)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 17:36:11 +00:00
Jan
81bc21eacf
Merge pull request #384 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-a6b9aff
chore(deps): bump thirdparty/libtomcrypt from `d032686` to `a6b9aff`
2025-03-25 18:35:04 +01:00
dependabot[bot]
aec779dae5
chore(deps): bump thirdparty/libtomcrypt from d032686 to a6b9aff
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `d032686` to `a6b9aff`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](d032686639...a6b9aff7aa)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 17:11:32 +00:00
Jan
97c4a23d5e
Merge pull request #392 from Laupetin/fix/compilation-on-windows
fix: compilation on msvc
2025-03-25 18:09:57 +01:00
Jan
0c587e5e5f
fix: compilation on msvc 2025-03-25 17:38:07 +01:00
Jan
4ac38bfc66
Merge pull request #376 from Laupetin/dependabot/submodules/thirdparty/json-8215dba
chore(deps): bump thirdparty/json from `606b634` to `8215dba`
2025-02-22 17:31:01 +01:00
Jan
34a0bd4f4f
Merge pull request #377 from Laupetin/dependabot/submodules/thirdparty/zlib-5a82f71
chore(deps): bump thirdparty/zlib from `7108497` to `5a82f71`
2025-02-22 17:30:53 +01:00
Jan
047e8aa125
Merge pull request #378 from Laupetin/dependabot/submodules/thirdparty/eigen-5fc6fc9
chore(deps): bump thirdparty/eigen from `9c21143` to `5fc6fc9`
2025-02-22 17:30:45 +01:00
Jan
b5303475d9
Merge pull request #379 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-d032686
chore(deps): bump thirdparty/libtomcrypt from `54f0456` to `d032686`
2025-02-22 17:30:38 +01:00
dependabot[bot]
4adc9115b2
chore(deps): bump thirdparty/libtomcrypt from 54f0456 to d032686
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `54f0456` to `d032686`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](54f0456559...d032686639)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-21 22:39:15 +00:00
dependabot[bot]
a4347b0b0d
chore(deps): bump thirdparty/zlib from 7108497 to 5a82f71
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `7108497` to `5a82f71`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](7108497fda...5a82f71ed1)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-21 22:39:13 +00:00
dependabot[bot]
4e5c72d79a
chore(deps): bump thirdparty/eigen from 9c21143 to 5fc6fc9
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `9c21143` to `5fc6fc9`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](9c211430b5...5fc6fc9881)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-21 22:39:12 +00:00
dependabot[bot]
58f5f66dcf
chore(deps): bump thirdparty/json from 606b634 to 8215dba
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `606b634` to `8215dba`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](606b6347ed...8215dbafbd)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-21 22:39:10 +00:00
Jan
54d19dcc8a
Merge pull request #373 from Laupetin/dependabot/submodules/thirdparty/eigen-9c21143
chore(deps): bump thirdparty/eigen from `715deac` to `9c21143`
2025-02-14 23:23:02 +01:00
Jan
f05a21984a
Merge pull request #374 from Laupetin/dependabot/submodules/thirdparty/zlib-7108497
chore(deps): bump thirdparty/zlib from `8a844d4` to `7108497`
2025-02-14 23:22:40 +01:00
dependabot[bot]
b071beea3f
chore(deps): bump thirdparty/zlib from 8a844d4 to 7108497
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `8a844d4` to `7108497`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](8a844d434f...7108497fda)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-14 22:01:47 +00:00
dependabot[bot]
548c0c23bf
chore(deps): bump thirdparty/eigen from 715deac to 9c21143
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `715deac` to `9c21143`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](715deac188...9c211430b5)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-14 22:01:45 +00:00
Jan
6d186bc09c
Merge pull request #372 from Laupetin/dependabot/submodules/thirdparty/eigen-715deac
chore(deps): bump thirdparty/eigen from `9589cc4` to `715deac`
2025-02-08 17:57:32 +01:00
Jan
96dc2c9318
Merge pull request #371 from Laupetin/dependabot/submodules/thirdparty/zlib-8a844d4
chore(deps): bump thirdparty/zlib from `ef24c4c` to `8a844d4`
2025-02-08 17:57:20 +01:00
dependabot[bot]
e4c08e1372
chore(deps): bump thirdparty/eigen from 9589cc4 to 715deac
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `9589cc4` to `715deac`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](9589cc4e7f...715deac188)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-07 22:44:15 +00:00
dependabot[bot]
1b6824f2bd
chore(deps): bump thirdparty/zlib from ef24c4c to 8a844d4
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `ef24c4c` to `8a844d4`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](ef24c4c750...8a844d434f)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-07 22:44:14 +00:00
Jan
0eb0383051
Merge pull request #370 from Laupetin/dependabot/submodules/thirdparty/eigen-9589cc4
chore(deps): bump thirdparty/eigen from `4a6ac97` to `9589cc4`
2025-02-01 17:18:26 +01:00
Jan
222d96a923
Merge pull request #369 from Laupetin/dependabot/submodules/thirdparty/json-606b634
chore(deps): bump thirdparty/json from `d0789e3` to `606b634`
2025-02-01 17:18:07 +01:00
Jan
07dccbf2f8
Merge pull request #368 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-54f0456
chore(deps): bump thirdparty/libtomcrypt from `427e055` to `54f0456`
2025-02-01 17:17:45 +01:00
Jan
b24b6b1979
Merge pull request #367 from Laupetin/dependabot/submodules/thirdparty/libtommath-5938524
chore(deps): bump thirdparty/libtommath from `5809141` to `5938524`
2025-02-01 17:17:22 +01:00
dependabot[bot]
a220142e86
chore(deps): bump thirdparty/eigen from 4a6ac97 to 9589cc4
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `4a6ac97` to `9589cc4`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](4a6ac97d13...9589cc4e7f)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 22:38:54 +00:00
dependabot[bot]
4c30bd129a
chore(deps): bump thirdparty/json from d0789e3 to 606b634
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `d0789e3` to `606b634`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](d0789e365d...606b6347ed)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 22:38:51 +00:00
dependabot[bot]
3d3a0ca565
chore(deps): bump thirdparty/libtomcrypt from 427e055 to 54f0456
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `427e055` to `54f0456`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](427e0551c0...54f0456559)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 22:38:49 +00:00
dependabot[bot]
903bd5a960
chore(deps): bump thirdparty/libtommath from 5809141 to 5938524
Bumps [thirdparty/libtommath](https://github.com/libtom/libtommath) from `5809141` to `5938524`.
- [Release notes](https://github.com/libtom/libtommath/releases)
- [Commits](5809141a3a...5938524c60)

---
updated-dependencies:
- dependency-name: thirdparty/libtommath
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 22:38:47 +00:00
Jan
2402d4f9c7
Merge pull request #364 from Laupetin/dependabot/submodules/thirdparty/json-d0789e3
chore(deps): bump thirdparty/json from `e72046e` to `d0789e3`
2025-01-25 00:30:50 +01:00
Jan
a21b410fd7
Merge pull request #363 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-427e055
chore(deps): bump thirdparty/libtomcrypt from `2e9f2b5` to `427e055`
2025-01-25 00:30:38 +01:00
Jan
2b1ade2b5a
Merge pull request #362 from Laupetin/dependabot/submodules/thirdparty/eigen-4a6ac97
chore(deps): bump thirdparty/eigen from `abac563` to `4a6ac97`
2025-01-25 00:30:24 +01:00
dependabot[bot]
d869de5881
chore(deps): bump thirdparty/json from e72046e to d0789e3
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `e72046e` to `d0789e3`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](e72046ef9f...d0789e365d)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-24 22:12:59 +00:00
dependabot[bot]
2ce1a4e050
chore(deps): bump thirdparty/libtomcrypt from 2e9f2b5 to 427e055
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `2e9f2b5` to `427e055`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](2e9f2b5e44...427e0551c0)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-24 22:12:57 +00:00
dependabot[bot]
89e22329f8
chore(deps): bump thirdparty/eigen from abac563 to 4a6ac97
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `abac563` to `4a6ac97`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](abac563f5d...4a6ac97d13)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-24 22:12:55 +00:00
Jan
bea601d932
Merge pull request #360 from Laupetin/fix/gltf-multiple-mesh-loading
fix: loading of gltf with multiple meshes
2025-01-23 23:47:50 +01:00
Jan
826c1d2f2d
fix: loading of gltf with multiple meshes 2025-01-23 22:25:38 +00:00
Jan
0b91eeb932
Merge pull request #359 from Laupetin/fix/load-gltf-base64
fix: loading of base64 data from gltf files
2025-01-23 22:40:44 +01:00
Jan
94ca0ab79e
fix: loading of base64 data from gltf files 2025-01-23 21:17:51 +00:00
Jan
f6d36b2d6e
Merge pull request #358 from Laupetin/feature/gltf-separate-meshes
feat: separate objects into gltf meshes instead of primitives
2025-01-23 19:12:04 +01:00
Jan
140eb7b7a4
feat: dump objects into gltf meshes instead of primitives 2025-01-23 17:47:30 +00:00
Jan
708e759f8c
chore: update code style of gltf writer 2025-01-23 17:23:33 +00:00
Jan
80fa61b45c
chore: update xmodel dumper code style 2025-01-23 17:09:09 +00:00
Jan
f436cd6caa
Merge pull request #357 from Laupetin/fix/load-non-reference-assets
fix: load non reference assets
2025-01-21 23:42:31 +01:00
Jan
4d0b0651eb
fix: formatting 2025-01-21 23:20:55 +01:00
Jan
7a639a359c
fix: not being able to ignore assets of type attachment,attachmentunique 2025-01-21 22:17:06 +00:00
Jan
990bfe27df
chore: add force loading of assets 2025-01-21 22:16:55 +00:00
Jan
b4194eff28
chore: always use dynamic asset pools and remove static implementation 2025-01-21 22:14:24 +00:00
Jan
8ace49b715
Merge pull request #353 from Laupetin/dependabot/submodules/thirdparty/json-e72046e
chore(deps): bump thirdparty/json from `2d42229` to `e72046e`
2025-01-18 11:45:17 +01:00
Jan
b623ed49a0
Merge pull request #352 from Laupetin/dependabot/submodules/thirdparty/eigen-abac563
chore(deps): bump thirdparty/eigen from `9836e8d` to `abac563`
2025-01-18 11:45:07 +01:00
dependabot[bot]
0ffbdf5b73
chore(deps): bump thirdparty/json from 2d42229 to e72046e
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `2d42229` to `e72046e`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](2d42229f4d...e72046ef9f)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-17 22:48:29 +00:00
dependabot[bot]
f930c874b8
chore(deps): bump thirdparty/eigen from 9836e8d to abac563
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `9836e8d` to `abac563`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](9836e8d035...abac563f5d)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-17 22:48:27 +00:00
Jan
74f84cbf83
Merge pull request #351 from Laupetin/fix/invalid-dds-mip-map-flags
fix: support dds files that lie about their mipmaps
2025-01-15 20:44:00 +01:00
Jan
8c453f1683
fix: support dds files that lie about their mipmaps 2025-01-15 19:18:04 +00:00
Jan
aa73dca59d
Merge pull request #350 from Laupetin/fix/not-loading-iwd
fix: not loading iwds from search-path in Unlinker
2025-01-15 19:10:13 +01:00
Jan
a41d15d43a
fix: not loading iwds from search-path in Unlinker 2025-01-15 17:47:33 +00:00
Jan
64bac44e63
Merge pull request #348 from Laupetin/fix/t6-long-fastfile-names
fix: long fastfile names
2025-01-15 01:09:57 +01:00
Jan
85d9f1c255
fix: salsa20 encryption only initializes encryption with zone name of at max 31 characters length 2025-01-15 00:47:01 +01:00
Jan
d9f23a0b76
fix: make file name verification consider max file name length in zone properly 2025-01-15 00:46:22 +01:00
Jan
a1d3e64813
Merge pull request #347 from Laupetin/refactor/outpath-search-path
refactor: use OutputPathFilesystem for writing fastfiles
2025-01-14 23:38:34 +01:00
Jan
cc67f6e730
refactor: use OutputPathFilesystem for writing fastfiles 2025-01-14 22:03:44 +01:00
Jan
a364e63258
Merge pull request #346 from Laupetin/refactor/remove-memorymanager-create
refactor: remove MemoryManager create method usages
2025-01-13 23:26:00 +01:00
Jan
4c09e94220
refactor: remove MemoryManager create method usages 2025-01-13 22:03:20 +00:00
Jan
62f1ac41c5
chore: remove debug log in generate script 2025-01-13 20:19:36 +00:00
Jan
fea4970b84
Merge pull request #345 from Laupetin/chore/premake-update
chore: remove premake5 executable from repo
2025-01-13 20:40:18 +01:00
Jan
0f1c67b54c
fix: properly interpret windows errorlevels 2025-01-13 19:15:21 +00:00
Jan
419481b4da
chore: add possibility to ignore premake5 from path 2025-01-13 01:27:32 +01:00
Jan
32c0ecb04d
chore: replace deprecated flags usage of FatalWarnings for premake 2025-01-12 23:45:11 +00:00
Jan
d1d4752114
chore: run generate script in ci 2025-01-12 23:41:23 +00:00
Jan
6e6bfca38c
chore: update premake version in ci 2025-01-12 23:49:17 +01:00
Jan
4240ddd4c7
chore: update and automatically install premake5 2025-01-12 23:47:59 +01:00
Jan
1d39062372
Merge pull request #341 from Laupetin/refactor/obj-dumping-output-path
refactor: obj dumping output path
2025-01-11 18:14:11 +01:00
Jan
2d58054ffc
refactor: make use of IOutputPath in ObjWriting 2025-01-11 17:52:04 +01:00
Jan
b584cd7423
fix: make sure creating directories in OutputPathFilesystem cannot lead to a crash 2025-01-11 13:05:45 +01:00
Jan
27c01e0a41
Merge pull request #339 from diamante0018/fix/recover-from-filesystem-ex
Recover from filesystem exception when dumping
2025-01-11 12:37:10 +01:00
Jan
a759f3d82b
Merge pull request #340 from Laupetin/fix/regressions-from-obj-compiling-refactor
fix: regressions from obj compiling refactor
2025-01-11 12:22:47 +01:00
Jan
c86f9f6391
fix: not accessing previous zone data when taking an asset from global asset pools 2025-01-11 11:57:09 +01:00
Jan
36f0764cd5
fix: not registering script strings for xmodel loading 2025-01-11 11:56:39 +01:00
Jan
0a98da9a79
fix: not calculating fields in t6 attachment unique loader 2025-01-11 11:56:04 +01:00
315eb76127
recover from filesystem exception when dumping 2025-01-11 11:20:12 +01:00
Jan
68665c79c9
Merge pull request #338 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-2e9f2b5
chore(deps): bump thirdparty/libtomcrypt from `c900951` to `2e9f2b5`
2025-01-11 00:32:51 +01:00
Jan
d04e76e635
Merge pull request #337 from Laupetin/dependabot/submodules/thirdparty/catch2-914aeec
chore(deps): bump thirdparty/catch2 from `0321d2f` to `914aeec`
2025-01-11 00:32:37 +01:00
Jan
50ece7dee2
Merge pull request #336 from Laupetin/dependabot/submodules/thirdparty/eigen-9836e8d
chore(deps): bump thirdparty/eigen from `7bb23b1` to `9836e8d`
2025-01-11 00:32:24 +01:00
Jan
9535342e60
Merge pull request #335 from Laupetin/dependabot/submodules/thirdparty/json-2d42229
chore(deps): bump thirdparty/json from `60c4875` to `2d42229`
2025-01-11 00:32:08 +01:00
dependabot[bot]
44440ab92e
chore(deps): bump thirdparty/libtomcrypt from c900951 to 2e9f2b5
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `c900951` to `2e9f2b5`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](c900951dab...2e9f2b5e44)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 22:56:08 +00:00
dependabot[bot]
f449527e51
chore(deps): bump thirdparty/catch2 from 0321d2f to 914aeec
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `0321d2f` to `914aeec`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](0321d2fce3...914aeecfe2)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 22:56:06 +00:00
dependabot[bot]
77c6e2d53c
chore(deps): bump thirdparty/eigen from 7bb23b1 to 9836e8d
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `7bb23b1` to `9836e8d`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](7bb23b1e36...9836e8d035)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 22:56:04 +00:00
dependabot[bot]
2c5f5215f3
chore(deps): bump thirdparty/json from 60c4875 to 2d42229
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `60c4875` to `2d42229`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](60c48755e3...2d42229f4d)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 22:56:03 +00:00
Jan
5d69473551
Merge pull request #333 from awsms/main
tiny mistakes in the filenames of the make scripts
2025-01-10 16:16:03 +01:00
awsms
e5e92b7b23 tiny mistakes in the filenames of the make scripts 2025-01-10 13:52:15 +01:00
Jan
98288f5d47
Merge pull request #330 from Laupetin/test/obj-compiling-tests
Add tests for ObjCompiling module
2025-01-08 22:55:18 +01:00
Jan
d1e6aa9da0
test: add unit test for IwdCreator 2025-01-08 21:25:48 +00:00
Jan
fa249b0bd3
test: add unit test for IPakCreator 2025-01-08 21:05:11 +00:00
Jan
54e240e98c
fix: compilation 2025-01-08 17:39:34 +00:00
Jan
3b5ca86b0d
test: add unit test for ImageIwdPostProcessor 2025-01-08 17:37:19 +00:00
Jan
8c8ceae0bd
test: add unit test for ImageIPakPostProcessor 2025-01-08 17:36:01 +00:00
Jan
e0f8b3d3ca
chore: add abstraction for opening output files to be able to mock it 2025-01-07 00:02:38 +01:00
Jan
cacccf64e1
fix: make sure kvps are in a deterministic order 2025-01-05 10:16:14 +00:00
Jan
67fb11506c
chore: initialize ipak and iwd post processors immediately in constructor 2025-01-05 09:35:52 +00:00
Jan
83833cb84e
fix: use canonical instead of absolute in test initialization 2025-01-05 09:05:47 +00:00
Jan
ce3786f086
chore: check exact paths of test executable and provide temp dir 2025-01-05 00:16:58 +00:00
Jan
fc9e6ce14d
test: add test for KeyValuePairsCompilerT6 2025-01-05 00:16:57 +00:00
Jan
16e82f68ca
Merge pull request #332 from Laupetin/dependabot/submodules/thirdparty/json-60c4875
chore(deps): bump thirdparty/json from `6be4e85` to `60c4875`
2025-01-04 12:50:17 +01:00
Jan
dbecafd2a2
Merge pull request #331 from Laupetin/dependabot/submodules/thirdparty/eigen-7bb23b1
chore(deps): bump thirdparty/eigen from `24e0c2a` to `7bb23b1`
2025-01-04 12:50:04 +01:00
dependabot[bot]
3ef65f741b
chore(deps): bump thirdparty/json from 6be4e85 to 60c4875
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `6be4e85` to `60c4875`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](6be4e85600...60c48755e3)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-03 22:39:34 +00:00
dependabot[bot]
768f4337f7
chore(deps): bump thirdparty/eigen from 24e0c2a to 7bb23b1
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `24e0c2a` to `7bb23b1`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](24e0c2a125...7bb23b1e36)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-03 22:39:32 +00:00
Jan
a781aae1c9
Merge pull request #286 from Laupetin/feature/obj-container-improvements
feat: improve building IWD and IPak obj containers
2025-01-03 15:16:45 +01:00
Jan
b84c719d3f
chore: add missing headers 2025-01-03 14:55:19 +01:00
Jan
ac43b646cc
feat: automatically add ipak_read kvp when creating ipak 2025-01-03 14:55:19 +01:00
Jan
2313da1c12
chore: inject ZoneAssetCreationStateCollection to states 2025-01-03 14:55:19 +01:00
Jan
ef862ff246
chore: make keyvaluepairscompiler use a zonestate 2025-01-03 14:55:19 +01:00
Jan
3c3161448f
chore: get Iwd and Ipak creators in constructor for post processors 2025-01-03 11:18:33 +01:00
Jan
416823c6cd
chore: rename ZoneAssetLoaderState to ZoneAssetCreationState 2025-01-03 11:01:44 +01:00
Jan
9068e96dfa
chore: make IZoneLoadingState return reference 2025-01-03 10:42:37 +01:00
Jan
fa6f9451d2
chore: extract ZoneAssetLoaderContainer to separate class 2025-01-03 10:25:51 +01:00
Jan
41d97c0954
chore: initialize KeyValuePairsCompiler for T6 as obj compiler 2025-01-03 09:59:28 +01:00
Jan
e92797e0b8
chore: remove outdated ipak code 2025-01-02 23:16:03 +01:00
Jan
ca761dfdbc
chore: do not fail upon failure to find ipak file 2025-01-02 22:59:21 +01:00
Jan
9097db7d0f
fix: compilation on windows 2025-01-02 22:39:14 +01:00
Jan
dfd6e4117c
feat: write data to ipak files 2025-01-02 17:59:49 +01:00
Jan
351b6bb1ea
feat: write iwi data to specified iwds 2025-01-02 17:54:46 +01:00
Jan
fe5d0f79ff
chore: consider specified obj containers when post processing 2025-01-02 16:26:42 +01:00
Jan
a7254aa11c
feat: add post processors compiling iwds and ipaks 2025-01-02 12:57:10 +01:00
Jan
b5937ef975
fix: fix not finalizing obj containers when parsing zone definition 2025-01-01 21:19:28 +01:00
Jan
aa212e0958
chore: parse includes and assetlists while parsing zone definition 2025-01-01 18:14:43 +01:00
Jan
9852f52a15
chore: get rid of now unused AssetLoading classes 2025-01-01 18:14:43 +01:00
Jan
e11e8a361e
chore: adjust message when no asset creator could create asset 2025-01-01 18:14:43 +01:00
Jan
dd4f18b638
chore: do not consider not finding global asset a failure 2025-01-01 18:14:42 +01:00
Jan
ffac925410
fix: reallocate assets before adding to zone pool when loading from
fastfile
2025-01-01 18:14:42 +01:00
Jan
da7a60221c
fix: initialize default asset creator collection 2025-01-01 18:14:42 +01:00
Jan
27ef3152a0
chore: do not initialize zone pools in ZoneCreator 2025-01-01 18:14:42 +01:00
Jan
b7c8c70f2a
fix: compilation 2025-01-01 18:14:42 +01:00
Jan
80c4a9a2ae
fix: do not reallocate assets for dynamic asset pool 2025-01-01 18:14:42 +01:00
Jan
306ffb730e
chore: fix error in ZoneCreator 2025-01-01 18:14:42 +01:00
Jan
692c31b711
chore: fix test compilation 2025-01-01 18:14:42 +01:00
Jan
83d13aa166
chore: fix loading and writing code for T6 2025-01-01 18:14:41 +01:00
Jan
d8bc156ffd
chore: fix loading and writing code for T5 2025-01-01 18:14:41 +01:00
Jan
a36581b06e
chore: fix loading and writing code for IW5 2025-01-01 18:14:41 +01:00
Jan
9ae5aaa1db
chore: fix loading and writing code for IW4 2025-01-01 18:14:41 +01:00
Jan
a5873a301f
chore: adjust IW3 asset loaders to fit IW4 format 2025-01-01 18:14:41 +01:00
Jan
7ef944ebd4
chore: refactor IW4 asset loaders 2025-01-01 18:14:41 +01:00
Jan
f9456101e6
chore: enable all currently implemented loaders for iw3 2025-01-01 18:14:41 +01:00
Jan
4f585c6aa7
chore: add generic default asset constructors for all games 2025-01-01 18:14:40 +01:00
Jan
9ebea5034a
chore: generalize default asset creators 2025-01-01 18:14:40 +01:00
Jan
c524cb007a
chore: implement obj loading skeleton with localize asset 2025-01-01 18:14:40 +01:00
Jan
673db0592f
chore: add scripts for formatting via docker containers 2025-01-01 18:14:40 +01:00
Jan
2c8fcf1630
chore: formatting 2025-01-01 18:14:40 +01:00
Jan
4f0a405bdc
chore: adjust asset creation process to use separated AssetCreators 2025-01-01 18:14:40 +01:00
Jan
63046f5681
chore: do not add duplicate paths in LinkerPaths 2025-01-01 18:14:40 +01:00
Jan
a240824706
chore: normalize paths before making use of them in LinkerPaths 2025-01-01 18:14:39 +01:00
Jan
110f31e58a
chore: fix linux build 2025-01-01 18:14:39 +01:00
Jan
be6c30c503
refactor: rework search paths 2025-01-01 18:14:39 +01:00
Jan
fd421c4784
chore: use std format for linker and unlinker args 2025-01-01 18:14:39 +01:00
Jan
3803ae24f5
chore: add ObjCompiling component 2025-01-01 18:14:39 +01:00
Jan
f9e0bdaa7b
chore: always build fastfile when there are assets defined 2025-01-01 18:14:39 +01:00
Jan
2182196730
feat: add ipak and iwd zone definition metadata to replace type 2025-01-01 18:14:39 +01:00
Jan
973ff73554
Merge pull request #324 from Laupetin/dependabot/submodules/thirdparty/json-6be4e85
chore(deps): bump thirdparty/json from `af4ad79` to `6be4e85`
2024-12-31 12:40:55 +01:00
dependabot[bot]
7097e36d27
chore(deps): bump thirdparty/json from af4ad79 to 6be4e85
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `af4ad79` to `6be4e85`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](af4ad7915c...6be4e85600)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 22:06:52 +00:00
Jan
a98fa5b5e3
Merge pull request #323 from Laupetin/dependabot/submodules/thirdparty/eigen-24e0c2a
chore(deps): bump thirdparty/eigen from `af59ada` to `24e0c2a`
2024-12-23 18:28:08 +01:00
Jan
f3d8addde8
Merge pull request #322 from Laupetin/dependabot/submodules/thirdparty/json-af4ad79
chore(deps): bump thirdparty/json from `620034e` to `af4ad79`
2024-12-23 18:27:52 +01:00
Jan
00ab5e69e1
Merge pull request #321 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-c900951
chore(deps): bump thirdparty/libtomcrypt from `a81dab9` to `c900951`
2024-12-23 18:27:31 +01:00
dependabot[bot]
1a5ebb0d81
chore(deps): bump thirdparty/eigen from af59ada to 24e0c2a
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `af59ada` to `24e0c2a`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](af59ada0ac...24e0c2a125)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-20 22:44:26 +00:00
dependabot[bot]
a17360c916
chore(deps): bump thirdparty/json from 620034e to af4ad79
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `620034e` to `af4ad79`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](620034ecec...af4ad7915c)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-20 22:44:24 +00:00
dependabot[bot]
f6921acbc2
chore(deps): bump thirdparty/libtomcrypt from a81dab9 to c900951
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `a81dab9` to `c900951`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](a81dab9970...c900951dab)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-20 22:44:23 +00:00
Jan
3db816fb7f
Merge pull request #320 from Laupetin/dependabot/submodules/thirdparty/eigen-af59ada
chore(deps): bump thirdparty/eigen from `fd48fbb` to `af59ada`
2024-12-19 17:14:30 +01:00
Jan
50e396c587
Merge pull request #319 from Laupetin/dependabot/submodules/thirdparty/json-620034e
chore(deps): bump thirdparty/json from `9f60e85` to `620034e`
2024-12-19 17:14:11 +01:00
Jan
cc39a394e6
Merge pull request #318 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-a81dab9
chore(deps): bump thirdparty/libtomcrypt from `507c668` to `a81dab9`
2024-12-19 17:13:57 +01:00
dependabot[bot]
b16198c705
chore(deps): bump thirdparty/eigen from fd48fbb to af59ada
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `fd48fbb` to `af59ada`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](fd48fbb260...af59ada0ac)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-13 22:33:52 +00:00
dependabot[bot]
f1f13d09eb
chore(deps): bump thirdparty/json from 9f60e85 to 620034e
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `9f60e85` to `620034e`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](9f60e85557...620034ecec)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-13 22:33:51 +00:00
dependabot[bot]
5e02352784
chore(deps): bump thirdparty/libtomcrypt from 507c668 to a81dab9
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `507c668` to `a81dab9`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](507c66827f...a81dab9970)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-13 22:33:48 +00:00
Jan
ce3f2c6d97
Merge pull request #317 from Laupetin/dependabot/submodules/thirdparty/json-9f60e85
chore(deps): bump thirdparty/json from `1b9a9d1` to `9f60e85`
2024-12-07 14:03:38 +01:00
Jan
b571024385
Merge pull request #316 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-507c668
chore(deps): bump thirdparty/libtomcrypt from `1764254` to `507c668`
2024-12-07 14:03:26 +01:00
Jan
fa250531b2
Merge pull request #315 from Laupetin/dependabot/submodules/thirdparty/eigen-fd48fbb
chore(deps): bump thirdparty/eigen from `d34b100` to `fd48fbb`
2024-12-07 14:03:11 +01:00
dependabot[bot]
9d37005445
chore(deps): bump thirdparty/json from 1b9a9d1 to 9f60e85
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `1b9a9d1` to `9f60e85`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](1b9a9d1f21...9f60e85557)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-06 23:00:10 +00:00
dependabot[bot]
45ac414c11
chore(deps): bump thirdparty/libtomcrypt from 1764254 to 507c668
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `1764254` to `507c668`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](17642547e4...507c66827f)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-06 23:00:08 +00:00
dependabot[bot]
6d7fed74a6
chore(deps): bump thirdparty/eigen from d34b100 to fd48fbb
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `d34b100` to `fd48fbb`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](d34b100c13...fd48fbb260)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-06 23:00:06 +00:00
Jan
815f484aa6
Merge pull request #314 from Laupetin/dependabot/submodules/thirdparty/json-1b9a9d1
chore(deps): bump thirdparty/json from `a97041a` to `1b9a9d1`
2024-12-06 11:08:15 +01:00
Jan
fddfe57d99
Merge pull request #313 from Laupetin/dependabot/submodules/thirdparty/eigen-d34b100
chore(deps): bump thirdparty/eigen from `8ad4344` to `d34b100`
2024-12-06 11:08:05 +01:00
dependabot[bot]
9ab581c072
chore(deps): bump thirdparty/json from a97041a to 1b9a9d1
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `a97041a` to `1b9a9d1`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](a97041a98f...1b9a9d1f21)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-29 22:35:56 +00:00
dependabot[bot]
96b055a37b
chore(deps): bump thirdparty/eigen from 8ad4344 to d34b100
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `8ad4344` to `d34b100`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](8ad4344ca7...d34b100c13)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-29 22:35:54 +00:00
Jan
b5e50c87fb
Merge pull request #310 from Laupetin/dependabot/submodules/thirdparty/catch2-0321d2f
chore(deps): bump thirdparty/catch2 from `506276c` to `0321d2f`
2024-11-27 11:59:15 +01:00
Jan
2c837a53b9
Merge pull request #311 from Laupetin/dependabot/submodules/thirdparty/json-a97041a
chore(deps): bump thirdparty/json from `fde9a86` to `a97041a`
2024-11-27 11:59:05 +01:00
Jan
d4a9211211
Merge pull request #312 from Laupetin/dependabot/submodules/thirdparty/eigen-8ad4344
chore(deps): bump thirdparty/eigen from `d6e3b52` to `8ad4344`
2024-11-27 11:58:56 +01:00
Jan
39a5564186
Merge pull request #309 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-1764254
chore(deps): bump thirdparty/libtomcrypt from `5d2b154` to `1764254`
2024-11-27 11:58:47 +01:00
dependabot[bot]
76aed9af14
chore(deps): bump thirdparty/eigen from d6e3b52 to 8ad4344
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `d6e3b52` to `8ad4344`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](d6e3b528b2...8ad4344ca7)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 22:32:52 +00:00
dependabot[bot]
e6f8ec3419
chore(deps): bump thirdparty/json from fde9a86 to a97041a
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `fde9a86` to `a97041a`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](fde9a86c5a...a97041a98f)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 22:32:50 +00:00
dependabot[bot]
130933ac29
chore(deps): bump thirdparty/catch2 from 506276c to 0321d2f
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `506276c` to `0321d2f`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](506276c592...0321d2fce3)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 22:32:48 +00:00
dependabot[bot]
9da2f5e788
chore(deps): bump thirdparty/libtomcrypt from 5d2b154 to 1764254
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `5d2b154` to `1764254`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](5d2b15472f...17642547e4)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 22:32:45 +00:00
Jan
a2063057ec
Merge pull request #308 from Laupetin/dependabot/submodules/thirdparty/zlib-ef24c4c
chore(deps): bump thirdparty/zlib from `d476828` to `ef24c4c`
2024-11-17 18:20:00 +01:00
Jan
59ff4c0b1d
Merge pull request #307 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-5d2b154
chore(deps): bump thirdparty/libtomcrypt from `2dd6690` to `5d2b154`
2024-11-17 18:19:51 +01:00
Jan
ecf2a026f7
Merge pull request #306 from Laupetin/dependabot/submodules/thirdparty/eigen-d6e3b52
chore(deps): bump thirdparty/eigen from `0d366f6` to `d6e3b52`
2024-11-17 18:19:41 +01:00
Jan
6117f4c206
Merge pull request #305 from Laupetin/dependabot/submodules/thirdparty/json-fde9a86
chore(deps): bump thirdparty/json from `18ff442` to `fde9a86`
2024-11-17 18:19:32 +01:00
Jan
a6340adb38
Merge pull request #304 from Laupetin/dependabot/submodules/thirdparty/catch2-506276c
chore(deps): bump thirdparty/catch2 from `119a7bb` to `506276c`
2024-11-17 18:19:21 +01:00
dependabot[bot]
66beda8723
chore(deps): bump thirdparty/zlib from d476828 to ef24c4c
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `d476828` to `ef24c4c`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](d476828316...ef24c4c750)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 22:08:04 +00:00
dependabot[bot]
46da761892
chore(deps): bump thirdparty/libtomcrypt from 2dd6690 to 5d2b154
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `2dd6690` to `5d2b154`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](2dd6690edf...5d2b15472f)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 22:08:03 +00:00
dependabot[bot]
6fb132dbfc
chore(deps): bump thirdparty/eigen from 0d366f6 to d6e3b52
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `0d366f6` to `d6e3b52`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](0d366f6532...d6e3b528b2)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 22:08:01 +00:00
dependabot[bot]
4572687502
chore(deps): bump thirdparty/json from 18ff442 to fde9a86
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `18ff442` to `fde9a86`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](18ff442e63...fde9a86c5a)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 22:08:00 +00:00
dependabot[bot]
7fb5c98894
chore(deps): bump thirdparty/catch2 from 119a7bb to 506276c
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `119a7bb` to `506276c`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](119a7bbe53...506276c592)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 22:07:58 +00:00
Jan
3079c5ee0d
Merge pull request #301 from Laupetin/dependabot/submodules/thirdparty/eigen-0d366f6
chore(deps): bump thirdparty/eigen from `7fd305e` to `0d366f6`
2024-11-12 20:15:59 +01:00
Jan
218612b8c8
Merge pull request #300 from Laupetin/dependabot/submodules/thirdparty/json-18ff442
chore(deps): bump thirdparty/json from `6325839` to `18ff442`
2024-11-12 20:15:49 +01:00
Jan
19f19f7adb
Merge pull request #299 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-2dd6690
chore(deps): bump thirdparty/libtomcrypt from `cbb01b3` to `2dd6690`
2024-11-12 20:15:39 +01:00
Jan
47b6d7720c
Merge pull request #303 from Laupetin/fix/zone-definition-default-name
fix: make name of zone definition the target name by default
2024-11-12 20:15:02 +01:00
Jan
2034db3330
fix: make name of zone definition the target name by default 2024-11-12 19:37:38 +01:00
dependabot[bot]
303f1da0bc
chore(deps): bump thirdparty/eigen from 7fd305e to 0d366f6
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `7fd305e` to `0d366f6`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](7fd305ecae...0d366f6532)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-08 22:25:05 +00:00
dependabot[bot]
a559fbafd2
chore(deps): bump thirdparty/json from 6325839 to 18ff442
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `6325839` to `18ff442`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](6325839776...18ff442e63)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-08 22:25:03 +00:00
dependabot[bot]
6ed907c114
chore(deps): bump thirdparty/libtomcrypt from cbb01b3 to 2dd6690
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `cbb01b3` to `2dd6690`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](cbb01b3708...2dd6690edf)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-08 22:25:01 +00:00
Jan
aa8300052a
Merge pull request #297 from Laupetin/dependabot/submodules/thirdparty/eigen-7fd305e
chore(deps): bump thirdparty/eigen from `53b83cd` to `7fd305e`
2024-11-02 08:51:57 +01:00
Jan
0591befd22
Merge pull request #296 from Laupetin/dependabot/submodules/thirdparty/catch2-119a7bb
chore(deps): bump thirdparty/catch2 from `a6ee7e2` to `119a7bb`
2024-11-02 08:51:43 +01:00
dependabot[bot]
5ad37e0e44
chore(deps): bump thirdparty/eigen from 53b83cd to 7fd305e
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `53b83cd` to `7fd305e`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](53b83cddf9...7fd305ecae)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 22:57:37 +00:00
dependabot[bot]
106affc794
chore(deps): bump thirdparty/catch2 from a6ee7e2 to 119a7bb
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `a6ee7e2` to `119a7bb`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](a6ee7e20cd...119a7bbe53)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 22:57:34 +00:00
Jan
b0911919a5
Merge pull request #294 from Laupetin/dependabot/submodules/thirdparty/catch2-a6ee7e2
chore(deps): bump thirdparty/catch2 from `0b2af56` to `a6ee7e2`
2024-10-26 01:35:32 +02:00
Jan
c202264ad0
Merge pull request #293 from Laupetin/dependabot/submodules/thirdparty/eigen-53b83cd
chore(deps): bump thirdparty/eigen from `b396a6f` to `53b83cd`
2024-10-26 01:35:19 +02:00
dependabot[bot]
18c903a9e2
chore(deps): bump thirdparty/catch2 from 0b2af56 to a6ee7e2
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `0b2af56` to `a6ee7e2`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](0b2af56271...a6ee7e20cd)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 22:33:00 +00:00
dependabot[bot]
ecb7b06e11
chore(deps): bump thirdparty/eigen from b396a6f to 53b83cd
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `b396a6f` to `53b83cd`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](b396a6fbb2...53b83cddf9)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-25 22:32:57 +00:00
Jan
242bf64576
Merge pull request #292 from Laupetin/refactor/global-game-state
refactor: get rid of global game variables
2024-10-19 22:29:46 +02:00
Jan
b00c65c8c0
refactor: get rid of global game variables 2024-10-19 22:09:26 +02:00
Jan
ce16d8e6c8
chore: use method static array for zonewriterfactory 2024-10-19 20:05:08 +01:00
Jan
a1851b0ea0
chore: use method static array for zoneloaderfactory 2024-10-19 20:05:08 +01:00
Jan
778361728c
chore: make some zone classes use const references 2024-10-19 20:05:08 +01:00
Jan
897a571a41
chore: make GetLanguagePrefixes return a reference instead of a vector copy 2024-10-19 20:05:05 +01:00
Jan
3aaa821b74
Merge pull request #291 from Laupetin/refactor/game-based-interfaces
refactor: interfaces with game implementations
2024-10-19 15:12:28 +02:00
Jan
e80b9d7460
chore: use std format 2024-10-19 13:46:47 +01:00
Jan
bb845f68e9
chore: use IObjWriter directly instead of indirection of ObjWriting 2024-10-19 13:46:47 +01:00
Jan
4c9a84777f
chore: use IObjLoader directly instead of indirection of ObjLoading 2024-10-19 13:46:47 +01:00
Jan
c034ac790a
refactor: refactor ZoneDefWriter 2024-10-19 10:49:56 +02:00
Jan
eec643fab5
Merge pull request #290 from Laupetin/dependabot/submodules/thirdparty/catch2-0b2af56
chore(deps): bump thirdparty/catch2 from `fa43b77` to `0b2af56`
2024-10-19 00:57:48 +02:00
Jan
5fb476719f
Merge pull request #289 from Laupetin/dependabot/submodules/thirdparty/eigen-b396a6f
chore(deps): bump thirdparty/eigen from `e0cbc55` to `b396a6f`
2024-10-19 00:57:36 +02:00
Jan
130da9343f
Merge pull request #288 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-cbb01b3
chore(deps): bump thirdparty/libtomcrypt from `29af892` to `cbb01b3`
2024-10-19 00:57:23 +02:00
dependabot[bot]
0e085971f3
chore(deps): bump thirdparty/catch2 from fa43b77 to 0b2af56
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `fa43b77` to `0b2af56`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](fa43b77429...0b2af56271)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-18 22:32:14 +00:00
dependabot[bot]
d135da5134
chore(deps): bump thirdparty/eigen from e0cbc55 to b396a6f
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `e0cbc55` to `b396a6f`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](e0cbc55d92...b396a6fbb2)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-18 22:32:12 +00:00
dependabot[bot]
b7af67e71d
chore(deps): bump thirdparty/libtomcrypt from 29af892 to cbb01b3
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `29af892` to `cbb01b3`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](29af8922b6...cbb01b3708)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-18 22:32:11 +00:00
Jan
1c01a2d8c9
Merge pull request #285 from Laupetin/fix/multi-ipak-reading
fix: use multimap again for zone definition properties
2024-10-12 22:35:54 +02:00
Jan
0e3d9efb0f
fix: use multimap again for zone definition properties since stuff like ipak_read can be specified multiple times 2024-10-12 22:14:55 +02:00
Jan
bc0f42a18f
Merge pull request #284 from Laupetin/fix/guessing-sound-filenames
fix: stop removing extensions of soundaliases
2024-10-12 20:15:47 +02:00
Jan
0a423937f0
fix: stop removing extensions of soundalises and guessing their extension later 2024-10-12 18:54:50 +01:00
Jan
dadce3dcca
Merge pull request #282 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-29af892
chore(deps): bump thirdparty/libtomcrypt from `e0d90c5` to `29af892`
2024-10-12 09:26:07 +02:00
Jan
dfcaf75b00
Merge pull request #281 from Laupetin/dependabot/submodules/thirdparty/json-6325839
chore(deps): bump thirdparty/json from `b36f4c4` to `6325839`
2024-10-12 09:25:54 +02:00
Jan
c13d0668e4
Merge pull request #280 from Laupetin/dependabot/submodules/thirdparty/eigen-e0cbc55
chore(deps): bump thirdparty/eigen from `a097f72` to `e0cbc55`
2024-10-12 09:25:41 +02:00
dependabot[bot]
6a11f22a66
chore(deps): bump thirdparty/libtomcrypt from e0d90c5 to 29af892
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `e0d90c5` to `29af892`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](e0d90c58da...29af8922b6)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 22:59:52 +00:00
dependabot[bot]
8127b667de
chore(deps): bump thirdparty/json from b36f4c4 to 6325839
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `b36f4c4` to `6325839`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](b36f4c477c...6325839776)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 22:59:50 +00:00
dependabot[bot]
36fda384b3
chore(deps): bump thirdparty/eigen from a097f72 to e0cbc55
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `a097f72` to `e0cbc55`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](a097f728fe...e0cbc55d92)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 22:59:49 +00:00
Jan
bf23d797aa
Merge pull request #278 from Jbleezy/main
Improve sound bank dumping
2024-10-08 21:38:09 +02:00
Jbleezy
ac7b1800f0 Add FORMATTING_RETRIES constexpr 2024-10-08 12:03:33 -07:00
Jbleezy
cfb7c7ca78 Save format string instead of float 2024-10-08 11:56:52 -07:00
Jan
038ed9a37a
Merge pull request #279 from Laupetin/fix/zone-def-loading
fix: zone def loading
2024-10-08 20:52:49 +02:00
Jbleezy
e98fad73b9 Remove curly braces on single line statements 2024-10-08 11:40:30 -07:00
Jbleezy
6beff28518 Remove more namespace on function calls 2024-10-08 11:38:24 -07:00
Jbleezy
e9720a2b1a Remove namespace on function calls 2024-10-08 11:36:23 -07:00
Jan
9f9e20988a
fix: zone def loader not taking correct token for asset name 2024-10-08 20:11:15 +02:00
Jan
c245daf56e
fix: loaded zone definitions do not set type fastfile if undefined 2024-10-08 20:10:40 +02:00
Jbleezy
351a4441c2 Revert FileSource rename 2024-10-07 12:33:01 -07:00
Jbleezy
bd57f84ecd Fix windows build 2024-10-07 12:10:32 -07:00
Jbleezy
321c5067ed Rename centValue to centsValue 2024-10-07 06:45:22 -07:00
Jbleezy
ed06700f99 Increase rounded sound alias float value precision until it is equal to initial value 2024-10-07 06:41:59 -07:00
Jbleezy
93a35f5dcf Rename CentToHertz to CentsToHertz 2024-10-07 01:15:48 -07:00
Jbleezy
5f8eb30ce0 Format dumped sound alias float values 2024-10-06 17:45:50 -07:00
Jbleezy
4529ff2c5e Rename all instances of Pausable to Pauseable 2024-10-06 15:16:14 -07:00
Jbleezy
a926b752cf Rename EnvelopPercentage to EnvelopPercent 2024-10-06 15:04:47 -07:00
Jbleezy
494ea8f89c Rename FileSource to File 2024-10-06 15:01:51 -07:00
Jbleezy
2aac08a62d Reorganize sound alias columns 2024-10-06 14:59:56 -07:00
Jbleezy
ff02491e08 Fix space being prepended to randomize type 2024-10-06 12:31:45 -07:00
Jbleezy
1774001598 Use int16_t max for pitch dumping and loading 2024-10-06 12:13:22 -07:00
Jan
1fc31b8c44
Merge pull request #277 from Laupetin/refactor/sound-bank-loading-dumping
refactor: sound bank loading dumping
2024-10-06 19:34:26 +02:00
Jan
d2b95b4ebe
chore: trim csv reader values 2024-10-06 19:11:25 +02:00
Jan
d814fe7b95
refactor: refactor sound csv loading code 2024-10-06 19:11:25 +02:00
Jan
a3b9d2693c
chore: rename pauseable to pausable 2024-10-06 19:11:25 +02:00
Jan
8620ce864c
refactor: refactor sound bank csv writing head 2024-10-06 19:11:25 +02:00
Jan
bc51ecb49d
chore: little improvement on sound bank types 2024-10-06 19:11:21 +02:00
Jan
ff98b53625
Merge pull request #274 from Jbleezy/main
Dump and load correct volume and pitch values for T6 sound aliases
2024-10-06 19:10:46 +02:00
Jan
c1d3138b04
fix: formula for dbspl and cent values 2024-10-06 18:45:06 +02:00
Jan
90f45c0cea
Merge pull request #276 from Laupetin/refactor/zone-definition-asset-type
refactor: use asset_type_t for ZoneDefinition
2024-10-05 13:16:26 +02:00
Jan
1a7d2cf1a2
chore: fix build 2024-10-05 12:56:14 +02:00
Jan
1861bd689c
chore: respect previously set game when including additional zone files 2024-10-05 11:19:41 +01:00
Jan
b156c7348a
refactor: use asset_type_t for ZoneDefinition 2024-10-05 10:56:56 +01:00
Jan
d2b4b2dc38
Merge pull request #275 from Laupetin/dependabot/submodules/thirdparty/eigen-a097f72
chore(deps): bump thirdparty/eigen from `7ad7c1d` to `a097f72`
2024-10-05 00:52:06 +02:00
dependabot[bot]
963ec4f71c
chore(deps): bump thirdparty/eigen from 7ad7c1d to a097f72
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `7ad7c1d` to `a097f72`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](7ad7c1d5c5...a097f728fe)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-04 22:32:34 +00:00
Jbleezy
70bfd06fdc Fix linux build 2024-10-01 15:02:59 -07:00
Jbleezy
0ea55810ab Dump and load correct volume and pitch values for T6 sound aliases 2024-10-01 14:29:28 -07:00
Jan
cdc65e0425
Merge pull request #273 from Laupetin/dependabot/submodules/thirdparty/eigen-7ad7c1d
chore(deps): bump thirdparty/eigen from `2d4c9b4` to `7ad7c1d`
2024-09-28 08:12:54 +02:00
dependabot[bot]
c1896934ed
chore(deps): bump thirdparty/eigen from 2d4c9b4 to 7ad7c1d
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `2d4c9b4` to `7ad7c1d`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](2d4c9b400c...7ad7c1d5c5)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 22:07:21 +00:00
Jan
a8fefbc978
Merge pull request #272 from Laupetin/feature/iwi-converter
feat: iwi converter tool
2024-09-27 21:41:47 +02:00
Jan
d2fa1f40f4
fix: linux build 2024-09-27 21:20:02 +02:00
Jan
2dccd423af
refactor: extract image code into single component 2024-09-27 21:16:29 +02:00
Jan
a2d70c17ba
feat: convert from dds to iwi 2024-09-27 20:31:33 +02:00
Jan
8bd70662e0
feat: convert from iwi to dds 2024-09-27 17:36:05 +01:00
Jan
5cc52c42cd
refactor: image and obj data loading 2024-09-26 07:22:35 +02:00
Jan
5fee875495
chore: use filename of argv0 in UsageInformation 2024-09-23 23:05:04 +02:00
Jan
32480a75eb
chore: give all args to arg parser instead of omitting arg0 2024-09-23 22:38:18 +02:00
Jan
2b1c048a4a
chore: improve argument parser code 2024-09-23 22:36:47 +02:00
Jan
da18291c89
chore: improve args code for other tools 2024-09-23 20:00:00 +02:00
Jan
c37e9984ba
chore: add base for image converter tool 2024-09-23 19:29:58 +02:00
Jan
fabefc8cd5
Merge pull request #271 from Jbleezy/main
Fix guess sound filename function
2024-09-23 09:59:10 +02:00
Jbleezy
d558a4e075 Use concat instead of replace_extension for guess sound filename function 2024-09-23 00:31:36 -07:00
Jan
042c68a8fc
Merge pull request #267 from Laupetin/refactor/generalize-xmodel-loading
feat: generalize xmodel loading for IW5
2024-09-22 17:23:38 +02:00
Jan
d4d8e83169
feat: load iw5 images from raw 2024-09-22 16:59:56 +02:00
Jan
7b28b574d2
feat: load iw5 materials from json 2024-09-22 16:59:31 +02:00
Jan
28a4fbd0d6
feat: dump iw5 materials as json 2024-09-22 15:11:40 +02:00
Jan
7649e5d58f
chore: generalize base64 usage 2024-09-22 15:10:54 +02:00
Jan
3b59dad109
chore: generalize material constant zone state 2024-09-22 15:10:01 +02:00
Jan
5549f71f29
Merge pull request #270 from Laupetin/dependabot/submodules/thirdparty/catch2-fa43b77
chore(deps): bump thirdparty/catch2 from `bc63412` to `fa43b77`
2024-09-21 08:19:54 +02:00
Jan
debb63ee31
Merge pull request #269 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-e0d90c5
chore(deps): bump thirdparty/libtomcrypt from `6865b9f` to `e0d90c5`
2024-09-21 08:19:44 +02:00
Jan
6a0034f584
Merge pull request #268 from Laupetin/dependabot/submodules/thirdparty/eigen-2d4c9b4
chore(deps): bump thirdparty/eigen from `84282c4` to `2d4c9b4`
2024-09-21 08:19:34 +02:00
dependabot[bot]
82d2e8a603
chore(deps): bump thirdparty/catch2 from bc63412 to fa43b77
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `bc63412` to `fa43b77`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](bc63412e2a...fa43b77429)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 22:12:10 +00:00
dependabot[bot]
c99b3e1c25
chore(deps): bump thirdparty/libtomcrypt from 6865b9f to e0d90c5
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `6865b9f` to `e0d90c5`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](6865b9fc81...e0d90c58da)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 22:12:08 +00:00
dependabot[bot]
d0ec4d8fb4
chore(deps): bump thirdparty/eigen from 84282c4 to 2d4c9b4
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `84282c4` to `2d4c9b4`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](84282c42fc...2d4c9b400c)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 22:12:07 +00:00
Jan
88499b6428
chore: create temporary iw5 partbits 2024-09-20 21:27:34 +02:00
Jan
1fef66397f
chore: implement scale based unit vec3 packing 2024-09-20 21:26:47 +02:00
Jan
e814515b53
fix: failure to load xmodel does not abort loading process 2024-09-20 19:39:26 +02:00
Jan
d05c1730fa
feat: dump and load xmodels for IW5 via template 2024-09-20 16:44:07 +01:00
Jan
0eb321f8c8
chore: make sure components using source templating depend on RawTemplater 2024-09-20 16:44:07 +01:00
Jan
fc216a153f
chore: use RawTemplater to template XModel dumping code for t5 and t6 2024-09-20 16:44:07 +01:00
Jan
7227c84cde
chore: use RawTemplater to template XModel loading code for t5 and t6 2024-09-20 16:44:06 +01:00
Jan
a2735b4f23
chore: use generic xmodel loader and dumper code for t5 2024-09-20 16:44:06 +01:00
Jan
28ecee3a1d
chore: move t6 xmodel json to proper folder 2024-09-20 16:44:06 +01:00
Jan
e9c66a2e28
chore: move xmodel dumping and loading code into generic files 2024-09-20 16:44:06 +01:00
Jan
543a4f06e4
refactor: extract TangentData from JsonXModelLoader 2024-09-20 16:44:05 +01:00
Jan
b282e611fc
refactor: extract PartClassificationState from JsonXModelLoader 2024-09-20 16:44:02 +01:00
Jan
53cde27d7f
Merge pull request #264 from Jbleezy/main
Various soundbank fixes
2024-09-19 08:14:53 +02:00
Jan
ae73f81a80
chore: address code review comments 2024-09-18 23:01:13 +02:00
Jbleezy
e0218dce2e Disable clang-format on SOUND_GROUPS array elements 2024-09-16 10:07:04 -07:00
Jbleezy
8d41e28a52 Fix more whitespace 2024-09-15 21:35:53 -07:00
Jbleezy
4ff138c67b Fix whitespace 2024-09-15 21:27:13 -07:00
Jbleezy
fe766a734f Use decltype of variable being set 2024-09-15 21:21:05 -07:00
Jbleezy
d21c6aef4d Find a file for the sound path including extension 2024-09-15 21:20:55 -07:00
Jbleezy
fed488d391 Dump sound extension 2024-09-15 21:20:17 -07:00
Jbleezy
3dcd89540b Fix order of some SoundConstantsT6 enums 2024-09-15 21:19:41 -07:00
Jbleezy
1caa54f16e Change SndAlias struct members type from char to uint8_t 2024-09-15 21:19:22 -07:00
Jan
568e6572fb
Merge pull request #261 from diamante0018/main
feat: track time spent linking zone
2024-09-15 12:13:04 +02:00
0021c85536
fix: address review 2024-09-15 11:36:05 +02:00
Jan
c7b31caadb
Merge pull request #263 from Laupetin/dependabot/submodules/thirdparty/eigen-84282c4
chore(deps): bump thirdparty/eigen from `072ec9d` to `84282c4`
2024-09-14 15:33:13 +02:00
dependabot[bot]
34ee738f26
chore(deps): bump thirdparty/eigen from 072ec9d to 84282c4
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `072ec9d` to `84282c4`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](072ec9d954...84282c42fc)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-13 22:10:15 +00:00
a0551d72da
feat: track time spent linking zone 2024-09-12 15:52:42 +02:00
Jan
576caed030
Merge pull request #260 from diamante0018/main
feat(Linker): add verbose loggin when writing of zones begins
2024-09-12 08:44:01 +02:00
d44b91485d
feat(Linker): add verbose loggin when writing of zones begins 2024-09-11 17:13:42 +02:00
Jan
f9a653b7f4
Merge pull request #259 from Laupetin/feature/check-xmodel-conversion-limits
feat: check for xmodel limits when converting
2024-09-08 23:22:02 +02:00
Jan
c91697caea
feat: check for xmodel limits when converting 2024-09-08 22:01:07 +01:00
Jan
6602b35cd6
Merge pull request #258 from Laupetin/feature/better-linker-search-paths
feat: better linker search paths
2024-09-08 22:37:59 +02:00
Jan
74a54ec981
feat: add command line args to add asset and source search paths without overriding all 2024-09-08 21:07:49 +01:00
Jan
8ea9380526
chore: fix command line description for linker gdt and source args 2024-09-08 21:43:45 +02:00
Jan
147de6e240
feat: add zone_raw/?project? as default source directory 2024-09-08 21:42:49 +02:00
Jan
87fb3e3b28
Merge pull request #257 from Laupetin/feature/t6-default-assets
chore: add asset loaders for all asset types of t6
2024-09-08 21:11:45 +02:00
Jan
931e128eb9
chore: add asset loaders for all asset types of t6 2024-09-08 17:59:09 +01:00
Jan
f8912418a5
Merge pull request #256 from Laupetin/feature/bin-search-paths
feat: load raw game folder relative to binary
2024-09-08 16:35:23 +02:00
Jan
c6ffdedb81
feat: load raw game folder relative to binary to be able to always locate it, even when in a different working directory 2024-09-08 16:15:45 +02:00
Jan
2c7c5cdb47
Mark t6 xmodels as supported 2024-09-08 14:37:55 +01:00
Jan
997f45d567
Add examples repository to README 2024-09-08 14:37:16 +01:00
Jan
d1abb46fc1
Merge pull request #255 from Laupetin/feature/omit-default-armature
feat: omit default armature when dumping xmodels
2024-09-08 15:06:37 +02:00
Jan
becfdbf814
chore: omit skel node when dumping gltf without armature 2024-09-08 14:40:20 +02:00
Jan
9b64ba1623
chore: omit default armature when dumping xmodels 2024-09-08 13:28:48 +01:00
Jan
abae48ead2
Merge pull request #254 from Laupetin/fix/models-without-bones
fix: auto generate armature when imported gltf has none
2024-09-08 14:15:44 +02:00
Jan
63556848c1
fix: auto generate armature when imported gltf has none 2024-09-08 13:55:50 +02:00
Jan
bc81245322
Merge pull request #253 from Laupetin/fix/gltf-model-import-2
fix: broken normals when packing unitvec3 for t6
2024-09-07 09:10:19 +02:00
Jan
7b020d3c9a
Merge pull request #252 from Laupetin/dependabot/submodules/thirdparty/zlib-d476828
chore(deps): bump thirdparty/zlib from `545f194` to `d476828`
2024-09-07 08:52:28 +02:00
Jan
96b4fdbd3f
Merge pull request #251 from Laupetin/dependabot/submodules/thirdparty/eigen-072ec9d
chore(deps): bump thirdparty/eigen from `66927f7` to `072ec9d`
2024-09-07 08:52:18 +02:00
Jan
c2028a2d68
Merge pull request #250 from Laupetin/dependabot/submodules/thirdparty/json-b36f4c4
chore(deps): bump thirdparty/json from `960b763` to `b36f4c4`
2024-09-07 08:52:06 +02:00
Jan
c36b1f2f4d
Merge pull request #249 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-6865b9f
chore(deps): bump thirdparty/libtomcrypt from `12bf723` to `6865b9f`
2024-09-07 08:51:53 +02:00
Jan
fb3964c677
Merge pull request #248 from Laupetin/dependabot/submodules/thirdparty/catch2-bc63412
chore(deps): bump thirdparty/catch2 from `fa306fc` to `bc63412`
2024-09-07 08:51:39 +02:00
Jan
2c47212b52
fix: broken normals when packing unitvec3 for t6 2024-09-07 08:48:49 +02:00
dependabot[bot]
d97621d014
chore(deps): bump thirdparty/zlib from 545f194 to d476828
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `545f194` to `d476828`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](545f194963...d476828316)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 22:48:12 +00:00
dependabot[bot]
8c8b4b2c2b
chore(deps): bump thirdparty/eigen from 66927f7 to 072ec9d
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `66927f7` to `072ec9d`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](66927f7807...072ec9d954)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 22:48:11 +00:00
dependabot[bot]
ca21e2bbb7
chore(deps): bump thirdparty/json from 960b763 to b36f4c4
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `960b763` to `b36f4c4`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](960b763ecd...b36f4c477c)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 22:48:10 +00:00
dependabot[bot]
f9aba52f92
chore(deps): bump thirdparty/libtomcrypt from 12bf723 to 6865b9f
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `12bf723` to `6865b9f`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](12bf723b74...6865b9fc81)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 22:48:08 +00:00
dependabot[bot]
dab68bf201
chore(deps): bump thirdparty/catch2 from fa306fc to bc63412
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `fa306fc` to `bc63412`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](fa306fc85e...bc63412e2a)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 22:48:07 +00:00
Jan
f4aed31ca2
Merge pull request #247 from Laupetin/fix/gltf-model-import-1
feat: support gltf bone rotation as matrix notation
2024-09-06 21:59:33 +02:00
Jan
7eb1714e89
feat: support gltf bone rotation as matrix notation 2024-09-06 21:37:48 +02:00
Jan
149a24b544
Merge pull request #246 from Laupetin/fix/gltf-loading-buffer-view
fix: gltf buffer view incorrectly calculating stride
2024-09-06 17:10:10 +02:00
Jan
30ca98d86e
fix: gltf buffer view incorrectly calculating stride 2024-09-06 15:49:06 +01:00
Electro Games
e0b28075a6
Added support for unsigned int accessors (#245)
* Added Unsigned Int to CreateAccessors()

* Added UnsignedIntAccessor class

* Added UnsignedIntAccessor class function implementations

* Oops

* Update src/ObjLoading/XModel/Gltf/Internal/GltfAccessor.cpp

Co-authored-by: Jan <Laupetin@users.noreply.github.com>

* Fixed ReadElement() using incorrect elementSize

---------

Co-authored-by: Jan <Laupetin@users.noreply.github.com>
2024-09-06 16:46:21 +02:00
Jan
8bab112afe
Merge pull request #244 from Laupetin/feature/t6-xmodel-raw
feat: gltf xmodel loading from raw for t6
2024-09-05 22:19:47 +02:00
Jan
36ddb998a4
fix: linux build 2024-09-05 21:56:17 +02:00
Jan
46111ae106
chore: add note about only rigid models being supported right now 2024-09-05 21:19:45 +02:00
Jan
27d047198f
chore: fix not terminating when not being able to load lod 2024-09-05 21:19:44 +02:00
Jan
71819e46a4
chore: set vertex color to 1.0 when no value read from gltf 2024-09-05 21:19:44 +02:00
Jan
db5e53e60d
chore: calculate tangents for xmodel vertices 2024-09-05 21:19:44 +02:00
Jan
26f4640194
chore: properly read uv data from gltf 2024-09-05 21:19:44 +02:00
Jan
c261aef1ef
chore: fix xmodel root struct bone trans and quats 2024-09-05 21:19:43 +02:00
Jan
2687fbf9fd
chore: properly calculate partbits for loaded gltf models 2024-09-05 21:19:43 +02:00
Jan
1be630f71e
chore: set vertex base index for all surfaces 2024-09-05 21:19:43 +02:00
Jan
8d2f5541d3
chore: make gltf dumping and loading work for models without bone weights 2024-09-05 21:19:43 +02:00
Jan
2699de86b6
chore: use remapped vertex indices when building vertices in gltf loading 2024-09-05 21:19:42 +02:00
Jan
36bc3cf7a3
chore: fix invalid sign when loading gltf 2024-09-05 21:19:42 +02:00
Jan
0bd581ef75
chore: correct tri ordering when loading gltf 2024-09-05 21:19:42 +02:00
Jan
14784fb1c4
chore: correct bone ordering when loading gltf 2024-09-05 21:19:41 +02:00
Jan
30d9ffd8c9
chore: add byteoffset to gltf loading accessors 2024-09-05 21:19:41 +02:00
Jan
f4092972e8
chore: implement vertex weights 2024-09-05 21:19:41 +02:00
Jan
f35a2f33ff
fix: linux build 2024-09-05 21:19:41 +02:00
Jan
01c284fb37
chore: update t6 xmodel part classifications 2024-09-05 21:19:40 +02:00
Jan
dfd8d1dbe9
chore: load materials for xmodel 2024-09-05 21:19:40 +02:00
Jan
0d343dd3fa
chore: dump and load lod dist from xmodel json 2024-09-05 21:19:40 +02:00
Jan
4db13de471
chore: properly calculate model and bone bounds 2024-09-05 21:19:40 +02:00
Jan
75e22b1750
fix: parentIndex is relative to current bone index 2024-09-05 21:19:39 +02:00
Jan
f653530714
chore: improve api for vector packing for models 2024-09-05 21:19:39 +02:00
Jan
1f5050befa
feat: first draft of loading gltf models for t6 2024-09-05 21:19:39 +02:00
Jan
f8b5734f86
chore: make XModelCommon use offset instead of pointer 2024-09-05 21:19:38 +02:00
Jan
d45f0ffab7
chore: adjust XModelCommon numeric types 2024-09-05 21:19:38 +02:00
Jan
66c2adacaa
Merge pull request #241 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-12bf723
chore(deps): bump thirdparty/libtomcrypt from `427ce33` to `12bf723`
2024-08-31 12:14:23 +02:00
Jan
97da1912d5
Merge pull request #240 from Laupetin/dependabot/submodules/thirdparty/eigen-66927f7
chore(deps): bump thirdparty/eigen from `3b5a1b4` to `66927f7`
2024-08-31 12:14:05 +02:00
dependabot[bot]
33b64168cb
chore(deps): bump thirdparty/libtomcrypt from 427ce33 to 12bf723
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `427ce33` to `12bf723`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](427ce3315e...12bf723b74)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 22:27:28 +00:00
dependabot[bot]
56cec10ddc
chore(deps): bump thirdparty/eigen from 3b5a1b4 to 66927f7
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `3b5a1b4` to `66927f7`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](3b5a1b4157...66927f7807)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 22:27:27 +00:00
Jan
98b88ddab9
Merge pull request #237 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-427ce33
chore(deps): bump thirdparty/libtomcrypt from `2302a3a` to `427ce33`
2024-08-24 08:49:23 +02:00
Jan
5aa5ecc23b
Merge pull request #238 from Laupetin/dependabot/submodules/thirdparty/eigen-3b5a1b4
chore(deps): bump thirdparty/eigen from `92e373e` to `3b5a1b4`
2024-08-24 00:40:25 +02:00
dependabot[bot]
de8b564432
chore(deps): bump thirdparty/eigen from 92e373e to 3b5a1b4
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `92e373e` to `3b5a1b4`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](92e373e6f5...3b5a1b4157)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 22:05:58 +00:00
dependabot[bot]
33f490a68f
chore(deps): bump thirdparty/libtomcrypt from 2302a3a to 427ce33
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `2302a3a` to `427ce33`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](2302a3a897...427ce3315e)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 22:05:55 +00:00
Jan
805e1a267e
Merge pull request #236 from Laupetin/fix/current-dir-prefix
fix: referencing files in cwd without dot slash
2024-08-21 11:04:41 +02:00
Jan
42a3e207e5
fix: referencing files in cwd without dot slash 2024-08-21 10:45:05 +02:00
Jan
31d93d39a4
Merge pull request #234 from Laupetin/dependabot/submodules/thirdparty/eigen-92e373e
chore(deps): bump thirdparty/eigen from `99ffad1` to `92e373e`
2024-08-17 07:44:59 +02:00
Jan
016ac935bb
Merge pull request #233 from Laupetin/dependabot/submodules/thirdparty/catch2-fa306fc
chore(deps): bump thirdparty/catch2 from `8898cc6` to `fa306fc`
2024-08-17 07:44:45 +02:00
dependabot[bot]
59f4caacd3
chore(deps): bump thirdparty/eigen from 99ffad1 to 92e373e
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `99ffad1` to `92e373e`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](99ffad1971...92e373e6f5)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-16 22:53:16 +00:00
dependabot[bot]
9e2849cc36
chore(deps): bump thirdparty/catch2 from 8898cc6 to fa306fc
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `8898cc6` to `fa306fc`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](8898cc6160...fa306fc85e)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-16 22:53:14 +00:00
Jan
29c6a62812
Merge pull request #232 from Laupetin/chore/rename-zone-code-headers
chore: rename zonecode headers to avoid duplicate paths
2024-08-14 08:57:28 +02:00
Jan
9c894fcff7
chore: rename zonecode headers to avoid duplicate paths 2024-08-14 08:21:02 +02:00
Jan
8f804fcf50
Merge pull request #231 from Laupetin/fix/linux-gcc-14-build
fix: linux gcc 14 build
2024-08-13 00:21:04 +02:00
Jan
af01bac183
fix: linux gcc 14 build 2024-08-13 00:01:00 +02:00
Jan
fc5853eaa4
fix: make all game names be supported in lowercase instead of only t6 2024-08-12 10:20:04 +02:00
Jan
254918acca
Merge pull request #230 from Laupetin/fix/game-name-case-insensitive
fix: make game name case insensitive
2024-08-12 10:06:37 +02:00
Jan
e4beee3d7e
chore: use std format in linker 2024-08-12 09:47:15 +02:00
Jan
0e1f0eef7f
fix: make specified game name case insensitive 2024-08-12 09:29:52 +02:00
Jan
1117339542
fix: log when a specified game is unsupported 2024-08-12 09:25:37 +02:00
Jan
dd2c97f7a0
chore: adjust log levels in linker 2024-08-12 09:18:22 +02:00
Jan
b3d59a3f28
chore: do not log failing to open sound curve file in iw4 2024-08-12 08:53:19 +02:00
Jan
dcd7396087
Merge pull request #229 from Laupetin/fix/normalize-asset-names-for-global-lookup
fix: not properly normalizing asset names when looking up from global asset pools
2024-08-10 16:23:51 +02:00
Jan
62f774f264
fix: not properly normalizing asset names when looking up from GlobalAssetPools 2024-08-10 16:04:39 +02:00
Jan
c0e1a6a6b5
Merge pull request #228 from Laupetin/dependabot/submodules/thirdparty/catch2-8898cc6
chore(deps): bump thirdparty/catch2 from `33e24b1` to `8898cc6`
2024-08-10 09:51:28 +02:00
Jan
e5cb0300f6
Merge pull request #227 from Laupetin/dependabot/submodules/thirdparty/eigen-99ffad1
chore(deps): bump thirdparty/eigen from `ec18dd0` to `99ffad1`
2024-08-10 09:51:15 +02:00
dependabot[bot]
3d6a693917
chore(deps): bump thirdparty/catch2 from 33e24b1 to 8898cc6
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `33e24b1` to `8898cc6`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](33e24b14fc...8898cc6160)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-09 22:35:15 +00:00
dependabot[bot]
84bd1e2f98
chore(deps): bump thirdparty/eigen from ec18dd0 to 99ffad1
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `ec18dd0` to `99ffad1`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](ec18dd09c8...99ffad1971)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-09 22:35:12 +00:00
Jan
e2464410b2
Merge pull request #226 from Laupetin/fix/t6-material-json-errors
fix: not properly handling errors when loading json
2024-08-08 19:43:25 +02:00
Jan
4d0096b634
chore: include better diagnostics in json error messages 2024-08-08 19:22:06 +02:00
Jan
ae6984dff9
fix: null values not resulting in parsed optional nullopt for json 2024-08-08 19:21:09 +02:00
Jan
219590898f
chore: log exception when parsing xmodel json fails 2024-08-08 18:50:53 +02:00
Jan
0707fa5873
chore: log exception when parsing weapon camo json fails 2024-08-08 18:50:35 +02:00
Jan
774da9a584
chore: log exception when parsing weapon attachment json fails 2024-08-08 18:50:11 +02:00
Jan
939f5b310f
chore: log exception when parsing leaderboard json fails 2024-08-08 18:49:25 +02:00
Jan
f452270f8a
chore: log exception when parsing material json fails 2024-08-08 18:48:51 +02:00
Jan
bec082fc0c
Merge pull request #225 from Laupetin/dependabot/submodules/thirdparty/zlib-545f194
chore(deps): bump thirdparty/zlib from `ceadaf2` to `545f194`
2024-08-04 18:35:34 +02:00
Jan
1dc8cc44b1
Merge pull request #224 from Laupetin/dependabot/submodules/thirdparty/catch2-33e24b1
chore(deps): bump thirdparty/catch2 from `85b7f3d` to `33e24b1`
2024-08-04 18:35:24 +02:00
Jan
9d6d76205d
Merge pull request #223 from Laupetin/dependabot/submodules/thirdparty/eigen-ec18dd0
chore(deps): bump thirdparty/eigen from `c29c800` to `ec18dd0`
2024-08-04 18:35:13 +02:00
dependabot[bot]
566221d898
chore(deps): bump thirdparty/zlib from ceadaf2 to 545f194
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `ceadaf2` to `545f194`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](ceadaf28df...545f194963)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-02 22:59:39 +00:00
dependabot[bot]
d62fae7de5
chore(deps): bump thirdparty/catch2 from 85b7f3d to 33e24b1
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `85b7f3d` to `33e24b1`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](85b7f3d6ab...33e24b14fc)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-02 22:59:38 +00:00
dependabot[bot]
0cb2afa962
chore(deps): bump thirdparty/eigen from c29c800 to ec18dd0
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `c29c800` to `ec18dd0`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](c29c800126...ec18dd09c8)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-02 22:59:36 +00:00
Jan
838ab225df
Merge pull request #222 from Laupetin/dependabot/submodules/thirdparty/catch2-85b7f3d
chore(deps): bump thirdparty/catch2 from `37c8b2d` to `85b7f3d`
2024-07-27 00:24:22 +02:00
dependabot[bot]
7edbffb671
chore(deps): bump thirdparty/catch2 from 37c8b2d to 85b7f3d
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `37c8b2d` to `85b7f3d`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](37c8b2d2b3...85b7f3d6ab)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-26 22:06:21 +00:00
Jan
652d4719af
Merge pull request #221 from Laupetin/dependabot/submodules/thirdparty/catch2-37c8b2d
chore(deps): bump thirdparty/catch2 from `4e8d92b` to `37c8b2d`
2024-07-20 10:28:30 +02:00
dependabot[bot]
7e9438be5e
chore(deps): bump thirdparty/catch2 from 4e8d92b to 37c8b2d
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `4e8d92b` to `37c8b2d`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](4e8d92bf02...37c8b2d2b3)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-19 22:21:40 +00:00
Jan
075cb5a435
Merge pull request #220 from Laupetin/dependabot/submodules/thirdparty/zlib-ceadaf2
chore(deps): bump thirdparty/zlib from `884e0c0` to `ceadaf2`
2024-07-13 07:33:07 +02:00
Jan
4ec9f4d7bc
Merge pull request #219 from Laupetin/dependabot/submodules/thirdparty/eigen-c29c800
chore(deps): bump thirdparty/eigen from `33d0937` to `c29c800`
2024-07-13 07:32:35 +02:00
Jan
69cbd69cca
Merge pull request #218 from Laupetin/dependabot/submodules/thirdparty/json-960b763
chore(deps): bump thirdparty/json from `8c391e0` to `960b763`
2024-07-13 07:32:19 +02:00
dependabot[bot]
919fb57502
chore(deps): bump thirdparty/zlib from 884e0c0 to ceadaf2
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `884e0c0` to `ceadaf2`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](884e0c0809...ceadaf28df)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 22:36:05 +00:00
dependabot[bot]
eecd672678
chore(deps): bump thirdparty/eigen from 33d0937 to c29c800
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `33d0937` to `c29c800`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](33d0937c6b...c29c800126)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 22:36:03 +00:00
dependabot[bot]
676eeae4f8
chore(deps): bump thirdparty/json from 8c391e0 to 960b763
Bumps [thirdparty/json](https://github.com/nlohmann/json) from `8c391e0` to `960b763`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](8c391e04fe...960b763ecd)

---
updated-dependencies:
- dependency-name: thirdparty/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 22:36:01 +00:00
Jan
45dbb2ce9b
Merge pull request #216 from Laupetin/dependabot/submodules/thirdparty/zlib-884e0c0
chore(deps): bump thirdparty/zlib from `0f51fb4` to `884e0c0`
2024-07-06 08:19:49 +02:00
Jan
11c865edb5
Merge pull request #215 from Laupetin/dependabot/submodules/thirdparty/eigen-33d0937
chore(deps): bump thirdparty/eigen from `d791d48` to `33d0937`
2024-07-06 08:19:34 +02:00
dependabot[bot]
eea7ae2232
chore(deps): bump thirdparty/zlib from 0f51fb4 to 884e0c0
Bumps [thirdparty/zlib](https://github.com/madler/zlib) from `0f51fb4` to `884e0c0`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](0f51fb4933...884e0c0809)

---
updated-dependencies:
- dependency-name: thirdparty/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-05 22:07:09 +00:00
dependabot[bot]
45f9040687
chore(deps): bump thirdparty/eigen from d791d48 to 33d0937
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `d791d48` to `33d0937`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](d791d48859...33d0937c6b)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-05 22:07:07 +00:00
Jan
2f80169f2f
Merge pull request #213 from Laupetin/dependabot/submodules/thirdparty/libtomcrypt-2302a3a
chore(deps): bump thirdparty/libtomcrypt from `f7e6519` to `2302a3a`
2024-06-29 08:33:23 +02:00
dependabot[bot]
a717394440
chore(deps): bump thirdparty/libtomcrypt from f7e6519 to 2302a3a
Bumps [thirdparty/libtomcrypt](https://github.com/libtom/libtomcrypt) from `f7e6519` to `2302a3a`.
- [Release notes](https://github.com/libtom/libtomcrypt/releases)
- [Commits](f7e6519fae...2302a3a897)

---
updated-dependencies:
- dependency-name: thirdparty/libtomcrypt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-28 22:48:14 +00:00
Jan
102422f5bf
Merge pull request #212 from Laupetin/dependabot/submodules/thirdparty/eigen-d791d48
chore(deps): bump thirdparty/eigen from `02bcf9b` to `d791d48`
2024-06-22 09:08:00 +02:00
dependabot[bot]
f47138818c
chore(deps): bump thirdparty/eigen from 02bcf9b to d791d48
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `02bcf9b` to `d791d48`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](02bcf9b591...d791d48859)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 22:48:06 +00:00
Jan
4a8ee0ab3c
Merge pull request #211 from Laupetin/dependabot/submodules/thirdparty/eigen-02bcf9b
chore(deps): bump thirdparty/eigen from `392b95b` to `02bcf9b`
2024-06-15 10:02:44 +02:00
dependabot[bot]
f29c9b9e79
chore(deps): bump thirdparty/eigen from 392b95b to 02bcf9b
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `392b95b` to `02bcf9b`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](392b95bdf1...02bcf9b591)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-14 22:40:42 +00:00
Jan
047cb4807e
Merge pull request #210 from Laupetin/dependabot/submodules/thirdparty/eigen-392b95b
chore(deps): bump thirdparty/eigen from `e605227` to `392b95b`
2024-06-08 07:21:23 +02:00
dependabot[bot]
8e79ab04ae
chore(deps): bump thirdparty/eigen from e605227 to 392b95b
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `e605227` to `392b95b`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](e605227030...392b95bdf1)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-07 22:29:53 +00:00
Jan
cd1e73d24d
Merge pull request #209 from Laupetin/fix/asset-loading-capitalization
fix: do not normalize asset names when loading assets
2024-06-01 15:19:36 +02:00
Jan
0ae7426fbe
fix: do not normalize asset names when loading assets since desired effect is already covered by normalized asset finding from asset pools 2024-06-01 15:01:19 +02:00
Jan
b1b8184e95
docs: mark leaderboard assets as being loadable 2024-06-01 14:45:53 +02:00
Jan
acf0d914b8
Merge pull request #207 from diamante0018/t6/leaderboard-load
feat(t6): load leaderboard definitions from raw
2024-06-01 14:43:44 +02:00
Jan
e68877464d
fix: iw5 leaderboard track type reading 2024-06-01 14:23:33 +02:00
Jan
7c5795f5bc
chore: use std::optional value_or for t6 leaderboard reading 2024-06-01 14:23:23 +02:00
Jan
feefc4a6a1
Merge pull request #206 from diamante0018/iw5/leaderboard-load
feat(iw5): load leaderboard definitions from raw
2024-06-01 14:15:36 +02:00
Jan
9367aa889b
chore: load t6 leaderboard asset loader 2024-06-01 14:14:56 +02:00
Jan
667fb49ab2
fix: iw5 leaderboard track type reading 2024-06-01 13:55:38 +02:00
Jan
28465d7c64
fix: add missing column id for iw5 leaderboards reading 2024-06-01 13:55:25 +02:00
Jan
e046089cbb
chore: use std::optional value_or for iw5 leaderboard reading 2024-06-01 13:55:00 +02:00
Jan
694548d6cb
Merge pull request #205 from diamante0018/iw4/load-leaderboarddef
feat(iw4): load leaderboard definitions from raw
2024-06-01 13:44:44 +02:00
Jan
02e39a0361
fix: not setting column ids for iw4 leaderboards 2024-06-01 13:25:04 +02:00
Jan
b76bdabc75
chore: use std::optional value_or 2024-06-01 13:12:42 +02:00
Jan
a15b57ed3a
Merge pull request #208 from Laupetin/dependabot/submodules/thirdparty/eigen-e605227
chore(deps): bump thirdparty/eigen from `5a9f66f` to `e605227`
2024-06-01 12:39:22 +02:00
dependabot[bot]
829403319f
chore(deps): bump thirdparty/eigen from 5a9f66f to e605227
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `5a9f66f` to `e605227`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](5a9f66fb35...e605227030)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-31 22:06:28 +00:00
709168165f
t6: fix default value for dwcolumn 2024-05-26 12:14:34 +02:00
d64d38e582
feat(t6): load leaderboard definitions from raw 2024-05-26 12:11:52 +02:00
1d9310fb9c
feat(iw5): load leaderboard definitions from raw 2024-05-26 11:53:07 +02:00
601494e515
fix compilation 2024-05-26 11:52:31 +02:00
960a606a4b
maint: use std::format here as well 2024-05-26 11:40:26 +02:00
2d28f423ef
feat(iw4): load leaderboard definitions from raw 2024-05-25 17:00:18 +02:00
Jan
d8adda81ec
Merge pull request #204 from Laupetin/refactor/assets-for-loaders
refactor: use templated asset structs for asset loaders
2024-05-25 11:43:32 +02:00
Jan
5737f232e2
chore: adjust name of leaderboard asset 2024-05-25 11:23:13 +02:00
Jan
a166878f7d
refactor: use template based asset structs for AssetLoaders 2024-05-25 11:17:04 +02:00
Jan
ef69bbb239
Merge pull request #203 from Laupetin/dependabot/submodules/thirdparty/eigen-5a9f66f
chore(deps): bump thirdparty/eigen from `b9b1c86` to `5a9f66f`
2024-05-25 03:06:24 +02:00
dependabot[bot]
3cce45eb63
chore(deps): bump thirdparty/eigen from b9b1c86 to 5a9f66f
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `b9b1c86` to `5a9f66f`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](b9b1c8661e...5a9f66fb35)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-24 22:52:52 +00:00
Jan
697a0c5200
Merge pull request #202 from Laupetin/feature/iw5-empty-assets
feat: iw5 asset forward references
2024-05-24 19:40:23 +02:00
Jan
15440e8d66
feat: add loader for creating empty assets for all remaining iw5 asset types 2024-05-24 19:18:19 +02:00
Jan
68022eee05
fix: IW4 xmodel surfs loader using wrong struct 2024-05-24 19:18:13 +02:00
Jan
47f5f2aa45
Merge pull request #198 from Laupetin/feature/accuracy-tables
feat: dump and load weapon accuracy tables
2024-05-20 13:58:53 +02:00
Jan
e68a7303b6
feat: load accuracy graphs using generic 2d graph loader 2024-05-20 13:41:01 +02:00
Jan
6f6a70c212
chore: restructure sound curve loader to load generic 2D graphs instead 2024-05-20 13:21:58 +02:00
Jan
fcb73347c2
feat: dump iw4 accuracy graphs 2024-05-20 10:42:02 +02:00
Jan
879acd35bb
feat: dump t6 accuracy graphs 2024-05-20 10:42:02 +02:00
Jan
36a2e48e5b
feat: dump iw5 accuracy graphs 2024-05-20 10:42:02 +02:00
Jan
5c0d1e4d99
chore: add writer for accuracy graphs 2024-05-20 10:42:01 +02:00
Jan
3201cefd5b
chore: rename accuracy table properties in weapon structs 2024-05-20 10:41:57 +02:00
Jan
183ebe473b
Merge pull request #201 from Laupetin/docs/model-demonstration-for-readme
docs: add image demonstrating model export to readme
2024-05-20 10:40:02 +02:00
Jan
4486de0175
docs: add image demonstrating model export to readme 2024-05-20 10:21:56 +02:00
Jan
0ba99d9058
Merge pull request #200 from Laupetin/fix/release-build-warnings
fix: warnings preventing release build for MSVC
2024-05-19 14:57:13 +02:00
Jan
7897c11e62
fix: warnings preventing release build for MSVC 2024-05-19 14:38:59 +02:00
Jan
d36ec97295
Merge pull request #199 from Laupetin/fix/iw5-leaderboard-col-ids
fix: iw4/iw5 leaderboard column ids
2024-05-19 13:49:53 +02:00
Jan
97ceced26b
Merge pull request #191 from diamante0018/t6/dump-leaderboard
feature: dump leaderboard definitions on T6
2024-05-19 13:33:15 +02:00
Jan
e8ab3ba92d
chore: rename iw4/iw5 column id property to colId 2024-05-19 13:31:53 +02:00
Jan
bfef9e2531
fix: not properly checking for xpColId and prestigeColId on leaderboards for iw4/iw5 2024-05-19 13:31:37 +02:00
Jan
374fc7fe5d
chore: rename t6 leaderboardDef folder to leaderboard 2024-05-19 13:16:07 +02:00
Jan
2a1ec18f6a
chore: only dump leaderboard values for t6 when they are relevant for the column 2024-05-19 13:07:04 +02:00
Jan
fb6a1b1e9d
Merge pull request #181 from diamante0018/iw5/dump-leaderboard
feature: dump leaderboard definitions on IW4/IW5
2024-05-19 12:27:02 +02:00
Jan
0c0103c998
chore: rename leaderboardDef folder to leaderboard 2024-05-19 12:09:26 +02:00
Jan
dc090c1371
chore: update count properties of leaderboard enums 2024-05-19 11:52:29 +02:00
Jan
489e4d033e
chore: only dump leaderboard values when they are relevant for the column 2024-05-19 11:46:21 +02:00
4fe852b162
feat: dump leaderboard definitions on T6 2024-05-19 09:30:19 +02:00
7ba5a616cd
feat: dump leaderboard definitions on IW4/IW5 2024-05-19 08:55:06 +02:00
Jan
4139253aac
Merge pull request #196 from Laupetin/dependabot/submodules/thirdparty/eigen-b9b1c86
chore(deps): bump thirdparty/eigen from `afb1728` to `b9b1c86`
2024-05-18 14:32:36 +02:00
Jan
aa50f891a8
Merge pull request #195 from Laupetin/fix/iw5-reference-asset-menu-crash
fix: crash on trying to dump referenced iw5 menu
2024-05-18 14:17:54 +02:00
dependabot[bot]
cae003bd57
chore(deps): bump thirdparty/eigen from afb1728 to b9b1c86
Bumps [thirdparty/eigen](https://gitlab.com/libeigen/eigen) from `afb1728` to `b9b1c86`.
- [Release notes](https://gitlab.com/libeigen/eigen/tags)
- [Commits](afb17288cb...b9b1c8661e)

---
updated-dependencies:
- dependency-name: thirdparty/eigen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-18 12:15:02 +00:00
Jan
a722b868fa
fix: crash on trying to dump referenced iw5 menu 2024-05-18 14:00:18 +02:00
Jan
bd98011956
Merge pull request #197 from Laupetin/fix/github-actions
fix: github actions
2024-05-18 13:58:58 +02:00
Jan
7497b55054
fix: github actions 2024-05-18 12:37:44 +01:00
Jan
444bdc6fa3
docs: add gltf to xmodel supported assets note 2024-05-12 23:01:27 +02:00
Jan
f2628fcda4
Merge pull request #193 from Laupetin/feature/improve-info-string-logging
feat: improve info string logging
2024-05-12 22:52:10 +02:00
Jan
3efd9534fb
feat: fail to parse info strings on empty keys 2024-05-12 22:33:39 +02:00
Jan
5d913acfef
feat: improve error messages when parsing an info string file fails 2024-05-12 22:29:40 +02:00
Jan
30394e6a4c
Merge pull request #192 from Laupetin/fix/gltf-bone-rotations
fix: gltf bone rotations
2024-05-12 21:35:26 +02:00
Jan
0a960c330c
fix: iw3 vertex weights for more than one bone 2024-05-12 21:17:03 +02:00
Jan
fa08017250
fix: iw4 vertex weights for more than one bone 2024-05-12 21:12:34 +02:00
Jan
a33bc5414c
fix: iw5 vertex weights for more than one bone 2024-05-12 21:01:57 +02:00
Jan
ae95accaa3
fix: t5 vertex weights for more than one bone 2024-05-12 20:47:38 +02:00
Jan
c89a6631b0
chore: replace custom vector, quaternion, matrix implementation with eigen library 2024-05-12 19:32:06 +02:00
Jan
9979275f8c
fix: gltf mesh wrong bone and invertBindMatrix transformations 2024-05-12 16:42:44 +02:00
Jan
17dee65337
fix: t6 vertex weights for more than one bone 2024-05-12 16:37:26 +02:00
Jan
e0dd0ac9dc
chore: add eigen library for vector math 2024-05-12 16:35:46 +02:00
Jan
b29089a61f
Merge pull request #188 from Laupetin/feature/case-insensitive-assets
feat: make asset lookup work case insensitively entirely
2024-05-11 13:22:14 +02:00
Jan
a9488b8152
chore: normalize asset names before adding to asset pools 2024-05-11 12:57:17 +02:00
Jan
b59bd01280
Merge pull request #187 from Laupetin/dependabot/submodules/thirdparty/catch2-4e8d92b
chore(deps): bump thirdparty/catch2 from `fa5a53d` to `4e8d92b`
2024-05-11 09:37:37 +02:00
Jan
35474c217e
Merge pull request #182 from Laupetin/feature/gltf-xmodel-dumping
feat: dump xmodels as gltf/glb
2024-05-11 02:08:55 +02:00
Jan
499b752272
chore: add names to exported gltf models 2024-05-11 01:51:28 +02:00
Jan
5c06b6e5e4
chore: dump gltf skin inverseBindMatrices 2024-05-11 01:23:52 +02:00
Jan
6a1962b65a
chore: export separate root node for gltf 2024-05-11 01:23:52 +02:00
Jan
1c105db5bc
fix: quaternion multiplication and division
i hope its correct at least, quaternions are not my strength
2024-05-11 01:23:51 +02:00
dependabot[bot]
3b0476dee8
chore(deps): bump thirdparty/catch2 from fa5a53d to 4e8d92b
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `fa5a53d` to `4e8d92b`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](fa5a53df17...4e8d92bf02)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-10 23:00:25 +00:00
Jan
c74be5e8ae
chore: dump gltf vertex weights 2024-05-11 00:44:03 +02:00
Jan
9ab78d5384
fix: correct asset references in xmodel material dumping 2024-05-09 22:12:39 +02:00
Jan
a0138c8abc
chore: set gltf material default metallicness to 0 2024-05-09 22:12:39 +02:00
Jan
1a35152098
chore: dump more information about gltf materials 2024-05-09 22:12:38 +02:00
Jan
ebccd67676
chore: fill dumped gltf min max fields for position accessor 2024-05-09 22:12:38 +02:00
Jan
c587dae05f
fix: build on linux 2024-05-09 22:12:38 +02:00
Jan
07fa12b7f6
chore: implement mesh gltf export 2024-05-09 22:12:38 +02:00
Jan
a39e993cc6
chore: use XModelCommon for dumping obj to reduce code duplication 2024-05-09 22:12:37 +02:00
Jan
45684ac828
fix: accidentally dumping NORMAL twice for xmodel export 2024-05-09 22:12:37 +02:00
Jan
2497a9f228
fix: use after free when dumping xmodel vertex weights 2024-05-09 22:12:37 +02:00
Jan
826e59d627
chore: update xmodel common to be a struct with substructs 2024-05-09 22:12:37 +02:00
Jan
0a65c93aa5
chore: move materialIndex to XModelObject 2024-05-09 22:12:36 +02:00
Jan
1bc1c12244
chore: fix linux build 2024-05-09 22:12:36 +02:00
Jan
0d96213f21
chore: export gltf basic attributes 2024-05-09 22:12:36 +02:00
Jan
8a0c93d3d8
feat: add gltf and glb as model dumping formats 2024-05-09 22:12:36 +02:00
Jan
f2438bea12
chore: write gltf header with new writers and outputs 2024-05-09 22:12:35 +02:00
Jan
c27f4ed544
chore: add output implementations for gltf and glb 2024-05-09 22:12:35 +02:00
Jan
7a0930a208
chore: add json types for gltf 2024-05-09 22:12:35 +02:00
Jan
d4ef9fa3d9
chore: move xmodel packages 2024-05-09 22:12:35 +02:00
Jan
abc3003b5b
chore: implement base loading and writing of xmodel json 2024-05-09 22:12:34 +02:00
Jan
237dc83cfc
chore: update xmodel structs 2024-05-09 22:12:30 +02:00
Jan
c2be18e3d6
Merge pull request #186 from Laupetin/feature/weapon-loading-error-logging
feat: log invalid enum values for infostring loaders
2024-05-09 20:55:54 +02:00
Jan
28610ae7a9
feat: log invalid enum values for infostring loaders 2024-05-09 20:38:23 +02:00
Jan
176b70f416
Merge pull request #183 from Laupetin/dependabot/submodules/thirdparty/catch2-fa5a53d
chore(deps): bump thirdparty/catch2 from `efb3968` to `fa5a53d`
2024-05-04 09:19:23 +02:00
dependabot[bot]
c93044665e
chore(deps): bump thirdparty/catch2 from efb3968 to fa5a53d
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `efb3968` to `fa5a53d`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](efb39689d9...fa5a53df17)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-03 22:48:39 +00:00
Jan
338c81fa6f
Merge pull request #178 from Laupetin/dependabot/submodules/thirdparty/catch2-efb3968
chore(deps): bump thirdparty/catch2 from `f232072` to `efb3968`
2024-04-27 01:54:28 +02:00
dependabot[bot]
3bcad8cf81
chore(deps): bump thirdparty/catch2 from f232072 to efb3968
Bumps [thirdparty/catch2](https://github.com/catchorg/Catch2) from `f232072` to `efb3968`.
- [Release notes](https://github.com/catchorg/Catch2/releases)
- [Commits](f2320724a7...efb39689d9)

---
updated-dependencies:
- dependency-name: thirdparty/catch2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-26 22:48:13 +00:00
Jan
f241caa274
Merge pull request #176 from Laupetin/refactor/asset-struct-based-loading
refactor: use template based asset structs for loading manager api
2024-04-23 01:06:37 +02:00
Jan
ae43a994b9
chore: update usages of AddAsset for template asset struct api 2024-04-23 00:49:05 +02:00
Jan
931fe695e1
refactor: use template asset structs for AddAsset api 2024-04-23 00:06:28 +02:00
Jan
d0c7311dce
fix: iw4 and iw5 structured data def asset using wrong struct 2024-04-23 00:05:56 +02:00
Jan
eb0cec1d81
refactor: make LoadDependency and LoadIndirectAssetReference functions work with Asset template types 2024-04-22 23:36:21 +02:00
Jan
0b61fc6e81
chore: add asset structs for all games containing enum entry and type 2024-04-22 23:14:29 +02:00
Jan
3e2315aca5
Merge pull request #175 from Laupetin/refactor/memory-manager
refactor: update memory manager api
2024-04-22 21:41:06 +02:00
Jan
a3acba8bc0
chore: update all usages of memory manager allocation 2024-04-22 21:21:48 +02:00
Jan
0845cccd12
refactor: change memory manager API to use a type template 2024-04-22 21:21:47 +02:00
1174 changed files with 40862 additions and 27928 deletions

View File

@ -8,40 +8,30 @@ on:
branches:
- "main"
env:
PREMAKE_VERSION: "5.0.0-beta2"
jobs:
build-test-linux:
env:
PREMAKE_CONFIG: gmake2
runs-on: ubuntu-latest
container: ubuntu:24.04
steps:
- name: Install g++ and multilib
run: |
apt-get update
apt-get install -y wget tar git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
update-alternatives --set gcc /usr/bin/gcc-13
update-alternatives --set g++ /usr/bin/g++-13
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install g++ and multilib
run: |
sudo apt-get update
sudo apt-get install gcc-13 g++-13 gcc-13-multilib g++-13-multilib
- name: Set gcc/g++ to version 13
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
sudo update-alternatives --set gcc /usr/bin/gcc-13
sudo update-alternatives --set g++ /usr/bin/g++-13
- name: Setup premake
uses: abel0b/setup-premake@v2.4
with:
version: ${{ env.PREMAKE_VERSION }}
- name: Premake generate
working-directory: ${{ github.workspace }}
run: premake5 ${{ env.PREMAKE_CONFIG }}
env:
PREMAKE_NO_PROMPT: 1
run: ./generate.sh
- name: Build
working-directory: ${{ github.workspace }}
@ -51,14 +41,13 @@ jobs:
working-directory: ${{ github.workspace }}/build/lib/Release_x86/tests
run: |
./ObjCommonTests
./ObjCompilingTests
./ObjLoadingTests
./ParserTests
./ZoneCodeGeneratorLibTests
./ZoneCommonTests
build-test-windows:
env:
PREMAKE_CONFIG: vs2022
runs-on: windows-latest
steps:
- name: Checkout repository
@ -69,14 +58,11 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2.0.0
- name: Setup premake
uses: abel0b/setup-premake@v2.4
with:
version: ${{ env.PREMAKE_VERSION }}
- name: Premake generate
working-directory: ${{ github.workspace }}
run: premake5 ${{ env.PREMAKE_CONFIG }}
env:
PREMAKE_NO_PROMPT: 1
run: ./generate.bat
- name: Build
working-directory: ${{ github.workspace }}
@ -88,6 +74,8 @@ jobs:
$combinedExitCode = 0
./ObjCommonTests
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
./ObjCompilingTests
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
./ObjLoadingTests
$combinedExitCode = [System.Math]::max($combinedExitCode, $LASTEXITCODE)
./ParserTests

View File

@ -5,40 +5,30 @@ on:
tags:
- "v*.*.*"
env:
PREMAKE_VERSION: "5.0.0-beta2"
jobs:
build-release-linux:
env:
PREMAKE_CONFIG: gmake2
runs-on: ubuntu-latest
container: ubuntu:24.04
steps:
- name: Install g++ and multilib
run: |
apt-get update
apt-get install -y wget tar git make gcc-13 g++-13 gcc-13-multilib g++-13-multilib
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
update-alternatives --set gcc /usr/bin/gcc-13
update-alternatives --set g++ /usr/bin/g++-13
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install g++ and multilib
run: |
sudo apt-get update
sudo apt-get install gcc-13 g++-13 gcc-13-multilib g++-13-multilib
- name: Set gcc/g++ to version 13
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13
sudo update-alternatives --set gcc /usr/bin/gcc-13
sudo update-alternatives --set g++ /usr/bin/g++-13
- name: Setup premake
uses: abel0b/setup-premake@v2.4
with:
version: ${{ env.PREMAKE_VERSION }}
- name: Premake generate
working-directory: ${{ github.workspace }}
run: premake5 ${{ env.PREMAKE_CONFIG }}
env:
PREMAKE_NO_PROMPT: 1
run: ./generate.sh
- name: Build
working-directory: ${{ github.workspace }}
@ -52,8 +42,6 @@ jobs:
${{ github.workspace }}/build/bin/Release_x86
build-release-windows:
env:
PREMAKE_CONFIG: vs2022
runs-on: windows-latest
steps:
- name: Checkout repository
@ -64,28 +52,25 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2.0.0
- name: Setup premake
uses: abel0b/setup-premake@v2.4
with:
version: ${{ env.PREMAKE_VERSION }}
- name: Premake generate
working-directory: ${{ github.workspace }}
run: premake5 ${{ env.PREMAKE_CONFIG }}
env:
PREMAKE_NO_PROMPT: 1
run: ./generate.bat
- name: Build
working-directory: ${{ github.workspace }}
run: msbuild /m /p:Configuration=Release /p:Platform=Win32 build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: oat-windows
path: |
${{ github.workspace }}/build/bin/Release_x86
release:
needs:
needs:
- build-release-linux
- build-release-windows
runs-on: ubuntu-latest
@ -108,4 +93,4 @@ jobs:
allowUpdates: true
draft: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitDraftDuringUpdate: true

3
.gitmodules vendored
View File

@ -13,3 +13,6 @@
[submodule "thirdparty/json"]
path = thirdparty/json
url = https://github.com/nlohmann/json.git
[submodule "thirdparty/eigen"]
path = thirdparty/eigen
url = https://gitlab.com/libeigen/eigen.git

View File

@ -44,6 +44,8 @@ In fact, I recommend against it to be able to better distinguish OAT files from
For more information, check out the ["Getting started" guide in the OAT documentation](https://openassettools.dev/guide/getting-started.html).
You can find other useful guides and reference documentation there as well.
![German Shepherd Model in Blender](./repo/german_shepherd.png)
## Building OAT
You need to clone this repository using Git.
@ -62,6 +64,7 @@ It is hosted on Github Pages and its source can be found in the [OAT Docs Reposi
For examples of mods that can be built with OAT, you can either look into the [docs folder](docs/example) for some (currently very barebones) examples
or check out one of the following projects that are using OAT:
* [OpenAssetTools/Examples](https://github.com/OpenAssetTools/Examples)
* [JezuzLizard/t6-fastfile-mods](https://github.com/JezuzLizard/t6-fastfile-mods)
* [Jbleezy/BO2-Reimagined](https://github.com/Jbleezy/BO2-Reimagined)
* [diamante0018/PlutoIW5Arena](https://github.com/diamante0018/PlutoIW5Arena) (Includes a GitHub action pipeline for building the mod)
@ -90,7 +93,7 @@ Since you are most likely on a 64-bit machine you will also need multilib for co
Use `generate.sh` to generate make files.
When this is done you will have a `build` folder with a `Makefile`.
You now run `make` manually or use `./scripts/make_release.sh` or `./scripts/make_debug.sh` to build.
You now run `make` manually or use `./scripts/make-release.sh` or `./scripts/make-debug.sh` to build.
The resulting binaries can be found in `build/bin/<Debug_x86|Release_x86>`.

View File

@ -9,33 +9,33 @@ The following section specify which assets are supported to be dumped to disk (u
## IW3 (Call of Duty 4: Modern Warfare)
| Asset Type | Dumping Support | Loading Support | Notes |
| -------------------- | --------------- | --------------- | -------------------------------------------------------- |
| PhysPreset | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT` and `OBJ`. |
| Material | ❌ | ❌ | |
| MaterialTechniqueSet | ❌ | ❌ | |
| GfxImage | ✅ | ✅ | |
| snd_alias_list_t | ❌ | ❌ | |
| SndCurve | ❌ | ❌ | |
| LoadedSound | ✅ | ❌ | |
| clipMap_t | ❌ | ❌ | |
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | ✅ | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ❌ | ❌ | |
| MenuList | ❌ | ❌ | |
| menuDef_t | ❌ | ❌ | |
| LocalizeEntry | ✅ | ✅ | |
| WeaponDef | ❌ | ❌ | |
| FxEffectDef | ❌ | ❌ | |
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| Asset Type | Dumping Support | Loading Support | Notes |
| -------------------- | --------------- | --------------- | ----------------------------------------------------------------- |
| PhysPreset | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT`, `OBJ`, `GLB/GLTF`. |
| Material | ❌ | ❌ | |
| MaterialTechniqueSet | ❌ | ❌ | |
| GfxImage | ✅ | ✅ | |
| snd_alias_list_t | ❌ | ❌ | |
| SndCurve | ❌ | ❌ | |
| LoadedSound | ✅ | ❌ | |
| clipMap_t | ❌ | ❌ | |
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | ✅ | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ❌ | ❌ | |
| MenuList | ❌ | ❌ | |
| menuDef_t | ❌ | ❌ | |
| LocalizeEntry | ✅ | ✅ | |
| WeaponDef | ❌ | ❌ | |
| FxEffectDef | ❌ | ❌ | |
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
## IW4 (Call of Duty: Modern Warfare 2)
@ -44,7 +44,7 @@ The following section specify which assets are supported to be dumped to disk (u
| PhysPreset | ✅ | ✅ | |
| PhysCollmap | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT` and `OBJ`. |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT`, `OBJ`, `GLB/GLTF`. |
| Material | ❌ | ❌ | |
| MaterialPixelShader | ✅ | ✅ | Shaders are compiled. Only dumps/loads shader bytecode. |
| MaterialVertexShader | ✅ | ✅ | Shaders are compiled. Only dumps/loads shader bytecode. |
@ -71,7 +71,7 @@ The following section specify which assets are supported to be dumped to disk (u
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| LeaderboardDef | ❌ | ❌ | |
| LeaderboardDef | ✅ | ✅ | |
| StructuredDataDefSet | ✅ | ✅ | The format is custom due to lacking information about original format. |
| TracerDef | ✅ | ❌ | |
| VehicleDef | ✅ | ❌ | |
@ -85,7 +85,7 @@ The following section specify which assets are supported to be dumped to disk (u
| PhysCollmap | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModelSurfs | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT` and `OBJ`. |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT`, `OBJ`, `GLB/GLTF`. |
| Material | ❌ | ❌ | |
| MaterialPixelShader | ❌ | ❌ | |
| MaterialVertexShader | ❌ | ❌ | |
@ -116,7 +116,7 @@ The following section specify which assets are supported to be dumped to disk (u
| RawFile | ✅ | ✅ | |
| ScriptFile | ⁉️ | ⁉️ | Can only be dumped/loaded as binary. Editing is possible with [GSC-Tool](https://github.com/xensik/gsc-tool). |
| StringTable | ✅ | ✅ | |
| LeaderboardDef | ❌ | ❌ | |
| LeaderboardDef | ✅ | ✅ | |
| StructuredDataDefSet | ❌ | ❌ | |
| TracerDef | ❌ | ❌ | |
| VehicleDef | ❌ | ❌ | |
@ -124,40 +124,40 @@ The following section specify which assets are supported to be dumped to disk (u
## T5 (Call of Duty: Black Ops)
| Asset Type | Dumping Support | Loading Support | Notes |
| -------------------- | --------------- | --------------- | -------------------------------------------------------- |
| PhysPreset | ❌ | ❌ | |
| PhysConstraints | ❌ | ❌ | |
| DestructibleDef | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT` and `OBJ`. |
| Material | ❌ | ❌ | |
| MaterialTechniqueSet | ❌ | ❌ | |
| GfxImage | ✅ | ❌ | A few special image encodings are not yet supported. |
| SndBank | ❌ | ❌ | |
| SndPatch | ❌ | ❌ | |
| clipMap_t | ❌ | ❌ | |
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | ❌ | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ❌ | ❌ | |
| MenuList | ❌ | ❌ | |
| menuDef_t | ❌ | ❌ | |
| LocalizeEntry | ✅ | ✅ | |
| WeaponVariantDef | ❌ | ❌ | |
| SndDriverGlobals | ❌ | ❌ | |
| FxEffectDef | ❌ | ❌ | |
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| PackIndex | ❌ | ❌ | |
| XGlobals | ❌ | ❌ | |
| ddlRoot_t | ❌ | ❌ | |
| Glasses | ❌ | ❌ | |
| EmblemSet | ❌ | ❌ | |
| Asset Type | Dumping Support | Loading Support | Notes |
| -------------------- | --------------- | --------------- | ----------------------------------------------------------------- |
| PhysPreset | ❌ | ❌ | |
| PhysConstraints | ❌ | ❌ | |
| DestructibleDef | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT`, `OBJ`, `GLB/GLTF`. |
| Material | ❌ | ❌ | |
| MaterialTechniqueSet | ❌ | ❌ | |
| GfxImage | ✅ | ❌ | A few special image encodings are not yet supported. |
| SndBank | ❌ | ❌ | |
| SndPatch | ❌ | ❌ | |
| clipMap_t | ❌ | ❌ | |
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | ❌ | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ❌ | ❌ | |
| MenuList | ❌ | ❌ | |
| menuDef_t | ❌ | ❌ | |
| LocalizeEntry | ✅ | ✅ | |
| WeaponVariantDef | ❌ | ❌ | |
| SndDriverGlobals | ❌ | ❌ | |
| FxEffectDef | ❌ | ❌ | |
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| PackIndex | ❌ | ❌ | |
| XGlobals | ❌ | ❌ | |
| ddlRoot_t | ❌ | ❌ | |
| Glasses | ❌ | ❌ | |
| EmblemSet | ❌ | ❌ | |
## T6 (Call of Duty: Black Ops II)
@ -167,7 +167,7 @@ The following section specify which assets are supported to be dumped to disk (u
| PhysConstraints | ✅ | ✅ | |
| DestructibleDef | ❌ | ❌ | |
| XAnimParts | ❌ | ❌ | |
| XModel | ⁉️ | ❌ | Model data can be exported to `XMODEL_EXPORT` and `OBJ`. |
| XModel | ✅ | ✅ | Model data can be exported to `XMODEL_EXPORT`, `OBJ`, `GLB/GLTF`. |
| Material | ⁉️ | ⁉️ | Dumping/Loading is currently possible for materials in their compiled form. There is currently no material pipeline. |
| MaterialTechniqueSet | ⁉️ | ❌ | Only dumps compiled shaders. |
| GfxImage | ✅ | ✅ | A few special image encodings are not yet supported. |
@ -177,7 +177,7 @@ The following section specify which assets are supported to be dumped to disk (u
| ComWorld | ❌ | ❌ | |
| GameWorldSp | ❌ | ❌ | |
| GameWorldMp | ❌ | ❌ | |
| MapEnts | | ❌ | |
| MapEnts | | ❌ | |
| GfxWorld | ❌ | ❌ | |
| GfxLightDef | ❌ | ❌ | |
| Font_s | ❌ | ❌ | |
@ -194,7 +194,7 @@ The following section specify which assets are supported to be dumped to disk (u
| FxImpactTable | ❌ | ❌ | |
| RawFile | ✅ | ✅ | |
| StringTable | ✅ | ✅ | |
| LeaderboardDef | ❌ | ❌ | |
| LeaderboardDef | ✅ | ✅ | |
| XGlobals | ❌ | ❌ | |
| ddlRoot_t | ❌ | ❌ | |
| Glasses | ❌ | ❌ | |

View File

@ -1,6 +1,88 @@
@echo off
set PREMAKE_URL="https://github.com/premake/premake-core/releases/download/v5.0.0-beta6/premake-5.0.0-beta6-windows.zip"
set PREMAKE_HASH="c34a6e0b15f119f6284886298fdd8df543af87ad16f3ce5f4d0a847be2a88343"
@REM The following variables can be set:
@REM PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
@REM PREMAKE_NO_PROMPT - Download premake5 without prompting
goto start
:downloadpremake
if not exist "build" mkdir "build"
where /q "pwsh"
IF NOT ERRORLEVEL 1 (
set POWERSHELL_BIN="pwsh"
) else (
set POWERSHELL_BIN="powershell"
)
echo Downloading...
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Invoke-WebRequest %PREMAKE_URL% -OutFile build/premake.zip"
IF ERRORLEVEL 1 (
echo Download failed >&2
exit 2
)
echo Extracting...
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "Expand-Archive -LiteralPath build/premake.zip -DestinationPath build -Force"
IF ERRORLEVEL 1 (
echo Extraction failed >&2
exit 2
)
rm build/premake.zip
echo Verifying hash...
%POWERSHELL_BIN% -NoProfile -NonInteractive -Command "if ((Get-FileHash -LiteralPath build/premake5.exe -Algorithm SHA256).Hash -eq \"%PREMAKE_HASH%\") { exit 0 } else { exit 1 }"
IF ERRORLEVEL 1 (
echo Hash verification failed >&2
rm build/premake5.exe
exit 2
)
exit /B 0
cd %~dp0
:start
IF "%PREMAKE_NO_GLOBAL%" EQU "" (
where /Q "premake5.exe"
IF NOT ERRORLEVEL 1 (
set PREMAKE_BIN="premake5.exe"
goto runpremake
)
)
IF EXIST build/premake5.exe (
build\premake5.exe --version >NUL
IF NOT ERRORLEVEL 1 (
set PREMAKE_BIN="build/premake5.exe"
goto runpremake
)
)
if "%PREMAKE_NO_PROMPT%" NEQ "" (
call:downloadpremake
set PREMAKE_BIN="build/premake5.exe"
goto runpremake
)
echo Could not find premake5. You can either install it yourself or this script download it for you.
set /p choice="Do you wish to download it automatically? [y/N]> "
if /i "%choice%" == "y" (
call:downloadpremake
set PREMAKE_BIN="build/premake5.exe"
goto runpremake
)
echo Please install premake5 and try again
exit 1
:runpremake
git submodule update --init --recursive
tools\premake5.exe %* vs2022
%PREMAKE_BIN% %* vs2022

View File

@ -1,7 +1,80 @@
#!/bin/bash
PREMAKE_URL='https://github.com/premake/premake-core/releases/download/v5.0.0-beta6/premake-5.0.0-beta6-linux.tar.gz'
PREMAKE_HASH='fade2839ace1a2953556693e6f3d8f9b8b2897894b5a1f2ad477cdf8e9af042a'
# The following variables can be set:
# PREMAKE_NO_GLOBAL - Ignore premake5 executable from path
# PREMAKE_NO_PROMPT - Download premake5 without prompting
function install_premake {
if [[ ! -x "$(command -v wget)" ]]; then
echo "Failed: Installation requires wget" >&2
exit 2
fi
if [[ ! -x "$(command -v tar)" ]]; then
echo "Failed: Installation requires tar" >&2
exit 2
fi
if [[ ! -x "$(command -v sha256sum)" ]]; then
echo "Failed: Installation requires sha256sum" >&2
exit 2
fi
mkdir -p build
wget -nd -O build/premake.tar.gz "$PREMAKE_URL"
if [[ $? -ne 0 ]]; then
echo "Download failed" >&2
exit 2
fi
tar -xf build/premake.tar.gz -C build
if [[ $? -ne 0 ]]; then
echo "Extraction failed" >&2
exit 2
fi
rm build/premake.tar.gz
echo "${PREMAKE_HASH} build/premake5" | sha256sum -c
if [[ $? -ne 0 ]]; then
echo "Hash verification failed" >&2
rm build/premake5
exit 2
fi
chmod +x build/premake5
}
function expect_inside_git_repository {
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ ! -d ".git" ] && [ ! "$inside_git_repo" ]; then
echo "You must clone the OpenAssetTools repository using 'git clone'. Please read README.md." >&2
exit 1
fi
}
# Go to repository root
cd "$(dirname "$0")" || exit 2
expect_inside_git_repository
PREMAKE_BIN=''
if [[ -z "$PREMAKE_NO_GLOBAL" ]] && [[ -x "$(command -v premake5)" ]]; then
PREMAKE_BIN='premake5'
elif [[ -x "$(command -v build/premake5)" ]] && [[ ! -z "$(build/premake5 --version)" ]]; then
PREMAKE_BIN='build/premake5'
else
echo "Could not find premake5. You can either install it yourself or this script download it for you."
if [[ ! -z "$PREMAKE_NO_PROMPT" ]] || [[ "$(read -e -p 'Do you wish to download it automatically? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then
echo "Installing premake"
install_premake
PREMAKE_BIN='build/premake5'
else
echo "Please install premake5 and try again"
exit 1
fi
fi
git submodule update --init --recursive
tools/premake5 $@ gmake2
$PREMAKE_BIN $@ gmake

View File

@ -1,9 +1,12 @@
require("premake", ">=5.0.0-beta5")
include "tools/scripts/folders.lua"
include "tools/scripts/including.lua"
include "tools/scripts/linking.lua"
include "tools/scripts/options.lua"
include "tools/scripts/platform.lua"
include "tools/scripts/version.lua"
include "tools/scripts/source_templating.lua"
-- ==================
-- Workspace
@ -13,7 +16,7 @@ workspace "OpenAssetTools"
objdir "%{wks.location}/obj"
symbols "On"
systemversion "latest"
cppdialect "C++20"
cppdialect "C++23"
largeaddressaware "on"
flags {
@ -51,13 +54,15 @@ workspace "OpenAssetTools"
symbols "On"
filter {}
filter {"system:windows", "configurations:Debug" }
buildoptions { "/bigobj" }
filter {}
filter "configurations:Release"
defines "NDEBUG"
optimize "Full"
symbols "Off"
flags {
"FatalWarnings"
}
fatalwarnings { "All" }
filter {}
defines {
@ -84,6 +89,7 @@ workspace "OpenAssetTools"
-- ThirdParty
-- ========================
include "thirdparty/catch2.lua"
include "thirdparty/eigen.lua"
include "thirdparty/libtomcrypt.lua"
include "thirdparty/libtommath.lua"
include "thirdparty/json.lua"
@ -95,6 +101,7 @@ include "thirdparty/zlib.lua"
-- ThirdParty group: All projects that are external dependencies
group "ThirdParty"
catch2:project()
eigen:project()
libtommath:project()
libtomcrypt:project()
json:project()
@ -109,6 +116,7 @@ group ""
-- ========================
include "src/Common.lua"
include "src/Crypto.lua"
include "src/ImageConverter.lua"
include "src/Linker.lua"
include "src/Parser.lua"
include "src/RawTemplater.lua"
@ -122,6 +130,8 @@ include "src/ZoneLoading.lua"
include "src/ZoneWriting.lua"
include "src/ZoneCommon.lua"
include "src/ObjCommon.lua"
include "src/ObjCompiling.lua"
include "src/ObjImage.lua"
include "src/ObjLoading.lua"
include "src/ObjWriting.lua"
include "tools/scripts/raw.lua"
@ -138,6 +148,8 @@ group "Components"
ZoneLoading:project()
ZoneWriting:project()
ObjCommon:project()
ObjCompiling:project()
ObjImage:project()
ObjLoading:project()
ObjWriting:project()
group ""
@ -152,6 +164,7 @@ group ""
group "Tools"
Linker:project()
Unlinker:project()
ImageConverter:project()
group ""
group "Raw"
@ -161,7 +174,10 @@ group ""
-- ========================
-- Tests
-- ========================
include "test/Catch2Common.lua"
include "test/ObjCommonTestUtils.lua"
include "test/ObjCommonTests.lua"
include "test/ObjCompilingTests.lua"
include "test/ObjLoadingTests.lua"
include "test/ParserTestUtils.lua"
include "test/ParserTests.lua"
@ -170,7 +186,10 @@ include "test/ZoneCommonTests.lua"
-- Tests group: Unit test and other tests projects
group "Tests"
Catch2Common:project()
ObjCommonTestUtils:project()
ObjCommonTests:project()
ObjCompilingTests:project()
ObjLoadingTests:project()
ParserTestUtils:project()
ParserTests:project()

View File

@ -0,0 +1,21 @@
J_Hip_RI,right_leg_upper
J_Hip_LE,left_leg_upper
J_Knee_RI,right_leg_lower
J_SpineUpper,torso_upper
J_Knee_LE,left_leg_lower
J_Ankle_RI,right_foot
J_Ankle_LE,left_foot
J_Clavicle_RI,torso_upper
J_Clavicle_LE,torso_upper
J_Shoulder_RI,right_arm_upper
J_Shoulder_LE,left_arm_upper
J_Neck,neck
J_Head,head
J_Elbow_RI,right_arm_lower
J_Elbow_LE,left_arm_lower
J_Wrist_RI,right_hand
J_Wrist_LE,left_hand
J_MainRoot,torso_lower
TAG_WEAPON_LEFT,gun
TAG_WEAPON_RIGHT,gun
J_Helmet,helmet
1 J_Hip_RI right_leg_upper
2 J_Hip_LE left_leg_upper
3 J_Knee_RI right_leg_lower
4 J_SpineUpper torso_upper
5 J_Knee_LE left_leg_lower
6 J_Ankle_RI right_foot
7 J_Ankle_LE left_foot
8 J_Clavicle_RI torso_upper
9 J_Clavicle_LE torso_upper
10 J_Shoulder_RI right_arm_upper
11 J_Shoulder_LE left_arm_upper
12 J_Neck neck
13 J_Head head
14 J_Elbow_RI right_arm_lower
15 J_Elbow_LE left_arm_lower
16 J_Wrist_RI right_hand
17 J_Wrist_LE left_hand
18 J_MainRoot torso_lower
19 TAG_WEAPON_LEFT gun
20 TAG_WEAPON_RIGHT gun
21 J_Helmet helmet

View File

@ -0,0 +1,19 @@
J_Hip_RI,right_leg_upper
J_Hip_LE,left_leg_upper
J_Knee_RI,right_leg_lower
J_SpineUpper,torso_lower
J_SpineLower,torso_lower
J_MainRoot,torso_lower
J_Knee_LE,left_leg_lower
J_Ankle_RI,right_foot
J_Ankle_LE,left_foot
J_Clavicle_RI,torso_upper
J_Clavicle_LE,torso_upper
J_Shoulder_RI,right_arm_upper
J_Shoulder_LE,left_arm_upper
J_Neck,neck
J_Head,head
J_Elbow_RI,right_arm_lower
J_Elbow_LE,left_arm_lower
J_Wrist_RI,right_hand
J_Wrist_LE,left_hand
1 J_Hip_RI right_leg_upper
2 J_Hip_LE left_leg_upper
3 J_Knee_RI right_leg_lower
4 J_SpineUpper torso_lower
5 J_SpineLower torso_lower
6 J_MainRoot torso_lower
7 J_Knee_LE left_leg_lower
8 J_Ankle_RI right_foot
9 J_Ankle_LE left_foot
10 J_Clavicle_RI torso_upper
11 J_Clavicle_LE torso_upper
12 J_Shoulder_RI right_arm_upper
13 J_Shoulder_LE left_arm_upper
14 J_Neck neck
15 J_Head head
16 J_Elbow_RI right_arm_lower
17 J_Elbow_LE left_arm_lower
18 J_Wrist_RI right_hand
19 J_Wrist_LE left_hand

View File

@ -0,0 +1,21 @@
J_Hip_RI,right_leg_upper
J_Hip_LE,left_leg_upper
J_Knee_RI,right_leg_lower
J_SpineUpper,torso_upper
J_Knee_LE,left_leg_lower
J_Ankle_RI,right_foot
J_Ankle_LE,left_foot
J_Clavicle_RI,torso_upper
J_Clavicle_LE,torso_upper
J_Shoulder_RI,right_arm_upper
J_Shoulder_LE,left_arm_upper
J_Neck,neck
J_Head,head
J_Elbow_RI,right_arm_lower
J_Elbow_LE,left_arm_lower
J_Wrist_RI,right_hand
J_Wrist_LE,left_hand
J_MainRoot,torso_lower
TAG_WEAPON_LEFT,gun
TAG_WEAPON_RIGHT,gun
J_Helmet,helmet
1 J_Hip_RI right_leg_upper
2 J_Hip_LE left_leg_upper
3 J_Knee_RI right_leg_lower
4 J_SpineUpper torso_upper
5 J_Knee_LE left_leg_lower
6 J_Ankle_RI right_foot
7 J_Ankle_LE left_foot
8 J_Clavicle_RI torso_upper
9 J_Clavicle_LE torso_upper
10 J_Shoulder_RI right_arm_upper
11 J_Shoulder_LE left_arm_upper
12 J_Neck neck
13 J_Head head
14 J_Elbow_RI right_arm_lower
15 J_Elbow_LE left_arm_lower
16 J_Wrist_RI right_hand
17 J_Wrist_LE left_hand
18 J_MainRoot torso_lower
19 TAG_WEAPON_LEFT gun
20 TAG_WEAPON_RIGHT gun
21 J_Helmet helmet

View File

@ -0,0 +1,19 @@
J_Hip_RI,right_leg_upper
J_Hip_LE,left_leg_upper
J_Knee_RI,right_leg_lower
J_SpineUpper,torso_lower
J_SpineLower,torso_lower
J_MainRoot,torso_lower
J_Knee_LE,left_leg_lower
J_Ankle_RI,right_foot
J_Ankle_LE,left_foot
J_Clavicle_RI,torso_upper
J_Clavicle_LE,torso_upper
J_Shoulder_RI,right_arm_upper
J_Shoulder_LE,left_arm_upper
J_Neck,neck
J_Head,head
J_Elbow_RI,right_arm_lower
J_Elbow_LE,left_arm_lower
J_Wrist_RI,right_hand
J_Wrist_LE,left_hand
1 J_Hip_RI right_leg_upper
2 J_Hip_LE left_leg_upper
3 J_Knee_RI right_leg_lower
4 J_SpineUpper torso_lower
5 J_SpineLower torso_lower
6 J_MainRoot torso_lower
7 J_Knee_LE left_leg_lower
8 J_Ankle_RI right_foot
9 J_Ankle_LE left_foot
10 J_Clavicle_RI torso_upper
11 J_Clavicle_LE torso_upper
12 J_Shoulder_RI right_arm_upper
13 J_Shoulder_LE left_arm_upper
14 J_Neck neck
15 J_Head head
16 J_Elbow_RI right_arm_lower
17 J_Elbow_LE left_arm_lower
18 J_Wrist_RI right_hand
19 J_Wrist_LE left_hand

View File

@ -0,0 +1,23 @@
j_helmet,helmet
j_head,head
j_neck,neck
j_clavicle_le,torso_upper
j_clavicle_ri,torso_upper
j_spineupper,torso_upper
j_mainroot,torso_lower
j_shoulder_ri,right_arm_upper
j_shoulder_le,left_arm_upper
j_elbow_ri,right_arm_lower
j_elbow_le,left_arm_lower
j_wrist_ri,right_hand
j_wrist_le,left_hand
j_hip_ri,right_leg_upper
j_hip_le,left_leg_upper
j_knee_ri,right_leg_lower
j_knee_le,left_leg_lower
j_ankle_ri,right_foot
j_ankle_le,left_foot
tag_weapon_left,gun
tag_weapon_right,gun
tag_stowed_back,shield
tag_weapon_left,shield
1 j_helmet helmet
2 j_head head
3 j_neck neck
4 j_clavicle_le torso_upper
5 j_clavicle_ri torso_upper
6 j_spineupper torso_upper
7 j_mainroot torso_lower
8 j_shoulder_ri right_arm_upper
9 j_shoulder_le left_arm_upper
10 j_elbow_ri right_arm_lower
11 j_elbow_le left_arm_lower
12 j_wrist_ri right_hand
13 j_wrist_le left_hand
14 j_hip_ri right_leg_upper
15 j_hip_le left_leg_upper
16 j_knee_ri right_leg_lower
17 j_knee_le left_leg_lower
18 j_ankle_ri right_foot
19 j_ankle_le left_foot
20 tag_weapon_left gun
21 tag_weapon_right gun
22 tag_stowed_back shield
23 tag_weapon_left shield

View File

@ -0,0 +1,23 @@
j_helmet,helmet
j_head,head
j_neck,neck
j_clavicle_le,torso_upper
j_clavicle_ri,torso_upper
j_spineupper,torso_middle
j_mainroot,torso_lower
j_shoulder_ri,right_arm_upper
j_shoulder_le,left_arm_upper
j_elbow_ri,right_arm_lower
j_elbow_le,left_arm_lower
j_wrist_ri,right_hand
j_wrist_le,left_hand
j_hip_ri,right_leg_upper
j_hip_le,left_leg_upper
j_knee_ri,right_leg_lower
j_knee_le,left_leg_lower
j_ankle_ri,right_foot
j_ankle_le,left_foot
tag_weapon_left,gun
tag_weapon_right,gun
tag_stowed_back,shield
tag_weapon_left,shield
1 j_helmet helmet
2 j_head head
3 j_neck neck
4 j_clavicle_le torso_upper
5 j_clavicle_ri torso_upper
6 j_spineupper torso_middle
7 j_mainroot torso_lower
8 j_shoulder_ri right_arm_upper
9 j_shoulder_le left_arm_upper
10 j_elbow_ri right_arm_lower
11 j_elbow_le left_arm_lower
12 j_wrist_ri right_hand
13 j_wrist_le left_hand
14 j_hip_ri right_leg_upper
15 j_hip_le left_leg_upper
16 j_knee_ri right_leg_lower
17 j_knee_le left_leg_lower
18 j_ankle_ri right_foot
19 j_ankle_le left_foot
20 tag_weapon_left gun
21 tag_weapon_right gun
22 tag_stowed_back shield
23 tag_weapon_left shield

BIN
repo/german_shepherd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

23
scripts/build.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
TARGET='all'
ARCHITECTURE='x86'
CONFIG='debug'
for var in "$@"
do
if [ "$var" == "debug" ] || [ "$var" == "release" ]; then
CONFIG="$var"
elif [ "$var" == "x86" ] || [ "$var" == "x64" ]; then
ARCHITECTURE="$var"
else
TARGET="$var"
fi
done
echo "Building config=${CONFIG} architecture=${ARCHITECTURE} target=${TARGET}"
make -C build -j$(nproc) config=${CONFIG}_${ARCHITECTURE} "${TARGET}"

6
scripts/check-format-docker.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
docker run --rm -v ".:/code" --user "$(id -u):$(id -g)" silkeh/clang:17 /code/scripts/check-format.sh

View File

@ -4,4 +4,6 @@
cd "$(dirname "$0")/.." || exit 2
make -C build -j$(nproc) config=debug_x86 clean
make -C build -j$(nproc) config=release_x86 clean
make -C build -j$(nproc) config=release_x86 clean
make -C build -j$(nproc) config=debug_x64 clean
make -C build -j$(nproc) config=release_x64 clean

View File

@ -3,4 +3,4 @@
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
make -C build -j$(nproc) config=debug_x86 all
make -C build -j$(nproc) config=debug_x86 all

View File

@ -4,4 +4,4 @@
cd "$(dirname "$0")/.." || exit 2
echo "Start building with $(nproc) threads"
make -C build -j$(nproc) config=release_x86 all
make -C build -j$(nproc) config=release_x86 all

6
scripts/reformat-all-docker.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Go to repository root
cd "$(dirname "$0")/.." || exit 2
docker run --rm -v ".:/code" --user "$(id -u):$(id -g)" silkeh/clang:17 /code/scripts/reformat-all.sh

56
src/Common/Game/IAsset.h Normal file
View File

@ -0,0 +1,56 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include <stdexcept>
#include <type_traits>
struct IAssetBase
{
};
template<asset_type_t AssetTypeEnum, typename AssetType> class Asset : IAssetBase
{
public:
static constexpr auto EnumEntry = AssetTypeEnum;
using Type = AssetType;
};
template<typename AssetType> struct AssetNameAccessor
{
public:
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
// static constexpr bool IS_SINGLETON = false;
// const char*& operator()(AssetType::Type& asset)
// {
// throw std::runtime_error("Not implemented");
// }
};
#define DEFINE_ASSET_NAME_ACCESSOR(assetType, nameProperty) \
template<> struct AssetNameAccessor<assetType> \
{ \
public: \
static_assert(std::is_base_of_v<IAssetBase, assetType>); \
static constexpr bool IS_SINGLETON = false; \
\
const char*& operator()(assetType::Type& asset) \
{ \
return asset.nameProperty; \
} \
}
#define DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(assetType, singletonName) \
template<> struct AssetNameAccessor<assetType> \
{ \
public: \
static_assert(std::is_base_of_v<IAssetBase, assetType>); \
static constexpr bool IS_SINGLETON = true; \
\
const char* const& operator()(assetType::Type& asset) \
{ \
static const char* NAME = singletonName; \
return NAME; \
} \
}

26
src/Common/Game/IGame.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "IGame.h"
#include "IW3/GameIW3.h"
#include "IW4/GameIW4.h"
#include "IW5/GameIW5.h"
#include "T5/GameT5.h"
#include "T6/GameT6.h"
#include <cassert>
IGame* IGame::GetGameById(GameId gameId)
{
static IGame* games[static_cast<unsigned>(GameId::COUNT)]{
new IW3::Game(),
new IW4::Game(),
new IW5::Game(),
new T5::Game(),
new T6::Game(),
};
assert(static_cast<unsigned>(gameId) < static_cast<unsigned>(GameId::COUNT));
auto* result = games[static_cast<unsigned>(gameId)];
assert(result);
return result;
}

View File

@ -1,10 +1,31 @@
#pragma once
#include "GameLanguage.h"
#include <type_traits>
#include <vector>
class Zone;
enum class GameId
{
IW3,
IW4,
IW5,
T5,
T6,
COUNT
};
static constexpr const char* GameId_Names[]{
"IW3",
"IW4",
"IW5",
"T5",
"T6",
};
static_assert(std::extent_v<decltype(GameId_Names)> == static_cast<unsigned>(GameId::COUNT));
class IGame
{
public:
@ -15,10 +36,13 @@ public:
IGame& operator=(const IGame& other) = default;
IGame& operator=(IGame&& other) noexcept = default;
virtual std::string GetFullName() = 0;
virtual std::string GetShortName() = 0;
[[nodiscard]] virtual GameId GetId() const = 0;
[[nodiscard]] virtual const std::string& GetFullName() const = 0;
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
virtual void AddZone(Zone* zone) = 0;
virtual void RemoveZone(Zone* zone) = 0;
virtual std::vector<Zone*> GetZones() = 0;
virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0;
[[nodiscard]] virtual const std::vector<Zone*>& GetZones() const = 0;
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
static IGame* GetGameById(GameId gameId);
};

View File

@ -4,32 +4,32 @@
using namespace IW3;
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
return PackedTexCoords{pack32::Vec2PackTexCoordsVU(in)};
}
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
return PackedUnitVec{pack32::Vec3PackUnitVecScaleBased(in)};
}
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
return GfxColor{pack32::Vec4PackGfxColor(in)};
}
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float*>(out));
pack32::Vec2UnpackTexCoordsVU(in.packed, out);
}
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float*>(out));
pack32::Vec3UnpackUnitVecScaleBased(in.packed, out);
}
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
pack32::Vec4UnpackGfxColor(in.packed, out);
}

View File

@ -21,11 +21,11 @@ namespace IW3
return result;
}
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
};
} // namespace IW3

View File

@ -1,29 +1,32 @@
#include "GameIW3.h"
#include "IW3.h"
#include <algorithm>
using namespace IW3;
GameIW3 g_GameIW3;
std::string GameIW3::GetFullName()
GameId Game::GetId() const
{
return "Call Of Duty 4: Modern Warfare";
return GameId::IW3;
}
std::string GameIW3::GetShortName()
const std::string& Game::GetFullName() const
{
return "IW3";
static std::string fullName = "Call Of Duty 4: Modern Warfare";
return fullName;
}
void GameIW3::AddZone(Zone* zone)
const std::string& Game::GetShortName() const
{
static std::string shortName = "IW3";
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameIW3::RemoveZone(Zone* zone)
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
@ -31,13 +34,13 @@ void GameIW3::RemoveZone(Zone* zone)
m_zones.erase(foundEntry);
}
std::vector<Zone*> GameIW3::GetZones()
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
std::vector<GameLanguagePrefix> GameIW3::GetLanguagePrefixes()
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
std::vector<GameLanguagePrefix> prefixes;
static std::vector<GameLanguagePrefix> prefixes;
return prefixes;
}

View File

@ -1,17 +1,20 @@
#pragma once
#include "Game/IGame.h"
class GameIW3 : public IGame
namespace IW3
{
std::vector<Zone*> m_zones;
class Game final : public IGame
{
public:
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};
extern GameIW3 g_GameIW3;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW3

View File

@ -3,7 +3,7 @@
// clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h"
#include "Game/IAsset.h"
#include "IW3_Assets.h"
@ -83,4 +83,62 @@ namespace IW3
WFT_NUM_FIELD_TYPES
};
using AssetXModelPieces = Asset<ASSET_TYPE_XMODELPIECES, XModelPieces>;
using AssetPhysPreset = Asset<ASSET_TYPE_PHYSPRESET, PhysPreset>;
using AssetXAnim = Asset<ASSET_TYPE_XANIMPARTS, XAnimParts>;
using AssetXModel = Asset<ASSET_TYPE_XMODEL, XModel>;
using AssetMaterial = Asset<ASSET_TYPE_MATERIAL, Material>;
using AssetTechniqueSet = Asset<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>;
using AssetImage = Asset<ASSET_TYPE_IMAGE, GfxImage>;
using AssetSound = Asset<ASSET_TYPE_SOUND, snd_alias_list_t>;
using AssetSoundCurve = Asset<ASSET_TYPE_SOUND_CURVE, SndCurve>;
using AssetLoadedSound = Asset<ASSET_TYPE_LOADED_SOUND, LoadedSound>;
using AssetClipMap = Asset<ASSET_TYPE_CLIPMAP, clipMap_t>;
using AssetClipMapPvs = Asset<ASSET_TYPE_CLIPMAP_PVS, clipMap_t>;
using AssetComWorld = Asset<ASSET_TYPE_COMWORLD, ComWorld>;
using AssetGameWorldSp = Asset<ASSET_TYPE_GAMEWORLD_SP, GameWorldSp>;
using AssetGameWorldMp = Asset<ASSET_TYPE_GAMEWORLD_MP, GameWorldMp>;
using AssetMapEnts = Asset<ASSET_TYPE_MAP_ENTS, MapEnts>;
using AssetGfxWorld = Asset<ASSET_TYPE_GFXWORLD, GfxWorld>;
using AssetLightDef = Asset<ASSET_TYPE_LIGHT_DEF, GfxLightDef>;
using AssetFont = Asset<ASSET_TYPE_FONT, Font_s>;
using AssetMenuList = Asset<ASSET_TYPE_MENULIST, MenuList>;
using AssetMenu = Asset<ASSET_TYPE_MENU, menuDef_t>;
using AssetLocalize = Asset<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>;
using AssetWeapon = Asset<ASSET_TYPE_WEAPON, WeaponDef>;
using AssetSoundDriverGlobals = Asset<ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals>;
using AssetFx = Asset<ASSET_TYPE_FX, FxEffectDef>;
using AssetImpactFx = Asset<ASSET_TYPE_IMPACT_FX, FxImpactTable>;
using AssetRawFile = Asset<ASSET_TYPE_RAWFILE, RawFile>;
using AssetStringTable = Asset<ASSET_TYPE_STRINGTABLE, StringTable>;
} // namespace IW3
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetXModelPieces, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetPhysPreset, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetXAnim, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetXModel, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetMaterial, info.name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetTechniqueSet, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetImage, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetSound, aliasName);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetSoundCurve, filename);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetLoadedSound, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetClipMap, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetClipMapPvs, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetComWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetGameWorldSp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetGameWorldMp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetGfxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetLightDef, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetFont, fontName);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetMenuList, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetMenu, window.name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetLocalize, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetWeapon, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetSoundDriverGlobals, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetImpactFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetRawFile, name);
DEFINE_ASSET_NAME_ACCESSOR(IW3::AssetStringTable, name);

View File

@ -1326,7 +1326,6 @@ namespace IW3
// void/*IDirect3DTexture9*/* map;
// void/*IDirect3DVolumeTexture9*/* volmap;
// void/*IDirect3DCubeTexture9*/* cubemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
@ -3091,20 +3090,16 @@ namespace IW3
float fHipViewScatterMax;
float fightDist;
float maxDist;
// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// const char* accuracyGraphName[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// float(*accuracyGraphKnots[2])[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// float(*originalAccuracyGraphKnots[2])[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;

View File

@ -2,6 +2,8 @@
#include "Utils/Pack.h"
#include <cctype>
using namespace IW4;
int Common::StringTable_HashString(const char* str)
@ -20,32 +22,32 @@ int Common::StringTable_HashString(const char* str)
return result;
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
return PackedTexCoords{pack32::Vec2PackTexCoordsVU(in)};
}
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
return PackedUnitVec{pack32::Vec3PackUnitVecScaleBased(in)};
}
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
return GfxColor{pack32::Vec4PackGfxColor(in)};
}
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float*>(out));
pack32::Vec2UnpackTexCoordsVU(in.packed, out);
}
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float*>(out));
pack32::Vec3UnpackUnitVecScaleBased(in.packed, out);
}
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
pack32::Vec4UnpackGfxColor(in.packed, out);
}

View File

@ -28,11 +28,11 @@ namespace IW4
static int StringTable_HashString(const char* str);
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
};
} // namespace IW4

View File

@ -1,29 +1,32 @@
#include "GameIW4.h"
#include "IW4.h"
#include <algorithm>
using namespace IW4;
GameIW4 g_GameIW4;
std::string GameIW4::GetFullName()
GameId Game::GetId() const
{
return "Call Of Duty: Modern Warfare 2";
return GameId::IW4;
}
std::string GameIW4::GetShortName()
const std::string& Game::GetFullName() const
{
return "IW4";
static std::string fullName = "Call Of Duty: Modern Warfare 2";
return fullName;
}
void GameIW4::AddZone(Zone* zone)
const std::string& Game::GetShortName() const
{
static std::string shortName = "IW4";
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameIW4::RemoveZone(Zone* zone)
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
@ -31,13 +34,13 @@ void GameIW4::RemoveZone(Zone* zone)
m_zones.erase(foundEntry);
}
std::vector<Zone*> GameIW4::GetZones()
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
std::vector<GameLanguagePrefix> GameIW4::GetLanguagePrefixes()
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
std::vector<GameLanguagePrefix> prefixes;
static std::vector<GameLanguagePrefix> prefixes;
return prefixes;
}

View File

@ -1,17 +1,20 @@
#pragma once
#include "Game/IGame.h"
class GameIW4 : public IGame
namespace IW4
{
std::vector<Zone*> m_zones;
class Game final : public IGame
{
public:
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};
extern GameIW4 g_GameIW4;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW4

View File

@ -3,7 +3,7 @@
// clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h"
#include "Game/IAsset.h"
#include "IW4_Assets.h"
@ -129,4 +129,80 @@ namespace IW4
VFT_NUM,
};
using AssetPhysPreset = Asset<ASSET_TYPE_PHYSPRESET, PhysPreset>;
using AssetPhysCollMap = Asset<ASSET_TYPE_PHYSCOLLMAP, PhysCollmap>;
using AssetXAnim = Asset<ASSET_TYPE_XANIMPARTS, XAnimParts>;
using AssetXModelSurfs = Asset<ASSET_TYPE_XMODEL_SURFS, XModelSurfs>;
using AssetXModel = Asset<ASSET_TYPE_XMODEL, XModel>;
using AssetMaterial = Asset<ASSET_TYPE_MATERIAL, Material>;
using AssetPixelShader = Asset<ASSET_TYPE_PIXELSHADER, MaterialPixelShader>;
using AssetVertexShader = Asset<ASSET_TYPE_VERTEXSHADER, MaterialVertexShader>;
using AssetVertexDecl = Asset<ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration>;
using AssetTechniqueSet = Asset<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>;
using AssetImage = Asset<ASSET_TYPE_IMAGE, GfxImage>;
using AssetSound = Asset<ASSET_TYPE_SOUND, snd_alias_list_t>;
using AssetSoundCurve = Asset<ASSET_TYPE_SOUND_CURVE, SndCurve>;
using AssetLoadedSound = Asset<ASSET_TYPE_LOADED_SOUND, LoadedSound>;
using AssetClipMapSp = Asset<ASSET_TYPE_CLIPMAP_SP, clipMap_t>;
using AssetClipMapMp = Asset<ASSET_TYPE_CLIPMAP_MP, clipMap_t>;
using AssetComWorld = Asset<ASSET_TYPE_COMWORLD, ComWorld>;
using AssetGameWorldSp = Asset<ASSET_TYPE_GAMEWORLD_SP, GameWorldSp>;
using AssetGameWorldMp = Asset<ASSET_TYPE_GAMEWORLD_MP, GameWorldMp>;
using AssetMapEnts = Asset<ASSET_TYPE_MAP_ENTS, MapEnts>;
using AssetFxWorld = Asset<ASSET_TYPE_FXWORLD, FxWorld>;
using AssetGfxWorld = Asset<ASSET_TYPE_GFXWORLD, GfxWorld>;
using AssetLightDef = Asset<ASSET_TYPE_LIGHT_DEF, GfxLightDef>;
using AssetFont = Asset<ASSET_TYPE_FONT, Font_s>;
using AssetMenuList = Asset<ASSET_TYPE_MENULIST, MenuList>;
using AssetMenu = Asset<ASSET_TYPE_MENU, menuDef_t>;
using AssetLocalize = Asset<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>;
using AssetWeapon = Asset<ASSET_TYPE_WEAPON, WeaponCompleteDef>;
using AssetFx = Asset<ASSET_TYPE_FX, FxEffectDef>;
using AssetImpactFx = Asset<ASSET_TYPE_IMPACT_FX, FxImpactTable>;
using AssetRawFile = Asset<ASSET_TYPE_RAWFILE, RawFile>;
using AssetStringTable = Asset<ASSET_TYPE_STRINGTABLE, StringTable>;
using AssetLeaderboard = Asset<ASSET_TYPE_LEADERBOARD, LeaderboardDef>;
using AssetStructuredDataDef = Asset<ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet>;
using AssetTracer = Asset<ASSET_TYPE_TRACER, TracerDef>;
using AssetVehicle = Asset<ASSET_TYPE_VEHICLE, VehicleDef>;
using AssetAddonMapEnts = Asset<ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts>;
} // namespace IW4
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetPhysPreset, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetPhysCollMap, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetXAnim, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetXModelSurfs, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetXModel, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetMaterial, info.name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetPixelShader, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetVertexShader, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetVertexDecl, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetTechniqueSet, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetImage, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetSound, aliasName);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetSoundCurve, filename);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetLoadedSound, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetClipMapSp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetClipMapMp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetComWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetGameWorldSp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetGameWorldMp, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetFxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetGfxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetLightDef, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetFont, fontName);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetMenuList, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetMenu, window.name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetLocalize, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetWeapon, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetImpactFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetRawFile, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetStringTable, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetLeaderboard, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetStructuredDataDef, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetTracer, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetVehicle, name);
DEFINE_ASSET_NAME_ACCESSOR(IW4::AssetAddonMapEnts, name);

View File

@ -1009,7 +1009,6 @@ namespace IW4
// IDirect3DTexture9* map;
// IDirect3DVolumeTexture9* volmap;
// IDirect3DCubeTexture9* cubemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
@ -2549,7 +2548,8 @@ namespace IW4
LBCOL_TYPE_PRESTIGE = 0x3,
LBCOL_TYPE_BIGNUMBER = 0x4,
LBCOL_TYPE_PERCENT = 0x5,
LBCOL_TYPE_COUNT = 0x6,
LBCOL_TYPE_COUNT
};
enum LbAggType
@ -2558,7 +2558,8 @@ namespace IW4
LBAGG_TYPE_MAX = 0x1,
LBAGG_TYPE_SUM = 0x2,
LBAGG_TYPE_LAST = 0x3,
LBAGG_TYPE_COUNT = 0x4,
LBAGG_TYPE_COUNT
};
struct LbColumnDef
@ -4080,7 +4081,7 @@ namespace IW4
HITLOC_GUN = 0x12,
HITLOC_SHIELD = 0x13,
HITLOC_NUM,
HITLOC_COUNT,
};
struct snd_alias_list_name
@ -4397,15 +4398,12 @@ namespace IW4
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char* accuracyGraphName[2];// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// vec2_t* originalAccuracyGraphKnots[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
uint16_t originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
uint16_t originalAiVsAiAccuracyGraphKnotCount;
uint16_t originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
@ -4549,8 +4547,10 @@ namespace IW4
int ammoDropStockMax;
float adsDofStart;
float adsDofEnd;
uint16_t accuracyGraphKnotCount[2];
vec2_t* accuracyGraphKnots[2];
uint16_t aiVsAiAccuracyGraphKnotCount;
uint16_t aiVsPlayerAccuracyGraphKnotCount;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
bool motionTracker;
bool enhanced;
bool dpadIconShowsAmmo;

View File

@ -2,6 +2,8 @@
#include "Utils/Pack.h"
#include <cctype>
using namespace IW5;
int Common::StringTable_HashString(const char* str)
@ -20,32 +22,32 @@ int Common::StringTable_HashString(const char* str)
return result;
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
return PackedTexCoords{pack32::Vec2PackTexCoordsVU(in)};
}
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
return PackedUnitVec{pack32::Vec3PackUnitVecScaleBased(in)};
}
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
return GfxColor{pack32::Vec4PackGfxColor(in)};
}
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float*>(out));
pack32::Vec2UnpackTexCoordsVU(in.packed, out);
}
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float*>(out));
pack32::Vec3UnpackUnitVecScaleBased(in.packed, out);
}
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
pack32::Vec4UnpackGfxColor(in.packed, out);
}

View File

@ -9,11 +9,26 @@ namespace IW5
public:
static int StringTable_HashString(const char* str);
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
static constexpr uint32_t R_HashString(const char* str, uint32_t hash)
{
for (const auto* pos = str; *pos; pos++)
{
hash = 33 * hash ^ (*pos | 0x20);
}
return hash;
}
static constexpr uint32_t R_HashString(const char* string)
{
return R_HashString(string, 0u);
}
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
};
} // namespace IW5

View File

@ -1,29 +1,32 @@
#include "GameIW5.h"
#include "IW5.h"
#include <algorithm>
using namespace IW5;
GameIW5 g_GameIW5;
std::string GameIW5::GetFullName()
GameId Game::GetId() const
{
return "Call Of Duty: Modern Warfare 3";
return GameId::IW5;
}
std::string GameIW5::GetShortName()
const std::string& Game::GetFullName() const
{
return "IW5";
static std::string fullName = "Call Of Duty: Modern Warfare 3";
return fullName;
}
void GameIW5::AddZone(Zone* zone)
const std::string& Game::GetShortName() const
{
static std::string shortName = "IW5";
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameIW5::RemoveZone(Zone* zone)
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
@ -31,13 +34,13 @@ void GameIW5::RemoveZone(Zone* zone)
m_zones.erase(foundEntry);
}
std::vector<Zone*> GameIW5::GetZones()
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
std::vector<GameLanguagePrefix> GameIW5::GetLanguagePrefixes()
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
std::vector<GameLanguagePrefix> prefixes;
static std::vector<GameLanguagePrefix> prefixes;
return prefixes;
}

View File

@ -1,17 +1,20 @@
#pragma once
#include "Game/IGame.h"
class GameIW5 : public IGame
namespace IW5
{
std::vector<Zone*> m_zones;
class Game final : public IGame
{
public:
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};
extern GameIW5 g_GameIW5;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW5

View File

@ -3,7 +3,7 @@
// clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h"
#include "Game/IAsset.h"
#include "IW5_Assets.h"
@ -137,4 +137,86 @@ namespace IW5
WAFT_NUM_FIELD_TYPES,
};
using AssetPhysPreset = Asset<ASSET_TYPE_PHYSPRESET, PhysPreset>;
using AssetPhysCollMap = Asset<ASSET_TYPE_PHYSCOLLMAP, PhysCollmap>;
using AssetXAnim = Asset<ASSET_TYPE_XANIMPARTS, XAnimParts>;
using AssetXModelSurfs = Asset<ASSET_TYPE_XMODEL_SURFS, XModelSurfs>;
using AssetXModel = Asset<ASSET_TYPE_XMODEL, XModel>;
using AssetMaterial = Asset<ASSET_TYPE_MATERIAL, Material>;
using AssetPixelShader = Asset<ASSET_TYPE_PIXELSHADER, MaterialPixelShader>;
using AssetVertexShader = Asset<ASSET_TYPE_VERTEXSHADER, MaterialVertexShader>;
using AssetVertexDecl = Asset<ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration>;
using AssetTechniqueSet = Asset<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>;
using AssetImage = Asset<ASSET_TYPE_IMAGE, GfxImage>;
using AssetSound = Asset<ASSET_TYPE_SOUND, snd_alias_list_t>;
using AssetSoundCurve = Asset<ASSET_TYPE_SOUND_CURVE, SndCurve>;
using AssetLoadedSound = Asset<ASSET_TYPE_LOADED_SOUND, LoadedSound>;
using AssetClipMap = Asset<ASSET_TYPE_CLIPMAP, clipMap_t>;
using AssetComWorld = Asset<ASSET_TYPE_COMWORLD, ComWorld>;
using AssetGlassWorld = Asset<ASSET_TYPE_GLASSWORLD, GlassWorld>;
using AssetPathData = Asset<ASSET_TYPE_PATHDATA, PathData>;
using AssetVehicleTrack = Asset<ASSET_TYPE_VEHICLE_TRACK, VehicleTrack>;
using AssetMapEnts = Asset<ASSET_TYPE_MAP_ENTS, MapEnts>;
using AssetFxWorld = Asset<ASSET_TYPE_FXWORLD, FxWorld>;
using AssetGfxWorld = Asset<ASSET_TYPE_GFXWORLD, GfxWorld>;
using AssetLightDef = Asset<ASSET_TYPE_LIGHT_DEF, GfxLightDef>;
using AssetFont = Asset<ASSET_TYPE_FONT, Font_s>;
using AssetMenuList = Asset<ASSET_TYPE_MENULIST, MenuList>;
using AssetMenu = Asset<ASSET_TYPE_MENU, menuDef_t>;
using AssetLocalize = Asset<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>;
using AssetAttachment = Asset<ASSET_TYPE_ATTACHMENT, WeaponAttachment>;
using AssetWeapon = Asset<ASSET_TYPE_WEAPON, WeaponCompleteDef>;
using AssetFx = Asset<ASSET_TYPE_FX, FxEffectDef>;
using AssetImpactFx = Asset<ASSET_TYPE_IMPACT_FX, FxImpactTable>;
using AssetSurfaceFx = Asset<ASSET_TYPE_SURFACE_FX, SurfaceFxTable>;
using AssetRawFile = Asset<ASSET_TYPE_RAWFILE, RawFile>;
using AssetScript = Asset<ASSET_TYPE_SCRIPTFILE, ScriptFile>;
using AssetStringTable = Asset<ASSET_TYPE_STRINGTABLE, StringTable>;
using AssetLeaderboard = Asset<ASSET_TYPE_LEADERBOARD, LeaderboardDef>;
using AssetStructuredDataDef = Asset<ASSET_TYPE_STRUCTURED_DATA_DEF, StructuredDataDefSet>;
using AssetTracer = Asset<ASSET_TYPE_TRACER, TracerDef>;
using AssetVehicle = Asset<ASSET_TYPE_VEHICLE, VehicleDef>;
using AssetAddonMapEnts = Asset<ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts>;
} // namespace IW5
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetPhysPreset, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetPhysCollMap, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetXAnim, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetXModelSurfs, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetXModel, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetMaterial, info.name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetPixelShader, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetVertexShader, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetVertexDecl, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetTechniqueSet, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetImage, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetSound, aliasName);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetSoundCurve, filename);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetLoadedSound, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetClipMap, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetComWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetGlassWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetPathData, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetVehicleTrack, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetFxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetGfxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetLightDef, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetFont, fontName);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetMenuList, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetMenu, window.name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetLocalize, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetAttachment, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetWeapon, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetImpactFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetSurfaceFx, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetRawFile, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetScript, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetStringTable, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetLeaderboard, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetStructuredDataDef, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetTracer, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetVehicle, name);
DEFINE_ASSET_NAME_ACCESSOR(IW5::AssetAddonMapEnts, name);

View File

@ -177,11 +177,50 @@ namespace IW5
void* data;
};
typedef float vec2_t[2];
typedef float vec3_t[3];
typedef float vec4_t[4];
union vec2_t
{
float v[2];
struct
{
float x;
float y;
};
};
union vec3_t
{
struct
{
float x;
float y;
float z;
};
float v[3];
};
union vec4_t
{
float v[4];
struct
{
float x;
float y;
float z;
float w;
};
struct
{
float r;
float g;
float b;
float a;
};
};
typedef tdef_align(16) uint16_t r_index16_t;
typedef tdef_align(16) char raw_byte16;
typedef tdef_align(16) float raw_float16;
typedef tdef_align(128) unsigned int raw_uint128;
@ -220,8 +259,8 @@ namespace IW5
struct Bounds
{
float midPoint[3];
float halfSize[3];
vec3_t midPoint;
vec3_t halfSize;
};
struct cplane_s
@ -446,34 +485,15 @@ namespace IW5
unsigned int packed;
};
struct GfxQuantizedNoColorVertex
{
short xyz[3];
short binormalSign;
PackedUnitVec normal;
PackedUnitVec tangent;
PackedTexCoords texCoord;
};
union GfxColor
{
unsigned int packed;
unsigned char array[4];
};
struct GfxQuantizedVertex
{
short xyz[3];
short binormalSign;
PackedUnitVec normal;
PackedUnitVec tangent;
PackedTexCoords texCoord;
GfxColor color;
};
struct type_align(16) GfxPackedVertex
{
float xyz[3];
vec3_t xyz;
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
@ -481,14 +501,6 @@ namespace IW5
PackedUnitVec tangent;
};
union GfxVertexUnion0
{
GfxQuantizedNoColorVertex* quantizedNoColorVerts0;
GfxQuantizedVertex* quantizedVerts0;
GfxPackedVertex* packedVerts0;
void* verts0;
};
struct XSurfaceCollisionAabb
{
unsigned short mins[3];
@ -526,6 +538,13 @@ namespace IW5
XSurfaceCollisionTree* collisionTree;
};
struct XSurfaceTri
{
uint16_t i[3];
};
typedef tdef_align(16) XSurfaceTri XSurfaceTri16;
struct XSurface
{
unsigned char tileMode;
@ -536,9 +555,9 @@ namespace IW5
uint16_t baseTriIndex;
uint16_t baseVertIndex;
float quantizeScale;
r_index16_t (*triIndices)[3];
XSurfaceTri16* triIndices;
XSurfaceVertexInfo vertInfo;
GfxVertexUnion0 verts0;
GfxPackedVertex* verts0;
unsigned int vertListCount;
XRigidVertList* vertList;
int partBits[6];
@ -554,8 +573,8 @@ namespace IW5
struct DObjAnimMat
{
float quat[4];
float trans[3];
vec4_t quat;
vec3_t trans;
float transWeight;
};
@ -567,7 +586,7 @@ namespace IW5
XModelSurfs* modelSurfs;
int partBits[6];
XSurface* surfs;
char lod;
unsigned char lod;
char smcBaseIndexPlusOne;
char smcSubIndexMask;
char smcBucket;
@ -596,6 +615,11 @@ namespace IW5
float radiusSquared;
};
struct XModelQuat
{
int16_t v[4];
};
struct XModel
{
const char* name;
@ -606,15 +630,15 @@ namespace IW5
unsigned int noScalePartBits[6];
ScriptString* boneNames;
unsigned char* parentList;
short (*quats)[4];
float (*trans)[3];
XModelQuat* quats;
float* trans;
unsigned char* partClassification;
DObjAnimMat* baseMat;
Material** materialHandles;
XModelLodInfo lodInfo[4];
char maxLoadedLod;
unsigned char numLods;
unsigned char collLod;
char collLod;
unsigned char flags;
XModelCollSurf_s* collSurfs;
int numCollSurfs;
@ -651,6 +675,23 @@ namespace IW5
gcc_align(8) uint64_t packed;
};
enum MaterialGameFlags
{
MTL_GAMEFLAG_1 = 0x1,
MTL_GAMEFLAG_2 = 0x2,
MTL_GAMEFLAG_4 = 0x4,
MTL_GAMEFLAG_8 = 0x8,
MTL_GAMEFLAG_10 = 0x10,
MTL_GAMEFLAG_20 = 0x20,
MTL_GAMEFLAG_40 = 0x40,
MTL_GAMEFLAG_80 = 0x80,
MTL_GAMEFLAG_100 = 0x100,
MTL_GAMEFLAG_200 = 0x200,
MTL_GAMEFLAG_400 = 0x400,
MTL_GAMEFLAG_800 = 0x800,
MTL_GAMEFLAG_1000 = 0x1000,
};
struct MaterialInfo
{
const char* name;
@ -713,13 +754,71 @@ namespace IW5
water_t* water;
};
enum TextureFilter
{
TEXTURE_FILTER_DISABLED = 0x0,
TEXTURE_FILTER_NEAREST = 0x1,
TEXTURE_FILTER_LINEAR = 0x2,
TEXTURE_FILTER_ANISO2X = 0x3,
TEXTURE_FILTER_ANISO4X = 0x4,
TEXTURE_FILTER_COUNT
};
enum SamplerStateBitsMipMap_e
{
SAMPLER_MIPMAP_ENUM_DISABLED,
SAMPLER_MIPMAP_ENUM_NEAREST,
SAMPLER_MIPMAP_ENUM_LINEAR,
SAMPLER_MIPMAP_ENUM_COUNT
};
enum SamplerStateBits_e
{
SAMPLER_FILTER_SHIFT = 0x0,
SAMPLER_FILTER_NEAREST = 0x1,
SAMPLER_FILTER_LINEAR = 0x2,
SAMPLER_FILTER_ANISO2X = 0x3,
SAMPLER_FILTER_ANISO4X = 0x4,
SAMPLER_FILTER_MASK = 0x7,
SAMPLER_MIPMAP_SHIFT = 0x3,
SAMPLER_MIPMAP_DISABLED = 0x0,
SAMPLER_MIPMAP_NEAREST = 0x8,
SAMPLER_MIPMAP_LINEAR = 0x10,
SAMPLER_MIPMAP_COUNT = 0x3,
SAMPLER_MIPMAP_MASK = 0x18,
SAMPLER_CLAMP_U_SHIFT = 0x5,
SAMPLER_CLAMP_V_SHIFT = 0x6,
SAMPLER_CLAMP_W_SHIFT = 0x7,
SAMPLER_CLAMP_U = 0x20,
SAMPLER_CLAMP_V = 0x40,
SAMPLER_CLAMP_W = 0x80,
SAMPLER_CLAMP_MASK = 0xE0,
};
struct MaterialTextureDefSamplerState
{
unsigned char filter : 3;
unsigned char mipMap : 2;
unsigned char clampU : 1;
unsigned char clampV : 1;
unsigned char clampW : 1;
};
#ifndef __zonecodegenerator
static_assert(sizeof(MaterialTextureDefSamplerState) == 1u);
#endif
struct MaterialTextureDef
{
unsigned int nameHash;
char nameStart;
char nameEnd;
unsigned char samplerState;
unsigned char semantic;
MaterialTextureDefSamplerState samplerState;
unsigned char semantic; // TextureSemantic
MaterialTextureDefInfo u;
};
@ -727,18 +826,161 @@ namespace IW5
{
unsigned int nameHash;
char name[12];
float literal[4];
vec4_t literal;
};
enum GfxBlend
{
GFXS_BLEND_DISABLED = 0x0,
GFXS_BLEND_ZERO = 0x1,
GFXS_BLEND_ONE = 0x2,
GFXS_BLEND_SRCCOLOR = 0x3,
GFXS_BLEND_INVSRCCOLOR = 0x4,
GFXS_BLEND_SRCALPHA = 0x5,
GFXS_BLEND_INVSRCALPHA = 0x6,
GFXS_BLEND_DESTALPHA = 0x7,
GFXS_BLEND_INVDESTALPHA = 0x8,
GFXS_BLEND_DESTCOLOR = 0x9,
GFXS_BLEND_INVDESTCOLOR = 0xA,
GFXS_BLEND_COUNT
};
enum GfxBlendOp
{
GFXS_BLENDOP_DISABLED = 0x0,
GFXS_BLENDOP_ADD = 0x1,
GFXS_BLENDOP_SUBTRACT = 0x2,
GFXS_BLENDOP_REVSUBTRACT = 0x3,
GFXS_BLENDOP_MIN = 0x4,
GFXS_BLENDOP_MAX = 0x5,
GFXS_BLENDOP_COUNT
};
enum GfxAlphaTest_e
{
GFXS_ALPHA_TEST_GT_0 = 1,
GFXS_ALPHA_TEST_LT_128 = 2,
GFXS_ALPHA_TEST_GE_128 = 3,
GFXS_ALPHA_TEST_COUNT
};
enum GfxCullFace_e
{
GFXS_CULL_NONE = 1,
GFXS_CULL_BACK = 2,
GFXS_CULL_FRONT = 3,
};
enum GfxDepthTest_e
{
GFXS_DEPTHTEST_ALWAYS = 0,
GFXS_DEPTHTEST_LESS = 1,
GFXS_DEPTHTEST_EQUAL = 2,
GFXS_DEPTHTEST_LESSEQUAL = 3
};
enum GfxPolygonOffset_e
{
GFXS_POLYGON_OFFSET_0 = 0,
GFXS_POLYGON_OFFSET_1 = 1,
GFXS_POLYGON_OFFSET_2 = 2,
GFXS_POLYGON_OFFSET_SHADOWMAP = 3
};
enum GfxStencilOp
{
GFXS_STENCILOP_KEEP = 0x0,
GFXS_STENCILOP_ZERO = 0x1,
GFXS_STENCILOP_REPLACE = 0x2,
GFXS_STENCILOP_INCRSAT = 0x3,
GFXS_STENCILOP_DECRSAT = 0x4,
GFXS_STENCILOP_INVERT = 0x5,
GFXS_STENCILOP_INCR = 0x6,
GFXS_STENCILOP_DECR = 0x7
};
enum GfxStencilFunc
{
GFXS_STENCILFUNC_NEVER = 0x0,
GFXS_STENCILFUNC_LESS = 0x1,
GFXS_STENCILFUNC_EQUAL = 0x2,
GFXS_STENCILFUNC_LESSEQUAL = 0x3,
GFXS_STENCILFUNC_GREATER = 0x4,
GFXS_STENCILFUNC_NOTEQUAL = 0x5,
GFXS_STENCILFUNC_GREATEREQUAL = 0x6,
GFXS_STENCILFUNC_ALWAYS = 0x7
};
struct GfxStateBitsLoadBitsStructured
{
// Byte 0
unsigned int srcBlendRgb : 4; // 0-3
unsigned int dstBlendRgb : 4; // 4-7
unsigned int blendOpRgb : 3; // 8-10
unsigned int alphaTestDisabled : 1; // 11
unsigned int alphaTest : 2; // 12-13
unsigned int cullFace : 2; // 14-15
unsigned int srcBlendAlpha : 4; // 16-19
unsigned int dstBlendAlpha : 4; // 20-23
unsigned int blendOpAlpha : 3; // 24-26
unsigned int colorWriteRgb : 1; // 27
unsigned int colorWriteAlpha : 1; // 28
unsigned int unused0 : 1; // 29
unsigned int gammaWrite : 1; // 30
unsigned int polymodeLine : 1; // 31
// Byte 1
unsigned int depthWrite : 1; // 0
unsigned int depthTestDisabled : 1; // 1
unsigned int depthTest : 2; // 2-3
unsigned int polygonOffset : 2; // 4-5
unsigned int stencilFrontEnabled : 1; // 6
unsigned int stencilBackEnabled : 1; // 7
unsigned int stencilFrontPass : 3; // 8-10
unsigned int stencilFrontFail : 3; // 11-13
unsigned int stencilFrontZFail : 3; // 14-16
unsigned int stencilFrontFunc : 3; // 17-19
unsigned int stencilBackPass : 3; // 20-22
unsigned int stencilBackFail : 3; // 23-25
unsigned int stencilBackZFail : 3; // 26-28
unsigned int stencilBackFunc : 3; // 29-31
};
union GfxStateBitsLoadBits
{
unsigned int raw[2];
GfxStateBitsLoadBitsStructured structured;
};
#ifndef __zonecodegenerator
static_assert(sizeof(GfxStateBitsLoadBits) == 8);
static_assert(sizeof(GfxStateBitsLoadBitsStructured) == 8);
#endif
struct GfxStateBits
{
unsigned int loadBits[2];
GfxStateBitsLoadBits loadBits;
};
enum GfxCameraRegionType
{
CAMERA_REGION_LIT_OPAQUE = 0x0,
CAMERA_REGION_LIT_TRANS = 0x1,
CAMERA_REGION_EMISSIVE = 0x2,
CAMERA_REGION_DEPTH_HACK = 0x3,
CAMERA_REGION_LIGHT_MAP_OPAQUE = 0x4,
CAMERA_REGION_COUNT,
CAMERA_REGION_NONE = CAMERA_REGION_COUNT,
};
struct Material
{
MaterialInfo info;
unsigned char stateBitsEntry[54];
char stateBitsEntry[54];
unsigned char textureCount;
unsigned char constantCount;
unsigned char stateBitsCount;
@ -901,9 +1143,6 @@ namespace IW5
// IDirect3DTexture9* map;
// IDirect3DVolumeTexture9* volmap;
// IDirect3DCubeTexture9* cubemap;
#ifndef __ida
Texture* texture;
#endif
GfxImageLoadDef* loadDef;
};
@ -3452,7 +3691,7 @@ namespace IW5
HITLOC_GUN = 0x12,
HITLOC_SHIELD = 0x13,
HITLOC_NUM
HITLOC_COUNT
};
enum materialSurfType_t
@ -3756,15 +3995,12 @@ namespace IW5
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char* accuracyGraphName[2];// TODO: Order is accuracyGraphName[0] -> originalAccuracyGraphKnots[0] -> accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
// vec2_t* originalAccuracyGraphKnots[2];
const char* accuracyGraphName0;
const char* accuracyGraphName1;
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
unsigned short originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
unsigned short originalAiVsAiAccuracyGraphKnotCount;
unsigned short originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
@ -4021,8 +4257,10 @@ namespace IW5
int ammoDropStockMax;
float adsDofStart;
float adsDofEnd;
unsigned short accuracyGraphKnotCount[2];
vec2_t* accuracyGraphKnots[2];
uint16_t aiVsAiAccuracyGraphKnotCount;
uint16_t aiVsPlayerAccuracyGraphKnotCount;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
bool motionTracker;
bool enhanced;
bool dpadIconShowsAmmo;
@ -4346,7 +4584,8 @@ namespace IW5
LBCOL_TYPE_BIGNUMBER = 0x4,
LBCOL_TYPE_PERCENT = 0x5,
LBCOL_TYPE_TIME_FULL = 0x6,
LBCOL_TYPE_COUNT = 0x7
LBCOL_TYPE_COUNT
};
enum LbAggType
@ -4355,7 +4594,8 @@ namespace IW5
LBAGG_TYPE_MAX = 0x1,
LBAGG_TYPE_SUM = 0x2,
LBAGG_TYPE_LAST = 0x3,
LBAGG_TYPE_COUNT = 0x4
LBAGG_TYPE_COUNT
};
struct LbColumnDef
@ -4377,7 +4617,22 @@ namespace IW5
LBUPDATE_TYPE_NORMAL = 0x0,
LBUPDATE_TYPE_RANK = 0x1,
LBUPDATE_TYPE_COMBINE = 0x2,
LBUPDATE_TYPE_COUNT = 0x3
LBUPDATE_TYPE_COUNT
};
enum LbTrackType
{
TRK_ALLTIME = 0x0,
TRK_WEEKLY = 0x1,
TRK_MONTHLY = 0x2,
TRK_PRESTIGE_ALLTIME = 0x3,
TRK_PRESTIGE_WEEKLY = 0x4,
TRK_PRESTIGE_MONTHLY = 0x5,
TRK_DAILY = 0x6,
TRK_PRESTIGE_DAILY = 0x7,
TRK_COUNT
};
struct LeaderboardDef
@ -4417,7 +4672,8 @@ namespace IW5
DATA_ENUM_ARRAY = 0x7,
DATA_FLOAT = 0x8,
DATA_SHORT = 0x9,
DATA_COUNT = 0xA
DATA_COUNT
};
union StructuredDataTypeUnion
@ -4444,7 +4700,8 @@ namespace IW5
VALIDATION_DELTACLAMP = 0x4,
VALIDATION_DELTASTRICT = 0x5,
VALIDATION_XP = 0x6,
VALIDATION_COUNT = 0x7
VALIDATION_COUNT
};
struct StructuredDataStructProperty

View File

@ -58,32 +58,32 @@ int Common::Com_HashString(const char* str, const int len)
return result;
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
return PackedTexCoords{pack32::Vec2PackTexCoordsVU(in)};
}
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
return PackedUnitVec{pack32::Vec3PackUnitVecScaleBased(in)};
}
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
return GfxColor{pack32::Vec4PackGfxColor(in)};
}
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float*>(out));
pack32::Vec2UnpackTexCoordsVU(in.packed, out);
}
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float*>(out));
pack32::Vec3UnpackUnitVecScaleBased(in.packed, out);
}
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
pack32::Vec4UnpackGfxColor(in.packed, out);
}

View File

@ -11,11 +11,11 @@ namespace T5
static int Com_HashString(const char* str);
static int Com_HashString(const char* str, int len);
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
};
} // namespace T5

View File

@ -1,29 +1,32 @@
#include "GameT5.h"
#include "T5.h"
#include <algorithm>
using namespace T5;
GameT5 g_GameT5;
std::string GameT5::GetFullName()
GameId Game::GetId() const
{
return "Call Of Duty: Black Ops";
return GameId::T5;
}
std::string GameT5::GetShortName()
const std::string& Game::GetFullName() const
{
return "T5";
static std::string fullName = "Call Of Duty: Black Ops";
return fullName;
}
void GameT5::AddZone(Zone* zone)
const std::string& Game::GetShortName() const
{
static std::string shortName = "T5";
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameT5::RemoveZone(Zone* zone)
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
@ -31,28 +34,28 @@ void GameT5::RemoveZone(Zone* zone)
m_zones.erase(foundEntry);
}
std::vector<Zone*> GameT5::GetZones()
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
std::vector<GameLanguagePrefix> GameT5::GetLanguagePrefixes()
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
std::vector<GameLanguagePrefix> prefixes;
prefixes.emplace_back(GameLanguage::LANGUAGE_ENGLISH, "en_");
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH, "fr_");
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH_CAN, "fc_");
prefixes.emplace_back(GameLanguage::LANGUAGE_GERMAN, "ge_");
prefixes.emplace_back(GameLanguage::LANGUAGE_AUSTRIAN, "ge_");
prefixes.emplace_back(GameLanguage::LANGUAGE_ITALIAN, "it_");
prefixes.emplace_back(GameLanguage::LANGUAGE_SPANISH, "sp_");
prefixes.emplace_back(GameLanguage::LANGUAGE_BRITISH, "br_");
prefixes.emplace_back(GameLanguage::LANGUAGE_RUSSIAN, "ru_");
prefixes.emplace_back(GameLanguage::LANGUAGE_POLISH, "po_");
prefixes.emplace_back(GameLanguage::LANGUAGE_KOREAN, "ko_");
prefixes.emplace_back(GameLanguage::LANGUAGE_JAPANESE, "ja_");
prefixes.emplace_back(GameLanguage::LANGUAGE_CZECH, "cz_");
static std::vector<GameLanguagePrefix> prefixes{
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
{GameLanguage::LANGUAGE_FRENCH, "fr_"},
{GameLanguage::LANGUAGE_FRENCH_CAN, "fc_"},
{GameLanguage::LANGUAGE_GERMAN, "ge_"},
{GameLanguage::LANGUAGE_AUSTRIAN, "ge_"},
{GameLanguage::LANGUAGE_ITALIAN, "it_"},
{GameLanguage::LANGUAGE_SPANISH, "sp_"},
{GameLanguage::LANGUAGE_BRITISH, "br_"},
{GameLanguage::LANGUAGE_RUSSIAN, "ru_"},
{GameLanguage::LANGUAGE_POLISH, "po_"},
{GameLanguage::LANGUAGE_KOREAN, "ko_"},
{GameLanguage::LANGUAGE_JAPANESE, "ja_"},
{GameLanguage::LANGUAGE_CZECH, "cz_"},
};
return prefixes;
}

View File

@ -1,17 +1,20 @@
#pragma once
#include "Game/IGame.h"
class GameT5 : public IGame
namespace T5
{
std::vector<Zone*> m_zones;
class Game final : public IGame
{
public:
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};
extern GameT5 g_GameT5;
private:
std::vector<Zone*> m_zones;
};
} // namespace T5

View File

@ -3,7 +3,7 @@
// clang-format off: Order of includes matters here
// #include <d3d9.h>
#include "Image/Texture.h"
#include "Game/IAsset.h"
#include "T5_Assets.h"
@ -114,4 +114,72 @@ namespace T5
CFT_NUM_FIELD_TYPES
};
using AssetPhysPreset = Asset<ASSET_TYPE_PHYSPRESET, PhysPreset>;
using AssetPhysConstraints = Asset<ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints>;
using AssetDestructibleDef = Asset<ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef>;
using AssetXAnim = Asset<ASSET_TYPE_XANIMPARTS, XAnimParts>;
using AssetXModel = Asset<ASSET_TYPE_XMODEL, XModel>;
using AssetMaterial = Asset<ASSET_TYPE_MATERIAL, Material>;
using AssetTechniqueSet = Asset<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>;
using AssetImage = Asset<ASSET_TYPE_IMAGE, GfxImage>;
using AssetSoundBank = Asset<ASSET_TYPE_SOUND, SndBank>;
using AssetSoundPatch = Asset<ASSET_TYPE_SOUND_PATCH, SndPatch>;
using AssetClipMap = Asset<ASSET_TYPE_CLIPMAP, clipMap_t>;
using AssetClipMapPvs = Asset<ASSET_TYPE_CLIPMAP_PVS, clipMap_t>;
using AssetComWorld = Asset<ASSET_TYPE_COMWORLD, ComWorld>;
using AssetGameWorldSp = Asset<ASSET_TYPE_GAMEWORLD_SP, GameWorldSp>;
using AssetGameWorldMp = Asset<ASSET_TYPE_GAMEWORLD_MP, GameWorldMp>;
using AssetMapEnts = Asset<ASSET_TYPE_MAP_ENTS, MapEnts>;
using AssetGfxWorld = Asset<ASSET_TYPE_GFXWORLD, GfxWorld>;
using AssetLightDef = Asset<ASSET_TYPE_LIGHT_DEF, GfxLightDef>;
using AssetFont = Asset<ASSET_TYPE_FONT, Font_s>;
using AssetMenuList = Asset<ASSET_TYPE_MENULIST, MenuList>;
using AssetMenu = Asset<ASSET_TYPE_MENU, menuDef_t>;
using AssetLocalize = Asset<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>;
using AssetWeapon = Asset<ASSET_TYPE_WEAPON, WeaponVariantDef>;
using AssetSoundDriverGlobals = Asset<ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals>;
using AssetFx = Asset<ASSET_TYPE_FX, FxEffectDef>;
using AssetImpactFx = Asset<ASSET_TYPE_IMPACT_FX, FxImpactTable>;
using AssetRawFile = Asset<ASSET_TYPE_RAWFILE, RawFile>;
using AssetStringTable = Asset<ASSET_TYPE_STRINGTABLE, StringTable>;
using AssetPackIndex = Asset<ASSET_TYPE_PACK_INDEX, PackIndex>;
using AssetXGlobals = Asset<ASSET_TYPE_XGLOBALS, XGlobals>;
using AssetDDL = Asset<ASSET_TYPE_DDL, ddlRoot_t>;
using AssetGlasses = Asset<ASSET_TYPE_GLASSES, Glasses>;
using AssetEmblemSet = Asset<ASSET_TYPE_EMBLEMSET, EmblemSet>;
} // namespace T5
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetPhysPreset, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetPhysConstraints, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetDestructibleDef, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetXAnim, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetXModel, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetMaterial, info.name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetTechniqueSet, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetImage, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetSoundBank, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetSoundPatch, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetClipMap, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetClipMapPvs, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetComWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetGameWorldSp, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetGameWorldMp, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetGfxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetLightDef, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetFont, fontName);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetMenuList, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetMenu, window.name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetLocalize, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetWeapon, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetSoundDriverGlobals, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetFx, name);
DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(T5::AssetImpactFx, "ImpactFx");
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetRawFile, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetStringTable, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetPackIndex, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetXGlobals, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetDDL, name);
DEFINE_ASSET_NAME_ACCESSOR(T5::AssetGlasses, name);
DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(T5::AssetEmblemSet, "EmblemSet");

View File

@ -108,9 +108,49 @@ namespace T5
MAX_XFILE_COUNT
};
typedef float vec2_t[2];
typedef float vec3_t[3];
typedef float vec4_t[4];
union vec2_t
{
float v[2];
struct
{
float x;
float y;
};
};
union vec3_t
{
struct
{
float x;
float y;
float z;
};
float v[3];
};
union vec4_t
{
float v[4];
struct
{
float x;
float y;
float z;
float w;
};
struct
{
float r;
float g;
float b;
float a;
};
};
union XAssetHeader
{
@ -166,10 +206,10 @@ namespace T5
typedef tdef_align(128) float float_align128;
typedef char cbrushedge_t;
typedef float vec2_t[2];
typedef float vec3_t[3];
typedef tdef_align(128) unsigned int raw_uint128;
typedef uint16_t ScriptString;
struct PhysPreset
{
const char* name;
@ -421,8 +461,8 @@ namespace T5
struct DObjAnimMat
{
float quat[4];
float trans[3];
vec4_t quat;
vec3_t trans;
float transWeight;
};
@ -452,7 +492,7 @@ namespace T5
struct type_align(16) GfxPackedVertex
{
float xyz[3];
vec3_t xyz;
float binormalSign;
GfxColor color;
PackedTexCoords texCoord;
@ -497,7 +537,12 @@ namespace T5
XSurfaceCollisionTree* collisionTree;
};
typedef tdef_align(16) uint16_t r_index16_t;
struct XSurfaceTri
{
uint16_t i[3];
};
typedef tdef_align(16) XSurfaceTri XSurfaceTri16;
struct XSurface
{
@ -508,7 +553,7 @@ namespace T5
uint16_t triCount;
uint16_t baseTriIndex;
uint16_t baseVertIndex;
r_index16_t (*triIndices)[3];
XSurfaceTri16* triIndices;
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
void /*IDirect3DVertexBuffer9*/* vb0;
@ -549,8 +594,8 @@ namespace T5
struct XBoneInfo
{
float bounds[2][3];
float offset[3];
vec3_t bounds[2];
vec3_t offset;
float radiusSquared;
char collmap;
};
@ -619,18 +664,31 @@ namespace T5
PhysGeomList* geomList;
};
enum XModelLodRampType : unsigned char
{
XMODEL_LOD_RAMP_RIGID = 0x0,
XMODEL_LOD_RAMP_SKINNED = 0x1,
XMODEL_LOD_RAMP_COUNT
};
struct XModelQuat
{
int16_t v[4];
};
struct XModel
{
const char* name;
unsigned char numBones;
unsigned char numRootBones;
unsigned char numsurfs;
char lodRampType;
uint16_t* boneNames;
char* parentList;
int16_t (*quats)[4];
float (*trans)[4];
char* partClassification;
XModelLodRampType lodRampType;
ScriptString* boneNames;
unsigned char* parentList;
XModelQuat* quats;
float* trans;
unsigned char* partClassification;
DObjAnimMat* baseMat;
XSurface* surfs;
Material** materialHandles;
@ -641,13 +699,13 @@ namespace T5
int contents;
XBoneInfo* boneInfo;
float radius;
float mins[3];
float maxs[3];
vec3_t mins;
vec3_t maxs;
uint16_t numLods;
uint16_t collLod;
int16_t collLod;
XModelStreamInfo streamInfo;
int memUsage;
int flags;
unsigned int flags;
bool bad;
PhysPreset* physPreset;
unsigned char numCollmaps;
@ -732,7 +790,7 @@ namespace T5
char nameStart;
char nameEnd;
char samplerState;
char semantic;
unsigned char semantic; // TextureSemantic
char isMatureContent;
char pad[3];
MaterialTextureDefInfo u;
@ -966,7 +1024,6 @@ namespace T5
// IDirect3DTexture9* map;
// IDirect3DVolumeTexture9* volmap;
// IDirect3DCubeTexture9* cubemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
@ -1254,7 +1311,7 @@ namespace T5
struct SndPatch
{
char* name;
const char* name;
unsigned int elementCount;
unsigned int* elements;
unsigned int fileCount;
@ -3288,7 +3345,7 @@ namespace T5
HITLOC_L_FOOT = 0x11,
HITLOC_GUN = 0x12,
HITLOC_NUM
HITLOC_COUNT
};
struct flameTable
@ -3861,20 +3918,16 @@ namespace T5
float fHipViewScatterMax;
float fightDist;
float maxDist;
// const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] ->
// accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// vec2_t *accuracyGraphKnots[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// vec2_t *originalAccuracyGraphKnots[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;

View File

@ -2,88 +2,61 @@
#include "Utils/Pack.h"
#include <cctype>
#include <algorithm>
#include <cmath>
using namespace T6;
int Common::Com_HashKey(const char* str, const int maxLen)
PackedTexCoords Common::Vec2PackTexCoords(const float (&in)[2])
{
if (str == nullptr)
return 0;
int hash = 0;
for (int i = 0; i < maxLen; i++)
{
if (str[i] == '\0')
break;
hash += str[i] * (0x77 + i);
}
return hash ^ ((hash ^ (hash >> 10)) >> 10);
return PackedTexCoords{pack32::Vec2PackTexCoordsUV(in)};
}
int Common::Com_HashString(const char* str)
PackedUnitVec Common::Vec3PackUnitVec(const float (&in)[3])
{
if (!str)
return 0;
auto result = 0x1505;
auto offset = 0;
while (str[offset])
{
const auto c = tolower(str[offset++]);
result = c + 33 * result;
}
return result;
return PackedUnitVec{pack32::Vec3PackUnitVecThirdBased(in)};
}
int Common::Com_HashString(const char* str, const int len)
GfxColor Common::Vec4PackGfxColor(const float (&in)[4])
{
if (!str)
return 0;
int result = 0x1505;
int offset = 0;
while (str[offset])
{
if (len > 0 && offset >= len)
break;
const int c = tolower(str[offset++]);
result = c + 33 * result;
}
return result;
return GfxColor{pack32::Vec4PackGfxColor(in)};
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2])
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(in->v)};
pack32::Vec2UnpackTexCoordsUV(in.packed, out);
}
PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3])
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(in->v)};
pack32::Vec3UnpackUnitVecThirdBased(in.packed, out);
}
GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
void Common::Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4])
{
return GfxColor{Pack32::Vec4PackGfxColor(in->v)};
pack32::Vec4UnpackGfxColor(in.packed, out);
}
void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
float Common::LinearToDbspl(const float linear)
{
Pack32::Vec2UnpackTexCoordsUV(in.packed, out->v);
const auto db = 20.0f * std::log10(std::max(linear, 0.0000152879f));
if (db > -95.0f)
return db + 100.0f;
return 0;
}
void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
float Common::DbsplToLinear(const float dbsplValue)
{
Pack32::Vec3UnpackUnitVecThirdBased(in.packed, out->v);
return std::pow(10.0f, (dbsplValue - 100.0f) / 20.0f);
}
void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
float Common::HertzToCents(const float hertz)
{
Pack32::Vec4UnpackGfxColor(in.packed, out->v);
return 1200.0f * std::log2(hertz);
}
float Common::CentsToHertz(const float cents)
{
return std::pow(2.0f, cents / 1200.0f);
}

View File

@ -2,14 +2,64 @@
#include "T6.h"
#include <cctype>
namespace T6
{
class Common
{
public:
static int Com_HashKey(const char* str, int maxLen);
static int Com_HashString(const char* str);
static int Com_HashString(const char* str, int len);
static constexpr int Com_HashKey(const char* str, const int maxLen)
{
if (str == nullptr)
return 0;
int hash = 0;
for (int i = 0; i < maxLen; i++)
{
if (str[i] == '\0')
break;
hash += str[i] * (0x77 + i);
}
return hash ^ ((hash ^ (hash >> 10)) >> 10);
}
static constexpr int Com_HashString(const char* str)
{
if (!str)
return 0;
auto result = 0x1505;
auto offset = 0;
while (str[offset])
{
const auto c = tolower(str[offset++]);
result = c + 33 * result;
}
return result;
}
static constexpr int Com_HashString(const char* str, const int len)
{
if (!str)
return 0;
int result = 0x1505;
int offset = 0;
while (str[offset])
{
if (len > 0 && offset >= len)
break;
const int c = tolower(str[offset++]);
result = c + 33 * result;
}
return result;
}
static constexpr uint32_t R_HashString(const char* str, uint32_t hash)
{
@ -21,6 +71,11 @@ namespace T6
return hash;
}
static constexpr uint32_t R_HashString(const char* string)
{
return R_HashString(string, 0u);
}
static constexpr uint32_t SND_HashName(const char* str)
{
if (!str || !*str)
@ -41,11 +96,15 @@ namespace T6
return result;
}
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
static PackedTexCoords Vec2PackTexCoords(const float (&in)[2]);
static PackedUnitVec Vec3PackUnitVec(const float (&in)[3]);
static GfxColor Vec4PackGfxColor(const float (&in)[4]);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, float (&out)[2]);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, float (&out)[3]);
static void Vec4UnpackGfxColor(const GfxColor& in, float (&out)[4]);
static float LinearToDbspl(const float linear);
static float DbsplToLinear(const float dbsplValue);
static float HertzToCents(const float hertz);
static float CentsToHertz(const float cents);
};
} // namespace T6

View File

@ -1,29 +1,32 @@
#include "GameT6.h"
#include "T6.h"
#include <algorithm>
using namespace T6;
GameT6 g_GameT6;
std::string GameT6::GetFullName()
GameId Game::GetId() const
{
return "Call Of Duty: Black Ops II";
return GameId::T6;
}
std::string GameT6::GetShortName()
const std::string& Game::GetFullName() const
{
return "T6";
static std::string fullName = "Call Of Duty: Black Ops II";
return fullName;
}
void GameT6::AddZone(Zone* zone)
const std::string& Game::GetShortName() const
{
static std::string shortName = "T6";
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameT6::RemoveZone(Zone* zone)
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
@ -31,31 +34,31 @@ void GameT6::RemoveZone(Zone* zone)
m_zones.erase(foundEntry);
}
std::vector<Zone*> GameT6::GetZones()
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
std::vector<GameLanguagePrefix> GameT6::GetLanguagePrefixes()
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
std::vector<GameLanguagePrefix> prefixes;
prefixes.emplace_back(GameLanguage::LANGUAGE_ENGLISH, "en_");
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH, "fr_");
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH_CAN, "fc_");
prefixes.emplace_back(GameLanguage::LANGUAGE_GERMAN, "ge_");
prefixes.emplace_back(GameLanguage::LANGUAGE_AUSTRIAN, "as_");
prefixes.emplace_back(GameLanguage::LANGUAGE_ITALIAN, "it_");
prefixes.emplace_back(GameLanguage::LANGUAGE_SPANISH, "sp_");
prefixes.emplace_back(GameLanguage::LANGUAGE_BRITISH, "br_");
prefixes.emplace_back(GameLanguage::LANGUAGE_RUSSIAN, "ru_");
prefixes.emplace_back(GameLanguage::LANGUAGE_POLISH, "po_");
prefixes.emplace_back(GameLanguage::LANGUAGE_KOREAN, "ko_");
prefixes.emplace_back(GameLanguage::LANGUAGE_JAPANESE, "ja_");
prefixes.emplace_back(GameLanguage::LANGUAGE_CZECH, "cz_");
prefixes.emplace_back(GameLanguage::LANGUAGE_FULL_JAPANESE, "fj_");
prefixes.emplace_back(GameLanguage::LANGUAGE_PORTUGUESE, "bp_");
prefixes.emplace_back(GameLanguage::LANGUAGE_MEXICAN_SPANISH, "ms_");
static std::vector<GameLanguagePrefix> prefixes{
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
{GameLanguage::LANGUAGE_FRENCH, "fr_"},
{GameLanguage::LANGUAGE_FRENCH_CAN, "fc_"},
{GameLanguage::LANGUAGE_GERMAN, "ge_"},
{GameLanguage::LANGUAGE_AUSTRIAN, "as_"},
{GameLanguage::LANGUAGE_ITALIAN, "it_"},
{GameLanguage::LANGUAGE_SPANISH, "sp_"},
{GameLanguage::LANGUAGE_BRITISH, "br_"},
{GameLanguage::LANGUAGE_RUSSIAN, "ru_"},
{GameLanguage::LANGUAGE_POLISH, "po_"},
{GameLanguage::LANGUAGE_KOREAN, "ko_"},
{GameLanguage::LANGUAGE_JAPANESE, "ja_"},
{GameLanguage::LANGUAGE_CZECH, "cz_"},
{GameLanguage::LANGUAGE_FULL_JAPANESE, "fj_"},
{GameLanguage::LANGUAGE_PORTUGUESE, "bp_"},
{GameLanguage::LANGUAGE_MEXICAN_SPANISH, "ms_"},
};
return prefixes;
}

View File

@ -1,17 +1,20 @@
#pragma once
#include "Game/IGame.h"
class GameT6 : public IGame
namespace T6
{
std::vector<Zone*> m_zones;
class Game final : public IGame
{
public:
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};
extern GameT6 g_GameT6;
private:
std::vector<Zone*> m_zones;
};
} // namespace T6

View File

@ -3,7 +3,7 @@
// clang-format off: Order of includes matters here
// #include <d3d11.h>
#include "Image/Texture.h"
#include "Game/IAsset.h"
#include "T6_Assets.h"
@ -159,4 +159,103 @@ namespace T6
AUFT_NUM_FIELD_TYPES,
};
using AssetPhysPreset = Asset<ASSET_TYPE_PHYSPRESET, PhysPreset>;
using AssetPhysConstraints = Asset<ASSET_TYPE_PHYSCONSTRAINTS, PhysConstraints>;
using AssetDestructibleDef = Asset<ASSET_TYPE_DESTRUCTIBLEDEF, DestructibleDef>;
using AssetXAnim = Asset<ASSET_TYPE_XANIMPARTS, XAnimParts>;
using AssetXModel = Asset<ASSET_TYPE_XMODEL, XModel>;
using AssetMaterial = Asset<ASSET_TYPE_MATERIAL, Material>;
using AssetTechniqueSet = Asset<ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet>;
using AssetImage = Asset<ASSET_TYPE_IMAGE, GfxImage>;
using AssetSoundBank = Asset<ASSET_TYPE_SOUND, SndBank>;
using AssetSoundPatch = Asset<ASSET_TYPE_SOUND_PATCH, SndPatch>;
using AssetClipMap = Asset<ASSET_TYPE_CLIPMAP, clipMap_t>;
using AssetClipMapPvs = Asset<ASSET_TYPE_CLIPMAP_PVS, clipMap_t>;
using AssetComWorld = Asset<ASSET_TYPE_COMWORLD, ComWorld>;
using AssetGameWorldSp = Asset<ASSET_TYPE_GAMEWORLD_SP, GameWorldSp>;
using AssetGameWorldMp = Asset<ASSET_TYPE_GAMEWORLD_MP, GameWorldMp>;
using AssetMapEnts = Asset<ASSET_TYPE_MAP_ENTS, MapEnts>;
using AssetGfxWorld = Asset<ASSET_TYPE_GFXWORLD, GfxWorld>;
using AssetLightDef = Asset<ASSET_TYPE_LIGHT_DEF, GfxLightDef>;
using AssetFont = Asset<ASSET_TYPE_FONT, Font_s>;
using AssetFontIcon = Asset<ASSET_TYPE_FONTICON, FontIcon>;
using AssetMenuList = Asset<ASSET_TYPE_MENULIST, MenuList>;
using AssetMenu = Asset<ASSET_TYPE_MENU, menuDef_t>;
using AssetLocalize = Asset<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>;
using AssetWeapon = Asset<ASSET_TYPE_WEAPON, WeaponVariantDef>;
using AssetAttachment = Asset<ASSET_TYPE_ATTACHMENT, WeaponAttachment>;
using AssetAttachmentUnique = Asset<ASSET_TYPE_ATTACHMENT_UNIQUE, WeaponAttachmentUnique>;
using AssetWeaponCamo = Asset<ASSET_TYPE_WEAPON_CAMO, WeaponCamo>;
using AssetSoundDriverGlobals = Asset<ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals>;
using AssetFx = Asset<ASSET_TYPE_FX, FxEffectDef>;
using AssetImpactFx = Asset<ASSET_TYPE_IMPACT_FX, FxImpactTable>;
using AssetRawFile = Asset<ASSET_TYPE_RAWFILE, RawFile>;
using AssetStringTable = Asset<ASSET_TYPE_STRINGTABLE, StringTable>;
using AssetLeaderboard = Asset<ASSET_TYPE_LEADERBOARD, LeaderboardDef>;
using AssetXGlobals = Asset<ASSET_TYPE_XGLOBALS, XGlobals>;
using AssetDDL = Asset<ASSET_TYPE_DDL, ddlRoot_t>;
using AssetGlasses = Asset<ASSET_TYPE_GLASSES, Glasses>;
using AssetEmblemSet = Asset<ASSET_TYPE_EMBLEMSET, EmblemSet>;
using AssetScript = Asset<ASSET_TYPE_SCRIPTPARSETREE, ScriptParseTree>;
using AssetKeyValuePairs = Asset<ASSET_TYPE_KEYVALUEPAIRS, KeyValuePairs>;
using AssetVehicle = Asset<ASSET_TYPE_VEHICLEDEF, VehicleDef>;
using AssetMemoryBlock = Asset<ASSET_TYPE_MEMORYBLOCK, MemoryBlock>;
using AssetAddonMapEnts = Asset<ASSET_TYPE_ADDON_MAP_ENTS, AddonMapEnts>;
using AssetTracer = Asset<ASSET_TYPE_TRACER, TracerDef>;
using AssetSkinnedVerts = Asset<ASSET_TYPE_SKINNEDVERTS, SkinnedVertsDef>;
using AssetQdb = Asset<ASSET_TYPE_QDB, Qdb>;
using AssetSlug = Asset<ASSET_TYPE_SLUG, Slug>;
using AssetFootstepTable = Asset<ASSET_TYPE_FOOTSTEP_TABLE, FootstepTableDef>;
using AssetFootstepFxTable = Asset<ASSET_TYPE_FOOTSTEPFX_TABLE, FootstepFXTableDef>;
using AssetZBarrier = Asset<ASSET_TYPE_ZBARRIER, ZBarrierDef>;
} // namespace T6
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetPhysPreset, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetPhysConstraints, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetDestructibleDef, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetXAnim, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetXModel, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetMaterial, info.name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetTechniqueSet, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetImage, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetSoundBank, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetSoundPatch, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetClipMap, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetClipMapPvs, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetComWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetGameWorldSp, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetGameWorldMp, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetGfxWorld, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetLightDef, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetFont, fontName);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetFontIcon, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetMenuList, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetMenu, window.name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetLocalize, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetWeapon, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetAttachment, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetAttachmentUnique, szInternalName);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetWeaponCamo, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetSoundDriverGlobals, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetFx, name);
DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(T6::AssetImpactFx, "ImpactFx");
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetRawFile, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetStringTable, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetLeaderboard, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetXGlobals, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetDDL, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetGlasses, name);
DEFINE_ASSET_NAME_ACCESSOR_SINGLETON(T6::AssetEmblemSet, "EmblemSet");
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetScript, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetKeyValuePairs, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetVehicle, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetMemoryBlock, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetAddonMapEnts, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetTracer, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetSkinnedVerts, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetQdb, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetSlug, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetFootstepTable, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetFootstepFxTable, name);
DEFINE_ASSET_NAME_ACCESSOR(T6::AssetZBarrier, name);

View File

@ -22,6 +22,8 @@ namespace T6
typedef tdef_align(128) float float_align128;
typedef uint16_t ScriptString;
struct dvar_t;
struct MenuCell;
struct cplane_s;
@ -588,7 +590,20 @@ namespace T6
float dist;
uint16_t numsurfs;
uint16_t surfIndex;
int partBits[5];
unsigned int partBits[5];
};
enum XModelLodRampType : unsigned char
{
XMODEL_LOD_RAMP_RIGID = 0x0,
XMODEL_LOD_RAMP_SKINNED = 0x1,
XMODEL_LOD_RAMP_COUNT
};
struct XModelQuat
{
int16_t v[4];
};
struct XModel
@ -597,12 +612,12 @@ namespace T6
unsigned char numBones;
unsigned char numRootBones;
unsigned char numsurfs;
char lodRampType;
uint16_t* boneNames;
XModelLodRampType lodRampType;
ScriptString* boneNames;
unsigned char* parentList;
uint16_t (*quats)[4];
float (*trans)[4];
char* partClassification;
XModelQuat* quats;
float* trans;
unsigned char* partClassification;
DObjAnimMat* baseMat;
XSurface* surfs;
Material** materialHandles;
@ -615,10 +630,10 @@ namespace T6
vec3_t mins;
vec3_t maxs;
uint16_t numLods;
uint16_t collLod;
int16_t collLod;
float* himipInvSqRadii;
int memUsage;
int flags;
unsigned int flags;
bool bad;
PhysPreset* physPreset;
unsigned char numCollmaps;
@ -833,7 +848,6 @@ namespace T6
union GfxTexture
{
void /*ID3D11ShaderResourceView*/* basemap;
Texture* texture;
GfxImageLoadDef* loadDef;
};
@ -1936,7 +1950,22 @@ namespace T6
LBUPDATE_TYPE_NORMAL = 0x0,
LBUPDATE_TYPE_RANK = 0x1,
LBUPDATE_TYPE_COMBINE = 0x2,
LBUPDATE_TYPE_COUNT = 0x3,
LBUPDATE_TYPE_COUNT
};
enum LbTrackType
{
TRK_ALLTIME = 0x0,
TRK_WEEKLY = 0x1,
TRK_MONTHLY = 0x2,
TRK_PRESTIGE_ALLTIME = 0x3,
TRK_PRESTIGE_WEEKLY = 0x4,
TRK_PRESTIGE_MONTHLY = 0x5,
TRK_DAILY = 0x6,
TRK_PRESTIGE_DAILY = 0x7,
TRK_COUNT
};
struct LeaderboardDef
@ -2085,7 +2114,7 @@ namespace T6
struct KeyValuePairs
{
const char* name;
int numVariables;
unsigned int numVariables;
KeyValuePair* keyValuePairs;
};
@ -2719,7 +2748,12 @@ namespace T6
float* tensionData;
};
typedef tdef_align(16) unsigned short r_index16_t;
struct XSurfaceTri
{
uint16_t i[3];
};
typedef tdef_align(16) XSurfaceTri XSurfaceTri16;
struct type_align(16) XSurface
{
@ -2729,13 +2763,13 @@ namespace T6
uint16_t vertCount;
uint16_t triCount;
uint16_t baseVertIndex;
r_index16_t(*triIndices)[3];
XSurfaceTri16* triIndices;
XSurfaceVertexInfo vertInfo;
GfxPackedVertex* verts0;
void /*ID3D11Buffer*/* vb0;
XRigidVertList* vertList;
void /*ID3D11Buffer*/* indexBuffer;
int partBits[5];
unsigned int partBits[5];
};
struct XModelCollSurf_s
@ -3780,7 +3814,8 @@ namespace T6
uint16_t dynEntId;
};
union gcc_align(8) __m128
// Usually __m128, but that is not portable
union gcc_align(8) custom_m128
{
float m128_f32[4];
uint64_t m128_u64[2];
@ -3793,19 +3828,12 @@ namespace T6
unsigned int m128_u32[4];
};
struct vector3
{
__m128 x;
__m128 y;
__m128 z;
};
struct vector4
{
__m128 x;
__m128 y;
__m128 z;
__m128 w;
custom_m128 x;
custom_m128 y;
custom_m128 z;
custom_m128 w;
};
struct type_align(16) SSkinInstance
@ -4299,7 +4327,8 @@ namespace T6
MISSILE_GUIDANCE_TVGUIDED = 0x6,
MISSILE_GUIDANCE_DRONE = 0x7,
MISSILE_GUIDANCE_HEATSEEKING = 0x8,
MISSILE_GUIDANCE_COUNT = 0x9,
MISSILE_GUIDANCE_COUNT
};
enum hitLocation_t
@ -4326,7 +4355,7 @@ namespace T6
HITLOC_GUN = 0x13,
HITLOC_SHIELD = 0x14,
HITLOC_NUM,
HITLOC_COUNT,
};
struct WeaponDef
@ -4835,20 +4864,16 @@ namespace T6
float fAntiQuickScopeSwayFactor;
float fightDist;
float maxDist;
// const char *accuracyGraphName[2]; // TODO: Order is accuracyGraphName[0] -> accuracyGraphKnots[0] -> originalAccuracyGraphKnots[0] ->
// accuracyGraphName[1] -> ...
// Which is currently not possible to do in code generation. Afaik this is the only place where this is the case.
// So might be something to fix but on the other hand it might be too much work for this little inconvenience.
const char* accuracyGraphName0;
const char* accuracyGraphName1;
// vec2_t *accuracyGraphKnots[2];
vec2_t* accuracyGraphKnots0;
vec2_t* accuracyGraphKnots1;
// vec2_t *originalAccuracyGraphKnots[2];
vec2_t* originalAccuracyGraphKnots0;
vec2_t* originalAccuracyGraphKnots1;
int accuracyGraphKnotCount[2];
int originalAccuracyGraphKnotCount[2];
const char* aiVsAiAccuracyGraphName;
const char* aiVsPlayerAccuracyGraphName;
vec2_t* aiVsAiAccuracyGraphKnots;
vec2_t* aiVsPlayerAccuracyGraphKnots;
vec2_t* originalAiVsAiAccuracyGraphKnots;
vec2_t* originalAiVsPlayerAccuracyGraphKnots;
int aiVsAiAccuracyGraphKnotCount;
int aiVsPlayerAccuracyGraphKnotCount;
int originalAiVsAiAccuracyGraphKnotCount;
int originalAiVsPlayerAccuracyGraphKnotCount;
int iPositionReloadTransTime;
float leftArc;
float rightArc;
@ -5538,8 +5563,8 @@ namespace T6
struct KeyValuePair
{
int keyHash;
int namespaceHash;
unsigned int keyHash;
unsigned int namespaceHash;
const char* value;
};
@ -6150,7 +6175,43 @@ namespace T6
SA_LOADED = 0x1,
SA_STREAMED = 0x2,
SA_PRIMED = 0x3,
SA_COUNT = 0x4,
SA_COUNT
};
enum SndLimitType
{
SND_LIMIT_NONE = 0x0,
SND_LIMIT_OLDEST = 0x1,
SND_LIMIT_REJECT = 0x2,
SND_LIMIT_PRIORITY = 0x3,
SND_LIMIT_COUNT
};
enum SndBus
{
SND_BUS_REVERB = 0x0,
SND_BUS_FX = 0x1,
SND_BUS_VOICE = 0x2,
SND_BUS_PFUTZ = 0x3,
SND_BUS_HDRFX = 0x4,
SND_BUS_UI = 0x5,
SND_BUS_MUSIC = 0x6,
SND_BUS_MOVIE = 0x7,
SND_BUS_REFERENCE = 0x8,
SND_BUS_COUNT
};
enum SndRandomizeType
{
SND_RANDOMIZE_INSTANCE = 0x0,
SND_RANDOMIZE_ENTITY_VOLUME = 0x1,
SND_RANDOMIZE_ENTITY_PITCH = 0x2,
SND_RANDOMIZE_ENTITY_VARIANT = 0x4,
SND_RANDOMIZE_ENTITY_COUNT
};
struct SndAliasFlags
@ -6163,7 +6224,7 @@ namespace T6
unsigned int isBig : 1; // 4
unsigned int pauseable : 1; // 5
unsigned int isMusic : 1; // 6
unsigned int stopOnDeath : 1; // 7
unsigned int stopOnEntDeath : 1; // 7
unsigned int timescale : 1; // 8
unsigned int voiceLimit : 1; // 9
unsigned int ignoreMaxDist : 1; // 10
@ -6182,7 +6243,9 @@ namespace T6
unsigned int reverbFalloffCurve : 6; // 8-13
unsigned int volumeMinFalloffCurve : 6; // 14-19
unsigned int reverbMinFalloffCurve : 6; // 20-25
unsigned int unknown1_1 : 6; // 26-31
unsigned int unknown1_1 : 1; // 26
unsigned int isCinematic : 1; // 27
unsigned int unknown1_2 : 4; // 28-31
};
struct SndAlias
@ -6190,7 +6253,7 @@ namespace T6
const char* name;
unsigned int id;
const char* subtitle;
const char* secondaryname;
const char* secondaryName;
unsigned int assetId;
const char* assetFileName;
SndAliasFlags flags;
@ -6216,16 +6279,16 @@ namespace T6
int16_t fadeIn;
int16_t fadeOut;
int16_t dopplerScale;
char minPriorityThreshold;
char maxPriorityThreshold;
char probability;
char occlusionLevel;
char minPriority;
char maxPriority;
char pan;
char limitCount;
char entityLimitCount;
char duckGroup;
uint8_t minPriorityThreshold;
uint8_t maxPriorityThreshold;
uint8_t probability;
uint8_t occlusionLevel;
uint8_t minPriority;
uint8_t maxPriority;
uint8_t pan;
uint8_t limitCount;
uint8_t entityLimitCount;
uint8_t duckGroup;
};
#ifndef __zonecodegenerator

View File

@ -1,127 +0,0 @@
#pragma once
#include "ImageFormat.h"
#include <cstdint>
enum class TextureType
{
T_2D,
T_CUBE,
T_3D
};
class Texture
{
protected:
const ImageFormat* m_format;
bool m_has_mip_maps;
uint8_t* m_data;
Texture(const ImageFormat* format, bool mipMaps);
Texture(Texture&& other) noexcept;
Texture& operator=(Texture&& other) noexcept;
public:
Texture(const Texture& other) = delete;
virtual ~Texture();
Texture& operator=(const Texture& other) = delete;
virtual TextureType GetTextureType() const = 0;
const ImageFormat* GetFormat() const;
virtual unsigned GetWidth() const = 0;
virtual unsigned GetHeight() const = 0;
virtual unsigned GetDepth() const = 0;
virtual int GetFaceCount() const = 0;
void Allocate();
bool Empty() const;
virtual size_t GetSizeOfMipLevel(int mipLevel) const = 0;
virtual uint8_t* GetBufferForMipLevel(int mipLevel, int face) = 0;
uint8_t* GetBufferForMipLevel(int mipLevel);
bool HasMipMaps() const;
virtual int GetMipMapCount() const = 0;
};
class Texture2D : public Texture
{
protected:
unsigned m_width;
unsigned m_height;
public:
Texture2D(const ImageFormat* format, unsigned width, unsigned height);
Texture2D(const ImageFormat* format, unsigned width, unsigned height, bool mipMaps);
Texture2D(const Texture2D& other) = delete;
Texture2D(Texture2D&& other) noexcept;
~Texture2D() override;
Texture2D& operator=(const Texture2D& other) = delete;
Texture2D& operator=(Texture2D&& other) noexcept;
TextureType GetTextureType() const override;
unsigned GetWidth() const override;
unsigned GetHeight() const override;
unsigned GetDepth() const override;
int GetFaceCount() const override;
size_t GetSizeOfMipLevel(int mipLevel) const override;
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
int GetMipMapCount() const override;
};
class TextureCube final : public Texture2D
{
static const int FACE_COUNT;
public:
TextureCube(const ImageFormat* format, unsigned width, unsigned height);
TextureCube(const ImageFormat* format, unsigned width, unsigned height, bool mipMaps);
TextureCube(const TextureCube& other) = delete;
TextureCube(TextureCube&& other) noexcept;
~TextureCube() override;
TextureCube& operator=(const TextureCube& other) = delete;
TextureCube& operator=(TextureCube&& other) noexcept;
TextureType GetTextureType() const override;
int GetFaceCount() const override;
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
};
class Texture3D final : public Texture
{
unsigned m_width;
unsigned m_height;
unsigned m_depth;
public:
Texture3D(const ImageFormat* format, unsigned width, unsigned height, unsigned depth);
Texture3D(const ImageFormat* format, unsigned width, unsigned height, unsigned depth, bool mipMaps);
Texture3D(const Texture3D& other) = delete;
Texture3D(Texture3D&& other) noexcept;
~Texture3D() override;
Texture3D& operator=(const Texture3D& other) = delete;
Texture3D& operator=(Texture3D&& other) noexcept;
TextureType GetTextureType() const override;
unsigned GetWidth() const override;
unsigned GetHeight() const override;
unsigned GetDepth() const override;
int GetFaceCount() const override;
size_t GetSizeOfMipLevel(int mipLevel) const override;
uint8_t* GetBufferForMipLevel(int mipLevel, int face) override;
int GetMipMapCount() const override;
};

View File

@ -17,7 +17,28 @@ float HalfFloat::ToFloat(const half_float_t half)
return 0.0f;
}
half_float_t HalfFloat::ToHalf(float f)
half_float_t HalfFloat::ToHalf(const float f)
{
return 0;
half_float_t v3;
int v6;
union
{
uint32_t u;
float f;
} result{};
result.f = f;
if (static_cast<int>((2 * result.u) ^ 0x80000000) >> 14 < 0x3FFF)
v6 = static_cast<int>((2 * result.u) ^ 0x80000000) >> 14;
else
v6 = 0x3FFF;
if (v6 > -16384)
v3 = static_cast<half_float_t>(v6);
else
v3 = 0xC000;
return (v3 & 0x3FFFu) | ((result.u >> 16) & 0xC000u);
}

View File

@ -4,6 +4,8 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
union PackUtil32
{
@ -14,70 +16,146 @@ union PackUtil32
uint8_t uc[4];
};
uint32_t Pack32::Vec2PackTexCoords(const float* in)
namespace pack32
{
return static_cast<uint32_t>(HalfFloat::ToHalf(in[0])) << 16 | HalfFloat::ToHalf(in[1]);
}
typedef float pvec3[3];
uint32_t Pack32::Vec3PackUnitVec(const float* in)
{
// TODO
return 0;
}
uint32_t Vec2PackTexCoordsUV(const float (&in)[2])
{
return static_cast<uint32_t>(HalfFloat::ToHalf(in[1])) << 16 | HalfFloat::ToHalf(in[0]);
}
uint32_t Pack32::Vec4PackGfxColor(const float* in)
{
return static_cast<uint8_t>(std::clamp(in[0], 0.0f, 1.0f) * 255.0f) | static_cast<uint8_t>(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8
| static_cast<uint8_t>(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16 | static_cast<uint8_t>(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24;
}
uint32_t Vec2PackTexCoordsVU(const float (&in)[2])
{
return static_cast<uint32_t>(HalfFloat::ToHalf(in[0])) << 16 | HalfFloat::ToHalf(in[1]);
}
void Pack32::Vec2UnpackTexCoordsUV(const uint32_t in, float* out)
{
const auto inHiDw = static_cast<half_float_t>((in >> 16) & UINT16_MAX);
const auto inLoDw = static_cast<half_float_t>(in & UINT16_MAX);
float Vec3_Normalize(pvec3& vector)
{
float length = std::sqrt(vector[0] * vector[0] + vector[1] * vector[1] + vector[2] * vector[2]);
if (-length >= 0.0f)
length = 1.0f;
const auto lengthInv = 1.0f / length;
vector[0] = lengthInv * vector[0];
vector[1] = lengthInv * vector[1];
vector[2] = lengthInv * vector[2];
return length;
}
out[0] = HalfFloat::ToFloat(inLoDw);
out[1] = HalfFloat::ToFloat(inHiDw);
}
uint32_t Vec3PackUnitVecScaleBased(const float (&in)[3])
{
PackUtil32 testEncoding{};
float normalized[3]{in[0], in[1], in[2]};
float decoded[3];
void Pack32::Vec2UnpackTexCoordsVU(const uint32_t in, float* out)
{
const auto inHiDw = static_cast<half_float_t>((in >> 16) & UINT16_MAX);
const auto inLoDw = static_cast<half_float_t>(in & UINT16_MAX);
Vec3_Normalize(normalized);
uint32_t out = 0u;
auto bestDirError = 3.4028235e38f;
auto bestLenError = 3.4028235e38f;
testEncoding.uc[3] = 0u;
do
{
const auto encodeScale = 32385.0f / (static_cast<float>(testEncoding.uc[3]) - -192.0f);
testEncoding.c[0] = static_cast<int8_t>(normalized[0] * encodeScale + 127.5f);
testEncoding.c[1] = static_cast<int8_t>(normalized[1] * encodeScale + 127.5f);
testEncoding.c[2] = static_cast<int8_t>(normalized[2] * encodeScale + 127.5f);
const auto decodeScale = (static_cast<float>(testEncoding.uc[3]) - -192.0f) / 32385.0f;
decoded[0] = (static_cast<float>(testEncoding.uc[0]) - 127.0f) * decodeScale;
decoded[1] = (static_cast<float>(testEncoding.uc[1]) - 127.0f) * decodeScale;
decoded[2] = (static_cast<float>(testEncoding.uc[2]) - 127.0f) * decodeScale;
const auto v2 = Vec3_Normalize(decoded) - 1.0f;
const auto lenError = std::abs(v2);
if (lenError < 0.001f)
{
const auto dirError = std::abs(decoded[0] * normalized[0] + decoded[1] * normalized[1] + decoded[2] * normalized[2] - 1.0f);
if (bestDirError > dirError || bestDirError <= dirError && bestLenError > lenError)
{
bestDirError = dirError;
bestLenError = lenError;
out = testEncoding.u;
if (lenError + dirError == 0.0f)
return out;
}
}
++testEncoding.c[3];
} while (testEncoding.c[3]);
out[0] = HalfFloat::ToFloat(inHiDw);
out[1] = HalfFloat::ToFloat(inLoDw);
}
return out;
}
void Pack32::Vec3UnpackUnitVecScaleBased(const uint32_t in, float* out)
{
assert(out != nullptr);
uint32_t Vec3PackUnitVecThirdBased(const float (&in)[3])
{
// This is based on the game's reversed code, the original code may have made a bit more sense
PackUtil32 x;
x.f = (in[0] - -24624.0939334638f) * 0.0001218318939208984f;
PackUtil32 y;
y.f = (in[1] - -24624.0939334638f) * 0.0001218318939208984f;
PackUtil32 z;
z.f = (in[2] - -24624.0939334638f) * 0.0001218318939208984f;
PackUtil32 _in{in};
const float decodeScale = (static_cast<float>(_in.uc[3]) - -192.0f) / 32385.0f;
out[0] = (static_cast<float>(_in.uc[0]) + -127.0f) * decodeScale;
out[1] = (static_cast<float>(_in.uc[1]) + -127.0f) * decodeScale;
out[2] = (static_cast<float>(_in.uc[2]) + -127.0f) * decodeScale;
}
return (x.u & 0x3FF) | (y.u & 0x3FF) << 10u | (z.u & 0x3FF) << 20u;
}
void Pack32::Vec3UnpackUnitVecThirdBased(const uint32_t in, float* out)
{
PackUtil32 v0{(in >> 0) & 0x3FF};
PackUtil32 v1{(in >> 10) & 0x3FF};
PackUtil32 v2{(in >> 20) & 0x3FF};
uint32_t Vec4PackGfxColor(const float (&in)[4])
{
// clang-format off
return static_cast<uint8_t>(std::clamp(in[0], 0.0f, 1.0f) * 255.0f)
| static_cast<uint8_t>(std::clamp(in[1], 0.0f, 1.0f) * 255.0f) << 8
| static_cast<uint8_t>(std::clamp(in[2], 0.0f, 1.0f) * 255.0f) << 16
| static_cast<uint8_t>(std::clamp(in[3], 0.0f, 1.0f) * 255.0f) << 24;
// clang-format on
}
v0.u = v0.u - 2 * (v0.u & 0x200) + 0x40400000;
v1.u = v1.u - 2 * (v1.u & 0x200) + 0x40400000;
v2.u = v2.u - 2 * (v2.u & 0x200) + 0x40400000;
out[0] = (v0.f - 3.0f) * 8208.0312f;
out[1] = (v1.f - 3.0f) * 8208.0312f;
out[2] = (v2.f - 3.0f) * 8208.0312f;
}
void Vec2UnpackTexCoordsUV(const uint32_t in, float (&out)[2])
{
const auto inHiDw = static_cast<half_float_t>((in >> 16) & std::numeric_limits<uint16_t>::max());
const auto inLoDw = static_cast<half_float_t>(in & std::numeric_limits<uint16_t>::max());
void Pack32::Vec4UnpackGfxColor(uint32_t in, float* out)
{
out[0] = static_cast<float>(in & UINT8_MAX) / 255.0f;
out[1] = static_cast<float>((in >> 8) & UINT8_MAX) / 255.0f;
out[2] = static_cast<float>((in >> 16) & UINT8_MAX) / 255.0f;
out[3] = static_cast<float>((in >> 24) & UINT8_MAX) / 255.0f;
}
out[0] = HalfFloat::ToFloat(inLoDw);
out[1] = HalfFloat::ToFloat(inHiDw);
}
void Vec2UnpackTexCoordsVU(const uint32_t in, float (&out)[2])
{
const auto inHiDw = static_cast<half_float_t>((in >> 16) & std::numeric_limits<uint16_t>::max());
const auto inLoDw = static_cast<half_float_t>(in & std::numeric_limits<uint16_t>::max());
out[0] = HalfFloat::ToFloat(inHiDw);
out[1] = HalfFloat::ToFloat(inLoDw);
}
void Vec3UnpackUnitVecScaleBased(const uint32_t in, float (&out)[3])
{
assert(out != nullptr);
const PackUtil32 inUtil{in};
const float decodeScale = (static_cast<float>(inUtil.uc[3]) - -192.0f) / 32385.0f;
out[0] = (static_cast<float>(inUtil.uc[0]) + -127.0f) * decodeScale;
out[1] = (static_cast<float>(inUtil.uc[1]) + -127.0f) * decodeScale;
out[2] = (static_cast<float>(inUtil.uc[2]) + -127.0f) * decodeScale;
}
void Vec3UnpackUnitVecThirdBased(const uint32_t in, float (&out)[3])
{
// This is based on the game's reversed code, the original code may have made a bit more sense
PackUtil32 v0{(in >> 0) & 0x3FF};
PackUtil32 v1{(in >> 10) & 0x3FF};
PackUtil32 v2{(in >> 20) & 0x3FF};
v0.u = v0.u - 2 * (v0.u & 0x200) + 0x40400000;
v1.u = v1.u - 2 * (v1.u & 0x200) + 0x40400000;
v2.u = v2.u - 2 * (v2.u & 0x200) + 0x40400000;
out[0] = (v0.f - 3.0f) * 8208.0312f;
out[1] = (v1.f - 3.0f) * 8208.0312f;
out[2] = (v2.f - 3.0f) * 8208.0312f;
}
void Vec4UnpackGfxColor(const uint32_t in, float (&out)[4])
{
out[0] = static_cast<float>(in & std::numeric_limits<uint8_t>::max()) / 255.0f;
out[1] = static_cast<float>((in >> 8) & std::numeric_limits<uint8_t>::max()) / 255.0f;
out[2] = static_cast<float>((in >> 16) & std::numeric_limits<uint8_t>::max()) / 255.0f;
out[3] = static_cast<float>((in >> 24) & std::numeric_limits<uint8_t>::max()) / 255.0f;
}
} // namespace pack32

View File

@ -2,17 +2,17 @@
#include <cstdint>
class Pack32
namespace pack32
{
Pack32() = default;
uint32_t Vec2PackTexCoordsUV(const float (&in)[2]);
uint32_t Vec2PackTexCoordsVU(const float (&in)[2]);
uint32_t Vec3PackUnitVecScaleBased(const float (&in)[3]);
uint32_t Vec3PackUnitVecThirdBased(const float (&in)[3]);
uint32_t Vec4PackGfxColor(const float (&in)[4]);
public:
static uint32_t Vec2PackTexCoords(const float* in);
static uint32_t Vec3PackUnitVec(const float* in);
static uint32_t Vec4PackGfxColor(const float* in);
static void Vec2UnpackTexCoordsUV(uint32_t in, float* out);
static void Vec2UnpackTexCoordsVU(uint32_t in, float* out);
static void Vec3UnpackUnitVecScaleBased(uint32_t in, float* out);
static void Vec3UnpackUnitVecThirdBased(uint32_t in, float* out);
static void Vec4UnpackGfxColor(uint32_t in, float* out);
};
void Vec2UnpackTexCoordsUV(uint32_t in, float (&out)[2]);
void Vec2UnpackTexCoordsVU(uint32_t in, float (&out)[2]);
void Vec3UnpackUnitVecScaleBased(uint32_t in, float (&out)[3]);
void Vec3UnpackUnitVecThirdBased(uint32_t in, float (&out)[3]);
void Vec4UnpackGfxColor(uint32_t in, float (&out)[4]);
}; // namespace pack32

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <limits>
struct ZoneHeader
{
@ -7,21 +8,11 @@ struct ZoneHeader
uint32_t m_version;
};
#ifdef ARCH_x64
typedef uint32_t scr_string_t;
typedef uint64_t xchunk_size_t;
typedef uint64_t xblock_size_t;
typedef uint64_t zone_pointer_t;
constexpr uint16_t SCR_STRING_MAX = UINT32_MAX;
#elif ARCH_x86
typedef uint16_t scr_string_t;
typedef uint32_t xchunk_size_t;
typedef uint32_t xblock_size_t;
typedef uint32_t zone_pointer_t;
constexpr uint16_t SCR_STRING_MAX = UINT16_MAX;
#endif
constexpr uint16_t SCR_STRING_MAX = std::numeric_limits<scr_string_t>::max();
typedef int block_t;
typedef int asset_type_t;

View File

@ -0,0 +1,70 @@
#include "Base64.h"
#define LTC_NO_PROTOTYPES
#include <tomcrypt.h>
namespace base64
{
std::string EncodeBase64(const void* inputData, const size_t inputLength)
{
const auto base64BufferSize = GetBase64EncodeOutputLength(inputLength);
std::string output(base64BufferSize, '\0');
const auto outLength = base64BufferSize + 1u;
const auto result = EncodeBase64(inputData, inputLength, output.data(), outLength);
assert(result);
return output;
}
bool EncodeBase64(const void* inputData, const size_t inputLength, void* outputBuffer, const size_t outputBufferSize)
{
unsigned long outLength = outputBufferSize;
const auto result = base64_encode(static_cast<const unsigned char*>(inputData), inputLength, static_cast<char*>(outputBuffer), &outLength);
return result == CRYPT_OK;
}
size_t GetBase64EncodeOutputLength(const size_t inputLength)
{
return 4u * ((inputLength + 2u) / 3u);
}
size_t DecodeBase64(const void* base64Data, const size_t inputLength, void* outputBuffer, const size_t outputBufferSize)
{
unsigned long outLength = GetBase64DecodeOutputLength(base64Data, inputLength);
assert(outLength <= outputBufferSize);
if (outLength > outputBufferSize)
return 0u;
const auto result = base64_decode(static_cast<const char*>(base64Data), inputLength, static_cast<unsigned char*>(outputBuffer), &outLength);
assert(result == CRYPT_OK);
return static_cast<size_t>(outLength);
}
size_t GetBase64DecodeOutputLength(const void* base64Data, const size_t inputLength)
{
assert(base64Data);
assert(inputLength);
if (!base64Data || inputLength == 0u)
return 0u;
auto padding = 0u;
if (inputLength >= 1 && static_cast<const char*>(base64Data)[inputLength - 1] == '=')
{
if (inputLength >= 2 && static_cast<const char*>(base64Data)[inputLength - 2] == '=')
padding = 2u;
else
padding = 1u;
}
return ((inputLength / 4u) * 3u) - padding;
}
size_t GetBase64DecodeOutputLength(const size_t inputLength)
{
return (inputLength / 4u) * 3u;
}
} // namespace base64

13
src/Crypto/Impl/Base64.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#include <string>
namespace base64
{
std::string EncodeBase64(const void* inputData, size_t inputLength);
bool EncodeBase64(const void* inputData, size_t inputLength, void* outputBuffer, size_t outputBufferSize);
size_t GetBase64EncodeOutputLength(size_t inputLength);
size_t DecodeBase64(const void* base64Data, size_t inputLength, void* outputBuffer, size_t outputBufferSize);
size_t GetBase64DecodeOutputLength(const void* base64Data, const size_t inputLength);
size_t GetBase64DecodeOutputLength(size_t inputLength);
} // namespace base64

48
src/ImageConverter.lua Normal file
View File

@ -0,0 +1,48 @@
ImageConverter = {}
function ImageConverter:include(includes)
if includes:handle(self:name()) then
includedirs {
path.join(ProjectFolder(), "ImageConverter")
}
end
end
function ImageConverter:link(links)
end
function ImageConverter:use()
dependson(self:name())
end
function ImageConverter:name()
return "ImageConverter"
end
function ImageConverter:project()
local folder = ProjectFolder()
local includes = Includes:create()
local links = Links:create()
project(self:name())
targetdir(TargetDirectoryBin)
location "%{wks.location}/src/%{prj.name}"
kind "ConsoleApp"
language "C++"
files {
path.join(folder, "ImageConverter/**.h"),
path.join(folder, "ImageConverter/**.cpp")
}
self:include(includes)
Utils:include(includes)
ObjImage:include(includes)
Raw:use()
links:linkto(Utils)
links:linkto(ObjImage)
links:linkall()
end

View File

@ -0,0 +1,202 @@
#include "ImageConverter.h"
#include "Image/DdsLoader.h"
#include "Image/DdsWriter.h"
#include "Image/IwiLoader.h"
#include "Image/IwiWriter13.h"
#include "Image/IwiWriter27.h"
#include "Image/IwiWriter6.h"
#include "Image/IwiWriter8.h"
#include "Image/Texture.h"
#include "ImageConverterArgs.h"
#include "Utils/StringUtils.h"
#include <assert.h>
#include <filesystem>
#include <format>
#include <fstream>
#include <iostream>
namespace fs = std::filesystem;
namespace image_converter
{
constexpr auto EXTENSION_IWI = ".iwi";
constexpr auto EXTENSION_DDS = ".dds";
class ImageConverterImpl final : public ImageConverter
{
public:
ImageConverterImpl()
: m_game_to_convert_to(image_converter::Game::UNKNOWN)
{
}
bool Start(const int argc, const char** argv) override
{
auto shouldContinue = true;
if (!m_args.ParseArgs(argc, argv, shouldContinue))
return false;
if (!shouldContinue)
return true;
m_game_to_convert_to = m_args.m_game_to_convert_to;
for (const auto& file : m_args.m_files_to_convert)
Convert(file);
return true;
}
private:
void Convert(const std::string& file)
{
const fs::path filePath(file);
auto extension = filePath.extension().string();
utils::MakeStringLowerCase(extension);
if (extension == EXTENSION_IWI)
ConvertIwi(filePath);
else if (extension == EXTENSION_DDS)
ConvertDds(filePath);
else
std::cerr << std::format("Unsupported extension {}\n", extension);
}
bool ConvertIwi(const fs::path& iwiPath)
{
std::ifstream file(iwiPath, std::ios::in | std::ios::binary);
if (!file.is_open())
{
std::cerr << std::format("Failed to open input file {}\n", iwiPath.string());
return false;
}
const auto texture = iwi::LoadIwi(file);
if (!texture)
return false;
auto outPath = iwiPath;
outPath.replace_extension(".dds");
std::ofstream outFile(outPath, std::ios::out | std::ios::binary);
if (!outFile.is_open())
{
std::cerr << std::format("Failed to open output file {}\n", outPath.string());
return false;
}
m_dds_writer.DumpImage(outFile, texture.get());
return true;
}
bool ConvertDds(const fs::path& ddsPath)
{
std::ifstream file(ddsPath, std::ios::in | std::ios::binary);
if (!file.is_open())
{
std::cerr << std::format("Failed to open input file {}\n", ddsPath.string());
return false;
}
const auto texture = dds::LoadDds(file);
if (!texture)
return false;
if (!EnsureIwiWriterIsPresent())
return false;
auto outPath = ddsPath;
outPath.replace_extension(".iwi");
std::ofstream outFile(outPath, std::ios::out | std::ios::binary);
if (!outFile.is_open())
{
std::cerr << std::format("Failed to open output file {}\n", outPath.string());
return false;
}
m_iwi_writer->DumpImage(outFile, texture.get());
return true;
}
bool EnsureIwiWriterIsPresent()
{
if (m_iwi_writer)
return true;
if (m_game_to_convert_to == Game::UNKNOWN && !ShowGameTui())
return false;
switch (m_game_to_convert_to)
{
case Game::IW3:
m_iwi_writer = std::make_unique<iwi6::IwiWriter>();
break;
case Game::IW4:
case Game::IW5:
m_iwi_writer = std::make_unique<iwi8::IwiWriter>();
break;
case Game::T5:
m_iwi_writer = std::make_unique<iwi13::IwiWriter>();
break;
case Game::T6:
m_iwi_writer = std::make_unique<iwi27::IwiWriter>();
break;
default:
assert(false);
return false;
}
return true;
}
bool ShowGameTui()
{
std::cout << "Select the game to convert to:\n";
std::cout << " 1 - Call Of Duty 4: Modern Warfare (IW3)\n";
std::cout << " 2 - Call Of Duty: Modern Warfare 2 (IW4)\n";
std::cout << " 3 - Call Of Duty: Modern Warfare 3 (IW5)\n";
std::cout << " 4 - Call Of Duty: Black Ops (T5)\n";
std::cout << " 5 - Call Of Duty: Black Ops 2 (T6)\n";
unsigned num;
std::cin >> num;
switch (num)
{
case 1:
m_game_to_convert_to = Game::IW3;
break;
case 2:
m_game_to_convert_to = Game::IW4;
break;
case 3:
m_game_to_convert_to = Game::IW5;
break;
case 4:
m_game_to_convert_to = Game::T5;
break;
case 5:
m_game_to_convert_to = Game::T6;
break;
default:
std::cerr << "Invalid input\n";
return false;
}
return true;
}
ImageConverterArgs m_args;
image_converter::Game m_game_to_convert_to;
DdsWriter m_dds_writer;
std::unique_ptr<IImageWriter> m_iwi_writer;
};
} // namespace image_converter
std::unique_ptr<ImageConverter> ImageConverter::Create()
{
return std::make_unique<image_converter::ImageConverterImpl>();
}

View File

@ -0,0 +1,24 @@
#pragma once
#include <memory>
class ImageConverter
{
public:
ImageConverter() = default;
virtual ~ImageConverter() = default;
ImageConverter(const ImageConverter& other) = delete;
ImageConverter(ImageConverter&& other) noexcept = delete;
ImageConverter& operator=(const ImageConverter& other) = delete;
ImageConverter& operator=(ImageConverter&& other) noexcept = delete;
/**
* \brief Starts the ImageConverter application logic.
* \param argc The amount of command line arguments specified.
* \param argv The command line arguments.
* \return \c true if the application was successful or \c false if an error occurred.
*/
virtual bool Start(int argc, const char** argv) = 0;
static std::unique_ptr<ImageConverter> Create();
};

View File

@ -0,0 +1,149 @@
#include "ImageConverterArgs.h"
#include "GitVersion.h"
#include "Utils/Arguments/UsageInformation.h"
#include <format>
#include <iostream>
#include <type_traits>
// clang-format off
const CommandLineOption* const OPTION_HELP =
CommandLineOption::Builder::Create()
.WithShortName("?")
.WithLongName("help")
.WithDescription("Displays usage information.")
.Build();
const CommandLineOption* const OPTION_VERSION =
CommandLineOption::Builder::Create()
.WithLongName("version")
.WithDescription("Prints the application version.")
.Build();
const CommandLineOption* const OPTION_VERBOSE =
CommandLineOption::Builder::Create()
.WithShortName("v")
.WithLongName("verbose")
.WithDescription("Outputs a lot more and more detailed messages.")
.Build();
constexpr auto CATEGORY_GAME = "Game";
const CommandLineOption* const OPTION_GAME_IW3 =
CommandLineOption::Builder::Create()
.WithLongName("iw3")
.WithCategory(CATEGORY_GAME)
.WithDescription("Converts images for IW3.")
.Build();
const CommandLineOption* const OPTION_GAME_IW4 =
CommandLineOption::Builder::Create()
.WithLongName("iw4")
.WithCategory(CATEGORY_GAME)
.WithDescription("Converts images for IW4.")
.Build();
const CommandLineOption* const OPTION_GAME_IW5 =
CommandLineOption::Builder::Create()
.WithLongName("iw5")
.WithCategory(CATEGORY_GAME)
.WithDescription("Converts images for IW5.")
.Build();
const CommandLineOption* const OPTION_GAME_T5 =
CommandLineOption::Builder::Create()
.WithLongName("t5")
.WithCategory(CATEGORY_GAME)
.WithDescription("Converts images for T5.")
.Build();
const CommandLineOption* const OPTION_GAME_T6 =
CommandLineOption::Builder::Create()
.WithLongName("t6")
.WithCategory(CATEGORY_GAME)
.WithDescription("Converts images for T6.")
.Build();
// clang-format on
const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_HELP,
OPTION_VERSION,
OPTION_VERBOSE,
OPTION_GAME_IW3,
OPTION_GAME_IW4,
OPTION_GAME_IW5,
OPTION_GAME_T5,
OPTION_GAME_T6,
};
ImageConverterArgs::ImageConverterArgs()
: m_verbose(false),
m_game_to_convert_to(image_converter::Game::UNKNOWN),
m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
{
}
void ImageConverterArgs::PrintUsage()
{
UsageInformation usage("ImageConverter.exe");
for (const auto* commandLineOption : COMMAND_LINE_OPTIONS)
{
usage.AddCommandLineOption(commandLineOption);
}
usage.AddArgument("fileToConvert");
usage.SetVariableArguments(true);
usage.Print();
}
void ImageConverterArgs::PrintVersion()
{
std::cout << std::format("OpenAssetTools ImageConverter {}\n", GIT_VERSION);
}
void ImageConverterArgs::SetVerbose(const bool isVerbose)
{
m_verbose = isVerbose;
}
bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;
}
// Check if the user requested help
if (m_argument_parser.IsOptionSpecified(OPTION_HELP))
{
PrintUsage();
shouldContinue = false;
return true;
}
// Check if the user wants to see the version
if (m_argument_parser.IsOptionSpecified(OPTION_VERSION))
{
PrintVersion();
shouldContinue = false;
return true;
}
m_files_to_convert = m_argument_parser.GetArguments();
if (m_files_to_convert.empty())
{
// No files to convert specified...
PrintUsage();
return false;
}
// -v; --verbose
SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE));
return true;
}

View File

@ -0,0 +1,42 @@
#pragma once
#include "Utils/Arguments/ArgumentParser.h"
#include <cstdint>
#include <string>
#include <vector>
namespace image_converter
{
enum class Game : std::uint8_t
{
UNKNOWN,
IW3,
IW4,
IW5,
T5,
T6
};
} // namespace image_converter
class ImageConverterArgs
{
public:
ImageConverterArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);
bool m_verbose;
std::vector<std::string> m_files_to_convert;
image_converter::Game m_game_to_convert_to;
private:
/**
* \brief Prints a command line usage help text for the ImageConverter tool to stdout.
*/
static void PrintUsage();
static void PrintVersion();
void SetVerbose(bool isVerbose);
ArgumentParser m_argument_parser;
};

View File

@ -0,0 +1,8 @@
#include "ImageConverter.h"
int main(const int argc, const char** argv)
{
const auto imageConverter = ImageConverter::Create();
return imageConverter->Start(argc, argv) ? 0 : 1;
}

View File

@ -39,6 +39,7 @@ function Linker:project()
self:include(includes)
Utils:include(includes)
ZoneLoading:include(includes)
ObjCompiling:include(includes)
ObjLoading:include(includes)
ObjWriting:include(includes)
ZoneWriting:include(includes)
@ -46,6 +47,7 @@ function Linker:project()
Raw:use()
links:linkto(Utils)
links:linkto(ObjCompiling)
links:linkto(ZoneLoading)
links:linkto(ZoneWriting)
links:linkto(ObjLoading)

View File

@ -1,98 +0,0 @@
#include "ZoneCreatorIW3.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Game/IW3/GameAssetPoolIW3.h"
#include "Game/IW3/GameIW3.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW3;
ZoneCreator::ZoneCreator()
{
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
{
AddAssetTypeName(assetType, GameAssetPoolIW3::AssetTypeNameByType(assetType));
}
}
void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
{
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
return false;
}
ignoredAssetMap[ignoreEntry.m_name] = foundAssetTypeEntry->second;
}
return true;
}
void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
{
zone->m_pools = std::make_unique<GameAssetPoolIW3>(zone, zone->m_priority);
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
zone->m_pools->InitPoolDynamic(assetType);
}
bool ZoneCreator::SupportsGame(const std::string& gameName) const
{
return gameName == g_GameIW3.GetShortName();
}
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
{
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW3);
CreateZoneAssetPools(zone.get());
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
if (!CreateIgnoredAssetMap(context, assetLoadingContext->m_ignored_asset_map))
return nullptr;
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
return nullptr;
}
if (!ObjLoading::LoadAssetForZone(assetLoadingContext.get(), foundAssetTypeEntry->second, assetEntry.m_asset_name))
return nullptr;
}
ObjLoading::FinalizeAssetsForZone(assetLoadingContext.get());
return zone;
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW3
{
class ZoneCreator final : public IZoneCreator
{
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;
void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
public:
ZoneCreator();
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
} // namespace IW3

View File

@ -1,97 +0,0 @@
#include "ZoneCreatorIW4.h"
#include "Game/IW4/GameAssetPoolIW4.h"
#include "Game/IW4/GameIW4.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW4;
ZoneCreator::ZoneCreator()
{
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
{
AddAssetTypeName(assetType, GameAssetPoolIW4::AssetTypeNameByType(assetType));
}
}
void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
{
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
return false;
}
ignoredAssetMap[ignoreEntry.m_name] = foundAssetTypeEntry->second;
}
return true;
}
void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
{
zone->m_pools = std::make_unique<GameAssetPoolIW4>(zone, zone->m_priority);
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
zone->m_pools->InitPoolDynamic(assetType);
}
bool ZoneCreator::SupportsGame(const std::string& gameName) const
{
return gameName == g_GameIW4.GetShortName();
}
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
{
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW4);
CreateZoneAssetPools(zone.get());
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
if (!CreateIgnoredAssetMap(context, assetLoadingContext->m_ignored_asset_map))
return nullptr;
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
return nullptr;
}
if (!ObjLoading::LoadAssetForZone(assetLoadingContext.get(), foundAssetTypeEntry->second, assetEntry.m_asset_name))
return nullptr;
}
ObjLoading::FinalizeAssetsForZone(assetLoadingContext.get());
return zone;
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW4
{
class ZoneCreator final : public IZoneCreator
{
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;
void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
public:
ZoneCreator();
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
} // namespace IW4

View File

@ -1,97 +0,0 @@
#include "ZoneCreatorIW5.h"
#include "Game/IW5/GameAssetPoolIW5.h"
#include "Game/IW5/GameIW5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace IW5;
ZoneCreator::ZoneCreator()
{
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
{
AddAssetTypeName(assetType, GameAssetPoolIW5::AssetTypeNameByType(assetType));
}
}
void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
{
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
return false;
}
ignoredAssetMap[ignoreEntry.m_name] = foundAssetTypeEntry->second;
}
return true;
}
void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
{
zone->m_pools = std::make_unique<GameAssetPoolIW5>(zone, zone->m_priority);
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
zone->m_pools->InitPoolDynamic(assetType);
}
bool ZoneCreator::SupportsGame(const std::string& gameName) const
{
return gameName == g_GameIW5.GetShortName();
}
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
{
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW5);
CreateZoneAssetPools(zone.get());
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
if (!CreateIgnoredAssetMap(context, assetLoadingContext->m_ignored_asset_map))
return nullptr;
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
return nullptr;
}
if (!ObjLoading::LoadAssetForZone(assetLoadingContext.get(), foundAssetTypeEntry->second, assetEntry.m_asset_name))
return nullptr;
}
ObjLoading::FinalizeAssetsForZone(assetLoadingContext.get());
return zone;
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace IW5
{
class ZoneCreator final : public IZoneCreator
{
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;
void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
public:
ZoneCreator();
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
} // namespace IW5

View File

@ -1,98 +0,0 @@
#include "ZoneCreatorT5.h"
#include "AssetLoading/AssetLoadingContext.h"
#include "Game/T5/GameAssetPoolT5.h"
#include "Game/T5/GameT5.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T5;
ZoneCreator::ZoneCreator()
{
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
{
AddAssetTypeName(assetType, GameAssetPoolT5::AssetTypeNameByType(assetType));
}
}
void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
{
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}
std::vector<Gdt*> ZoneCreator::CreateGdtList(ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
return false;
}
ignoredAssetMap[ignoreEntry.m_name] = foundAssetTypeEntry->second;
}
return true;
}
void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
{
zone->m_pools = std::make_unique<GameAssetPoolT5>(zone, zone->m_priority);
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
zone->m_pools->InitPoolDynamic(assetType);
}
bool ZoneCreator::SupportsGame(const std::string& gameName) const
{
return gameName == g_GameT5.GetShortName();
}
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
{
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameT5);
CreateZoneAssetPools(zone.get());
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
if (!CreateIgnoredAssetMap(context, assetLoadingContext->m_ignored_asset_map))
return nullptr;
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
return nullptr;
}
if (!ObjLoading::LoadAssetForZone(assetLoadingContext.get(), foundAssetTypeEntry->second, assetEntry.m_asset_name))
return nullptr;
}
ObjLoading::FinalizeAssetsForZone(assetLoadingContext.get());
return zone;
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T5
{
class ZoneCreator final : public IZoneCreator
{
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;
void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
public:
ZoneCreator();
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
} // namespace T5

View File

@ -1,149 +0,0 @@
#include "ZoneCreatorT6.h"
#include "Game/T6/CommonT6.h"
#include "Game/T6/GameAssetPoolT6.h"
#include "Game/T6/GameT6.h"
#include "Game/T6/T6.h"
#include "ObjLoading.h"
#include <iostream>
using namespace T6;
ZoneCreator::ZoneCreator()
{
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
{
AddAssetTypeName(assetType, GameAssetPoolT6::AssetTypeNameByType(assetType));
}
}
void ZoneCreator::AddAssetTypeName(asset_type_t assetType, std::string name)
{
m_asset_types_by_name.emplace(std::make_pair(std::move(name), assetType));
}
std::vector<Gdt*> ZoneCreator::CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
bool ZoneCreator::CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const
{
for (const auto& ignoreEntry : context.m_ignored_assets.m_entries)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(ignoreEntry.m_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << ignoreEntry.m_type << "\" for ignore \"" << ignoreEntry.m_name << "\"\n";
return false;
}
ignoredAssetMap[ignoreEntry.m_name] = foundAssetTypeEntry->second;
}
return true;
}
void ZoneCreator::CreateZoneAssetPools(Zone* zone) const
{
zone->m_pools = std::make_unique<GameAssetPoolT6>(zone, zone->m_priority);
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
zone->m_pools->InitPoolDynamic(assetType);
}
void ZoneCreator::HandleMetadata(Zone* zone, const ZoneCreationContext& context) const
{
std::vector<KeyValuePair> kvpList;
for (const auto& metaData : context.m_definition->m_metadata)
{
if (metaData->m_key.rfind("level.", 0) == 0)
{
const std::string strValue = metaData->m_key.substr(std::char_traits<char>::length("level."));
if (strValue.empty())
continue;
int keyHash;
if (strValue[0] == '@')
{
char* endPtr;
keyHash = strtol(&strValue[1], &endPtr, 16);
if (endPtr != &strValue[strValue.size()])
{
std::cout << "Could not parse metadata key \"" << metaData->m_key << "\" as hash\n";
continue;
}
}
else
{
keyHash = Common::Com_HashKey(strValue.c_str(), 64);
}
KeyValuePair kvp{keyHash, Common::Com_HashKey(zone->m_name.c_str(), 64), zone->GetMemory()->Dup(metaData->m_value.c_str())};
kvpList.push_back(kvp);
}
}
if (!kvpList.empty())
{
auto* kvps = zone->GetMemory()->Create<KeyValuePairs>();
kvps->name = zone->GetMemory()->Dup(zone->m_name.c_str());
kvps->numVariables = kvpList.size();
kvps->keyValuePairs = static_cast<KeyValuePair*>(zone->GetMemory()->Alloc(sizeof(KeyValuePair) * kvpList.size()));
for (auto i = 0u; i < kvpList.size(); i++)
kvps->keyValuePairs[i] = kvpList[i];
zone->m_pools->AddAsset(std::make_unique<XAssetInfo<KeyValuePairs>>(ASSET_TYPE_KEYVALUEPAIRS, zone->m_name, kvps));
}
}
bool ZoneCreator::SupportsGame(const std::string& gameName) const
{
return gameName == g_GameT6.GetShortName();
}
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
{
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameT6);
CreateZoneAssetPools(zone.get());
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
const auto assetLoadingContext = std::make_unique<AssetLoadingContext>(zone.get(), context.m_asset_search_path, CreateGdtList(context));
if (!CreateIgnoredAssetMap(context, assetLoadingContext->m_ignored_asset_map))
return nullptr;
HandleMetadata(zone.get(), context);
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto foundAssetTypeEntry = m_asset_types_by_name.find(assetEntry.m_asset_type);
if (foundAssetTypeEntry == m_asset_types_by_name.end())
{
std::cout << "Unknown asset type \"" << assetEntry.m_asset_type << "\"\n";
return nullptr;
}
if (!ObjLoading::LoadAssetForZone(assetLoadingContext.get(), foundAssetTypeEntry->second, assetEntry.m_asset_name))
return nullptr;
}
ObjLoading::FinalizeAssetsForZone(assetLoadingContext.get());
return zone;
}

View File

@ -1,26 +0,0 @@
#pragma once
#include "Zone/ZoneTypes.h"
#include "ZoneCreation/IZoneCreator.h"
#include <string>
#include <unordered_map>
namespace T6
{
class ZoneCreator final : public IZoneCreator
{
std::unordered_map<std::string, asset_type_t> m_asset_types_by_name;
void AddAssetTypeName(asset_type_t assetType, std::string name);
static std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context);
bool CreateIgnoredAssetMap(const ZoneCreationContext& context, std::unordered_map<std::string, asset_type_t>& ignoredAssetMap) const;
void CreateZoneAssetPools(Zone* zone) const;
void HandleMetadata(Zone* zone, const ZoneCreationContext& context) const;
public:
ZoneCreator();
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
};
} // namespace T6

View File

@ -1,149 +1,211 @@
#include "Linker.h"
#include "Game/IW3/ZoneCreatorIW3.h"
#include "Game/IW4/ZoneCreatorIW4.h"
#include "Game/IW5/ZoneCreatorIW5.h"
#include "Game/T5/ZoneCreatorT5.h"
#include "Game/T6/ZoneCreatorT6.h"
#include "LinkerArgs.h"
#include "LinkerSearchPaths.h"
#include "ObjContainer/IPak/IPakWriter.h"
#include "ObjContainer/IWD/IWD.h"
#include "LinkerPaths.h"
#include "ObjContainer/SoundBank/SoundBankWriter.h"
#include "ObjLoading.h"
#include "ObjWriting.h"
#include "SearchPath/OutputPathFilesystem.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Utils/ObjFileStream.h"
#include "Utils/StringUtils.h"
#include "Zone/AssetList/AssetList.h"
#include "Zone/AssetList/AssetListStream.h"
#include "Zone/AssetList/AssetListReader.h"
#include "Zone/Definition/ZoneDefinitionStream.h"
#include "ZoneCreation/IZoneCreator.h"
#include "ZoneCreation/ZoneCreationContext.h"
#include "ZoneCreation/ZoneCreator.h"
#include "ZoneLoading.h"
#include "ZoneWriting.h"
#include <deque>
#include <filesystem>
#include <format>
#include <fstream>
#include <regex>
#include <set>
#include <unordered_set>
namespace fs = std::filesystem;
const IZoneCreator* const ZONE_CREATORS[]{
new IW3::ZoneCreator(),
new IW4::ZoneCreator(),
new IW5::ZoneCreator(),
new T5::ZoneCreator(),
new T6::ZoneCreator(),
};
enum class ProjectType
namespace
{
NONE,
FASTFILE,
IPAK,
class LinkerSearchPathContext
{
public:
explicit LinkerSearchPathContext(const ILinkerSearchPathBuilder& searchPathBuilder)
: m_search_path_builder(searchPathBuilder)
{
m_independent_search_paths = m_search_path_builder.BuildIndependentSearchPaths();
if (m_independent_search_paths)
m_search_paths.IncludeSearchPath(m_independent_search_paths.get());
}
MAX
};
[[nodiscard]] ISearchPath& GetSearchPaths()
{
return m_search_paths;
}
constexpr const char* PROJECT_TYPE_NAMES[static_cast<unsigned>(ProjectType::MAX)]{
"none",
"fastfile",
"ipak",
};
void LoadProjectSpecific(const std::string& projectName)
{
m_project_specific_search_paths = m_search_path_builder.BuildSearchPathsSpecificToProject(projectName);
if (m_project_specific_search_paths)
m_search_paths.IncludeSearchPath(m_project_specific_search_paths.get());
}
void UnloadProjectSpecific()
{
if (!m_project_specific_search_paths)
return;
m_search_paths.RemoveSearchPath(m_project_specific_search_paths.get());
m_project_specific_search_paths.reset();
}
void LoadGameSpecific(const std::string& projectName, const GameId game)
{
m_game_specific_search_paths = m_search_path_builder.BuildSearchPathsSpecificToProjectAndGame(projectName, game);
if (m_game_specific_search_paths)
m_search_paths.IncludeSearchPath(m_game_specific_search_paths.get());
}
void UnloadGameSpecific()
{
if (!m_game_specific_search_paths)
return;
m_search_paths.RemoveSearchPath(m_game_specific_search_paths.get());
m_game_specific_search_paths.reset();
}
private:
const ILinkerSearchPathBuilder& m_search_path_builder;
std::unique_ptr<ISearchPath> m_independent_search_paths;
std::unique_ptr<ISearchPath> m_project_specific_search_paths;
std::unique_ptr<ISearchPath> m_game_specific_search_paths;
SearchPaths m_search_paths;
};
class LinkerPathManager
{
public:
explicit LinkerPathManager(const LinkerArgs& args)
: m_linker_paths(ILinkerPaths::FromArgs(args)),
m_asset_paths(m_linker_paths->AssetSearchPaths()),
m_gdt_paths(m_linker_paths->GdtSearchPaths()),
m_source_paths(m_linker_paths->SourceSearchPaths())
{
}
std::unique_ptr<ILinkerPaths> m_linker_paths;
LinkerSearchPathContext m_asset_paths;
LinkerSearchPathContext m_gdt_paths;
LinkerSearchPathContext m_source_paths;
};
class PathProjectContext
{
public:
PathProjectContext(LinkerPathManager& paths, const std::string& projectName)
: m_paths(paths)
{
m_paths.m_asset_paths.LoadProjectSpecific(projectName);
m_paths.m_gdt_paths.LoadProjectSpecific(projectName);
m_paths.m_source_paths.LoadProjectSpecific(projectName);
}
~PathProjectContext()
{
m_paths.m_asset_paths.UnloadProjectSpecific();
m_paths.m_gdt_paths.UnloadProjectSpecific();
m_paths.m_source_paths.UnloadProjectSpecific();
}
PathProjectContext(const PathProjectContext& other) = delete;
PathProjectContext(PathProjectContext&& other) noexcept = delete;
PathProjectContext& operator=(const PathProjectContext& other) = delete;
PathProjectContext& operator=(PathProjectContext&& other) noexcept = delete;
private:
LinkerPathManager& m_paths;
};
class PathGameContext
{
public:
PathGameContext(LinkerPathManager& paths, const std::string& projectName, const GameId game)
: m_paths(paths)
{
m_paths.m_asset_paths.LoadGameSpecific(projectName, game);
m_paths.m_gdt_paths.LoadGameSpecific(projectName, game);
m_paths.m_source_paths.LoadGameSpecific(projectName, game);
}
~PathGameContext()
{
m_paths.m_asset_paths.UnloadGameSpecific();
m_paths.m_gdt_paths.UnloadGameSpecific();
m_paths.m_source_paths.UnloadGameSpecific();
}
PathGameContext(const PathGameContext& other) = delete;
PathGameContext(PathGameContext&& other) noexcept = delete;
PathGameContext& operator=(const PathGameContext& other) = delete;
PathGameContext& operator=(PathGameContext&& other) noexcept = delete;
private:
LinkerPathManager& m_paths;
};
} // namespace
class LinkerImpl final : public Linker
{
static constexpr const char* METADATA_GAME = "game";
static constexpr const char* METADATA_GDT = "gdt";
static constexpr const char* METADATA_NAME = "name";
static constexpr const char* METADATA_TYPE = "type";
LinkerArgs m_args;
LinkerSearchPaths m_search_paths;
std::vector<std::unique_ptr<Zone>> m_loaded_zones;
bool IncludeAdditionalZoneDefinitions(const std::string& initialFileName, ZoneDefinition& zoneDefinition, ISearchPath* sourceSearchPath) const
std::unique_ptr<ZoneDefinition> ReadZoneDefinition(LinkerPathManager& paths, const std::string& targetName, bool logMissing = true) const
{
std::set<std::string> sourceNames;
sourceNames.emplace(initialFileName);
std::deque<std::string> toIncludeQueue;
for (const auto& include : zoneDefinition.m_includes)
toIncludeQueue.emplace_back(include);
while (!toIncludeQueue.empty())
auto& sourceSearchPath = paths.m_source_paths.GetSearchPaths();
std::unique_ptr<ZoneDefinition> zoneDefinition;
{
const auto& source = toIncludeQueue.front();
if (sourceNames.find(source) == sourceNames.end())
const auto definitionFileName = std::format("{}.zone", targetName);
const auto definitionStream = sourceSearchPath.Open(definitionFileName);
if (!definitionStream.IsOpen())
{
sourceNames.emplace(source);
std::unique_ptr<ZoneDefinition> includeDefinition;
{
const auto definitionFileName = source + ".zone";
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
if (!definitionStream.IsOpen())
{
std::cout << "Could not find zone definition file for project \"" << source << "\".\n";
return false;
}
ZoneDefinitionInputStream zoneDefinitionInputStream(*definitionStream.m_stream, definitionFileName, m_args.m_verbose);
includeDefinition = zoneDefinitionInputStream.ReadDefinition();
}
if (!includeDefinition)
{
std::cout << "Failed to read zone definition file for project \"" << source << "\".\n";
return false;
}
for (const auto& include : includeDefinition->m_includes)
toIncludeQueue.emplace_back(include);
zoneDefinition.Include(*includeDefinition);
if (logMissing)
std::cerr << std::format("Could not find zone definition file for target \"{}\".\n", targetName);
return nullptr;
}
toIncludeQueue.pop_front();
ZoneDefinitionInputStream zoneDefinitionInputStream(*definitionStream.m_stream, targetName, definitionFileName, sourceSearchPath);
zoneDefinition = zoneDefinitionInputStream.ReadDefinition();
}
return true;
if (!zoneDefinition)
{
std::cerr << std::format("Failed to read zone definition file for target \"{}\".\n", targetName);
return nullptr;
}
return zoneDefinition;
}
bool ReadAssetList(const std::string& zoneName, AssetList& assetList, ISearchPath* sourceSearchPath) const
bool ReadIgnoreEntries(LinkerPathManager& paths, const std::string& zoneName, const GameId game, AssetList& assetList) const
{
{
const auto assetListFileName = "assetlist/" + zoneName + ".csv";
const auto assetListStream = sourceSearchPath->Open(assetListFileName);
if (assetListStream.IsOpen())
AssetListReader assetListReader(paths.m_source_paths.GetSearchPaths(), game);
const auto maybeReadAssetList = assetListReader.ReadAssetList(zoneName, false);
if (maybeReadAssetList)
{
const AssetListInputStream stream(*assetListStream.m_stream);
AssetListEntry entry;
while (stream.NextEntry(entry))
{
assetList.m_entries.reserve(assetList.m_entries.size() + maybeReadAssetList->m_entries.size());
for (auto& entry : maybeReadAssetList->m_entries)
assetList.m_entries.emplace_back(std::move(entry));
}
return true;
}
}
{
const auto zoneDefinition = ReadZoneDefinition(zoneName, sourceSearchPath);
const auto zoneDefinition = ReadZoneDefinition(paths, zoneName, false);
if (zoneDefinition)
{
assetList.m_entries.reserve(assetList.m_entries.size() + zoneDefinition->m_assets.size());
for (const auto& entry : zoneDefinition->m_assets)
{
assetList.m_entries.emplace_back(entry.m_asset_type, entry.m_asset_name, entry.m_is_reference);
}
return true;
}
}
@ -151,203 +213,33 @@ class LinkerImpl final : public Linker
return false;
}
bool IncludeAssetLists(ZoneDefinition& zoneDefinition, ISearchPath* sourceSearchPath) const
{
for (const auto& assetListName : zoneDefinition.m_asset_lists)
{
AssetList assetList;
if (!ReadAssetList(assetListName, assetList, sourceSearchPath))
{
std::cerr << "Failed to read asset list \"" << assetListName << "\"\n";
return false;
}
zoneDefinition.Include(assetList);
}
return true;
}
static bool GetNameFromZoneDefinition(std::string& name, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{
auto firstNameEntry = true;
const auto [rangeBegin, rangeEnd] = zoneDefinition.m_metadata_lookup.equal_range(METADATA_NAME);
for (auto i = rangeBegin; i != rangeEnd; ++i)
{
if (firstNameEntry)
{
name = i->second->m_value;
firstNameEntry = false;
}
else
{
if (name != i->second->m_value)
{
std::cout << "Conflicting names in target \"" << targetName << "\": " << name << " != " << i->second << "\n";
return false;
}
}
}
if (firstNameEntry)
name = targetName;
return true;
}
std::unique_ptr<ZoneDefinition> ReadZoneDefinition(const std::string& targetName, ISearchPath* sourceSearchPath) const
{
std::unique_ptr<ZoneDefinition> zoneDefinition;
{
const auto definitionFileName = targetName + ".zone";
const auto definitionStream = sourceSearchPath->Open(definitionFileName);
if (!definitionStream.IsOpen())
{
std::cout << "Could not find zone definition file for target \"" << targetName << "\".\n";
return nullptr;
}
ZoneDefinitionInputStream zoneDefinitionInputStream(*definitionStream.m_stream, definitionFileName, m_args.m_verbose);
zoneDefinition = zoneDefinitionInputStream.ReadDefinition();
}
if (!zoneDefinition)
{
std::cout << "Failed to read zone definition file for target \"" << targetName << "\".\n";
return nullptr;
}
if (!GetNameFromZoneDefinition(zoneDefinition->m_name, targetName, *zoneDefinition))
return nullptr;
if (!IncludeAdditionalZoneDefinitions(targetName, *zoneDefinition, sourceSearchPath))
return nullptr;
if (!IncludeAssetLists(*zoneDefinition, sourceSearchPath))
return nullptr;
return zoneDefinition;
}
bool ProcessZoneDefinitionIgnores(const std::string& targetName, ZoneCreationContext& context, ISearchPath* sourceSearchPath) const
bool ProcessZoneDefinitionIgnores(LinkerPathManager& paths, const std::string& targetName, ZoneCreationContext& context) const
{
if (context.m_definition->m_ignores.empty())
return true;
std::map<std::string, std::reference_wrapper<ZoneDefinitionEntry>> zoneDefinitionAssetsByName;
for (auto& entry : context.m_definition->m_assets)
{
zoneDefinitionAssetsByName.try_emplace(entry.m_asset_name, entry);
}
for (const auto& ignore : context.m_definition->m_ignores)
{
if (ignore == targetName)
continue;
std::vector<AssetListEntry> assetList;
if (!ReadAssetList(ignore, context.m_ignored_assets, sourceSearchPath))
if (!ReadIgnoreEntries(paths, ignore, context.m_definition->m_game, context.m_ignored_assets))
{
std::cout << "Failed to read asset listing for ignoring assets of project \"" << ignore << "\".\n";
std::cerr << std::format("Failed to read asset listing for ignoring assets of project \"{}\".\n", ignore);
return false;
}
}
return true;
}
static bool ProjectTypeByName(ProjectType& projectType, const std::string& projectTypeName)
{
for (auto i = 0u; i < static_cast<unsigned>(ProjectType::MAX); i++)
{
if (projectTypeName == PROJECT_TYPE_NAMES[i])
{
projectType = static_cast<ProjectType>(i);
return true;
}
}
return false;
}
static bool GetProjectTypeFromZoneDefinition(ProjectType& projectType, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{
auto firstTypeEntry = true;
const auto [rangeBegin, rangeEnd] = zoneDefinition.m_metadata_lookup.equal_range(METADATA_TYPE);
for (auto i = rangeBegin; i != rangeEnd; ++i)
{
ProjectType parsedProjectType;
if (!ProjectTypeByName(parsedProjectType, i->second->m_value))
{
std::cerr << "Not a valid project type: \"" << i->second->m_value << "\"\n";
return false;
}
if (firstTypeEntry)
{
projectType = parsedProjectType;
firstTypeEntry = false;
}
else
{
if (projectType != parsedProjectType)
{
std::cerr << "Conflicting types in target \"" << targetName << "\": " << PROJECT_TYPE_NAMES[static_cast<unsigned>(projectType)]
<< " != " << PROJECT_TYPE_NAMES[static_cast<unsigned>(parsedProjectType)] << "\n";
return false;
}
}
}
if (firstTypeEntry)
{
if (zoneDefinition.m_assets.empty())
projectType = ProjectType::NONE;
else
projectType = ProjectType::FASTFILE;
}
return true;
}
static bool GetGameNameFromZoneDefinition(std::string& gameName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{
auto firstGameEntry = true;
const auto [rangeBegin, rangeEnd] = zoneDefinition.m_metadata_lookup.equal_range(METADATA_GAME);
for (auto i = rangeBegin; i != rangeEnd; ++i)
{
if (firstGameEntry)
{
gameName = i->second->m_value;
firstGameEntry = false;
}
else
{
if (gameName != i->second->m_value)
{
std::cout << "Conflicting game names in target \"" << targetName << "\": " << gameName << " != " << i->second << "\n";
return false;
}
}
}
if (firstGameEntry)
{
std::cout << "No game name was specified for target \"" << targetName << "\"\n";
return false;
}
return true;
}
static bool LoadGdtFilesFromZoneDefinition(std::vector<std::unique_ptr<Gdt>>& gdtList, const ZoneDefinition& zoneDefinition, ISearchPath* gdtSearchPath)
{
const auto [rangeBegin, rangeEnd] = zoneDefinition.m_metadata_lookup.equal_range(METADATA_GDT);
for (auto i = rangeBegin; i != rangeEnd; ++i)
for (const auto& gdtName : zoneDefinition.m_gdts)
{
const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt");
const auto gdtFile = gdtSearchPath->Open(std::format("{}.gdt", gdtName));
if (!gdtFile.IsOpen())
{
std::cout << "Failed to open file for gdt \"" << i->second->m_value << "\"\n";
std::cerr << std::format("Failed to open file for gdt \"{}\"\n", gdtName);
return false;
}
@ -355,7 +247,7 @@ class LinkerImpl final : public Linker
auto gdt = std::make_unique<Gdt>();
if (!gdtReader.Read(*gdt))
{
std::cout << "Failed to read gdt file \"" << i->second << "\"\n";
std::cerr << std::format("Failed to read gdt file \"{}\"\n", gdtName);
return false;
}
@ -365,167 +257,95 @@ class LinkerImpl final : public Linker
return true;
}
std::unique_ptr<Zone> CreateZoneForDefinition(const std::string& targetName,
ZoneDefinition& zoneDefinition,
ISearchPath* assetSearchPath,
ISearchPath* gdtSearchPath,
ISearchPath* sourceSearchPath) const
std::unique_ptr<Zone> CreateZoneForDefinition(
LinkerPathManager& paths, const fs::path& outDir, const fs::path& cacheDir, const std::string& targetName, ZoneDefinition& zoneDefinition) const
{
const auto context = std::make_unique<ZoneCreationContext>(assetSearchPath, &zoneDefinition);
if (!ProcessZoneDefinitionIgnores(targetName, *context, sourceSearchPath))
ZoneCreationContext context(&zoneDefinition, &paths.m_asset_paths.GetSearchPaths(), outDir, cacheDir);
if (!ProcessZoneDefinitionIgnores(paths, targetName, context))
return nullptr;
if (!GetGameNameFromZoneDefinition(context->m_game_name, targetName, zoneDefinition))
return nullptr;
if (!LoadGdtFilesFromZoneDefinition(context->m_gdt_files, zoneDefinition, gdtSearchPath))
if (!LoadGdtFilesFromZoneDefinition(context.m_gdt_files, zoneDefinition, &paths.m_gdt_paths.GetSearchPaths()))
return nullptr;
for (const auto* assetLoader : ZONE_CREATORS)
{
if (assetLoader->SupportsGame(context->m_game_name))
return assetLoader->CreateZoneForDefinition(*context);
}
return nullptr;
return zone_creator::CreateZoneForDefinition(zoneDefinition.m_game, context);
}
bool WriteZoneToFile(const std::string& projectName, Zone* zone) const
static bool WriteZoneToFile(IOutputPath& outPath, const Zone& zone)
{
const fs::path zoneFolderPath(m_args.GetOutputFolderPathForProject(projectName));
auto zoneFilePath(zoneFolderPath);
zoneFilePath.append(zone->m_name + ".ff");
fs::create_directories(zoneFolderPath);
std::ofstream stream(zoneFilePath, std::fstream::out | std::fstream::binary);
if (!stream.is_open())
return false;
if (!ZoneWriting::WriteZone(stream, zone))
const auto stream = outPath.Open(std::format("{}.ff", zone.m_name));
if (!stream)
{
std::cout << "Writing zone failed.\n";
stream.close();
std::cerr << std::format("Failed to open file for zone: {}\n", zone.m_name);
return false;
}
std::cout << "Created zone \"" << zoneFilePath.string() << "\"\n";
std::cout << std::format("Building zone \"{}\"\n", zone.m_name);
if (!ZoneWriting::WriteZone(*stream, zone))
{
std::cerr << "Writing zone failed.\n";
return false;
}
std::cout << std::format("Created zone \"{}\"\n", zone.m_name);
stream.close();
return true;
}
bool BuildFastFile(const std::string& projectName,
const std::string& targetName,
ZoneDefinition& zoneDefinition,
SearchPaths& assetSearchPaths,
SearchPaths& gdtSearchPaths,
SearchPaths& sourceSearchPaths) const
bool BuildFastFile(LinkerPathManager& paths, const std::string& projectName, const std::string& targetName, ZoneDefinition& zoneDefinition) const
{
SoundBankWriter::OutputPath = fs::path(m_args.GetOutputFolderPathForProject(projectName));
const fs::path outDir(paths.m_linker_paths->BuildOutputFolderPath(projectName, zoneDefinition.m_game));
const auto zone = CreateZoneForDefinition(targetName, zoneDefinition, &assetSearchPaths, &gdtSearchPaths, &sourceSearchPaths);
OutputPathFilesystem outputPath(outDir);
const fs::path cacheDir(paths.m_linker_paths->BuildCacheFolderPath(projectName, zoneDefinition.m_game));
SoundBankWriter::OutputPath = outDir;
const auto zone = CreateZoneForDefinition(paths, outDir, cacheDir, targetName, zoneDefinition);
auto result = zone != nullptr;
if (zone)
result = WriteZoneToFile(projectName, zone.get());
result = WriteZoneToFile(outputPath, *zone);
return result;
}
bool BuildIPak(const std::string& projectName, const ZoneDefinition& zoneDefinition, SearchPaths& assetSearchPaths) const
bool BuildProject(LinkerPathManager& paths, const std::string& projectName, const std::string& targetName) const
{
const fs::path ipakFolderPath(m_args.GetOutputFolderPathForProject(projectName));
auto ipakFilePath(ipakFolderPath);
ipakFilePath.append(zoneDefinition.m_name + ".ipak");
std::deque<std::string> targetsToBuild;
std::unordered_set<std::string> alreadyBuiltTargets;
fs::create_directories(ipakFolderPath);
targetsToBuild.emplace_back(targetName);
std::ofstream stream(ipakFilePath, std::fstream::out | std::fstream::binary);
if (!stream.is_open())
return false;
const auto ipakWriter = IPakWriter::Create(stream, &assetSearchPaths);
for (const auto& assetEntry : zoneDefinition.m_assets)
while (!targetsToBuild.empty())
{
if (assetEntry.m_is_reference)
continue;
const auto currentTarget = std::move(targetsToBuild.front());
targetsToBuild.pop_front();
alreadyBuiltTargets.emplace(currentTarget);
if (assetEntry.m_asset_type == "image")
ipakWriter->AddImage(assetEntry.m_asset_name);
}
PathProjectContext projectContext(paths, projectName);
if (!ipakWriter->Write())
{
std::cout << "Writing ipak failed.\n";
stream.close();
return false;
}
std::cout << "Created ipak \"" << ipakFilePath.string() << "\"\n";
stream.close();
return true;
}
bool BuildReferencedTargets(const std::string& projectName, const std::string& targetName, const ZoneDefinition& zoneDefinition)
{
return std::ranges::all_of(zoneDefinition.m_targets_to_build,
[this, &projectName, &targetName](const std::string& buildTargetName)
{
if (buildTargetName == targetName)
{
std::cerr << "Cannot build target with same name: \"" << targetName << "\"\n";
return false;
}
std::cout << "Building referenced target \"" << buildTargetName << "\"\n";
return BuildProject(projectName, buildTargetName);
});
}
bool BuildProject(const std::string& projectName, const std::string& targetName)
{
auto sourceSearchPaths = m_search_paths.GetSourceSearchPathsForProject(projectName);
const auto zoneDefinition = ReadZoneDefinition(targetName, &sourceSearchPaths);
if (!zoneDefinition)
return false;
ProjectType projectType;
if (!GetProjectTypeFromZoneDefinition(projectType, targetName, *zoneDefinition))
return false;
auto result = true;
if (projectType != ProjectType::NONE)
{
std::string gameName;
if (!GetGameNameFromZoneDefinition(gameName, targetName, *zoneDefinition))
const auto zoneDefinition = ReadZoneDefinition(paths, targetName);
if (!zoneDefinition)
return false;
utils::MakeStringLowerCase(gameName);
auto assetSearchPaths = m_search_paths.GetAssetSearchPathsForProject(gameName, projectName);
auto gdtSearchPaths = m_search_paths.GetGdtSearchPathsForProject(gameName, projectName);
PathGameContext gameContext(paths, projectName, zoneDefinition->m_game);
switch (projectType)
if (!zoneDefinition->m_assets.empty())
{
case ProjectType::FASTFILE:
result = BuildFastFile(projectName, targetName, *zoneDefinition, assetSearchPaths, gdtSearchPaths, sourceSearchPaths);
break;
if (!BuildFastFile(paths, projectName, targetName, *zoneDefinition))
return false;
case ProjectType::IPAK:
result = BuildIPak(projectName, *zoneDefinition, assetSearchPaths);
break;
default:
assert(false);
result = false;
break;
for (const auto& referencedTarget : zoneDefinition->m_targets_to_build)
{
if (alreadyBuiltTargets.find(referencedTarget) == alreadyBuiltTargets.end())
{
targetsToBuild.emplace_back(referencedTarget);
std::cout << std::format("Building referenced target \"{}\"\n", referencedTarget);
}
}
}
}
m_search_paths.UnloadProjectSpecificSearchPaths();
result = result && BuildReferencedTargets(projectName, targetName, *zoneDefinition);
return result;
return true;
}
bool LoadZones()
@ -534,22 +354,25 @@ class LinkerImpl final : public Linker
{
if (!fs::is_regular_file(zonePath))
{
std::cout << "Could not find zone file to load \"" << zonePath << "\".\n";
std::cerr << std::format("Could not find zone file to load \"{}\".\n", zonePath);
return false;
}
auto absoluteZoneDirectory = absolute(std::filesystem::path(zonePath).remove_filename()).string();
auto zoneDirectory = fs::path(zonePath).remove_filename();
if (zoneDirectory.empty())
zoneDirectory = fs::current_path();
auto absoluteZoneDirectory = absolute(zoneDirectory).string();
auto zone = std::unique_ptr<Zone>(ZoneLoading::LoadZone(zonePath));
if (zone == nullptr)
auto zone = ZoneLoading::LoadZone(zonePath);
if (!zone)
{
std::cout << "Failed to load zone \"" << zonePath << "\".\n";
std::cerr << std::format("Failed to load zone \"{}\".\n", zonePath);
return false;
}
if (m_args.m_verbose)
{
std::cout << "Load zone \"" << zone->m_name << "\"\n";
std::cout << std::format("Load zone \"{}\"\n", zone->m_name);
}
m_loaded_zones.emplace_back(std::move(zone));
@ -568,7 +391,7 @@ class LinkerImpl final : public Linker
loadedZone.reset();
if (m_args.m_verbose)
std::cout << "Unloaded zone \"" << zoneName << "\"\n";
std::cout << std::format("Unloaded zone \"{}\"\n", zoneName);
}
m_loaded_zones.clear();
}
@ -583,7 +406,7 @@ class LinkerImpl final : public Linker
}
else if (projectSpecifier.find_first_of('/', targetNameSeparatorIndex + 1) != std::string::npos)
{
std::cerr << "Project specifier cannot have more than one target name: \"" << projectSpecifier << "\"\n";
std::cerr << std::format("Project specifier cannot have more than one target name: \"{}\"\n", projectSpecifier);
return false;
}
else
@ -594,13 +417,13 @@ class LinkerImpl final : public Linker
if (projectName.empty())
{
std::cerr << "Project name cannot be empty: \"" << projectSpecifier << "\"\n";
std::cerr << std::format("Project name cannot be empty: \"{}\"\n", projectSpecifier);
return false;
}
if (targetName.empty())
{
std::cerr << "Target name cannot be empty: \"" << projectSpecifier << "\"\n";
std::cerr << std::format("Target name cannot be empty: \"{}\"\n", projectSpecifier);
return false;
}
@ -608,11 +431,6 @@ class LinkerImpl final : public Linker
}
public:
LinkerImpl()
: m_search_paths(m_args)
{
}
bool Start(const int argc, const char** argv) override
{
auto shouldContinue = true;
@ -622,8 +440,7 @@ public:
if (!shouldContinue)
return true;
if (!m_search_paths.BuildProjectIndependentSearchPaths())
return false;
LinkerPathManager paths(m_args);
if (!LoadZones())
return false;
@ -639,7 +456,7 @@ public:
break;
}
if (!BuildProject(projectName, targetName))
if (!BuildProject(paths, projectName, targetName))
{
result = false;
break;
@ -650,6 +467,10 @@ public:
return result;
}
private:
LinkerArgs m_args;
std::vector<std::unique_ptr<Zone>> m_loaded_zones;
};
std::unique_ptr<Linker> Linker::Create()

View File

@ -5,10 +5,11 @@
#include "ObjWriting.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/FileUtils.h"
#include "Utils/PathUtils.h"
#include <filesystem>
#include <format>
#include <iostream>
#include <regex>
#include <type_traits>
namespace fs = std::filesystem;
@ -45,28 +46,44 @@ const CommandLineOption* const OPTION_BASE_FOLDER =
const CommandLineOption* const OPTION_OUTPUT_FOLDER =
CommandLineOption::Builder::Create()
.WithLongName("output-folder")
.WithDescription("Specifies the output folder containing the build artifacts. Defaults to \"" + std::string(LinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\".")
.WithDescription(std::format("Specifies the output folder containing the build artifacts. Defaults to \"{}\".", LinkerArgs::DEFAULT_OUTPUT_FOLDER))
.WithParameter("outputFolderPath")
.Build();
const CommandLineOption* const OPTION_ADD_ASSET_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("add-asset-search-path")
.WithDescription("Adds a search paths used for assets. This does not override the default search paths.")
.WithParameter("assetSearchPathString")
.Reusable()
.Build();
const CommandLineOption* const OPTION_ASSET_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("asset-search-path")
.WithDescription("Specifies the search paths used for assets. Defaults to \"" + std::string(LinkerArgs::DEFAULT_ASSET_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for assets. Defaults to \"{}\".", LinkerArgs::DEFAULT_ASSET_SEARCH_PATH))
.WithParameter("assetSearchPathString")
.Build();
const CommandLineOption* const OPTION_GDT_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("gdt-search-path")
.WithDescription("Specifies the search paths used for assets. Defaults to \"" + std::string(LinkerArgs::DEFAULT_GDT_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for gdt files. Defaults to \"{}\".", LinkerArgs::DEFAULT_GDT_SEARCH_PATH))
.WithParameter("gdtSearchPathString")
.Build();
const CommandLineOption* const OPTION_ADD_SOURCE_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("add-source-search-path")
.WithDescription("Adds a search paths used for source files. This does not override the default search paths.")
.WithParameter("sourceSearchPathString")
.Reusable()
.Build();
const CommandLineOption* const OPTION_SOURCE_SEARCH_PATH =
CommandLineOption::Builder::Create()
.WithLongName("source-search-path")
.WithDescription("Specifies the search paths used for assets. Defaults to \"" + std::string(LinkerArgs::DEFAULT_SOURCE_SEARCH_PATH) + "\".")
.WithDescription(std::format("Specifies the search paths used for source files. Defaults to \"{}\".", LinkerArgs::DEFAULT_SOURCE_SEARCH_PATH))
.WithParameter("sourceSearchPathString")
.Build();
@ -100,8 +117,10 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
OPTION_VERBOSE,
OPTION_BASE_FOLDER,
OPTION_OUTPUT_FOLDER,
OPTION_ADD_ASSET_SEARCH_PATH,
OPTION_ASSET_SEARCH_PATH,
OPTION_GDT_SEARCH_PATH,
OPTION_ADD_SOURCE_SEARCH_PATH,
OPTION_SOURCE_SEARCH_PATH,
OPTION_LOAD,
OPTION_MENU_PERMISSIVE,
@ -109,19 +128,14 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
};
LinkerArgs::LinkerArgs()
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
m_base_pattern(R"(\?base\?)"),
m_game_pattern(R"(\?game\?)"),
m_project_pattern(R"(\?project\?)"),
m_base_folder_depends_on_project(false),
m_out_folder_depends_on_project(false),
m_verbose(false)
: m_verbose(false),
m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
{
}
void LinkerArgs::PrintUsage()
void LinkerArgs::PrintUsage() const
{
UsageInformation usage("Linker.exe");
UsageInformation usage(m_argument_parser.GetExecutableName());
for (const auto* commandLineOption : COMMAND_LINE_OPTIONS)
{
@ -136,7 +150,13 @@ void LinkerArgs::PrintUsage()
void LinkerArgs::PrintVersion()
{
std::cout << "OpenAssetTools Linker " << std::string(GIT_VERSION) << "\n";
std::cout << std::format("OpenAssetTools Linker {}\n", GIT_VERSION);
}
void LinkerArgs::SetBinFolder()
{
const fs::path path(utils::GetExecutablePath());
m_bin_folder = path.parent_path().string();
}
void LinkerArgs::SetVerbose(const bool isVerbose)
@ -146,76 +166,10 @@ void LinkerArgs::SetVerbose(const bool isVerbose)
ObjWriting::Configuration.Verbose = isVerbose;
}
std::string LinkerArgs::GetBasePathForProject(const std::string& projectName) const
{
return std::regex_replace(m_base_folder, m_project_pattern, projectName);
}
void LinkerArgs::SetDefaultBasePath()
{
const auto currentDir = fs::absolute(fs::current_path());
if (currentDir.filename() == "bin")
{
m_base_folder = currentDir.parent_path().string();
}
else
{
m_base_folder = currentDir.string();
}
}
std::set<std::string> LinkerArgs::GetProjectIndependentSearchPaths(const std::set<std::string>& set) const
{
std::set<std::string> out;
for (const auto& path : set)
{
if (path.find(PATTERN_GAME) != std::string::npos)
continue;
if (path.find(PATTERN_PROJECT) != std::string::npos)
continue;
if (path.find(PATTERN_BASE) != std::string::npos)
{
if (m_base_folder_depends_on_project)
continue;
out.emplace(std::regex_replace(path, m_base_pattern, m_base_folder));
}
else
{
out.emplace(path);
}
}
return out;
}
std::set<std::string> LinkerArgs::GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const
{
std::set<std::string> out;
const auto basePath = GetBasePathForProject(projectName);
for (const auto& path : set)
{
if (path.find(PATTERN_GAME) == std::string::npos && path.find(PATTERN_PROJECT) == std::string::npos
&& (!m_base_folder_depends_on_project || path.find(PATTERN_BASE) == std::string::npos))
{
continue;
}
out.emplace(std::regex_replace(
std::regex_replace(std::regex_replace(path, m_project_pattern, projectName), m_game_pattern, gameName), m_base_pattern, basePath));
}
return out;
}
bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
if (!m_argument_parser.ParseArguments(argc, argv))
{
PrintUsage();
return false;
@ -237,6 +191,8 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
return true;
}
SetBinFolder();
m_project_specifiers_to_build = m_argument_parser.GetArguments();
if (m_project_specifiers_to_build.empty())
{
@ -252,15 +208,13 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
if (m_argument_parser.IsOptionSpecified(OPTION_BASE_FOLDER))
m_base_folder = m_argument_parser.GetValueForOption(OPTION_BASE_FOLDER);
else
SetDefaultBasePath();
m_base_folder_depends_on_project = m_base_folder.find(PATTERN_GAME) != std::string::npos || m_base_folder.find(PATTERN_PROJECT) != std::string::npos;
m_base_folder = DEFAULT_BASE_FOLDER;
// --output-folder
if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER))
m_out_folder = m_argument_parser.GetValueForOption(OPTION_OUTPUT_FOLDER);
else
m_out_folder = DEFAULT_OUTPUT_FOLDER;
m_out_folder_depends_on_project = m_out_folder.find(PATTERN_PROJECT) != std::string::npos;
// --asset-search-path
if (m_argument_parser.IsOptionSpecified(OPTION_ASSET_SEARCH_PATH))
@ -274,6 +228,13 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
return false;
}
// --add-assets-search-path
for (const auto& specifiedValue : m_argument_parser.GetParametersForOption(OPTION_ADD_ASSET_SEARCH_PATH))
{
if (!FileUtils::ParsePathsString(specifiedValue, m_asset_search_paths))
return false;
}
// --gdt-search-path
if (m_argument_parser.IsOptionSpecified(OPTION_GDT_SEARCH_PATH))
{
@ -298,6 +259,13 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
return false;
}
// --add-source-search-path
for (const auto& specifiedValue : m_argument_parser.GetParametersForOption(OPTION_ADD_SOURCE_SEARCH_PATH))
{
if (!FileUtils::ParsePathsString(specifiedValue, m_source_search_paths))
return false;
}
// -l; --load
if (m_argument_parser.IsOptionSpecified(OPTION_LOAD))
m_zones_to_load = m_argument_parser.GetParametersForOption(OPTION_LOAD);
@ -312,38 +280,3 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
return true;
}
std::string LinkerArgs::GetOutputFolderPathForProject(const std::string& projectName) const
{
return std::regex_replace(std::regex_replace(m_out_folder, m_project_pattern, projectName), m_base_pattern, GetBasePathForProject(projectName));
}
std::set<std::string> LinkerArgs::GetProjectIndependentAssetSearchPaths() const
{
return GetProjectIndependentSearchPaths(m_asset_search_paths);
}
std::set<std::string> LinkerArgs::GetProjectIndependentGdtSearchPaths() const
{
return GetProjectIndependentSearchPaths(m_gdt_search_paths);
}
std::set<std::string> LinkerArgs::GetProjectIndependentSourceSearchPaths() const
{
return GetProjectIndependentSearchPaths(m_source_search_paths);
}
std::set<std::string> LinkerArgs::GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const
{
return GetSearchPathsForProject(m_asset_search_paths, gameName, projectName);
}
std::set<std::string> LinkerArgs::GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const
{
return GetSearchPathsForProject(m_gdt_search_paths, gameName, projectName);
}
std::set<std::string> LinkerArgs::GetSourceSearchPathsForProject(const std::string& projectName) const
{
return GetSearchPathsForProject(m_source_search_paths, "", projectName);
}

View File

@ -1,76 +1,44 @@
#pragma once
#include "Utils/Arguments/ArgumentParser.h"
#include "Utils/ClassUtils.h"
#include "Zone/Zone.h"
#include <regex>
#include <set>
#include <vector>
class LinkerArgs
{
public:
static constexpr const char* PATTERN_BASE = "?base?";
static constexpr const char* PATTERN_GAME = "?game?";
static constexpr const char* PATTERN_PROJECT = "?project?";
static constexpr auto DEFAULT_BASE_FOLDER = ".";
static constexpr auto DEFAULT_CACHE_FOLDER = "?base?/.oat/cache/?project?";
static constexpr auto DEFAULT_OUTPUT_FOLDER = "?base?/zone_out/?project?";
static constexpr auto DEFAULT_ASSET_SEARCH_PATH = "?bin?/raw/?game?;?base?/raw;?base?/raw/?game?;?base?/zone_raw/?project?";
static constexpr auto DEFAULT_GDT_SEARCH_PATH = "?base?/source_data;?base?/zone_raw/?project?/source_data";
static constexpr auto DEFAULT_SOURCE_SEARCH_PATH = "?base?/zone_source;?base?/zone_raw/?project?;?base?/zone_raw/?project?/zone_source";
static constexpr const char* DEFAULT_BASE_FOLDER = ".";
static constexpr const char* DEFAULT_BASE_FOLDER_MOD_TOOLS = "..";
static constexpr const char* DEFAULT_OUTPUT_FOLDER = "?base?/zone_out/?project?";
static constexpr const char* DEFAULT_ASSET_SEARCH_PATH = "?base?/raw;?base?/raw/?game?;?base?/zone_raw/?project?";
static constexpr const char* DEFAULT_GDT_SEARCH_PATH = "?base?/source_data;?base?/zone_raw/?project?/source_data";
static constexpr const char* DEFAULT_SOURCE_SEARCH_PATH = "?base?/zone_source;?base?/zone_raw/?project?/zone_source";
LinkerArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);
private:
ArgumentParser m_argument_parser;
std::regex m_base_pattern;
std::regex m_game_pattern;
std::regex m_project_pattern;
bool m_verbose;
/**
* \brief Prints a command line usage help text for the Linker tool to stdout.
*/
static void PrintUsage();
static void PrintVersion();
void SetVerbose(bool isVerbose);
_NODISCARD std::string GetBasePathForProject(const std::string& projectName) const;
void SetDefaultBasePath();
_NODISCARD std::set<std::string> GetProjectIndependentSearchPaths(const std::set<std::string>& set) const;
_NODISCARD std::set<std::string>
GetSearchPathsForProject(const std::set<std::string>& set, const std::string& gameName, const std::string& projectName) const;
public:
std::vector<std::string> m_zones_to_load;
std::vector<std::string> m_project_specifiers_to_build;
std::string m_bin_folder;
std::string m_base_folder;
std::string m_out_folder;
bool m_base_folder_depends_on_project;
bool m_out_folder_depends_on_project;
std::set<std::string> m_asset_search_paths;
std::set<std::string> m_gdt_search_paths;
std::set<std::string> m_source_search_paths;
bool m_verbose;
LinkerArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);
private:
/**
* \brief Converts the output path specified by command line arguments to a path applies for the specified project.
* \param projectName The name of the project to resolve the path input for.
* \return An output path for the project based on the user input.
* \brief Prints a command line usage help text for the Linker tool to stdout.
*/
_NODISCARD std::string GetOutputFolderPathForProject(const std::string& projectName) const;
void PrintUsage() const;
static void PrintVersion();
_NODISCARD std::set<std::string> GetProjectIndependentAssetSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentGdtSearchPaths() const;
_NODISCARD std::set<std::string> GetProjectIndependentSourceSearchPaths() const;
void SetBinFolder();
void SetVerbose(bool isVerbose);
_NODISCARD std::set<std::string> GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName) const;
_NODISCARD std::set<std::string> GetSourceSearchPathsForProject(const std::string& projectName) const;
ArgumentParser m_argument_parser;
};

342
src/Linker/LinkerPaths.cpp Normal file
View File

@ -0,0 +1,342 @@
#include "LinkerPaths.h"
#include "SearchPath/IWD.h"
#include "SearchPath/SearchPathFilesystem.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/StringUtils.h"
#include <cassert>
#include <cstdint>
#include <cstring>
#include <filesystem>
#include <format>
#include <iostream>
#include <sstream>
#include <type_traits>
#include <unordered_set>
namespace fs = std::filesystem;
namespace
{
enum class PathTemplateParameterType : std::uint8_t
{
BIN = 1 << 0,
BASE = 1 << 1,
PROJECT = 1 << 2,
GAME = 1 << 3,
};
class LinkerPathTemplate
{
static constexpr auto PATTERN_BIN = "?bin?";
static constexpr auto PATTERN_BASE = "?base?";
static constexpr auto PATTERN_GAME = "?game?";
static constexpr auto PATTERN_PROJECT = "?project?";
struct Pattern
{
const char* m_str;
PathTemplateParameterType m_type;
};
static constexpr Pattern PATTERNS[]{
{PATTERN_BIN, PathTemplateParameterType::BIN },
{PATTERN_BASE, PathTemplateParameterType::BASE },
{PATTERN_GAME, PathTemplateParameterType::GAME },
{PATTERN_PROJECT, PathTemplateParameterType::PROJECT},
};
public:
LinkerPathTemplate()
: m_parameter_type_flags(0u)
{
}
void CreateFromString(const std::string& templateString)
{
const auto templateStringLength = templateString.size();
auto partStart = 0u;
for (auto i = 0u; i < templateStringLength; i++)
{
if (templateString[i] != '?')
continue;
for (const auto& pattern : PATTERNS)
{
const auto patternLength = std::strlen(pattern.m_str);
if (templateString.compare(i, patternLength, pattern.m_str) == 0)
{
m_parts.emplace_back(templateString.substr(partStart, i - partStart));
m_parameters.emplace_back(pattern.m_type);
m_parameter_type_flags |= static_cast<std::underlying_type_t<PathTemplateParameterType>>(pattern.m_type);
i += patternLength;
partStart = i;
break;
}
}
}
if (partStart < templateStringLength)
m_parts.emplace_back(templateString.substr(partStart, templateStringLength - partStart));
}
[[nodiscard]] std::string
Render(const std::string& binDir, const std::string& baseDir, const std::string& projectName, const std::string& gameName) const
{
if (m_parts.empty())
return "";
if (m_parameters.empty())
return m_parts[0];
std::ostringstream ss;
ss << m_parts[0];
const auto partsCount = m_parts.size();
const auto parameterCount = m_parameters.size();
for (auto parameterIndex = 0u; parameterIndex < parameterCount; parameterIndex++)
{
switch (m_parameters[parameterIndex])
{
case PathTemplateParameterType::BIN:
ss << binDir;
break;
case PathTemplateParameterType::BASE:
ss << baseDir;
break;
case PathTemplateParameterType::PROJECT:
ss << projectName;
break;
case PathTemplateParameterType::GAME:
ss << gameName;
break;
default:
assert(false);
break;
}
if (parameterIndex + 1 < partsCount)
ss << m_parts[parameterIndex + 1];
}
return fs::path(ss.str()).make_preferred().string();
}
[[nodiscard]] bool CanRender(const std::underlying_type_t<PathTemplateParameterType> availableParameters) const
{
return (m_parameter_type_flags & ~availableParameters) == 0;
}
private:
std::vector<std::string> m_parts;
std::vector<PathTemplateParameterType> m_parameters;
std::underlying_type_t<PathTemplateParameterType> m_parameter_type_flags;
};
class LinkerSearchPathBuilder final : public ILinkerSearchPathBuilder
{
static constexpr auto INDEPENDENT_MASK = static_cast<unsigned>(PathTemplateParameterType::BIN) | static_cast<unsigned>(PathTemplateParameterType::BASE);
static constexpr auto PROJECT_MASK = static_cast<unsigned>(PathTemplateParameterType::BIN) | static_cast<unsigned>(PathTemplateParameterType::BASE)
| static_cast<unsigned>(PathTemplateParameterType::PROJECT);
static constexpr auto GAME_MASK = static_cast<unsigned>(PathTemplateParameterType::BIN) | static_cast<unsigned>(PathTemplateParameterType::BASE)
| static_cast<unsigned>(PathTemplateParameterType::PROJECT) | static_cast<unsigned>(PathTemplateParameterType::GAME);
public:
LinkerSearchPathBuilder(const char* typeName, std::string binDir, std::string baseDir)
: m_type_name(typeName),
m_bin_dir(std::move(binDir)),
m_base_dir(std::move(baseDir))
{
}
void BuildFromArgs(const std::set<std::string>& templates)
{
m_templates.reserve(templates.size());
for (const auto& templateString : templates)
{
LinkerPathTemplate templateStruct;
templateStruct.CreateFromString(templateString);
m_templates.emplace_back(std::move(templateStruct));
}
}
[[nodiscard]] std::unique_ptr<ISearchPath> BuildIndependentSearchPaths() const override
{
SearchPaths searchPaths;
std::unordered_set<std::string> addedSearchPaths;
auto hasSearchPath = false;
for (const auto& curTemplate : m_templates)
{
if (curTemplate.CanRender(INDEPENDENT_MASK))
{
auto renderedTemplate = curTemplate.Render(m_bin_dir, m_base_dir, std::string(), std::string());
if (AddSearchPath(addedSearchPaths, searchPaths, renderedTemplate))
hasSearchPath = true;
}
}
if (hasSearchPath)
return std::make_unique<SearchPaths>(std::move(searchPaths));
return {};
}
[[nodiscard]] std::unique_ptr<ISearchPath> BuildSearchPathsSpecificToProject(const std::string& projectName) const override
{
SearchPaths searchPaths;
std::unordered_set<std::string> addedSearchPaths;
auto hasSearchPath = false;
for (const auto& curTemplate : m_templates)
{
if (!curTemplate.CanRender(INDEPENDENT_MASK) && curTemplate.CanRender(PROJECT_MASK))
{
auto renderedTemplate = curTemplate.Render(m_bin_dir, m_base_dir, projectName, std::string());
if (AddSearchPath(addedSearchPaths, searchPaths, renderedTemplate))
hasSearchPath = true;
}
}
if (hasSearchPath)
return std::make_unique<SearchPaths>(std::move(searchPaths));
return {};
}
[[nodiscard]] std::unique_ptr<ISearchPath> BuildSearchPathsSpecificToProjectAndGame(const std::string& projectName, GameId game) const override
{
SearchPaths searchPaths;
std::unordered_set<std::string> addedSearchPaths;
auto hasSearchPath = false;
for (const auto& curTemplate : m_templates)
{
if (!curTemplate.CanRender(PROJECT_MASK) && curTemplate.CanRender(GAME_MASK))
{
std::string gameName(GameId_Names[static_cast<unsigned>(game)]);
utils::MakeStringLowerCase(gameName);
auto renderedTemplate = curTemplate.Render(m_bin_dir, m_base_dir, projectName, gameName);
if (AddSearchPath(addedSearchPaths, searchPaths, renderedTemplate))
hasSearchPath = true;
}
}
if (hasSearchPath)
return std::make_unique<SearchPaths>(std::move(searchPaths));
return {};
}
private:
bool AddSearchPath(std::unordered_set<std::string>& existingSearchPaths, SearchPaths& searchPaths, const std::string& path) const
{
const auto existingSearchPath = existingSearchPaths.find(path);
if (existingSearchPath != existingSearchPaths.end())
return false;
existingSearchPaths.emplace(path);
if (!fs::is_directory(path))
{
std::cout << std::format("Adding {} search path (Not found): {}\n", m_type_name, path);
return false;
}
std::cout << std::format("Adding {} search path: {}\n", m_type_name, path);
searchPaths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(path));
return true;
}
const char* m_type_name;
std::vector<LinkerPathTemplate> m_templates;
std::string m_bin_dir;
std::string m_base_dir;
};
class LinkerPaths final : public ILinkerPaths
{
public:
LinkerPaths(std::string binDir,
std::string baseDir,
LinkerSearchPathBuilder assetSearchPaths,
LinkerSearchPathBuilder gdtSearchPaths,
LinkerSearchPathBuilder sourceSearchPaths,
LinkerPathTemplate cacheTemplate,
LinkerPathTemplate outTemplate)
: m_bin_dir(std::move(binDir)),
m_base_dir(std::move(baseDir)),
m_asset_search_paths(std::move(assetSearchPaths)),
m_gdt_search_paths(std::move(gdtSearchPaths)),
m_source_search_paths(std::move(sourceSearchPaths)),
m_cache_template(std::move(cacheTemplate)),
m_out_template(std::move(outTemplate))
{
}
[[nodiscard]] const ILinkerSearchPathBuilder& AssetSearchPaths() const override
{
return m_asset_search_paths;
}
[[nodiscard]] const ILinkerSearchPathBuilder& GdtSearchPaths() const override
{
return m_gdt_search_paths;
}
[[nodiscard]] const ILinkerSearchPathBuilder& SourceSearchPaths() const override
{
return m_source_search_paths;
}
[[nodiscard]] std::string BuildCacheFolderPath(const std::string& projectName, GameId game) const override
{
return m_cache_template.Render(m_bin_dir, m_base_dir, projectName, GameId_Names[static_cast<unsigned>(game)]);
}
[[nodiscard]] std::string BuildOutputFolderPath(const std::string& projectName, GameId game) const override
{
return m_out_template.Render(m_bin_dir, m_base_dir, projectName, GameId_Names[static_cast<unsigned>(game)]);
}
private:
std::string m_bin_dir;
std::string m_base_dir;
LinkerSearchPathBuilder m_asset_search_paths;
LinkerSearchPathBuilder m_gdt_search_paths;
LinkerSearchPathBuilder m_source_search_paths;
LinkerPathTemplate m_cache_template;
LinkerPathTemplate m_out_template;
};
} // namespace
std::unique_ptr<ILinkerPaths> ILinkerPaths::FromArgs(const LinkerArgs& args)
{
std::string normalizedBinPath = fs::weakly_canonical(args.m_bin_folder).make_preferred().string();
std::string normalizedBasePath = fs::weakly_canonical(args.m_base_folder).make_preferred().string();
LinkerSearchPathBuilder assetSearchPaths("asset", normalizedBinPath, normalizedBasePath);
assetSearchPaths.BuildFromArgs(args.m_asset_search_paths);
LinkerSearchPathBuilder gdtSearchPaths("gdt", normalizedBinPath, normalizedBasePath);
gdtSearchPaths.BuildFromArgs(args.m_gdt_search_paths);
LinkerSearchPathBuilder sourceSearchPaths("source", normalizedBinPath, normalizedBasePath);
sourceSearchPaths.BuildFromArgs(args.m_source_search_paths);
LinkerPathTemplate cacheTemplate;
cacheTemplate.CreateFromString(LinkerArgs::DEFAULT_CACHE_FOLDER);
LinkerPathTemplate outTemplate;
outTemplate.CreateFromString(args.m_out_folder);
return std::make_unique<LinkerPaths>(std::move(normalizedBinPath),
std::move(normalizedBasePath),
std::move(assetSearchPaths),
std::move(gdtSearchPaths),
std::move(sourceSearchPaths),
std::move(cacheTemplate),
std::move(outTemplate));
}

74
src/Linker/LinkerPaths.h Normal file
View File

@ -0,0 +1,74 @@
#pragma once
#include "Game/IGame.h"
#include "LinkerArgs.h"
#include "SearchPath/ISearchPath.h"
#include <memory>
class ILinkerSearchPathBuilder
{
public:
ILinkerSearchPathBuilder() = default;
virtual ~ILinkerSearchPathBuilder() = default;
ILinkerSearchPathBuilder(const ILinkerSearchPathBuilder& other) = default;
ILinkerSearchPathBuilder(ILinkerSearchPathBuilder&& other) noexcept = default;
ILinkerSearchPathBuilder& operator=(const ILinkerSearchPathBuilder& other) = default;
ILinkerSearchPathBuilder& operator=(ILinkerSearchPathBuilder&& other) noexcept = default;
[[nodiscard]] virtual std::unique_ptr<ISearchPath> BuildIndependentSearchPaths() const = 0;
[[nodiscard]] virtual std::unique_ptr<ISearchPath> BuildSearchPathsSpecificToProject(const std::string& projectName) const = 0;
[[nodiscard]] virtual std::unique_ptr<ISearchPath> BuildSearchPathsSpecificToProjectAndGame(const std::string& projectName, GameId game) const = 0;
};
class ILinkerPaths
{
public:
ILinkerPaths() = default;
virtual ~ILinkerPaths() = default;
ILinkerPaths(const ILinkerPaths& other) = default;
ILinkerPaths(ILinkerPaths&& other) noexcept = default;
ILinkerPaths& operator=(const ILinkerPaths& other) = default;
ILinkerPaths& operator=(ILinkerPaths&& other) noexcept = default;
/**
* \brief Creates linker search paths based on templates from user specified args.
* \param args The user specified args.
* \return Linker search paths based on user specified templates.
*/
static std::unique_ptr<ILinkerPaths> FromArgs(const LinkerArgs& args);
/**
* \brief Grants access to the builder for asset search paths.
* \return A builder instance for building asset search paths.
*/
[[nodiscard]] virtual const ILinkerSearchPathBuilder& AssetSearchPaths() const = 0;
/**
* \brief Grants access to the builder for gdt search paths.
* \return A builder instance for building gdt search paths.
*/
[[nodiscard]] virtual const ILinkerSearchPathBuilder& GdtSearchPaths() const = 0;
/**
* \brief Grants access to the builder for source search paths.
* \return A builder instance for building source search paths.
*/
[[nodiscard]] virtual const ILinkerSearchPathBuilder& SourceSearchPaths() const = 0;
/**
* \brief Builds the cache path based on the specified information.
* \param projectName The name of the project to resolve the path input for.
* \param game The game to resolve the path input for.
* \return A cache path based on the input and preconfigured template.
*/
[[nodiscard]] virtual std::string BuildCacheFolderPath(const std::string& projectName, GameId game) const = 0;
/**
* \brief Builds the output path based on the specified information.
* \param projectName The name of the project to resolve the path input for.
* \param game The game to resolve the path input for.
* \return An output path based on the input and preconfigured template.
*/
[[nodiscard]] virtual std::string BuildOutputFolderPath(const std::string& projectName, GameId game) const = 0;
};

View File

@ -1,189 +0,0 @@
#include "LinkerSearchPaths.h"
#include "ObjContainer/IWD/IWD.h"
#include "ObjLoading.h"
#include "SearchPath/SearchPathFilesystem.h"
#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
LinkerSearchPaths::LinkerSearchPaths(const LinkerArgs& args)
: m_args(args)
{
}
void LinkerSearchPaths::LoadSearchPath(ISearchPath* searchPath) const
{
if (m_args.m_verbose)
{
printf("Loading search path: \"%s\"\n", searchPath->GetPath().c_str());
}
ObjLoading::LoadIWDsInSearchPath(searchPath);
}
void LinkerSearchPaths::UnloadSearchPath(ISearchPath* searchPath) const
{
if (m_args.m_verbose)
{
printf("Unloading search path: \"%s\"\n", searchPath->GetPath().c_str());
}
ObjLoading::UnloadIWDsInSearchPath(searchPath);
}
SearchPaths LinkerSearchPaths::GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName)
{
SearchPaths searchPathsForProject;
for (const auto& searchPathStr : m_args.GetAssetSearchPathsForProject(gameName, projectName))
{
auto absolutePath = fs::absolute(searchPathStr);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding asset search path: " << absolutePath.string() << "\n";
auto searchPath = std::make_unique<SearchPathFilesystem>(searchPathStr);
LoadSearchPath(searchPath.get());
searchPathsForProject.IncludeSearchPath(searchPath.get());
m_loaded_project_search_paths.emplace_back(std::move(searchPath));
}
searchPathsForProject.IncludeSearchPath(&m_asset_search_paths);
for (auto* iwd : IWD::Repository)
{
searchPathsForProject.IncludeSearchPath(iwd);
}
return searchPathsForProject;
}
SearchPaths LinkerSearchPaths::GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName)
{
SearchPaths searchPathsForProject;
for (const auto& searchPathStr : m_args.GetGdtSearchPathsForProject(gameName, projectName))
{
auto absolutePath = fs::absolute(searchPathStr);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Adding gdt search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding gdt search path: " << absolutePath.string() << "\n";
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
}
searchPathsForProject.IncludeSearchPath(&m_gdt_search_paths);
return searchPathsForProject;
}
SearchPaths LinkerSearchPaths::GetSourceSearchPathsForProject(const std::string& projectName)
{
SearchPaths searchPathsForProject;
for (const auto& searchPathStr : m_args.GetSourceSearchPathsForProject(projectName))
{
auto absolutePath = fs::absolute(searchPathStr);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Adding source search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding source search path: " << absolutePath.string() << "\n";
searchPathsForProject.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathStr));
}
searchPathsForProject.IncludeSearchPath(&m_source_search_paths);
return searchPathsForProject;
}
bool LinkerSearchPaths::BuildProjectIndependentSearchPaths()
{
for (const auto& path : m_args.GetProjectIndependentAssetSearchPaths())
{
auto absolutePath = fs::absolute(path);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Adding asset search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding asset search path: " << absolutePath.string() << "\n";
auto searchPath = std::make_unique<SearchPathFilesystem>(absolutePath.string());
LoadSearchPath(searchPath.get());
m_asset_search_paths.CommitSearchPath(std::move(searchPath));
}
for (const auto& path : m_args.GetProjectIndependentGdtSearchPaths())
{
auto absolutePath = fs::absolute(path);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Loading gdt search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding gdt search path: " << absolutePath.string() << "\n";
m_gdt_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
}
for (const auto& path : m_args.GetProjectIndependentSourceSearchPaths())
{
auto absolutePath = fs::absolute(path);
if (!fs::is_directory(absolutePath))
{
if (m_args.m_verbose)
std::cout << "Loading source search path (Not found): " << absolutePath.string() << "\n";
continue;
}
if (m_args.m_verbose)
std::cout << "Adding source search path: " << absolutePath.string() << "\n";
m_source_search_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(absolutePath.string()));
}
return true;
}
void LinkerSearchPaths::UnloadProjectSpecificSearchPaths()
{
for (const auto& loadedSearchPath : m_loaded_project_search_paths)
{
UnloadSearchPath(loadedSearchPath.get());
}
m_loaded_project_search_paths.clear();
}

View File

@ -1,45 +0,0 @@
#pragma once
#include "LinkerArgs.h"
#include "SearchPath/SearchPaths.h"
#include <memory>
#include <vector>
class LinkerSearchPaths
{
public:
explicit LinkerSearchPaths(const LinkerArgs& args);
/**
* \brief Loads a search path.
* \param searchPath The search path to load.
*/
void LoadSearchPath(ISearchPath* searchPath) const;
/**
* \brief Unloads a search path.
* \param searchPath The search path to unload.
*/
void UnloadSearchPath(ISearchPath* searchPath) const;
SearchPaths GetAssetSearchPathsForProject(const std::string& gameName, const std::string& projectName);
SearchPaths GetGdtSearchPathsForProject(const std::string& gameName, const std::string& projectName);
SearchPaths GetSourceSearchPathsForProject(const std::string& projectName);
/**
* \brief Initializes the Linker object's search paths based on the user's input.
* \return \c true if building the search paths was successful, otherwise \c false.
*/
bool BuildProjectIndependentSearchPaths();
void UnloadProjectSpecificSearchPaths();
private:
const LinkerArgs& m_args;
std::vector<std::unique_ptr<ISearchPath>> m_loaded_project_search_paths;
SearchPaths m_asset_search_paths;
SearchPaths m_gdt_search_paths;
SearchPaths m_source_search_paths;
};

View File

@ -1,20 +0,0 @@
#pragma once
#include "Utils/ClassUtils.h"
#include "Zone/Zone.h"
#include "ZoneCreationContext.h"
#include <string>
class IZoneCreator
{
public:
IZoneCreator() = default;
virtual ~IZoneCreator() = default;
IZoneCreator(const IZoneCreator& other) = default;
IZoneCreator(IZoneCreator&& other) noexcept = default;
IZoneCreator& operator=(const IZoneCreator& other) = default;
IZoneCreator& operator=(IZoneCreator&& other) noexcept = default;
_NODISCARD virtual bool SupportsGame(const std::string& gameName) const = 0;
_NODISCARD virtual std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const = 0;
};

View File

@ -1,13 +1,17 @@
#include "ZoneCreationContext.h"
namespace fs = std::filesystem;
ZoneCreationContext::ZoneCreationContext()
: m_asset_search_path(nullptr),
m_definition(nullptr)
: m_definition(nullptr),
m_asset_search_path(nullptr)
{
}
ZoneCreationContext::ZoneCreationContext(ISearchPath* assetSearchPath, ZoneDefinition* definition)
: m_asset_search_path(assetSearchPath),
m_definition(definition)
ZoneCreationContext::ZoneCreationContext(ZoneDefinition* definition, ISearchPath* assetSearchPath, fs::path outDir, fs::path cacheDir)
: m_definition(definition),
m_asset_search_path(assetSearchPath),
m_out_dir(std::move(outDir)),
m_cache_dir(std::move(cacheDir))
{
}

View File

@ -4,19 +4,20 @@
#include "Zone/AssetList/AssetList.h"
#include "Zone/Definition/ZoneDefinition.h"
#include <filesystem>
#include <memory>
#include <string>
#include <vector>
class ZoneCreationContext
{
public:
std::string m_game_name;
ISearchPath* m_asset_search_path;
ZoneDefinition* m_definition;
ISearchPath* m_asset_search_path;
std::filesystem::path m_out_dir;
std::filesystem::path m_cache_dir;
std::vector<std::unique_ptr<Gdt>> m_gdt_files;
AssetList m_ignored_assets;
ZoneCreationContext();
ZoneCreationContext(ISearchPath* assetSearchPath, ZoneDefinition* definition);
ZoneCreationContext(ZoneDefinition* definition, ISearchPath* assetSearchPath, std::filesystem::path outDir, std::filesystem::path cacheDir);
};

View File

@ -0,0 +1,91 @@
#include "ZoneCreator.h"
#include "Gdt/GdtLookup.h"
#include "IObjCompiler.h"
#include "IObjLoader.h"
#include "SearchPath/OutputPathFilesystem.h"
#include <cassert>
namespace
{
std::unique_ptr<Zone> CreateZone(const ZoneCreationContext& context, const GameId gameId)
{
return std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(gameId));
}
std::vector<Gdt*> CreateGdtList(const ZoneCreationContext& context)
{
std::vector<Gdt*> gdtList;
gdtList.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
gdtList.push_back(gdt.get());
return gdtList;
}
void IgnoreReferencesFromAssets(ZoneCreationContext& context)
{
for (const auto& assetEntry : context.m_definition->m_assets)
{
if (!assetEntry.m_is_reference)
continue;
context.m_ignored_assets.m_entries.emplace_back(assetEntry.m_asset_type, assetEntry.m_asset_name, assetEntry.m_is_reference);
}
}
} // namespace
namespace zone_creator
{
void InitLookup(const ZoneCreationContext& context, GdtLookup& lookup)
{
std::vector<const Gdt*> gdtFiles;
gdtFiles.reserve(context.m_gdt_files.size());
for (const auto& gdt : context.m_gdt_files)
{
gdtFiles.emplace_back(gdt.get());
}
lookup.Initialize(gdtFiles);
}
std::unique_ptr<Zone> CreateZoneForDefinition(GameId gameId, ZoneCreationContext& context)
{
auto zone = CreateZone(context, gameId);
IgnoreReferencesFromAssets(context);
IgnoredAssetLookup ignoredAssetLookup(context.m_ignored_assets);
GdtLookup lookup;
InitLookup(context, lookup);
const auto* objCompiler = IObjCompiler::GetObjCompilerForGame(gameId);
const auto* objLoader = IObjLoader::GetObjLoaderForGame(gameId);
AssetCreatorCollection creatorCollection(*zone);
ZoneDefinitionContext zoneDefinitionContext(*context.m_definition);
AssetCreationContext creationContext(*zone, &creatorCollection, &ignoredAssetLookup);
OutputPathFilesystem outDir(context.m_out_dir);
OutputPathFilesystem cacheDir(context.m_cache_dir);
objCompiler->ConfigureCreatorCollection(
creatorCollection, *zone, zoneDefinitionContext, *context.m_asset_search_path, lookup, creationContext, outDir, cacheDir);
objLoader->ConfigureCreatorCollection(creatorCollection, *zone, *context.m_asset_search_path, lookup);
for (const auto& assetEntry : context.m_definition->m_assets)
{
const auto* createdAsset = creationContext.LoadDependencyGeneric(assetEntry.m_asset_type, assetEntry.m_asset_name);
if (!createdAsset)
return nullptr;
++zoneDefinitionContext.m_asset_index_in_definition;
}
creatorCollection.FinalizeZone(creationContext);
return zone;
}
} // namespace zone_creator

View File

@ -0,0 +1,9 @@
#pragma once
#include "Zone/Zone.h"
#include "ZoneCreationContext.h"
namespace zone_creator
{
[[nodiscard]] std::unique_ptr<Zone> CreateZoneForDefinition(GameId game, ZoneCreationContext& context);
}

View File

@ -5,6 +5,7 @@ function ObjCommon:include(includes)
Common:include(includes)
json:include(includes)
minizip:include(includes)
Parser:include(includes)
includedirs {
path.join(ProjectFolder(), "ObjCommon")
}
@ -16,6 +17,7 @@ function ObjCommon:link(links)
links:linkto(Utils)
links:linkto(Common)
links:linkto(minizip)
links:linkto(Parser)
end
function ObjCommon:use()

View File

@ -0,0 +1,34 @@
#include "Csv/CsvHeaderRow.h"
CsvHeaderRow::CsvHeaderRow() = default;
bool CsvHeaderRow::Read(const CsvInputStream& inputStream)
{
if (!m_header_row.empty())
return false;
return inputStream.NextRow(m_header_row);
}
const std::string& CsvHeaderRow::HeaderNameForColumn(const unsigned columnIndex) const
{
return m_header_row[columnIndex];
}
bool CsvHeaderRow::RequireIndexForHeader(const std::string& headerName, unsigned& out) const
{
const auto existingHeader = std::ranges::find(m_header_row, headerName);
if (existingHeader == m_header_row.end())
return false;
out = std::distance(m_header_row.begin(), existingHeader);
return true;
}
std::optional<unsigned> CsvHeaderRow::GetIndexForHeader(const std::string& headerName) const
{
unsigned result;
if (!RequireIndexForHeader(headerName, result))
return std::nullopt;
return result;
}

View File

@ -0,0 +1,22 @@
#pragma once
#include "Csv/CsvStream.h"
#include <optional>
#include <string>
#include <vector>
class CsvHeaderRow
{
public:
CsvHeaderRow();
bool Read(const CsvInputStream& inputStream);
const std::string& HeaderNameForColumn(unsigned columnIndex) const;
bool RequireIndexForHeader(const std::string& headerName, unsigned& out) const;
[[nodiscard]] std::optional<unsigned> GetIndexForHeader(const std::string& headerName) const;
private:
std::vector<std::string> m_header_row;
};

View File

@ -1,14 +1,88 @@
#include "CsvStream.h"
#include "Utils/StringUtils.h"
#include <cstdlib>
#include <sstream>
constexpr char CSV_SEPARATOR = ',';
CsvCell::CsvCell(std::string value)
: m_value(std::move(value))
{
}
bool CsvCell::AsFloat(float& out) const
{
const char* startPtr = m_value.c_str();
char* endPtr;
out = std::strtof(startPtr, &endPtr);
if (endPtr == startPtr)
return false;
for (const auto* c = endPtr; *c; c++)
{
if (!isspace(*c))
return false;
}
return true;
}
bool CsvCell::AsInt32(int32_t& out) const
{
const char* startPtr = m_value.c_str();
char* endPtr;
out = std::strtol(startPtr, &endPtr, 0);
if (endPtr == startPtr)
return false;
for (const auto* c = endPtr; *c; c++)
{
if (!isspace(*c))
return false;
}
return true;
}
bool CsvCell::AsUInt32(uint32_t& out) const
{
const char* startPtr = m_value.c_str();
char* endPtr;
out = std::strtoul(startPtr, &endPtr, 0);
if (endPtr == startPtr)
return false;
for (const auto* c = endPtr; *c; c++)
{
if (!isspace(*c))
return false;
}
return true;
}
CsvInputStream::CsvInputStream(std::istream& stream)
: m_stream(stream)
{
}
bool CsvInputStream::NextRow(std::vector<CsvCell>& out) const
{
if (!out.empty())
out.clear();
return EmitNextRow(
[&out](std::string value)
{
out.emplace_back(std::move(value));
});
}
bool CsvInputStream::NextRow(std::vector<std::string>& out) const
{
if (!out.empty())
@ -38,13 +112,17 @@ bool CsvInputStream::EmitNextRow(const std::function<void(std::string)>& cb) con
auto c = m_stream.get();
const auto isEof = c == EOF;
std::ostringstream col;
auto content = false;
while (c != EOF)
{
if (c == CSV_SEPARATOR)
{
cb(col.str());
auto value = col.str();
utils::StringTrimR(value);
cb(std::move(value));
col.clear();
col.str(std::string());
content = false;
}
else if (c == '\r')
{
@ -57,8 +135,14 @@ bool CsvInputStream::EmitNextRow(const std::function<void(std::string)>& cb) con
{
break;
}
else if (isspace(c))
{
if (content)
col << static_cast<char>(c);
}
else
{
content = true;
col << static_cast<char>(c);
}
@ -67,7 +151,9 @@ bool CsvInputStream::EmitNextRow(const std::function<void(std::string)>& cb) con
if (!isEof)
{
cb(col.str());
auto value = col.str();
utils::StringTrimR(value);
cb(std::move(value));
}
return !isEof;

View File

@ -1,16 +1,30 @@
#pragma once
#include "Utils/MemoryManager.h"
#include <cstdint>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
class CsvCell
{
public:
explicit CsvCell(std::string value);
bool AsFloat(float& out) const;
bool AsInt32(int32_t& out) const;
bool AsUInt32(uint32_t& out) const;
std::string m_value;
};
class CsvInputStream
{
public:
explicit CsvInputStream(std::istream& stream);
bool NextRow(std::vector<CsvCell>& out) const;
bool NextRow(std::vector<std::string>& out) const;
bool NextRow(std::vector<const char*>& out, MemoryManager& memory) const;

View File

@ -1,80 +0,0 @@
#include "Csv/ParsedCsv.h"
ParsedCsvRow::ParsedCsvRow(std::unordered_map<std::string, size_t>& headers, std::vector<std::string> row)
: headers(headers),
values(std::move(row))
{
}
std::string ParsedCsvRow::GetValue(const std::string& header, const bool required) const
{
if (this->headers.find(header) == this->headers.end())
{
if (required)
std::cerr << "ERROR: Required column \"" << header << "\" was not found\n";
else
std::cerr << "WARNING: Expected column \"" << header << "\" was not found\n";
return {};
}
auto& value = this->values.at(this->headers[header]);
if (required && value.empty())
{
std::cerr << "ERROR: Required column \"" << header << "\" does not have a value\n";
return {};
}
return value;
}
float ParsedCsvRow::GetValueFloat(const std::string& header, const bool required) const
{
const auto& value = this->GetValue(header, required);
if (!value.empty())
{
std::istringstream ss(value);
float out;
ss >> out;
return out;
}
return {};
}
ParsedCsv::ParsedCsv(const CsvInputStream& inputStream, const bool hasHeaders)
{
std::vector<std::vector<std::string>> csvLines;
std::vector<std::string> currentLine;
while (inputStream.NextRow(currentLine))
{
csvLines.emplace_back(std::move(currentLine));
currentLine = std::vector<std::string>();
}
if (hasHeaders)
{
const auto& headersRow = csvLines[0];
for (auto i = 0u; i < headersRow.size(); i++)
{
this->headers[headersRow[i]] = i;
}
}
for (auto i = hasHeaders ? 1u : 0u; i < csvLines.size(); i++)
{
auto& rowValues = csvLines[i];
this->rows.emplace_back(this->headers, std::move(rowValues));
}
}
size_t ParsedCsv::Size() const
{
return this->rows.size();
}
ParsedCsvRow ParsedCsv::operator[](const size_t index) const
{
return this->rows.at(index);
}

View File

@ -1,45 +0,0 @@
#pragma once
#include "Csv/CsvStream.h"
#include "Utils/ClassUtils.h"
#include <sstream>
#include <unordered_map>
class ParsedCsvRow
{
std::unordered_map<std::string, size_t>& headers;
std::vector<std::string> values;
public:
explicit ParsedCsvRow(std::unordered_map<std::string, size_t>& headers, std::vector<std::string> row);
_NODISCARD std::string GetValue(const std::string& header, bool required = false) const;
_NODISCARD float GetValueFloat(const std::string& header, bool required = false) const;
template<typename T> T GetValueInt(const std::string& header, const bool required = false) const
{
const auto& value = this->GetValue(header, required);
if (!value.empty())
{
std::istringstream ss(value);
long long out;
ss >> out;
return static_cast<T>(out);
}
return {};
}
};
class ParsedCsv
{
std::unordered_map<std::string, size_t> headers;
std::vector<ParsedCsvRow> rows;
public:
explicit ParsedCsv(const CsvInputStream& inputStream, bool hasHeaders = true);
_NODISCARD size_t Size() const;
ParsedCsvRow operator[](size_t index) const;
};

View File

@ -0,0 +1,58 @@
#pragma once
#include "Game/IW4/IW4.h"
#include "Json/JsonCommon.h"
#include "Json/JsonExtension.h"
#include <memory>
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
#include <vector>
namespace IW4
{
NLOHMANN_JSON_SERIALIZE_ENUM(LbColType,
{
{LBCOL_TYPE_NUMBER, "number" },
{LBCOL_TYPE_TIME, "time" },
{LBCOL_TYPE_LEVELXP, "levelxp" },
{LBCOL_TYPE_PRESTIGE, "prestige" },
{LBCOL_TYPE_BIGNUMBER, "bignumber"},
{LBCOL_TYPE_PERCENT, "percent" },
});
NLOHMANN_JSON_SERIALIZE_ENUM(LbAggType,
{
{LBAGG_TYPE_MIN, "min" },
{LBAGG_TYPE_MAX, "max" },
{LBAGG_TYPE_SUM, "sum" },
{LBAGG_TYPE_LAST, "last"},
});
class JsonColumnDef
{
public:
std::string name;
int colId;
std::optional<int> propertyId;
std::optional<bool> hidden;
std::optional<std::string> statName;
LbColType type;
std::optional<int> precision;
LbAggType aggregationFunction;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonColumnDef, name, colId, propertyId, hidden, statName, type, precision, aggregationFunction);
class JsonLeaderboardDef
{
public:
int id;
std::optional<int> xpColId;
std::optional<int> prestigeColId;
std::vector<JsonColumnDef> columns;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonLeaderboardDef, id, xpColId, prestigeColId, columns);
} // namespace IW4

View File

@ -1,4 +1,5 @@
#pragma once
#include "Game/IW4/IW4.h"
namespace IW4

Some files were not shown because too many files have changed in this diff Show More