sourcepp 2025.2.12.dev1__tar.gz → 2025.2.16.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ endif()
30
30
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
31
31
 
32
32
  set(SOURCEPP_BUILD_PYTHON_WRAPPERS ON CACHE INTERNAL "" FORCE)
33
- set(SOURCEPP_VERSION "2025.2.12dev1")
33
+ set(SOURCEPP_VERSION "2025.2.16dev1")
34
34
 
35
35
  # As weird as this looks, this is necessary for sdist wheel
36
36
  set(SOURCEPP_PYTHON_IS_SUBDIR OFF)
@@ -41,6 +41,6 @@ else()
41
41
  FetchContent_Declare(
42
42
  sourcepp
43
43
  GIT_REPOSITORY "https://github.com/craftablescience/sourcepp.git"
44
- GIT_TAG "109a8cd7348af99447f9675c340df66cae2bf1b5")
44
+ GIT_TAG "c05d8a47b06affa5b60d35332bb0ce3c10ca744f")
45
45
  FetchContent_MakeAvailable(sourcepp)
46
46
  endif()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sourcepp
3
- Version: 2025.2.12.dev1
3
+ Version: 2025.2.16.dev1
4
4
  Summary: Several modern C++20 libraries for sanely parsing Valve formats.
5
5
  Home-page: https://github.com/craftablescience/sourcepp
6
6
  Author-Email: craftablescience <lauralewisdev@gmail.com>
@@ -180,17 +180,11 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
180
180
  </tr>
181
181
  <tr><!-- empty row to disable github striped bg color --></tr>
182
182
  <tr>
183
- <td rowspan="29"><code>vpkpp</code></td>
183
+ <td rowspan="23"><code>vpkpp</code></td>
184
184
  <td>007 v1.1, v1.3 (007 - Nightfire)</td>
185
185
  <td align="center">✅</td>
186
186
  <td align="center">❌</td>
187
- <td rowspan="29" align="center">C<br>C#</td>
188
- </tr>
189
- <tr><!-- empty row to disable github striped bg color --></tr>
190
- <tr>
191
- <td><a href="https://developer.valvesoftware.com/wiki/Bonus_Maps">BMZ</a></td>
192
- <td align="center">✅</td>
193
- <td align="center">✅</td>
187
+ <td rowspan="23" align="center">C<br>C#</td>
194
188
  </tr>
195
189
  <tr><!-- empty row to disable github striped bg color --></tr>
196
190
  <tr>
@@ -238,18 +232,6 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
238
232
  <td align="center">✅</td>
239
233
  </tr>
240
234
  <tr><!-- empty row to disable github striped bg color --></tr>
241
- <tr>
242
- <td><a href="https://doomwiki.org/wiki/PK3">PK3</a> (Quake III)</td>
243
- <td align="center">✅</td>
244
- <td align="center">✅</td>
245
- </tr>
246
- <tr><!-- empty row to disable github striped bg color --></tr>
247
- <tr>
248
- <td><a href="https://doomwiki.org/wiki/PK4">PK4</a> (Quake IV, Doom 3)</td>
249
- <td align="center">✅</td>
250
- <td align="center">✅</td>
251
- </tr>
252
- <tr><!-- empty row to disable github striped bg color --></tr>
253
235
  <tr>
254
236
  <td>
255
237
  <a href="https://developer.valvesoftware.com/wiki/VPK">VPK</a> pre-v1, v1-2, v54
@@ -273,17 +255,25 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
273
255
  </tr>
274
256
  <tr><!-- empty row to disable github striped bg color --></tr>
275
257
  <tr>
276
- <td>ZIP</td>
258
+ <td>
259
+ ZIP, and some of its aliases:
260
+ <br> &bull; <a href="https://github.com/BEEmod/BEE2-items">BEE_PACK</a> (BEE2.4 Package)
261
+ <br> &bull; <a href="https://developer.valvesoftware.com/wiki/Bonus_Maps">BMZ</a> (Source 1 Bonus Maps)
262
+ <br> &bull; FPK (Tactical Intervention)
263
+ <br> &bull; <a href="https://doomwiki.org/wiki/PK3">PK3</a> (Quake III)
264
+ <br> &bull; <a href="https://doomwiki.org/wiki/PK4">PK4</a> (Quake IV, Doom 3)
265
+ <br> &bull; PKZ (Quake II RTX)
266
+ </td>
277
267
  <td align="center">✅</td>
