3713 Commits

Author SHA1 Message Date
Kawe Mazidjatari
77521b61c6 RTech: add GUID helper functions to fix a defect
Several instances of Pak_GetValidAssetGUID() in the engine are calling the hashing algorithm twice; once to get the guid, once to return the guid. The rewrite eliminates the bug by returning the cached guid. This is still pending a hook to effectively replace the defective function(s).
2024-06-05 17:58:08 +02:00
Kawe Mazidjatari
328d88213c Miles: fix voice comm bus regression
Regression was caused in commit 3bb4ee625863c1dd503f07e0d480f4b3fd302c48. The new sound engine has breaking changes in its exports. Added shim layer to fix incompatibilities on the export 'MilesSampleSetSourceRaw'.
2024-06-01 02:23:55 +02:00
Kawe Mazidjatari
b25f5b181f Tier1: only set overflow flag if it hasn't been set already
Only set overflow flag in 'CBitRead::GrabNextDWord()' if it hasn't been set already, code now matches the assembly of the game executable.
2024-05-31 14:55:47 +02:00
Kawe Mazidjatari
b5f166085d Engine: mark cvar 'fps_max' as FCVAR_ARCHIVE
The new scripts now show a dedicated FPS limit option in the video settings, there is also a demand for having this cvar to persist its value. Marked as FCVAR_ARCHIVE so it gets saved to user profile settings.
2024-05-31 14:03:04 +02:00
Kawe Mazidjatari
0634b6ded6 VScript: fix compiler error on VS2017
Compiler error only happens on VS2017's compiler "*\ found outside comment". Fixed error while also making the comment more clear.
2024-05-31 14:01:11 +02:00
Kawe Mazidjatari
442f28e6cc Engine: check for bitbuf overflow after reading voice data 2024-05-31 13:44:27 +02:00
Kawe Mazidjatari
d1c4d6f1d6 Engine: fix CLC voice data netmessage structures
The field 'void* unk0' is actually 'CNetMessage::m_pMessageHandler'. Since this type was taken from the IDB (in which this field is actually part of the netmessage implementation itself, since SVC messages use a different vtable and its the only way to have it show correctly in the output), an extra 8 bytes shift occurred rendering the system defective. Removed the field and the structure now matches that of the game executable.
2024-05-31 13:43:47 +02:00
Kawe Mazidjatari
3bb4ee6258 Miles: upgrade sound engine to v10.0.47.7
Internal structure 'IntProjectData_t' has changed, padding size adjusted to accommodate changes.
Sound engine taken from retail build R5pc_r5-61_J318_CL651503_2020_10_14_18_51.
2024-05-29 17:56:55 +02:00
Kawe Mazidjatari
a1c9f3e49e RTech: enforce naming consistency in define names
renamed PLATFORM_PAK_PATH and PLATFORM_PAK_OVERRIDE_PATH.
2024-05-27 14:26:39 +02:00
Kawe Mazidjatari
bec5d2746f ImGui: use cached value for clamped window width
Remove extraneous indirection.
2024-05-26 22:22:46 +02:00
Kawe Mazidjatari
bdca1a1644 RTech: improve concommand strings
Improve readability.
2024-05-26 22:21:02 +02:00
Kawe Mazidjatari
be24ccf8ac
Merge pull request #120 from Mauler125/bot_timebase_fix
Bot player timebase fix
2024-05-26 13:31:46 +02:00
Kawe Mazidjatari
371ece6005 Engine: make debug statement a warning 2024-05-26 13:13:33 +02:00
Kawe Mazidjatari
d63fbb5f88 Server: fix incorrect calculation of player timebase on bot instances
- Member CPlayer::m_lastUCmdSimulationRemainderTime is set and checked as an int in compiled code, change type from float to int.
- Simulation time was calculated incorrectly; brough expression 'CPlayer::m_lastUCmdSimulationRemainderTime * TICK_INTERVAL' into parentheses.
- Call to CPlayer::SetTotalExtraClientCmdTimeAttempted() took incorrect parameter value if flSimulationTime < 0.0f, it was supposed to be clamped to 0.0f, but instead, took the value of 'TIME_TO_TICKS( flTimeBase )'.
2024-05-23 19:53:54 +02:00
Kawe Mazidjatari
20d3a66b8e Engine: add functionality to run game without the platform system
Unbind the game from the platform system, which is useful when developing for or debugging the game. This was supposed to make it into the SDK back in 2021, but wasn't due to the ability to spoof usernames. This is no longer possible on servers requiring authentication as the player's name is actually checked along with the Nucleus ID.
2024-05-17 11:12:57 +02:00
Kawe Mazidjatari
71175c2a2b Game: add game dll flags to "script(_*)" command
The flags were originally removed in commit 1bdc3b893e59f208dbeadd78b978096dcdd8e8f9, but this caused a regression in the dev menu. Restored flags (this also doesn't cause security issues as these commands are flagged devonly and cheats anyways).
2024-05-15 19:03:24 +02:00
Kawe Mazidjatari
11f6ec7633 Ebisu: allow overriding global game language setting
The code originally fetches available and selected languages from Origin/EADesktop. The issue however is that its hard to change the language through the Origin/EADesktop app. The second issue is that the languages returned by Origin/EADesktop isn't necvesarily supported by our version of the game, for example, the original implementation of EbisuSDK_GetLanguage() also returns ar_SA, which is supported by the retail version of the game, but our version doesn't have the code to render this language. The code has been rewritten to allow the user to easily change the language using the command line '-language' parameter. The miles code has also been slightly adjusted to fetch the language directly from HEbisuSDK_GetLanguage() instead of miles_language since otherwise we would still error out in engine code as miles_language will be out of sync.
2024-05-07 16:05:57 +02:00
Kawe Mazidjatari
36824629fe Localize: add language codes
Newly added g_LanguageCodes maps directly with g_LanguageNames.
2024-05-07 16:00:20 +02:00
Kawe Mazidjatari
f0fe2bf58f Engine: fix client dll compile error
This code should not compile for client.dll.
2024-05-07 15:02:36 +02:00
Kawe Mazidjatari
44b5db29ff Resource: additional dedicated build patches to improve runtime performance
Disabled additional unnecessary DX code from patched dedicated server executable, this allows the dedicated server to run RPaks containing models without any material or texture data. This also allows us to fully rebuild all RPaks for dedicated while also omitting material/texture data to further reduce memory usage during the parsing thereof, and overall disk size.
2024-05-07 14:47:09 +02:00
Kawe Mazidjatari
5b0303357f Engine: fix stack smash in client side UserMessage processor
Unclamped CBitRead::ReadBits() call on stack buffer of MAX_USER_MSG_DATA bytes. Function has been rebuilt with additional clamping to mitigate the problem.
2024-05-07 14:44:12 +02:00
Kawe Mazidjatari
56011c5d50 Tier1: fix ctor bug in class bf_read
Parameter 'nBytes' was unused while it should've been, causing invalid buffer sizes being set. Bug was found after careful inspection of generation assembly code.
2024-05-07 14:36:05 +02:00
Kawe Mazidjatari
a61c475379 Engine: fix numerous exploitable bugs in voice protocol
- Fixed stack smash in CClient:ProcessVoiceData (oob read on bitbuf).
- Fixed stack smash in CClient:ProcessDurangoVoiceData (oob read on bitbuf).
- Fixed ability to bypass team check on Durango voice packets if forced as reliable from the sender (client).
- Incorporated the following missing checks in the durango version of voice broadcasting:
  - Enforce chat between multiple teams using cvar 'sv_alltalk'.
  - Ability to also disable Durango voice data with cvar 'sv_voiceenable'.
  - Ability to echo voice with Durango voice data using cvar 'sv_voiceEcho'.
2024-05-07 14:05:11 +02:00
Kawe Mazidjatari
cd78ee6654 Launcher: parse maps and playlists on surface setup
This allows you to scroll through the combo list with the scroll wheel without uncollapsing it.
2024-05-05 11:32:32 +02:00
Kawe Mazidjatari
3e8cda22b3 Common: unmark "set" command from FCVAR_DEVELOPMENTONLY from dedicated
"set" is already marked as FCVAR_CHEATS, and typically used when sv_cheats 1; remove FCVAR_DEVELOPMENTONLY from dedi builds as well.
2024-05-05 11:31:03 +02:00
Kawe Mazidjatari
1bdc3b893e Game: remove game dll flag from "script" cmd
Prevent remote execution, should be done through RCON instead for security.
2024-04-24 22:32:50 +02:00
Kawe Mazidjatari
874f2aebae Resource: update vpk build list and remove old build scripts
2 new maps added, which will be includes in the next release. The dedi could still be used to build the vpk's, but ReVPK is prefered. Removed old build scripts.
2024-04-23 00:41:44 +02:00
Kawe Mazidjatari
1d36f0aa89 Miles: refer to 'MILES_DEFAULT_LANGUAGE' instead of 'english'
Enforce 'MILES_DEFAULT_LANGUAGE' as the default rather than "english", even though "english" will always be the default. Also marked cvar 'miles_debug' as FCVAR_DEVELOPMENTONLY.
2024-04-23 00:27:01 +02:00
Kawe Mazidjatari
065f86391e Miles: put event queue warnings behind a cvar
These warnings can get verbose, especially if events from the map itself are missing. Put behind a cvar and enabled it by default in development configurations.
2024-04-23 00:15:02 +02:00
Kawe Mazidjatari
8ef05a8f43 Launcher: several fixes and improvements
- Reload map list each time the combo box is opened (needs to refresh if user installed a new map while launcher is still open).
- Reload playlists each time the combo box is opened (makes sure that the list is up-to-date if user modified it in any way).
- Use global VPK dir regex to parse out map names.
2024-04-23 00:06:11 +02:00
Kawe Mazidjatari
29fd9e3ed7 VpkLib: make regex available to other code and utilize those instead
Prevent copies or similar patterns that might not work as good.
2024-04-23 00:03:31 +02:00
Kawe Mazidjatari
f4797d920c CppKore: add callback for drop down opened event 2024-04-23 00:01:50 +02:00
Kawe Mazidjatari
6e373b1428 VpkLib: light cleanup
Improve global names, initialize VPKDirHeader_t structure, make inlines for checking if language or target exists.
2024-04-22 02:38:48 +02:00
Kawe Mazidjatari
266dc56b36 NetCon: rename to 'netcon'; remove platform suffix
Netcon is no longer 32bits. Previously it was made 32bits to maximize system compatibility, but this was unfortunately too hard to maintain after the migration to CMake, it was also no longer worth it as the tool never got used on 32bit platforms. Renamed to avoid confusion.
2024-04-21 01:54:58 +02:00
Kawe Mazidjatari
f3ca070868 Resource: use default protoc instead of custom one
No need to use the custom one.
2024-04-21 01:50:32 +02:00
Kawe Mazidjatari
e0f24d3313 Launcher: initialize all member vars
Suppress IntelliSense warnings.
2024-04-20 23:28:35 +02:00
Kawe Mazidjatari
b5616999ab PluginSystem: add callback for chatroom receiver
Allow plugins to block chat msg's based on their text.
2024-04-20 23:27:00 +02:00
Kawe Mazidjatari
425f1dc5da Server: add getter for net name in CBaseCombatCharacter 2024-04-20 23:11:13 +02:00
Kawe Mazidjatari
d6644eff89 Server: add getter for Nucleus ID in CPlayer 2024-04-20 23:10:45 +02:00
Kawe Mazidjatari
bf0cef130d Launcher: fix use after free (ASAN)
The launcher would regularly throw the PSA (Program Compatibility Assistance) notification upon exit. Running the program with address sanitizer revealed 'CSurface::GetControlValue()' returned a pointer to a temporary buffer, this is destroyed as 'Forms::Control::Text()' returns class String by value. 'CSurface::GetControlValue()' is no longer necessary since we moved to the official KeyValues class, so this function has been removed all together and the issue has therefore been fixed.
2024-04-20 23:08:31 +02:00
Kawe Mazidjatari
7bc7c9d2f4 Engine: simplify "script" command callback for server
Code actually doesn't need to be ran in the server frame thread. All the code really does is preparation work. Run it in the main thread but do join the server frame thread (FCVAR_SERVER_FRAME_THREAD) as we can't do concurrent work on the server VM.
2024-04-20 01:33:34 +02:00
Kawe Mazidjatari
84daa21cfd Engine: don't broadcast voice data on training dedi
Training dedi doesn't support broadcasting voice data, return out.
2024-04-20 01:00:49 +02:00
Kawe Mazidjatari
85b7f84d47 Engine: add command line statics for dedicated server and light cleanup
CGameServer::SpawnServer() pointer to engine/server/server.h, and renamed it to CServer::SpawnServer().
2024-04-20 00:59:39 +02:00
Kawe Mazidjatari
50d38af63a RTech: fix bitwise order in define
Put in parentheses.
2024-04-19 17:06:11 +02:00
Kawe Mazidjatari
e7fd19cdf3 VScript: fix method order
More logical order of newly added methods.
2024-04-19 13:14:35 +02:00
Kawe Mazidjatari
f8f8be9870 Squirrel: fix struct name
bufCopy is actually bufPos as this indicated the current pos in the text buffer as it gets parsed out.
2024-04-19 13:13:17 +02:00
Kawe Mazidjatari
f70cc90eb9 VScript: move script run code to dedicated method 2024-04-19 13:12:35 +02:00
Kawe Mazidjatari
1455017419 VScript: properly implement script command callback
Previously we did sq_pushroottable() and a subsequent sq_call() after compiling the text buffer, but this didn't work for code that was threaded, or using Get/SetNetVar* functions.

The second issue was that the callback for the "script" command was ran in the main thread. Server script should always run in the server frame thread, the Set/GetNetVar* functions check thread id to retrieve the correct VM context, so running server script from the main thread ended up with Set/GetNetVar* functions retrieving the client VM context rather than server's, causing undefined behavior.

Script commands are now queued to the server frame thread, ultimately fixing this bug.

Also fixed a small bug with function 'sq_compilebuffer()'; it takes an extra argument but this wasn't taken into account in the SDK.
2024-04-19 12:56:10 +02:00
Kawe Mazidjatari
183a6e9c35 VScript: add CSquirrelVM::ExecuteFunction()
Executes script code by function handle.
2024-04-19 12:56:10 +02:00
Kawe Mazidjatari
42a8edc4cd Squirrel: add multiple SQ API functions
Added:
- sq_getstackobj
- sq_pop
- sq_addref
- sq_release
- SQVM::Pop
- RefTable::Get
- RefTable::AddRef
- RefTable::Release
2024-04-19 12:56:09 +02:00