84 Commits

Author SHA1 Message Date
Kawe Mazidjatari
4c123e20d0 CIOStream and CSigCache class improvements
CIOStream:
* Use flag based system instead (common flags are aliased; uses std::ios_base::openmode).
* 'ReadString' now writes into a string buffer (reference) that needs to be passed in by programmer (avoids copy).
* 'm_nSize' is now synced with any write operations.

CSigCache:
* Fixed bug causing crash when 'DecompressBlob' failed (results were never checked).
* Light formatting improvements.
2023-02-04 00:36:05 +01:00
Kawe Mazidjatari
3ea7cc1cd4 CModule: class improvements
* Added 'GetImportedFunction'.
* Remove extraneous std::string copy constructors during construction of 'm_vModuleSections'.
* Added extra constructor using base address.
2023-01-31 23:52:11 +01:00
Kawe Mazidjatari
af42dfafe3 Bump sig cache version
Signatures have changed, force rebuild of db.
2023-01-31 23:46:26 +01:00
Kawe Mazidjatari
34f69a5b1e Move crashhandler implementation to tier0 2023-01-31 22:13:40 +01:00
Kawe Mazidjatari
281addc68e Fix crash whitelist not working on client.dll
Unregister gamesdk's crash handler if -noworkerdll is passed. This is required as both crashhandlers will be called during an exception, and on one, the whitelist wouldn't work.
2023-01-31 21:48:42 +01:00
Kawe Mazidjatari
500a7c1925 Finish libcurl implementation
Master server queries now use SSL.
2023-01-26 20:06:48 +01:00
Kawe Mazidjatari
5a9824d30c Remove useless assert
Invalid assert as rebuilding cache map happens prior to initialization.
2023-01-24 00:54:13 +01:00
Kawe Mazidjatari
888989d2b3 Fully working implementation of 'sv_showhitboxes'
Setting 'sv_showhitboxes' to 0 will enable it on everything deriving from CBaseAnimating, and having a valid studiohdr/hitbox. -1 means off, value > 0 will select entity by index (value of 'sv_showhitbox').
2023-01-24 00:53:45 +01:00
Kawe Mazidjatari
eede2b65f3 Force signature dictionary full rebuild
Launch times become slower in debug builds due to the many added signatures; force full rebuild of dictionary.
2023-01-23 02:24:41 +01:00
Kawe Mazidjatari
4022fbd3ad Fix bad assert
Field 'm_bInitialized' should be set prior to calling this, this field was named differently and its use case was inverted, forgot to reflect changes in assert.
2023-01-21 14:49:53 +01:00
Kawe Mazidjatari
d5ef71200f Update sig cache minor version
Invalidate old databases and rebuild as signature for 'gpGlobals' has changed.
2023-01-18 01:35:27 +01:00
Kawe Mazidjatari
94bf515ba7 Add gpGlobals to SDK 2023-01-17 11:21:10 +01:00
Amos
39920283c0 Fix arithmetic register formatting for high number
High values would cause the formatting to be decimal while it should be hexadecimal if the value equals or exceeds one million.
2023-01-16 15:28:39 +01:00
Kawe Mazidjatari
d8dd9aba93 Fix CCrashHandler method name
Renamed from APU to ALU (typo).
2023-01-04 14:55:58 +01:00
Kawe Mazidjatari
08ed169cf3 Only run game's exception filter if ours didn't handle it
This is required as otherwise the game's exception filter will be called after ours. If we didn't handle the exception, the game's implementation, or an exception handler associated to the exception raised by address will take care of it. Unlike the game's implementation, our exception handler does not handle unknown exceptions. We only do the low level stuff reliably.
2022-12-28 21:44:51 +01:00
Kawe Mazidjatari
f00153ccb4 Rename exception filter 2022-12-28 21:39:58 +01:00
Kawe Mazidjatari
3c7ad57650 CCrashHandler improvements
* Move large module instance array to the heap.
* Add ability to query whether or not an exception was handled.
2022-12-28 21:38:47 +01:00
Kawe Mazidjatari
2c70283397 CCrashHandler improvements
* Only handle exceptions we could handle (anything that isn't in the switch case is not getting handled).
* Only show hexadecimal representation of decimal integer if could contain hexadecimal digits.
2022-12-28 20:30:33 +01:00
Kawe Mazidjatari
5de241b807 CCrashHandler: light cleanup 2022-12-28 16:36:52 +01:00
Kawe Mazidjatari
700bb48494 Fix compiler error 2022-12-28 15:38:34 +01:00
Kawe Mazidjatari
56c48f2949 Fix FPU formatting for negative numbers
Properly format negative numbers too. The function now checks if any of the 4 values in the SSE register are above or below one million before displaying in hexadecimal. Prior to this commit, the value was unsigned leading to negative numbers bellow one million being displayed as very high in hexadecimal.
2022-12-28 15:38:18 +01:00
Kawe Mazidjatari
bc99a064b1 Don't write null character to text file on disc 2022-12-27 23:12:21 +01:00
Kawe Mazidjatari
d2fc2405c3 Add ability to whitelist return addresses from exception filter
Programmer could add and remove whitelisted addresses. If an exception occurs, the system checks the callstack up to 'MAX_IMI_SEARCH' frames (defined in CCrashHandler), and returns true if found (returning early with 'EXCEPTION_CONTINUE_SEARCH' so we use whatever exception handler is set for this particular case), false otherwise.
2022-12-27 23:08:59 +01:00
Kawe Mazidjatari
3f4884b20a Fix CrashMsg flag
'2' means that the generic "Apex crashed" message box gets displayed without any additional information regarding the module.
2022-12-27 14:23:54 +01:00
Kawe Mazidjatari
b48f028b5a Make FPU vector unsigned
Value must be unsigned to yield proper output.
2022-12-27 14:21:20 +01:00
Kawe Mazidjatari
57c71b8ee4 Log loaded module information (base and base+imageSize) 2022-12-27 14:12:46 +01:00
Kawe Mazidjatari
3f5102cc6f Detect possible return address in callstack
Also increased the number of frames to capture from 60 to 128, and skipped the last 2 frames.
2022-12-27 13:19:57 +01:00
Kawe Mazidjatari
7dfef9c9c8 CCrashHandler and logging improvements
* CCrashHandler now calls the crashmsg executable to display the error to the user.
* Logs are now placed into directories named to the current time to avoid overwriting them or having 2 instances of the game writing to the same logs.
2022-12-27 02:28:43 +01:00
Kawe Mazidjatari
5502dcb8f1 Add 'build_id' to crash log
Also performed light cleanup.
2022-12-26 23:35:41 +01:00
Kawe Mazidjatari
cd3a80479e Log system information to the crash file
Added:
* CPU brand identifier
* CPU clock speed
* GPU device string
* GPU device state flags
* RAM total (physical/virtual)
* RAM avail (physical/virtual)
2022-12-26 22:00:38 +01:00
Kawe Mazidjatari
23070bd8ce Reorder 'CCrashHandler' class and add descriptions to functions 2022-12-26 20:33:09 +01:00
Kawe Mazidjatari
b4383478d1 Initial refactor of the CCrashHandler class
* Fixed recursive call.
* Format file similarly to Respawn's.
* Reduced output code size.

TODO:
* Call crashmsg.exe.
* Add build and system information.
2022-12-26 20:11:37 +01:00
Kawe Mazidjatari
9ec5b6aabd Improve formatting for FPU 2022-12-25 22:49:49 +01:00
Kawe Mazidjatari
0a9045f1c7 Fix typo in crash handler 2022-12-25 22:44:07 +01:00
Marvin D
c79f98e4f8 Remove comment on crashhandler. 2022-12-24 16:48:15 +01:00
Marvin D
f9f09bd02a Limit IMI search to 7. 2022-12-24 16:43:19 +01:00
Marvin D
e24b9b90a5 VEH Clean-up. 2022-12-24 16:41:47 +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
Marvin D
d1ec3aaf71 Disable VEH till fix. 2022-12-24 13:06:44 +01:00
Marvin D
8506851860 VEH clean up. 2022-12-23 14:06:31 +01:00
Marvin D
bd2cc9f4b3 EXCEPTION_EXECUTE_HANDLER -> EXCEPTION_CONTINUE_SEARCH 2022-12-23 03:19:43 +01:00
Marvin D
37a50c92b8 VectoredExceptionHandler init.
* Only gets compiled in for release builds.
* Attaches on gamesdk init, so should catch everything on dll setup also.
* Fake PDB parsing still needs to be done.
2022-12-23 02:56:40 +01:00
rexx
3c3e1c46df Add pak_listtypes command 2022-12-22 21:44:38 +00:00
Marvin D
01724cfaad vtable.cpp clean up 2022-12-21 15:55:52 +01:00
Marvin D
c071ce2217 Prevent constant ModuleSections_t allocation. 2022-12-20 23:38:45 +01:00
Marvin D
9994491551 RTech_RegisterAsset 2022-12-20 01:03:59 +01:00
Marvin D
21f995a37b remove un-needed include 2022-12-09 01:17:23 +01:00
Marvin D
ef256618f6 CVTableHelper class for easier RE.
* THIS IS NOT SUPPOSED TO BE USED WITH SHIPPING CODE!
* This is used for a quick way to call virtual functions for reverse engineering and rebuilding big functions, upon successful rebuild, implement needed VTables accordingly.
2022-12-09 01:15:42 +01:00
Kawe Mazidjatari
ebf7bb5e0b Fix engine bug regarding forcing application borders
In Respawn's engine, the '-forceborder' command line parameter does the same thing as '-noborder'. '-forceborder' should remove the flags (nand) while '-noborder' should append the borderless flag. This code is an attempt to mitigate the problem. There was not enough bytes to assemble the nand operation for this code path without involving code caves or shifting.
2022-12-06 00:48:11 +01:00
Kawe Mazidjatari
119255b4ff Const correctness 2022-12-05 00:57:48 +01:00