278
268
  <td align="center">✅</td>
279
269
  </tr>
280
270
  <tr><!-- empty row to disable github striped bg color --></tr>
281
271
  <tr>
282
- <td rowspan="29"><code>vtfpp</code></td>
272
+ <td rowspan="31"><code>vtfpp</code></td>
283
273
  <td><a href="https://wiki.mozilla.org/APNG_Specification">APNG</a></td>
284
274
  <td align="center">✅</td>
285
275
  <td align="center">❌</td>
286
- <td rowspan="29" align="center">Python</td>
276
+ <td rowspan="31" align="center">Python</td>
287
277
  </tr>
288
278
  <tr><!-- empty row to disable github striped bg color --></tr>
289
279
  <tr>
@@ -358,6 +348,12 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
358
348
  <td align="center">✅</td>
359
349
  </tr>
360
350
  <tr><!-- empty row to disable github striped bg color --></tr>
351
+ <tr>
352
+ <td>TTX (TTH, TTZ) v1.0</td>
353
+ <td align="center">✅</td>
354
+ <td align="center">✅</td>
355
+ </tr>
356
+ <tr><!-- empty row to disable github striped bg color --></tr>
361
357
  <tr>
362
358
  <td>
363
359
  <a href="https://developer.valvesoftware.com/wiki/VTF_(Valve_Texture_Format)">VTF</a> v7.0-7.6
@@ -157,17 +157,11 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
157
157
  </tr>
158
158
  <tr><!-- empty row to disable github striped bg color --></tr>
159
159
  <tr>
160
- <td rowspan="29"><code>vpkpp</code></td>
160
+ <td rowspan="23"><code>vpkpp</code></td>
161
161
  <td>007 v1.1, v1.3 (007 - Nightfire)</td>
162
162
  <td align="center">✅</td>
163
163
  <td align="center">❌</td>
164
- <td rowspan="29" align="center">C<br>C#</td>
165
- </tr>
166
- <tr><!-- empty row to disable github striped bg color --></tr>
167
- <tr>
168
- <td><a href="https://developer.valvesoftware.com/wiki/Bonus_Maps">BMZ</a></td>
169
- <td align="center">✅</td>
170
- <td align="center">✅</td>
164
+ <td rowspan="23" align="center">C<br>C#</td>
171
165
  </tr>
172
166
  <tr><!-- empty row to disable github striped bg color --></tr>
173
167
  <tr>
@@ -215,18 +209,6 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
215
209
  <td align="center">✅</td>
216
210
  </tr>
217
211
  <tr><!-- empty row to disable github striped bg color --></tr>
218
- <tr>
219
- <td><a href="https://doomwiki.org/wiki/PK3">PK3</a> (Quake III)</td>
220
- <td align="center">✅</td>
221
- <td align="center">✅</td>
222
- </tr>
223
- <tr><!-- empty row to disable github striped bg color --></tr>
224
- <tr>
225
- <td><a href="https://doomwiki.org/wiki/PK4">PK4</a> (Quake IV, Doom 3)</td>
226
- <td align="center">✅</td>
227
- <td align="center">✅</td>
228
- </tr>
229
- <tr><!-- empty row to disable github striped bg color --></tr>
230
212
  <tr>
231
213
  <td>
232
214
  <a href="https://developer.valvesoftware.com/wiki/VPK">VPK</a> pre-v1, v1-2, v54
@@ -250,17 +232,25 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
250
232
  </tr>
251
233
  <tr><!-- empty row to disable github striped bg color --></tr>
252
234
  <tr>
