80 Commits

Author SHA1 Message Date
Kawe Mazidjatari
11864f8902 Add all public headers to CMake projects
Added all public headers to CMake projects, also moved some files around in the public directory. Translation units have been moved to the libraries that were responsible for implementing them, as this game is monolithic.
2023-05-15 14:47:03 +02:00
Kawe Mazidjatari
9f44bcc818 Treat compiler warnings as errors
Treat them as errors globally. Most of the time a warning is a bug, or problem in code that could be solved in a different (better) manner. Thirdparty code have this disabled. The warnings as errors option can be globally disabled through the CMake GUI, but this is not recommended.
2023-05-15 09:44:26 +02:00
Kawe Mazidjatari
6a86ae2606 Cleanup CMakeLists files
Light cleanup in CMakeLists files. Split protocols and improve filter names.
2023-05-14 17:36:08 +02:00
Kawe Mazidjatari
8d38de1ce0 Move client only code from rtech libraries
Moved, and renamed to 'CreateTextureResource'. Reason for move was that the rtech libraries is used by server and client, and using this on dedicated requires linking directx libraries, as it has to be hooked (even when not used). Moved to client only code to avoid having to hook it. Material system is no longer linked to the dedicated server module, as nothing from it was getting used.
2023-05-13 18:03:48 +02:00
Kawe Mazidjatari
8dbc2024c6 CMake code improvements
Use the 'add_module' macro to add modules without creating duplicate code. This macro also takes a reuse PCH as parameter, so modules that need a precompiled header, could reuse those from different targets that compile them. This commit also restructures the group order of the generated solution files for easier code navigation.
2023-05-13 00:14:53 +02:00
Kawe Mazidjatari
f120354e96 Initial port to CMake
* All libraries have been isolated from each other, and build into separate artifacts.
* Project has been restructured to support isolating libraries.
* CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example).
* Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp).

TODO:
* Add a batch file to autogenerate all projects.
* Add support for dedicated server.
* Add support for client dll.