253
- <td>ZIP</td>
235
+ <td>
236
+ ZIP, and some of its aliases:
237
+ <br> &bull; <a href="https://github.com/BEEmod/BEE2-items">BEE_PACK</a> (BEE2.4 Package)
238
+ <br> &bull; <a href="https://developer.valvesoftware.com/wiki/Bonus_Maps">BMZ</a> (Source 1 Bonus Maps)
239
+ <br> &bull; FPK (Tactical Intervention)
240
+ <br> &bull; <a href="https://doomwiki.org/wiki/PK3">PK3</a> (Quake III)
241
+ <br> &bull; <a href="https://doomwiki.org/wiki/PK4">PK4</a> (Quake IV, Doom 3)
242
+ <br> &bull; PKZ (Quake II RTX)
243
+ </td>
254
244
  <td align="center">✅</td>
255
245
  <td align="center">✅</td>
256
246
  </tr>
257
247
  <tr><!-- empty row to disable github striped bg color --></tr>
258
248
  <tr>
259
- <td rowspan="29"><code>vtfpp</code></td>
249
+ <td rowspan="31"><code>vtfpp</code></td>
260
250
  <td><a href="https://wiki.mozilla.org/APNG_Specification">APNG</a></td>
261
251
  <td align="center">✅</td>
262
252
  <td align="center">❌</td>
263
- <td rowspan="29" align="center">Python</td>
253
+ <td rowspan="31" align="center">Python</td>
264
254
  </tr>
265
255
  <tr><!-- empty row to disable github striped bg color --></tr>
266
256
  <tr>
@@ -335,6 +325,12 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
335
325
  <td align="center">✅</td>
336
326
  </tr>
337
327
  <tr><!-- empty row to disable github striped bg color --></tr>
328
+ <tr>
329
+ <td>TTX (TTH, TTZ) v1.0</td>
330
+ <td align="center">✅</td>
331
+ <td align="center">✅</td>
332
+ </tr>
333
+ <tr><!-- empty row to disable github striped bg color --></tr>
338
334
  <tr>
339
335
  <td>
340
336
  <a href="https://developer.valvesoftware.com/wiki/VTF_(Valve_Texture_Format)">VTF</a> v7.0-7.6
@@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build"
5
5
 
6
6
  [project]
7
7
  name = "sourcepp"
8
- version = "2025.2.12dev1"
8
+ version = "2025.2.16dev1"
9
9
  authors = [{ name = "craftablescience", email = "lauralewisdev@gmail.com" }]
10
10
  maintainers = [{ name = "craftablescience", email = "lauralewisdev@gmail.com" }]
11
11
  description = "Several modern C++20 libraries for sanely parsing Valve formats."
@@ -1,5 +1,5 @@
1
1
  from ._sourcepp_impl import __doc__, bsppp, gamepp, sourcepp, steampp, toolpp, vcryptpp, vtfpp
2
2
 
3
3
  __author__ = "craftablescience"
4
- __version__ = "2025.2.12dev1"
4
+ __version__ = "2025.2.16dev1"
5
5
  __all__ = ['__author__', '__doc__', '__version__', 'bsppp', 'gamepp', 'sourcepp', 'steampp', 'toolpp', 'vcryptpp', 'vtfpp']
@@ -17,7 +17,7 @@ inline void register_python(py::module_& m) {
17
17
  auto VFONT = vcryptpp.def_submodule("VFONT");
18
18
  using namespace VFONT;
19
19
 
20
- VFONT.attr("IDENTIFIER") = IDENTIFIER;
20
+ VFONT.attr("SIGNATURE") = SIGNATURE;
21
21
 
22
22
  VFONT.attr("MAGIC") = MAGIC;
23
23
 
@@ -1,7 +1,5 @@
1
1
  #pragma once
2
2
 
3
- #include <tuple>
4
-
5
3
  #include <nanobind/nanobind.h>
6
4
  #include <nanobind/stl/array.h>
7
5
  #include <nanobind/stl/pair.h>
@@ -291,6 +289,33 @@ void register_python(py::module_& m) {
291
289
  })
292
290
  .def("bake_to_file", py::overload_cast<const std::string&>(&SHT::bake, py::const_), py::arg("sht_path"));
293
291
 