Bugs:
* Game crashes on the title screen after the UI script compiler has finished (root cause unknown).
* Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
2023-05-10 00:05:38 +02:00
Kawe Mazidjatari
5a90e2cff3 Remove deprecated workaround
No longer required as of commit f520cab4.
2023-04-18 18:41:06 +02:00
rexx
f520cab44b fix static prop exceptions
This fixes the exceptions that were caused by loading ported bsps with replaced models
CStaticProp::Init was using static prop lump data to request non-existent skins due to the replaced models, causing invalid material pointers to be fetched.
When encountered, these skins will be forced to 0 and an error will be printed.
Ideally these issues are fixed from within the bsp file before they are shipped.
2023-04-18 16:56:35 +01:00
Kawe Mazidjatari
16ea75d5a2 Fix clang-cl compile errors
Cannot concatenate __FUNCTION__ macro like this.
2023-04-01 13:10:22 +02:00
Kawe Mazidjatari
b508096016 Remove unused functions
These will no longer be used.
2023-03-15 00:00:28 +01:00
Kawe Mazidjatari
cae5037324 Initial fix for older game builds
SDK compiles and works for the S1 game now, still needs to be debugged further.
2023-03-01 00:09:38 +01:00
Kawe Mazidjatari
fb00aa5c37 Force 'CMaterialSystem::IsMaterialInternal' no inline
This seems to work a lot better for our crash handler. 'CMaterialSystem::IsMaterialInternal' still needs to be removed entirely in the future!
2023-02-17 23:56:56 +01:00
Kawe Mazidjatari
8537881781 Fix stream overlay bug
Unfree texture memory displayed the value of total texture memory. Offset search with 4 bytes to yield correct results.
2023-01-31 23:42:43 +01:00
Kawe Mazidjatari
34f69a5b1e Move crashhandler implementation to tier0 2023-01-31 22:13:40 +01:00
Amos
d76ed1098a Improve VFTable address logging
More standardized VFTable address logging.
2023-01-25 11:19:53 +01:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00
Kawe Mazidjatari
700bb48494 Fix compiler error 2022-12-28 15:38:34 +01:00
Kawe Mazidjatari
1376e1be82 Add temporary whitelist address for materialsystem crash case
This is required as we still have a very hacky approach for running 'custom' BSP files. Even though we are pretty much ready to move over the proper approach, we haven't been able to update all files yet. This is kept in place but will have to be deprecated and removed among with the MaterialSystem hack before the next release.
2022-12-27 23:10:51 +01:00
Marvin D
22506fa689 Fix VEH.
* Make sure IsMaterialInternal won't be inlined.
* Fix recurssive VEH throwing.
* Check if IsMaterialInternal caused exception and ignore it.
2022-12-24 16:40:04 +01:00
Kawe Mazidjatari
1493cc59ce Follow same string format convention as GameDLL 2022-12-05 01:00:31 +01:00
Kawe Mazidjatari
1021a95068 Merge branch 'SignatureMap' into indev 2022-12-04 14:21:14 +01:00
Marvin D
0ba475b62f Most likely depth variable in cmaterialglue 2022-12-03 00:34:24 +01:00
Kawe Mazidjatari
4cc3c28985 Deref VFTable pointer only once to obtain CShaderGlue::SetupShader
Due to the new cache changes, the pointer should only be dereferenced once.
2022-12-02 01:33:49 +01:00
Kawe Mazidjatari
2501c37044 Globally convert all byte patterns to strings
These get reconverted to masked byte patterns at runtime. With the signature map cache system, this will only happen when building the cache.
2022-12-01 22:44:55 +01:00
Kawe Mazidjatari
c24e8a9f21 Rename 'MOD_' to 'Mod_'
The engine names these functions as 'Mod_'.
2022-11-24 11:58:32 +01:00
Kawe Mazidjatari
a7c33d4df3 Use KeyValues system for level settings file instead
Previously we used Json, however the rest of the game features KeyValues. I changed the system to feature KeyValues instead, to maintain consistency. Also improved the logic behind loading/parsing so we don't reparse the same level settings file if the pointer is still valid and we are on the same level.
2022-11-24 11:10:46 +01:00
Marvin D
ae2c702dd0 Update cmaterialglue.h 2022-11-02 00:28:41 +01:00
Kawe Mazidjatari
bc361c7c85 Fix texture streaming debug overlay bug
Fix bug where we did not log the actual total streaming texture memory.
2022-10-30 10:18:22 +01:00
Marvin D
136ac06b7c ClipTransform, ScreenTransform (W2S) 2022-10-23 01:20:49 +02:00
Kawe Mazidjatari
5cfcc12ba5 Add new cvar for logging missing materials
The behavior has been changed; when a material is missing and bComplain is false, nothing gets printed to the console unless 'mat_alwaysComplain' is nonzero.
2022-10-21 21:49:10 +02:00
Kawe Mazidjatari
fb7f77f7cb Fix dedicated.dll compile errors 2022-10-13 02:41:09 +02:00
Kawe Mazidjatari
50fee7414d Missing material error logging
This commit implements missing material error logging.
When a material does not exist, it will get replaced with an error material, we log which material is missing, and with which error material it gets replaced with.
This commit also comes with some updates regarding the CMaterialGlue class, and some new types used by this class from the RePak project.
2022-10-13 02:22:50 +02:00
Kawe Mazidjatari
72a60f6f39 Fix project "dedicated" compile errors 2022-10-05 02:11:13 +02:00
Kawe Mazidjatari
a68fda98c1 Fix crash when loading arena maps caused by recent BSP crash fix
CMaterial and CMaterialGlue derive from the same abstract classes. The function that builds the culling map uses IMaterialInternal, which is used by CMaterial, CMaterialInternal and CMaterialSubRect. Added a check for CMaterialGlue as these are valid too.
2022-10-05 01:59:22 +02:00
Kawe Mazidjatari
7af660d613 Fixed rare bug where models where missing during level load
Some CMaterial instances are allocated on the heap, and we only check for bounds in .data/.pdata. Checking bounds is cheap, checking valid ptr's is not. However we are lucky most of the data is within the segments, so running this isn't too costly.
This fixes the problem where the large leaf model in worlds edge was missing.
2022-10-03 01:15:02 +02:00
Kawe Mazidjatari
d946f9d1a1 Fixed bug when reading text files using internal file system
Small oversight causing defect, but found during extensive tests and code inspection.
2022-09-01 01:05:15 +02:00
Kawe Mazidjatari
fc596a4715 Use internal FileSystem for loading level settings for STBSP overrides 2022-08-31 03:01:45 +02:00
Kawe Mazidjatari
5548a74d59 Major cleanup (see description)
* Fix all compiler error for GameSDK on S0 and S1.
* Remove some unused patterns and globals (launch performance gains of 100ms).
* Remove most duplicate patterns.
* Relocate globals from engine to a more appropriate location.
* Renamed some unknown vars to a more appropriate name (most of these where obtained a while back, but as we reversed more parts of the engine, some of these vars become known).
* Renamed some vars to fit the naming convention used in the SDK.
* Fixed pattern debug logging using the wrong pointer, thus displaying the wrong address.
2022-08-18 02:15:23 +02:00
Kawe Mazidjatari
8bf6dac3d8 Code improvements
* Use GetVirtualMethodTable for VFTable pointers.
* Pack CClientState to 4 bytes (this aligns it properly in memory).
* Use CClientState members directly for setting m_bRestrictServerCommands/m_bRestrictClientCommands.
2022-08-15 22:29:16 +02:00
Kawe Mazidjatari
88b3336758 Many small code improvements and optimizations
* Use c++ methods as much as possible.
* Use enum types for accessing NavMesh objects from array.
* Use size_t for for loops when testing against size types.
* Don't compute strlen twice of more on the same string.
* Don't use unnecessary c string casts if there is a method with a std::string overload.
* Don't create string objects from string pointers if we could use them directly.
* Don't initialize RCON password twice on each change, and don't set if the new password equals the old.
2022-08-11 11:07:45 +02:00
Kawe Mazidjatari
8c6ee8a834 Remove 'm' prefix from dll globals
Large commit.
2022-08-09 03:02:00 +02:00
PixieCore
178aeeb3fd Use GetVirtualMethodTable for VTable consts. 2022-07-21 20:36:47 +02:00
PixieCore
f57da25341 RTech changes.
* Added RPakAssetBinding_t.
* Added RPakUnknownStruct_t
* PatternScan the global RPakUnknownStruct_t.
* Renamed Members of CMaterialGlue
* RTechTextureInfo_t now has another unknown member named.
2022-07-20 11:27:42 +02:00
rexx
dad356b0c3 rename materialglue/shaderglue members 2022-07-18 22:00:03 +01:00
PixieCore
746e7e9996 CMaterialGlue changes.
* Reversed more of the class and fixed up member names.
2022-07-16 12:33:02 +02:00
PixieCore
1b2c0cecd0 CShaderGlue changes and RTech implementation.
* Added RTech::LoadShaderSet for the asset load routine
* Grabbing CShaderGlue::SetupShader and CShaderGlue::m_pVTable dynamically now
* Everything verified for every season, cross-compatible!
2022-07-04 22:52:10 +02:00
PixieCore
8860d9b1b8 fix compilation 2022-07-03 22:57:07 +02:00
PixieCore
2b1374cff8 Added CShaderGlue VTable context 2022-07-03 22:44:25 +02:00
PixieCore
1e2bfe6dd2 90% Fully reversed CShaderGlue 2022-07-03 21:55:35 +02:00
PixieCore
6a90314fc1 Update cshaderglue.h 2022-07-03 13:57:24 +02:00