292
+ vtfpp.attr("TTH_SIGNATURE") = TTH_SIGNATURE;
293
+
294
+ auto cVTF = py::class_<VTF>(vtfpp, "VTF");
295
+
296
+ py::class_<TTX>(vtfpp, "TTX")
297
+ .def(py::init<VTF&&>(), py::arg("vtf"))
298
+ .def("__init__", [](TTX* self, const py::bytes& tthData, const py::bytes& ttzData) {
299
+ return new(self) TTX{{reinterpret_cast<const std::byte*>(tthData.data()), tthData.size()}, {reinterpret_cast<const std::byte*>(ttzData.data()), ttzData.size()}};
300
+ }, py::arg("tth_data"), py::arg("ttz_data"))
301
+ .def(py::init<const std::string&, const std::string&>(), py::arg("tth_path"), py::arg("ttz_path"))
302
+ .def("__bool__", &TTX::operator bool, py::is_operator())
303
+ .def_prop_rw("version_major", &TTX::getMajorVersion, &TTX::setMajorVersion)
304
+ .def_prop_rw("version_minor", &TTX::getMinorVersion, &TTX::setMinorVersion)
305
+ .def_prop_rw("aspect_ratio_type", &TTX::getAspectRatioType, &TTX::setAspectRatioType)
306
+ .def_prop_rw("mip_flags", py::overload_cast<>(&TTX::getMipFlags, py::const_), [](TTX& self, const std::vector<uint64_t>& mipFlags) {
307
+ self.getMipFlags() = mipFlags;
308
+ }, py::rv_policy::reference_internal)
309
+ .def_prop_rw("vtf", py::overload_cast<>(&TTX::getVTF, py::const_), [](TTX& self, const VTF& vtf) {
310
+ self.getVTF() = vtf;
311
+ }, py::rv_policy::reference_internal)
312
+ .def_prop_rw("compression_level", &TTX::getCompressionLevel, &TTX::setCompressionLevel)
313
+ .def("bake", [](const TTX& self) -> std::pair<py::bytes, py::bytes> {
314
+ const auto d = self.bake();
315
+ return {py::bytes{d.first.data(), d.first.size()}, py::bytes{d.second.data(), d.second.size()}};
316
+ })
317
+ .def("bake_to_file", py::overload_cast<const std::string&, const std::string&>(&TTX::bake, py::const_), py::arg("tth_path"), py::arg("ttz_path"));
318
+
294
319
  vtfpp.attr("VTF_SIGNATURE") = VTF_SIGNATURE;
295
320
 
296
321
  py::enum_<CompressionMethod>(vtfpp, "CompressionMethod", py::is_arithmetic())
@@ -330,43 +355,40 @@ void register_python(py::module_& m) {
330
355
  .def("get_data_as_aux_compression_method", &Resource::getDataAsAuxCompressionMethod)
331
356
  .def("get_data_as_aux_compression_length", &Resource::getDataAsAuxCompressionLength, py::arg("mip"), py::arg("mip_count"), py::arg("frame"), py::arg("frame_count"), py::arg("face"), py::arg("face_count"));
332
357
 
333
- auto cVTF = py::class_<VTF>(vtfpp, "VTF");
334
-
335
358
  py::enum_<VTF::Flags>(cVTF, "Flags", py::is_flag())
336
- .value("NONE", VTF::FLAG_NONE)
337
- .value("POINT_SAMPLE", VTF::FLAG_POINT_SAMPLE)
338
- .value("TRILINEAR", VTF::FLAG_TRILINEAR)
339
- .value("CLAMP_S", VTF::FLAG_CLAMP_S)
340
- .value("CLAMP_T", VTF::FLAG_CLAMP_T)
341
- .value("ANISOTROPIC", VTF::FLAG_ANISOTROPIC)
342
- .value("HINT_DXT5", VTF::FLAG_HINT_DXT5)
343
- .value("SRGB", VTF::FLAG_SRGB)
344
- .value("NO_COMPRESS", VTF::FLAG_NO_COMPRESS)
345
- .value("NORMAL", VTF::FLAG_NORMAL)
346
- .value("NO_MIP", VTF::FLAG_NO_MIP)
347
- .value("NO_LOD", VTF::FLAG_NO_LOD)
348
- .value("LOAD_LOWEST_MIPS", VTF::FLAG_LOAD_LOWEST_MIPS)
349
- .value("PROCEDURAL", VTF::FLAG_PROCEDURAL)
350
- .value("ONE_BIT_ALPHA", VTF::FLAG_ONE_BIT_ALPHA)
351
- .value("MULTI_BIT_ALPHA", VTF::FLAG_MULTI_BIT_ALPHA)
352
- .value("ENVMAP", VTF::FLAG_ENVMAP)
353
- .value("RENDERTARGET", VTF::FLAG_RENDERTARGET)
354
- .value("DEPTH_RENDERTARGET", VTF::FLAG_DEPTH_RENDERTARGET)
355
- .value("NO_DEBUG_OVERRIDE", VTF::FLAG_NO_DEBUG_OVERRIDE)
356
- .value("SINGLE_COPY", VTF::FLAG_SINGLE_COPY)
357
- .value("ONE_OVER_MIP_LEVEL_IN_ALPHA", VTF::FLAG_ONE_OVER_MIP_LEVEL_IN_ALPHA)
358
- .value("PREMULTIPLY_COLOR_BY_ONE_OVER_MIP_LEVEL", VTF::FLAG_PREMULTIPLY_COLOR_BY_ONE_OVER_MIP_LEVEL)
359
- .value("NORMAL_TO_DUDV", VTF::FLAG_NORMAL_TO_DUDV)
360
- .value("ALPHA_TEST_MIP_GENERATION", VTF::FLAG_ALPHA_TEST_MIP_GENERATION)
361
- .value("NO_DEPTH_BUFFER", VTF::FLAG_NO_DEPTH_BUFFER)
362
- .value("NICE_FILTERED", VTF::FLAG_NICE_FILTERED)
363
- .value("CLAMP_U", VTF::FLAG_CLAMP_U)
364
- .value("VERTEX_TEXTURE", VTF::FLAG_VERTEX_TEXTURE)
365
- .value("SSBUMP", VTF::FLAG_SSBUMP)
366
- .value("UNFILTERABLE_OK", VTF::FLAG_UNFILTERABLE_OK)
367
- .value("BORDER", VTF::FLAG_BORDER)
368
- .value("SPECVAR_RED", VTF::FLAG_SPECVAR_RED)
369
- .value("SPECVAR_ALPHA", VTF::FLAG_SPECVAR_ALPHA)
359
+ .value("NONE", VTF::FLAG_NONE)
360
+ .value("POINT_SAMPLE", VTF::FLAG_POINT_SAMPLE)
361
+ .value("TRILINEAR", VTF::FLAG_TRILINEAR)
362
+ .value("CLAMP_S", VTF::FLAG_CLAMP_S)
363
+ .value("CLAMP_T", VTF::FLAG_CLAMP_T)
364
+ .value("ANISOTROPIC", VTF::FLAG_ANISOTROPIC)
365
+ .value("HINT_DXT5", VTF::FLAG_HINT_DXT5)
366
+ .value("PWL_CORRECTED", VTF::FLAG_PWL_CORRECTED)
367
+ .value("NORMAL", VTF::FLAG_NORMAL)
368
+ .value("NO_MIP", VTF::FLAG_NO_MIP)
369
+ .value("NO_LOD", VTF::FLAG_NO_LOD)
370
+ .value("LOAD_ALL_MIPS", VTF::FLAG_LOAD_ALL_MIPS)
371
+ .value("PROCEDURAL", VTF::FLAG_PROCEDURAL)
372
+ .value("ONE_BIT_ALPHA", VTF::FLAG_ONE_BIT_ALPHA)
373
+ .value("MULTI_BIT_ALPHA", VTF::FLAG_MULTI_BIT_ALPHA)
374
+ .value("ENVMAP", VTF::FLAG_ENVMAP)
375
+ .value("RENDERTARGET", VTF::FLAG_RENDERTARGET)
376
+ .value("DEPTH_RENDERTARGET", VTF::FLAG_DEPTH_RENDERTARGET)
377
+ .value("NO_DEBUG_OVERRIDE", VTF::FLAG_NO_DEBUG_OVERRIDE)
378
+ .value("SINGLE_COPY", VTF::FLAG_SINGLE_COPY)
379
+ .value("SRGB", VTF::FLAG_SRGB)
380
+ .value("DEFAULT_POOL", VTF::FLAG_DEFAULT_POOL)
381
+ .value("COMBINED", VTF::FLAG_COMBINED)
382
+ .value("ASYNC_DOWNLOAD", VTF::FLAG_ASYNC_DOWNLOAD)
383
+ .value("NO_DEPTH_BUFFER", VTF::FLAG_NO_DEPTH_BUFFER)
384
+ .value("SKIP_INITIAL_DOWNLOAD", VTF::FLAG_SKIP_INITIAL_DOWNLOAD)
385
+ .value("CLAMP_U", VTF::FLAG_CLAMP_U)
386
+ .value("VERTEX_TEXTURE", VTF::FLAG_VERTEX_TEXTURE)
387
+ .value("SSBUMP", VTF::FLAG_SSBUMP)
388
+ .value("LOAD_MOST_MIPS", VTF::FLAG_LOAD_MOST_MIPS)
389
+ .value("BORDER", VTF::FLAG_BORDER)
390
+ .value("YCOCG", VTF::FLAG_YCOCG)
391
+ .value("ASYNC_SKIP_INITIAL_LOW_RES", VTF::FLAG_ASYNC_SKIP_INITIAL_LOW_RES)
370
392
  .export_values();
371
393
 
372
394
  py::enum_<VTF::Platform>(cVTF, "Platform")
@@ -398,9 +420,11 @@ void register_python(py::module_& m) {
398
420
  .def_rw("bumpmap_scale", &VTF::CreationOptions::bumpMapScale);
399
421
 
400
422
  cVTF
401
- .def_ro_static("FLAG_MASK_GENERATED", &VTF::FLAG_MASK_GENERATED)
402
- .def_ro_static("FORMAT_UNCHANGED", &VTF::FORMAT_UNCHANGED)
403
- .def_ro_static("FORMAT_DEFAULT", &VTF::FORMAT_DEFAULT)
423
+ .def_ro_static("FLAG_MASK_AFTER_V7_3", &VTF::FLAG_MASK_AFTER_V7_3)
424
+ .def_ro_static("FLAG_MASK_GENERATED", &VTF::FLAG_MASK_GENERATED)
425
+ .def_ro_static("FLAG_MASK_SRGB", &VTF::FLAG_MASK_SRGB)
426
+ .def_ro_static("FORMAT_UNCHANGED", &VTF::FORMAT_UNCHANGED)
427
+ .def_ro_static("FORMAT_DEFAULT", &VTF::FORMAT_DEFAULT)
404
428
  .def(py::init<>())
405
429
  .def("__init__", [](VTF* self, const py::bytes& vtfData, bool parseHeaderOnly = false) {
406
430
  return new(self) VTF{std::span{reinterpret_cast<const std::byte*>(vtfData.data()), vtfData.size()}, parseHeaderOnly};
@@ -469,7 +493,7 @@ void register_python(py::module_& m) {
469
493
  .def("remove_particle_sheet_resource", &VTF::removeParticleSheetResource)
470
494
  .def("set_crc_resource", &VTF::setCRCResource, py::arg("value"))
471
495
  .def("remove_crc_resource", &VTF::removeCRCResource)
472
- .def("set_lod_resource", &VTF::setLODResource, py::arg("u"), py::arg("v"))
496
+ .def("set_lod_resource", &VTF::setLODResource, py::arg("u"), py::arg("v"), py::arg("u360") = 0, py::arg("v360") = 0)
473
497
  .def("remove_lod_resource", &VTF::removeLODResource)
474
498
  .def("set_extended_flags_resource", &VTF::setExtendedFlagsResource, py::arg("value"))
475
499
  .def("remove_extended_flags_resource", &VTF::removeExtendedFlagsResource)