From c898b202f30bba463f21595a96ad59557d537f03 Mon Sep 17 00:00:00 2001 From: mysterio Date: Mon, 9 Oct 2023 12:12:37 -0400 Subject: [PATCH 1/2] update --- .gitattributes | 2 + LICENSE.txt | 674 + hook_lib.sln | 62 +- hook_lib/Main.cpp | 3000 +- hook_lib/Main.hpp | 234 +- hook_lib/assets.cpp | 10 +- hook_lib/assets.h | 8766 +-- hook_lib/common/exception/minidump.cpp | 170 +- hook_lib/common/exception/minidump.hpp | 16 +- hook_lib/common/utils/MinHook.hpp | 370 +- hook_lib/common/utils/binary_resource.cpp | 150 +- hook_lib/common/utils/binary_resource.hpp | 40 +- hook_lib/common/utils/concurrency.hpp | 92 +- hook_lib/common/utils/finally.hpp | 106 +- hook_lib/common/utils/hardware_breakpoint.cpp | 346 +- hook_lib/common/utils/hardware_breakpoint.hpp | 64 +- hook_lib/common/utils/hook.cpp | 968 +- hook_lib/common/utils/hook.hpp | 372 +- hook_lib/common/utils/http.cpp | 96 +- hook_lib/common/utils/http.hpp | 26 +- hook_lib/common/utils/io.cpp | 260 +- hook_lib/common/utils/io.hpp | 42 +- hook_lib/common/utils/memory.cpp | 340 +- hook_lib/common/utils/memory.hpp | 154 +- hook_lib/common/utils/nt.cpp | 582 +- hook_lib/common/utils/nt.hpp | 354 +- hook_lib/common/utils/signature.cpp | 440 +- hook_lib/common/utils/signature.hpp | 98 +- hook_lib/common/utils/smbios.cpp | 188 +- hook_lib/common/utils/smbios.hpp | 16 +- hook_lib/common/utils/string.cpp | 354 +- hook_lib/common/utils/string.hpp | 194 +- hook_lib/common/utils/thread.cpp | 232 +- hook_lib/common/utils/thread.hpp | 94 +- hook_lib/functions.cpp | 783 +- hook_lib/functions.hpp | 456 +- hook_lib/hook_lib.vcxproj | 9 +- hook_lib/hook_lib.vcxproj.filters | 283 +- hook_lib/hook_lib.vcxproj.user | 13 +- hook_lib/ini.h | 1576 +- hook_lib/json.hpp | 49344 ++++++++-------- hook_lib/resource.h | 2 +- hook_lib/splashscreen.cpp | 16 +- hook_lib/splashscreen.hpp | 30 +- hook_lib/structs.cpp | 232 +- hook_lib/structs.h | 4166 +- lib/minhook.lib | Bin 0 -> 444766 bytes lib/minhook_old.lib | Bin 0 -> 516018 bytes 48 files changed, 38639 insertions(+), 37183 deletions(-) create mode 100644 .gitattributes create mode 100644 LICENSE.txt create mode 100644 lib/minhook.lib create mode 100644 lib/minhook_old.lib diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/hook_lib.sln b/hook_lib.sln index 8ae0a70..4f19910 100644 --- a/hook_lib.sln +++ b/hook_lib.sln @@ -1,31 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33130.400 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hook_lib", "hook_lib\hook_lib.vcxproj", "{D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x64.ActiveCfg = Debug|x64 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x64.Build.0 = Debug|x64 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x86.ActiveCfg = Debug|Win32 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x86.Build.0 = Debug|Win32 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x64.ActiveCfg = Release|x64 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x64.Build.0 = Release|x64 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x86.ActiveCfg = Release|Win32 - {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {58937352-3EDA-4AEE-A7FD-C21D6955F38B} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33130.400 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hook_lib", "hook_lib\hook_lib.vcxproj", "{D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x64.ActiveCfg = Debug|x64 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x64.Build.0 = Debug|x64 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x86.ActiveCfg = Debug|Win32 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Debug|x86.Build.0 = Debug|Win32 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x64.ActiveCfg = Release|x64 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x64.Build.0 = Release|x64 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x86.ActiveCfg = Release|Win32 + {D84DCA02-7BEE-40E4-81D5-75EB0AA0A9D3}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {58937352-3EDA-4AEE-A7FD-C21D6955F38B} + EndGlobalSection +EndGlobal diff --git a/hook_lib/Main.cpp b/hook_lib/Main.cpp index 525d906..72283aa 100644 --- a/hook_lib/Main.cpp +++ b/hook_lib/Main.cpp @@ -1,1148 +1,1854 @@ -#include "Main.hpp" - -#include "csv.hpp" - -void* exception_handler; - -void backtrace(const char* func) { - const int trace_count = 15; - void* trace_back[trace_count]; - DWORD hash; - RtlCaptureStackBackTrace(1, trace_count, trace_back, &hash); - nlog("%s callstack: ", func); - printf("%s callstack: ", func); - for (int i = 0; i < trace_count; i++) { - if (i == trace_count - 1) { - nlog("%p\n", (uintptr_t)trace_back[i]); - printf("%p\n", (uintptr_t)trace_back[i]); - } - else { - nlog("%p:", (uintptr_t)trace_back[i]); - printf("%p:", (uintptr_t)trace_back[i]); - } - } -} - -int iTick = 0; -bool bFinished; -bool btoggle; - -uintptr_t xuid_generated; -int collision_ticker; -utils::hook::detour r_endframe; -void R_EndFrame_Detour() { - if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) { - *reinterpret_cast(0x14E385A68_g) = 80; - *reinterpret_cast(0x14E385A78_g) = 80; - if (collision_ticker == 60) { - btoggle = !btoggle; - *reinterpret_cast(0x145CC7555_g) = btoggle; // s_transientsCollisionMP_LobbyToGameStart - } - collision_ticker++; - } - else { - *reinterpret_cast(0x14E385A68_g) = 1000; - *reinterpret_cast(0x14E385A78_g) = 1000; - } - - if (!bFinished) { - if (iTick == 500) { - DWORD flOldProtect; - XUID xuid; - xuid.RandomXUID(); - utils::hook::set(0x144622BE0_g, 1); - - utils::hook::set(0x14E5C07C0_g, 0x11CB1243B8D7C31E | xuid.m_id * xuid.m_id); - utils::hook::set(0x14F05ACE8_g, 0x11CB1243B8D7C31E | xuid.m_id * xuid.m_id); - - utils::hook::set(0x14E5C07E8_g, 0x11CB1243B8D7C31E | (xuid.m_id * xuid.m_id) / 6); // s_presenceData - - utils::hook::set(0x14E371231_g, 1); - utils::hook::set(0x144622910_g, 2); - utils::hook::set(0x144622BE0_g, 1); - - utils::hook::set(*reinterpret_cast(0x14EE560B0_g) + 0x28, 0); - utils::hook::set(0x14E5C0730_g, 2); - - auto get_bnet_class = reinterpret_cast(0x141660280_g); - uintptr_t bnet_class = get_bnet_class(); - *(DWORD*)(bnet_class + 0x2F4) = 0x795230F0; - *(DWORD*)(bnet_class + 0x2FC) = 0; - *(BYTE*)(bnet_class + 0x2F8) = 31; - - printf("LOADED!\n"); - bFinished = true; - } - else { - iTick += 1; - } - } - - r_endframe.stub(); -} - -bool initiatedevgui; - -void CG_DrawWaterMark() { - float white[4] = { 1.0f, 1.0f, 1.0f, 0.2f }; - CL_DrawText(0x14EF2DEA0_g, "Fuck off activision you cunts", 0x7FFFFFFF, *reinterpret_cast(0x14EEB0C68_g), 0, 400.0f, 1, 1, 0.80000001, 0.80000001, white, 7); -} - -void CL_ScreenMP_DrawOverlay_Detour() { - auto DevGui_Draw = reinterpret_cast(0x1417E5CD0_g); - auto Con_DrawConsole = reinterpret_cast(0x1415AE0B0_g); - - Con_DrawConsole(0); - DevGui_Draw(0); - - if (show_watermark->current.enabled) { - CG_DrawWaterMark(); - } -} - -utils::hook::detour cl_createdevgui; -void CL_CreateDevGui_Detour(int fsMenuEntries, const char* modeCfg) { - auto DevGui_AddCommand = reinterpret_cast(0x1417E58B0_g); - auto DevGui_AddDvar = reinterpret_cast(0x1417E5940_g); - - cl_createdevgui.stub(fsMenuEntries, modeCfg); -} - -const char* username_Detour() { - if (player_name) { - return player_name->current.string; - } - else { - return "Unknown Name"; - } -} - -utils::hook::detour lui_cod_registerdvars; -void LUI_CoD_RegisterDvars_Detour() { - nlog("registering lui dvars\n"); - player_name = Dvar_RegisterString("player_name", "Player1", 0, "Sets the player name."); - sv_cheats = Dvar_RegisterBool("sv_cheats", false, 0, "Enables cheats to be used on a server"); - spawn_br_gas = Dvar_RegisterBool("spawn_br_gas", true, 0, "Disables gas in battle royale maps"); - show_watermark = Dvar_RegisterBool("show_watermark", false, 0, "Shows the watermark for codUPLOADER"); - - player_sustainammo = Dvar_RegisterBool("player_sustainAmmo", false, 0, "Firing weapon will not decrease clip ammo."); - - lui_cod_registerdvars.stub(); -} - -utils::hook::detour db_zones_performzoneload; -__int64 DB_Zones_PerformZoneLoad_Detour(bool processingPreloadedFiles, bool isBaseMap, bool wasPaused, int failureMode) { - failureMode = 1; - - return db_zones_performzoneload.stub<__int64>(processingPreloadedFiles, isBaseMap, wasPaused, failureMode); -} - -void CL_TransientsCollisionMP_SetTransientMode_Detour(int mode) { - if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) { - *reinterpret_cast(0x145CC7534_g) = 1; - } - else { - *reinterpret_cast(0x145CC7534_g) = mode; - } -} - -utils::hook::detour net_outofbanddata; -bool NET_OutOfBandData_Detour(int sock, netadr_t* adr, const unsigned __int8* format, int len) { - return net_outofbanddata.stub(sock, adr, format, len); -} - -utils::hook::detour g_cmdsmp_clientcommand; -void G_CmdsMP_ClientCommand_Detour(int clientNum) { - g_entities = *reinterpret_cast(0x14BC20F00_g); - - uintptr_t client = g_entities[clientNum].get(0x150); - - char command[1024]; - SV_Cmd_ArgvBuffer(0, command, 1024); - - if (client) { - if (strcmp(command, "noclip") == 0) { - if (CheatsOk(clientNum)) { - Cmd_Noclip_f(clientNum); - } - return; - } - if (strcmp(command, "give") == 0) { - if (CheatsOk(clientNum)) { - SV_Cmd_ArgvBuffer(1, command, 1024); - Weapon weap; - if (BG_Weapons_GetFullWeaponForName(command, &weap, BG_FindBaseWeaponForName)) { - if (SV_Cmd_Argc() == 3) { - SV_Cmd_ArgvBuffer(2, command, 1024); - weap.weaponCamo = atoi(command); - } - if (G_Weapon_GivePlayerWeapon(client, 0, &weap, 0, 0, 0)) { - G_Items_AddAmmo(client, &weap, 0, 9999, 1); - G_Weapon_SelectWeapon(clientNum, &weap); - } - } - } - } - if (strcmp(command, "ks_give") == 0) { - if (CheatsOk(clientNum)) { - SV_Cmd_ArgvBuffer(1, command, 1024); - scrContext_t* ctx = ScriptContext_Server(); - Scr_AddString(ctx, command); - - Scr_FreeThread(ctx, GScr_ExecEntThread(&g_entities[clientNum], 0x1B65FC, 1)); - } - } - if (strcmp(command, "bold_msg") == 0) { - char msgbuf[500]; - SV_Cmd_ArgvBuffer(1, command, 1024); - if (strlen(command) < 500) { - for (int i = 0; i < 30; i++) { - SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * i)); - if (ms_clients) { - snprintf(msgbuf, 500, "g \"%s\"", command); - ms_clients->SendServerCommand(1, msgbuf); - } - } - } - } - if (strcmp(command, "remove_barriers") == 0) { - if (CheatsOk(clientNum)) { - auto SL_ConvertToString = reinterpret_cast(0x14131AA20_g); - for (int i = 0; i < 1024; i++) { - int classname = g_entities[i].get(0x17C); - if (classname) { - if (strcmp(SL_ConvertToString(classname), "trigger_hurt") == 0 || - strcmp(SL_ConvertToString(classname), "trigger_multiple") == 0 || - strcmp(SL_ConvertToString(classname), "trigger_damage") == 0) { - auto G_SetOrigin = reinterpret_cast(0x140FD4CC0_g); - vec3_t gone = { 0, 0, -9999999 }; - G_SetOrigin(&g_entities[i], &gone, true, true); - } - } - } - for (int i = 0; i < 30; i++) { - SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * i)); - if (ms_clients) { - ms_clients->SendServerCommand(1, "g \"Death barriers removed!\""); - } - } - } - } - if (strcmp(command, "viewpos") == 0) { - if (CheatsOk(clientNum)) { - char msgbuf[500]; - SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * clientNum)); - if (ms_clients) { - snprintf(msgbuf, 500, "f \"viewpos: (%.2f, %.2f, %.2f)\"", g_entities[clientNum].r_currentOrigin[0], g_entities[clientNum].r_currentOrigin[1], g_entities[clientNum].r_currentOrigin[2]); - ms_clients->SendServerCommand(1, msgbuf); - } - } - } - } - - g_cmdsmp_clientcommand.stub(clientNum); -} - -utils::hook::detour cl_inputmp_execbinding; -void CL_InputMP_ExecBinding_Detour(int localClientNum, int kb, int key, int forceNotify) { - switch (key) { - case K_N: - CL_Main_AddReliableCommand("noclip"); - break; - } - - cl_inputmp_execbinding.stub(localClientNum, kb, key, forceNotify); -} - -void Cmd_Exec_Internal(bool isSuperUser) { - const char* cmdbuf; - const char* file; - auto DB_FindXAssetHeader = reinterpret_cast(0x1411AA890_g); - auto DB_ReadRawFile = reinterpret_cast(0x141297140_g); - auto Core_strcpy_truncate = reinterpret_cast(0x142036A90_g); - auto Com_DefaultExtension = reinterpret_cast(0x1413F1AE0_g); - char path[64]; - - if (cmd_args->argc[cmd_args->nesting] == 2) - { - Core_strcpy_truncate(path, 64, *(cmd_args->argv[cmd_args->nesting] + 1)); - Com_DefaultExtension(path, 64, ".cfg"); - if (DB_FindXAssetHeader(ASSET_TYPE_RAWFILE, path, 0)) - { - if (!DB_ReadRawFile(0, cmd_args->controllerIndex[cmd_args->nesting], path, isSuperUser)) - { - if (cmd_args->argc[cmd_args->nesting] <= 1) - file = ""; - else - file = *(cmd_args->argv[cmd_args->nesting] + 1); - printf("couldn't exec %s\n", file); - } - } - else - { - FS_ReadFile(path, &cmdbuf); - LUI_CoD_LuaCall_ExecNow(*reinterpret_cast(0x151868880_g), cmdbuf); - } - } - else - { - printf(0, "exec : execute a script file\n"); - } -} - -utils::hook::detour gscr_spawnbrcircle; -void GScr_SpawnBrCircle_Detour(uintptr_t scrContext) { - if (spawn_br_gas->current.enabled) { - gscr_spawnbrcircle.stub(scrContext); - } -} - -void entry_point() { - XUID xuid; - xuid.RandomXUID(); - - printf("%i\n", xuid.m_id); - - r_endframe.create(0x141966950_g, R_EndFrame_Detour); - utils::hook::jump(0x141297580_g, Cmd_Exec_Internal); - utils::hook::jump(0x1415E1340_g, CL_ScreenMP_DrawOverlay_Detour); - utils::hook::jump(0x1413FD3A0_g, username_Detour); - - db_zones_performzoneload.create(0x140F677A0_g, DB_Zones_PerformZoneLoad_Detour); - - g_cmdsmp_clientcommand.create(0x14120B6A0_g, G_CmdsMP_ClientCommand_Detour); - cl_inputmp_execbinding.create(0x1415E1AB0_g, CL_InputMP_ExecBinding_Detour); - gscr_spawnbrcircle.create(0x141243AB0_g, GScr_SpawnBrCircle_Detour); - - utils::hook::jump(0x140D6B7D0_g, CL_TransientsCollisionMP_SetTransientMode_Detour); - - printf("hooked!\n"); -} - -extern "C" __declspec(dllexport) int DiscordCreate() { - CreateThread(0, 0xA0, (LPTHREAD_START_ROUTINE)entry_point, 0, 0, 0); - return 1; -} - -utils::hook::detour cl_keys_event; -void CL_Keys_Event_Detour(int localClientNum, int key, bool down, unsigned int time, int virtualKey, int controllerIndex) { - auto Con_ToggleConsole = reinterpret_cast(0x1415B18C0_g); - auto DevGui_Toggle = reinterpret_cast(0x1417E9DA0_g); - - if (down) { - switch (key) { - case K_GRAVE: - Con_ToggleConsole(); - return; - break; - case K_F1: - DevGui_Toggle(); - return; - break; - } - } - - cl_keys_event.stub(localClientNum, key, down, time, virtualKey, controllerIndex); -} - -utils::hook::detour PM_WeaponUseAmmo; -void PM_WeaponUseAmmo_Detour(__int64 playerstate, Weapon* weapon, char a3, int a4, int hand) { - if (!player_sustainammo->current.enabled) { - PM_WeaponUseAmmo.stub(playerstate, weapon, a3, a4, hand); - } -} - -utils::hook::detour dvar_registerbool; -dvar_t* Dvar_RegisterBool_Detour(const char* dvarName, bool value, unsigned int flags, const char* description) { - if (strcmp(dvarName, "LSTQOKLTRN") == 0) { - nlog("dvar registered!\n"); - value = true; - } - if (strcmp(dvarName, "MPSSOTQQPM") == 0) { - nlog("dvar registered!\n"); - value = true; - } - dvar_t* ret = dvar_registerbool.stub(dvarName, value, flags, description); - return ret; -} - -utils::hook::detour dvar_registerstring; -dvar_t* Dvar_RegisterString_Detour(const char* dvarName, const char* value, unsigned int flags, const char* description) { - return dvar_registerstring.stub(dvarName, value, flags, description); -} - -utils::hook::detour seh_stringed_getstring; -const char* SEH_StringEd_GetString_Detour(const char* pszReference) { - const char* ret = seh_stringed_getstring.stub(pszReference); - - if (!pszReference[1]) - { - if ((*pszReference & 0x80) != 0) - return "t"; - return pszReference; - } - - if ( - strstr(pszReference, "LUA_MENU/MAPNAME_DEADZONE") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_CAGE") || - strstr(pszReference, "LUA_MENU/MAPNAME_CAVE_AM") || - strstr(pszReference, "LUA_MENU/MAPNAME_CAVE") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_CARGO") || - strstr(pszReference, "LUA_MENU/MAPNAME_CRASH2") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_OVERUNDER") || - strstr(pszReference, "LUA_MENU/MAPNAME_EUPHRATES") || - strstr(pszReference, "LUA_MENU/MAPNAME_RAID") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_SHOWERS") || - strstr(pszReference, "LUA_MENU/MAPNAME_RUNNER_AM") || - strstr(pszReference, "LUA_MENU/MAPNAME_RUNNER") || - strstr(pszReference, "LUA_MENU/MAPNAME_HACKNEY_AM") || - strstr(pszReference, "LUA_MENU/MAPNAME_HACKNEY_YARD") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_HILL") || - strstr(pszReference, "LUA_MENU/MAPNAME_PICCADILLY") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_PINE") || - strstr(pszReference, "LUA_MENU/MAPNAME_SPEAR_AM") || - strstr(pszReference, "LUA_MENU/MAPNAME_SPEAR") || - strstr(pszReference, "LUA_MENU/MAPNAME_PETROGRAD") || - strstr(pszReference, "LUA_MENU/MAPNAME_M_STACK") || - strstr(pszReference, "LUA_MENU/MAPNAME_VACANT")) { - return "^1no work"; - } - - return ret; -} - -char buffer[0x5000]; - -utils::hook::detour db_loadxfile; -int DB_LoadXFile_Detour(const char* zoneName, uintptr_t zoneMem, uintptr_t assetList, int zoneFlags, bool wasPaused, int failureMode, uintptr_t outSignature) { - return db_loadxfile.stub(zoneName, zoneMem, assetList, zoneFlags, wasPaused, failureMode, outSignature); -} - -utils::hook::detour CL_TransientsMP_ProcessLoadingQueue; -char CL_TransientsMP_ProcessLoadingQueue_Detour() { - return CL_TransientsMP_ProcessLoadingQueue.stub(); -} - -utils::hook::detour partyhost_startprivateparty; -void PartyHost_StartPrivateParty_Detour(int localClientNum, int localControllerIndex, bool currentlyActive, int hostType) { - Cbuf_AddText("exec autoexec.cfg"); - - partyhost_startprivateparty.stub(localClientNum, localControllerIndex, currentlyActive, hostType); -} - -bool Live_IsUserSignedInToDemonware_Detour() { - return true; -} - -int dwGetLogOnStatus_Detour() { - return 2; -} - -int LiveStorage_GetActiveStatsSource_Detour() { - return 1; -} - -void set_byte_f() { - char command[500]; - if (Cmd_Argc() == 3) { - Cmd_ArgvBuffer(1, command, 500); - uintptr_t address = atoll(command) + base; - Cmd_ArgvBuffer(2, command, 500); - utils::hook::set(address, atoi(command)); - } -} - -void set_short_f() { - char command[500]; - if (Cmd_Argc() == 3) { - Cmd_ArgvBuffer(1, command, 500); - uintptr_t address = atoll(command) + base; - Cmd_ArgvBuffer(2, command, 500); - utils::hook::set(address, atol(command)); - } -} - -void set_int_f() { - char command[500]; - if (Cmd_Argc() == 3) { - Cmd_ArgvBuffer(1, command, 500); - uintptr_t address = atoll(command) + base; - Cmd_ArgvBuffer(2, command, 500); - utils::hook::set(address, _atoi64(command)); - } -} - -void set_pointer_f() { - char command[500]; - if (Cmd_Argc() == 3) { - Cmd_ArgvBuffer(1, command, 500); - uintptr_t address = atoll(command) + base; - Cmd_ArgvBuffer(2, command, 500); - utils::hook::set(address, _atoi64(command)); - } -} - -void Cmd_Quit_f() { - ExitProcess(0x1); -} - -void Cmd_OpenMenu_f() { - char command[500]; - if (Cmd_Argc() == 2) { - auto LUI_OpenMenu = reinterpret_cast(0x141B9BDB0_g); - Cmd_ArgvBuffer(1, command, 500); - LUI_OpenMenu(0, command, true, false, false); - } -} - -void Cmd_AddBot_f() { - auto SV_ClientMP_AddTestClient = reinterpret_cast(0x14136E570_g); - SV_ClientMP_AddTestClient(); -} - -void Cmd_DDLDump_f() { - int cur = 0; - DDLFile* g_assets = *(DDLFile**)(0x14B8F5C48_g); - if (g_assets[cur].name) { - while (g_assets[cur].name != 0 && g_assets[cur].ddlDef != 0) { - nlog("%s\n", g_assets[cur].name); - for (int istruct = 0; istruct < g_assets[cur].ddlDef->structCount; istruct++) { - nlog("struct %s { //count: %i\n", g_assets[cur].ddlDef->structList[istruct].name, g_assets[cur].ddlDef->structList[istruct].memberCount); - for (int imember = 0; imember < g_assets[cur].ddlDef->structList[istruct].memberCount; imember++) { - if (g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize == 1) { - switch (g_assets[cur].ddlDef->structList[istruct].members[imember].type) { - case DDL_STRING_TYPE: nlog("\tconst char* %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_FIXEDPOINT_TYPE: - case DDL_FLOAT_TYPE: nlog("\tfloat %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_BYTE_TYPE: nlog("\tbyte %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_SHORT_TYPE: nlog("\tshort %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_INT_TYPE: nlog("\tint %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_UINT_TYPE: nlog("\tuint %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_PAD_TYPE: nlog("\tchar %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_HASH_TYPE: nlog("\thash %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_UINT64_TYPE: nlog("\tuint64_t %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_ENUM_TYPE: nlog("\t%s %s;\n", g_assets[cur].ddlDef->enumList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - case DDL_STRUCT_TYPE: nlog("\t%s %s;\n", g_assets[cur].ddlDef->structList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - default:nlog("\t%s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - } - } - else { - switch (g_assets[cur].ddlDef->structList[istruct].members[imember].type) { - case DDL_FIXEDPOINT_TYPE: - case DDL_FLOAT_TYPE: nlog("\tfloat %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_STRING_TYPE: nlog("\tconst char* %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_BYTE_TYPE: nlog("\tbyte %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_SHORT_TYPE: nlog("\tshort %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_INT_TYPE: nlog("\tint %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_UINT_TYPE: nlog("\tuint %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_PAD_TYPE: nlog("\tchar %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_HASH_TYPE: nlog("\thash %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_ENUM_TYPE: nlog("\t%s %s[%i];\n", g_assets[cur].ddlDef->enumList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_UINT64_TYPE: nlog("\tuint64_t %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - case DDL_STRUCT_TYPE: nlog("\t%s %s[%i];\n", g_assets[cur].ddlDef->structList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; - default:nlog("\t%s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; - } - } - } - nlog("}\n"); - } - for (int ienum = 0; ienum < g_assets[cur].ddlDef->enumCount; ienum++) { - nlog("enum %s { //count: %i\n", g_assets[cur].ddlDef->enumList[ienum].name, g_assets[cur].ddlDef->enumList[ienum].memberCount); - for (int imember = 0; imember < g_assets[cur].ddlDef->enumList[ienum].memberCount; imember++) { - nlog("\t%s,\n", g_assets[cur].ddlDef->enumList[ienum].members[imember]); - } - nlog("}\n\n\n\n"); - } - cur++; - } - } -} - -void Cmd_WeaponDefDump_f() { - //Globals - uintptr_t* bg_weaponCompleteDefs = reinterpret_cast(0x14C6EC870_g); - - nlog("DUMPING WEAPON DEFINITIONS!!! --- \n"); - - for (int i = 0; i < 550; i++) { - WeaponCompleteDef* weap = reinterpret_cast(bg_weaponCompleteDefs[i]); - - if (!weap) continue; - nlog("szInternalName: %s\n", weap->szInternalName); - nlog("szDisplayName: %s\n", weap->szDisplayName); - } - - nlog("FINISHED WEAPON DEFINITION DUMP YAY!!! --- \n"); -} - -void Cmd_ViewVehicleEnts_f() { - auto SL_ConvertToString = reinterpret_cast(0x14131AA20_g); - for (int i = 0; i < 1024; i++) { - int classname = g_entities[i].get(0x17C); - if (classname) { - const char* s_classname = SL_ConvertToString(classname); - if (g_entities[i].get(0x160)) { - nlog("vehicle %s\n", s_classname); - } - } - } -} - -void Cmd_LoadoutSave_f() { - auto Cmd_LocalControllerIndex = reinterpret_cast(0x141298040_g); - auto LiveStorage_GetActiveStatsSource = reinterpret_cast(0x1412A1EB0_g); - auto LiveStorage_CreateDDLContext = reinterpret_cast(0x1412A13C0_g); - auto DDL_MoveToPath = reinterpret_cast(0x1420524F0_g); - //auto Com_DDL_ConvertNavStringToHash = reinterpret_cast(0x14129EE80_g); - //auto LiveStorage_InitializeDDLStateForStatsGroup = reinterpret_cast(0x1410CAD70_g); - auto Com_PlayerData_GetStatsBlob = reinterpret_cast(0x1410CA7A0_g); - auto DDL_GetType = reinterpret_cast(0x142051DD0_g); - auto DDL_GetString = reinterpret_cast(0x142051CD0_g); - auto DDL_GetEnum = reinterpret_cast(0x1420519E0_g); - auto DDL_GetInt = reinterpret_cast(0x142051BF0_g); - auto DDL_GetRootState = reinterpret_cast(0x142051C70_g); - auto CL_PlayerData_GetDDLBuffer = reinterpret_cast(0x1415C7940_g); - auto Com_DDL_LoadAsset = reinterpret_cast(0x14129F3B0_g); - auto Com_ParseNavStrings = reinterpret_cast(0x1412A02E0_g); - auto Com_DDL_CreateContext = reinterpret_cast(0x14129EEC0_g); - - DDLContext context; - DDLState state; - char buffer[200]; - char* navStrings[32]{}; - int navStringCount; - if (CL_PlayerData_GetDDLBuffer(&context, 0, 1, 4)) { - DDL_GetRootState(&state, context.def); - sprintf_s(buffer, "loadouts.0.name"); - Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); - if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) { - printf("%s\n", DDL_GetString(&state, &context)); - } - } -} - -void SaveOperatorSkins() -{ - auto Cmd_LocalControllerIndex = reinterpret_cast(0x141298040_g); - auto LiveStorage_GetActiveStatsSource = reinterpret_cast(0x1412A1EB0_g); - auto LiveStorage_CreateDDLContext = reinterpret_cast(0x1412A13C0_g); - auto DDL_MoveToPath = reinterpret_cast(0x1420524F0_g); - //auto Com_DDL_ConvertNavStringToHash = reinterpret_cast(0x14129EE80_g); - //auto LiveStorage_InitializeDDLStateForStatsGroup = reinterpret_cast(0x1410CAD70_g); - auto Com_PlayerData_GetStatsBlob = reinterpret_cast(0x1410CA7A0_g); - auto DDL_GetType = reinterpret_cast(0x142051DD0_g); - auto DDL_GetString = reinterpret_cast(0x142051CD0_g); - auto DDL_GetEnum = reinterpret_cast(0x1420519E0_g); - auto DDL_GetInt = reinterpret_cast(0x142051BF0_g); - auto DDL_GetRootState = reinterpret_cast(0x142051C70_g); - auto CL_PlayerData_GetDDLBuffer = reinterpret_cast(0x1415C7940_g); - auto Com_DDL_LoadAsset = reinterpret_cast(0x14129F3B0_g); - auto Com_ParseNavStrings = reinterpret_cast(0x1412A02E0_g); - auto Com_DDL_CreateContext = reinterpret_cast(0x14129EEC0_g); - auto StringTable_GetColumnValueForRow = reinterpret_cast(0x1413E2B40_g); - - DDLContext context; - DDLState state; - char buffer[200]; - char* navStrings[32]{}; - int navStringCount; - char path[MAX_PATH + 1]; - strcpy(path, Dvar_GetStringSafe("LOOQOTRNTN")); - strcat(path, "\\players\\inventory.json"); - nlohmann::json inventoryJson; - if (CL_PlayerData_GetDDLBuffer(&context, 0, 1, 4)) { - auto operatorCsv = DB_FindXAssetHeader(ASSET_TYPE_STRINGTABLE, "operators.csv", 0).stringTable; - for (int i = 0; i < operatorCsv->rowCount; ++i) { - const char* operatorName = StringTable_GetColumnValueForRow(operatorCsv, i, 1); - DDL_GetRootState(&state, context.def); - sprintf_s(buffer, "customizationSetup.operatorCustomization.%s.skin", operatorName); - Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); - if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) - { - inventoryJson["Operator"]["OperatorSkin"][operatorName] = DDL_GetInt(&state, &context); - } - } - for (int i = 0; i < 2; ++i) - { - DDL_GetRootState(&state, context.def); - sprintf_s(buffer, "customizationSetup.operators.%d", i); - Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); - if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) - { - inventoryJson["Operator"]["SelectedOperator"][i] = DDL_GetEnum(&state, &context); - } - } - std::ofstream JsonOut(path); - JsonOut << inventoryJson; - } -} - -int LuaShared_LuaCall_IsDemoBuild_Detour(uintptr_t luaVM) { - lua_pushboolean(luaVM, 1); - return 1; -} - -utils::hook::detour dvar_findvarbyname; -dvar_t* Dvar_FindVarByName_Detour(const char* dvarName) { - dvar_t* ret = dvar_findvarbyname.stub(dvarName); - return ret; -} - -utils::hook::detour db_findxassetheader; -XAssetHeader DB_FindXAssetHeader_Detour(XAssetType type, const char* givenName, int allowCreateDefault) { - XAssetHeader temp = db_findxassetheader.stub(type, givenName, allowCreateDefault); - - //if (type == ASSET_TYPE_XMODEL) { - // if (strcmp(temp.model->name, "head_mp_western_ghost_1_1") == 0) { - // return db_findxassetheader.stub(type, "head_opforce_juggernaut", allowCreateDefault); - // } - // if (strcmp(temp.model->name, "mp_western_vm_arms_ghost_1_1") == 0) { - // return db_findxassetheader.stub(type, "viewhands_opforce_juggernaut", allowCreateDefault); - // } - // if (strcmp(temp.model->name, "body_mp_western_ghost_1_1_lod1") == 0) { - // return db_findxassetheader.stub(type, "body_opforce_juggernaut_mp_lod1", allowCreateDefault); - // } - // if (strcmp(temp.model->name, "military_carepackage_01_friendly") == 0) { - // return db_findxassetheader.stub(type, "opforce_juggernaut_prop_static", allowCreateDefault); - // } - // if (strstr(temp.model->name, "veh8_mil_air_")) { - // return db_findxassetheader.stub(type, "veh8_mil_air_acharlie130", allowCreateDefault); - // } - //} - - //if (type == ASSET_TYPE_STRINGTABLE) - //{ - // char path[MAX_PATH + 1]; - // memset(path, 0, MAX_PATH + 1); - // snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), givenName); - // if (file_exists(path)) - // { - // printf("replacing file %s\n", givenName); - - // csv::CSVFileInfo info = csv::get_file_info(path); - // StringTable* table = temp.stringTable; - // table->rowCount = info.n_rows; - // table->columnCount = info.n_cols; - - // //table->name = - // } - //} - - return temp; -} - -utils::hook::detour db_getrawbufferinflate; -const char* DB_GetRawBufferInflate_Detour(const char* file, char* buffer, int length) { - char path[MAX_PATH + 1]; - memset(path, 0, MAX_PATH + 1); - std::string filecontents; - std::string curline; - snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), file); - if (file_exists(path)) { - printf("replacing file %s\n", file); - std::ifstream myfile; - myfile.open(path); - filecontents = ""; - while (myfile) { - std::getline(myfile, curline); - filecontents += curline + "\n"; - } - myfile.close(); - strcpy(buffer, filecontents.c_str()); - return filecontents.c_str();; - } - printf("loading %s\n", file); - return db_getrawbufferinflate.stub(file, buffer, length); -} - -const char* _va(const char* format, ...) { - char _buf[2048]; - va_list ap; - - va_start(ap, format); - vsnprintf(_buf, 2048, format, ap); - _buf[2047] = 0; - return _buf; -} -SpawnPointEntityRecord* g_customSpawns; -char g_customEntityString[0xFFFFFFF]; -utils::hook::detour load_mapentsasset; -void Load_MapEntsAsset_Detour(XAssetHeader* mapEnts) { - auto Scr_AllocGlobalString = reinterpret_cast(0x14131B2C0_g); - char path[MAX_PATH + 1]; - snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), mapEnts->image->name); - if (file_exists(path)) { - printf("loading %s\n", path); - HANDLE mapEntsFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); - int numberOfBytesRead = GetFileSize(mapEntsFile, NULL); - if (mapEntsFile != INVALID_HANDLE_VALUE) - { - memset(g_customEntityString, 0, 0xFFFFFFF); - ReadFile(mapEntsFile, g_customEntityString, numberOfBytesRead, (LPDWORD)&numberOfBytesRead, 0); - mapEnts->mapEnts->entityString = g_customEntityString; - mapEnts->mapEnts->numEntityChars = strlen(g_customEntityString) + 1; - CloseHandle(mapEntsFile); - memset(path, 0, MAX_PATH + 1); - snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s.spawnlist", Dvar_GetStringSafe("LOOQOTRNTN"), mapEnts->image->name); - if (!file_exists(path)) { - } - else { - nlohmann::json json; - std::ifstream file(path); - file >> json; - file.close(); - mapEnts->mapEnts->spawnList.spawnsCount = json["spawnList"]["spawnsCount"]; - for (int i = 0; i < mapEnts->mapEnts->spawnList.spawnsCount; i++) { - mapEnts->mapEnts->spawnList.spawns[i].index = json["spawnList"][_va("spawns[%i]", i)]["index"]; - mapEnts->mapEnts->spawnList.spawns[i].name = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["name"]).c_str()); - mapEnts->mapEnts->spawnList.spawns[i].target = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["target"]).c_str()); - mapEnts->mapEnts->spawnList.spawns[i].script_noteworthy = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["script_noteworthy"]).c_str()); - - mapEnts->mapEnts->spawnList.spawns[i].origin.v[0] = json["spawnList"][_va("spawns[%i]", i)]["origin"][0]; - mapEnts->mapEnts->spawnList.spawns[i].origin.v[1] = json["spawnList"][_va("spawns[%i]", i)]["origin"][1]; - mapEnts->mapEnts->spawnList.spawns[i].origin.v[2] = json["spawnList"][_va("spawns[%i]", i)]["origin"][2]; - - mapEnts->mapEnts->spawnList.spawns[i].angles.v[0] = json["spawnList"][_va("spawns[%i]", i)]["angles"][0]; - mapEnts->mapEnts->spawnList.spawns[i].angles.v[1] = json["spawnList"][_va("spawns[%i]", i)]["angles"][1]; - mapEnts->mapEnts->spawnList.spawns[i].angles.v[2] = json["spawnList"][_va("spawns[%i]", i)]["angles"][2]; - } - } - } - } - - printf("%s\n", mapEnts->mapEnts->clientTrigger.triggerString); - - load_mapentsasset.stub(mapEnts); -} - -utils::hook::detour load_clipmapasset; -void Load_ClipMapAsset_Detour(XAssetHeader* clipMap) { - load_clipmapasset.stub(clipMap); -} -char g_customBuffer[0x18000]; -utils::hook::detour db_getrawbuffer; -void DB_GetRawBuffer_Detour(const RawFile* rawfile, char* buf, int size) { - char path[MAX_PATH + 1]; - snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), rawfile->name); - if (file_exists(path)) { - HANDLE mapEntsFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); - int numberOfBytesRead = GetFileSize(mapEntsFile, NULL); - if (mapEntsFile != INVALID_HANDLE_VALUE) - { - ReadFile(mapEntsFile, g_customBuffer, numberOfBytesRead, (LPDWORD)&numberOfBytesRead, 0); - CloseHandle(mapEntsFile); - strcpy(buf, g_customBuffer); - printf("replacing %s\n", rawfile->name); - } - return; - } - printf("loading %s\n", rawfile->name); - - db_getrawbuffer.stub(rawfile, buf, size); -} - -utils::hook::detour db_pollfastfilestate; -int DB_PollFastfileState_Detour(const char* zoneName) { - if (strcmp(zoneName, "mp_donetsk_cg_ls_tr") == 0) { - return 2; - } - - //printf("%s\n", zoneName); - - return db_pollfastfilestate.stub(zoneName); -} - -utils::hook::detour load_xmodelasset; -void Load_XModelAsset_Detour(XAssetHeader* model) { - load_xmodelasset.stub(model); -} - -utils::hook::detour ddl_setuint; -bool DDL_SetUInt_Detour(const DDLState* state, DDLContext* ddlContext, unsigned int val) { - //ddlContext->obfuscated = false; - //printf("%p - %p\n", state->offset, (uintptr_t)(ddlContext->buff) + state->offset); - - return ddl_setuint.stub(state, ddlContext, val); -} - -void SV_CmdsMP_FastRestart_f() { - auto SV_CmdsMP_RequestMapRestart = reinterpret_cast(0x14136C310_g); - SV_CmdsMP_RequestMapRestart(1, 0); -} - -void* exception_handler_handle; -BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) { - g_Addrs.ModuleBase = (uintptr_t)(GetModuleHandle(0)); - utils::hook::set(0x1403061A0_g, 0xC3); // Mystery function 1 - if (Reason == DLL_PROCESS_ATTACH) { - AllocConsole(); - FILE* Dummy; - freopen_s(&Dummy, "CONOUT$", "w", stdout); - freopen_s(&Dummy, "CONIN$", "r", stdin); - - utils::nt::library game{}; - utils::nt::library user32("user32.dll"); - utils::nt::library ntdll("ntdll.dll"); - utils::nt::library kernel32("kernel32.dll"); - - va = (const char* (*)(const char*, ...))0x1413F3010_g; //j_va - - nlog("Base Address: %p\n", base); - - cmd_args = (CmdArgs*)(0x14D20CBD0_g); - - //utils::hook::jump(0x141BD3360_g, sub_141BD3360_Detour); - - //sub_141BD3360.create(0x141BD3360_g, sub_141BD3360_Detour); - - utils::hook::copy(0x1530AD525_g, data_buf, 0x12856B); // Splash screen data - - Cmd_AddCommandInternal("set_byte", set_byte_f, &set_byte_f_VAR); - Cmd_AddCommandInternal("set_short", set_short_f, &set_short_f_VAR); - Cmd_AddCommandInternal("set_int", set_int_f, &set_int_f_VAR); - Cmd_AddCommandInternal("set_pointer", set_pointer_f, &set_pointer_f_VAR); - Cmd_AddCommandInternal("quit", Cmd_Quit_f, &quit_f_VAR); - Cmd_AddCommandInternal("openmenu", Cmd_OpenMenu_f, &openmenu_f_VAR); - //Cmd_AddCommandInternal("addbot", Cmd_AddBot_f, &addbot_f_VAR); - Cmd_AddCommandInternal("ddldump", Cmd_DDLDump_f, &ddldump_f_VAR); - Cmd_AddCommandInternal("weapondefdump", Cmd_WeaponDefDump_f, &weapondefdump_f_VAR); - //Cmd_AddCommandInternal("view_vehicle_ents", Cmd_ViewVehicleEnts_f, &view_vehicle_ents_f_VAR); - //Cmd_AddCommandInternal("loadout_save", Cmd_LoadoutSave_f, &loadout_save_f_VAR); - Cmd_AddCommandInternal("loadout_save", SaveOperatorSkins, &loadout_save_f_VAR); - Cmd_AddCommandInternal("fast_restart", SV_CmdsMP_FastRestart_f, &FastRestart_f_VAR); - - // patch ui_maxclients limit - utils::hook::nop(0x140F30210_g, 5); - utils::hook::nop(0x14119E51D_g, 5); - utils::hook::nop(0x14136B8F8_g, 5); - utils::hook::nop(0x1416029F0_g, 5); - utils::hook::nop(0x1419E19A3_g, 5); - - // patch party_maxplayers limit - utils::hook::nop(0x140F252EE_g, 5); - utils::hook::nop(0x14119D23F_g, 5); - utils::hook::nop(0x1410769B9_g, 5); - utils::hook::set(0x1410769B9_g, 0xC3); - utils::hook::nop(0x140F24B4B_g, 5); - utils::hook::set(0x140F24B4B_g, 0xC3); - utils::hook::nop(0x1416029E2_g, 5); - utils::hook::nop(0x14119E52B_g, 5); - utils::hook::nop(0x140f252EE_g, 5); - utils::hook::nop(0x14119F13A_g, 5); - utils::hook::nop(0x1410D32E2_g, 5); - - // Fix crash exploit - utils::hook::nop(0x14136D0EA_g, 5); - - db_findxassetheader.create(0x1411AA890_g, DB_FindXAssetHeader_Detour); - db_getrawbufferinflate.create(0x1412C2AE0_g, DB_GetRawBufferInflate_Detour); - ddl_setuint.create(0x1420529C0_g, DDL_SetUInt_Detour); - //db_pollfastfilestate.create(0x1411ADD00_g, DB_PollFastfileState_Detour); - - load_mapentsasset.create(0x140F61690_g, Load_MapEntsAsset_Detour); - load_clipmapasset.create(0x140F60F40_g, Load_ClipMapAsset_Detour); - load_xmodelasset.create(0x140F62290_g, Load_XModelAsset_Detour); - //load_ttfasset.create(0x140F61F40_g, Load_TTFAsset_Detour); - - db_getrawbuffer.create(0x1412C29A0_g, DB_GetRawBuffer_Detour); - - utils::hook::jump(0x141528490_g, Live_IsUserSignedInToDemonware_Detour); - utils::hook::jump(0x1417EC930_g, dwGetLogOnStatus_Detour); - utils::hook::jump(0x1412A1EB0_g, LiveStorage_GetActiveStatsSource_Detour); - //utils::hook::jump(0x1419B96A0_g, LuaShared_LuaCall_IsDemoBuild_Detour); - - dvar_findvarbyname.create(0x1413E63A0_g, Dvar_FindVarByName_Detour); - - db_loadxfile.create(0x1411A79F0_g, DB_LoadXFile_Detour); - CL_TransientsMP_ProcessLoadingQueue.create(0x1415F7BF0_g, CL_TransientsMP_ProcessLoadingQueue_Detour); - - lui_cod_registerdvars.create(0x1419D4500_g, LUI_CoD_RegisterDvars_Detour); - net_outofbanddata.create(0x1412BB350_g, NET_OutOfBandData_Detour); - cl_keys_event.create(0x1415BEB80_g, CL_Keys_Event_Detour); - dvar_registerbool.create(0x1413E7670_g, Dvar_RegisterBool_Detour); - dvar_registerstring.create(0x1413E7A70_g, Dvar_RegisterString_Detour); - seh_stringed_getstring.create(0x1413CC2A0_g, SEH_StringEd_GetString_Detour); - - cl_createdevgui.create(0x1415B2080_g, CL_CreateDevGui_Detour); - partyhost_startprivateparty.create(0x14119F0D0_g, PartyHost_StartPrivateParty_Detour); - - PM_WeaponUseAmmo.create(0x141155AF0_g, PM_WeaponUseAmmo_Detour); //TODO: add sv_cheat validation - - clientUIActives = (clientUIActive_t*)(0x14EEF1280_g); - } - - return TRUE; -} - -void nlog(const char* str, ...) { - va_list ap; - HWND notepad, edit; - char buf[256]; - - va_start(ap, str); - vsprintf(buf, str, ap); - va_end(ap); - strcat(buf, ""); - log(buf); -} -void nlog(const char* file, const char* str, ...) { - va_list ap; - HWND notepad, edit; - char buf[256]; - - va_start(ap, str); - vsprintf(buf, str, ap); - va_end(ap); - strcat(buf, ""); - log(file, buf); -} - -uintptr_t find_pattern(const char* module_name, const char* pattern) { - const auto get_module_size = [=](uintptr_t module_base) - { - return reinterpret_cast(module_base + reinterpret_cast(module_base)->e_lfanew)->OptionalHeader.SizeOfImage; - }; - const auto module_start = (uintptr_t)GetModuleHandle(module_name); - if (module_start != 0ULL) - { - const auto module_end = module_start + get_module_size(module_start); - - const char* pattern_current = pattern; - uintptr_t current_match = NULL; - - MEMORY_BASIC_INFORMATION64 page_information = {}; - for (auto current_page = reinterpret_cast(module_start); current_page < reinterpret_cast(module_end); current_page = reinterpret_cast(page_information.BaseAddress + page_information.RegionSize)) - { - VirtualQuery(reinterpret_cast(current_page), reinterpret_cast(&page_information), sizeof(MEMORY_BASIC_INFORMATION)); - if (page_information.Protect == PAGE_NOACCESS) - continue; - - if (page_information.State != MEM_COMMIT) - continue; - - if (page_information.Protect & PAGE_GUARD) - continue; - - for (auto current_address = reinterpret_cast(page_information.BaseAddress); current_address < reinterpret_cast(page_information.BaseAddress + page_information.RegionSize - 0x8); current_address++) - { - if (*current_address != GET_BYTE(pattern_current) && *pattern_current != '\?') { - current_match = 0ULL; - pattern_current = pattern; - continue; - } - - if (!current_match) - current_match = reinterpret_cast(current_address); - - pattern_current += 3; - if (pattern_current[-1] == NULL) - return current_match; - } - } - } - - return 0ULL; -} - -uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pattern) { - const auto get_module_size = [=](uintptr_t module_base) - { - return reinterpret_cast(module_base + reinterpret_cast(module_base)->e_lfanew)->OptionalHeader.SizeOfImage; - }; - const auto module_start = start; - if (module_start != 0ULL) - { - const auto module_end = module_start + get_module_size(module_start); - - const char* pattern_current = pattern; - uintptr_t current_match = NULL; - - MEMORY_BASIC_INFORMATION64 page_information = {}; - for (auto current_page = reinterpret_cast(module_start); current_page < reinterpret_cast(module_end); current_page = reinterpret_cast(page_information.BaseAddress + page_information.RegionSize)) - { - VirtualQuery(reinterpret_cast(current_page), reinterpret_cast(&page_information), sizeof(MEMORY_BASIC_INFORMATION)); - if (page_information.Protect == PAGE_NOACCESS) - continue; - - if (page_information.State != MEM_COMMIT) - continue; - - if (page_information.Protect & PAGE_GUARD) - continue; - - for (auto current_address = reinterpret_cast(page_information.BaseAddress); current_address < reinterpret_cast(page_information.BaseAddress + page_information.RegionSize - 0x8); current_address++) - { - if (*current_address != GET_BYTE(pattern_current) && *pattern_current != '\?') { - current_match = 0ULL; - pattern_current = pattern; - continue; - } - - if (!current_match) - current_match = reinterpret_cast(current_address); - - pattern_current += 3; - if (pattern_current[-1] == NULL) - return current_match; - } - } - } - - return 0ULL; -} -menu_variables vars; - -size_t operator"" _b(const size_t val) -{ - return base + val; -} - -size_t reverse_b(const size_t val) -{ - return val - base; -} - -size_t reverse_b(const void* val) -{ - return reverse_b(reinterpret_cast(val)); -} - -size_t operator"" _g(const size_t val) -{ - return base + (val - 0x140000000); -} - -size_t reverse_g(const size_t val) -{ - return (val - base) + 0x140000000; -} - -size_t reverse_g(const void* val) -{ - return reverse_g(reinterpret_cast(val)); -} - -void log(const char* str) { - std::ofstream outputFile("output.log", std::ios::app); - if (outputFile.is_open()) { - outputFile << str; - outputFile.close(); - } - else { - std::cout << "Failed to open file for appending." << std::endl; - } -} - -void log(const char* file, const char* str) { - try { - std::ofstream outputFile(file, std::ios::app); - if (!outputFile.is_open()) { - throw std::runtime_error("Failed to open file for appending."); - } - - outputFile << str; - } - catch (const std::exception& e) { - printf("%s\n", e.what()); - } +#include "Main.hpp" + +void* exception_handler; + +bool isSubStr(std::string str, std::string subStr) +{ + size_t pos = str.find(subStr); + if (pos != std::string::npos) + { + return true; + } + return false; +} + +float strToFloat(const std::string& str) +{ + float num = 0.0f; + float fraction = 0.1f; + bool isNegative = false; + + size_t i = 0; + if (str[i] == '-') + { + isNegative = true; + i++; + } + + for (; i < str.length(); i++) + { + if (str[i] >= '0' && str[i] <= '9') + { + num = num * 10.0f + static_cast(str[i] - '0'); + } + else if (str[i] == '.') + { + i++; + break; + } + else + { + break; + } + } + + for (; i < str.length(); i++) + { + if (str[i] >= '0' && str[i] <= '9') + { + num += (str[i] - '0') * fraction; + fraction *= 0.1f; + } + else + { + break; + } + } + + if (isNegative) + { + num = -num; + } + + return num; +} + +void backtrace(const char* func) { + const int trace_count = 15; + void* trace_back[trace_count]; + DWORD hash; + RtlCaptureStackBackTrace(1, trace_count, trace_back, &hash); + nlog("%s callstack: ", func); + printf("%s callstack: ", func); + for (int i = 0; i < trace_count; i++) { + if (i == trace_count - 1) { + nlog("%p\n", (uintptr_t)trace_back[i]); + printf("%p\n", (uintptr_t)trace_back[i]); + } + else { + nlog("%p:", (uintptr_t)trace_back[i]); + printf("%p:", (uintptr_t)trace_back[i]); + } + } +} + +int BG_Omnvar_GetType(OmnvarDef* ovDef); + +void DumpOmnvars() +{ + auto G_Omnvar_GetData = reinterpret_cast(0x140FC5110_g); + auto BG_Omnvar_GetTypeString = reinterpret_cast(0x140CD5900_g); + auto NetConstStrings_GetLuiStringIndex = reinterpret_cast(0x1410F0F40_g); + auto BG_Omnvar_GetValueString = reinterpret_cast(0x140CD5980_g); + + g_entities = *reinterpret_cast(0x14BC20F00_g); + + uintptr_t psHost = ((uintptr_t)(g_entities + 0x150)); + + int s_omnvarDefCount = *(int*)(0x145C48518_g); + OmnvarDef* OmnvarDefs = (OmnvarDef*)(0x145C48580_g); + for (int i = 0; i < s_omnvarDefCount; ++i) + { + OmnvarDef* omnvar = &OmnvarDefs[i]; + OmnvarData* data = G_Omnvar_GetData(i, 0, psHost); + const char* typeStr = BG_Omnvar_GetTypeString(omnvar); + int type = BG_Omnvar_GetType(omnvar); + + std::cout << "omnvar '" << omnvar->name << "' (" << typeStr << ") "; + if (type == OMNVAR_TYPE_BOOL) + { + std::cout << "value(" << data->current.enabled << ") "; + } + else if (type == OMNVAR_TYPE_FLOAT) + { + std::cout << "value(" << data->current.value << ") "; + } + else if (type == OMNVAR_TYPE_INT) + { + std::cout << "value(" << data->current.integer << ") "; + } + else if (type == OMNVAR_TYPE_UINT || type == OMNVAR_TYPE_TIME) + { + std::cout << "value(" << data->current.unsignedInteger << ") "; + } + else if (type == OMNVAR_TYPE_NCS_LUI) + { + char currentStr[100] = { NULL }; + BG_Omnvar_GetValueString(omnvar, data, currentStr, 100); + + std::cout << "value'" << currentStr << "' "; + } + else + { + std::cout << "value(" << data->current.unsignedInteger << ") "; + } + + std::cout << std::endl; + } +} + +int iTick = 0; +bool bFinished; +bool btoggle; + +uintptr_t xuid_generated; +int collision_ticker; +utils::hook::detour r_endframe; +void R_EndFrame_Detour() { + if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) { + *reinterpret_cast(0x14E385A68_g) = 80; + *reinterpret_cast(0x14E385A78_g) = 80; + if (collision_ticker == 60) { + btoggle = !btoggle; + *reinterpret_cast(0x145CC7555_g) = btoggle; // s_transientsCollisionMP_LobbyToGameStart + } + collision_ticker++; + } + else { + *reinterpret_cast(0x14E385A68_g) = 1000; + *reinterpret_cast(0x14E385A78_g) = 1000; + } + + if (!bFinished) { + if (iTick == 500) { + DWORD flOldProtect; + XUID xuid; + xuid.RandomXUID(); + utils::hook::set(0x144622BE0_g, 1); + + utils::hook::set(0x14E5C07C0_g, 0x11CB1243B8D7C31E | xuid.m_id * xuid.m_id); + utils::hook::set(0x14F05ACE8_g, 0x11CB1243B8D7C31E | xuid.m_id * xuid.m_id); + + utils::hook::set(0x14E5C07E8_g, 0x11CB1243B8D7C31E | (xuid.m_id * xuid.m_id) / 6); // s_presenceData + + utils::hook::set(0x14E371231_g, 1); + utils::hook::set(0x144622910_g, 2); + utils::hook::set(0x144622BE0_g, 1); + + utils::hook::set(*reinterpret_cast(0x14EE560B0_g) + 0x28, 0); + utils::hook::set(0x14E5C0730_g, 2); + + auto get_bnet_class = reinterpret_cast(0x141660280_g); + uintptr_t bnet_class = get_bnet_class(); + *(DWORD*)(bnet_class + 0x2F4) = 0x795230F0; + *(DWORD*)(bnet_class + 0x2FC) = 0; + *(BYTE*)(bnet_class + 0x2F8) = 31; + + printf("LOADED!\n"); + bFinished = true; + } + else { + iTick += 1; + } + } + + r_endframe.stub(); +} + +bool initiatedevgui; + +void CG_DrawWaterMark() { + float white[4] = { 1.0f, 1.0f, 1.0f, 0.2f }; + // CL_DrawText(0x14EF2DEA0_g, "Fuck off activision you cunts", 0x7FFFFFFF, *reinterpret_cast(0x14EEB0C68_g), 0, 400.0f, 1, 1, 0.80000001, 0.80000001, white, 7); +} + +void CL_ScreenMP_DrawOverlay_Detour() { + auto DevGui_Draw = reinterpret_cast(0x1417E5CD0_g); + auto Con_DrawConsole = reinterpret_cast(0x1415AE0B0_g); + + Con_DrawConsole(0); + DevGui_Draw(0); + + if (show_watermark->current.enabled) { + CG_DrawWaterMark(); + } +} + +utils::hook::detour cl_createdevgui; +void CL_CreateDevGui_Detour(int fsMenuEntries, const char* modeCfg) { + auto DevGui_AddCommand = reinterpret_cast(0x1417E58B0_g); + auto DevGui_AddDvar = reinterpret_cast(0x1417E5940_g); + + cl_createdevgui.stub(fsMenuEntries, modeCfg); +} + +const char* username_Detour() { + if (player_name) { + return player_name->current.string; + } + else { + return "Unknown Name"; + } +} + +utils::hook::detour lui_cod_registerdvars; +void LUI_CoD_RegisterDvars_Detour() { + nlog("registering lui dvars\n"); + player_name = Dvar_RegisterString("player_name", "Player1", 0, "Sets the player name."); + sv_cheats = Dvar_RegisterBool("sv_cheats", false, 0, "Enables cheats to be used on a server"); + spawn_br_gas = Dvar_RegisterBool("spawn_br_gas", true, 0, "Disables gas in battle royale maps"); + show_watermark = Dvar_RegisterBool("show_watermark", false, 0, "Shows the watermark for codUPLOADER"); + + player_sustainammo = Dvar_RegisterBool("player_sustainAmmo", false, 0, "Firing weapon will not decrease clip ammo."); + + lui_cod_registerdvars.stub(); +} + +utils::hook::detour db_zones_performzoneload; +__int64 DB_Zones_PerformZoneLoad_Detour(bool processingPreloadedFiles, bool isBaseMap, bool wasPaused, int failureMode) { + failureMode = 1; + + return db_zones_performzoneload.stub<__int64>(processingPreloadedFiles, isBaseMap, wasPaused, failureMode); +} + +void CL_TransientsCollisionMP_SetTransientMode_Detour(int mode) { + if (strcmp(Dvar_GetStringSafe("NSQLTTMRMP"), "mp_donetsk") == 0) { + *reinterpret_cast(0x145CC7534_g) = 1; + } + else { + *reinterpret_cast(0x145CC7534_g) = mode; + } +} + +utils::hook::detour net_outofbanddata; +bool NET_OutOfBandData_Detour(int sock, netadr_t* adr, const unsigned __int8* format, int len) { + return net_outofbanddata.stub(sock, adr, format, len); +} + +utils::hook::detour g_cmdsmp_clientcommand; +void G_CmdsMP_ClientCommand_Detour(int clientNum) { + g_entities = *reinterpret_cast(0x14BC20F00_g); + + uintptr_t client = g_entities[clientNum].get(0x150); + + char command[1024]; + SV_Cmd_ArgvBuffer(0, command, 1024); + + if (client) { + if (strcmp(command, "noclip") == 0) { + if (CheatsOk(clientNum)) { + Cmd_Noclip_f(clientNum); + } + return; + } + if (strcmp(command, "give") == 0) { + if (CheatsOk(clientNum)) { + SV_Cmd_ArgvBuffer(1, command, 1024); + Weapon weap; + if (BG_Weapons_GetFullWeaponForName(command, &weap, BG_FindBaseWeaponForName)) { + if (SV_Cmd_Argc() == 3) { + SV_Cmd_ArgvBuffer(2, command, 1024); + weap.weaponCamo = atoi(command); + } + if (G_Weapon_GivePlayerWeapon(client, 0, &weap, 0, 0, 0)) { + G_Items_AddAmmo(client, &weap, 0, 9999, 1); + G_Weapon_SelectWeapon(clientNum, &weap); + } + } + } + } + + if (strcmp(command, "give_akimbo") == 0) + { + if (CheatsOk(clientNum)) + { + SV_Cmd_ArgvBuffer(1, command, 1024); + Weapon weap; + if (BG_Weapons_GetFullWeaponForName(command, &weap, BG_FindBaseWeaponForName)) + { + if (SV_Cmd_Argc() == 3) + { + SV_Cmd_ArgvBuffer(2, command, 1024); + weap.weaponCamo = atoi(command); + } + if (G_Weapon_GivePlayerWeapon(client, 0, &weap, 1, 0, 0)) + { + G_Items_AddAmmo(client, &weap, 0, 9999, 1); + G_Weapon_SelectWeapon(clientNum, &weap); + } + } + } + } + + if (strcmp(command, "ks_give") == 0) { + if (CheatsOk(clientNum)) { + SV_Cmd_ArgvBuffer(1, command, 1024); + scrContext_t* ctx = ScriptContext_Server(); + Scr_AddString(ctx, command); + + Scr_FreeThread(ctx, GScr_ExecEntThread(&g_entities[clientNum], 0x1B65FC, 1)); + } + } + if (strcmp(command, "bold_msg") == 0) { + char msgbuf[500]; + SV_Cmd_ArgvBuffer(1, command, 1024); + if (strlen(command) < 500) { + for (int i = 0; i < 30; i++) { + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * i)); + if (ms_clients) { + snprintf(msgbuf, 500, "g \"%s\"", command); + ms_clients->SendServerCommand(1, msgbuf); + } + } + } + } + if (strcmp(command, "remove_barriers") == 0) { + if (CheatsOk(clientNum)) { + auto SL_ConvertToString = reinterpret_cast(0x14131AA20_g); + for (int i = 0; i < 1024; i++) { + int classname = g_entities[i].get(0x17C); + if (classname) { + if (strcmp(SL_ConvertToString(classname), "trigger_hurt") == 0 || + strcmp(SL_ConvertToString(classname), "trigger_multiple") == 0 || + strcmp(SL_ConvertToString(classname), "trigger_damage") == 0) { + auto G_SetOrigin = reinterpret_cast(0x140FD4CC0_g); + vec3_t gone = { 0, 0, -9999999 }; + G_SetOrigin(&g_entities[i], &gone, true, true); + } + } + } + for (int i = 0; i < 30; i++) { + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * i)); + if (ms_clients) { + ms_clients->SendServerCommand(1, "g \"Death barriers removed!\""); + } + } + } + } + + /*if (strcmp(command, "scmd") == 0) + { + if (CheatsOk(clientNum) && clientNum == 0) + { + char msgbuf[500]; + std::string cmdline = ""; + if (SV_Cmd_Argc() > 1) + { + for (int i = 0; i < SV_Cmd_Argc() - 1; i++) + { + SV_Cmd_ArgvBuffer(1 + i, msgbuf, 500); + if (i == 0) + { + cmdline = msgbuf; + } + else + { + cmdline = cmdline + " " + std::string(msgbuf); + } + std::cout << 1 + i << ": '" << msgbuf << "'" << std::endl; + memset(msgbuf, 0, 500); + } + + const char* cCmdLine = cmdline.c_str(); + memcpy(msgbuf, cCmdLine, cmdline.length() + 1); + std::cout << "msgbug: '" << msgbuf << "'" << std::endl; + + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * clientNum)); + if (ms_clients) + { + ms_clients->SendServerCommand(1, msgbuf); + } + } + } + }*/ + + if (strcmp(command, "viewpos") == 0) { + if (CheatsOk(clientNum)) { + char msgbuf[500]; + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * clientNum)); + if (ms_clients) { + snprintf(msgbuf, 500, "f \"viewpos: (%.2f, %.2f, %.2f)\"", g_entities[clientNum].r_currentOrigin[0], g_entities[clientNum].r_currentOrigin[1], g_entities[clientNum].r_currentOrigin[2]); + ms_clients->SendServerCommand(1, msgbuf); + } + } + } + + if (strcmp(command, "setpos") == 0) + { + if (CheatsOk(clientNum) && clientNum == 0) + { + if (SV_Cmd_Argc() == 4) + { + char xBuf[100]; + char yBuf[100]; + char zBuf[100]; + + SV_Cmd_ArgvBuffer(1, xBuf, 100); + SV_Cmd_ArgvBuffer(2, yBuf, 100); + SV_Cmd_ArgvBuffer(3, zBuf, 100); + + float x = strToFloat(xBuf); + float y = strToFloat(yBuf); + float z = strToFloat(zBuf); + + struct gclient_s + { + char __padding[0x30]; + float coords[3]; + }; + g_entities = *reinterpret_cast(0x14BC20F00_g); + + gclient_s* host = (gclient_s*)g_entities[0].client; + host->coords[0] = x; + host->coords[1] = y; + host->coords[2] = z; + } + } + } + } + + g_cmdsmp_clientcommand.stub(clientNum); +} + +utils::hook::detour cl_inputmp_execbinding; +void CL_InputMP_ExecBinding_Detour(int localClientNum, int kb, int key, int forceNotify) { + switch (key) { + case K_N: + CL_Main_AddReliableCommand("noclip"); + break; + } + + cl_inputmp_execbinding.stub(localClientNum, kb, key, forceNotify); +} + +void Cmd_Exec_Internal(bool isSuperUser) +{ + const char* cmdbuf; + const char* file; + auto DB_FindXAssetHeader = reinterpret_cast(0x1411AA890_g); + auto DB_ReadRawFile = reinterpret_cast(0x141297140_g); + auto Core_strcpy_truncate = reinterpret_cast(0x142036A90_g); + auto Com_DefaultExtension = reinterpret_cast(0x1413F1AE0_g); + char path[64]; + + if (cmd_args->argc[cmd_args->nesting] == 2) + { + Core_strcpy_truncate(path, 64, *(cmd_args->argv[cmd_args->nesting] + 1)); + Com_DefaultExtension(path, 64, ".cfg"); + if (DB_FindXAssetHeader(ASSET_TYPE_RAWFILE, path, 0)) + { + if (!DB_ReadRawFile(0, cmd_args->controllerIndex[cmd_args->nesting], path, isSuperUser)) + { + if (cmd_args->argc[cmd_args->nesting] <= 1) + file = ""; + else + file = *(cmd_args->argv[cmd_args->nesting] + 1); + printf("couldn't exec %s\n", file); + } + } + else + { + FS_ReadFile(path, &cmdbuf); + LUI_CoD_LuaCall_ExecNow(*reinterpret_cast(0x151868880_g), cmdbuf); + } + } + else + { + printf(0, "exec : execute a script file\n"); + } +} + +utils::hook::detour gscr_spawnbrcircle; +void GScr_SpawnBrCircle_Detour(uintptr_t scrContext) { + if (spawn_br_gas->current.enabled) { + gscr_spawnbrcircle.stub(scrContext); + } +} + +void entry_point() { + XUID xuid; + xuid.RandomXUID(); + + printf("%i\n", xuid.m_id); + + r_endframe.create(0x141966950_g, R_EndFrame_Detour); + utils::hook::jump(0x141297580_g, Cmd_Exec_Internal); + utils::hook::jump(0x1415E1340_g, CL_ScreenMP_DrawOverlay_Detour); + utils::hook::jump(0x1413FD3A0_g, username_Detour); + + db_zones_performzoneload.create(0x140F677A0_g, DB_Zones_PerformZoneLoad_Detour); + + g_cmdsmp_clientcommand.create(0x14120B6A0_g, G_CmdsMP_ClientCommand_Detour); + cl_inputmp_execbinding.create(0x1415E1AB0_g, CL_InputMP_ExecBinding_Detour); + gscr_spawnbrcircle.create(0x141243AB0_g, GScr_SpawnBrCircle_Detour); + + utils::hook::jump(0x140D6B7D0_g, CL_TransientsCollisionMP_SetTransientMode_Detour); + + printf("hooked!\n"); +} + +extern "C" __declspec(dllexport) int DiscordCreate() { + CreateThread(0, 0xA0, (LPTHREAD_START_ROUTINE)entry_point, 0, 0, 0); + return 1; +} + +void SaveInventory() +{ + auto DDL_MoveToPath = reinterpret_cast(0x142052430_g); + //auto Com_DDL_ConvertNavStringToHash = reinterpret_cast(0x14129EE80_g); + //auto LiveStorage_InitializeDDLStateForStatsGroup = reinterpret_cast(0x1410CAD70_g); + auto Com_PlayerData_GetStatsBlob = reinterpret_cast(0x1410CA7A0_g); + auto DDL_GetType = reinterpret_cast(0x142051DD0_g); + auto DDL_GetString = reinterpret_cast(0x142051CD0_g); + auto DDL_GetEnum = reinterpret_cast(0x1420519E0_g); + auto DDL_GetInt = reinterpret_cast(0x142051BF0_g); + auto DDL_GetRootState = reinterpret_cast(0x142051C70_g); + auto CL_PlayerData_GetDDLBuffer = reinterpret_cast(0x1415C7940_g); + auto Com_DDL_LoadAsset = reinterpret_cast(0x14129F3B0_g); + auto Com_ParseNavStrings = reinterpret_cast(0x1412A02E0_g); + auto Com_DDL_CreateContext = reinterpret_cast(0x14129EEC0_g); + + DDLContext context; + DDLDef* ddlDef; + DDLState state; + char buffer[200]; + char* navStrings[32]{}; + int navStringCount; + char path[MAX_PATH + 1]; + strcpy(path, Dvar_GetStringSafe("LOOQOTRNTN")); + strcat(path, "\\players\\inventory.json"); + nlohmann::json inventoryJson; + if (CL_PlayerData_GetDDLBuffer(&context, 0, STATS_OFFLINE, STATSGROUP_PRIVATELOADOUTS)) { + ddlDef = (DDLDef*)context.def; + // start of operator customization related + for (int i = 0; i < ddlDef->enumCount; ++i) + { + if (!strcmp(ddlDef->enumList[i].name, "Operator")) { + for (int j = 0; j < ddlDef->enumList[i].memberCount; ++j) + { + // get operator skins + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorCustomization.%s.skin", ddlDef->enumList[i].members[j]); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + int OP_opSkin = DDL_GetInt(&state, &context); + inventoryJson["Operator"]["OperatorSkin"][ddlDef->enumList[i].members[j]] = OP_opSkin; + } + // execution ids + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorCustomization.%s.execution", ddlDef->enumList[i].members[j]); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Operator"]["OperatorExecution"][ddlDef->enumList[i].members[j]] = DDL_GetInt(&state, &context); + } + } + } + } + // selected operator + for (int i = 0; i < 2; ++i) + { + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operators.%d", i); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Operator"]["SelectedOperator"][i] = DDL_GetEnum(&state, &context); + } + } + // operator Index + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.selectedOperatorIndex"); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Operator"]["OperatorIndex"] = DDL_GetInt(&state, &context); + } + // operator watch + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorWatch"); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Operator"]["OperatorWatch"] = DDL_GetInt(&state, &context); + } + // end of operator customization related + // start of weapon customization + + for (int i = 0; i < 10; ++i) { + // get weapon + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.name", i); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + // test by getting loadout names + inventoryJson["Loadouts"][i] = { {"name", DDL_GetString(&state, &context)} }; + } + for (int j = 0; j < 2; ++j) { + // get camos + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.camo", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Loadouts"][i]["weaponSetup"][j] = { {"camo", DDL_GetEnum(&state, &context)} }; + } + // get weapons + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.weapon", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Loadouts"][i]["weaponSetup"][j].push_back({ "weapon", DDL_GetEnum(&state, &context) }); + } + // get variant ids + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.variantID", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Loadouts"][i]["weaponSetup"][j].push_back({ "variantId", DDL_GetInt(&state, &context) }); + } + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.lootItemID", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Loadouts"][i]["weaponSetup"][j].push_back({ "lootItemID", DDL_GetInt(&state, &context) }); + } + for (int k = 0; k < 5; ++k) { + // get attachments & variants + std::string attachmentName; + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.attachmentSetup.%d.attachment", i, j, k); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + attachmentName = DDL_GetEnum(&state, &context); + } + + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.attachmentSetup.%d.variantID", i, j, k); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + inventoryJson["Loadouts"][i]["weaponSetup"][j]["attachments"][k] = { attachmentName.c_str(), DDL_GetInt(&state, &context) }; + } + } + } + + } + // printf("Saved Inventory!\n"); + } + else { + Com_SetErrorMessage("[DLL ERROR] Couldn't get DDLBuffer, called before initialized?"); + } + + std::ofstream JsonOut(path); + JsonOut << inventoryJson; + +} + +void LoadInventory() +{ + auto Cmd_LocalControllerIndex = reinterpret_cast(0x141298040_g); + auto LiveStorage_GetActiveStatsSource = reinterpret_cast(0x1412A1EB0_g); + auto LiveStorage_CreateDDLContext = reinterpret_cast(0x1412A13C0_g); + auto DDL_MoveToPath = reinterpret_cast(0x142052430_g); + //auto Com_DDL_ConvertNavStringToHash = reinterpret_cast(0x14129EE80_g); + //auto LiveStorage_InitializeDDLStateForStatsGroup = reinterpret_cast(0x1410CAD70_g); + auto Com_PlayerData_GetStatsBlob = reinterpret_cast(0x1410CA7A0_g); + auto DDL_GetType = reinterpret_cast(0x142051DD0_g); + auto DDL_GetString = reinterpret_cast(0x142051CD0_g); + auto DDL_GetEnum = reinterpret_cast(0x1420519E0_g); + auto DDL_GetInt = reinterpret_cast(0x142051BF0_g); + auto DDL_GetRootState = reinterpret_cast(0x142051C70_g); + auto CL_PlayerData_GetDDLBuffer = reinterpret_cast(0x1415C7940_g); + auto Com_DDL_LoadAsset = reinterpret_cast(0x14129F3B0_g); + auto Com_ParseNavStrings = reinterpret_cast(0x1412A02E0_g); + auto Com_DDL_CreateContext = reinterpret_cast(0x14129EEC0_g); + auto StringTable_GetColumnValueForRow = reinterpret_cast(0x1413E2B40_g); + auto DDL_SetInt = reinterpret_cast(0x142052820_g); + auto DDL_SetEnum = reinterpret_cast(0x142052710_g); + auto DDL_SetString = reinterpret_cast(0x1420528D0_g); + + DDLContext context; + DDLDef* ddlDef; + DDLState state; + char buffer[200]; + char* navStrings[32]{}; + int navStringCount; + char path[MAX_PATH + 1]; + strcpy(path, Dvar_GetStringSafe("LOOQOTRNTN")); + strcat(path, "\\players\\inventory.json"); + if (file_exists(path)) { + std::ifstream jsonPath(path); + nlohmann::json inventoryJson = nlohmann::json::parse(jsonPath); + if (CL_PlayerData_GetDDLBuffer(&context, 0, STATS_OFFLINE, STATSGROUP_PRIVATELOADOUTS)) { + ddlDef = (DDLDef*)context.def; + for (int i = 0; i < ddlDef->enumCount; ++i) + { + if (!strcmp(ddlDef->enumList[i].name, "Operator")) { + for (int j = 0; j < ddlDef->enumList[i].memberCount; ++j) + { + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorCustomization.%s.skin", ddlDef->enumList[i].members[j]); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Operator"]["OperatorSkin"][ddlDef->enumList[i].members[j]]); + } + // execution ids + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorCustomization.%s.execution", ddlDef->enumList[i].members[j]); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Operator"]["OperatorExecution"][ddlDef->enumList[i].members[j]]); + } + + } + } + } + for (int i = 0; i < 2; ++i) + { + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operators.%d", i); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetEnum(&state, &context, inventoryJson["Operator"]["SelectedOperator"][i].get().c_str()); + } + } + // operator Index + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.selectedOperatorIndex"); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Operator"]["OperatorIndex"]); + } + + // operator watch + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "customizationSetup.operatorWatch"); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Operator"]["OperatorWatch"]); + } + // start of weapon customization + for (int i = 0; i < 10; ++i) { + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.name", i); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetString(&state, &context, inventoryJson["Loadouts"][i]["name"].get().c_str()); + } + for (int j = 0; j < 2; ++j) { + // set camo + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.camo", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetEnum(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["camo"].get().c_str()); + } + // set weapon + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.weapon", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetEnum(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["weapon"].get().c_str()); + } + // set variantid + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.variantID", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["variantId"]); + } + // set lootItemId + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.lootItemID", i, j); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["lootItemID"]); + } + for (int k = 0; k < 5; ++k) { + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.attachmentSetup.%d.attachment", i, j, k); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetEnum(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["attachments"][k][0].get().c_str()); + } + + DDL_GetRootState(&state, ddlDef); + sprintf_s(buffer, "squadMembers.loadouts.%d.weaponSetups.%d.attachmentSetup.%d.variantID", i, j, k); + Com_ParseNavStrings(buffer, (const char**)navStrings, 32, &navStringCount); + if (DDL_MoveToPath(&state, &state, navStringCount, (const char**)navStrings)) + { + DDL_SetInt(&state, &context, inventoryJson["Loadouts"][i]["weaponSetup"][j]["attachments"][k][1]); + } + } + } + } + + } + else { + Com_SetErrorMessage("[DLL ERROR] Couldn't get DDLBuffer, called before initialized?"); + } + printf("Loaded Inventory!\n"); + } + else { + // Com_SetErrorMessage("[DLL ERROR] Attempted to load inventory from \"players/inventory.json\" but file does not exist. Use 'saveinv' to save your inventory."); + printf("Attempted to load inventory from \"players/inventory.json\" but file does not exist\n"); + } +} + +utils::hook::detour cl_keys_event; +void CL_Keys_Event_Detour(int localClientNum, int key, bool down, unsigned int time, int virtualKey, int controllerIndex) +{ + auto Con_ToggleConsole = reinterpret_cast(0x1415B18C0_g); + auto Con_ToggleConsoleOutput = reinterpret_cast(0x1415B1930_g); + auto DevGui_Toggle = reinterpret_cast(0x1417E9DA0_g); + auto Con_IsActive = reinterpret_cast(0x1415b0EF0_g); + + if (down) + { + switch (key) + { + case K_GRAVE: + + if (GetAsyncKeyState(VK_SHIFT) & 0x8000) + { + if (Con_IsActive(localClientNum) == false) + { + Con_ToggleConsole(); + } + Con_ToggleConsoleOutput(); + } + else + { + Con_ToggleConsole(); + } + return; + break; + case K_F1: + DevGui_Toggle(); + return; + break; + } + } + + cl_keys_event.stub(localClientNum, key, down, time, virtualKey, controllerIndex); +} + +utils::hook::detour PM_WeaponUseAmmo; +void PM_WeaponUseAmmo_Detour(__int64 playerstate, Weapon* weapon, char a3, int a4, int hand) +{ + bool sv_cheats = Dvar_GetBoolSafe("NTPNRQTKNP"); + + if (!(player_sustainammo->current.enabled && sv_cheats)) + { + PM_WeaponUseAmmo.stub(playerstate, weapon, a3, a4, hand); + } +} + +utils::hook::detour dvar_registerbool; +dvar_t* Dvar_RegisterBool_Detour(const char* dvarName, bool value, unsigned int flags, const char* description) { + if (strcmp(dvarName, "LSTQOKLTRN") == 0) { + nlog("dvar registered!\n"); + value = true; + } + if (strcmp(dvarName, "MPSSOTQQPM") == 0) { + nlog("dvar registered!\n"); + value = true; + } + dvar_t* ret = dvar_registerbool.stub(dvarName, value, flags, description); + return ret; +} + +utils::hook::detour dvar_registerstring; +dvar_t* Dvar_RegisterString_Detour(const char* dvarName, const char* value, unsigned int flags, const char* description) { + return dvar_registerstring.stub(dvarName, value, flags, description); +} + +void GamerProfile_SetDataByName(unsigned int controllerIndex, const char* settingName, float settingValue) { + auto func = reinterpret_cast(0x1415D8BD0_g); + return func(controllerIndex, settingName, settingValue); +} + +utils::hook::detour seh_stringed_getstring; +const char* SEH_StringEd_GetString_Detour(const char* pszReference) { + const char* ret = seh_stringed_getstring.stub(pszReference); + + if (!pszReference[1]) + { + if ((*pszReference & 0x80) != 0) + return "t"; + return pszReference; + } + + GamerProfile_SetDataByName(0, "acceptedEULA", 1); + GamerProfile_SetDataByName(0, "hasEverPlayed_MainMenu", 1); + + if (strstr(pszReference, "LUA_MENU/MAPNAME_ANIYAH") || + strstr(pszReference, "LUA_MENU/MAPNAME_DEADZONE") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_CAGE") || + strstr(pszReference, "LUA_MENU/MAPNAME_CAVE_AM") || + strstr(pszReference, "LUA_MENU/MAPNAME_CAVE") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_CARGO") || + strstr(pszReference, "LUA_MENU/MAPNAME_CRASH2") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_OVERUNDER") || + strstr(pszReference, "LUA_MENU/MAPNAME_EUPHRATES") || + strstr(pszReference, "LUA_MENU/MAPNAME_RAID") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_SHOWERS") || + strstr(pszReference, "LUA_MENU/MAPNAME_RUNNER_AM") || + strstr(pszReference, "LUA_MENU/MAPNAME_RUNNER") || + strstr(pszReference, "LUA_MENU/MAPNAME_HACKNEY_AM") || + strstr(pszReference, "LUA_MENU/MAPNAME_HACKNEY_YARD") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_HILL") || + strstr(pszReference, "LUA_MENU/MAPNAME_PICCADILLY") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_PINE") || + strstr(pszReference, "LUA_MENU/MAPNAME_SPEAR_AM") || + strstr(pszReference, "LUA_MENU/MAPNAME_SPEAR") || + strstr(pszReference, "LUA_MENU/MAPNAME_PETROGRAD") || + strstr(pszReference, "LUA_MENU/MAPNAME_M_STACK") || + strstr(pszReference, "LUA_MENU/MAPNAME_VACANT")) { + return "^1no work"; + } + + if (strstr(pszReference, "MENU/CAMPAIGN")) + { + return "^3Campaign is not available in this build of the game."; + } + + if (strstr(pszReference, "LUA_MENU/LOCAL_COOP_DESC")) + { + return "^3CO-OP is not available in this build of the game."; + } + + if (strstr(pszReference, "LUA_MENU/LOCAL_MULTIPLAYER_CAPS")) + { + return "MULTIPLAYER"; + } + + if (strstr(pszReference, "MENU_SP/CAMPAIGN")) + { + return "^1CAMPAIGN"; + } + + if (strstr(pszReference, "LUA_MENU/LOCAL_COOP_CAPS")) + { + return "^1LOCAL CO-OP"; + } + + return ret; +} + +char buffer[0x5000]; + +utils::hook::detour db_loadxfile; +int DB_LoadXFile_Detour(const char* zoneName, uintptr_t zoneMem, uintptr_t assetList, int zoneFlags, bool wasPaused, int failureMode, uintptr_t outSignature) { + return db_loadxfile.stub(zoneName, zoneMem, assetList, zoneFlags, wasPaused, failureMode, outSignature); +} + +utils::hook::detour CL_TransientsMP_ProcessLoadingQueue; +char CL_TransientsMP_ProcessLoadingQueue_Detour() { + return CL_TransientsMP_ProcessLoadingQueue.stub(); +} + +utils::hook::detour partyhost_startprivateparty; +void PartyHost_StartPrivateParty_Detour(int localClientNum, int localControllerIndex, bool currentlyActive, int hostType) { + Cbuf_AddText("exec autoexec.cfg"); + + partyhost_startprivateparty.stub(localClientNum, localControllerIndex, currentlyActive, hostType); + + LoadInventory(); +} + +bool Live_IsUserSignedInToDemonware_Detour() { + return true; +} + +int dwGetLogOnStatus_Detour() { + return 2; +} + +int LiveStorage_GetActiveStatsSource_Detour() { + return 1; +} + +void set_byte_f() { + char command[500]; + if (Cmd_Argc() == 3) { + Cmd_ArgvBuffer(1, command, 500); + uintptr_t address = atoll(command) + base; + Cmd_ArgvBuffer(2, command, 500); + utils::hook::set(address, atoi(command)); + } +} + +void set_short_f() { + char command[500]; + if (Cmd_Argc() == 3) { + Cmd_ArgvBuffer(1, command, 500); + uintptr_t address = atoll(command) + base; + Cmd_ArgvBuffer(2, command, 500); + utils::hook::set(address, atol(command)); + } +} + +void set_int_f() { + char command[500]; + if (Cmd_Argc() == 3) { + Cmd_ArgvBuffer(1, command, 500); + uintptr_t address = atoll(command) + base; + Cmd_ArgvBuffer(2, command, 500); + utils::hook::set(address, _atoi64(command)); + } +} + +void set_float_f() +{ + char command[500]; + if (Cmd_Argc() == 3) { + Cmd_ArgvBuffer(1, command, 500); + uintptr_t address = atoll(command) + base; + Cmd_ArgvBuffer(2, command, 500); + utils::hook::set(address, strToFloat(command)); + } +} + +void set_pointer_f() { + char command[500]; + if (Cmd_Argc() == 3) { + Cmd_ArgvBuffer(1, command, 500); + uintptr_t address = atoll(command) + base; + Cmd_ArgvBuffer(2, command, 500); + utils::hook::set(address, _atoi64(command)); + } +} + +void Cmd_Quit_f() { + ExitProcess(0x1); +} + +void Cmd_OpenMenu_f() { + char command[500]; + if (Cmd_Argc() == 2) { + auto LUI_OpenMenu = reinterpret_cast(0x141B9BDB0_g); + Cmd_ArgvBuffer(1, command, 500); + LUI_OpenMenu(0, command, true, false, false); + } +} + +short* SV_ClientMP_AddTestClient() +{ + uintptr_t SV_ClientMP_AddTestClient_func_address = 0x14136e570_g; + short* (__cdecl * SV_ClientMP_AddTestClient_func)(void) = (short* (__cdecl*)(void))SV_ClientMP_AddTestClient_func_address; + + return SV_ClientMP_AddTestClient_func(); +} + +void GScr_AddEntity(short* entity) +{ + auto GScr_AddEntity_func = reinterpret_cast(0x1412578a0_g); + GScr_AddEntity_func(entity); +} + +void SV_ClientMP_SpawnBotOrTestClient(short* entity) +{ + auto SV_ClientMP_SpawnBotOrTestClient_func = reinterpret_cast(0x141373640_g); + SV_ClientMP_SpawnBotOrTestClient_func(entity); +} + +void Cmd_AddBot_f() +{ + auto ent = SV_ClientMP_AddTestClient(); + GScr_AddEntity(ent); + SV_ClientMP_SpawnBotOrTestClient(ent); +} + +void SV_CmdsMP_MapRestart_f() +{ + auto SV_CmdsMP_RequestMapRestart = reinterpret_cast(0x14136C310_g); + SV_CmdsMP_RequestMapRestart(1, 0); +} + +void SV_CmdsMP_FastRestart_f() +{ + auto SV_CmdsMP_RequestMapRestart = reinterpret_cast(0x14136C310_g); + auto CL_Screen_Update = reinterpret_cast(0x1415caa50_g); + SV_CmdsMP_RequestMapRestart(0, 0); + // CL_Screen_Update(); +} + +OmnvarDef* BG_Omnvar_GetDef(unsigned int index) +{ + auto BG_Omnvar_GetDef_func = reinterpret_cast(0x140CD5830_g); + return BG_Omnvar_GetDef_func(index); + + /*OmnvarDef* OmnvarDefs = (OmnvarDef*)(0x145C48580_g); + return OmnvarDefs + index;*/ +} + +uintptr_t G_GetEntityPlayerState(gentity_s* ent) +{ + uintptr_t cl = ent->client; + + // return &cl->ps; + return cl; // client + 0x0 = playerstate +} + +int G_Main_GetTime() +{ + return *(int*)0x14BC21730; +} + +int BG_Omnvar_GetType(OmnvarDef* ovDef) +{ + const char* type = (const char*)((char*)ovDef + 0x26); + return *type; +} + +void Cmd_Omnvar_Set_f() +{ + char ovName[100]; + char newValue[100]; + + auto BG_Omnvar_GetIndexByName = reinterpret_cast(0x140CD5870_g); + auto BG_Omnvar_GetDef = reinterpret_cast(0x140CD5830_g); + auto G_Omnvar_GetData = reinterpret_cast(0x140FC5110_g); + auto BG_Omnvar_GetTypeString = reinterpret_cast(0x140CD5900_g); + auto G_Omnvar_MarkChanged = reinterpret_cast(0x140FC51B0_g); + auto NetConstStrings_GetLuiStringIndex = reinterpret_cast(0x1410F0F40_g); + + g_entities = *reinterpret_cast(0x14BC20F00_g); + + if (Cmd_Argc() != 3) + { + printf("setOmnvar usage: setOmnvar \n"); + return; + } + + Cmd_ArgvBuffer(1, ovName, 100); + Cmd_ArgvBuffer(2, newValue, 100); + + unsigned int omnvarIndex = BG_Omnvar_GetIndexByName(ovName); + if (omnvarIndex == -1) + { + printf("Omnvar %s not found\n", ovName); + return; + } + OmnvarDef* ovDef = BG_Omnvar_GetDef(omnvarIndex); + uintptr_t psHost = ((uintptr_t)(g_entities + 0x150)); + OmnvarData* data = G_Omnvar_GetData(omnvarIndex, 0, psHost); + const char* typeStr = BG_Omnvar_GetTypeString(ovDef); + int type = BG_Omnvar_GetType(ovDef); + + if (type == OMNVAR_TYPE_BOOL) + { + char num = *newValue; + if (num == '0' || num == '1') + { + (data->current).enabled = num == '1'; + G_Omnvar_MarkChanged(data); + } + } + else if (type == OMNVAR_TYPE_FLOAT) + { + float value = strToFloat(newValue); + (data->current).value = value; + G_Omnvar_MarkChanged(data); + } + else if (type == OMNVAR_TYPE_INT) + { + int value = atoi(newValue); + (data->current).integer = value; + G_Omnvar_MarkChanged(data); + } + else if (type == OMNVAR_TYPE_UINT) + { + int value = atoi(newValue); + if ((ovDef->maxvalue > value) && (value > ovDef->minvalue)) + { + (data->current).unsignedInteger = value; + G_Omnvar_MarkChanged(data); + } + } + else if (type == OMNVAR_TYPE_TIME) + { + int value = atoi(newValue); + if (value < 0) + { + printf("Expected positive value for time omnvar %s\n", ovDef->name); + return; + } + (data->current).integer = value; + G_Omnvar_MarkChanged(data); + } + else if (type == OMNVAR_TYPE_NCS_LUI) + { + int ret = NetConstStrings_GetLuiStringIndex(newValue, &(data->current).ncsString); + if (ret == NULL) + { + printf("Invalid value '%s' for omnvar '%s'.\n", newValue, ovDef->name); + } + else + { + G_Omnvar_MarkChanged(data); + } + } +} + +void Cmd_Omnvars_Dump_f() +{ + DumpOmnvars(); +} + +void Cmd_DDLDump_f() { + int cur = 0; + DDLFile* g_assets = *(DDLFile**)(0x14B8F5C48_g); + if (g_assets[cur].name) { + while (g_assets[cur].name != 0 && g_assets[cur].ddlDef != 0) { + nlog("%s\n", g_assets[cur].name); + for (int istruct = 0; istruct < g_assets[cur].ddlDef->structCount; istruct++) { + nlog("struct %s { //count: %i\n", g_assets[cur].ddlDef->structList[istruct].name, g_assets[cur].ddlDef->structList[istruct].memberCount); + for (int imember = 0; imember < g_assets[cur].ddlDef->structList[istruct].memberCount; imember++) { + if (g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize == 1) { + switch (g_assets[cur].ddlDef->structList[istruct].members[imember].type) { + case DDL_STRING_TYPE: nlog("\tconst char* %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_FIXEDPOINT_TYPE: + case DDL_FLOAT_TYPE: nlog("\tfloat %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_BYTE_TYPE: nlog("\tbyte %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_SHORT_TYPE: nlog("\tshort %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_INT_TYPE: nlog("\tint %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_UINT_TYPE: nlog("\tuint %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_PAD_TYPE: nlog("\tchar %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_HASH_TYPE: nlog("\thash %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_UINT64_TYPE: nlog("\tuint64_t %s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_ENUM_TYPE: nlog("\t%s %s;\n", g_assets[cur].ddlDef->enumList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + case DDL_STRUCT_TYPE: nlog("\t%s %s;\n", g_assets[cur].ddlDef->structList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + default:nlog("\t%s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + } + } + else { + switch (g_assets[cur].ddlDef->structList[istruct].members[imember].type) { + case DDL_FIXEDPOINT_TYPE: + case DDL_FLOAT_TYPE: nlog("\tfloat %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_STRING_TYPE: nlog("\tconst char* %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_BYTE_TYPE: nlog("\tbyte %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_SHORT_TYPE: nlog("\tshort %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_INT_TYPE: nlog("\tint %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_UINT_TYPE: nlog("\tuint %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_PAD_TYPE: nlog("\tchar %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_HASH_TYPE: nlog("\thash %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_ENUM_TYPE: nlog("\t%s %s[%i];\n", g_assets[cur].ddlDef->enumList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_UINT64_TYPE: nlog("\tuint64_t %s[%i];\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + case DDL_STRUCT_TYPE: nlog("\t%s %s[%i];\n", g_assets[cur].ddlDef->structList[g_assets[cur].ddlDef->structList[istruct].members[imember].externalIndex].name, g_assets[cur].ddlDef->structList[istruct].members[imember].name, g_assets[cur].ddlDef->structList[istruct].members[imember].arraySize); break; + default:nlog("\t%s;\n", g_assets[cur].ddlDef->structList[istruct].members[imember].name); break; + } + } + } + nlog("}\n"); + } + for (int ienum = 0; ienum < g_assets[cur].ddlDef->enumCount; ienum++) { + nlog("enum %s { //count: %i\n", g_assets[cur].ddlDef->enumList[ienum].name, g_assets[cur].ddlDef->enumList[ienum].memberCount); + for (int imember = 0; imember < g_assets[cur].ddlDef->enumList[ienum].memberCount; imember++) { + nlog("\t%s,\n", g_assets[cur].ddlDef->enumList[ienum].members[imember]); + } + nlog("}\n\n\n\n"); + } + cur++; + } + } +} + +void Cmd_WeaponDefDump_f() { + //Globals + uintptr_t* bg_weaponCompleteDefs = reinterpret_cast(0x14C6EC870_g); + + nlog("DUMPING WEAPON DEFINITIONS!!! --- \n"); + + for (int i = 0; i < 550; i++) { + WeaponCompleteDef* weap = reinterpret_cast(bg_weaponCompleteDefs[i]); + + if (!weap) continue; + nlog("szInternalName: %s\n", weap->szInternalName); + nlog("szDisplayName: %s\n", weap->szDisplayName); + } + + nlog("FINISHED WEAPON DEFINITION DUMP YAY!!! --- \n"); +} + +void Cmd_ViewVehicleEnts_f() { + auto SL_ConvertToString = reinterpret_cast(0x14131AA20_g); + for (int i = 0; i < 1024; i++) { + int classname = g_entities[i].get(0x17C); + if (classname) { + const char* s_classname = SL_ConvertToString(classname); + if (g_entities[i].get(0x160)) { + nlog("vehicle %s\n", s_classname); + } + } + } +} + +void Cmd_LoadoutSave_f() { + SaveInventory(); +} +int LuaShared_LuaCall_IsDemoBuild_Detour(uintptr_t luaVM) { + lua_pushboolean(luaVM, 1); + return 1; +} + +utils::hook::detour dvar_findvarbyname; +dvar_t* Dvar_FindVarByName_Detour(const char* dvarName) { + dvar_t* ret = dvar_findvarbyname.stub(dvarName); + return ret; +} + +utils::hook::detour db_findxassetheader; +XAssetHeader DB_FindXAssetHeader_Detour(XAssetType type, const char* givenName, int allowCreateDefault) +{ + XAssetHeader temp = db_findxassetheader.stub(type, givenName, allowCreateDefault); + + //if (type == ASSET_TYPE_XMODEL) { + // if (strcmp(temp.model->name, "head_mp_western_ghost_1_1") == 0) { + // return db_findxassetheader.stub(type, "head_opforce_juggernaut", allowCreateDefault); + // } + // if (strcmp(temp.model->name, "mp_western_vm_arms_ghost_1_1") == 0) { + // return db_findxassetheader.stub(type, "viewhands_opforce_juggernaut", allowCreateDefault); + // } + // if (strcmp(temp.model->name, "body_mp_western_ghost_1_1_lod1") == 0) { + // return db_findxassetheader.stub(type, "body_opforce_juggernaut_mp_lod1", allowCreateDefault); + // } + // if (strcmp(temp.model->name, "military_carepackage_01_friendly") == 0) { + // return db_findxassetheader.stub(type, "opforce_juggernaut_prop_static", allowCreateDefault); + // } + // if (strstr(temp.model->name, "veh8_mil_air_")) { + // return db_findxassetheader.stub(type, "veh8_mil_air_acharlie130", allowCreateDefault); + // } + //} + + return temp; +} + +utils::hook::detour db_getrawbufferinflate; +const char* DB_GetRawBufferInflate_Detour(const char* file, char* buffer, int length) { + char path[MAX_PATH + 1]; + memset(path, 0, MAX_PATH + 1); + std::string filecontents; + std::string curline; + snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), file); + if (file_exists(path)) { + printf("replacing file %s\n", file); + std::ifstream myfile; + myfile.open(path); + filecontents = ""; + while (myfile) { + std::getline(myfile, curline); + filecontents += curline + "\n"; + } + myfile.close(); + strcpy(buffer, filecontents.c_str()); + return filecontents.c_str();; + } + printf("loading %s\n", file); + return db_getrawbufferinflate.stub(file, buffer, length); +} + +const char* _va(const char* format, ...) { + char _buf[2048]; + va_list ap; + + va_start(ap, format); + vsnprintf(_buf, 2048, format, ap); + _buf[2047] = 0; + return _buf; +} +SpawnPointEntityRecord* g_customSpawns; +char g_customEntityString[0xFFFFFFF]; +utils::hook::detour load_mapentsasset; +void Load_MapEntsAsset_Detour(XAssetHeader* mapEnts) { + auto Scr_AllocGlobalString = reinterpret_cast(0x14131B2C0_g); + char path[MAX_PATH + 1]; + snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), mapEnts->image->name); + if (file_exists(path)) { + printf("loading %s\n", path); + HANDLE mapEntsFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + int numberOfBytesRead = GetFileSize(mapEntsFile, NULL); + if (mapEntsFile != INVALID_HANDLE_VALUE) + { + memset(g_customEntityString, 0, 0xFFFFFFF); + ReadFile(mapEntsFile, g_customEntityString, numberOfBytesRead, (LPDWORD)&numberOfBytesRead, 0); + mapEnts->mapEnts->entityString = g_customEntityString; + mapEnts->mapEnts->numEntityChars = strlen(g_customEntityString) + 1; + CloseHandle(mapEntsFile); + memset(path, 0, MAX_PATH + 1); + snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s.spawnlist", Dvar_GetStringSafe("LOOQOTRNTN"), mapEnts->image->name); + if (!file_exists(path)) { + } + else { + nlohmann::json json; + std::ifstream file(path); + file >> json; + file.close(); + mapEnts->mapEnts->spawnList.spawnsCount = json["spawnList"]["spawnsCount"]; + for (int i = 0; i < mapEnts->mapEnts->spawnList.spawnsCount; i++) { + mapEnts->mapEnts->spawnList.spawns[i].index = json["spawnList"][_va("spawns[%i]", i)]["index"]; + mapEnts->mapEnts->spawnList.spawns[i].name = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["name"]).c_str()); + mapEnts->mapEnts->spawnList.spawns[i].target = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["target"]).c_str()); + mapEnts->mapEnts->spawnList.spawns[i].script_noteworthy = Scr_AllocGlobalString(std::string(json["spawnList"][_va("spawns[%i]", i)]["script_noteworthy"]).c_str()); + + mapEnts->mapEnts->spawnList.spawns[i].origin.v[0] = json["spawnList"][_va("spawns[%i]", i)]["origin"][0]; + mapEnts->mapEnts->spawnList.spawns[i].origin.v[1] = json["spawnList"][_va("spawns[%i]", i)]["origin"][1]; + mapEnts->mapEnts->spawnList.spawns[i].origin.v[2] = json["spawnList"][_va("spawns[%i]", i)]["origin"][2]; + + mapEnts->mapEnts->spawnList.spawns[i].angles.v[0] = json["spawnList"][_va("spawns[%i]", i)]["angles"][0]; + mapEnts->mapEnts->spawnList.spawns[i].angles.v[1] = json["spawnList"][_va("spawns[%i]", i)]["angles"][1]; + mapEnts->mapEnts->spawnList.spawns[i].angles.v[2] = json["spawnList"][_va("spawns[%i]", i)]["angles"][2]; + } + } + } + } + + printf("%s\n", mapEnts->mapEnts->clientTrigger.triggerString); + + load_mapentsasset.stub(mapEnts); +} + +utils::hook::detour load_clipmapasset; +void Load_ClipMapAsset_Detour(XAssetHeader* clipMap) { + load_clipmapasset.stub(clipMap); +} +char g_customBuffer[0x18000]; +utils::hook::detour db_getrawbuffer; +void DB_GetRawBuffer_Detour(const RawFile* rawfile, char* buf, int size) { + char path[MAX_PATH + 1]; + snprintf(path, MAX_PATH + 1, "%s\\players\\raw\\%s", Dvar_GetStringSafe("LOOQOTRNTN"), rawfile->name); + if (file_exists(path)) { + HANDLE mapEntsFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + int numberOfBytesRead = GetFileSize(mapEntsFile, NULL); + if (mapEntsFile != INVALID_HANDLE_VALUE) + { + ReadFile(mapEntsFile, g_customBuffer, numberOfBytesRead, (LPDWORD)&numberOfBytesRead, 0); + CloseHandle(mapEntsFile); + strcpy(buf, g_customBuffer); + printf("replacing %s\n", rawfile->name); + } + return; + } + + db_getrawbuffer.stub(rawfile, buf, size); +} + +utils::hook::detour db_pollfastfilestate; +int DB_PollFastfileState_Detour(const char* zoneName) { + if (strcmp(zoneName, "mp_donetsk_cg_ls_tr") == 0) { + return 2; + } + + //printf("%s\n", zoneName); + + return db_pollfastfilestate.stub(zoneName); +} + +utils::hook::detour load_xmodelasset; +void Load_XModelAsset_Detour(XAssetHeader* model) { + load_xmodelasset.stub(model); +} + +utils::hook::detour ddl_setuint; +bool DDL_SetUInt_Detour(const DDLState* state, DDLContext* ddlContext, unsigned int val) { + //ddlContext->obfuscated = false; + //printf("%p - %p\n", state->offset, (uintptr_t)(ddlContext->buff) + state->offset); + + return ddl_setuint.stub(state, ddlContext, val); +} + +utils::hook::detour com_gamemode_supportsfeature; +bool Com_GameMode_SupportsFeature_Detour(unsigned int featureID) +{ + if (featureID == 70) // TIMESCALE_TWEAKING + { + return true; + } + + if (featureID == 33) // GRAVITY_CHANGE_ALLOWED + { + return true; + } + + return com_gamemode_supportsfeature.stub(featureID); +} + +utils::hook::detour sv_updateuserinfo_detour; +void SV_UpdateUserinfo_f(unsigned char* cl) +{ + auto SV_Cmd_Argv = reinterpret_cast(0x141298B10_g); + auto Info_ValueForKey = reinterpret_cast(0x1413F2A10_g); + // more checks can be added here (it's patched in current mw19, vanguard, and mwii, could probably find the actual fix there) + if (!strlen(Info_ValueForKey(SV_Cmd_Argv(1), "platform"))) + { + return; + } + sv_updateuserinfo_detour.stub(cl); +} + +utils::hook::detour lui_cod_luacall_getblueprintdata_impl; +int LUI_CoD_LuaCall_GetBlueprintData_impl_Detour(uintptr_t luaState) +{ + SaveInventory(); + return 0; +} + +void* exception_handler_handle; +BOOL WINAPI DllMain(HMODULE hModule, DWORD Reason, LPVOID lpVoid) { + g_Addrs.ModuleBase = (uintptr_t)(GetModuleHandle(0)); + utils::hook::set(0x1403061A0_g, 0xC3); // Mystery function 1 + if (Reason == DLL_PROCESS_ATTACH) { + AllocConsole(); + FILE* Dummy; + freopen_s(&Dummy, "CONOUT$", "w", stdout); + freopen_s(&Dummy, "CONIN$", "r", stdin); + + utils::nt::library game{}; + utils::nt::library user32("user32.dll"); + utils::nt::library ntdll("ntdll.dll"); + utils::nt::library kernel32("kernel32.dll"); + + va = (const char* (*)(const char*, ...))0x1413F3010_g; //j_va + + nlog("Base Address: %p\n", base); + + cmd_args = (CmdArgs*)(0x14D20CBD0_g); + + //utils::hook::jump(0x141BD3360_g, sub_141BD3360_Detour); + + //sub_141BD3360.create(0x141BD3360_g, sub_141BD3360_Detour); + + // utils::hook::copy(0x1530AD525_g, data_buf, 0x12856B); // Splash screen data + + Cmd_AddCommandInternal("set_byte", set_byte_f, &set_byte_f_VAR); + Cmd_AddCommandInternal("set_short", set_short_f, &set_short_f_VAR); + Cmd_AddCommandInternal("set_int", set_int_f, &set_int_f_VAR); + Cmd_AddCommandInternal("set_float", set_float_f, &set_float_f_VAR); + Cmd_AddCommandInternal("set_pointer", set_pointer_f, &set_pointer_f_VAR); + Cmd_AddCommandInternal("quit", Cmd_Quit_f, &quit_f_VAR); + Cmd_AddCommandInternal("openmenu", Cmd_OpenMenu_f, &openmenu_f_VAR); + Cmd_AddCommandInternal("addbot", Cmd_AddBot_f, &addbot_f_VAR); + Cmd_AddCommandInternal("ddldump", Cmd_DDLDump_f, &ddldump_f_VAR); + Cmd_AddCommandInternal("weapondefdump", Cmd_WeaponDefDump_f, &weapondefdump_f_VAR); + //Cmd_AddCommandInternal("view_vehicle_ents", Cmd_ViewVehicleEnts_f, &view_vehicle_ents_f_VAR); + // Cmd_AddCommandInternal("save_inventory", Cmd_LoadoutSave_f, &loadout_save_f_VAR); + Cmd_AddCommandInternal("map_restart", SV_CmdsMP_MapRestart_f, &MapRestart_f_VAR); + Cmd_AddCommandInternal("fast_restart", SV_CmdsMP_FastRestart_f, &FastRestart_f_VAR); + Cmd_AddCommandInternal("setOmnvar", Cmd_Omnvar_Set_f, &omnvar_set_f_VAR); + // Cmd_AddCommandInternal("dumpomnvars", Cmd_Omnvars_Dump_f, &omnvar_dump_f_VAR); + + // patch ui_maxclients limit + utils::hook::nop(0x140F30210_g, 5); + utils::hook::nop(0x14119E51D_g, 5); + utils::hook::nop(0x14136B8F8_g, 5); + utils::hook::nop(0x1416029F0_g, 5); + utils::hook::nop(0x1419E19A3_g, 5); + + // patch party_maxplayers limit + utils::hook::nop(0x140F252EE_g, 5); + utils::hook::nop(0x14119D23F_g, 5); + utils::hook::nop(0x1410769B9_g, 5); + utils::hook::set(0x1410769B9_g, 0xC3); + utils::hook::nop(0x140F24B4B_g, 5); + utils::hook::set(0x140F24B4B_g, 0xC3); + utils::hook::nop(0x1416029E2_g, 5); + utils::hook::nop(0x14119E52B_g, 5); + utils::hook::nop(0x140f252EE_g, 5); + utils::hook::nop(0x14119F13A_g, 5); + utils::hook::nop(0x1410D32E2_g, 5); + + // patch userinfo crash exploit + // utils::hook::nop(0x14136D0EA_g, 5); + sv_updateuserinfo_detour.create(0x14136d0c0_g, SV_UpdateUserinfo_f); + + db_findxassetheader.create(0x1411AA890_g, DB_FindXAssetHeader_Detour); + db_getrawbufferinflate.create(0x1412C2AE0_g, DB_GetRawBufferInflate_Detour); + ddl_setuint.create(0x1420529C0_g, DDL_SetUInt_Detour); + //db_pollfastfilestate.create(0x1411ADD00_g, DB_PollFastfileState_Detour); + + load_mapentsasset.create(0x140F61690_g, Load_MapEntsAsset_Detour); + load_clipmapasset.create(0x140F60F40_g, Load_ClipMapAsset_Detour); + load_xmodelasset.create(0x140F62290_g, Load_XModelAsset_Detour); + //load_ttfasset.create(0x140F61F40_g, Load_TTFAsset_Detour); + + db_getrawbuffer.create(0x1412C29A0_g, DB_GetRawBuffer_Detour); + + utils::hook::jump(0x141528490_g, Live_IsUserSignedInToDemonware_Detour); + utils::hook::jump(0x1417EC930_g, dwGetLogOnStatus_Detour); + utils::hook::jump(0x1412A1EB0_g, LiveStorage_GetActiveStatsSource_Detour); + utils::hook::jump(0x1419B96A0_g, LuaShared_LuaCall_IsDemoBuild_Detour); + + dvar_findvarbyname.create(0x1413E63A0_g, Dvar_FindVarByName_Detour); + + db_loadxfile.create(0x1411A79F0_g, DB_LoadXFile_Detour); + CL_TransientsMP_ProcessLoadingQueue.create(0x1415F7BF0_g, CL_TransientsMP_ProcessLoadingQueue_Detour); + + lui_cod_registerdvars.create(0x1419D4500_g, LUI_CoD_RegisterDvars_Detour); + net_outofbanddata.create(0x1412BB350_g, NET_OutOfBandData_Detour); + cl_keys_event.create(0x1415BEB80_g, CL_Keys_Event_Detour); + dvar_registerbool.create(0x1413E7670_g, Dvar_RegisterBool_Detour); + dvar_registerstring.create(0x1413E7A70_g, Dvar_RegisterString_Detour); + seh_stringed_getstring.create(0x1413CC2A0_g, SEH_StringEd_GetString_Detour); + + cl_createdevgui.create(0x1415B2080_g, CL_CreateDevGui_Detour); + partyhost_startprivateparty.create(0x14119F0D0_g, PartyHost_StartPrivateParty_Detour); + + PM_WeaponUseAmmo.create(0x141155AF0_g, PM_WeaponUseAmmo_Detour); + + com_gamemode_supportsfeature.create(0x1410C8980_g, Com_GameMode_SupportsFeature_Detour); + + lui_cod_luacall_getblueprintdata_impl.create(0x140F58A00_g, LUI_CoD_LuaCall_GetBlueprintData_impl_Detour); + + clientUIActives = (clientUIActive_t*)(0x14EEF1280_g); + + // removes "Services aren't ready yet." print + utils::hook::nop(0x141504374_g, 5); + + // enable tweaking of jump_slowdownEnable dvar + utils::hook::nop(0x1411014F5_g, 2); + utils::hook::nop(0x141101B12_g, 2); + utils::hook::nop(0x141101C6C_g, 2); + utils::hook::nop(0x141101D3C_g, 2); + utils::hook::nop(0x141101EE5_g, 2); + + // fixes lost connection issue? + utils::hook::nop(0x14165E97E_g, 5); + utils::hook::nop(0x14165E660_g, 5); + utils::hook::nop(0x141665289_g, 5); + utils::hook::nop(0x14166567D_g, 5); + } + + return TRUE; +} + +void nlog(const char* str, ...) { + va_list ap; + HWND notepad, edit; + char buf[256]; + + va_start(ap, str); + vsprintf(buf, str, ap); + va_end(ap); + strcat(buf, ""); + log(buf); +} +void nlog(const char* file, const char* str, ...) { + va_list ap; + HWND notepad, edit; + char buf[256]; + + va_start(ap, str); + vsprintf(buf, str, ap); + va_end(ap); + strcat(buf, ""); + log(file, buf); +} + +uintptr_t find_pattern(const char* module_name, const char* pattern) { + const auto get_module_size = [=](uintptr_t module_base) + { + return reinterpret_cast(module_base + reinterpret_cast(module_base)->e_lfanew)->OptionalHeader.SizeOfImage; + }; + const auto module_start = (uintptr_t)GetModuleHandle(module_name); + if (module_start != 0ULL) + { + const auto module_end = module_start + get_module_size(module_start); + + const char* pattern_current = pattern; + uintptr_t current_match = NULL; + + MEMORY_BASIC_INFORMATION64 page_information = {}; + for (auto current_page = reinterpret_cast(module_start); current_page < reinterpret_cast(module_end); current_page = reinterpret_cast(page_information.BaseAddress + page_information.RegionSize)) + { + VirtualQuery(reinterpret_cast(current_page), reinterpret_cast(&page_information), sizeof(MEMORY_BASIC_INFORMATION)); + if (page_information.Protect == PAGE_NOACCESS) + continue; + + if (page_information.State != MEM_COMMIT) + continue; + + if (page_information.Protect & PAGE_GUARD) + continue; + + for (auto current_address = reinterpret_cast(page_information.BaseAddress); current_address < reinterpret_cast(page_information.BaseAddress + page_information.RegionSize - 0x8); current_address++) + { + if (*current_address != GET_BYTE(pattern_current) && *pattern_current != '\?') { + current_match = 0ULL; + pattern_current = pattern; + continue; + } + + if (!current_match) + current_match = reinterpret_cast(current_address); + + pattern_current += 3; + if (pattern_current[-1] == NULL) + return current_match; + } + } + } + + return 0ULL; +} + +uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pattern) { + const auto get_module_size = [=](uintptr_t module_base) + { + return reinterpret_cast(module_base + reinterpret_cast(module_base)->e_lfanew)->OptionalHeader.SizeOfImage; + }; + const auto module_start = start; + if (module_start != 0ULL) + { + const auto module_end = module_start + get_module_size(module_start); + + const char* pattern_current = pattern; + uintptr_t current_match = NULL; + + MEMORY_BASIC_INFORMATION64 page_information = {}; + for (auto current_page = reinterpret_cast(module_start); current_page < reinterpret_cast(module_end); current_page = reinterpret_cast(page_information.BaseAddress + page_information.RegionSize)) + { + VirtualQuery(reinterpret_cast(current_page), reinterpret_cast(&page_information), sizeof(MEMORY_BASIC_INFORMATION)); + if (page_information.Protect == PAGE_NOACCESS) + continue; + + if (page_information.State != MEM_COMMIT) + continue; + + if (page_information.Protect & PAGE_GUARD) + continue; + + for (auto current_address = reinterpret_cast(page_information.BaseAddress); current_address < reinterpret_cast(page_information.BaseAddress + page_information.RegionSize - 0x8); current_address++) + { + if (*current_address != GET_BYTE(pattern_current) && *pattern_current != '\?') { + current_match = 0ULL; + pattern_current = pattern; + continue; + } + + if (!current_match) + current_match = reinterpret_cast(current_address); + + pattern_current += 3; + if (pattern_current[-1] == NULL) + return current_match; + } + } + } + + return 0ULL; +} +menu_variables vars; + +size_t operator"" _b(const size_t val) +{ + return base + val; +} + +size_t reverse_b(const size_t val) +{ + return val - base; +} + +size_t reverse_b(const void* val) +{ + return reverse_b(reinterpret_cast(val)); +} + +size_t operator"" _g(const size_t val) +{ + return base + (val - 0x140000000); +} + +size_t reverse_g(const size_t val) +{ + return (val - base) + 0x140000000; +} + +size_t reverse_g(const void* val) +{ + return reverse_g(reinterpret_cast(val)); +} + +void log(const char* str) { + std::ofstream outputFile("output.log", std::ios::app); + if (outputFile.is_open()) { + outputFile << str; + outputFile.close(); + } + else { + std::cout << "Failed to open file for appending." << std::endl; + } +} + +void log(const char* file, const char* str) { + try { + std::ofstream outputFile(file, std::ios::app); + if (!outputFile.is_open()) { + throw std::runtime_error("Failed to open file for appending."); + } + + outputFile << str; + } + catch (const std::exception& e) { + printf("%s\n", e.what()); + } } \ No newline at end of file diff --git a/hook_lib/Main.hpp b/hook_lib/Main.hpp index 0d1193e..7e9cfe5 100644 --- a/hook_lib/Main.hpp +++ b/hook_lib/Main.hpp @@ -1,117 +1,117 @@ -#pragma once -#include -#include -#include -#include -#include - -#include -#include -#include - -#pragma comment(lib, "ws2_32.lib") -#pragma comment(lib, "user32.lib") - -#include "common/utils/hook.hpp" -#include "common/utils/hardware_breakpoint.hpp" -#include "functions.hpp" -#include "structs.h" -#include "assets.h" - -#include "ini.h" -#include "json.hpp" -#include "splashscreen.hpp" - -extern void* exception_handler; - -#define base g_Addrs.ModuleBase - -#pragma warning(disable:4996) -#pragma comment(lib, "Gdi32.lib") - - - - -#define INRANGE(x, a, b) (x >= a && x <= b) -#define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0)) -#define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1])) - -struct menu_variables { - bool bInitiateMenu; - bool bMenuOpen; - -}; -extern menu_variables vars; - -void nlog(const char* str, ...); -uintptr_t find_pattern(const char* module_name, const char* pattern); -uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pattern); - -size_t operator"" _b(size_t val); -size_t reverse_b(size_t val); -size_t reverse_b(const void* val); - -size_t operator"" _g(size_t val); -size_t reverse_g(size_t val); -size_t reverse_g(const void* val); - -void log(const char* str); -void log(const char* file, const char* str); - -struct DvarPair -{ - const char* m_key; - const char* m_value; -}; -inline bool IsBadPointer(uintptr_t* ptr) -{ - __try - { - volatile auto result = *ptr; - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - return true; - } - return false; -} - -struct DvarMap -{ - DvarPair m_pairs[10000]; -}; -extern int g_dvarmapcount; -extern DvarPair g_dvarmap[6821]; - -struct shaderOverride_t -{ - float scrollRateX; - float scrollRateY; - float scrollRateR; - float tilingX; - float tilingY; - float rotation; - float alpha; - float emissive; - float atlasTime; -}; - -struct GfxSceneHudOutlineInfo -{ - unsigned int color; - float scopeStencil; - bool drawOccludedPixels; - bool drawNonOccludedPixels; - bool fill; - bool useAlternateColor; - bool forSpectator; - bool specialActive; - unsigned __int8 renderMode; - unsigned __int8 lineWidth; - unsigned __int8 temperatureSet; - unsigned int mapEntLookup; - float temperatureBase; - float temperatureScale; - float characterEVOffset; -}; - +#pragma once +#include +#include +#include +#include +#include + +#include +#include +#include + +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "user32.lib") + +#include "common/utils/hook.hpp" +#include "common/utils/hardware_breakpoint.hpp" +#include "functions.hpp" +#include "structs.h" +#include "assets.h" + +#include "ini.h" +#include "json.hpp" +#include "splashscreen.hpp" + +extern void* exception_handler; + +#define base g_Addrs.ModuleBase + +#pragma warning(disable:4996) +#pragma comment(lib, "Gdi32.lib") + + + + +#define INRANGE(x, a, b) (x >= a && x <= b) +#define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0)) +#define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1])) + +struct menu_variables { + bool bInitiateMenu; + bool bMenuOpen; + +}; +extern menu_variables vars; + +void nlog(const char* str, ...); +uintptr_t find_pattern(const char* module_name, const char* pattern); +uintptr_t find_pattern(uintptr_t start, const char* module_name, const char* pattern); + +size_t operator"" _b(size_t val); +size_t reverse_b(size_t val); +size_t reverse_b(const void* val); + +size_t operator"" _g(size_t val); +size_t reverse_g(size_t val); +size_t reverse_g(const void* val); + +void log(const char* str); +void log(const char* file, const char* str); + +struct DvarPair +{ + const char* m_key; + const char* m_value; +}; +inline bool IsBadPointer(uintptr_t* ptr) +{ + __try + { + volatile auto result = *ptr; + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + return true; + } + return false; +} + +struct DvarMap +{ + DvarPair m_pairs[10000]; +}; +extern int g_dvarmapcount; +extern DvarPair g_dvarmap[6821]; + +struct shaderOverride_t +{ + float scrollRateX; + float scrollRateY; + float scrollRateR; + float tilingX; + float tilingY; + float rotation; + float alpha; + float emissive; + float atlasTime; +}; + +struct GfxSceneHudOutlineInfo +{ + unsigned int color; + float scopeStencil; + bool drawOccludedPixels; + bool drawNonOccludedPixels; + bool fill; + bool useAlternateColor; + bool forSpectator; + bool specialActive; + unsigned __int8 renderMode; + unsigned __int8 lineWidth; + unsigned __int8 temperatureSet; + unsigned int mapEntLookup; + float temperatureBase; + float temperatureScale; + float characterEVOffset; +}; + diff --git a/hook_lib/assets.cpp b/hook_lib/assets.cpp index 0f8d2df..7d08aa2 100644 --- a/hook_lib/assets.cpp +++ b/hook_lib/assets.cpp @@ -1,6 +1,6 @@ -#include "assets.h" - - -void test() { - sizeof(VehicleDef); +#include "assets.h" + + +void test() { + sizeof(VehicleDef); } \ No newline at end of file diff --git a/hook_lib/assets.h b/hook_lib/assets.h index 6d77034..1aee26e 100644 --- a/hook_lib/assets.h +++ b/hook_lib/assets.h @@ -1,4383 +1,4383 @@ -#pragma once -#include "Main.hpp" - -struct RumbleGraph; -struct RumbleInfo; -struct CameraDef; -struct GfxImage; -struct Material; -struct Bounds; -struct FxCombinedDef; - -struct vec2_t -{ - float v[2]; -}; - -struct vec3_t -{ - float v[3]; -}; - -struct vec4_t -{ - float v[4]; -}; - -typedef int scr_string_t; - -struct Bounds -{ - vec3_t midPoint; - vec3_t halfSize; -}; - -struct GfxDrawSurfFields -{ - unsigned __int64 indirectArgsOffset : 10; - unsigned __int64 gpBatchIndex : 16; - unsigned __int64 objectId : 24; - unsigned __int64 hasGfxEntIndex : 1; - unsigned __int64 lightmapIndex : 9; - unsigned __int64 shadowcaster : 1; - unsigned __int64 materialSortedIndex : 16; - unsigned __int64 tessellation : 3; - unsigned __int64 prepass : 2; - unsigned __int64 viewModelRender : 1; - unsigned __int64 lowResShading : 1; - unsigned __int64 surfType : 4; - unsigned __int64 primarySortKey : 6; -}; - -struct EffectDefMap { - char name[64]; - char filename[256]; -}; - -struct Packed128 -{ - unsigned __int64 p0; - unsigned __int64 p1; -}; - -union GfxDrawSurf -{ - GfxDrawSurfFields fields; - Packed128 packed; -}; - -struct MaterialTextureDef -{ - unsigned __int8 index; - GfxImage* image; -}; - -struct MaterialConstantDef -{ - unsigned __int8 index; - vec4_t literal; -}; - -struct GfxDecalVolumeMaterial -{ - const char* name; - GfxImage* channels[6]; - unsigned int flags; - vec3_t colorTint; - float alphaDissolveParms; - float emissiveScale; - unsigned int packedDisplacementScaleAndBias; - float displacementCutoffDistance; - float displacementCutoffFalloff; - unsigned int packedTemperatureBaseAndScale; - unsigned __int8 textureAtlasRowCount; - unsigned __int8 textureAtlasColumnCount; - unsigned __int8 padding[6]; -}; - -struct PhysicsAssetUsageCounter -{ - int serverEnt; - int clientEnt; - int dynEnt; -}; - -struct __declspec(align(4)) PhysicsAsset -{ - const char* name; - char* havokData; - unsigned int havokDataSize; - int useCategory; - int numRigidBodies; - int numConstraints; - uintptr_t simulationCategories; - unsigned int* bodyContents; - int numSFXEventAssets; - int numVFXEventAssets; - uintptr_t sfxEventAssets; - uintptr_t vfxEventAssets; - PhysicsAssetUsageCounter usageCounter; - bool containsDynamicBodies; -}; - -struct Material -{ - const char* name; - unsigned int contents; - unsigned int surfaceFlags; - float maxDisplacement; - int /*MaterialGeometryType*/ materialType; - unsigned __int8 cameraRegion; - unsigned __int8 sortKey; - unsigned __int16 flags; - unsigned __int8 textureCount; - unsigned __int8 constantCount; - unsigned __int8 constantBufferCount; - unsigned __int8 layerCount; - unsigned __int16 packedAtlasDataSize; - unsigned __int8 textureAtlasRowCount; - unsigned __int8 textureAtlasColumnCount; - GfxDrawSurf drawSurf; - unsigned __int8* packedAtlasData; - void* /*MaterialTechniqueSet*/ techniqueSet; - MaterialTextureDef* textureTable; - MaterialConstantDef* constantTable; - GfxDecalVolumeMaterial* decalVolumeMaterial; - unsigned __int8* constantBufferIndex; - void* /*MaterialConstantBufferDef*/ constantBufferTable; - const char** subMaterials; -}; - -enum GfxTextureId : __int32 -{ - NULLID = 0x0, -}; - -enum GfxPixelFormat : __int32 -{ - GFX_PF_INVALID = 0x0, - GFX_PF_R8 = 0x1, - GFX_PF_A8 = 0x2, - GFX_PF_L8 = 0x3, - GFX_PF_R8G8 = 0x4, - GFX_PF_L8A8 = 0x5, - GFX_PF_R8G8B8A8 = 0x6, - GFX_PF_R8G8B8A8_SRGB = 0x7, - GFX_PF_R8_SNORM = 0x8, - GFX_PF_R8G8_SNORM = 0x9, - GFX_PF_R16 = 0xA, - GFX_PF_R16G16 = 0xB, - GFX_PF_R16G16B16A16 = 0xC, - GFX_PF_R16_SNORM = 0xD, - GFX_PF_R16F = 0xE, - GFX_PF_R16G16F = 0xF, - GFX_PF_R16G16B16A16F = 0x10, - GFX_PF_R32F = 0x11, - GFX_PF_R32G32F = 0x12, - GFX_PF_R32G32B32A32F = 0x13, - GFX_PF_D16 = 0x14, - GFX_PF_D32F = 0x15, - GFX_PF_D32F_S8 = 0x16, - GFX_PF_R8_UINT = 0x17, - GFX_PF_R16_UINT = 0x18, - GFX_PF_R32_UINT = 0x19, - GFX_PF_R32G32_UINT = 0x1A, - GFX_PF_R32G32B32A32_UINT = 0x1B, - GFX_PF_R10G10B10A2_UINT = 0x1C, - GFX_PF_R5G6B5 = 0x1D, - GFX_PF_R10G10B10A2 = 0x1E, - GFX_PF_R9G9B9E5_SHAREDEXP = 0x1F, - GFX_PF_R11G11B10F = 0x20, - GFX_PF_BC1 = 0x21, - GFX_PF_BC1_SRGB = 0x22, - GFX_PF_BC2 = 0x23, - GFX_PF_BC2_SRGB = 0x24, - GFX_PF_BC3 = 0x25, - GFX_PF_BC3_SRGB = 0x26, - GFX_PF_BC4 = 0x27, - GFX_PF_BC5 = 0x28, - GFX_PF_BC5S = 0x29, - GFX_PF_BC6H = 0x2A, - GFX_PF_BC6HS = 0x2B, - GFX_PF_BC7 = 0x2C, - GFX_PF_BC7_SRGB = 0x2D, - GFX_PF_R8G8B8A8_SNORM = 0x2E, - GFX_PF_R1 = 0x2F, - GFX_PF_R4G4 = 0x30, - GFX_PF_R10G10B10A2_SNORM = 0x31, - GFX_PF_COUNT = 0x32, -}; - -enum GfxImageFlags -{ - IMG_FLAG_NONE = 0x0, - IMG_DISK_FLAG_NOPICMIP = 0x1, - IMG_DISK_FLAG_NOMIPMAPS = 0x2, - IMG_DISK_FLAG_UNUSED = 0x4, - IMG_DISK_FLAG_NORMAL_OCCLUSON_GLOSS = 0x8, - IMG_DISK_FLAG_CLAMP_U = 0x10, - IMG_DISK_FLAG_CLAMP_V = 0x20, - IMG_DISK_FLAG_STREAMED = 0x40, - IMG_DISK_FLAG_USE_OODLE_COMPRESSION = 0x80, - IMG_DISK_FLAG_GAMMA_SRGB = 0x100, - IMG_DISK_FLAG_PACKED_ATLAS = 0x200, - IMG_CREATE_FLAG_UNTILED = 0x400, - IMG_CREATE_FLAG_CPU_READ = 0x800, - IMG_CREATE_FLAG_CPU_WRITE = 0x1000, - IMG_DISK_FLAG_AUTOMETALNESS = 0x2000, - IMG_DISK_FLAG_AUTODISPLACEMENT = 0x4000, - IMG_DISK_FLAG_MAPTYPE_2D = 0x0, - IMG_DISK_FLAG_MAPTYPE_CUBE = 0x8000, - IMG_DISK_FLAG_MAPTYPE_3D = 0x10000, - IMG_DISK_FLAG_MAPTYPE_1D = 0x18000, - IMG_DISK_FLAG_MAPTYPE_ARRAY = 0x20000, - IMG_DISK_FLAG_MAPTYPE_CUBE_ARRAY = 0x28000, - IMG_DISK_FLAG_INVERT_ALPHA = 0x40000, - IMG_DISK_FLAG_PREMUL_ALPHA = 0x80000, - IMG_DISK_FLAG_MIPGEN_ORIGINAL = 0x0, - IMG_DISK_FLAG_MIPGEN_LANCZOS3 = 0x100000, - IMG_DISK_FLAG_MIPGEN_CATMULL_ROM = 0x200000, - IMG_DISK_FLAG_MIPGEN_CUBIC_BSPLINE = 0x300000, - IMG_DISK_FLAG_MIPGEN_BOX = 0x400000, - IMG_DISK_FLAG_MIPGEN_COVERAGE_PRESERVING = 0x500000, - IMG_CREATE_FLAG_RW_VIEW = 0x800000, - IMG_CREATE_FLAG_DYNAMIC = 0x1000000, - IMG_DISK_FLAG_PREMUL_KEEP_ALPHA = 0x2000000, - IMG_DISK_FLAG_RTT = 0x4000000, - IMG_DISK_FLAG_EXTRACT_ALPHA = 0x8000000, - IMG_DISK_FLAG_OCTAHEDRON = 0x10000000, - IMG_CREATE_FLAG_STAGING = 0x20000000, - IMG_CREATE_FLAG_VOLUMETRIC_LAYOUT_OVERRIDE = 0x40000000, - IMG_CREATE_FLAG_TYPELESS = 0x80000000, -}; - -union GfxImageSemanticSpecific -{ - float atlasFps; - unsigned int albedoMapScaleBias; - unsigned int normalMapScaleBias; - unsigned int maxMipMap; -}; - -struct GfxImageAtlasSize -{ - unsigned __int8 rowCount; - unsigned __int8 colCount; -}; - -union GfxImageAtlasInfo -{ - GfxImageAtlasSize atlasSize; - unsigned __int16 packedAtlasDataSize; -}; - -enum TextureSemantic : __int8 -{ - TS_2D = 0x0, - TS_FUNCTION = 0x1, - TS_COLOR_MAP = 0x2, - TS_GRAY_MAP = 0x3, - TS_SIGNED_VELOCITY_MAP = 0x4, - TS_NORMAL_MAP = 0x5, - TS_METALNESS_MAP = 0x6, - TS_NORMAL_OCCLUSION_GLOSS_MAP = 0x7, - TS_SIGNED_DISTANCE_FIELD = 0x8, - TS_CARD_IMPOSTER_NORMAL = 0x9, - TS_COUNT = 0xA, -}; - -enum GfxImageCategory : __int8 -{ - IMG_CATEGORY_UNKNOWN = 0x0, - IMG_CATEGORY_AUTO_GENERATED = 0x1, - IMG_CATEGORY_LIGHTMAP = 0x2, - IMG_CATEGORY_LOAD_FROM_FILE = 0x3, - IMG_CATEGORY_RAW = 0x4, - IMG_CATEGORY_FIRST_UNMANAGED = 0x5, - IMG_CATEGORY_RENDERTARGET = 0x5, - IMG_CATEGORY_TEMP = 0x6, -}; - -struct XPakEntryInfo -{ - unsigned __int64 key; - __int64 offset; - unsigned __int64 size; - unsigned __int64 xpakIndex : 8; - unsigned __int64 compressed : 1; - unsigned __int64 valid : 1; - unsigned __int64 adjacentLeftType : 3; - unsigned __int64 adjacentRightType : 3; - unsigned __int64 adjacentLeft : 19; - unsigned __int64 adjacentRight : 19; - unsigned __int64 padding : 10; -}; - -enum GfxImageStreamLevelCountAndSize : __int32 -{ -}; - -struct GfxImageStreamData -{ - XPakEntryInfo xpakEntry; - GfxImageStreamLevelCountAndSize levelCountAndSize; - unsigned __int16 width; - unsigned __int16 height; -}; - -struct streamer_handle_t -{ - unsigned __int64 data; -}; - -struct GfxImageFallback -{ - unsigned __int8* pixels; - unsigned int size; - unsigned __int16 width; - unsigned __int16 height; -}; - -union GfxImagePixels -{ - streamer_handle_t streamedDataHandle; - unsigned __int8* residentData; -}; - - -struct GfxImage -{ - const char* name; - unsigned __int8* packedAtlasData; - GfxTextureId textureId; - GfxPixelFormat format; - GfxImageFlags flags; - unsigned int totalSize; - GfxImageSemanticSpecific semanticSpecific; - unsigned __int16 width; - unsigned __int16 height; - unsigned __int16 depth; - unsigned __int16 numElements; - GfxImageAtlasInfo atlasInfo; - TextureSemantic semantic; - GfxImageCategory category; - unsigned __int8 levelCount; - unsigned __int8 streamedPartCount; - unsigned __int8 decalAtlasIndex; - char freqDomainMetricBias; - GfxImageStreamData streams[4]; - GfxImageFallback* fallback; - GfxImagePixels pixels; -}; - -struct AttachmentList -{ - unsigned int attachmentCount; - void** /*WeaponAttachment*/ attachments; -}; - -struct __declspec(align(4)) SceneZoomSettings -{ - int adsZoomCount; - float adsZoomFov[3]; - float adsReloadFov[3]; - int adsZoomFovTransitionTime[3]; - int /*AdsOffsetInterpolationType*/ adsZoomFovLerpType; - float adsZoomInFrac; - float adsZoomOutFrac; - float adsFOVNVG; - float adsReloadFovNVG; - bool adsZoomLevelIndexResetOnToggle; -}; - -struct __declspec(align(4)) WeaponZoomSettings -{ - float adsZoomFov; - int /*AdsOffsetInterpolationType*/ adsZoomFovLerpType; - float adsZoomFovXOffset; - float adsReloadZoomFov; - float adsReloadZoomFovXOffset; - float adsNVGZoomFov; - float adsNVGZoomFovXOffset; - float adsNVGReloadZoomFov; - float adsNVGReloadZoomFovXOffset; - float adsZoomInFrac; - float adsZoomOutFrac; - bool adsZoomFovXOffsetOverride; - bool adsReloadFovXOffsetOverride; -}; - -struct ZoomSettings -{ - SceneZoomSettings scene; - WeaponZoomSettings weapon; -}; - - -struct WeaponEntityNotify -{ - int flags; - float radius; - float height; - float minSpeed; -}; - - - -struct XModelPhysicsUsageCounter { - int serverEnt; - int clientEnt; - int dynEnt; -}; - -struct DObjAnimMat { - float quat[4]; - float trans[3]; - float transWeight; -}; - -struct XModel { - const char* name; - unsigned __int16 numsurfs; - unsigned __int8 numLods; - unsigned __int8 collLod; - unsigned __int16 mdaoVolumeCount; - unsigned __int8 shadowCutoffLod; - int physicsUseCategory; - char characterCollBoundsType; - unsigned __int8 numAimAssistBones; - unsigned __int8 impactType; - unsigned __int8 mdaoType; - unsigned __int8 numBones; - unsigned __int8 numRootBones; - unsigned __int16 numClientBones; - unsigned __int8 numClothAssets; - unsigned int flags; - int contents; - float scale; - float radius; - Bounds bounds; - float edgeLength; - unsigned int lgvData; - XModelPhysicsUsageCounter physicsUsageCounter; - unsigned int noScalePartBits[8]; - void* scriptableMoverDef; - void* proceduralBones; - void* dynamicBones; - scr_string_t* aimAssistBones; - scr_string_t* boneNames; - unsigned __int8* parentList; - __int16* quats; - float* trans; - unsigned __int8* partClassification; - DObjAnimMat* baseMat; - vec3_t* ikHingeAxis; - uintptr_t reactiveMotionInfo; - uintptr_t materialHandles; -}; - -struct WeaponAnimPackage -{ - const char* name; - uintptr_t anims; - uintptr_t timers; - int meleeAnimPrimaryType; - int meleeAnimPrimaryCount; - unsigned __int8 meleeAnimPrimarySet; - bool meleeRandomizeAnims; - int meleeAnimAltType; - int meleeAnimAltCount; - unsigned __int8 meleeAnimAltSet; - bool altMeleeRandomizeAnims; - uintptr_t blendSpaces; - uintptr_t footstep; -}; - -union XAnimIndices -{ - unsigned __int8* _1; - unsigned __int16* _2; - void* data; -}; - -struct XAnimParts -{ - const char* name; - scr_string_t* names; - unsigned __int8* dataByte; - __int16* dataShort; - int* dataInt; - __int16* randomDataShort; - unsigned __int8* randomDataByte; - int* randomDataInt; - XAnimIndices indices; - uintptr_t notify; - uintptr_t deltaPart; - unsigned int randomDataShortCount; - unsigned int randomDataByteCount; - unsigned int indexCount; - float framerate; - float frequency; - unsigned int dataByteCount; - unsigned __int16 dataShortCount; - unsigned __int16 dataIntCount; - unsigned __int16 randomDataIntCount; - unsigned __int16 numframes; - unsigned __int8 flags; - unsigned __int8 boneCount[10]; - unsigned __int8 notifyCount; - unsigned __int8 assetType; - unsigned __int8 ikType; - unsigned __int8 fingerPoseType; - unsigned __int16 blendShapeWeightCount; - scr_string_t* blendShapeWeightNames; - unsigned __int16* blendShapeWeights; -}; - -struct WeaponDamageCommon -{ - int minDamage; - int mid1Damage; - int mid2Damage; - int mid3Damage; - int damage; - float maxDamageRange; - float mid1DamageRange; - float mid2DamageRange; - float mid3DamageRange; - float minDamageRange; -}; - -struct WeaponDamageInfo -{ - WeaponDamageCommon damageData[3]; - int deathAnimDamageType; - float terminateAtRange; -}; - -struct WeaponVFXPackage -{ - const char* name; - uintptr_t vfx; -}; - -struct __declspec(align(4)) TriggerDisconnectSoundData -{ - float analogTriggerValue; - bool enabledForFireType[6]; -}; - -struct __declspec(align(8)) WeaponSFXPackage -{ - const char* name; - uintptr_t sounds; - WeaponSFXPackage* transientFallbackPackage; - uintptr_t detailSoundBankNPC; - uintptr_t detailSoundBankPlayer; - unsigned __int8 rattleSoundType; - const char* szAdsrBaseSetting; - const char* szWeapSndReflectionClass; - const char* szWeapSndReflFrontOverride; - const char* szWeapSndReflDistantOverride; - float weapSndFireVolumeShot1; - float weapSndFireVolumeShot2; - float weapSndFireVolumeShot3; - float weapSndProneFireLFEVolume; - float weapSndMediumRangeStart; - float weapSndFarRangeStart; - float weapSndDistantRangeStart; - unsigned int projExplosionReflClass; - int sfxImpactType; - int sfxMeleeImpactType; - int sfxMaterialType; - const char* szMountEnterExitString; - const char* szMountImpactString; - unsigned int whizbyType; - unsigned int adsContextType; - unsigned int adsContextValue; - float speedOfSoundMult; - TriggerDisconnectSoundData triggerDisconnectSoundData; -}; - -struct __declspec(align(8)) ADSOverlay -{ - Material* shaderMat; - Material* shaderLowResMat; - Material* shaderEMPMat; - Material* shaderEMPLowResMat; - GfxImage* shaderImg; - GfxImage* shaderLowResImg; - GfxImage* shaderEMPImg; - GfxImage* shaderEMPLowResImg; - bool applyVisionSet; - int reticle; - float width; - float height; - float widthSplitscreen; - float heightSplitscreen; - const char* visionSetName; - float visionSetADSFraction; - int visionSetBlendInTimeMs; - int visionSetBlendOutTimeMs; -}; - -struct CommonSwaySettings -{ - float maxAngle; - float lerpSpeed; - float pitchScale; - float yawScale; - float horizScale; - float vertScale; - float gunAngleScale; -}; - -struct HipSwaySettings -{ - CommonSwaySettings common; - float maxAngleSteadyAim; -}; - -struct AdsSwaySettings -{ - CommonSwaySettings common; - float swayTransitionLerpSpeed; - float adsSwayScale[3]; -}; - -struct AdvancedHipSwaySettings -{ - bool enabled; - float torsoGoalSmoothSpeed; - int torsoGoalViewSmoothDurationMs; - vec2_t torsoGoalDeadzoneAdjustSpeed; - RumbleGraph* torsoGoalViewSpeedToMaxDeadzone_graph; - vec2_t torsoGoalViewSpeedToMaxDeadzone_viewspeed; - vec2_t torsoGoalViewSpeedToMaxDeadzone_maxDeadzone; - vec2_t torsoMass; - vec2_t torsoSpring; - vec2_t torsoDamper; - int gunGoalViewSmoothDurationMs; - RumbleGraph* gunGoalViewSpeedToOffset_graph; - vec2_t gunGoalViewSpeedToOffset_viewspeed; - vec2_t gunGoalViewSpeedToOffset_offset; - vec2_t gunMass; - vec2_t gunSpring; - vec2_t gunDamper; - vec3_t gunPivotPoint; - float gunYawToRollScale; - int fireDurationMs; - int fireStartBlendDurationMs; - int fireFinishBlendDurationMs; - float fireTorsoGoalSmoothSpeed; - float fireTorsoDeadzoneScale; - float fireTorsoToGunDirScale; -}; - -struct __declspec(align(4)) SwaySettings -{ - HipSwaySettings hip; - AdsSwaySettings ads; - AdvancedHipSwaySettings adv; - float shellShockScale; - bool overrideHip; - bool overrideAds; -}; - -struct WeaponOffsetCurveDescription -{ - float blendTime; - float decayTime; - float shotDecayFireTimeFrac; - float holdTime; - float adsFractionBegin; - float adsFractionEnd; - int interpType; - int interpTypeOut; -}; - -struct WeaponOffsetPatternDescription -{ - bool active; - scr_string_t patternKey; - int curveType; - int patternType; - int transformType; - float frequency; - float blendTime; - vec3_t magnitude; - float hipScale; - float rotationOffset; - float bulletDirScale; - float fullAutoScale; - int fullAutoBullets; - float fullAutoDecay; - int referenceIndex; - int kickOrSnapDecayIndex; -}; - -struct __declspec(align(4)) GestureWeaponSettings -{ - unsigned __int16 blendToStates; - bool hideReticle; - float fireDelay; - float sprintDelay; - bool useLeftIdleAkimbo; - bool splitAnimsAkimbo; - bool blendToDemeanorLoop; - bool blendOutRaise; - bool blendOutFingerPose; - bool blendOutAdditiveADS; -}; - -struct __declspec(align(2)) GestureDirectionalSettings -{ - float maxAngle; - float lerpAtMaxAngle; - float widthCushionAngle; - float lerpAtMinCushionAngle; - float lerpAtMaxCushionAngle; - float limitLeft; - float limitRight; - float limitUp; - float limitDown; - bool useTargetOffset; - float targetOffsetX; - float targetOffsetY; - float targetOffsetZ; - float targetOffsetYaw; - float targetOffsetPitch; - float targetOffsetRoll; - bool ignoreViewPitchForTargetOffset; - bool ignoreViewYawForTargetOffset; - bool ignoreViewRollForTargetOffset; -}; - -struct __declspec(align(4)) FootstepTime -{ - float time; - bool isLeft; -}; - -struct __declspec(align(4)) MovementTime -{ - float time; - bool isLeadIn; -}; - -struct FootstepAnim -{ - int leftCount; - FootstepTime step[32]; - MovementTime movement[32]; -}; - -struct GestureLookAroundSettings -{ - float yawLerpIn; - float yawLerpOut; - unsigned __int16 walkTime; - FootstepAnim walkFootStepAnim; -}; - -struct GestureIKTargetSettings -{ - scr_string_t targetEntityBoneName; -}; - -struct __declspec(align(8)) Gesture -{ - const char* name; - int type; - int priority; - bool looping; - uintptr_t anims; - GestureWeaponSettings weaponSettings; - GestureDirectionalSettings directionalSettings; - GestureLookAroundSettings lookAroundSettings; - GestureIKTargetSettings ikTargetSettings; -}; - -struct LaserSettings -{ - bool forceLaserOn; - bool localPlayerADSLaserEnabled; - bool localPlayerHipLaserEnabled; - bool localPlayerNVGADSLaserEnabled; - bool localPlayerNVGHipLaserEnabled; - bool remotePlayerADSLaserEnabled; - bool remotePlayerHipLaserEnabled; - bool remotePlayerNVGADSLaserEnabled; - bool remotePlayerNVGHipLaserEnabled; - bool laserViewCenterInAds; -}; - -struct __declspec(align(4)) GrenadeRotationParams -{ - float initialPitch; - float initialYaw; - float initialRoll; - int rotationPitchDir; - int rotationPitchMin; - int rotationPitchMax; - int rotationYawDir; - int rotationYawMin; - int rotationYawMax; - int rotationRollDir; - int rotationRollMin; - int rotationRollMax; - bool rotate; -}; - -struct AnimOverride -{ - unsigned int numBindings; - uintptr_t bindings; - uintptr_t overrides; - uintptr_t overridesAlt; -}; - -struct CarryAnimOverride -{ - int carryObjectType; - WeaponAnimPackage* animPackage; - WeaponAnimPackage* animPackageAlt; -}; - -struct SFXOverride -{ - unsigned int numBindings; - uintptr_t bindings; - uintptr_t overrides; - uintptr_t overridesAlt; -}; - -struct VFXOverride -{ - unsigned int numBindings; - uintptr_t bindings; - uintptr_t overrides; - uintptr_t overridesAlt; -}; - -struct WeaponOffsetPatternScaleInfo -{ - int numPatternScales; - uintptr_t patternScales; -}; - -struct AdvancedIdleSettings -{ - bool useAdvancedIdleSettings; - bool useRandomPointsAlgorithm; - float breathGaspScaleOverride; - float idleSwaySetting1_HipBulletDirScale; - float idleSwaySetting1_HipIdleSpeed; - float idleSwaySetting1_HipWeaponMagnitudeX; - float idleSwaySetting1_HipWeaponMagnitudeY; - float idleSwaySetting1_HipWeaponMagnitudeZ; - float idleSwaySetting1_HipWeaponMagnitudeF; - float idleSwaySetting1_HipWeaponRotationOffset; - float idleSwaySetting1_HipViewMagnitudeX; - float idleSwaySetting1_HipViewMagnitudeY; - float idleSwaySetting1_AdsBulletDirScale; - float idleSwaySetting1_AdsIdleSpeed; - float idleSwaySetting1_AdsWeaponMagnitudeX; - float idleSwaySetting1_AdsWeaponMagnitudeY; - float idleSwaySetting1_AdsWeaponMagnitudeZ; - float idleSwaySetting1_AdsWeaponMagnitudeF; - float idleSwaySetting1_AdsWeaponRotationOffset; - float idleSwaySetting1_AdsViewMagnitudeX; - float idleSwaySetting1_AdsViewMagnitudeY; - float idleSwaySetting2_HipBulletDirScale; - float idleSwaySetting2_HipIdleSpeed; - float idleSwaySetting2_HipWeaponMagnitudeX; - float idleSwaySetting2_HipWeaponMagnitudeY; - float idleSwaySetting2_HipWeaponMagnitudeZ; - float idleSwaySetting2_HipWeaponMagnitudeF; - float idleSwaySetting2_HipWeaponRotationOffset; - float idleSwaySetting2_HipViewMagnitudeX; - float idleSwaySetting2_HipViewMagnitudeY; - float idleSwaySetting2_AdsBulletDirScale; - float idleSwaySetting2_AdsIdleSpeed; - float idleSwaySetting2_AdsWeaponMagnitudeX; - float idleSwaySetting2_AdsWeaponMagnitudeY; - float idleSwaySetting2_AdsWeaponMagnitudeZ; - float idleSwaySetting2_AdsWeaponMagnitudeF; - float idleSwaySetting2_AdsWeaponRotationOffset; - float idleSwaySetting2_AdsViewMagnitudeX; - float idleSwaySetting2_AdsViewMagnitudeY; -}; - -struct BallisticInfoCalculated -{ - float* distances; - float zeroingAngle; - int numDistanceEntries; -}; - -struct BallisticInfo -{ - float muzzleVelocity; - float ballisticCoefficient; - float diameter; - float mass; - float gravityFactor; - float zeroingDistance; - BallisticInfoCalculated* calculated; - bool enableBallisticTrajectory; - int lifeTimeMs; -}; - -struct FxCombinedDef -{ - const void* /*ParticleSystemDef*/ particleSystemDef; -}; - -struct TracerDef -{ - const char* name; - FxCombinedDef effect; - FxCombinedDef viewmodelEffect; - unsigned int drawInterval; - float speed; - bool drawLegacyTracer; - bool fadeOverTime; - float fadeTime; - Material* material; - float beamLength; - float beamWidth; - float screwRadius; - float screwDist; - vec4_t colors[5]; -}; - -struct LaserDef -{ - const char* name; - Material* laserMaterial; - Material* laserLightMaterial; - bool ownerOnly; - bool nightvisionOnly; - float range; - float radius; - float endOffsetViewmodel; - float endOffsetOther; - float flarePct; - FxCombinedDef beamEffect; - FxCombinedDef laserEndEffect; - bool clientCollision; - vec4_t color; - vec4_t hdrColorScale; - bool laserLight; - bool laserLightNvgOnly; - float laserLightRadius; - float laserLightBeginOffset; - float laserLightEndOffset; - float laserLightBodyTweak; - vec4_t laserLightColor; - vec4_t laserLightHdrColorScale; - float range_alt; - float radius_alt; - float laserLightRadius_alt; - float flarePct_alt; -}; - - -struct SurfaceFxTable -{ - const char* name; - void* /*SurfaceFxEntry*/ table; - int numTableEntry; - unsigned __int8* mapPoolBuffer; - int mapPoolBufferSize; -}; - -struct RawFile -{ - const char* name; - unsigned int compressedLen; - unsigned int len; - const char* buffer; -}; - -struct ScriptFile -{ - const char* name; - int compressedLen; - int len; - int bytecodeLen; - const char* buffer; - unsigned __int8* bytecode; -}; - -struct ScriptDebugData -{ - const char* name; - unsigned int nameCRC; - unsigned int profileStringCount; - void* /*ScriptDebugDataProfileString*/ profileStrings; -}; - -struct StringTable -{ - const char* name; - int columnCount; - int rowCount; - int uniqueCellCount; - unsigned __int16* cellIndices; - int* hashes; - const char** strings; -}; - -struct LeaderboardDef -{ - const char* name; - int id; - int sourceLbId; - int sourceLbWidth; - int columnCount; - int xpColId; - int prestigeColId; - void* /*LbColumnDef*/ columns; - int /*LbUpdateType*/ updateType; - int trackTypes; - int rankColIdX; - int rankColIdY; -}; - -struct __declspec(align(8)) VirtualLeaderboardDef -{ - const char* name; - const char* sourceName; - int id; - int sourceId; - void* /*LbVrColumnDef*/ columns; - int columnCount; - int rankColIdX; - int rankColIdY; -}; - -struct DDLFile -{ - char* name; - struct DDLDef* ddlDef; -}; - -struct SndAliasLookup -{ - const char* name; -}; - -struct __declspec(align(8)) VehiclePhysicsSoundGroup -{ - SndAliasLookup alias; - float threshold; - float vmin; - float vmax; - float pmin; - float pmax; -}; - -struct __declspec(align(8)) VehiclePhysicsVfxGroup -{ - void* /*FootstepVFX*/ surfaceEffects; - float threshold; - float range0; - float range1; -}; - - -struct VehiclePhysicsDef -{ - int physicsEnabled; - int /*VehiclePhysicsNetcodeType*/ physics_netcodeType; - char /*VehiclePhysicsGameProfile*/ physics_gameProfile; - int /*VehiclePhysicsAnimProfile*/ physics_animProfile; - int physics_numWheels; - bool physics_axleRigidBodies; - float physics_axleBodyPadding; - int physics_axleBodySides; - scr_string_t physics_wheelBones[12]; - float physics_wheelRadius; - float physics_suspStiffness; - float physics_suspDamping; - float physics_suspNoiseAmp; - float physics_frontalSuspension; - float physics_ackermannRatio; - vec3_t physics_hardPointOffset; - vec3_t physics_comOffset; - vec4_t physics_massFactorContact; - vec4_t physics_inertiaDiagonal; - float physics_extraGravityFactor; - float physics_extraGravityFactorAir; - float physics_camFovDelta; - float physics_camPitchBase; - float physics_camPitchDynamic; - float physics_camRangeAdd; - float physics_steeringFactor; - float physics_steeringForce; - float physics_steeringMaxYawSpeed; - float physics_steeringOffsetPoint; - float physics_steeringOffsetPointUp; - float physics_steeringReturnSpeed; - float physics_steeringChangeDirSpeed; - float physics_steeringHandbrake; - float physics_steeringSpeed; - float physics_steeringSpeedIncrease; - float physics_engineOffsetPoint; - float physics_engineReductionOnHB; - float physics_rollingFriction; - float physics_lateralFriction; - float physics_frictionBase; - float physics_frictionRecoverSpeedTgt; - float physics_frictionFwRedirect; - float physics_frictionLost; - float physics_frictionHandbrake; - float physics_frictionSpeedToBlock; - float physics_decel; - float physics_minSpeed; - bool physics_stabilizeRoll; - bool physics_stabilizePitch; - bool physics_contentsAsMissile; - bool physics_pitchInversion; - unsigned int physics_controlMode; - float physics_timeAfterColl; - int physics_cycleCamButton; - int physics_boostButton; - float physics_boostSpeed; - float physics_rcpBoostAccel; - float physics_rcpBoostDecel; - bool physics_holdToBoost; - SndAliasLookup physics_rcpBoostSound; - vec3_t physics_rcpBoostShakeCam; - bool physics_rcpUseChangeDirLogic; - bool physics_rcpUseChangeDirLogicPitch; - bool physics_rcpUseRollForYawSpeed; - float physics_rcpOvershootProtection; - float physics_rcpPitchTurnSpeed; - float physics_rcpPitchChangeDirFactor; - float physics_rcpPitchLerpSpeed; - float physics_rcpPitchLerpSpeedChangeDir; - float physics_rcpPitchLerpSpeedReturning; - float physics_rcpPitchMaxAngle; - float physics_rcpYawTurnSpeed; - float physics_rcpYawChangeDirFactor; - float physics_rcpYawLerpSpeed; - float physics_rcpYawLerpSpeedChangeDir; - float physics_rcpYawLerpSpeedReturning; - float physics_rcpRollTurnSpeed; - float physics_rcpRollLerpSpeedSteering; - float physics_rcpRollLerpSpeedChangeDir; - float physics_rcpRollLerpSpeedReturning; - float physics_rcpRollMaxAngle; - float physics_rcpAccelGoingDown; - float physics_rcpDecelGoingUp; - float physics_rcpTraceAhead; - bool physics_rcpCam1stAttachToTagPlayer; - vec2_t physics_rcpCam1stNoiseScale; - float physics_rcpCam1stRollSpeed; - float physics_rcpCam1stRollPercentage; - float physics_comAdjustThreshold; - float physics_comAdjustVertDisp; - float physics_playersWeightFactor; - float physics_timeToAcceptInputOnStart; - float physics_viewDirectionHelp; - float physics_stabilizePitchSpeed; - float physics_stabilizeRollSpeed; - int /*VehicleWheelSpinBoneType*/ spinWheelBones; - float spinWheelAngleOffset; - int treads_enabled; - int treads_boneCount; - scr_string_t treads_firstBones[2]; - float frictionBraking; - float suspensionTravel; - float maxSteeringAngle; - float steeringLerp; - float minSteeringScale; - float minSteeringSpeed; - int disableWheelsTurning; - int disableWheelsSpinning; - float minimumWheelCastFraction; - float handbrakeThreshold; - float minimumJoltForNotify; - float pathConstraintStrengthFwd; - float pathConstraintStrengthSide; - float pathConstraintDampFwd; - float pathConstraintDampSide; - float crashPointOffsetFwd; - float crashPointOffsetUp; - float crashImpulseSide; - float crashImpulseUp; - float wreckedMassScale; - VehiclePhysicsSoundGroup sndImpactHard; - float sndImpactExp; - VehiclePhysicsSoundGroup sndImpactLight; - VehiclePhysicsSoundGroup sndDrivingFast; - VehiclePhysicsSoundGroup sndDrivingSlow; - VehiclePhysicsSoundGroup sndSuspension; - VehiclePhysicsSoundGroup sndBrakingHard; - VehiclePhysicsSoundGroup sndBrakingLight; - VehiclePhysicsSoundGroup sndDrifting; - VehiclePhysicsSoundGroup sndSkidding; - VehiclePhysicsSoundGroup sndDlc1; - VehiclePhysicsSoundGroup sndDlc2; - VehiclePhysicsSoundGroup sndDlc3; - VehiclePhysicsSoundGroup sndDlc4; - VehiclePhysicsVfxGroup vfxImpactHard; - VehiclePhysicsVfxGroup vfxImpactLight; - VehiclePhysicsVfxGroup vfxDrivingFast; - VehiclePhysicsVfxGroup vfxDrivingSlow; - VehiclePhysicsVfxGroup vfxBrakingHard; - VehiclePhysicsVfxGroup vfxBrakingLight; - VehiclePhysicsVfxGroup vfxDrifting; - VehiclePhysicsVfxGroup vfxSkidding; - VehiclePhysicsVfxGroup vfxDrivingFlatFast; - VehiclePhysicsVfxGroup vfxDrivingFlatSlow; - VehiclePhysicsVfxGroup vfxDlc3; - VehiclePhysicsVfxGroup vfxDlc4; -}; - -struct SpaceshipAnimParts -{ - void* /*XAnimParts*/ anim[2]; -}; - -struct VehiclePhysicsRevModifier -{ - float skidSndContrib; - float noiseAmpl; - float sinewaveFreq; - float sinewaveAmpl; - float rpmMax; - float rpmScale; - float rpmSpeedEmaSamples; - float inclinedThreshold; - int gearCount; - float inclContrib; - float maxSpinSpeedRPMFw; - float maxSpinSpeedRPMBw; -}; - -struct VehicleDef -{ - const char* name; - char type; - const char* useHintString; - int health; - int inputBindingSet; - int hitClientScriptables; - int hitRemoteControllers; - int accurateShapeOverlap; - int numDoors; - float maxDoorAngle; - scr_string_t doorBones[4]; - CameraDef* cameraDef; - CameraDef* killCamDef; - float texScrollScale; - float topSpeed; - float accel; - float rotRate; - float rotAccel; - float maxBodyPitch; - float maxBodyRoll; - float rangeForBoneControllers; - float fakeBodyAccelPitch; - float fakeBodyAccelRoll; - float fakeBodyVelPitch; - float fakeBodyVelRoll; - float fakeBodySideVelPitch; - float fakeBodyPitchStrength; - float fakeBodyRollStrength; - float fakeBodyPitchDampening; - float fakeBodyRollDampening; - float fakeBodyBoatRockingAmplitude; - float fakeBodyBoatRockingPeriod; - float fakeBodyBoatRockingRotationPeriod; - float fakeBodyBoatRockingFadeoutSpeed; - float boatBouncingMinForce; - float boatBouncingMaxForce; - float boatBouncingRate; - float boatBouncingFadeinSpeed; - float boatBouncingFadeoutSteeringAngle; - float collisionDamage; - float collisionSpeed; - bool collisionDamageIgnoresImpactAngle; - vec3_t killcamOffset; - int playerProtected; - int bulletDamage; - int armorPiercingDamage; - int grenadeDamage; - int projectileDamage; - int projectileSplashDamage; - int heavyExplosiveDamage; - VehiclePhysicsDef vehiclePhysicsDef; - int vehHelicopterLockAltitude; - int vehHelicopterOffsetFromMesh; - float vehHelicopterAltitudeOffset; - float vehHelicopterPitchOffset; - float vehHelicopterBoundsRadius; - float vehHelicopterMaxSpeed; - float vehHelicopterMaxSpeedVertical; - float vehHelicopterMaxAccel; - float vehHelicopterMaxAccelVertical; - float vehHelicopterDecelerationFwd; - float vehHelicopterDecelerationSide; - float vehHelicopterDecelerationUp; - float vehHelicopterMaxYawRate; - float vehHelicopterMaxYawAccel; - float vehHelicopterTiltFromVelocity; - float vehHelicopterTiltFromControllerAxes; - float vehHelicopterTiltFromAcceleration; - float vehHelicopterTiltFromDeceleration; - float vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt; - float vehHelicopterTiltFromFwdAndYaw; - float vehHelicopterTiltMomentum; - float vehHelicopterTiltSpeed; - float vehHelicopterMaxPitch; - float vehHelicopterMaxRoll; - float vehHelicopterHoverSpeedThreshold; - float vehHelicopterJitterJerkyness; - float vehHelicopterLookaheadTime; - int vehHelicopterSoftCollisions; - int vehHelicopterUseGroundFX; - FxCombinedDef vehHelicopterGroundFx; - FxCombinedDef vehHelicopterGroundWaterFx; - float vehHelicopterGroundFxDefaultRepeatRate; - float vehHelicopterGroundFxSlowestRepeatRate; - float vehHelicopterGroundFxFastestRepeatRate; - float vehHelicopterGroundFxMinGroundDist; - float vehHelicopterGroundFxMaxGroundDist; - float vehRotorMaxVelocity; - float vehRotorMaxAccel; - float vehRotorAccelTiltBlend; - float vehRotorMaxVehicleSpin; - float vehRotorMaxAngle; - float vehRotorSpinSpeed; - float vehRotorSpinVerticalSpeedThreshold; - float vehRotorMaxSpinAddition; - float ssWeaponSwitchDelaySeconds; - float ssWeaponRaiseDelaySeconds; - vec3_t ssFlyMaxSpeedMph; - vec3_t ssFlyMaxAccelerationMphps; - vec3_t ssFlyMaxCounterAccelerationMphps; - vec3_t ssFlyFrictionMphps; - vec3_t ssFlyJukeSpeedMph; - vec3_t ssHoverMaxSpeedMph; - vec3_t ssHoverMaxAccelerationMphps; - vec3_t ssHoverMaxCounterAccelerationMphps; - vec3_t ssHoverFrictionMphps; - vec3_t ssHoverJukeSpeedMph; - float ssFlyJukeRampTime; - float ssHoverJukeRampTime; - float ssBrakingFrictionMphps; - float ssFlyRedirectVelocityScale; - float ssFlySlowRedirectVelocityScale; - float ssHoverRedirectVelocityScale; - float ssFlyMinSpeedRatio; - bool ssProjectVelocityDesiresToXY; - bool ssEnforceMinGroundClearance; - float ssMinGroundClearanceHeight; - float ssMinGroundClearanceLiftForce; - bool ssTerrainModeMovement; - float ssTerrainModeGravity; - float ssTerrainModeFlyTime; - vec2_t ssAimOffsetClampDeg; - vec2_t ssPitchUpSoftLimitDeg; - vec2_t ssPitchDownSoftLimitDeg; - float ssClutchPitchSpeedScale; - vec2_t ssFlyAimSpeedDps; - vec2_t ssFlySlowAimSpeedDps; - vec2_t ssHoverAimSpeedDps; - vec2_t ssFlyAimDriftScale; - vec2_t ssFlySlowAimDriftScale; - vec2_t ssHoverAimDriftScale; - float ssMinSpringOscillation; - float ssMaxSpringOscillation; - float ssMinSpringStrength; - float ssMaxSpringStrength; - float ssMinSpringAngSpeed; - float ssMaxSpringAngSpeed; - float ssSpringControllerContribution; - float ssTiltSpringOscillation; - float ssTiltSpringStrength; - float ssTiltSpringAngleContribution; - int ssADSToLockOn; - float ssLockOnMinAngle; - float ssLockOnMaxAngle; - float ssPilotAssistNoLockAimScale; - float ssPilotAssistNoLockMinAngle; - float ssPilotAssistNoLockMaxAngle; - float ssPilotAssistAimScale; - float ssPilotAssistMinAngle; - float ssPilotAssistMaxAngle; - vec2_t ssAutoLevelStrengthHover; - vec2_t ssAutoLevelStrengthFly; - bool ssIsRollRightStick; - float ssRollMaxSpeedDps; - float ssBoostSpeedScale; - float ssBoostThrustScale; - bool ssEnableBoostToFly; - float ssBoostTime; - float ssBoostRegenTime; - float ssBoostRegenStallTime; - float ssBoostMinThresholdRatio; - float ssCollisionRadiusI; - float ssCylinderHeightI; - bool ssUseCylinder; - bool ssUsePlayerClip; - float ssCollisionOffsetI; - float ssCollisionHardThresholdMph; - float ssFOVFlyOffsetDeg; - float ssFOVFlyBoostOffsetDeg; - float ssFOVHoverOffsetDeg; - float ssZoomBlendSpeedDps; - float ssZoomMaxAngle; - float ssZoomMinDistI; - float ssZoomIdealDistI; - float ssZoomMaxDistI; - bool ssShowPilotViewmodel; - float ssCameraAnimScale; - vec2_t ssFlyTiltShipAngles; - float ssFlyTiltCameraScale; - vec2_t ssHoverTiltShipAngles; - float ssHoverTiltCameraScale; - float ssMotionIdleRateMinSpeed; - float ssMotionIdleRateMaxSpeed; - float ssMotionIdleMinRate; - float ssMotionIdleMaxRate; - scr_string_t ssAnimTree; - SpaceshipAnimParts ssAnimParts[33]; - FxCombinedDef ssThrustFxLoop; - FxCombinedDef ssJukeFx; - RumbleInfo* ssIdleRumble; - RumbleInfo* ssSmallRumble; - RumbleInfo* ssMedRumble; - RumbleInfo* ssLargeRumble; - SndAliasLookup rattleLoop; - float rattleLoopMinVolume; - float rattleLoopMaxVolume; - SndAliasLookup airLoop; - float airLoopMinVolume; - float airLoopMaxVolume; - SndAliasLookup engineLoop; - float engineLoopMinVolume; - float engineLoopMaxVolume; - float engineLoopMinPitch; - float engineLoopMaxPitch; - SndAliasLookup hoverLoop; - float hoverLoopMinVolume; - float hoverLoopMaxVolume; - float hoverLoopMinPitch; - float hoverLoopMaxPitch; - SndAliasLookup boostLoop; - float boostLoopMaxVolume; - float boostLoopMaxPitch; - SndAliasLookup ssThrustLoop; - float ssThrustLoopMaxVolume; - float ssThrustLoopMaxPitch; - SndAliasLookup boostStart; - SndAliasLookup boostStop; - SndAliasLookup boostDepleted; - SndAliasLookup boostUnavailable; - SndAliasLookup jukeLeft; - SndAliasLookup jukeRight; - SndAliasLookup jukeUpDown; - SndAliasLookup jukeBack; - SndAliasLookup jukeFront; - SndAliasLookup flightOn; - SndAliasLookup flightOff; - float flightOnTimer; - float flightOffTimer; - SndAliasLookup hardCollision; - SndAliasLookup softCollision; - int camLookEnabled; - int camRelativeControl; - int camRemoteDrive; - float camLerp; - float camHeight; - float camRadius; - float camPitchInfluence; - float camYawInfluence; - float camRollInfluence; - float camFovIncrease; - float camFovOffset; - float camFovSpeed; - float camReturnSpeed; - float camReturnLerp; - float camVehicleAnglePitchRate; - float camVehicleAngleYawRate; - float camVehicleAngleRollRate; - int vehCam_UseGDT; - float vehCam_anglesPitch; - float vehCam_anglesYaw; - float vehCam_anglesRoll; - float vehCam_offsetX; - float vehCam_offsetY; - float vehCam_offsetZ; - float vehCam_radius; - float vehCam_speedInfluence; - float vehCam_pitchTurnRate; - float vehCam_pitchClamp; - float vehCam_yawTurnRate; - float vehCam_yawClamp; - int /*VehCamZOffsetMode*/ vehCam_zOffsetMode; - float vehCam_anglesPitch3P; - float vehCam_anglesYaw3P; - float vehCam_anglesRoll3P; - float vehCam_offsetX3P; - float vehCam_offsetY3P; - float vehCam_offsetZ3P; - float vehCam_radius3P; - float vehCam_speedInfluence3P; - float vehCam_pitchTurnRate3P; - float vehCam_pitchClamp3P; - float vehCam_yawTurnRate3P; - float vehCam_yawClamp3P; - int /*VehCamZOffsetMode*/ vehCam_zOffsetMode3P; - const char* turretWeaponName; - void* /*WeaponCompleteDef*/ turretWeapon; - float turretHorizSpanLeft; - float turretHorizSpanRight; - float turretVertSpanUp; - float turretVertSpanDown; - float turretHorizResistLeft; - float turretHorizResistRight; - float turretVertResistUp; - float turretVertResistDown; - float turretRotRate; - int /*VehicleTurretFireType*/ turretFireType; - SndAliasLookup turretSpinSnd; - SndAliasLookup turretStopSnd; - int trophyEnabled; - float trophyRadius; - float trophyInactiveRadius; - int trophyAmmoCount; - float trophyReloadTime; - scr_string_t trophyTags[4]; - FxCombinedDef trophyExplodeFx; - FxCombinedDef trophyFlashFx; - Material* compassFriendlyIcon; - Material* compassEnemyIcon; - Material* compassFriendlyAltIcon; - Material* compassEnemyAltIcon; - int compassIconWidth; - int compassIconHeight; - void* /*SndBankTransient*/ detailSoundBankNPC; - void* /*SndBankTransient*/ detailSoundBankPlayer; - SndAliasLookup idleLowSnd; - SndAliasLookup idleHighSnd; - SndAliasLookup engineLowSnd; - SndAliasLookup engineHighSnd; - SndAliasLookup fallbackIdleLowSnd; - SndAliasLookup fallbackIdleHighSnd; - SndAliasLookup fallbackEngineLowSnd; - SndAliasLookup fallbackEngineHighSnd; - float engineSndSpeed; - scr_string_t audioOriginTag; - SndAliasLookup mainRotorLowRpmSnd; - SndAliasLookup mainRotorOperatingRpmSnd; - SndAliasLookup mainRotorOperatingEffortSnd; - SndAliasLookup tailRotorLowRpmSnd; - SndAliasLookup tailRotorOperatingRpmSnd; - SndAliasLookup tailRotorOperatingEffortSndLeft; - SndAliasLookup tailRotorOperatingEffortSndRight; - SndAliasLookup physicsHeliStartup; - SndAliasLookup physicsHeliShutdown; - SndAliasLookup turbineLowRpmSnd; - SndAliasLookup turbineOperatingRpmSnd; - bool useRevAudioSettings; - SndAliasLookup revLowFidelityMod; - SndAliasLookup revHighFidelityMod; - float revPlayerPriority; - VehiclePhysicsRevModifier revModifier; - SndAliasLookup engineStartUpSnd; - int engineStartUpLength; - SndAliasLookup engineShutdownSnd; - SndAliasLookup engineIdleSnd; - SndAliasLookup engineSustainSnd; - SndAliasLookup engineRampUpSnd; - int engineRampUpLength; - SndAliasLookup engineRampDownSnd; - int engineRampDownLength; - SndAliasLookup suspensionSoftSnd; - float suspensionSoftCompression; - SndAliasLookup suspensionHardSnd; - float suspensionHardCompression; - SndAliasLookup collisionSnd; - float collisionBlendSpeed; - SndAliasLookup speedSnd; - float speedSndBlendSpeed; - const char* surfaceSndName; - float surfaceSndBlendSpeed; - float slideVolume; - float slideBlendSpeed; - float inAirPitch; - const char* soundTriggerOverrideZone; - bool soundTriggerOverrideReverb; - bool soundTriggerOverrideMix; - bool soundTriggerOverrideFilter; - bool soundTriggerOverrideOcclusion; - bool soundTriggerOverrideAmbient; - bool soundTriggerOverrideAmbientEvents; - bool soundTriggerOverrideADSR; - int visionBlendTime; - const char* globalVisionSettings; - const char* mapVisionSettings; - const char* luiCrosshairWidget; - float dlcFloat[8]; -}; - -struct MapTriggers -{ - unsigned int count; - void* /*TriggerModel*/ models; - unsigned int hullCount; - void* /*TriggerHull*/ hulls; - unsigned int slabCount; - void* /*TriggerSlab*/ slabs; - unsigned int windingCount; - void* /*TriggerWinding*/ windings; - unsigned int windingPointCount; - void* /*TriggerWindingPoint*/ windingPoints; -}; - - -struct AddonMapEnts -{ - const char* name; - char* entityString; - int numEntityChars; - MapTriggers trigger; - unsigned int numSubModels; - void* /*cmodel_t*/ cmodels; - void* /*GfxBrushModel*/ models; -}; - -struct NetConstStrings -{ - const char* name; - int /*NetConstStringType*/ stringType; - int /*NetConstStringSource*/ sourceType; - unsigned int flags; - unsigned int entryCount; - const char** stringList; -}; - -struct LuaFile -{ - const char* name; - int len; - unsigned __int8 strippingType; - const unsigned __int8* buffer; -}; - - -struct __declspec(align(8)) ScriptableDef -{ - const char* name; - ScriptableDef* nextScriptableDef; - int flags; - unsigned int numParts; - void* /*ScriptablePartDef*/ parts; - unsigned int maxNumDynEntsRequired; - unsigned int partCount; - unsigned int serverInstancedPartCount; - unsigned int serverControlledPartCount; - unsigned int maxNumDynEntPartsBase; - unsigned int maxNumDynEntPartsForSpawning; - unsigned __int16 eventStreamSizeRequiredServer; - unsigned __int16 eventStreamSizeRequiredClient; - unsigned int usablePartCount; - unsigned int ffMemCost; - scr_string_t animationTreeName; - void* /*XAnim_s*/ animationTreeDef[2]; - float viewRadius; - bool networkLODRangeOverride; - float networkLODRangeOverrideDistance; - unsigned int numXModels; - XModel** models; - char /*DynEntitySpatialActivationMode*/ spatialActivationMode; -}; - -struct EquipSoundSetMoveTypes -{ - void* /*EquipmentSoundSet*/ soundSets; -}; - -struct EquipmentSoundSet -{ - void* /*SndAliasList*/ soundPLR; - void* /*SndAliasList*/ soundNPC; -}; - -struct EquipSoundSetMeleeWorld -{ - EquipmentSoundSet soundSets[8][3][2][4]; -}; - -struct EquipmentSoundTable -{ - const char* szName; - unsigned int numClothTypes; - unsigned int numWeaponRattleTypes; - unsigned int numMoveTypes; - unsigned int numStanceTypes; - void* /*EquipmentClothData*/ clothTypes; - void* /*EquipmentWeaponRattleData*/ weaponRattleTypes; - void* /*EquipmentChanceRattleTypes*/ chancesPLR; - void* /*EquipmentChanceRattleTypes*/ chancesNPC; - void* /*EquipSoundSetFootsteps*/ mvmtClothFootstepSoundSets; - void* /*EquipSoundSetFootsteps*/ mvmtClothFootstepCeilingSoundSets; - void* /*EquipSoundSetMoveLeadTypes*/ mvmtClothFoleySoundSets; - void* /*EquipSoundSetMoveTypes*/ mvmtRattleSoundSets; - EquipSoundSetMoveTypes mvmtAccentSoundSets; - void* /*EquipSoundSetMantleTypes*/ mvmtMantleSoundSets; - void* /*EquipSoundSetStanceTypes*/ mvmtStanceSoundSets; - void* /*EquipSoundSetMeleeVM*/ meleeAttackVMSoundSets; - void* /*EquipSoundSetMeleeWM*/ meleeAttackWMSoundSets; - void* /*EquipSoundSetMeleeWM*/ meleeCharacterSoundSets; - EquipSoundSetMeleeWorld meleeWorldSoundSets; -}; - -struct ExtentBounds -{ - vec3_t mins; - vec3_t maxs; -}; - -struct VectorField -{ - const char* name; - void* /*VectorSubField*/ subFields; - ExtentBounds worldBounds; - vec3_t localOrigin; - unsigned int numSubFields; - unsigned int pad[2]; -}; - -struct FxParticleSimAnimationHeader -{ - float playbackRate; - float duration; - unsigned int frameCount; - float minX; - float minY; - float minZ; - float boundsXDelta; - float boundsYDelta; - float boundsZDelta; - float maxWidth; - float maxHeight; - unsigned int colorTableSize; - unsigned int particleDataCount; - unsigned int maxActiveParticles; - bool evalVisStatePerParticle; - bool sortParticlesAtRuntime; - bool hasOrientation3D; - bool hasIndex; -}; - -struct FxParticleSimAnimation -{ - const char* name; - Material* material; - FxParticleSimAnimationHeader header; - void* /*FxParticleSimAnimationParticleData*/ particleData; - void* /*FxParticleSimAnimationParticleDataOrientation3D*/ particleDataOrientation3D; - void* /*FxParticleSimAnimationParticleDataIndex*/ particleDataIndex; - void* /*FxParticleSimAnimationFrame*/ frames; - vec4_t* colorTable; -}; - -struct StreamingInfo { - char __padding[0x48]; -}; - -struct TTFDef -{ - const char* name; - int fileLen; - const char* file; - void* ftFace; -}; - -struct SuitDef -{ - const char* name; - float cam_minVelocityForFovIncrease; - float cam_maxVelocityForFovIncrease; - float cam_velocityToDecreaseFov; - float cam_fovIncreaseAtMaxVelocity; - float cam_oneOverFovEaseInTimeMs; - float cam_oneOverFovEaseOutTimeMs; - CameraDef* cam_helmetCam; - bool cam_drawHelmet; - vec3_t cam_camtoHelmetOffsetOrigin; - vec3_t cam_camtoHelmetOffsetAngles; - bool enableIKOverride; - float player_globalAccelScale; - float player_crouchSpeedScale; - float player_proneSpeedScale; - float player_lastStandCrawlSpeedScale; - float player_sprintSpeedScale; - bool player_sprintUnlimited; - float player_viewBobScale; - bool jump_slowdownEnable; - float jump_height; - float sprintLeap_height; - float sprintLeap_forwardVelocityScale; - int sprintLeap_minSprintTimeMs; - float doubleJump_accel; - float doubleJump_speed; - float doubleJump_speedNoBoost; - float doubleJump_frictionMin; - float doubleJump_frictionMax; - float doubleJump_initialUpBoostAccel; - float doubleJump_standardUpBoostAccel; - float doubleJump_energyNeededForInitialUpBoost; - float doubleJump_energyNeededForStandardUpBoost; - float doubleJump_maxUpwardsVelocity; - bool doubleJump_enableMinZVelocity; - float doubleJump_minZVelocity; - float doubleJump_energyInitialCost; - float doubleJump_boostUpEnergyUseRate; - float doubleJump_energyUsePerButtonPress; - bool doubleJump_hoverOnly; - float doubleJump_maxViewPitchDip; - float doubleJump_maxViewBackwardsPitchDip; - float doubleJump_maxViewRoll; - float doubleJump_oneOverEaseInTime; - float doubleJump_oneOverEaseOutTimeMs; - bool doubleJump_alwaysDipView; - SndAliasLookup doubleJump_sound; - SndAliasLookup doubleJump_soundPlayer; - SndAliasLookup doubleJump_releaseSound; - SndAliasLookup doubleJump_releaseSoundPlayer; - float slide_strafe_speed_scale; - int slide_sprint_penalty_ms; - bool slide_allow_firing; - bool slide_allow_ads; - bool slide_allow_weapon_switch; - float slide_jump_speed_scale; - float slide_energy_cost_ratio; - int slide_max_time_ms; - int slide_max_time_reduced_ms; - int slide_max_time_base_ms; - int slide_inTimeMs; - float slide_inMaxSpeedScale; - float slide_inAcceleration; - float slide_frictionScaleNormal; - float slide_frictionScaleDownhill; - float slide_frictionScaleUphill; - float slide_frictionScaleBlocked; - int slide_gestureOutTimeForJumpMs; - int slide_sprintDelayMs; - bool slide_disableProneTransition; - int slide_proneDelayMs; - int slide_proneButtonCheckTimeMs; - int slide_outTimeMs; - float slide_outFrictionScaleStart; - float slide_outFrictionScaleFinish; - float slide_outSpeedScaleStart; - float slide_outSpeedScaleFinish; - int slide_inAirTimeMs; - float slide_inAirFrictionScaleStart; - float slide_inAirFrictionScaleFinish; - int slide_viewBlendInTimeMs; - int slide_viewBlendOutTimeMs; - float wallRun_minZVel; - float wallRun_minTriggerSpeed; - float wallRun_minMaintainSpeed; - int wallRun_delayPeriodMs; - float wallRun_minJumpHeight; - int wallRun_maxTimeMs; - int wallRun_fallStageTimeMs; - float wallRun_maxHeight; - float wallRun_jumpHeight; - float wallRun_jumpVelocity; - float wallRun_frictionScale; - float wallRun_speedScale; - float wallRun_speedScaleADS; - float wallRun_energyInitialCost; - float wallRun_energyChangePerSecond; - float ladder_anchorOffset; - float ladder_anchorOffsetWM; - float ladder_handDistance; - int /*SuitAnimType*/ suitAnimType; - bool isMovementCameraIndependent; - void* /*SuitAnimPackage*/ animPackage; - void* /*SuitAnimPackage*/ animPackageL; - void* /*SuitAnimPackage*/ animPackageR; - void* /*SuitAnimPackage*/ animPackageRelaxed; - void* /*SuitAnimPackage*/ animPackageSafe; - void* /*ASM*/ asmAsset; - void* /*Animset*/ animsetAsset; - unsigned __int8 facialAnimType; - int /*SuitBodyAnimType*/ bodyAnimType; - ScriptableDef* scriptableDef; - int viewheight_stand; - int viewheight_crouch; - int viewheight_prone; - int viewheight_laststand; - int viewheight_dead; - int viewheight_swim; - int viewheight_slide; - int viewheight_sprint; - int bounds_radius; - int bounds_height_stand; - int bounds_height_crouch; - int bounds_height_prone; - Bounds bounds_stand; - Bounds bounds_crouch; - Bounds bounds_prone; - int radialMotionBlur_interpTimeIn; - int radialMotionBlur_interpTimeOut; - float radialMotionBlur_sprintMinRadius; - float radialMotionBlur_sprintMaxRadius; - float radialMotionBlur_sprintMinStrength; - float radialMotionBlur_sprintMaxStrength; - float radialMotionBlur_slideMinRadius; - float radialMotionBlur_slideMaxRadius; - float radialMotionBlur_slideMinStrength; - float radialMotionBlur_slideMaxStrength; - float radialMotionBlur_doubleJumpMinRadius; - float radialMotionBlur_doubleJumpMaxRadius; - float radialMotionBlur_doubleJumpMinStrength; - float radialMotionBlur_doubleJumpMaxStrength; - float radialMotionBlur_wallRunMinRadius; - float radialMotionBlur_wallRunMaxRadius; - float radialMotionBlur_wallRunMinStrength; - float radialMotionBlur_wallRunMaxStrength; - float radialMotionBlur_groundPoundMinRadius; - float radialMotionBlur_groundPoundMaxRadius; - float radialMotionBlur_groundPoundMinStrength; - float radialMotionBlur_groundPoundMaxStrength; - float radialMotionBlur_rewindMinRadius; - float radialMotionBlur_rewindMaxRadius; - float radialMotionBlur_rewindMinStrength; - float radialMotionBlur_rewindMaxStrength; - float radialMotionBlur_dodgeMinRadius; - float radialMotionBlur_dodgeMaxRadius; - float radialMotionBlur_dodgeMinStrength; - float radialMotionBlur_dodgeMaxStrength; - float radialMotionBlur_skydiveMinRadius; - float radialMotionBlur_skydiveMaxRadius; - float radialMotionBlur_skydiveMinStrength; - float radialMotionBlur_skydiveMaxStrength; - RumbleInfo* groundPound_activationRumble; - SndAliasLookup groundPound_activationSound; - SndAliasLookup groundPound_activationSoundPlayer; - RumbleInfo* groundPound_landingRumble; - SndAliasLookup groundPound_landingSound; - SndAliasLookup groundPound_landingSoundPlayer; - RumbleInfo* landing_rumbleLowHeight; - RumbleInfo* landing_rumbleMediumHeight; - RumbleInfo* landing_rumbleHighHeight; - RumbleInfo* landing_rumbleExtremeHeight; - float landing_speedScale; - float footstep_shakeBroadcastRadiusInches; - int footstep_shakeDurationMs; - float footstep_shakeAmplitude; - RumbleInfo* footstep_rumble; - void* /*FootstepVFX*/ footstepvfx_slide; - void* /*FootstepVFX*/ footstepvfx_creep_left; - void* /*FootstepVFX*/ footstepvfx_creep_right; - void* /*FootstepVFX*/ footstepvfx_walk_left; - void* /*FootstepVFX*/ footstepvfx_walk_right; - void* /*FootstepVFX*/ footstepvfx_run_left; - void* /*FootstepVFX*/ footstepvfx_run_right; - void* /*FootstepVFX*/ footstepvfx_sprint_left; - void* /*FootstepVFX*/ footstepvfx_sprint_right; - float skydive_mass; - float skydive_gravitatationalAcceleration; - XModel* skydive_parachuteViewModel; - XModel* skydive_parachuteWorldModel; - float skydive_baseJumpMinimumHeight; - float skydive_baseJumpClearanceRadius; - float skydive_baseJumpAutoDeployHeight; - float skydive_baseJumpForceFreefallHeight; - float skydive_freefallSuperDiveCameraPitch; - float skydive_freefallSuperDiveStickInput; - float skydive_freefallSuperDiveFovAdjustDegrees; - int skydive_freefallSuperDiveFovAdjustInTime; - int skydive_freefallSuperDiveFovAdjustOutTime; - void* /*CinematicMotionDef*/ skydive_freefallCinematicMotion; - float skydive_freefallThrottleTrackSpeed; - float skydive_freefallAnimTrackSpeedThrottle; - float skydive_freefallAnimTrackSpeedStrafe; - float skydive_freefallAnimTrackSpeedYaw; - float skydive_freefallAnimTrackSpeedPitch; - float skydive_freefallAnimMinWeight; - float skydive_freefallAnimMaxWeight; - float skydive_freefallAnimMinPlayRate; - float skydive_freefallAnimMaxPlayRate; - float skydive_freefallAnimSpeedForMinWeight; - float skydive_freefallAnimSpeedForMaxWeight; - float skydive_freefallTopGroundSpeed; - float skydive_freefallMinPitch; - float skydive_freefallMaxPitch; - float skydive_freefallPitchSpeed; - float skydive_freefallYawSpeed; - float skydive_freefallCrossSectionalArea; - float skydive_freefallLookHorizForceMin; - float skydive_freefallLookHorizForceMax; - RumbleGraph* skydive_freefallLookHorizForceGraph; - float skydive_freefallStickHorizForceMin; - float skydive_freefallStickHorizForceMax; - RumbleGraph* skydive_freefallStickHorizForceGraph; - float skydive_freefallDragCoefHoriz; - float skydive_freefallLookHorizDragCoeff; - RumbleGraph* skydive_freefallLookHorizDragGraph; - float skydive_freefallStickHorizDragCoeff; - RumbleGraph* skydive_freefallStickHorizDragGraph; - float skydive_freefallDragCoefVert; - float skydive_freefallLookVertDragCoeff; - RumbleGraph* skydive_freefallLookVertDragGraph; - float skydive_freefallStickVertDragIncreasePerc; - RumbleGraph* skydive_freefallStickVertDragIncreaseGraph; - float skydive_freefallStickVertDragReductionPerc; - RumbleGraph* skydive_freefallStickVertDragReductionGraph; - float skydive_freefallStickSidewaysForce; - float skydive_freefallMaxBrakeForce; - float skydive_freefallMinTurnMultiplier; - float skydive_freefallMaxTurnMultiplier; - RumbleGraph* skydive_freefallTurnMultiplierGraph; - float skydive_freefallTurnMultiplierMinScale; - float skydive_freefallTurnMultiplierMaxScale; - RumbleGraph* skydive_freefallTurnMultiplierPitchGraph; - SndAliasLookup skydive_freefallAmbientSound; - float skydive_freefallAmbientSoundGroundSpeedWeight; - float skydive_freefallAmbientSoundMinVolume; - float skydive_freefallAmbientSoundMaxVolume; - float skydive_freefallAmbientSoundMinPitch; - float skydive_freefallAmbientSoundMaxPitch; - float skydive_freefallAmbientSoundMinGroundSpeed; - float skydive_freefallAmbientSoundMaxGroundSpeed; - float skydive_freefallAmbientSoundMinFallSpeed; - float skydive_freefallAmbientSoundMaxFallSpeed; - SndAliasLookup skydive_freefallHighSpeedSound; - float skydive_freefallHighSpeedSoundGroundSpeedWeight; - float skydive_freefallHighSpeedSoundMinVolume; - float skydive_freefallHighSpeedSoundMaxVolume; - float skydive_freefallHighSpeedSoundMinPitch; - float skydive_freefallHighSpeedSoundMaxPitch; - float skydive_freefallHighSpeedSoundMinGroundSpeed; - float skydive_freefallHighSpeedSoundMaxGroundSpeed; - float skydive_freefallHighSpeedSoundMinFallSpeed; - float skydive_freefallHighSpeedSoundMaxFallSpeed; - float skydive_deployHorizontalDrag; - float skydive_deployVerticalDrag; - void* /*CinematicMotionDef*/ skydive_canopyCinematicMotion; - float skydive_canopyThrottleTrackSpeed; - float skydive_canopyAnimTrackSpeedThrottle; - float skydive_canopyAnimTrackSpeedStrafe; - float skydive_canopyAnimTrackSpeedYaw; - float skydive_canopyAnimTrackSpeedPitch; - float skydive_canopyAnimMinWeight; - float skydive_canopyAnimMaxWeight; - float skydive_canopyAnimMinPlayRate; - float skydive_canopyAnimMaxPlayRate; - float skydive_canopyAnimSpeedForMinWeight; - float skydive_canopyAnimSpeedForMaxWeight; - float skydive_canopyTopGroundSpeed; - float skydive_canopyMinPitch; - float skydive_canopyMaxPitch; - float skydive_canopyPitchSpeed; - float skydive_canopyYawSpeed; - float skydive_canopyCrossSectionalArea; - float skydive_canopyLookHorizForceMin; - float skydive_canopyLookHorizForceMax; - RumbleGraph* skydive_canopyLookHorizForceGraph; - float skydive_canopyStickHorizForceMin; - float skydive_canopyStickHorizForceMax; - RumbleGraph* skydive_canopyStickHorizForceGraph; - float skydive_canopyDragCoefHoriz; - float skydive_canopyLookHorizDragCoeff; - RumbleGraph* skydive_canopyLookHorizDragGraph; - float skydive_canopyStickHorizDragCoeff; - RumbleGraph* skydive_canopyStickHorizDragGraph; - float skydive_canopyDragCoefVert; - float skydive_canopyLookVertDragCoeff; - RumbleGraph* skydive_canopyLookVertDragGraph; - float skydive_canopyStickVertDragIncreasePerc; - RumbleGraph* skydive_canopyStickVertDragIncreaseGraph; - float skydive_canopyStickVertDragReductionPerc; - RumbleGraph* skydive_canopyStickVertDragReductionGraph; - float skydive_canopyStickSidewaysForce; - float skydive_canopyMaxBrakeForce; - float skydive_canopyMinTurnMultiplier; - float skydive_canopyMaxTurnMultiplier; - RumbleGraph* skydive_canopyTurnMultiplierGraph; - float skydive_canopyTurnMultiplierMinScale; - float skydive_canopyTurnMultiplierMaxScale; - RumbleGraph* skydive_canopyTurnMultiplierPitchGraph; - SndAliasLookup skydive_canopyAmbientSound; - float skydive_canopyAmbientSoundGroundSpeedWeight; - float skydive_canopyAmbientSoundMinVolume; - float skydive_canopyAmbientSoundMaxVolume; - float skydive_canopyAmbientSoundMinPitch; - float skydive_canopyAmbientSoundMaxPitch; - float skydive_canopyAmbientSoundMinGroundSpeed; - float skydive_canopyAmbientSoundMaxGroundSpeed; - float skydive_canopyAmbientSoundMinFallSpeed; - float skydive_canopyAmbientSoundMaxFallSpeed; - SndAliasLookup skydive_canopyHighSpeedSound; - float skydive_canopyHighSpeedSoundGroundSpeedWeight; - float skydive_canopyHighSpeedSoundMinVolume; - float skydive_canopyHighSpeedSoundMaxVolume; - float skydive_canopyHighSpeedSoundMinPitch; - float skydive_canopyHighSpeedSoundMaxPitch; - float skydive_canopyHighSpeedSoundMinGroundSpeed; - float skydive_canopyHighSpeedSoundMaxGroundSpeed; - float skydive_canopyHighSpeedSoundMinFallSpeed; - float skydive_canopyHighSpeedSoundMaxFallSpeed; - float skydive_wmAnimFreefallPitchMin; - float skydive_wmAnimFreefallPitchMax; - float skydive_wmAnimFreefallPitchTrackSpeed; - float skydive_wmAnimFreefallRollTrackSpeed; - float skydive_wmAnimFreefallRollReturnSpeed; - RumbleGraph* skydive_wmAnimFreefallLeftStickXToRollGraph; - RumbleGraph* skydive_wmAnimFreefallRightStickXToRollGraph; - float skydive_camFreefallHeightOffset; - RumbleGraph* skydive_camFreefallPitchToDistanceGraph; - RumbleGraph* skydive_camFreefallPitchToForwardOffsetGraph; - float skydive_camParachuteHeightOffset; - RumbleGraph* skydive_camParachutePitchToDistanceGraph; - RumbleGraph* skydive_camParachutePitchToForwardOffsetGraph; - RumbleGraph* skydive_camParachutePitchToModelPitchForwardOffsetGraph; - RumbleGraph* skydive_camParachutePitchToModelRollSideOffsetGraph; - RumbleGraph* skydive_camParachutePitchToModelRollUpOffsetGraph; - float skydive_camParachuteBlendInTime; - SndAliasLookup nvg_blindSound; - float dlcFloat[8]; -}; - -struct SuitAnimPackage -{ - const char* name; - void* /*SuitAnimPerWeapClass*/ animOverrides; -}; - -struct CameraFirstPersonProfileDef -{ - bool applyOffset; - vec3_t offsetTranslation; - bool disableFOVWeaponOffset; - float cameraAnimationTransScale; - float cameraAnimationRotScale; - float handheldCameraTransScale; - float handheldCameraRotScale; - float handheldCameraImpulseTransScale; - float handheldCameraImpulseRotScale; -}; - -struct CameraOrbitProfileDef -{ - float lerpSpeed; - vec3_t pivotOffset; - float initialAzimuth; - float initialPolar; - float polarMin; - float polarMax; - float range; - float returnAzimuthSpeed; - float returnPolarSpeed; - float easeInFactor; - float returnTimeTo; - float turningSpeedPolar; - float turningSpeedAzimuth; - float traceCollRadius; - float mouseInputMultiplier; - float rollContrib; - float pitchContrib; - int buttonToggleReturn; - int buttonCyclePerspective; - int buttonRecenter; - bool initialReturn; - bool returnAzimuth; - bool returnPolar; - float alignToMovement; - bool interpolateFocus; - bool cameraReturnOnGas; - float cameraReturnOnSpeed; - float yawTurnAdjust; -}; - -struct CameraSentryDroneDef -{ - float range; - float thresHitToSpeedUp; - float speedUpFactor; - float lerpSpeedEye; - float lerpSpeedFocus; - float lerpSpeedUp; - float focusTraceLen; - float eyeHeight; - float horizontalOffset; - float upOffsetFactorIncl; -}; - -struct CameraKillCamVehicleDef -{ - float lookAtRadius; - float fov; - float distBack; - float distUp; - float distBackRadiusMod; - float distUpRadiusMod; - float fovRadiusMod; - float sideMag; - float traceCollRad; -}; - -struct CameraTransitionDef -{ - bool active; - float time; - float timewaitEyepos; - float timewaitAxis; - int /*CameraTransitionCurve*/ curveEyepos; - int /*CameraTransitionCurve*/ curveAxis; -}; - -struct CameraDef -{ - const char* name; - int /*CameraProfile*/ profile; - bool keepShakeCam; - bool serverFeedback; - bool behaveAsRemoteCont; - bool interpolateViewTransition; - bool overrideFOV; - float FOV; - int /*LensProfileMode*/ overrideLensProfile; - float lensFocalLength; - float lensFStop; - float lensScale; - float lensUVScale; - bool overrideRadialBlur; - float radialBlurRadius; - float radialBlurStrength; - bool overrideZPlanes; - float zPlaneVMNear; - float zPlaneSceneNear; - CameraFirstPersonProfileDef firstPerson; - CameraOrbitProfileDef orbit; - CameraSentryDroneDef sentryDrone; - CameraKillCamVehicleDef kcamVeh; - CameraTransitionDef transitionIn; - CameraTransitionDef transitionOut; - vec3_t fpveh_offsetLs; - float fpveh_offsetYaw; - float fpveh_offsetPitch; - float fpveh_rollContrib; - float fpveh_rollMax; - bool fpveh_freeLook; - bool fpveh_freeLookReturn; - bool dlcBool[1]; - bool fadeOutPlayerOnTransitionIn; -}; - -struct HudOutlineDef -{ - const char* name; - unsigned __int8 outlineType; - bool drawInStencil; - bool drawNonOccludedPixels; - bool drawOccludedPixels; - bool drawFill; - bool fadeOverTimeEnable; - bool fadeOverTimeLooping; - unsigned __int8 fadeOverTimeCurveType; - float fadeOverTimeMinAlpha; - float fadeOverTimeMaxAlphaTime; - float fadeOverTimeMinAlphaTime; - float fadeOverTimeInTime; - float fadeOverTimeOutTime; - bool distanceFadeEnable; - float distanceFadeMinAlpha; - float distanceFadeStartDistance; - float distanceFadeEndDistance; - unsigned int outlineColor; - int outlineWidth; - bool drawOnLocalPlayerCharacter; - bool drawOnVehicleOccupants; - bool drawOnLocalPlayerVehicleOccupants; - bool drawOnLocalPlayerVehicle; - bool dlcBool0; - bool dlcBool1; - bool dlcBool2; - bool dlcBool3; - bool dlcBool4; - bool dlcBool5; - float dlcFloat0; - float dlcFloat1; - float dlcFloat2; - float dlcFloat3; - float dlcFloat4; - float dlcFloat5; -}; - -struct SpaceshipTargetDef -{ - const char* name; - scr_string_t targetTag; - float annotationOffsetX; - float annotationOffsetY; - float annotationOffsetZ; - bool disableLeading; - float lock_minDistance; - float lock_maxDistance; - float lock_cutoffDistance; - float lock_minRate; - float lock_maxRate; - float lock_maxZoomFOV; - float lock_followDistance; - float lockCooldown_rate; - float aa_closeDistance; - float aa_farDistance; - float aa_closeMinAngle; - float aa_closeMaxAngle; - float aa_closeBlendMax; - float aa_farMinAngle; - float aa_farMaxAngle; - float aa_farBlendMax; - float aaLocked_closeDistance; - float aaLocked_farDistance; - float aaLocked_closeMinAngle; - float aaLocked_closeMaxAngle; - float aaLocked_closeBlendMax; - float aaLocked_farMinAngle; - float aaLocked_farMaxAngle; - float aaLocked_farBlendMax; - float pilotAssistScale; - float callout_maxDistance; - float callout_maxAngle; -}; - -struct __declspec(align(8)) RumbleInfo -{ - const char* name; - int duration; - float range; - RumbleGraph* highRumbleGraph; - RumbleGraph* lowRumbleGraph; - RumbleGraph* leftTriggerRumbleGraph; - RumbleGraph* rightTriggerRumbleGraph; - bool swapTriggerRumblesOnLefty; - bool panTriggerRumbles; - bool fadeWithDistance; - bool broadcast; -}; - -struct __declspec(align(8)) RumbleGraph -{ - const char* name; - vec2_t knots[16]; - unsigned __int16 knotCount; -}; - -struct LocalizeEntry -{ - const char* name; - const char* value; -}; - -struct StaticModelCollisionInstance -{ - vec3_t origin; - vec3_t angles; - float scale; -}; - -struct XModelDetailCollision -{ - const char* name; - unsigned int physicsLODDataSize; - char* physicsLODData; - unsigned int physicsLODDataNameCount; - scr_string_t* physicsLODDataNames; -}; - -struct StaticModelCollisionModel -{ - scr_string_t name; - PhysicsAsset* physicsAsset; - XModelDetailCollision* detailCollision; - unsigned int numInstances; - StaticModelCollisionInstance* instances; -}; - -struct __declspec(align(8)) StaticModelCollisionModelList -{ - unsigned int numModels; - StaticModelCollisionModel* models; - unsigned int structureMemoryCost; -}; - -struct PhysicsCapacities -{ - int maxNumRigidBodiesServer; - int maxNumDetailRigidBodiesServer; - int maxNumConstraintsServer; - int maxNumMotionsServer; - int maxNumRigidBodiesClient; - int maxNumDetailRigidBodiesClient; - int maxNumConstraintsClient; - int maxNumMotionsClient; -}; - -struct SpawnPointEntityRecord -{ - unsigned __int16 index; - scr_string_t name; - scr_string_t target; - scr_string_t script_noteworthy; - vec3_t origin; - vec3_t angles; -}; - -struct SpawnPointRecordList -{ - unsigned __int16 spawnsCount; - SpawnPointEntityRecord* spawns; -}; - -struct ClientMapTriggers -{ - unsigned int count; - uintptr_t models; - unsigned int hullCount; - uintptr_t hulls; - unsigned int slabCount; - uintptr_t slabs; -}; - -struct ClientTriggers -{ - ClientMapTriggers trigger; - unsigned int triggerStringLength; - char* triggerString; - __int16* visionSetTriggers; - unsigned __int16* triggerType; - vec3_t* origins; - float* scriptDelay; - float* priority; - __int16* audioTriggers; - __int16* blendLookup; - __int16* npcTriggers; - __int16* audioStateIds; - uintptr_t detailSoundBank; - uintptr_t audioRvbPanInfo; - __int16* parent; - uintptr_t linkTo; - uintptr_t spatialTree; -}; - -struct ClientTriggerBlend -{ - unsigned __int16 numClientTriggerBlendNodes; - uintptr_t blendNodes; -}; - -struct SplinePointEntityRecord -{ - int splineId; - int splineNodeId; - scr_string_t splineNodeLabel; - scr_string_t targetname; - scr_string_t target; - scr_string_t string; - float speed; - float splineNodeTension; - vec3_t origin; - vec3_t angles; - float throttle; - vec2_t corridorDims; - vec3_t tangent; - float distToNextNode; - vec3_t positionCubic[4]; - vec3_t tangentQuadratic[3]; -}; - -struct SplinePointRecordList -{ - unsigned __int16 splinePointCount; - float splineLength; - SplinePointEntityRecord* splinePoints; -}; - -struct SplineRecordList -{ - unsigned __int16 splineCount; - SplinePointRecordList* splines; -}; - -struct __declspec(align(8)) cmodel_t -{ - Bounds bounds; - float radius; - uintptr_t physicsAsset; - unsigned __int16 physicsShapeOverrideIdx; - unsigned __int16 navObstacleIdx; - unsigned int edgeFirstIndex; - unsigned int edgeTotalCount; -}; - -struct MapEdgeList -{ - const char* name; - vec3_t mins; - vec3_t maxs; - unsigned int transientIndex; - unsigned int dynamicQueryTypes; - unsigned int staticQueryTypes; - unsigned int numDynamicEdges; - unsigned int numStaticEdges; - bool valid; - unsigned int numEdges; - vec4_t(*edges)[2]; - uintptr_t edgeMetadata; - unsigned int numEdgeOctrees; - uintptr_t edgeOctrees; - unsigned int numEdgeOctreeNodeSet; - uintptr_t edgeOctreeNodeSets; - unsigned int numEdgeIndices; - unsigned int* edgeIndices; - unsigned int numEdgeAdjacencyMetadata; - uintptr_t edgeAdjacencyMetadata; - unsigned int numEdgeAdjacency; - uintptr_t edgeAdjacency; -}; - -struct __declspec(align(4)) CM_ClientModel -{ - vec3_t spawnOrigin; - vec3_t spawnAngles; - const XModel* model; - scr_string_t animationTreeName; - XAnimParts* animation; - scr_string_t name; - bool noPhysics; - bool noCloth; -}; - -struct __declspec(align(8)) MapEnts -{ - const char* name; - char* entityString; - int numEntityChars; - unsigned __int8 field_14; - unsigned __int8 field_15; - unsigned __int8 field_16; - unsigned __int8 field_17; - MapTriggers trigger; - ClientTriggers clientTrigger; - ClientTriggerBlend clientTriggerBlend; - SpawnPointRecordList spawnList; - SplineRecordList splineList; - unsigned int havokEntsShapeDataSize; - unsigned __int8 field_14C; - unsigned __int8 field_14D; - unsigned __int8 field_14E; - unsigned __int8 field_14F; - char* havokEntsShapeData; - int numSubModels; - unsigned __int8 field_15C; - unsigned __int8 field_15D; - unsigned __int8 field_15E; - unsigned __int8 field_15F; - cmodel_t* cmodels; - unsigned __int8 field_168; - unsigned __int8 field_169; - unsigned __int8 field_16A; - unsigned __int8 field_16B; - int numEdgeLists; - MapEdgeList** edgeLists; - uintptr_t edgeListSpatialTree; - int numClientModels; - unsigned __int8 field_184; - unsigned __int8 field_185; - unsigned __int8 field_186; - unsigned __int8 field_187; - CM_ClientModel* clientModels; - unsigned __int8 field_190; - unsigned __int8 field_191; - unsigned __int8 field_192; - unsigned __int8 field_193; - unsigned __int8 field_194; - unsigned __int8 field_195; - unsigned __int8 field_196; - unsigned __int8 field_197; - unsigned __int8 field_198; - unsigned __int8 field_199; - unsigned __int8 field_19A; - unsigned __int8 field_19B; - int dynEntityListsCount[2]; - __declspec(align(8)) unsigned __int8 field_1A8; - unsigned __int8 field_1A9; - unsigned __int8 field_1AA; - unsigned __int8 field_1AB; - unsigned __int8 field_1AC; - unsigned __int8 field_1AD; - unsigned __int8 field_1AE; - unsigned __int8 field_1AF; - unsigned __int8 field_1B0; - unsigned __int8 field_1B1; - unsigned __int8 field_1B2; - unsigned __int8 field_1B3; - unsigned __int8 field_1B4; - unsigned __int8 field_1B5; - unsigned __int8 field_1B6; - unsigned __int8 field_1B7; - unsigned __int8 field_1B8; - unsigned __int8 field_1B9; - unsigned __int8 field_1BA; - unsigned __int8 field_1BB; - unsigned __int8 field_1BC; - unsigned __int8 field_1BD; - unsigned __int8 field_1BE; - unsigned __int8 field_1BF; - unsigned __int8 field_1C0; - unsigned __int8 field_1C1; - unsigned __int8 field_1C2; - unsigned __int8 field_1C3; - unsigned __int8 field_1C4; - unsigned __int8 field_1C5; - unsigned __int8 field_1C6; - unsigned __int8 field_1C7; - uintptr_t dynEntSpatialPopulation[2]; - uintptr_t dynEntSpatialTransientMap[2]; - unsigned __int8 field_1E8; - unsigned __int8 field_1E9; - unsigned __int8 field_1EA; - unsigned __int8 field_1EB; - int clientEntAnchorCount; - uintptr_t clientEntAnchors; - unsigned __int8 scriptableMapEnts; - unsigned __int8 field_1F9; - unsigned __int8 field_1FA; - unsigned __int8 field_1FB; - unsigned __int8 field_1FC; - unsigned __int8 field_1FD; - unsigned __int8 field_1FE; - unsigned __int8 field_1FF; - unsigned __int8 field_200; - unsigned __int8 field_201; - unsigned __int8 field_202; - unsigned __int8 field_203; - unsigned __int8 field_204; - unsigned __int8 field_205; - unsigned __int8 field_206; - unsigned __int8 field_207; - unsigned __int8 field_208; - unsigned __int8 field_209; - unsigned __int8 field_20A; - unsigned __int8 field_20B; - unsigned __int8 field_20C; - unsigned __int8 field_20D; - unsigned __int8 field_20E; - unsigned __int8 field_20F; - unsigned __int8 field_210; - unsigned __int8 field_211; - unsigned __int8 field_212; - unsigned __int8 field_213; - unsigned __int8 field_214; - unsigned __int8 field_215; - unsigned __int8 field_216; - unsigned __int8 field_217; - unsigned __int8 field_218; - unsigned __int8 field_219; - unsigned __int8 field_21A; - unsigned __int8 field_21B; - unsigned __int8 field_21C; - unsigned __int8 field_21D; - unsigned __int8 field_21E; - unsigned __int8 field_21F; - unsigned __int8 field_220; - unsigned __int8 field_221; - unsigned __int8 field_222; - unsigned __int8 field_223; - unsigned __int8 field_224; - unsigned __int8 field_225; - unsigned __int8 field_226; - unsigned __int8 field_227; - unsigned __int8 field_228; - unsigned __int8 field_229; - unsigned __int8 field_22A; - unsigned __int8 field_22B; - unsigned __int8 field_22C; - unsigned __int8 field_22D; - unsigned __int8 field_22E; - unsigned __int8 field_22F; - unsigned __int8 field_230; - unsigned __int8 field_231; - unsigned __int8 field_232; - unsigned __int8 field_233; - unsigned __int8 field_234; - unsigned __int8 field_235; - unsigned __int8 field_236; - unsigned __int8 field_237; - unsigned __int8 field_238; - unsigned __int8 field_239; - unsigned __int8 field_23A; - unsigned __int8 field_23B; - unsigned __int8 field_23C; - unsigned __int8 field_23D; - unsigned __int8 field_23E; - unsigned __int8 field_23F; - unsigned __int8 field_240; - unsigned __int8 field_241; - unsigned __int8 field_242; - unsigned __int8 field_243; - unsigned __int8 field_244; - unsigned __int8 field_245; - unsigned __int8 field_246; - unsigned __int8 field_247; - unsigned __int8 field_248; - unsigned __int8 field_249; - unsigned __int8 field_24A; - unsigned __int8 field_24B; - unsigned __int8 field_24C; - unsigned __int8 field_24D; - unsigned __int8 field_24E; - unsigned __int8 field_24F; - unsigned __int8 field_250; - unsigned __int8 field_251; - unsigned __int8 field_252; - unsigned __int8 field_253; - unsigned __int8 field_254; - unsigned __int8 field_255; - unsigned __int8 field_256; - unsigned __int8 field_257; - unsigned __int8 field_258; - unsigned __int8 field_259; - unsigned __int8 field_25A; - unsigned __int8 field_25B; - unsigned __int8 field_25C; - unsigned __int8 field_25D; - unsigned __int8 field_25E; - unsigned __int8 field_25F; - unsigned __int8 field_260; - unsigned __int8 field_261; - unsigned __int8 field_262; - unsigned __int8 field_263; - unsigned __int8 field_264; - unsigned __int8 field_265; - unsigned __int8 field_266; - unsigned __int8 field_267; - unsigned __int8 field_268; - unsigned __int8 field_269; - unsigned __int8 field_26A; - unsigned __int8 field_26B; - unsigned __int8 field_26C; - unsigned __int8 field_26D; - unsigned __int8 field_26E; - unsigned __int8 field_26F; - unsigned __int8 field_270; - unsigned __int8 field_271; - unsigned __int8 field_272; - unsigned __int8 field_273; - unsigned __int8 field_274; - unsigned __int8 field_275; - unsigned __int8 field_276; - unsigned __int8 field_277; - unsigned __int8 field_278; - unsigned __int8 field_279; - unsigned __int8 field_27A; - unsigned __int8 field_27B; - unsigned __int8 field_27C; - unsigned __int8 field_27D; - unsigned __int8 field_27E; - unsigned __int8 field_27F; - unsigned __int8 field_280; - unsigned __int8 field_281; - unsigned __int8 field_282; - unsigned __int8 field_283; - unsigned __int8 field_284; - unsigned __int8 field_285; - unsigned __int8 field_286; - unsigned __int8 field_287; - unsigned __int8 field_288; - unsigned __int8 field_289; - unsigned __int8 field_28A; - unsigned __int8 field_28B; - unsigned __int8 field_28C; - unsigned __int8 field_28D; - unsigned __int8 field_28E; - unsigned __int8 field_28F; - unsigned __int8 field_290; - unsigned __int8 field_291; - unsigned __int8 field_292; - unsigned __int8 field_293; - unsigned __int8 field_294; - unsigned __int8 field_295; - unsigned __int8 field_296; - unsigned __int8 field_297; - unsigned __int8 field_298; - unsigned __int8 field_299; - unsigned __int8 field_29A; - unsigned __int8 field_29B; - unsigned __int8 field_29C; - unsigned __int8 field_29D; - unsigned __int8 field_29E; - unsigned __int8 field_29F; - unsigned __int8 field_2A0; - unsigned __int8 field_2A1; - unsigned __int8 field_2A2; - unsigned __int8 field_2A3; - unsigned __int8 field_2A4; - unsigned __int8 field_2A5; - unsigned __int8 field_2A6; - unsigned __int8 field_2A7; - unsigned __int8 field_2A8; - unsigned __int8 field_2A9; - unsigned __int8 field_2AA; - unsigned __int8 field_2AB; - unsigned __int8 field_2AC; - unsigned __int8 field_2AD; - unsigned __int8 field_2AE; - unsigned __int8 field_2AF; - unsigned __int8 field_2B0; - unsigned __int8 field_2B1; - unsigned __int8 field_2B2; - unsigned __int8 field_2B3; - unsigned __int8 field_2B4; - unsigned __int8 field_2B5; - unsigned __int8 field_2B6; - unsigned __int8 field_2B7; - unsigned __int8 field_2B8; - unsigned __int8 field_2B9; - unsigned __int8 field_2BA; - unsigned __int8 field_2BB; - unsigned __int8 field_2BC; - unsigned __int8 field_2BD; - unsigned __int8 field_2BE; - unsigned __int8 field_2BF; - unsigned __int8 field_2C0; - unsigned __int8 field_2C1; - unsigned __int8 field_2C2; - unsigned __int8 field_2C3; - unsigned __int8 field_2C4; - unsigned __int8 field_2C5; - unsigned __int8 field_2C6; - unsigned __int8 field_2C7; - unsigned __int8 field_2C8; - unsigned __int8 field_2C9; - unsigned __int8 field_2CA; - unsigned __int8 field_2CB; - unsigned __int8 field_2CC; - unsigned __int8 field_2CD; - unsigned __int8 field_2CE; - unsigned __int8 field_2CF; - unsigned __int8 field_2D0; - unsigned __int8 field_2D1; - unsigned __int8 field_2D2; - unsigned __int8 field_2D3; - unsigned __int8 field_2D4; - unsigned __int8 field_2D5; - unsigned __int8 field_2D6; - unsigned __int8 field_2D7; - unsigned __int8 field_2D8; - unsigned __int8 field_2D9; - unsigned __int8 field_2DA; - unsigned __int8 field_2DB; - unsigned __int8 field_2DC; - unsigned __int8 field_2DD; - unsigned __int8 field_2DE; - unsigned __int8 field_2DF; - unsigned __int8 field_2E0; - unsigned __int8 field_2E1; - unsigned __int8 field_2E2; - unsigned __int8 field_2E3; - unsigned __int8 field_2E4; - unsigned __int8 field_2E5; - unsigned __int8 field_2E6; - unsigned __int8 field_2E7; - unsigned __int8 field_2E8; - unsigned __int8 field_2E9; - unsigned __int8 field_2EA; - unsigned __int8 field_2EB; - unsigned __int8 field_2EC; - unsigned __int8 field_2ED; - unsigned __int8 field_2EE; - unsigned __int8 field_2EF; - unsigned __int8 field_2F0; - unsigned __int8 field_2F1; - unsigned __int8 field_2F2; - unsigned __int8 field_2F3; - unsigned __int8 field_2F4; - unsigned __int8 field_2F5; - unsigned __int8 field_2F6; - unsigned __int8 field_2F7; - unsigned __int8 field_2F8; - unsigned __int8 field_2F9; - unsigned __int8 field_2FA; - unsigned __int8 field_2FB; - unsigned __int8 field_2FC; - unsigned __int8 field_2FD; - unsigned __int8 field_2FE; - unsigned __int8 field_2FF; - unsigned __int8 field_300; - unsigned __int8 field_301; - unsigned __int8 field_302; - unsigned __int8 field_303; - unsigned __int8 field_304; - unsigned __int8 field_305; - unsigned __int8 field_306; - unsigned __int8 field_307; - unsigned __int8 field_308; - unsigned __int8 field_309; - unsigned __int8 field_30A; - unsigned __int8 field_30B; - unsigned __int8 field_30C; - unsigned __int8 field_30D; - unsigned __int8 field_30E; - unsigned __int8 field_30F; - unsigned __int8 field_310; - unsigned __int8 field_311; - unsigned __int8 field_312; - unsigned __int8 field_313; - unsigned __int8 field_314; - unsigned __int8 field_315; - unsigned __int8 field_316; - unsigned __int8 field_317; - unsigned __int8 field_318; - unsigned __int8 field_319; - unsigned __int8 field_31A; - unsigned __int8 field_31B; - unsigned __int8 field_31C; - unsigned __int8 field_31D; - unsigned __int8 field_31E; - unsigned __int8 field_31F; - unsigned __int8 field_320; - unsigned __int8 field_321; - unsigned __int8 field_322; - unsigned __int8 field_323; - unsigned __int8 field_324; - unsigned __int8 field_325; - unsigned __int8 field_326; - unsigned __int8 field_327; - unsigned __int8 field_328; - unsigned __int8 field_329; - unsigned __int8 field_32A; - unsigned __int8 field_32B; - unsigned __int8 field_32C; - unsigned __int8 field_32D; - unsigned __int8 field_32E; - unsigned __int8 field_32F; - unsigned __int8 field_330; - unsigned __int8 field_331; - unsigned __int8 field_332; - unsigned __int8 field_333; - unsigned __int8 field_334; - unsigned __int8 field_335; - unsigned __int8 field_336; - unsigned __int8 field_337; - unsigned __int8 field_338; - unsigned __int8 field_339; - unsigned __int8 field_33A; - unsigned __int8 field_33B; - unsigned __int8 field_33C; - unsigned __int8 field_33D; - unsigned __int8 field_33E; - unsigned __int8 field_33F; - unsigned __int8 field_340; - unsigned __int8 field_341; - unsigned __int8 field_342; - unsigned __int8 field_343; - unsigned __int8 field_344; - unsigned __int8 field_345; - unsigned __int8 field_346; - unsigned __int8 field_347; - unsigned __int8 field_348; - unsigned __int8 field_349; - unsigned __int8 field_34A; - unsigned __int8 field_34B; - unsigned __int8 field_34C; - unsigned __int8 field_34D; - unsigned __int8 field_34E; - unsigned __int8 field_34F; - unsigned __int8 field_350; - unsigned __int8 field_351; - unsigned __int8 field_352; - unsigned __int8 field_353; - unsigned __int8 field_354; - unsigned __int8 field_355; - unsigned __int8 field_356; - unsigned __int8 field_357; - unsigned __int8 field_358; - unsigned __int8 field_359; - unsigned __int8 field_35A; - unsigned __int8 field_35B; - unsigned __int8 field_35C; - unsigned __int8 field_35D; - unsigned __int8 field_35E; - unsigned __int8 field_35F; - unsigned __int8 field_360; - unsigned __int8 field_361; - unsigned __int8 field_362; - unsigned __int8 field_363; - unsigned __int8 field_364; - unsigned __int8 field_365; - unsigned __int8 field_366; - unsigned __int8 field_367; - unsigned __int8 field_368; - unsigned __int8 field_369; - unsigned __int8 field_36A; - unsigned __int8 field_36B; - unsigned __int8 field_36C; - unsigned __int8 field_36D; - unsigned __int8 field_36E; - unsigned __int8 field_36F; - unsigned __int8 field_370; - unsigned __int8 field_371; - unsigned __int8 field_372; - unsigned __int8 field_373; - unsigned __int8 field_374; - unsigned __int8 field_375; - unsigned __int8 field_376; - unsigned __int8 field_377; - unsigned __int8 field_378; - unsigned __int8 field_379; - unsigned __int8 field_37A; - unsigned __int8 field_37B; - unsigned __int8 field_37C; - unsigned __int8 field_37D; - unsigned __int8 field_37E; - unsigned __int8 field_37F; - unsigned __int8 field_380; - unsigned __int8 field_381; - unsigned __int8 field_382; - unsigned __int8 field_383; - unsigned __int8 field_384; - unsigned __int8 field_385; - unsigned __int8 field_386; - unsigned __int8 field_387; - unsigned __int8 field_388; - unsigned __int8 field_389; - unsigned __int8 field_38A; - unsigned __int8 field_38B; - unsigned __int8 field_38C; - unsigned __int8 field_38D; - unsigned __int8 field_38E; - unsigned __int8 field_38F; - unsigned __int8 field_390; - unsigned __int8 field_391; - unsigned __int8 field_392; - unsigned __int8 field_393; - unsigned __int8 field_394; - unsigned __int8 field_395; - unsigned __int8 field_396; - unsigned __int8 field_397; - unsigned __int8 field_398; - unsigned __int8 field_399; - unsigned __int8 field_39A; - unsigned __int8 field_39B; - unsigned __int8 field_39C; - unsigned __int8 field_39D; - unsigned __int8 field_39E; - unsigned __int8 field_39F; - unsigned __int8 field_3A0; - unsigned __int8 field_3A1; - unsigned __int8 field_3A2; - unsigned __int8 field_3A3; - unsigned __int8 field_3A4; - unsigned __int8 field_3A5; - unsigned __int8 field_3A6; - unsigned __int8 field_3A7; - unsigned __int8 field_3A8; - unsigned __int8 field_3A9; - unsigned __int8 field_3AA; - unsigned __int8 field_3AB; - unsigned __int8 field_3AC; - unsigned __int8 field_3AD; - unsigned __int8 field_3AE; - unsigned __int8 field_3AF; - unsigned __int8 field_3B0; - unsigned __int8 field_3B1; - unsigned __int8 field_3B2; - unsigned __int8 field_3B3; - unsigned __int8 field_3B4; - unsigned __int8 field_3B5; - unsigned __int8 field_3B6; - unsigned __int8 field_3B7; - unsigned __int8 field_3B8; - unsigned __int8 field_3B9; - unsigned __int8 field_3BA; - unsigned __int8 field_3BB; - unsigned __int8 field_3BC; - unsigned __int8 field_3BD; - unsigned __int8 field_3BE; - unsigned __int8 field_3BF; - unsigned __int8 field_3C0; - unsigned __int8 field_3C1; - unsigned __int8 field_3C2; - unsigned __int8 field_3C3; - unsigned __int8 field_3C4; - unsigned __int8 field_3C5; - unsigned __int8 field_3C6; - unsigned __int8 field_3C7; - unsigned __int8 field_3C8; - unsigned __int8 field_3C9; - unsigned __int8 field_3CA; - unsigned __int8 field_3CB; - unsigned __int8 field_3CC; - unsigned __int8 field_3CD; - unsigned __int8 field_3CE; - unsigned __int8 field_3CF; - unsigned __int8 field_3D0; - unsigned __int8 field_3D1; - unsigned __int8 field_3D2; - unsigned __int8 field_3D3; - unsigned __int8 field_3D4; - unsigned __int8 field_3D5; - unsigned __int8 field_3D6; - unsigned __int8 field_3D7; - unsigned __int8 field_3D8; - unsigned __int8 field_3D9; - unsigned __int8 field_3DA; - unsigned __int8 field_3DB; - unsigned __int8 field_3DC; - unsigned __int8 field_3DD; - unsigned __int8 field_3DE; - unsigned __int8 field_3DF; - unsigned __int8 field_3E0; - unsigned __int8 field_3E1; - unsigned __int8 field_3E2; - unsigned __int8 field_3E3; - unsigned __int8 field_3E4; - unsigned __int8 field_3E5; - unsigned __int8 field_3E6; - unsigned __int8 field_3E7; - unsigned __int8 field_3E8; - unsigned __int8 field_3E9; - unsigned __int8 field_3EA; - unsigned __int8 field_3EB; - unsigned __int8 field_3EC; - unsigned __int8 field_3ED; - unsigned __int8 field_3EE; - unsigned __int8 field_3EF; - unsigned __int8 field_3F0; - unsigned __int8 field_3F1; - unsigned __int8 field_3F2; - unsigned __int8 field_3F3; - unsigned __int8 field_3F4; - unsigned __int8 field_3F5; - unsigned __int8 field_3F6; - unsigned __int8 field_3F7; - unsigned __int8 field_3F8; - unsigned __int8 field_3F9; - unsigned __int8 field_3FA; - unsigned __int8 field_3FB; - unsigned __int8 field_3FC; - unsigned __int8 field_3FD; - unsigned __int8 field_3FE; - unsigned __int8 field_3FF; - unsigned __int8 field_400; - unsigned __int8 field_401; - unsigned __int8 field_402; - unsigned __int8 field_403; - unsigned __int8 field_404; - unsigned __int8 field_405; - unsigned __int8 field_406; - unsigned __int8 field_407; -}; - - -struct CollisionHeatmapEntry -{ - int vertexCount; - float vertexDensity; - vec3_t minExtent; - vec3_t maxExtent; -}; - -struct Stage -{ - const char* name; - vec3_t origin; - unsigned __int16 triggerIndex; - unsigned __int8 sunPrimaryLightIndex; - unsigned int entityUID; - vec3_t skyRotationAngles; -}; - -struct __declspec(align(8)) clipMap_t -{ - const char* name; - int isInUse; - unsigned int numStaticModelCollisionModelLists; - StaticModelCollisionModelList* staticModelCollisionModelLists; - MapEnts* mapEnts; - Stage* stages; - unsigned __int8 stageCount; - MapTriggers stageTrigger; - vec3_t broadphaseMin; - vec3_t broadphaseMax; - PhysicsCapacities physicsCapacities; - unsigned int havokWorldShapeDataSize; - char* havokWorldShapeData; - unsigned int numCollisionHeatmapEntries; - CollisionHeatmapEntry* collisionHeatmap; - unsigned int totalGlassInitPieceCount; - unsigned int totalGlassPieceLimit; - uintptr_t topDownMapData; - const char* visionSetName; - unsigned int checksum; -}; - -struct __declspec(align(8)) WeaponDef -{ - const char* szOverlayName; - XModel* gunXModel; - XModel* gunXModelLeftHand; - XModel* gunXModelRightHand; - XModel* defaultViewModel; - XModel* defaultWorldModelLeftHand; - XModel* defaultWorldModelRightHand; - XModel* worldModel; - XModel* worldXModelLeftHand; - XModel* worldXModelRightHand; - XModel* defaultWorldModel; - XModel* censorshipWorldModel; - XModel* censorshipWorldModelLeftHand; - XModel* censorshipWorldModelRightHand; - XModel* playerShadowModel; - XModel* playerShadowModelLeftHand; - XModel* playerShadowModelRightHand; - XModel* handXModel; - WeaponAnimPackage* szXAnims; - WeaponAnimPackage* szXAnimsRightHanded; - WeaponAnimPackage* szXAnimsLeftHanded; - XAnimParts* turretRaiseAnim; - XAnimParts* turretIdleAnim; - XAnimParts* turretFireAnim; - WeaponDamageInfo damageInfo; - int iFireTime; - int iFireDelay; - int iFireTimeAkimbo; - int iFireDelayAkimbo; - float sprintOutTimerScale; - const char* szModeName; - scr_string_t* notetrackRumbleMapKeys; - scr_string_t* notetrackRumbleMapValues; - scr_string_t* notetrackFXMapKeys; - FxCombinedDef* notetrackFXMapValues; - scr_string_t* notetrackFXMapTagValues; - int playerAnimType; - int scriptedAnimEvent; - int scriptedAnimType; - int weapType; - int weapClass; - int penetrateType; - int inventoryType; - int fireType; - int turretFireType; - int burstCount; - int targetAssistType; - int targetAssistBehavior; - float targetAssistRange; - float targetAssistAngle; - float targetAssistLosOffsetForward; - float targetAssistLosOffsetRight; - float targetAssistLosOffsetUp; - bool targetAssistOnlyAvailableInAds; - int reloadType; - float burstFireCooldown; - bool burstFireAuto; - float viewPitchMaxSpeed; - float viewYawMaxSpeed; - bool alignBarrelWithTurretBody; - bool keepOrientationOnExit; - float kickBackForceMultiplier; - bool autoAdjust; - bool networkLODRangeOverride; - float networkLODRangeOverrideDistance; - int offhandClass; - int stance; - WeaponVFXPackage* vfxPackage; - WeaponSFXPackage* sfxPackage; - bool disableBreathOffhand; - int reticleType; - int hitmarkerType; - Material* reticleCenter; - Material* reticleSide; - Material* reticleOnePiece; - int iReticleCenterSize; - int iReticleSideSize; - int iReticleMinOfs; - bool reticleCenterPulse; - int iReticleShakeDuration; - int iReticleSettleDuration; - int iReticleNumBulletsToRapidFire; - int activeReticleType; - bool useTurretViewmodelAnims; - bool useTurret3pIK; - int turret3pAnimType; - float turretFireAnimMinTime; - vec3_t vStandOfs; - vec3_t vStandOfsRot; - vec3_t vStandOfsRotPivot; - vec3_t vStandMove; - vec3_t vStandRot; - vec3_t strafeMove; - vec3_t strafeRot; - int hipOffsetLerpType; - vec3_t vDuckedOfs; - vec3_t vDuckedOfsRot; - vec3_t vDuckedOfsRotPivot; - vec3_t vDuckedMove; - vec3_t vDuckedRot; - vec3_t vProneOfs; - vec3_t vProneMove; - vec3_t vProneRot; - float adsForwardOffset; - float adsRoll; - float fPosMoveRate; - float fPosProneMoveRate; - float fStandMoveMinSpeed; - float fDuckedMoveMinSpeed; - float fProneMoveMinSpeed; - float fPosRotRate; - float fPosProneRotRate; - float fDuckedOfsRotRate; - float fStandRotMinSpeed; - float fDuckedRotMinSpeed; - float fProneRotMinSpeed; - float fReticleShakeMagnitude; - float fReticleRapidFireMultiplier; - XModel* worldClipModel; - XModel* rocketModel; - GfxImage* hudIcon; - GfxImage* pickupIcon; - GfxImage* dangerIconImg; - GfxImage* throwBackIconImg; - Material* dangerIconMat; - Material* throwBackIconMat; - bool hideWarningIcons; - float warningIconsDelay; - int ammoCounterClip; - int iStartAmmo; - int iPerkStartAmmo; - int iPerkMaxAmmo; - const char* szAmmoName; - int iAmmoIndex; - int iMaxAmmo; - int shotCount; - const char* szSharedAmmoCapName; - int iSharedAmmoCapIndex; - int iSharedAmmoCap; - int iAmmoUsedPerShot; - bool requireAmmoUsedPerShot; - bool disableNoAmmoWarning; - float lowAmmoWarningThreshold; - int lowAmmoWarningCount; - int iDamageType; - int iMeleeDamage; - int iMeleeCountToFinisher; - bool hasMeleeFinisher; - float autoAimRange; - float aimAssistRange; - float aimAssistRangeAds; - float aimAssistPitchSlowdown; - float aimAssistPitchSlowdownAds; - float aimAssistYawSlowdown; - float aimAssistYawSlowdownAds; - float aimAssistLockonStrength; - float aimPadding; - float enemyCrosshairRange; - float moveSpeedScale; - float adsMoveSpeedScale; - float sprintDurationScale; - float sprintRestoreDelay; - ADSOverlay overlay; - int overlayInterface; - float fAdsBobFactor; - float fAdsViewBobMult; - float fAdsGunBobPitchScale; - float fAdsGunBobYawScale; - float fAdsGunBobTiltPitchScale; - float fAdsGunBobTiltYawScale; - float fAdsGunBobTiltRollScale; - float fAdsGunBobTiltBulletDirScale; - float fAdsGunBobTiltOffset; - float fAdsGunBobCrouchFactor; - float adsCrouchViewKickFactor; - float adsCrouchGunKickFactor; - float adsProneViewKickFactor; - float adsProneGunKickFactor; - float fHipSpreadStandMin; - float fHipSpreadDuckedMin; - float fHipSpreadProneMin; - float hipSpreadSprintMin; - float hipSpreadInAirMin; - float hipSpreadStandMax; - float hipSpreadDuckedMax; - float hipSpreadProneMax; - float hipSpreadSprintMax; - float hipSpreadInAirMax; - float fHipSpreadDecayRate; - float fHipSpreadFireAdd; - float fHipSpreadTurnAdd; - float fHipSpreadMoveAdd; - float fHipSpreadDuckedDecay; - float fHipSpreadProneDecay; - float hipSpreadSprintDecay; - float hipSpreadInAirDecay; - float fHipReticleSidePos; - float fAdsIdleAmount; - float fHipIdleAmount; - float adsIdleSpeed; - float hipIdleSpeed; - float fIdleCrouchFactor; - float fIdleProneFactor; - float fGunMaxPitch; - float fGunMaxYaw; - float fViewMaxPitch; - float fViewMaxYaw; - float adsIdleLerpStartTime; - float adsIdleLerpTime; - bool useUninterruptedAdsIdleMotion; - bool disableInputDrivenViewReturnDampening; - float slideSpreadMin; - float slideSpreadMax; - float slideSpreadDecayRate; - float slideSpreadFireAdd; - float slideSpreadTurnAdd; - SwaySettings swaySettings; - float adsFireRateScale; - float adsDamageRangeScale; - float adsFireAnimFrac; - float fireTimerLerpToAdsScale; - bool alwaysFireAtMaxRangeInAds; - bool adsAlignEnabled; - bool disableTagAlignX; - vec3_t adsAlignOffset; - int adsAlignOffsetLerpType; - int adsAlignLerpType; - float adsMovementAnimLerpStart; - float adsMovementAnimLerpEnd; - float dualWieldViewModelOffset; - float fScopeDriftDelay; - float fScopeDriftLerpInTime; - float fScopeDriftSteadyTime; - float fScopeDriftLerpOutTime; - float fScopeDriftSteadyFactor; - float fScopeDriftUnsteadyFactor; - int killIconRatio; - int iReloadAmmoAdd; - int iReloadStartAdd; - bool reloadTwoRound; - int ammoDropStockMin; - int ammoDropClipPercentMin; - int ammoDropClipPercentMax; - float cameraShakeScale; - int cameraShakeDuration; - float cameraShakeRadius; - int iExplosionRadius; - int iExplosionRadiusMin; - int iExplosionForceRadius; - int iExplosionInnerDamage; - int iExplosionOuterDamage; - float explosionForceScalar; - float damageConeAngle; - float bulletExplDmgMultMin; - float bulletExplDmgMult; - float bulletExplRadiusMult; - int iProjectileSpeed; - int iProjectileSpeedUp; - int iProjectileSpeedForward; - int iProjectileActivateDist; - int iProjectileDetonationRadius; - float projLifetime; - float projLifetimeStdDeviation; - float timeToAccelerate; - float projectileCurvature; - XModel* projectileModel; - int projExplosion; - FxCombinedDef projExplosionEffect; - FxCombinedDef projDudEffect; - FxCombinedDef projTimeoutEffect; - int iExplosionSteppedRadiusInner; - int iExplosionSteppedRadiusMid; - int iExplosionSteppedRadiusOuter; - int iExplosionSteppedDamageInner; - int iExplosionSteppedDamageMid; - int iExplosionSteppedDamageOuter; - float* parallelBounce; - float* perpendicularBounce; - FxCombinedDef vmProjBodyEffect; - FxCombinedDef projBodyEffect; - FxCombinedDef projTrailEffect; - FxCombinedDef projBeaconEffect; - vec3_t vProjectileColor; - int guidedMissileType; - float maxSteeringAccel; - int projIgnitionDelay; - FxCombinedDef projIgnitionEffect; - float fAdsAimPitch; - float adsInCrosshairAlphaStart; - float adsInCrosshairAlphaEnd; - float adsOutCrosshairAlphaStart; - float adsOutCrosshairAlphaEnd; - bool adsShouldShowCrosshair; - float fAdsGunKickPitchMin; - float fAdsGunKickPitchMax; - float fAdsGunKickYawMin; - float fAdsGunKickYawMax; - float fAdsGunKickMagMin; - float fAdsGunKickAccel; - float fAdsGunKickSpeedMax; - float fAdsGunKickSpeedDecay; - float fAdsGunKickStaticDecay; - float fAdsViewKickPitchMin; - float fAdsViewKickPitchMax; - float fAdsViewKickYawMin; - float fAdsViewKickYawMax; - float fAdsViewKickMagMin; - float fAdsViewScatterMin; - float fAdsViewScatterMax; - float fAdsSpread; - float fAdsSpreadNVG; - float adsSpreadStartFrac; - float adsSpreadEndFrac; - int iVisibilityAxis; - float fVisibilityUpOffset; - float fHipGunKickPitchMin; - float fHipGunKickPitchMax; - float fHipGunKickYawMin; - float fHipGunKickYawMax; - float fHipGunKickMagMin; - float fHipGunKickAccel; - float fHipGunKickSpeedMax; - float fHipGunKickSpeedDecay; - float fHipGunKickStaticDecay; - float fHipViewKickPitchMin; - float fHipViewKickPitchMax; - float fHipViewKickYawMin; - float fHipViewKickYawMax; - float fHipViewKickMagMin; - float fHipViewScatterMin; - float fHipViewScatterMax; - float multipleReloadClipPercentage; - float hipStartingGunKickPercent; - float hipStartingViewKickPercent; - int adsStartingKickBullets; - float adsStartingGunKickPercent; - float adsStartingViewKickPercent; - float hipEndingGunKickPercent; - float hipEndingViewKickPercent; - int adsEndingKickBullets; - float adsEndingGunKickPercent; - float adsEndingViewKickPercent; - float kickAlignedInputScalar; - float kickOpposedInputScalar; - float viewKickMaintainFraction; - float adsGunTiltPitchFactor; - float adsGunTiltYawFactor; - float adsGunTiltRollFactor; - float adsGunTiltOffset; - float hipGunTiltPitchFactor; - float hipGunTiltYawFactor; - float hipGunTiltRollFactor; - float hipGunTiltOffset; - bool useNewViewKick; - bool useNewGunKick; - bool useAngularViewKick; - bool useAngularGunKick; - float hipAngularViewKickDir[6]; - float hipAngularViewKickDev[6]; - float hipAngularViewKickStrengthMin[6]; - float hipAngularViewKickStrengthMax[6]; - float hipAngularViewKickPitchScale[6]; - float adsAngularViewKickDir[6]; - float adsAngularViewKickDev[6]; - float adsAngularViewKickStrengthMin[6]; - float adsAngularViewKickStrengthMax[6]; - float adsAngularViewKickPitchScale[6]; - int adsAngularViewKickBullet[6]; - bool adsAngularViewKickUseSet[6]; - float hipAngularGunKickDir[6]; - float hipAngularGunKickDev[6]; - float hipAngularGunKickStrengthMin[6]; - float hipAngularGunKickStrengthMax[6]; - float hipAngularGunKickPitchScale[6]; - float adsAngularGunKickDir[6]; - float adsAngularGunKickDev[6]; - float adsAngularGunKickStrengthMin[6]; - float adsAngularGunKickStrengthMax[6]; - float adsAngularGunKickPitchScale[6]; - int adsAngularGunKickBullet[6]; - bool adsAngularGunKickUseSet[6]; - float hipViewKickReturnAccelScale; - float adsViewKickReturnAccelScale; - float hipViewKickReturnSpeedCurveScale; - float adsViewKickReturnSpeedCurveScale; - float hipGunKickReturnAccelScale; - float adsGunKickReturnAccelScale; - float hipGunKickReturnSpeedCurveScale; - float adsGunKickReturnSpeedCurveScale; - float hipSpreadStandMoveMax; - float hipSpreadDuckedMoveMax; - float hipSpreadProneMoveMax; - float hipSpreadSprintMoveMax; - float hipSpreadInAirMoveMax; - float slideSpreadMoveMax; - WeaponOffsetCurveDescription weaponOffsetCurveHoldFireSlow; - WeaponOffsetCurveDescription weaponOffsetCurveHoldFireFast; - WeaponOffsetCurveDescription weaponOffsetCurveAds; - WeaponOffsetCurveDescription weaponOffsetCurveAlwaysOn; - WeaponOffsetCurveDescription weaponOffsetCurveKick; - WeaponOffsetCurveDescription weaponOffsetCurveSnapDecay; - int numWeaponOffsetPatterns; - WeaponOffsetPatternDescription* weaponOffsetPatterns; - int numWeaponOffsetPatternsKickOrSnapDecay; - WeaponOffsetPatternDescription** weaponOffsetPatternsKickOrSnapDecay; - float fightDist; - float maxDist; - const char* accuracyGraphName[2]; - vec2_t* originalAccuracyGraphKnots[2]; - unsigned __int16 originalAccuracyGraphKnotCount[2]; - int iPositionReloadTransTime; - float leftArc; - float rightArc; - float topArc; - float bottomArc; - float visualPitchLimitTop; - float visualPitchLimitBottom; - bool softLeftRightArc; - float accuracy; - float aiSpread; - float playerSpread; - float minTurnSpeed[2]; - float maxTurnSpeed[2]; - float pitchConvergenceTime; - float yawConvergenceTime; - float suppressTime; - float suppressTimeTargetKilled; - float aiReturnToDefaultSpeed[2]; - float maxRange; - float fAnimHorRotateInc; - float fPlayerPositionDist; - const char* szUseHintString; - const char* dropHintString; - unsigned int iUseHintStringIndex; - unsigned int dropHintStringIndex; - float horizViewJitter; - float vertViewJitter; - bool enableViewBounceFire; - float viewBounceFireDecay; - float viewBounceFireFrequency; - float viewBounceFirePitchScale; - float viewBounceFireRollScale; - float scanSpeed; - float scanAccel; - int scanPauseTime; - const char* szScript; - float adsSpeedMs[2]; - float adsAccelSec[2]; - bool deferDamageToParentVehicle; - bool useSteppedExplosionDamage; - float destabilizationRateTime; - float destabilizationCurvatureMax; - int destabilizeDistance; - float robotechMaxPitch; - float robotechMaxYaw; - float robotechFrequency; - float robotechVariancePitch; - float robotechVarianceYaw; - float robotechVarianceFrequency; - float* locationDamageMultipliers; - unsigned __int8* hitLocPriorityMap; - float unittypeMultipliers[7]; - RumbleInfo* fireRumble; - RumbleInfo* meleeImpactRumble; - float heatAccumulationPerShot; - float heatDissipationPerSecond; - float heatSmokeStartThreshold; - float heatSmokeStopThreshold; - bool heatIsOpenBolt; - int tracerStyle; - TracerDef* tracerType; - TracerDef* overchargeTracerType; - LaserDef* laserTypeViewModel; - LaserDef* laserTypeViewModelAlt; - LaserDef* laserTypeFriendly; - LaserDef* laserTypeEnemy; - bool turretADSEnabled; - float turretADSTime; - float turretFov; - float turretFovADS; - float turretScopeZoomRate; - float turretScopeZoomMin; - float turretScopeZoomMax; - float turretOverheatPenalty; - SndAliasLookup turretOverheatSound; - FxCombinedDef turretOverheatEffect; - RumbleInfo* turretBarrelSpinRumble; - float turretBarrelSpinSpeed; - float turretBarrelSpinUpTime; - float turretBarrelSpinDownTime; - SndAliasLookup turretBarrelSpinMaxSnd; - SndAliasLookup turretBarrelSpinUpSnd[4]; - SndAliasLookup turretBarrelSpinDownSnd[4]; - SndAliasLookup missileConeSoundAlias; - SndAliasLookup missileConeSoundAliasAtBase; - float missileConeSoundRadiusAtTop; - float missileConeSoundRadiusAtBase; - float missileConeSoundHeight; - float missileConeSoundOriginOffset; - float missileConeSoundVolumescaleAtCore; - float missileConeSoundVolumescaleAtEdge; - float missileConeSoundVolumescaleCoreSize; - float missileConeSoundPitchAtTop; - float missileConeSoundPitchAtBottom; - float missileConeSoundPitchTopSize; - float missileConeSoundPitchBottomSize; - float missileConeSoundCrossfadeTopSize; - float missileConeSoundCrossfadeBottomSize; - bool meleeOverrideValues; - float aim_automelee_lerp; - float aim_automelee_region_height; - float aim_automelee_region_width; - float aim_automelee_maxPitchMovement; - float aim_automelee_maxYawMovement; - float player_meleeHeight; - float player_meleeWidth; - float playerMeleeRangeStanding; - float playerMeleeRangeCrouched; - float playerMeleeRangeProne; - float playerMeleeRangeChargeStanding; - float playerMeleeRangeChargeCrouched; - float playerMeleeChargeHeightTolerance; - bool shieldAllowFiring; - int shieldMaxSpeed; - bool shieldAlwaysDisplay; - Gesture* shieldDeployGesture; - Gesture* shieldFireWeapGesture; - Gesture* shieldDeployWhileFiring; - Gesture* shieldRetractWhileFiring; - Gesture* shieldBashGesture; - FxCombinedDef shieldMeleeFx; - float shieldMeleeFxDelay; - float HitEarthquakeScale; - float HitEarthquakeDuration; - float HitEarthquakeRadius; - RumbleInfo* shieldHitRumble; - float MissEarthquakeScale; - float MissEarthquakeDuration; - float MissEarthquakeRadius; - RumbleInfo* shieldMissRumble; - int shieldDeployButton; - bool shieldUsesEnergy; - float shieldMaxEnergy; - float shieldConsumptionRate; - float shieldMeleeEnergyCost; - float shieldMeleeHitEnergyCost; - float reactiveMotionRadiusScale; - float reactiveMotionFrequencyScale; - float reactiveMotionAmplitudeScale; - float reactiveMotionFalloff; - float reactiveMotionLifetime; - unsigned __int8 transientBaseViewFlags; - unsigned __int8 transientBaseWorldFlags; - bool hasAnyTransientModels; - bool blendFireAnimations; - bool sharedAmmo; - bool lockonSupported; - bool requireLockonToFire; - bool isAirburstWeapon; - bool bigExplosion; - bool noAdsWhenMagEmpty; - bool avoidDropCleanup; - bool allowGrenadeSwitching; - bool inheritsPerks; - bool forceUse; - bool ladderWeapon; - bool executionVictimHiddenWeapon; - bool crosshairColorChange; - bool bRifleBullet; - bool bEnergyBullet; - bool bIncendiaryBullet; - bool armorPiercing; - bool impaling; - bool bBoltAction; - bool aimDownSight; - bool canHoldBreath; - bool meleeOnly; - bool supportsAlternateMelee; - bool bRechamberWhileAds; - bool reloadWhileAds; - bool bBulletExplosiveDamage; - bool bCookOffHold; - bool overCookIsNotLethal; - bool reticleSpin45; - bool bClipOnly; - bool bDoesNotConsumeAmmo; - bool bRemoveWeaponOnEmpty; - bool noAmmoPickup; - bool adsFireOnly; - bool cancelAutoHolsterWhenEmpty; - bool disableSwitchToWhenEmpty; - bool suppressAmmoPrimaryDisplay; - bool suppressAmmoReserveDisplay; - LaserSettings laserSettings; - bool markableViewmodel; - bool isPredictedProjectile; - int clientTrajectoryBlendOutTime; - int serverTrajectoryBlendInTime; - int dualWieldType; - bool flipKillIcon; - bool bNoPartialReload; - bool reloadDisabled; - bool blocksProne; - bool silenced; - bool doNotSuppressAI; - bool isRollingGrenade; - bool dropGrenadeHeldOnDeath; - bool projExplosionEffectForceNormalUp; - bool projExplosionEffectInheritParentDirection; - bool bProjImpactExplode; - bool spawnProjAtMuzzle; - bool correctBulletTrajectory; - float maxCorrectionAngle; - bool disableProjectileCrumpleCheck; - bool bProjTrajectoryEvents; - bool bProjWhizByEnabled; - bool stickToPlayers; - bool stickToVehicles; - bool stickToTurrets; - bool stickToNonStick; - bool projEnableMissileStickiness; - bool enableMissileRicochet; - bool thrownSideways; - bool disableFiring; - bool firesOnWeaponSwitch; - bool disableHolding; - bool timedDetonation; - float missileRicochetMinAngleOfIncidence; - float missileCrumpleMinSpeed; - int detonateType; - XModel* detonatorWorldModel; - int explosiveDamageDelay; - int fuseTime; - int aiFuseTime; - int maxHoldTime; - GrenadeRotationParams rotationParams; - bool holdButtonToThrow; - bool autoHold; - bool infiniteHold; - bool freezeMovementWhenFiring; - bool offhandAllowsSprint; - bool thermalScope; - bool thermalToggle; - bool outlineEnemies; - bool outlineDepthTest; - bool outlineFill; - float enemyOutlineR; - float enemyOutlineG; - float enemyOutlineB; - float enemyOutlineA; - float allyOutlineR; - float allyOutlineG; - float allyOutlineB; - float allyOutlineA; - bool depthScan; - float depthScanThickness; - float depthScanR; - float depthScanG; - float depthScanB; - float depthScanA; - float depthScanOutlineThickness; - float depthScanOutlineR; - float depthScanOutlineG; - float depthScanOutlineB; - float depthScanOutlineA; - bool depthScanOverlay; - float depthScanOverlayStrength; - float depthScanOverlayXTiles; - float depthScanOverlayYTiles; - float depthScanOverlayXScroll; - float depthScanOverlayYScroll; - float blurSceneAdsInFraction; - float blurSceneAdsOutFraction; - bool altModeSameWeapon; - bool playAltGesturesForOffhandWeapons; - bool turretBarrelSpinEnabled; - bool missileConeSoundEnabled; - bool missileConeSoundPitchshiftEnabled; - bool missileConeSoundCrossfadeEnabled; - bool offhandHoldIsCancelable; - bool doNotAllowAttachmentsToOverrideSpread; - bool useScopeDrift; - bool alwaysShatterGlassOnImpact; - bool jumpSpread; - bool noFullViewmodelAnimations; - float killcamOffset; - bool useDualFOV; - bool showViewModelInDualFOV; - bool syncedFOVInDualFOV; - bool disableDrop; - bool preferredDrop; - Gesture* gestureAnimation; - float gestureFireStateTime; - Gesture* gesturePullback; - Gesture* gesturePullbackAlt; - float minPullbackTime; - float minPullbackToThrowBlendTime; - float maxPullbackToThrowBlendTime; - Gesture* gestureThrow; - Gesture* gestureThrowAlt; - float gestureFireTime; - Gesture* gestureDetonate; - Gesture* gestureDetonateAlt; - float gestureDetonationTime; - bool gesturesDisablePrimary; - FxCombinedDef cameraFireEffect; - float cameraFireEffectDurationSec; - float changedFireTime; - float changedFireTimeAkimbo; - int changedFireTimeNumBullets; - int chargeType; - float chargeGain; - float chargeCostPerShot; - float chargeLossWhenIdle; - float chargeEmptyCooldown; - float chargeFireAtMaxDamageMultiplier; - int chargeMeterEffectBoneCount; - FxCombinedDef chargeMeterEffect; - SndAliasLookup chargeUpSound; - SndAliasLookup chargeDownSound; - SndAliasLookup chargeUpSoundPlayer; - SndAliasLookup chargeDownSoundPlayer; - SndAliasLookup chargeDownToUpSound; - SndAliasLookup chargeDownToUpSoundPlayer; - SndAliasLookup chargeUpToDownSound; - SndAliasLookup chargeUpToDownSoundPlayer; - SndAliasLookup chargeMaxSound; - SndAliasLookup chargeMaxSoundPlayer; - bool chargeHudReveal; - RumbleInfo* chargeRumble; - scr_string_t stowTag; - XModel* stowOffsetModel; - scr_string_t stowOffsetAttachTag; - int slot; - float maxTargetAngle; - bool spaceshipSecondaryWeapon; - float impulseFieldRadius; - float impulseFieldInitialSpeed; - float impulseFieldMaxSpeed; - float impulseFieldAcceleration; - float impulseFieldInAirImpulseMultiplier; - float impulseFieldInAirImpulseMultiplierInterpTime; - float impulseFieldSlideMultiplier; - float impulseFieldSlideMultiplierInterpTime; - bool impulseFieldIsPush; - bool impulseFieldAffectsFriendlies; - bool impulseFieldAffectsSelf; - bool impulseFieldAffectsProne; - bool regenerationEnabled; - int regenerationTimeMs; - int regenerationAddTimeMs; - int regenerationAmount; - bool regenerationConsumeStock; - bool regenerationDisableWhileFiring; - int deployType; - bool deployRequireOnWalkableSurface; - bool deployRequireOnNavmesh; - bool deployRequireSkyAbove; - bool deployRequireNoOverhang; - bool deployAlwaysUpright; - bool deployEdgeSnap; - float deployCylinderRadius; - float deployCylinderHeight; - float deployMaxDistance; - float deployMaxHeightAboveEye; - float deployEffectHeightOffset; - float deployMaxSlope; - FxCombinedDef deployEffect; - int deployValidGroupId; - int deployIndoorGroupId; - int deployInvalidGroupId; - int deployOutOfRangeGroupId; - int numAnimOverrides; - AnimOverride* animOverrides; - CarryAnimOverride carryAnimOverrides[5]; - int numSfxOverrides; - SFXOverride* sfxOverrides; - int numVfxOverrides; - VFXOverride* vfxOverrides; - float reactiveEmitterDelay; - float grenadeDangerIconDistance; - float bulletDirGunAngleModifierIdleHip; - float bulletDirGunAngleModifierIdleAds; - float bulletDirGunAngleModifierGunKickHip; - float bulletDirGunAngleModifierGunKickAds; - float bulletDirGunAngleModifierGunTiltHip; - float bulletDirGunAngleModifierGunTiltAds; - float viewClampPitchCatchUpTimeSec; - float viewClampYawCatchUpTimeSec; - bool mountTopEnable; - bool mountTopYawClamp; - float mountTopYawMax; - float mountTopGunKickScale; - float mountTopGunCenterScale; - float mountTopViewKickScale; - float mountTopViewCenterScale; - float mountTopGunIdleMotionScale; - float mountTopViewIdleMotionScale; - int mountTopEnterDurationMs; - int mountTopExitDurationMs; - float mountTopEdgeToEyeDistanceForward; - float mountTopEdgeToEyeDistanceAbove; - bool mountSideEnable; - bool mountSideTransitionEnable; - float mountSideRoll; - float mountSideRollStartFrac; - float mountSideRollEndFrac; - float mountSideGunKickScale; - float mountSideGunCenterScale; - float mountSideViewKickScale; - float mountSideViewCenterScale; - float mountSideGunIdleMotionScale; - float mountSideViewIdleMotionScale; - int mountSideEnterDurationMs; - int mountSideExitDurationMs; - float mountSideEdgeToEyeDistanceForward; - float mountSideEdgeToEyeDistanceAbove; - float mountViewmodelOffset; - float mountFOVScale; - RumbleInfo* mountRumble; - WeaponOffsetPatternScaleInfo mountWeaponOffsetPatternScaleInfo; - float adsFireMotionBlur; - int adsFireMotionBlurDurationMs; - float adsFireMotionBlurDecayExponent; - float hipFireMotionBlur; - int hipFireMotionBlurDurationMs; - float hipFireMotionBlurDecayExponent; - float adsCameraShakeRotationScale; - float adsCameraShakeTranslationScale; - AdvancedIdleSettings advancedIdleSettings; - WeaponOffsetPatternScaleInfo crouchedWeaponOffsetPatternScaleInfo; - WeaponOffsetPatternScaleInfo proneWeaponOffsetPatternScaleInfo; - BallisticInfo ballisticInfo; - WeaponEntityNotify* notifyTypes[2]; - float dlcFloat[6]; - bool dlcBool[3]; - bool enableWeaponInspect; - bool stowedOcclusionTestEnabled; - bool ignoreMinTracerSpawnDistance; - bool tracerOverrideEnabled; - bool boltActionReloadIncludesRechamber; -}; - - -struct WeaponCompleteDef -{ - const char* szInternalName; - WeaponDef weapDef; - const char* szDisplayName; - const char* szLootTable; - scr_string_t* hideTags; - AttachmentList attachments[14]; - unsigned int numLootVariants; - unsigned int numNotetrackSoundMappings; - scr_string_t* notetrackSoundMapKeys; - scr_string_t* notetrackSoundMapValues; - unsigned int numNotetrackOverrides; - void* /*NoteTrackToSoundEntry*/ notetrackOverrides; - unsigned int numNotetrackSuitEntries; - void* /*NoteTrackToSuitSoundEntry*/ notetrackSuitEntries; - ZoomSettings zoomSettings; - int iAdsTransInTime; - int iAdsTransOutTime; - int iAdsTransInToOutTime; - int iAdsTransOutToInTime; - int iClipSize; - int vfxImpactType; - float penetrateMultiplier; - float fAdsViewKickCenterSpeed; - float fHipViewKickCenterSpeed; - Material* killIconMat; - Material* dpadIconMat; - Material* dpadIconInactiveMat; - GfxImage* killIconImg; - GfxImage* dpadIconImg; - GfxImage* dpadIconInactiveImg; - int ammoDropStockMax; - bool useSceneDof; - float adsDofPhysicalFstop; - float adsDofPhysicalFocusDistance; - bool adsDofPhysicalFocalTag; - float adsDofPhysicalReloadFstop; - float adsDofPhysicalReloadFocusDistance; - unsigned __int16 accuracyGraphKnotCount[2]; - vec2_t* accuracyGraphKnots[2]; - bool enhanced; - bool dpadIconShowsAmmo; - bool luiWeaponInfoWidgetUsesScopeStencil; - const char* szAltModeInactiveName; - const char* dynamicIconAnimationName; - bool isUsingDynamicIcon; - const char* szLUIWeaponInfoWidgetName; - const char* szLUIWeaponInfoWidgetTag; - const char* szLUICrosshairWidget; -}; - -union XAssetHeader -{ - //PhysicsLibrary* physicsLibrary; - //PhysicsSFXEventAsset* physicsSFXEventAsset; - //PhysicsVFXEventAsset* physicsVFXEventAsset; - PhysicsAsset* physicsAsset; - //PhysicsFXPipeline* physicsFXPipeline; - //PhysicsFXShape* physicsFXShape; - //PhysicsDebugData* physicsDebugData; - //XAnimParts* parts; - //XModelSurfs* modelSurfs; - XModel* model; - //MayhemData* mayhem; - Material* material; - //ComputeShader* computeShader; - //MaterialSerializedShader* serializedShader; - //MaterialTechniqueSet* techniqueSet; - GfxImage* image; - //SndGlobals* soundGlobals; - //SndBankResident* soundBankResident; - //SndBankTransient* soundBankTransient; - clipMap_t* clipMap; - //ComWorld* comWorld; - //GlassWorld* glassWorld; - //PathData* pathData; - //NavMeshData* navMeshData; - //TacticalGraphData* tacGraphData; - MapEnts* mapEnts; - //FxWorld* fxWorld; - //GfxWorld* gfxWorld; - //GfxWorldTransientZone* gfxWorldTransientZone; - //GfxIESProfile* iesProfile; - //GfxLightDef* lightDef; - //GfxGradingClut* gradingClut; - //GfxFogSpline* fogSpline; - //AnimationClass* animClass; - //PlayerAnimScript* playerAnim; - Gesture* gesture; - LocalizeEntry* localize; - //WeaponAttachment* attachment; - WeaponCompleteDef* weapon; - //ParticleSystemDef* vfx; - //FxImpactTable* impactFx; - SurfaceFxTable* surfaceFx; - RawFile* rawfile; - ScriptFile* scriptfile; - ScriptDebugData* scriptDebugData; - StringTable* stringTable; - LeaderboardDef* leaderboardDef; - VirtualLeaderboardDef* virtualLeaderboardDef; - DDLFile* ddlFile; - TracerDef* tracerDef; - VehicleDef* vehDef; - AddonMapEnts* addonMapEnts; - NetConstStrings* netConstStrings; - LuaFile* luaFile; - ScriptableDef* scriptable; - EquipmentSoundTable* equipSndTable; - VectorField* vectorField; - FxParticleSimAnimation* particleSimAnimation; - StreamingInfo* streamingInfo; - LaserDef* laserDef; - TTFDef* ttfDef; - SuitDef* suitDef; - SuitAnimPackage* suitAnimPackage; - CameraDef* cameraDef; - HudOutlineDef* hudOutlineDef; - SpaceshipTargetDef* spaceshipTargetDef; - RumbleInfo* rumble; - RumbleGraph* rumbleGraph; - //WeaponAnimPackage* weaponAnimPackage; - //WeaponSFXPackage* weaponSFXPackage; - //WeaponVFXPackage* weaponVFXPackage; - //FootstepVFX* footstepVFX; - //BehaviorTree* behaviorTree; - //Animset* animset; - //ASM* asmAsset; - //XAnimProceduralBones* proceduralBones; - //XAnimDynamicBones* dynamicBones; - //ReticleDef* reticleDef; - //XAnimCurve* xanimCurve; - //CoverSelector* coverSelector; - //EnemySelector* enemySelector; - //ClientCharacter* clientCharacter; - //ClothAsset* clothAsset; - //CinematicMotionDef* cinematicMotion; - //AccessoryDef* accessory; - //LocDmgTable* locDmgTable; - //BulletPenetration* bulletPenetration; - //ScriptBundle* scriptBundle; - //BlendSpace2DDef* blendSpace2DDef; - //XCam* xcam; - //Camo* camo; - //XCompositeModelDef* compositeModel; - //XModelDetailCollision* modelDetailCollision; - //StreamKey* streamKey; - //StreamTreeOverride* streamTreeOverride; - //KeyValuePairs* keyValuePairs; - //StTerrain* stTerrain; - //NativeScriptPatchFile* nativeScriptPatch; - //CollisionTile* collisionTile; - //ExecutionDef* executionDef; - //CarryObjectDef* carryObjectDef; - //SoundBankListDef* soundBankListDef; - //GfxDecalVolumeMaterial* decalVolumeMaterial; - //GfxDecalVolumeMask* decalVolumeMask; - //DynEntityList* dynEntityList; - void* data; - //FxWorldTransientZone* fxWorldTransientZone; - //DLogSchema* dlogSchema; - //MapEdgeList* mapEdgeList; -}; - -enum XAssetType -{ - ASSET_TYPE_PHYSICSLIBRARY = 0x0, - ASSET_TYPE_PHYSICSSFXEVENTASSET = 0x1, - ASSET_TYPE_PHYSICSVFXEVENTASSET = 0x2, - ASSET_TYPE_PHYSICSASSET = 0x3, - ASSET_TYPE_PHYSICSFXPIPELINE = 0x4, - ASSET_TYPE_PHYSICSFXSHAPE = 0x5, - ASSET_TYPE_PHYSICSDEBUGDATA = 0x6, - ASSET_TYPE_XANIM = 0x7, - ASSET_TYPE_XMODELSURFS = 0x8, - ASSET_TYPE_XMODEL = 0x9, - ASSET_TYPE_MAYHEM = 0xA, - ASSET_TYPE_MATERIAL = 0xB, - ASSET_TYPE_COMPUTESHADER = 0xC, - ASSET_TYPE_LIBSHADER = 0xD, - ASSET_TYPE_VERTEXSHADER = 0xE, - ASSET_TYPE_HULLSHADER = 0xF, - ASSET_TYPE_DOMAINSHADER = 0x10, - ASSET_TYPE_PIXELSHADER = 0x11, - ASSET_TYPE_TECHSET = 0x12, - ASSET_TYPE_IMAGE = 0x13, - ASSET_TYPE_SOUNDGLOBALS = 0x14, - ASSET_TYPE_SOUNDBANK = 0x15, - ASSET_TYPE_SOUNDBANKTRANSIENT = 0x16, - ASSET_TYPE_COL_MAP = 0x17, - ASSET_TYPE_COM_MAP = 0x18, - ASSET_TYPE_GLASS_MAP = 0x19, - ASSET_TYPE_AIPATHS = 0x1A, - ASSET_TYPE_NAVMESH = 0x1B, - ASSET_TYPE_TACGRAPH = 0x1C, - ASSET_TYPE_MAP_ENTS = 0x1D, - ASSET_TYPE_FX_MAP = 0x1E, - ASSET_TYPE_GFX_MAP = 0x1F, - ASSET_TYPE_GFX_MAP_TRZONE = 0x20, - ASSET_TYPE_IESPROFILE = 0x21, - ASSET_TYPE_LIGHTDEF = 0x22, - ASSET_TYPE_GRADINGCLUT = 0x23, - ASSET_TYPE_UI_MAP = 0x24, - ASSET_TYPE_FOGSPLINE = 0x25, - ASSET_TYPE_ANIMCLASS = 0x26, - ASSET_TYPE_PLAYERANIM = 0x27, - ASSET_TYPE_GESTURE = 0x28, - ASSET_TYPE_LOCALIZE = 0x29, - ASSET_TYPE_ATTACHMENT = 0x2A, - ASSET_TYPE_WEAPON = 0x2B, - ASSET_TYPE_VFX = 0x2C, - ASSET_TYPE_IMPACTFX = 0x2D, - ASSET_TYPE_SURFACEFX = 0x2E, - ASSET_TYPE_AITYPE = 0x2F, - ASSET_TYPE_MPTYPE = 0x30, - ASSET_TYPE_CHARACTER = 0x31, - ASSET_TYPE_XMODELALIAS = 0x32, - ASSET_TYPE_RAWFILE = 0x33, - ASSET_TYPE_SCRIPTFILE = 0x34, - ASSET_TYPE_SCRIPTDEBUGDATA = 0x35, - ASSET_TYPE_STRINGTABLE = 0x36, - ASSET_TYPE_LEADERBOARDDEF = 0x37, - ASSET_TYPE_VIRTUALLEADERBOARDDEF = 0x38, - ASSET_TYPE_DDL = 0x39, - ASSET_TYPE_TRACER = 0x3A, - ASSET_TYPE_VEHICLE = 0x3B, - ASSET_TYPE_ADDON_MAP_ENTS = 0x3C, - ASSET_TYPE_NETCONSTSTRINGS = 0x3D, - ASSET_TYPE_LUAFILE = 0x3E, - ASSET_TYPE_SCRIPTABLE = 0x3F, - ASSET_TYPE_EQUIPSNDTABLE = 0x40, - ASSET_TYPE_VECTORFIELD = 0x41, - ASSET_TYPE_PARTICLESIMANIMATION = 0x42, - ASSET_TYPE_STREAMINGINFO = 0x43, - ASSET_TYPE_LASER = 0x44, - ASSET_TYPE_TTF = 0x45, - ASSET_TYPE_SUIT = 0x46, - ASSET_TYPE_SUITANIMPACKAGE = 0x47, - ASSET_TYPE_CAMERA = 0x48, - ASSET_TYPE_HUDOUTLINE = 0x49, - ASSET_TYPE_SPACESHIPTARGET = 0x4A, - ASSET_TYPE_RUMBLE = 0x4B, - ASSET_TYPE_RUMBLEGRAPH = 0x4C, - ASSET_TYPE_ANIMPKG = 0x4D, - ASSET_TYPE_SFXPKG = 0x4E, - ASSET_TYPE_VFXPKG = 0x4F, - ASSET_TYPE_FOOTSTEPVFX = 0x50, - ASSET_TYPE_BEHAVIORTREE = 0x51, - ASSET_TYPE_AIANIMSET = 0x52, - ASSET_TYPE_AIASM = 0x53, - ASSET_TYPE_PROCEDURALBONES = 0x54, - ASSET_TYPE_DYNAMICBONES = 0x55, - ASSET_TYPE_RETICLE = 0x56, - ASSET_TYPE_XANIMCURVE = 0x57, - ASSET_TYPE_COVERSELECTOR = 0x58, - ASSET_TYPE_ENEMYSELECTOR = 0x59, - ASSET_TYPE_CLIENTCHARACTER = 0x5A, - ASSET_TYPE_CLOTHASSET = 0x5B, - ASSET_TYPE_CINEMATICMOTION = 0x5C, - ASSET_TYPE_ACCESSORY = 0x5D, - ASSET_TYPE_LOCDMGTABLE = 0x5E, - ASSET_TYPE_BULLETPENETRATION = 0x5F, - ASSET_TYPE_SCRIPTBUNDLE = 0x60, - ASSET_TYPE_BLENDSPACE2D = 0x61, - ASSET_TYPE_XCAM = 0x62, - ASSET_TYPE_CAMO = 0x63, - ASSET_TYPE_XCOMPOSITEMODEL = 0x64, - ASSET_TYPE_XMODELDETAILCOLLISION = 0x65, - ASSET_TYPE_STREAMKEY = 0x66, - ASSET_TYPE_STREAMTREEOVERRIDE = 0x67, - ASSET_TYPE_KEYVALUEPAIRS = 0x68, - ASSET_TYPE_STTERRAIN = 0x69, - ASSET_TYPE_NATIVESCRIPTPATCH = 0x6A, - ASSET_TYPE_COLLISIONTILE = 0x6B, - ASSET_TYPE_EXECUTION = 0x6C, - ASSET_TYPE_CARRYOBJECT = 0x6D, - ASSET_TYPE_SOUNDBANKLIST = 0x6E, - ASSET_TYPE_DECALVOLUMEMATERIAL = 0x6F, - ASSET_TYPE_DECALVOLUMEMASK = 0x70, - ASSET_TYPE_DYNENTITYLIST = 0x71, - ASSET_TYPE_FX_MAP_TRZONE = 0x72, - ASSET_TYPE_DLOGSCHEMA = 0x73, - ASSET_TYPE_EDGELIST = 0x74, -}; - -struct XAsset -{ - XAssetType type; - XAssetHeader header; -}; - -struct ScriptStringList -{ - int count; - bool loaded; - const char** strings; -}; - -struct XAssetList -{ - ScriptStringList stringList; - unsigned int assetCount; - unsigned int assetReadPos; - XAsset* assets; -}; - +#pragma once +#include "Main.hpp" + +struct RumbleGraph; +struct RumbleInfo; +struct CameraDef; +struct GfxImage; +struct Material; +struct Bounds; +struct FxCombinedDef; + +struct vec2_t +{ + float v[2]; +}; + +struct vec3_t +{ + float v[3]; +}; + +struct vec4_t +{ + float v[4]; +}; + +typedef int scr_string_t; + +struct Bounds +{ + vec3_t midPoint; + vec3_t halfSize; +}; + +struct GfxDrawSurfFields +{ + unsigned __int64 indirectArgsOffset : 10; + unsigned __int64 gpBatchIndex : 16; + unsigned __int64 objectId : 24; + unsigned __int64 hasGfxEntIndex : 1; + unsigned __int64 lightmapIndex : 9; + unsigned __int64 shadowcaster : 1; + unsigned __int64 materialSortedIndex : 16; + unsigned __int64 tessellation : 3; + unsigned __int64 prepass : 2; + unsigned __int64 viewModelRender : 1; + unsigned __int64 lowResShading : 1; + unsigned __int64 surfType : 4; + unsigned __int64 primarySortKey : 6; +}; + +struct EffectDefMap { + char name[64]; + char filename[256]; +}; + +struct Packed128 +{ + unsigned __int64 p0; + unsigned __int64 p1; +}; + +union GfxDrawSurf +{ + GfxDrawSurfFields fields; + Packed128 packed; +}; + +struct MaterialTextureDef +{ + unsigned __int8 index; + GfxImage* image; +}; + +struct MaterialConstantDef +{ + unsigned __int8 index; + vec4_t literal; +}; + +struct GfxDecalVolumeMaterial +{ + const char* name; + GfxImage* channels[6]; + unsigned int flags; + vec3_t colorTint; + float alphaDissolveParms; + float emissiveScale; + unsigned int packedDisplacementScaleAndBias; + float displacementCutoffDistance; + float displacementCutoffFalloff; + unsigned int packedTemperatureBaseAndScale; + unsigned __int8 textureAtlasRowCount; + unsigned __int8 textureAtlasColumnCount; + unsigned __int8 padding[6]; +}; + +struct PhysicsAssetUsageCounter +{ + int serverEnt; + int clientEnt; + int dynEnt; +}; + +struct __declspec(align(4)) PhysicsAsset +{ + const char* name; + char* havokData; + unsigned int havokDataSize; + int useCategory; + int numRigidBodies; + int numConstraints; + uintptr_t simulationCategories; + unsigned int* bodyContents; + int numSFXEventAssets; + int numVFXEventAssets; + uintptr_t sfxEventAssets; + uintptr_t vfxEventAssets; + PhysicsAssetUsageCounter usageCounter; + bool containsDynamicBodies; +}; + +struct Material +{ + const char* name; + unsigned int contents; + unsigned int surfaceFlags; + float maxDisplacement; + int /*MaterialGeometryType*/ materialType; + unsigned __int8 cameraRegion; + unsigned __int8 sortKey; + unsigned __int16 flags; + unsigned __int8 textureCount; + unsigned __int8 constantCount; + unsigned __int8 constantBufferCount; + unsigned __int8 layerCount; + unsigned __int16 packedAtlasDataSize; + unsigned __int8 textureAtlasRowCount; + unsigned __int8 textureAtlasColumnCount; + GfxDrawSurf drawSurf; + unsigned __int8* packedAtlasData; + void* /*MaterialTechniqueSet*/ techniqueSet; + MaterialTextureDef* textureTable; + MaterialConstantDef* constantTable; + GfxDecalVolumeMaterial* decalVolumeMaterial; + unsigned __int8* constantBufferIndex; + void* /*MaterialConstantBufferDef*/ constantBufferTable; + const char** subMaterials; +}; + +enum GfxTextureId : __int32 +{ + NULLID = 0x0, +}; + +enum GfxPixelFormat : __int32 +{ + GFX_PF_INVALID = 0x0, + GFX_PF_R8 = 0x1, + GFX_PF_A8 = 0x2, + GFX_PF_L8 = 0x3, + GFX_PF_R8G8 = 0x4, + GFX_PF_L8A8 = 0x5, + GFX_PF_R8G8B8A8 = 0x6, + GFX_PF_R8G8B8A8_SRGB = 0x7, + GFX_PF_R8_SNORM = 0x8, + GFX_PF_R8G8_SNORM = 0x9, + GFX_PF_R16 = 0xA, + GFX_PF_R16G16 = 0xB, + GFX_PF_R16G16B16A16 = 0xC, + GFX_PF_R16_SNORM = 0xD, + GFX_PF_R16F = 0xE, + GFX_PF_R16G16F = 0xF, + GFX_PF_R16G16B16A16F = 0x10, + GFX_PF_R32F = 0x11, + GFX_PF_R32G32F = 0x12, + GFX_PF_R32G32B32A32F = 0x13, + GFX_PF_D16 = 0x14, + GFX_PF_D32F = 0x15, + GFX_PF_D32F_S8 = 0x16, + GFX_PF_R8_UINT = 0x17, + GFX_PF_R16_UINT = 0x18, + GFX_PF_R32_UINT = 0x19, + GFX_PF_R32G32_UINT = 0x1A, + GFX_PF_R32G32B32A32_UINT = 0x1B, + GFX_PF_R10G10B10A2_UINT = 0x1C, + GFX_PF_R5G6B5 = 0x1D, + GFX_PF_R10G10B10A2 = 0x1E, + GFX_PF_R9G9B9E5_SHAREDEXP = 0x1F, + GFX_PF_R11G11B10F = 0x20, + GFX_PF_BC1 = 0x21, + GFX_PF_BC1_SRGB = 0x22, + GFX_PF_BC2 = 0x23, + GFX_PF_BC2_SRGB = 0x24, + GFX_PF_BC3 = 0x25, + GFX_PF_BC3_SRGB = 0x26, + GFX_PF_BC4 = 0x27, + GFX_PF_BC5 = 0x28, + GFX_PF_BC5S = 0x29, + GFX_PF_BC6H = 0x2A, + GFX_PF_BC6HS = 0x2B, + GFX_PF_BC7 = 0x2C, + GFX_PF_BC7_SRGB = 0x2D, + GFX_PF_R8G8B8A8_SNORM = 0x2E, + GFX_PF_R1 = 0x2F, + GFX_PF_R4G4 = 0x30, + GFX_PF_R10G10B10A2_SNORM = 0x31, + GFX_PF_COUNT = 0x32, +}; + +enum GfxImageFlags +{ + IMG_FLAG_NONE = 0x0, + IMG_DISK_FLAG_NOPICMIP = 0x1, + IMG_DISK_FLAG_NOMIPMAPS = 0x2, + IMG_DISK_FLAG_UNUSED = 0x4, + IMG_DISK_FLAG_NORMAL_OCCLUSON_GLOSS = 0x8, + IMG_DISK_FLAG_CLAMP_U = 0x10, + IMG_DISK_FLAG_CLAMP_V = 0x20, + IMG_DISK_FLAG_STREAMED = 0x40, + IMG_DISK_FLAG_USE_OODLE_COMPRESSION = 0x80, + IMG_DISK_FLAG_GAMMA_SRGB = 0x100, + IMG_DISK_FLAG_PACKED_ATLAS = 0x200, + IMG_CREATE_FLAG_UNTILED = 0x400, + IMG_CREATE_FLAG_CPU_READ = 0x800, + IMG_CREATE_FLAG_CPU_WRITE = 0x1000, + IMG_DISK_FLAG_AUTOMETALNESS = 0x2000, + IMG_DISK_FLAG_AUTODISPLACEMENT = 0x4000, + IMG_DISK_FLAG_MAPTYPE_2D = 0x0, + IMG_DISK_FLAG_MAPTYPE_CUBE = 0x8000, + IMG_DISK_FLAG_MAPTYPE_3D = 0x10000, + IMG_DISK_FLAG_MAPTYPE_1D = 0x18000, + IMG_DISK_FLAG_MAPTYPE_ARRAY = 0x20000, + IMG_DISK_FLAG_MAPTYPE_CUBE_ARRAY = 0x28000, + IMG_DISK_FLAG_INVERT_ALPHA = 0x40000, + IMG_DISK_FLAG_PREMUL_ALPHA = 0x80000, + IMG_DISK_FLAG_MIPGEN_ORIGINAL = 0x0, + IMG_DISK_FLAG_MIPGEN_LANCZOS3 = 0x100000, + IMG_DISK_FLAG_MIPGEN_CATMULL_ROM = 0x200000, + IMG_DISK_FLAG_MIPGEN_CUBIC_BSPLINE = 0x300000, + IMG_DISK_FLAG_MIPGEN_BOX = 0x400000, + IMG_DISK_FLAG_MIPGEN_COVERAGE_PRESERVING = 0x500000, + IMG_CREATE_FLAG_RW_VIEW = 0x800000, + IMG_CREATE_FLAG_DYNAMIC = 0x1000000, + IMG_DISK_FLAG_PREMUL_KEEP_ALPHA = 0x2000000, + IMG_DISK_FLAG_RTT = 0x4000000, + IMG_DISK_FLAG_EXTRACT_ALPHA = 0x8000000, + IMG_DISK_FLAG_OCTAHEDRON = 0x10000000, + IMG_CREATE_FLAG_STAGING = 0x20000000, + IMG_CREATE_FLAG_VOLUMETRIC_LAYOUT_OVERRIDE = 0x40000000, + IMG_CREATE_FLAG_TYPELESS = 0x80000000, +}; + +union GfxImageSemanticSpecific +{ + float atlasFps; + unsigned int albedoMapScaleBias; + unsigned int normalMapScaleBias; + unsigned int maxMipMap; +}; + +struct GfxImageAtlasSize +{ + unsigned __int8 rowCount; + unsigned __int8 colCount; +}; + +union GfxImageAtlasInfo +{ + GfxImageAtlasSize atlasSize; + unsigned __int16 packedAtlasDataSize; +}; + +enum TextureSemantic : __int8 +{ + TS_2D = 0x0, + TS_FUNCTION = 0x1, + TS_COLOR_MAP = 0x2, + TS_GRAY_MAP = 0x3, + TS_SIGNED_VELOCITY_MAP = 0x4, + TS_NORMAL_MAP = 0x5, + TS_METALNESS_MAP = 0x6, + TS_NORMAL_OCCLUSION_GLOSS_MAP = 0x7, + TS_SIGNED_DISTANCE_FIELD = 0x8, + TS_CARD_IMPOSTER_NORMAL = 0x9, + TS_COUNT = 0xA, +}; + +enum GfxImageCategory : __int8 +{ + IMG_CATEGORY_UNKNOWN = 0x0, + IMG_CATEGORY_AUTO_GENERATED = 0x1, + IMG_CATEGORY_LIGHTMAP = 0x2, + IMG_CATEGORY_LOAD_FROM_FILE = 0x3, + IMG_CATEGORY_RAW = 0x4, + IMG_CATEGORY_FIRST_UNMANAGED = 0x5, + IMG_CATEGORY_RENDERTARGET = 0x5, + IMG_CATEGORY_TEMP = 0x6, +}; + +struct XPakEntryInfo +{ + unsigned __int64 key; + __int64 offset; + unsigned __int64 size; + unsigned __int64 xpakIndex : 8; + unsigned __int64 compressed : 1; + unsigned __int64 valid : 1; + unsigned __int64 adjacentLeftType : 3; + unsigned __int64 adjacentRightType : 3; + unsigned __int64 adjacentLeft : 19; + unsigned __int64 adjacentRight : 19; + unsigned __int64 padding : 10; +}; + +enum GfxImageStreamLevelCountAndSize : __int32 +{ +}; + +struct GfxImageStreamData +{ + XPakEntryInfo xpakEntry; + GfxImageStreamLevelCountAndSize levelCountAndSize; + unsigned __int16 width; + unsigned __int16 height; +}; + +struct streamer_handle_t +{ + unsigned __int64 data; +}; + +struct GfxImageFallback +{ + unsigned __int8* pixels; + unsigned int size; + unsigned __int16 width; + unsigned __int16 height; +}; + +union GfxImagePixels +{ + streamer_handle_t streamedDataHandle; + unsigned __int8* residentData; +}; + + +struct GfxImage +{ + const char* name; + unsigned __int8* packedAtlasData; + GfxTextureId textureId; + GfxPixelFormat format; + GfxImageFlags flags; + unsigned int totalSize; + GfxImageSemanticSpecific semanticSpecific; + unsigned __int16 width; + unsigned __int16 height; + unsigned __int16 depth; + unsigned __int16 numElements; + GfxImageAtlasInfo atlasInfo; + TextureSemantic semantic; + GfxImageCategory category; + unsigned __int8 levelCount; + unsigned __int8 streamedPartCount; + unsigned __int8 decalAtlasIndex; + char freqDomainMetricBias; + GfxImageStreamData streams[4]; + GfxImageFallback* fallback; + GfxImagePixels pixels; +}; + +struct AttachmentList +{ + unsigned int attachmentCount; + void** /*WeaponAttachment*/ attachments; +}; + +struct __declspec(align(4)) SceneZoomSettings +{ + int adsZoomCount; + float adsZoomFov[3]; + float adsReloadFov[3]; + int adsZoomFovTransitionTime[3]; + int /*AdsOffsetInterpolationType*/ adsZoomFovLerpType; + float adsZoomInFrac; + float adsZoomOutFrac; + float adsFOVNVG; + float adsReloadFovNVG; + bool adsZoomLevelIndexResetOnToggle; +}; + +struct __declspec(align(4)) WeaponZoomSettings +{ + float adsZoomFov; + int /*AdsOffsetInterpolationType*/ adsZoomFovLerpType; + float adsZoomFovXOffset; + float adsReloadZoomFov; + float adsReloadZoomFovXOffset; + float adsNVGZoomFov; + float adsNVGZoomFovXOffset; + float adsNVGReloadZoomFov; + float adsNVGReloadZoomFovXOffset; + float adsZoomInFrac; + float adsZoomOutFrac; + bool adsZoomFovXOffsetOverride; + bool adsReloadFovXOffsetOverride; +}; + +struct ZoomSettings +{ + SceneZoomSettings scene; + WeaponZoomSettings weapon; +}; + + +struct WeaponEntityNotify +{ + int flags; + float radius; + float height; + float minSpeed; +}; + + + +struct XModelPhysicsUsageCounter { + int serverEnt; + int clientEnt; + int dynEnt; +}; + +struct DObjAnimMat { + float quat[4]; + float trans[3]; + float transWeight; +}; + +struct XModel { + const char* name; + unsigned __int16 numsurfs; + unsigned __int8 numLods; + unsigned __int8 collLod; + unsigned __int16 mdaoVolumeCount; + unsigned __int8 shadowCutoffLod; + int physicsUseCategory; + char characterCollBoundsType; + unsigned __int8 numAimAssistBones; + unsigned __int8 impactType; + unsigned __int8 mdaoType; + unsigned __int8 numBones; + unsigned __int8 numRootBones; + unsigned __int16 numClientBones; + unsigned __int8 numClothAssets; + unsigned int flags; + int contents; + float scale; + float radius; + Bounds bounds; + float edgeLength; + unsigned int lgvData; + XModelPhysicsUsageCounter physicsUsageCounter; + unsigned int noScalePartBits[8]; + void* scriptableMoverDef; + void* proceduralBones; + void* dynamicBones; + scr_string_t* aimAssistBones; + scr_string_t* boneNames; + unsigned __int8* parentList; + __int16* quats; + float* trans; + unsigned __int8* partClassification; + DObjAnimMat* baseMat; + vec3_t* ikHingeAxis; + uintptr_t reactiveMotionInfo; + uintptr_t materialHandles; +}; + +struct WeaponAnimPackage +{ + const char* name; + uintptr_t anims; + uintptr_t timers; + int meleeAnimPrimaryType; + int meleeAnimPrimaryCount; + unsigned __int8 meleeAnimPrimarySet; + bool meleeRandomizeAnims; + int meleeAnimAltType; + int meleeAnimAltCount; + unsigned __int8 meleeAnimAltSet; + bool altMeleeRandomizeAnims; + uintptr_t blendSpaces; + uintptr_t footstep; +}; + +union XAnimIndices +{ + unsigned __int8* _1; + unsigned __int16* _2; + void* data; +}; + +struct XAnimParts +{ + const char* name; + scr_string_t* names; + unsigned __int8* dataByte; + __int16* dataShort; + int* dataInt; + __int16* randomDataShort; + unsigned __int8* randomDataByte; + int* randomDataInt; + XAnimIndices indices; + uintptr_t notify; + uintptr_t deltaPart; + unsigned int randomDataShortCount; + unsigned int randomDataByteCount; + unsigned int indexCount; + float framerate; + float frequency; + unsigned int dataByteCount; + unsigned __int16 dataShortCount; + unsigned __int16 dataIntCount; + unsigned __int16 randomDataIntCount; + unsigned __int16 numframes; + unsigned __int8 flags; + unsigned __int8 boneCount[10]; + unsigned __int8 notifyCount; + unsigned __int8 assetType; + unsigned __int8 ikType; + unsigned __int8 fingerPoseType; + unsigned __int16 blendShapeWeightCount; + scr_string_t* blendShapeWeightNames; + unsigned __int16* blendShapeWeights; +}; + +struct WeaponDamageCommon +{ + int minDamage; + int mid1Damage; + int mid2Damage; + int mid3Damage; + int damage; + float maxDamageRange; + float mid1DamageRange; + float mid2DamageRange; + float mid3DamageRange; + float minDamageRange; +}; + +struct WeaponDamageInfo +{ + WeaponDamageCommon damageData[3]; + int deathAnimDamageType; + float terminateAtRange; +}; + +struct WeaponVFXPackage +{ + const char* name; + uintptr_t vfx; +}; + +struct __declspec(align(4)) TriggerDisconnectSoundData +{ + float analogTriggerValue; + bool enabledForFireType[6]; +}; + +struct __declspec(align(8)) WeaponSFXPackage +{ + const char* name; + uintptr_t sounds; + WeaponSFXPackage* transientFallbackPackage; + uintptr_t detailSoundBankNPC; + uintptr_t detailSoundBankPlayer; + unsigned __int8 rattleSoundType; + const char* szAdsrBaseSetting; + const char* szWeapSndReflectionClass; + const char* szWeapSndReflFrontOverride; + const char* szWeapSndReflDistantOverride; + float weapSndFireVolumeShot1; + float weapSndFireVolumeShot2; + float weapSndFireVolumeShot3; + float weapSndProneFireLFEVolume; + float weapSndMediumRangeStart; + float weapSndFarRangeStart; + float weapSndDistantRangeStart; + unsigned int projExplosionReflClass; + int sfxImpactType; + int sfxMeleeImpactType; + int sfxMaterialType; + const char* szMountEnterExitString; + const char* szMountImpactString; + unsigned int whizbyType; + unsigned int adsContextType; + unsigned int adsContextValue; + float speedOfSoundMult; + TriggerDisconnectSoundData triggerDisconnectSoundData; +}; + +struct __declspec(align(8)) ADSOverlay +{ + Material* shaderMat; + Material* shaderLowResMat; + Material* shaderEMPMat; + Material* shaderEMPLowResMat; + GfxImage* shaderImg; + GfxImage* shaderLowResImg; + GfxImage* shaderEMPImg; + GfxImage* shaderEMPLowResImg; + bool applyVisionSet; + int reticle; + float width; + float height; + float widthSplitscreen; + float heightSplitscreen; + const char* visionSetName; + float visionSetADSFraction; + int visionSetBlendInTimeMs; + int visionSetBlendOutTimeMs; +}; + +struct CommonSwaySettings +{ + float maxAngle; + float lerpSpeed; + float pitchScale; + float yawScale; + float horizScale; + float vertScale; + float gunAngleScale; +}; + +struct HipSwaySettings +{ + CommonSwaySettings common; + float maxAngleSteadyAim; +}; + +struct AdsSwaySettings +{ + CommonSwaySettings common; + float swayTransitionLerpSpeed; + float adsSwayScale[3]; +}; + +struct AdvancedHipSwaySettings +{ + bool enabled; + float torsoGoalSmoothSpeed; + int torsoGoalViewSmoothDurationMs; + vec2_t torsoGoalDeadzoneAdjustSpeed; + RumbleGraph* torsoGoalViewSpeedToMaxDeadzone_graph; + vec2_t torsoGoalViewSpeedToMaxDeadzone_viewspeed; + vec2_t torsoGoalViewSpeedToMaxDeadzone_maxDeadzone; + vec2_t torsoMass; + vec2_t torsoSpring; + vec2_t torsoDamper; + int gunGoalViewSmoothDurationMs; + RumbleGraph* gunGoalViewSpeedToOffset_graph; + vec2_t gunGoalViewSpeedToOffset_viewspeed; + vec2_t gunGoalViewSpeedToOffset_offset; + vec2_t gunMass; + vec2_t gunSpring; + vec2_t gunDamper; + vec3_t gunPivotPoint; + float gunYawToRollScale; + int fireDurationMs; + int fireStartBlendDurationMs; + int fireFinishBlendDurationMs; + float fireTorsoGoalSmoothSpeed; + float fireTorsoDeadzoneScale; + float fireTorsoToGunDirScale; +}; + +struct __declspec(align(4)) SwaySettings +{ + HipSwaySettings hip; + AdsSwaySettings ads; + AdvancedHipSwaySettings adv; + float shellShockScale; + bool overrideHip; + bool overrideAds; +}; + +struct WeaponOffsetCurveDescription +{ + float blendTime; + float decayTime; + float shotDecayFireTimeFrac; + float holdTime; + float adsFractionBegin; + float adsFractionEnd; + int interpType; + int interpTypeOut; +}; + +struct WeaponOffsetPatternDescription +{ + bool active; + scr_string_t patternKey; + int curveType; + int patternType; + int transformType; + float frequency; + float blendTime; + vec3_t magnitude; + float hipScale; + float rotationOffset; + float bulletDirScale; + float fullAutoScale; + int fullAutoBullets; + float fullAutoDecay; + int referenceIndex; + int kickOrSnapDecayIndex; +}; + +struct __declspec(align(4)) GestureWeaponSettings +{ + unsigned __int16 blendToStates; + bool hideReticle; + float fireDelay; + float sprintDelay; + bool useLeftIdleAkimbo; + bool splitAnimsAkimbo; + bool blendToDemeanorLoop; + bool blendOutRaise; + bool blendOutFingerPose; + bool blendOutAdditiveADS; +}; + +struct __declspec(align(2)) GestureDirectionalSettings +{ + float maxAngle; + float lerpAtMaxAngle; + float widthCushionAngle; + float lerpAtMinCushionAngle; + float lerpAtMaxCushionAngle; + float limitLeft; + float limitRight; + float limitUp; + float limitDown; + bool useTargetOffset; + float targetOffsetX; + float targetOffsetY; + float targetOffsetZ; + float targetOffsetYaw; + float targetOffsetPitch; + float targetOffsetRoll; + bool ignoreViewPitchForTargetOffset; + bool ignoreViewYawForTargetOffset; + bool ignoreViewRollForTargetOffset; +}; + +struct __declspec(align(4)) FootstepTime +{ + float time; + bool isLeft; +}; + +struct __declspec(align(4)) MovementTime +{ + float time; + bool isLeadIn; +}; + +struct FootstepAnim +{ + int leftCount; + FootstepTime step[32]; + MovementTime movement[32]; +}; + +struct GestureLookAroundSettings +{ + float yawLerpIn; + float yawLerpOut; + unsigned __int16 walkTime; + FootstepAnim walkFootStepAnim; +}; + +struct GestureIKTargetSettings +{ + scr_string_t targetEntityBoneName; +}; + +struct __declspec(align(8)) Gesture +{ + const char* name; + int type; + int priority; + bool looping; + uintptr_t anims; + GestureWeaponSettings weaponSettings; + GestureDirectionalSettings directionalSettings; + GestureLookAroundSettings lookAroundSettings; + GestureIKTargetSettings ikTargetSettings; +}; + +struct LaserSettings +{ + bool forceLaserOn; + bool localPlayerADSLaserEnabled; + bool localPlayerHipLaserEnabled; + bool localPlayerNVGADSLaserEnabled; + bool localPlayerNVGHipLaserEnabled; + bool remotePlayerADSLaserEnabled; + bool remotePlayerHipLaserEnabled; + bool remotePlayerNVGADSLaserEnabled; + bool remotePlayerNVGHipLaserEnabled; + bool laserViewCenterInAds; +}; + +struct __declspec(align(4)) GrenadeRotationParams +{ + float initialPitch; + float initialYaw; + float initialRoll; + int rotationPitchDir; + int rotationPitchMin; + int rotationPitchMax; + int rotationYawDir; + int rotationYawMin; + int rotationYawMax; + int rotationRollDir; + int rotationRollMin; + int rotationRollMax; + bool rotate; +}; + +struct AnimOverride +{ + unsigned int numBindings; + uintptr_t bindings; + uintptr_t overrides; + uintptr_t overridesAlt; +}; + +struct CarryAnimOverride +{ + int carryObjectType; + WeaponAnimPackage* animPackage; + WeaponAnimPackage* animPackageAlt; +}; + +struct SFXOverride +{ + unsigned int numBindings; + uintptr_t bindings; + uintptr_t overrides; + uintptr_t overridesAlt; +}; + +struct VFXOverride +{ + unsigned int numBindings; + uintptr_t bindings; + uintptr_t overrides; + uintptr_t overridesAlt; +}; + +struct WeaponOffsetPatternScaleInfo +{ + int numPatternScales; + uintptr_t patternScales; +}; + +struct AdvancedIdleSettings +{ + bool useAdvancedIdleSettings; + bool useRandomPointsAlgorithm; + float breathGaspScaleOverride; + float idleSwaySetting1_HipBulletDirScale; + float idleSwaySetting1_HipIdleSpeed; + float idleSwaySetting1_HipWeaponMagnitudeX; + float idleSwaySetting1_HipWeaponMagnitudeY; + float idleSwaySetting1_HipWeaponMagnitudeZ; + float idleSwaySetting1_HipWeaponMagnitudeF; + float idleSwaySetting1_HipWeaponRotationOffset; + float idleSwaySetting1_HipViewMagnitudeX; + float idleSwaySetting1_HipViewMagnitudeY; + float idleSwaySetting1_AdsBulletDirScale; + float idleSwaySetting1_AdsIdleSpeed; + float idleSwaySetting1_AdsWeaponMagnitudeX; + float idleSwaySetting1_AdsWeaponMagnitudeY; + float idleSwaySetting1_AdsWeaponMagnitudeZ; + float idleSwaySetting1_AdsWeaponMagnitudeF; + float idleSwaySetting1_AdsWeaponRotationOffset; + float idleSwaySetting1_AdsViewMagnitudeX; + float idleSwaySetting1_AdsViewMagnitudeY; + float idleSwaySetting2_HipBulletDirScale; + float idleSwaySetting2_HipIdleSpeed; + float idleSwaySetting2_HipWeaponMagnitudeX; + float idleSwaySetting2_HipWeaponMagnitudeY; + float idleSwaySetting2_HipWeaponMagnitudeZ; + float idleSwaySetting2_HipWeaponMagnitudeF; + float idleSwaySetting2_HipWeaponRotationOffset; + float idleSwaySetting2_HipViewMagnitudeX; + float idleSwaySetting2_HipViewMagnitudeY; + float idleSwaySetting2_AdsBulletDirScale; + float idleSwaySetting2_AdsIdleSpeed; + float idleSwaySetting2_AdsWeaponMagnitudeX; + float idleSwaySetting2_AdsWeaponMagnitudeY; + float idleSwaySetting2_AdsWeaponMagnitudeZ; + float idleSwaySetting2_AdsWeaponMagnitudeF; + float idleSwaySetting2_AdsWeaponRotationOffset; + float idleSwaySetting2_AdsViewMagnitudeX; + float idleSwaySetting2_AdsViewMagnitudeY; +}; + +struct BallisticInfoCalculated +{ + float* distances; + float zeroingAngle; + int numDistanceEntries; +}; + +struct BallisticInfo +{ + float muzzleVelocity; + float ballisticCoefficient; + float diameter; + float mass; + float gravityFactor; + float zeroingDistance; + BallisticInfoCalculated* calculated; + bool enableBallisticTrajectory; + int lifeTimeMs; +}; + +struct FxCombinedDef +{ + const void* /*ParticleSystemDef*/ particleSystemDef; +}; + +struct TracerDef +{ + const char* name; + FxCombinedDef effect; + FxCombinedDef viewmodelEffect; + unsigned int drawInterval; + float speed; + bool drawLegacyTracer; + bool fadeOverTime; + float fadeTime; + Material* material; + float beamLength; + float beamWidth; + float screwRadius; + float screwDist; + vec4_t colors[5]; +}; + +struct LaserDef +{ + const char* name; + Material* laserMaterial; + Material* laserLightMaterial; + bool ownerOnly; + bool nightvisionOnly; + float range; + float radius; + float endOffsetViewmodel; + float endOffsetOther; + float flarePct; + FxCombinedDef beamEffect; + FxCombinedDef laserEndEffect; + bool clientCollision; + vec4_t color; + vec4_t hdrColorScale; + bool laserLight; + bool laserLightNvgOnly; + float laserLightRadius; + float laserLightBeginOffset; + float laserLightEndOffset; + float laserLightBodyTweak; + vec4_t laserLightColor; + vec4_t laserLightHdrColorScale; + float range_alt; + float radius_alt; + float laserLightRadius_alt; + float flarePct_alt; +}; + + +struct SurfaceFxTable +{ + const char* name; + void* /*SurfaceFxEntry*/ table; + int numTableEntry; + unsigned __int8* mapPoolBuffer; + int mapPoolBufferSize; +}; + +struct RawFile +{ + const char* name; + unsigned int compressedLen; + unsigned int len; + const char* buffer; +}; + +struct ScriptFile +{ + const char* name; + int compressedLen; + int len; + int bytecodeLen; + const char* buffer; + unsigned __int8* bytecode; +}; + +struct ScriptDebugData +{ + const char* name; + unsigned int nameCRC; + unsigned int profileStringCount; + void* /*ScriptDebugDataProfileString*/ profileStrings; +}; + +struct StringTable +{ + const char* name; + int columnCount; + int rowCount; + int uniqueCellCount; + unsigned __int16* cellIndices; + int* hashes; + const char** strings; +}; + +struct LeaderboardDef +{ + const char* name; + int id; + int sourceLbId; + int sourceLbWidth; + int columnCount; + int xpColId; + int prestigeColId; + void* /*LbColumnDef*/ columns; + int /*LbUpdateType*/ updateType; + int trackTypes; + int rankColIdX; + int rankColIdY; +}; + +struct __declspec(align(8)) VirtualLeaderboardDef +{ + const char* name; + const char* sourceName; + int id; + int sourceId; + void* /*LbVrColumnDef*/ columns; + int columnCount; + int rankColIdX; + int rankColIdY; +}; + +struct DDLFile +{ + char* name; + struct DDLDef* ddlDef; +}; + +struct SndAliasLookup +{ + const char* name; +}; + +struct __declspec(align(8)) VehiclePhysicsSoundGroup +{ + SndAliasLookup alias; + float threshold; + float vmin; + float vmax; + float pmin; + float pmax; +}; + +struct __declspec(align(8)) VehiclePhysicsVfxGroup +{ + void* /*FootstepVFX*/ surfaceEffects; + float threshold; + float range0; + float range1; +}; + + +struct VehiclePhysicsDef +{ + int physicsEnabled; + int /*VehiclePhysicsNetcodeType*/ physics_netcodeType; + char /*VehiclePhysicsGameProfile*/ physics_gameProfile; + int /*VehiclePhysicsAnimProfile*/ physics_animProfile; + int physics_numWheels; + bool physics_axleRigidBodies; + float physics_axleBodyPadding; + int physics_axleBodySides; + scr_string_t physics_wheelBones[12]; + float physics_wheelRadius; + float physics_suspStiffness; + float physics_suspDamping; + float physics_suspNoiseAmp; + float physics_frontalSuspension; + float physics_ackermannRatio; + vec3_t physics_hardPointOffset; + vec3_t physics_comOffset; + vec4_t physics_massFactorContact; + vec4_t physics_inertiaDiagonal; + float physics_extraGravityFactor; + float physics_extraGravityFactorAir; + float physics_camFovDelta; + float physics_camPitchBase; + float physics_camPitchDynamic; + float physics_camRangeAdd; + float physics_steeringFactor; + float physics_steeringForce; + float physics_steeringMaxYawSpeed; + float physics_steeringOffsetPoint; + float physics_steeringOffsetPointUp; + float physics_steeringReturnSpeed; + float physics_steeringChangeDirSpeed; + float physics_steeringHandbrake; + float physics_steeringSpeed; + float physics_steeringSpeedIncrease; + float physics_engineOffsetPoint; + float physics_engineReductionOnHB; + float physics_rollingFriction; + float physics_lateralFriction; + float physics_frictionBase; + float physics_frictionRecoverSpeedTgt; + float physics_frictionFwRedirect; + float physics_frictionLost; + float physics_frictionHandbrake; + float physics_frictionSpeedToBlock; + float physics_decel; + float physics_minSpeed; + bool physics_stabilizeRoll; + bool physics_stabilizePitch; + bool physics_contentsAsMissile; + bool physics_pitchInversion; + unsigned int physics_controlMode; + float physics_timeAfterColl; + int physics_cycleCamButton; + int physics_boostButton; + float physics_boostSpeed; + float physics_rcpBoostAccel; + float physics_rcpBoostDecel; + bool physics_holdToBoost; + SndAliasLookup physics_rcpBoostSound; + vec3_t physics_rcpBoostShakeCam; + bool physics_rcpUseChangeDirLogic; + bool physics_rcpUseChangeDirLogicPitch; + bool physics_rcpUseRollForYawSpeed; + float physics_rcpOvershootProtection; + float physics_rcpPitchTurnSpeed; + float physics_rcpPitchChangeDirFactor; + float physics_rcpPitchLerpSpeed; + float physics_rcpPitchLerpSpeedChangeDir; + float physics_rcpPitchLerpSpeedReturning; + float physics_rcpPitchMaxAngle; + float physics_rcpYawTurnSpeed; + float physics_rcpYawChangeDirFactor; + float physics_rcpYawLerpSpeed; + float physics_rcpYawLerpSpeedChangeDir; + float physics_rcpYawLerpSpeedReturning; + float physics_rcpRollTurnSpeed; + float physics_rcpRollLerpSpeedSteering; + float physics_rcpRollLerpSpeedChangeDir; + float physics_rcpRollLerpSpeedReturning; + float physics_rcpRollMaxAngle; + float physics_rcpAccelGoingDown; + float physics_rcpDecelGoingUp; + float physics_rcpTraceAhead; + bool physics_rcpCam1stAttachToTagPlayer; + vec2_t physics_rcpCam1stNoiseScale; + float physics_rcpCam1stRollSpeed; + float physics_rcpCam1stRollPercentage; + float physics_comAdjustThreshold; + float physics_comAdjustVertDisp; + float physics_playersWeightFactor; + float physics_timeToAcceptInputOnStart; + float physics_viewDirectionHelp; + float physics_stabilizePitchSpeed; + float physics_stabilizeRollSpeed; + int /*VehicleWheelSpinBoneType*/ spinWheelBones; + float spinWheelAngleOffset; + int treads_enabled; + int treads_boneCount; + scr_string_t treads_firstBones[2]; + float frictionBraking; + float suspensionTravel; + float maxSteeringAngle; + float steeringLerp; + float minSteeringScale; + float minSteeringSpeed; + int disableWheelsTurning; + int disableWheelsSpinning; + float minimumWheelCastFraction; + float handbrakeThreshold; + float minimumJoltForNotify; + float pathConstraintStrengthFwd; + float pathConstraintStrengthSide; + float pathConstraintDampFwd; + float pathConstraintDampSide; + float crashPointOffsetFwd; + float crashPointOffsetUp; + float crashImpulseSide; + float crashImpulseUp; + float wreckedMassScale; + VehiclePhysicsSoundGroup sndImpactHard; + float sndImpactExp; + VehiclePhysicsSoundGroup sndImpactLight; + VehiclePhysicsSoundGroup sndDrivingFast; + VehiclePhysicsSoundGroup sndDrivingSlow; + VehiclePhysicsSoundGroup sndSuspension; + VehiclePhysicsSoundGroup sndBrakingHard; + VehiclePhysicsSoundGroup sndBrakingLight; + VehiclePhysicsSoundGroup sndDrifting; + VehiclePhysicsSoundGroup sndSkidding; + VehiclePhysicsSoundGroup sndDlc1; + VehiclePhysicsSoundGroup sndDlc2; + VehiclePhysicsSoundGroup sndDlc3; + VehiclePhysicsSoundGroup sndDlc4; + VehiclePhysicsVfxGroup vfxImpactHard; + VehiclePhysicsVfxGroup vfxImpactLight; + VehiclePhysicsVfxGroup vfxDrivingFast; + VehiclePhysicsVfxGroup vfxDrivingSlow; + VehiclePhysicsVfxGroup vfxBrakingHard; + VehiclePhysicsVfxGroup vfxBrakingLight; + VehiclePhysicsVfxGroup vfxDrifting; + VehiclePhysicsVfxGroup vfxSkidding; + VehiclePhysicsVfxGroup vfxDrivingFlatFast; + VehiclePhysicsVfxGroup vfxDrivingFlatSlow; + VehiclePhysicsVfxGroup vfxDlc3; + VehiclePhysicsVfxGroup vfxDlc4; +}; + +struct SpaceshipAnimParts +{ + void* /*XAnimParts*/ anim[2]; +}; + +struct VehiclePhysicsRevModifier +{ + float skidSndContrib; + float noiseAmpl; + float sinewaveFreq; + float sinewaveAmpl; + float rpmMax; + float rpmScale; + float rpmSpeedEmaSamples; + float inclinedThreshold; + int gearCount; + float inclContrib; + float maxSpinSpeedRPMFw; + float maxSpinSpeedRPMBw; +}; + +struct VehicleDef +{ + const char* name; + char type; + const char* useHintString; + int health; + int inputBindingSet; + int hitClientScriptables; + int hitRemoteControllers; + int accurateShapeOverlap; + int numDoors; + float maxDoorAngle; + scr_string_t doorBones[4]; + CameraDef* cameraDef; + CameraDef* killCamDef; + float texScrollScale; + float topSpeed; + float accel; + float rotRate; + float rotAccel; + float maxBodyPitch; + float maxBodyRoll; + float rangeForBoneControllers; + float fakeBodyAccelPitch; + float fakeBodyAccelRoll; + float fakeBodyVelPitch; + float fakeBodyVelRoll; + float fakeBodySideVelPitch; + float fakeBodyPitchStrength; + float fakeBodyRollStrength; + float fakeBodyPitchDampening; + float fakeBodyRollDampening; + float fakeBodyBoatRockingAmplitude; + float fakeBodyBoatRockingPeriod; + float fakeBodyBoatRockingRotationPeriod; + float fakeBodyBoatRockingFadeoutSpeed; + float boatBouncingMinForce; + float boatBouncingMaxForce; + float boatBouncingRate; + float boatBouncingFadeinSpeed; + float boatBouncingFadeoutSteeringAngle; + float collisionDamage; + float collisionSpeed; + bool collisionDamageIgnoresImpactAngle; + vec3_t killcamOffset; + int playerProtected; + int bulletDamage; + int armorPiercingDamage; + int grenadeDamage; + int projectileDamage; + int projectileSplashDamage; + int heavyExplosiveDamage; + VehiclePhysicsDef vehiclePhysicsDef; + int vehHelicopterLockAltitude; + int vehHelicopterOffsetFromMesh; + float vehHelicopterAltitudeOffset; + float vehHelicopterPitchOffset; + float vehHelicopterBoundsRadius; + float vehHelicopterMaxSpeed; + float vehHelicopterMaxSpeedVertical; + float vehHelicopterMaxAccel; + float vehHelicopterMaxAccelVertical; + float vehHelicopterDecelerationFwd; + float vehHelicopterDecelerationSide; + float vehHelicopterDecelerationUp; + float vehHelicopterMaxYawRate; + float vehHelicopterMaxYawAccel; + float vehHelicopterTiltFromVelocity; + float vehHelicopterTiltFromControllerAxes; + float vehHelicopterTiltFromAcceleration; + float vehHelicopterTiltFromDeceleration; + float vehHelicopterTiltFromFwdAndYaw_VelAtMaxTilt; + float vehHelicopterTiltFromFwdAndYaw; + float vehHelicopterTiltMomentum; + float vehHelicopterTiltSpeed; + float vehHelicopterMaxPitch; + float vehHelicopterMaxRoll; + float vehHelicopterHoverSpeedThreshold; + float vehHelicopterJitterJerkyness; + float vehHelicopterLookaheadTime; + int vehHelicopterSoftCollisions; + int vehHelicopterUseGroundFX; + FxCombinedDef vehHelicopterGroundFx; + FxCombinedDef vehHelicopterGroundWaterFx; + float vehHelicopterGroundFxDefaultRepeatRate; + float vehHelicopterGroundFxSlowestRepeatRate; + float vehHelicopterGroundFxFastestRepeatRate; + float vehHelicopterGroundFxMinGroundDist; + float vehHelicopterGroundFxMaxGroundDist; + float vehRotorMaxVelocity; + float vehRotorMaxAccel; + float vehRotorAccelTiltBlend; + float vehRotorMaxVehicleSpin; + float vehRotorMaxAngle; + float vehRotorSpinSpeed; + float vehRotorSpinVerticalSpeedThreshold; + float vehRotorMaxSpinAddition; + float ssWeaponSwitchDelaySeconds; + float ssWeaponRaiseDelaySeconds; + vec3_t ssFlyMaxSpeedMph; + vec3_t ssFlyMaxAccelerationMphps; + vec3_t ssFlyMaxCounterAccelerationMphps; + vec3_t ssFlyFrictionMphps; + vec3_t ssFlyJukeSpeedMph; + vec3_t ssHoverMaxSpeedMph; + vec3_t ssHoverMaxAccelerationMphps; + vec3_t ssHoverMaxCounterAccelerationMphps; + vec3_t ssHoverFrictionMphps; + vec3_t ssHoverJukeSpeedMph; + float ssFlyJukeRampTime; + float ssHoverJukeRampTime; + float ssBrakingFrictionMphps; + float ssFlyRedirectVelocityScale; + float ssFlySlowRedirectVelocityScale; + float ssHoverRedirectVelocityScale; + float ssFlyMinSpeedRatio; + bool ssProjectVelocityDesiresToXY; + bool ssEnforceMinGroundClearance; + float ssMinGroundClearanceHeight; + float ssMinGroundClearanceLiftForce; + bool ssTerrainModeMovement; + float ssTerrainModeGravity; + float ssTerrainModeFlyTime; + vec2_t ssAimOffsetClampDeg; + vec2_t ssPitchUpSoftLimitDeg; + vec2_t ssPitchDownSoftLimitDeg; + float ssClutchPitchSpeedScale; + vec2_t ssFlyAimSpeedDps; + vec2_t ssFlySlowAimSpeedDps; + vec2_t ssHoverAimSpeedDps; + vec2_t ssFlyAimDriftScale; + vec2_t ssFlySlowAimDriftScale; + vec2_t ssHoverAimDriftScale; + float ssMinSpringOscillation; + float ssMaxSpringOscillation; + float ssMinSpringStrength; + float ssMaxSpringStrength; + float ssMinSpringAngSpeed; + float ssMaxSpringAngSpeed; + float ssSpringControllerContribution; + float ssTiltSpringOscillation; + float ssTiltSpringStrength; + float ssTiltSpringAngleContribution; + int ssADSToLockOn; + float ssLockOnMinAngle; + float ssLockOnMaxAngle; + float ssPilotAssistNoLockAimScale; + float ssPilotAssistNoLockMinAngle; + float ssPilotAssistNoLockMaxAngle; + float ssPilotAssistAimScale; + float ssPilotAssistMinAngle; + float ssPilotAssistMaxAngle; + vec2_t ssAutoLevelStrengthHover; + vec2_t ssAutoLevelStrengthFly; + bool ssIsRollRightStick; + float ssRollMaxSpeedDps; + float ssBoostSpeedScale; + float ssBoostThrustScale; + bool ssEnableBoostToFly; + float ssBoostTime; + float ssBoostRegenTime; + float ssBoostRegenStallTime; + float ssBoostMinThresholdRatio; + float ssCollisionRadiusI; + float ssCylinderHeightI; + bool ssUseCylinder; + bool ssUsePlayerClip; + float ssCollisionOffsetI; + float ssCollisionHardThresholdMph; + float ssFOVFlyOffsetDeg; + float ssFOVFlyBoostOffsetDeg; + float ssFOVHoverOffsetDeg; + float ssZoomBlendSpeedDps; + float ssZoomMaxAngle; + float ssZoomMinDistI; + float ssZoomIdealDistI; + float ssZoomMaxDistI; + bool ssShowPilotViewmodel; + float ssCameraAnimScale; + vec2_t ssFlyTiltShipAngles; + float ssFlyTiltCameraScale; + vec2_t ssHoverTiltShipAngles; + float ssHoverTiltCameraScale; + float ssMotionIdleRateMinSpeed; + float ssMotionIdleRateMaxSpeed; + float ssMotionIdleMinRate; + float ssMotionIdleMaxRate; + scr_string_t ssAnimTree; + SpaceshipAnimParts ssAnimParts[33]; + FxCombinedDef ssThrustFxLoop; + FxCombinedDef ssJukeFx; + RumbleInfo* ssIdleRumble; + RumbleInfo* ssSmallRumble; + RumbleInfo* ssMedRumble; + RumbleInfo* ssLargeRumble; + SndAliasLookup rattleLoop; + float rattleLoopMinVolume; + float rattleLoopMaxVolume; + SndAliasLookup airLoop; + float airLoopMinVolume; + float airLoopMaxVolume; + SndAliasLookup engineLoop; + float engineLoopMinVolume; + float engineLoopMaxVolume; + float engineLoopMinPitch; + float engineLoopMaxPitch; + SndAliasLookup hoverLoop; + float hoverLoopMinVolume; + float hoverLoopMaxVolume; + float hoverLoopMinPitch; + float hoverLoopMaxPitch; + SndAliasLookup boostLoop; + float boostLoopMaxVolume; + float boostLoopMaxPitch; + SndAliasLookup ssThrustLoop; + float ssThrustLoopMaxVolume; + float ssThrustLoopMaxPitch; + SndAliasLookup boostStart; + SndAliasLookup boostStop; + SndAliasLookup boostDepleted; + SndAliasLookup boostUnavailable; + SndAliasLookup jukeLeft; + SndAliasLookup jukeRight; + SndAliasLookup jukeUpDown; + SndAliasLookup jukeBack; + SndAliasLookup jukeFront; + SndAliasLookup flightOn; + SndAliasLookup flightOff; + float flightOnTimer; + float flightOffTimer; + SndAliasLookup hardCollision; + SndAliasLookup softCollision; + int camLookEnabled; + int camRelativeControl; + int camRemoteDrive; + float camLerp; + float camHeight; + float camRadius; + float camPitchInfluence; + float camYawInfluence; + float camRollInfluence; + float camFovIncrease; + float camFovOffset; + float camFovSpeed; + float camReturnSpeed; + float camReturnLerp; + float camVehicleAnglePitchRate; + float camVehicleAngleYawRate; + float camVehicleAngleRollRate; + int vehCam_UseGDT; + float vehCam_anglesPitch; + float vehCam_anglesYaw; + float vehCam_anglesRoll; + float vehCam_offsetX; + float vehCam_offsetY; + float vehCam_offsetZ; + float vehCam_radius; + float vehCam_speedInfluence; + float vehCam_pitchTurnRate; + float vehCam_pitchClamp; + float vehCam_yawTurnRate; + float vehCam_yawClamp; + int /*VehCamZOffsetMode*/ vehCam_zOffsetMode; + float vehCam_anglesPitch3P; + float vehCam_anglesYaw3P; + float vehCam_anglesRoll3P; + float vehCam_offsetX3P; + float vehCam_offsetY3P; + float vehCam_offsetZ3P; + float vehCam_radius3P; + float vehCam_speedInfluence3P; + float vehCam_pitchTurnRate3P; + float vehCam_pitchClamp3P; + float vehCam_yawTurnRate3P; + float vehCam_yawClamp3P; + int /*VehCamZOffsetMode*/ vehCam_zOffsetMode3P; + const char* turretWeaponName; + void* /*WeaponCompleteDef*/ turretWeapon; + float turretHorizSpanLeft; + float turretHorizSpanRight; + float turretVertSpanUp; + float turretVertSpanDown; + float turretHorizResistLeft; + float turretHorizResistRight; + float turretVertResistUp; + float turretVertResistDown; + float turretRotRate; + int /*VehicleTurretFireType*/ turretFireType; + SndAliasLookup turretSpinSnd; + SndAliasLookup turretStopSnd; + int trophyEnabled; + float trophyRadius; + float trophyInactiveRadius; + int trophyAmmoCount; + float trophyReloadTime; + scr_string_t trophyTags[4]; + FxCombinedDef trophyExplodeFx; + FxCombinedDef trophyFlashFx; + Material* compassFriendlyIcon; + Material* compassEnemyIcon; + Material* compassFriendlyAltIcon; + Material* compassEnemyAltIcon; + int compassIconWidth; + int compassIconHeight; + void* /*SndBankTransient*/ detailSoundBankNPC; + void* /*SndBankTransient*/ detailSoundBankPlayer; + SndAliasLookup idleLowSnd; + SndAliasLookup idleHighSnd; + SndAliasLookup engineLowSnd; + SndAliasLookup engineHighSnd; + SndAliasLookup fallbackIdleLowSnd; + SndAliasLookup fallbackIdleHighSnd; + SndAliasLookup fallbackEngineLowSnd; + SndAliasLookup fallbackEngineHighSnd; + float engineSndSpeed; + scr_string_t audioOriginTag; + SndAliasLookup mainRotorLowRpmSnd; + SndAliasLookup mainRotorOperatingRpmSnd; + SndAliasLookup mainRotorOperatingEffortSnd; + SndAliasLookup tailRotorLowRpmSnd; + SndAliasLookup tailRotorOperatingRpmSnd; + SndAliasLookup tailRotorOperatingEffortSndLeft; + SndAliasLookup tailRotorOperatingEffortSndRight; + SndAliasLookup physicsHeliStartup; + SndAliasLookup physicsHeliShutdown; + SndAliasLookup turbineLowRpmSnd; + SndAliasLookup turbineOperatingRpmSnd; + bool useRevAudioSettings; + SndAliasLookup revLowFidelityMod; + SndAliasLookup revHighFidelityMod; + float revPlayerPriority; + VehiclePhysicsRevModifier revModifier; + SndAliasLookup engineStartUpSnd; + int engineStartUpLength; + SndAliasLookup engineShutdownSnd; + SndAliasLookup engineIdleSnd; + SndAliasLookup engineSustainSnd; + SndAliasLookup engineRampUpSnd; + int engineRampUpLength; + SndAliasLookup engineRampDownSnd; + int engineRampDownLength; + SndAliasLookup suspensionSoftSnd; + float suspensionSoftCompression; + SndAliasLookup suspensionHardSnd; + float suspensionHardCompression; + SndAliasLookup collisionSnd; + float collisionBlendSpeed; + SndAliasLookup speedSnd; + float speedSndBlendSpeed; + const char* surfaceSndName; + float surfaceSndBlendSpeed; + float slideVolume; + float slideBlendSpeed; + float inAirPitch; + const char* soundTriggerOverrideZone; + bool soundTriggerOverrideReverb; + bool soundTriggerOverrideMix; + bool soundTriggerOverrideFilter; + bool soundTriggerOverrideOcclusion; + bool soundTriggerOverrideAmbient; + bool soundTriggerOverrideAmbientEvents; + bool soundTriggerOverrideADSR; + int visionBlendTime; + const char* globalVisionSettings; + const char* mapVisionSettings; + const char* luiCrosshairWidget; + float dlcFloat[8]; +}; + +struct MapTriggers +{ + unsigned int count; + void* /*TriggerModel*/ models; + unsigned int hullCount; + void* /*TriggerHull*/ hulls; + unsigned int slabCount; + void* /*TriggerSlab*/ slabs; + unsigned int windingCount; + void* /*TriggerWinding*/ windings; + unsigned int windingPointCount; + void* /*TriggerWindingPoint*/ windingPoints; +}; + + +struct AddonMapEnts +{ + const char* name; + char* entityString; + int numEntityChars; + MapTriggers trigger; + unsigned int numSubModels; + void* /*cmodel_t*/ cmodels; + void* /*GfxBrushModel*/ models; +}; + +struct NetConstStrings +{ + const char* name; + int /*NetConstStringType*/ stringType; + int /*NetConstStringSource*/ sourceType; + unsigned int flags; + unsigned int entryCount; + const char** stringList; +}; + +struct LuaFile +{ + const char* name; + int len; + unsigned __int8 strippingType; + const unsigned __int8* buffer; +}; + + +struct __declspec(align(8)) ScriptableDef +{ + const char* name; + ScriptableDef* nextScriptableDef; + int flags; + unsigned int numParts; + void* /*ScriptablePartDef*/ parts; + unsigned int maxNumDynEntsRequired; + unsigned int partCount; + unsigned int serverInstancedPartCount; + unsigned int serverControlledPartCount; + unsigned int maxNumDynEntPartsBase; + unsigned int maxNumDynEntPartsForSpawning; + unsigned __int16 eventStreamSizeRequiredServer; + unsigned __int16 eventStreamSizeRequiredClient; + unsigned int usablePartCount; + unsigned int ffMemCost; + scr_string_t animationTreeName; + void* /*XAnim_s*/ animationTreeDef[2]; + float viewRadius; + bool networkLODRangeOverride; + float networkLODRangeOverrideDistance; + unsigned int numXModels; + XModel** models; + char /*DynEntitySpatialActivationMode*/ spatialActivationMode; +}; + +struct EquipSoundSetMoveTypes +{ + void* /*EquipmentSoundSet*/ soundSets; +}; + +struct EquipmentSoundSet +{ + void* /*SndAliasList*/ soundPLR; + void* /*SndAliasList*/ soundNPC; +}; + +struct EquipSoundSetMeleeWorld +{ + EquipmentSoundSet soundSets[8][3][2][4]; +}; + +struct EquipmentSoundTable +{ + const char* szName; + unsigned int numClothTypes; + unsigned int numWeaponRattleTypes; + unsigned int numMoveTypes; + unsigned int numStanceTypes; + void* /*EquipmentClothData*/ clothTypes; + void* /*EquipmentWeaponRattleData*/ weaponRattleTypes; + void* /*EquipmentChanceRattleTypes*/ chancesPLR; + void* /*EquipmentChanceRattleTypes*/ chancesNPC; + void* /*EquipSoundSetFootsteps*/ mvmtClothFootstepSoundSets; + void* /*EquipSoundSetFootsteps*/ mvmtClothFootstepCeilingSoundSets; + void* /*EquipSoundSetMoveLeadTypes*/ mvmtClothFoleySoundSets; + void* /*EquipSoundSetMoveTypes*/ mvmtRattleSoundSets; + EquipSoundSetMoveTypes mvmtAccentSoundSets; + void* /*EquipSoundSetMantleTypes*/ mvmtMantleSoundSets; + void* /*EquipSoundSetStanceTypes*/ mvmtStanceSoundSets; + void* /*EquipSoundSetMeleeVM*/ meleeAttackVMSoundSets; + void* /*EquipSoundSetMeleeWM*/ meleeAttackWMSoundSets; + void* /*EquipSoundSetMeleeWM*/ meleeCharacterSoundSets; + EquipSoundSetMeleeWorld meleeWorldSoundSets; +}; + +struct ExtentBounds +{ + vec3_t mins; + vec3_t maxs; +}; + +struct VectorField +{ + const char* name; + void* /*VectorSubField*/ subFields; + ExtentBounds worldBounds; + vec3_t localOrigin; + unsigned int numSubFields; + unsigned int pad[2]; +}; + +struct FxParticleSimAnimationHeader +{ + float playbackRate; + float duration; + unsigned int frameCount; + float minX; + float minY; + float minZ; + float boundsXDelta; + float boundsYDelta; + float boundsZDelta; + float maxWidth; + float maxHeight; + unsigned int colorTableSize; + unsigned int particleDataCount; + unsigned int maxActiveParticles; + bool evalVisStatePerParticle; + bool sortParticlesAtRuntime; + bool hasOrientation3D; + bool hasIndex; +}; + +struct FxParticleSimAnimation +{ + const char* name; + Material* material; + FxParticleSimAnimationHeader header; + void* /*FxParticleSimAnimationParticleData*/ particleData; + void* /*FxParticleSimAnimationParticleDataOrientation3D*/ particleDataOrientation3D; + void* /*FxParticleSimAnimationParticleDataIndex*/ particleDataIndex; + void* /*FxParticleSimAnimationFrame*/ frames; + vec4_t* colorTable; +}; + +struct StreamingInfo { + char __padding[0x48]; +}; + +struct TTFDef +{ + const char* name; + int fileLen; + const char* file; + void* ftFace; +}; + +struct SuitDef +{ + const char* name; + float cam_minVelocityForFovIncrease; + float cam_maxVelocityForFovIncrease; + float cam_velocityToDecreaseFov; + float cam_fovIncreaseAtMaxVelocity; + float cam_oneOverFovEaseInTimeMs; + float cam_oneOverFovEaseOutTimeMs; + CameraDef* cam_helmetCam; + bool cam_drawHelmet; + vec3_t cam_camtoHelmetOffsetOrigin; + vec3_t cam_camtoHelmetOffsetAngles; + bool enableIKOverride; + float player_globalAccelScale; + float player_crouchSpeedScale; + float player_proneSpeedScale; + float player_lastStandCrawlSpeedScale; + float player_sprintSpeedScale; + bool player_sprintUnlimited; + float player_viewBobScale; + bool jump_slowdownEnable; + float jump_height; + float sprintLeap_height; + float sprintLeap_forwardVelocityScale; + int sprintLeap_minSprintTimeMs; + float doubleJump_accel; + float doubleJump_speed; + float doubleJump_speedNoBoost; + float doubleJump_frictionMin; + float doubleJump_frictionMax; + float doubleJump_initialUpBoostAccel; + float doubleJump_standardUpBoostAccel; + float doubleJump_energyNeededForInitialUpBoost; + float doubleJump_energyNeededForStandardUpBoost; + float doubleJump_maxUpwardsVelocity; + bool doubleJump_enableMinZVelocity; + float doubleJump_minZVelocity; + float doubleJump_energyInitialCost; + float doubleJump_boostUpEnergyUseRate; + float doubleJump_energyUsePerButtonPress; + bool doubleJump_hoverOnly; + float doubleJump_maxViewPitchDip; + float doubleJump_maxViewBackwardsPitchDip; + float doubleJump_maxViewRoll; + float doubleJump_oneOverEaseInTime; + float doubleJump_oneOverEaseOutTimeMs; + bool doubleJump_alwaysDipView; + SndAliasLookup doubleJump_sound; + SndAliasLookup doubleJump_soundPlayer; + SndAliasLookup doubleJump_releaseSound; + SndAliasLookup doubleJump_releaseSoundPlayer; + float slide_strafe_speed_scale; + int slide_sprint_penalty_ms; + bool slide_allow_firing; + bool slide_allow_ads; + bool slide_allow_weapon_switch; + float slide_jump_speed_scale; + float slide_energy_cost_ratio; + int slide_max_time_ms; + int slide_max_time_reduced_ms; + int slide_max_time_base_ms; + int slide_inTimeMs; + float slide_inMaxSpeedScale; + float slide_inAcceleration; + float slide_frictionScaleNormal; + float slide_frictionScaleDownhill; + float slide_frictionScaleUphill; + float slide_frictionScaleBlocked; + int slide_gestureOutTimeForJumpMs; + int slide_sprintDelayMs; + bool slide_disableProneTransition; + int slide_proneDelayMs; + int slide_proneButtonCheckTimeMs; + int slide_outTimeMs; + float slide_outFrictionScaleStart; + float slide_outFrictionScaleFinish; + float slide_outSpeedScaleStart; + float slide_outSpeedScaleFinish; + int slide_inAirTimeMs; + float slide_inAirFrictionScaleStart; + float slide_inAirFrictionScaleFinish; + int slide_viewBlendInTimeMs; + int slide_viewBlendOutTimeMs; + float wallRun_minZVel; + float wallRun_minTriggerSpeed; + float wallRun_minMaintainSpeed; + int wallRun_delayPeriodMs; + float wallRun_minJumpHeight; + int wallRun_maxTimeMs; + int wallRun_fallStageTimeMs; + float wallRun_maxHeight; + float wallRun_jumpHeight; + float wallRun_jumpVelocity; + float wallRun_frictionScale; + float wallRun_speedScale; + float wallRun_speedScaleADS; + float wallRun_energyInitialCost; + float wallRun_energyChangePerSecond; + float ladder_anchorOffset; + float ladder_anchorOffsetWM; + float ladder_handDistance; + int /*SuitAnimType*/ suitAnimType; + bool isMovementCameraIndependent; + void* /*SuitAnimPackage*/ animPackage; + void* /*SuitAnimPackage*/ animPackageL; + void* /*SuitAnimPackage*/ animPackageR; + void* /*SuitAnimPackage*/ animPackageRelaxed; + void* /*SuitAnimPackage*/ animPackageSafe; + void* /*ASM*/ asmAsset; + void* /*Animset*/ animsetAsset; + unsigned __int8 facialAnimType; + int /*SuitBodyAnimType*/ bodyAnimType; + ScriptableDef* scriptableDef; + int viewheight_stand; + int viewheight_crouch; + int viewheight_prone; + int viewheight_laststand; + int viewheight_dead; + int viewheight_swim; + int viewheight_slide; + int viewheight_sprint; + int bounds_radius; + int bounds_height_stand; + int bounds_height_crouch; + int bounds_height_prone; + Bounds bounds_stand; + Bounds bounds_crouch; + Bounds bounds_prone; + int radialMotionBlur_interpTimeIn; + int radialMotionBlur_interpTimeOut; + float radialMotionBlur_sprintMinRadius; + float radialMotionBlur_sprintMaxRadius; + float radialMotionBlur_sprintMinStrength; + float radialMotionBlur_sprintMaxStrength; + float radialMotionBlur_slideMinRadius; + float radialMotionBlur_slideMaxRadius; + float radialMotionBlur_slideMinStrength; + float radialMotionBlur_slideMaxStrength; + float radialMotionBlur_doubleJumpMinRadius; + float radialMotionBlur_doubleJumpMaxRadius; + float radialMotionBlur_doubleJumpMinStrength; + float radialMotionBlur_doubleJumpMaxStrength; + float radialMotionBlur_wallRunMinRadius; + float radialMotionBlur_wallRunMaxRadius; + float radialMotionBlur_wallRunMinStrength; + float radialMotionBlur_wallRunMaxStrength; + float radialMotionBlur_groundPoundMinRadius; + float radialMotionBlur_groundPoundMaxRadius; + float radialMotionBlur_groundPoundMinStrength; + float radialMotionBlur_groundPoundMaxStrength; + float radialMotionBlur_rewindMinRadius; + float radialMotionBlur_rewindMaxRadius; + float radialMotionBlur_rewindMinStrength; + float radialMotionBlur_rewindMaxStrength; + float radialMotionBlur_dodgeMinRadius; + float radialMotionBlur_dodgeMaxRadius; + float radialMotionBlur_dodgeMinStrength; + float radialMotionBlur_dodgeMaxStrength; + float radialMotionBlur_skydiveMinRadius; + float radialMotionBlur_skydiveMaxRadius; + float radialMotionBlur_skydiveMinStrength; + float radialMotionBlur_skydiveMaxStrength; + RumbleInfo* groundPound_activationRumble; + SndAliasLookup groundPound_activationSound; + SndAliasLookup groundPound_activationSoundPlayer; + RumbleInfo* groundPound_landingRumble; + SndAliasLookup groundPound_landingSound; + SndAliasLookup groundPound_landingSoundPlayer; + RumbleInfo* landing_rumbleLowHeight; + RumbleInfo* landing_rumbleMediumHeight; + RumbleInfo* landing_rumbleHighHeight; + RumbleInfo* landing_rumbleExtremeHeight; + float landing_speedScale; + float footstep_shakeBroadcastRadiusInches; + int footstep_shakeDurationMs; + float footstep_shakeAmplitude; + RumbleInfo* footstep_rumble; + void* /*FootstepVFX*/ footstepvfx_slide; + void* /*FootstepVFX*/ footstepvfx_creep_left; + void* /*FootstepVFX*/ footstepvfx_creep_right; + void* /*FootstepVFX*/ footstepvfx_walk_left; + void* /*FootstepVFX*/ footstepvfx_walk_right; + void* /*FootstepVFX*/ footstepvfx_run_left; + void* /*FootstepVFX*/ footstepvfx_run_right; + void* /*FootstepVFX*/ footstepvfx_sprint_left; + void* /*FootstepVFX*/ footstepvfx_sprint_right; + float skydive_mass; + float skydive_gravitatationalAcceleration; + XModel* skydive_parachuteViewModel; + XModel* skydive_parachuteWorldModel; + float skydive_baseJumpMinimumHeight; + float skydive_baseJumpClearanceRadius; + float skydive_baseJumpAutoDeployHeight; + float skydive_baseJumpForceFreefallHeight; + float skydive_freefallSuperDiveCameraPitch; + float skydive_freefallSuperDiveStickInput; + float skydive_freefallSuperDiveFovAdjustDegrees; + int skydive_freefallSuperDiveFovAdjustInTime; + int skydive_freefallSuperDiveFovAdjustOutTime; + void* /*CinematicMotionDef*/ skydive_freefallCinematicMotion; + float skydive_freefallThrottleTrackSpeed; + float skydive_freefallAnimTrackSpeedThrottle; + float skydive_freefallAnimTrackSpeedStrafe; + float skydive_freefallAnimTrackSpeedYaw; + float skydive_freefallAnimTrackSpeedPitch; + float skydive_freefallAnimMinWeight; + float skydive_freefallAnimMaxWeight; + float skydive_freefallAnimMinPlayRate; + float skydive_freefallAnimMaxPlayRate; + float skydive_freefallAnimSpeedForMinWeight; + float skydive_freefallAnimSpeedForMaxWeight; + float skydive_freefallTopGroundSpeed; + float skydive_freefallMinPitch; + float skydive_freefallMaxPitch; + float skydive_freefallPitchSpeed; + float skydive_freefallYawSpeed; + float skydive_freefallCrossSectionalArea; + float skydive_freefallLookHorizForceMin; + float skydive_freefallLookHorizForceMax; + RumbleGraph* skydive_freefallLookHorizForceGraph; + float skydive_freefallStickHorizForceMin; + float skydive_freefallStickHorizForceMax; + RumbleGraph* skydive_freefallStickHorizForceGraph; + float skydive_freefallDragCoefHoriz; + float skydive_freefallLookHorizDragCoeff; + RumbleGraph* skydive_freefallLookHorizDragGraph; + float skydive_freefallStickHorizDragCoeff; + RumbleGraph* skydive_freefallStickHorizDragGraph; + float skydive_freefallDragCoefVert; + float skydive_freefallLookVertDragCoeff; + RumbleGraph* skydive_freefallLookVertDragGraph; + float skydive_freefallStickVertDragIncreasePerc; + RumbleGraph* skydive_freefallStickVertDragIncreaseGraph; + float skydive_freefallStickVertDragReductionPerc; + RumbleGraph* skydive_freefallStickVertDragReductionGraph; + float skydive_freefallStickSidewaysForce; + float skydive_freefallMaxBrakeForce; + float skydive_freefallMinTurnMultiplier; + float skydive_freefallMaxTurnMultiplier; + RumbleGraph* skydive_freefallTurnMultiplierGraph; + float skydive_freefallTurnMultiplierMinScale; + float skydive_freefallTurnMultiplierMaxScale; + RumbleGraph* skydive_freefallTurnMultiplierPitchGraph; + SndAliasLookup skydive_freefallAmbientSound; + float skydive_freefallAmbientSoundGroundSpeedWeight; + float skydive_freefallAmbientSoundMinVolume; + float skydive_freefallAmbientSoundMaxVolume; + float skydive_freefallAmbientSoundMinPitch; + float skydive_freefallAmbientSoundMaxPitch; + float skydive_freefallAmbientSoundMinGroundSpeed; + float skydive_freefallAmbientSoundMaxGroundSpeed; + float skydive_freefallAmbientSoundMinFallSpeed; + float skydive_freefallAmbientSoundMaxFallSpeed; + SndAliasLookup skydive_freefallHighSpeedSound; + float skydive_freefallHighSpeedSoundGroundSpeedWeight; + float skydive_freefallHighSpeedSoundMinVolume; + float skydive_freefallHighSpeedSoundMaxVolume; + float skydive_freefallHighSpeedSoundMinPitch; + float skydive_freefallHighSpeedSoundMaxPitch; + float skydive_freefallHighSpeedSoundMinGroundSpeed; + float skydive_freefallHighSpeedSoundMaxGroundSpeed; + float skydive_freefallHighSpeedSoundMinFallSpeed; + float skydive_freefallHighSpeedSoundMaxFallSpeed; + float skydive_deployHorizontalDrag; + float skydive_deployVerticalDrag; + void* /*CinematicMotionDef*/ skydive_canopyCinematicMotion; + float skydive_canopyThrottleTrackSpeed; + float skydive_canopyAnimTrackSpeedThrottle; + float skydive_canopyAnimTrackSpeedStrafe; + float skydive_canopyAnimTrackSpeedYaw; + float skydive_canopyAnimTrackSpeedPitch; + float skydive_canopyAnimMinWeight; + float skydive_canopyAnimMaxWeight; + float skydive_canopyAnimMinPlayRate; + float skydive_canopyAnimMaxPlayRate; + float skydive_canopyAnimSpeedForMinWeight; + float skydive_canopyAnimSpeedForMaxWeight; + float skydive_canopyTopGroundSpeed; + float skydive_canopyMinPitch; + float skydive_canopyMaxPitch; + float skydive_canopyPitchSpeed; + float skydive_canopyYawSpeed; + float skydive_canopyCrossSectionalArea; + float skydive_canopyLookHorizForceMin; + float skydive_canopyLookHorizForceMax; + RumbleGraph* skydive_canopyLookHorizForceGraph; + float skydive_canopyStickHorizForceMin; + float skydive_canopyStickHorizForceMax; + RumbleGraph* skydive_canopyStickHorizForceGraph; + float skydive_canopyDragCoefHoriz; + float skydive_canopyLookHorizDragCoeff; + RumbleGraph* skydive_canopyLookHorizDragGraph; + float skydive_canopyStickHorizDragCoeff; + RumbleGraph* skydive_canopyStickHorizDragGraph; + float skydive_canopyDragCoefVert; + float skydive_canopyLookVertDragCoeff; + RumbleGraph* skydive_canopyLookVertDragGraph; + float skydive_canopyStickVertDragIncreasePerc; + RumbleGraph* skydive_canopyStickVertDragIncreaseGraph; + float skydive_canopyStickVertDragReductionPerc; + RumbleGraph* skydive_canopyStickVertDragReductionGraph; + float skydive_canopyStickSidewaysForce; + float skydive_canopyMaxBrakeForce; + float skydive_canopyMinTurnMultiplier; + float skydive_canopyMaxTurnMultiplier; + RumbleGraph* skydive_canopyTurnMultiplierGraph; + float skydive_canopyTurnMultiplierMinScale; + float skydive_canopyTurnMultiplierMaxScale; + RumbleGraph* skydive_canopyTurnMultiplierPitchGraph; + SndAliasLookup skydive_canopyAmbientSound; + float skydive_canopyAmbientSoundGroundSpeedWeight; + float skydive_canopyAmbientSoundMinVolume; + float skydive_canopyAmbientSoundMaxVolume; + float skydive_canopyAmbientSoundMinPitch; + float skydive_canopyAmbientSoundMaxPitch; + float skydive_canopyAmbientSoundMinGroundSpeed; + float skydive_canopyAmbientSoundMaxGroundSpeed; + float skydive_canopyAmbientSoundMinFallSpeed; + float skydive_canopyAmbientSoundMaxFallSpeed; + SndAliasLookup skydive_canopyHighSpeedSound; + float skydive_canopyHighSpeedSoundGroundSpeedWeight; + float skydive_canopyHighSpeedSoundMinVolume; + float skydive_canopyHighSpeedSoundMaxVolume; + float skydive_canopyHighSpeedSoundMinPitch; + float skydive_canopyHighSpeedSoundMaxPitch; + float skydive_canopyHighSpeedSoundMinGroundSpeed; + float skydive_canopyHighSpeedSoundMaxGroundSpeed; + float skydive_canopyHighSpeedSoundMinFallSpeed; + float skydive_canopyHighSpeedSoundMaxFallSpeed; + float skydive_wmAnimFreefallPitchMin; + float skydive_wmAnimFreefallPitchMax; + float skydive_wmAnimFreefallPitchTrackSpeed; + float skydive_wmAnimFreefallRollTrackSpeed; + float skydive_wmAnimFreefallRollReturnSpeed; + RumbleGraph* skydive_wmAnimFreefallLeftStickXToRollGraph; + RumbleGraph* skydive_wmAnimFreefallRightStickXToRollGraph; + float skydive_camFreefallHeightOffset; + RumbleGraph* skydive_camFreefallPitchToDistanceGraph; + RumbleGraph* skydive_camFreefallPitchToForwardOffsetGraph; + float skydive_camParachuteHeightOffset; + RumbleGraph* skydive_camParachutePitchToDistanceGraph; + RumbleGraph* skydive_camParachutePitchToForwardOffsetGraph; + RumbleGraph* skydive_camParachutePitchToModelPitchForwardOffsetGraph; + RumbleGraph* skydive_camParachutePitchToModelRollSideOffsetGraph; + RumbleGraph* skydive_camParachutePitchToModelRollUpOffsetGraph; + float skydive_camParachuteBlendInTime; + SndAliasLookup nvg_blindSound; + float dlcFloat[8]; +}; + +struct SuitAnimPackage +{ + const char* name; + void* /*SuitAnimPerWeapClass*/ animOverrides; +}; + +struct CameraFirstPersonProfileDef +{ + bool applyOffset; + vec3_t offsetTranslation; + bool disableFOVWeaponOffset; + float cameraAnimationTransScale; + float cameraAnimationRotScale; + float handheldCameraTransScale; + float handheldCameraRotScale; + float handheldCameraImpulseTransScale; + float handheldCameraImpulseRotScale; +}; + +struct CameraOrbitProfileDef +{ + float lerpSpeed; + vec3_t pivotOffset; + float initialAzimuth; + float initialPolar; + float polarMin; + float polarMax; + float range; + float returnAzimuthSpeed; + float returnPolarSpeed; + float easeInFactor; + float returnTimeTo; + float turningSpeedPolar; + float turningSpeedAzimuth; + float traceCollRadius; + float mouseInputMultiplier; + float rollContrib; + float pitchContrib; + int buttonToggleReturn; + int buttonCyclePerspective; + int buttonRecenter; + bool initialReturn; + bool returnAzimuth; + bool returnPolar; + float alignToMovement; + bool interpolateFocus; + bool cameraReturnOnGas; + float cameraReturnOnSpeed; + float yawTurnAdjust; +}; + +struct CameraSentryDroneDef +{ + float range; + float thresHitToSpeedUp; + float speedUpFactor; + float lerpSpeedEye; + float lerpSpeedFocus; + float lerpSpeedUp; + float focusTraceLen; + float eyeHeight; + float horizontalOffset; + float upOffsetFactorIncl; +}; + +struct CameraKillCamVehicleDef +{ + float lookAtRadius; + float fov; + float distBack; + float distUp; + float distBackRadiusMod; + float distUpRadiusMod; + float fovRadiusMod; + float sideMag; + float traceCollRad; +}; + +struct CameraTransitionDef +{ + bool active; + float time; + float timewaitEyepos; + float timewaitAxis; + int /*CameraTransitionCurve*/ curveEyepos; + int /*CameraTransitionCurve*/ curveAxis; +}; + +struct CameraDef +{ + const char* name; + int /*CameraProfile*/ profile; + bool keepShakeCam; + bool serverFeedback; + bool behaveAsRemoteCont; + bool interpolateViewTransition; + bool overrideFOV; + float FOV; + int /*LensProfileMode*/ overrideLensProfile; + float lensFocalLength; + float lensFStop; + float lensScale; + float lensUVScale; + bool overrideRadialBlur; + float radialBlurRadius; + float radialBlurStrength; + bool overrideZPlanes; + float zPlaneVMNear; + float zPlaneSceneNear; + CameraFirstPersonProfileDef firstPerson; + CameraOrbitProfileDef orbit; + CameraSentryDroneDef sentryDrone; + CameraKillCamVehicleDef kcamVeh; + CameraTransitionDef transitionIn; + CameraTransitionDef transitionOut; + vec3_t fpveh_offsetLs; + float fpveh_offsetYaw; + float fpveh_offsetPitch; + float fpveh_rollContrib; + float fpveh_rollMax; + bool fpveh_freeLook; + bool fpveh_freeLookReturn; + bool dlcBool[1]; + bool fadeOutPlayerOnTransitionIn; +}; + +struct HudOutlineDef +{ + const char* name; + unsigned __int8 outlineType; + bool drawInStencil; + bool drawNonOccludedPixels; + bool drawOccludedPixels; + bool drawFill; + bool fadeOverTimeEnable; + bool fadeOverTimeLooping; + unsigned __int8 fadeOverTimeCurveType; + float fadeOverTimeMinAlpha; + float fadeOverTimeMaxAlphaTime; + float fadeOverTimeMinAlphaTime; + float fadeOverTimeInTime; + float fadeOverTimeOutTime; + bool distanceFadeEnable; + float distanceFadeMinAlpha; + float distanceFadeStartDistance; + float distanceFadeEndDistance; + unsigned int outlineColor; + int outlineWidth; + bool drawOnLocalPlayerCharacter; + bool drawOnVehicleOccupants; + bool drawOnLocalPlayerVehicleOccupants; + bool drawOnLocalPlayerVehicle; + bool dlcBool0; + bool dlcBool1; + bool dlcBool2; + bool dlcBool3; + bool dlcBool4; + bool dlcBool5; + float dlcFloat0; + float dlcFloat1; + float dlcFloat2; + float dlcFloat3; + float dlcFloat4; + float dlcFloat5; +}; + +struct SpaceshipTargetDef +{ + const char* name; + scr_string_t targetTag; + float annotationOffsetX; + float annotationOffsetY; + float annotationOffsetZ; + bool disableLeading; + float lock_minDistance; + float lock_maxDistance; + float lock_cutoffDistance; + float lock_minRate; + float lock_maxRate; + float lock_maxZoomFOV; + float lock_followDistance; + float lockCooldown_rate; + float aa_closeDistance; + float aa_farDistance; + float aa_closeMinAngle; + float aa_closeMaxAngle; + float aa_closeBlendMax; + float aa_farMinAngle; + float aa_farMaxAngle; + float aa_farBlendMax; + float aaLocked_closeDistance; + float aaLocked_farDistance; + float aaLocked_closeMinAngle; + float aaLocked_closeMaxAngle; + float aaLocked_closeBlendMax; + float aaLocked_farMinAngle; + float aaLocked_farMaxAngle; + float aaLocked_farBlendMax; + float pilotAssistScale; + float callout_maxDistance; + float callout_maxAngle; +}; + +struct __declspec(align(8)) RumbleInfo +{ + const char* name; + int duration; + float range; + RumbleGraph* highRumbleGraph; + RumbleGraph* lowRumbleGraph; + RumbleGraph* leftTriggerRumbleGraph; + RumbleGraph* rightTriggerRumbleGraph; + bool swapTriggerRumblesOnLefty; + bool panTriggerRumbles; + bool fadeWithDistance; + bool broadcast; +}; + +struct __declspec(align(8)) RumbleGraph +{ + const char* name; + vec2_t knots[16]; + unsigned __int16 knotCount; +}; + +struct LocalizeEntry +{ + const char* name; + const char* value; +}; + +struct StaticModelCollisionInstance +{ + vec3_t origin; + vec3_t angles; + float scale; +}; + +struct XModelDetailCollision +{ + const char* name; + unsigned int physicsLODDataSize; + char* physicsLODData; + unsigned int physicsLODDataNameCount; + scr_string_t* physicsLODDataNames; +}; + +struct StaticModelCollisionModel +{ + scr_string_t name; + PhysicsAsset* physicsAsset; + XModelDetailCollision* detailCollision; + unsigned int numInstances; + StaticModelCollisionInstance* instances; +}; + +struct __declspec(align(8)) StaticModelCollisionModelList +{ + unsigned int numModels; + StaticModelCollisionModel* models; + unsigned int structureMemoryCost; +}; + +struct PhysicsCapacities +{ + int maxNumRigidBodiesServer; + int maxNumDetailRigidBodiesServer; + int maxNumConstraintsServer; + int maxNumMotionsServer; + int maxNumRigidBodiesClient; + int maxNumDetailRigidBodiesClient; + int maxNumConstraintsClient; + int maxNumMotionsClient; +}; + +struct SpawnPointEntityRecord +{ + unsigned __int16 index; + scr_string_t name; + scr_string_t target; + scr_string_t script_noteworthy; + vec3_t origin; + vec3_t angles; +}; + +struct SpawnPointRecordList +{ + unsigned __int16 spawnsCount; + SpawnPointEntityRecord* spawns; +}; + +struct ClientMapTriggers +{ + unsigned int count; + uintptr_t models; + unsigned int hullCount; + uintptr_t hulls; + unsigned int slabCount; + uintptr_t slabs; +}; + +struct ClientTriggers +{ + ClientMapTriggers trigger; + unsigned int triggerStringLength; + char* triggerString; + __int16* visionSetTriggers; + unsigned __int16* triggerType; + vec3_t* origins; + float* scriptDelay; + float* priority; + __int16* audioTriggers; + __int16* blendLookup; + __int16* npcTriggers; + __int16* audioStateIds; + uintptr_t detailSoundBank; + uintptr_t audioRvbPanInfo; + __int16* parent; + uintptr_t linkTo; + uintptr_t spatialTree; +}; + +struct ClientTriggerBlend +{ + unsigned __int16 numClientTriggerBlendNodes; + uintptr_t blendNodes; +}; + +struct SplinePointEntityRecord +{ + int splineId; + int splineNodeId; + scr_string_t splineNodeLabel; + scr_string_t targetname; + scr_string_t target; + scr_string_t string; + float speed; + float splineNodeTension; + vec3_t origin; + vec3_t angles; + float throttle; + vec2_t corridorDims; + vec3_t tangent; + float distToNextNode; + vec3_t positionCubic[4]; + vec3_t tangentQuadratic[3]; +}; + +struct SplinePointRecordList +{ + unsigned __int16 splinePointCount; + float splineLength; + SplinePointEntityRecord* splinePoints; +}; + +struct SplineRecordList +{ + unsigned __int16 splineCount; + SplinePointRecordList* splines; +}; + +struct __declspec(align(8)) cmodel_t +{ + Bounds bounds; + float radius; + uintptr_t physicsAsset; + unsigned __int16 physicsShapeOverrideIdx; + unsigned __int16 navObstacleIdx; + unsigned int edgeFirstIndex; + unsigned int edgeTotalCount; +}; + +struct MapEdgeList +{ + const char* name; + vec3_t mins; + vec3_t maxs; + unsigned int transientIndex; + unsigned int dynamicQueryTypes; + unsigned int staticQueryTypes; + unsigned int numDynamicEdges; + unsigned int numStaticEdges; + bool valid; + unsigned int numEdges; + vec4_t(*edges)[2]; + uintptr_t edgeMetadata; + unsigned int numEdgeOctrees; + uintptr_t edgeOctrees; + unsigned int numEdgeOctreeNodeSet; + uintptr_t edgeOctreeNodeSets; + unsigned int numEdgeIndices; + unsigned int* edgeIndices; + unsigned int numEdgeAdjacencyMetadata; + uintptr_t edgeAdjacencyMetadata; + unsigned int numEdgeAdjacency; + uintptr_t edgeAdjacency; +}; + +struct __declspec(align(4)) CM_ClientModel +{ + vec3_t spawnOrigin; + vec3_t spawnAngles; + const XModel* model; + scr_string_t animationTreeName; + XAnimParts* animation; + scr_string_t name; + bool noPhysics; + bool noCloth; +}; + +struct __declspec(align(8)) MapEnts +{ + const char* name; + char* entityString; + int numEntityChars; + unsigned __int8 field_14; + unsigned __int8 field_15; + unsigned __int8 field_16; + unsigned __int8 field_17; + MapTriggers trigger; + ClientTriggers clientTrigger; + ClientTriggerBlend clientTriggerBlend; + SpawnPointRecordList spawnList; + SplineRecordList splineList; + unsigned int havokEntsShapeDataSize; + unsigned __int8 field_14C; + unsigned __int8 field_14D; + unsigned __int8 field_14E; + unsigned __int8 field_14F; + char* havokEntsShapeData; + int numSubModels; + unsigned __int8 field_15C; + unsigned __int8 field_15D; + unsigned __int8 field_15E; + unsigned __int8 field_15F; + cmodel_t* cmodels; + unsigned __int8 field_168; + unsigned __int8 field_169; + unsigned __int8 field_16A; + unsigned __int8 field_16B; + int numEdgeLists; + MapEdgeList** edgeLists; + uintptr_t edgeListSpatialTree; + int numClientModels; + unsigned __int8 field_184; + unsigned __int8 field_185; + unsigned __int8 field_186; + unsigned __int8 field_187; + CM_ClientModel* clientModels; + unsigned __int8 field_190; + unsigned __int8 field_191; + unsigned __int8 field_192; + unsigned __int8 field_193; + unsigned __int8 field_194; + unsigned __int8 field_195; + unsigned __int8 field_196; + unsigned __int8 field_197; + unsigned __int8 field_198; + unsigned __int8 field_199; + unsigned __int8 field_19A; + unsigned __int8 field_19B; + int dynEntityListsCount[2]; + __declspec(align(8)) unsigned __int8 field_1A8; + unsigned __int8 field_1A9; + unsigned __int8 field_1AA; + unsigned __int8 field_1AB; + unsigned __int8 field_1AC; + unsigned __int8 field_1AD; + unsigned __int8 field_1AE; + unsigned __int8 field_1AF; + unsigned __int8 field_1B0; + unsigned __int8 field_1B1; + unsigned __int8 field_1B2; + unsigned __int8 field_1B3; + unsigned __int8 field_1B4; + unsigned __int8 field_1B5; + unsigned __int8 field_1B6; + unsigned __int8 field_1B7; + unsigned __int8 field_1B8; + unsigned __int8 field_1B9; + unsigned __int8 field_1BA; + unsigned __int8 field_1BB; + unsigned __int8 field_1BC; + unsigned __int8 field_1BD; + unsigned __int8 field_1BE; + unsigned __int8 field_1BF; + unsigned __int8 field_1C0; + unsigned __int8 field_1C1; + unsigned __int8 field_1C2; + unsigned __int8 field_1C3; + unsigned __int8 field_1C4; + unsigned __int8 field_1C5; + unsigned __int8 field_1C6; + unsigned __int8 field_1C7; + uintptr_t dynEntSpatialPopulation[2]; + uintptr_t dynEntSpatialTransientMap[2]; + unsigned __int8 field_1E8; + unsigned __int8 field_1E9; + unsigned __int8 field_1EA; + unsigned __int8 field_1EB; + int clientEntAnchorCount; + uintptr_t clientEntAnchors; + unsigned __int8 scriptableMapEnts; + unsigned __int8 field_1F9; + unsigned __int8 field_1FA; + unsigned __int8 field_1FB; + unsigned __int8 field_1FC; + unsigned __int8 field_1FD; + unsigned __int8 field_1FE; + unsigned __int8 field_1FF; + unsigned __int8 field_200; + unsigned __int8 field_201; + unsigned __int8 field_202; + unsigned __int8 field_203; + unsigned __int8 field_204; + unsigned __int8 field_205; + unsigned __int8 field_206; + unsigned __int8 field_207; + unsigned __int8 field_208; + unsigned __int8 field_209; + unsigned __int8 field_20A; + unsigned __int8 field_20B; + unsigned __int8 field_20C; + unsigned __int8 field_20D; + unsigned __int8 field_20E; + unsigned __int8 field_20F; + unsigned __int8 field_210; + unsigned __int8 field_211; + unsigned __int8 field_212; + unsigned __int8 field_213; + unsigned __int8 field_214; + unsigned __int8 field_215; + unsigned __int8 field_216; + unsigned __int8 field_217; + unsigned __int8 field_218; + unsigned __int8 field_219; + unsigned __int8 field_21A; + unsigned __int8 field_21B; + unsigned __int8 field_21C; + unsigned __int8 field_21D; + unsigned __int8 field_21E; + unsigned __int8 field_21F; + unsigned __int8 field_220; + unsigned __int8 field_221; + unsigned __int8 field_222; + unsigned __int8 field_223; + unsigned __int8 field_224; + unsigned __int8 field_225; + unsigned __int8 field_226; + unsigned __int8 field_227; + unsigned __int8 field_228; + unsigned __int8 field_229; + unsigned __int8 field_22A; + unsigned __int8 field_22B; + unsigned __int8 field_22C; + unsigned __int8 field_22D; + unsigned __int8 field_22E; + unsigned __int8 field_22F; + unsigned __int8 field_230; + unsigned __int8 field_231; + unsigned __int8 field_232; + unsigned __int8 field_233; + unsigned __int8 field_234; + unsigned __int8 field_235; + unsigned __int8 field_236; + unsigned __int8 field_237; + unsigned __int8 field_238; + unsigned __int8 field_239; + unsigned __int8 field_23A; + unsigned __int8 field_23B; + unsigned __int8 field_23C; + unsigned __int8 field_23D; + unsigned __int8 field_23E; + unsigned __int8 field_23F; + unsigned __int8 field_240; + unsigned __int8 field_241; + unsigned __int8 field_242; + unsigned __int8 field_243; + unsigned __int8 field_244; + unsigned __int8 field_245; + unsigned __int8 field_246; + unsigned __int8 field_247; + unsigned __int8 field_248; + unsigned __int8 field_249; + unsigned __int8 field_24A; + unsigned __int8 field_24B; + unsigned __int8 field_24C; + unsigned __int8 field_24D; + unsigned __int8 field_24E; + unsigned __int8 field_24F; + unsigned __int8 field_250; + unsigned __int8 field_251; + unsigned __int8 field_252; + unsigned __int8 field_253; + unsigned __int8 field_254; + unsigned __int8 field_255; + unsigned __int8 field_256; + unsigned __int8 field_257; + unsigned __int8 field_258; + unsigned __int8 field_259; + unsigned __int8 field_25A; + unsigned __int8 field_25B; + unsigned __int8 field_25C; + unsigned __int8 field_25D; + unsigned __int8 field_25E; + unsigned __int8 field_25F; + unsigned __int8 field_260; + unsigned __int8 field_261; + unsigned __int8 field_262; + unsigned __int8 field_263; + unsigned __int8 field_264; + unsigned __int8 field_265; + unsigned __int8 field_266; + unsigned __int8 field_267; + unsigned __int8 field_268; + unsigned __int8 field_269; + unsigned __int8 field_26A; + unsigned __int8 field_26B; + unsigned __int8 field_26C; + unsigned __int8 field_26D; + unsigned __int8 field_26E; + unsigned __int8 field_26F; + unsigned __int8 field_270; + unsigned __int8 field_271; + unsigned __int8 field_272; + unsigned __int8 field_273; + unsigned __int8 field_274; + unsigned __int8 field_275; + unsigned __int8 field_276; + unsigned __int8 field_277; + unsigned __int8 field_278; + unsigned __int8 field_279; + unsigned __int8 field_27A; + unsigned __int8 field_27B; + unsigned __int8 field_27C; + unsigned __int8 field_27D; + unsigned __int8 field_27E; + unsigned __int8 field_27F; + unsigned __int8 field_280; + unsigned __int8 field_281; + unsigned __int8 field_282; + unsigned __int8 field_283; + unsigned __int8 field_284; + unsigned __int8 field_285; + unsigned __int8 field_286; + unsigned __int8 field_287; + unsigned __int8 field_288; + unsigned __int8 field_289; + unsigned __int8 field_28A; + unsigned __int8 field_28B; + unsigned __int8 field_28C; + unsigned __int8 field_28D; + unsigned __int8 field_28E; + unsigned __int8 field_28F; + unsigned __int8 field_290; + unsigned __int8 field_291; + unsigned __int8 field_292; + unsigned __int8 field_293; + unsigned __int8 field_294; + unsigned __int8 field_295; + unsigned __int8 field_296; + unsigned __int8 field_297; + unsigned __int8 field_298; + unsigned __int8 field_299; + unsigned __int8 field_29A; + unsigned __int8 field_29B; + unsigned __int8 field_29C; + unsigned __int8 field_29D; + unsigned __int8 field_29E; + unsigned __int8 field_29F; + unsigned __int8 field_2A0; + unsigned __int8 field_2A1; + unsigned __int8 field_2A2; + unsigned __int8 field_2A3; + unsigned __int8 field_2A4; + unsigned __int8 field_2A5; + unsigned __int8 field_2A6; + unsigned __int8 field_2A7; + unsigned __int8 field_2A8; + unsigned __int8 field_2A9; + unsigned __int8 field_2AA; + unsigned __int8 field_2AB; + unsigned __int8 field_2AC; + unsigned __int8 field_2AD; + unsigned __int8 field_2AE; + unsigned __int8 field_2AF; + unsigned __int8 field_2B0; + unsigned __int8 field_2B1; + unsigned __int8 field_2B2; + unsigned __int8 field_2B3; + unsigned __int8 field_2B4; + unsigned __int8 field_2B5; + unsigned __int8 field_2B6; + unsigned __int8 field_2B7; + unsigned __int8 field_2B8; + unsigned __int8 field_2B9; + unsigned __int8 field_2BA; + unsigned __int8 field_2BB; + unsigned __int8 field_2BC; + unsigned __int8 field_2BD; + unsigned __int8 field_2BE; + unsigned __int8 field_2BF; + unsigned __int8 field_2C0; + unsigned __int8 field_2C1; + unsigned __int8 field_2C2; + unsigned __int8 field_2C3; + unsigned __int8 field_2C4; + unsigned __int8 field_2C5; + unsigned __int8 field_2C6; + unsigned __int8 field_2C7; + unsigned __int8 field_2C8; + unsigned __int8 field_2C9; + unsigned __int8 field_2CA; + unsigned __int8 field_2CB; + unsigned __int8 field_2CC; + unsigned __int8 field_2CD; + unsigned __int8 field_2CE; + unsigned __int8 field_2CF; + unsigned __int8 field_2D0; + unsigned __int8 field_2D1; + unsigned __int8 field_2D2; + unsigned __int8 field_2D3; + unsigned __int8 field_2D4; + unsigned __int8 field_2D5; + unsigned __int8 field_2D6; + unsigned __int8 field_2D7; + unsigned __int8 field_2D8; + unsigned __int8 field_2D9; + unsigned __int8 field_2DA; + unsigned __int8 field_2DB; + unsigned __int8 field_2DC; + unsigned __int8 field_2DD; + unsigned __int8 field_2DE; + unsigned __int8 field_2DF; + unsigned __int8 field_2E0; + unsigned __int8 field_2E1; + unsigned __int8 field_2E2; + unsigned __int8 field_2E3; + unsigned __int8 field_2E4; + unsigned __int8 field_2E5; + unsigned __int8 field_2E6; + unsigned __int8 field_2E7; + unsigned __int8 field_2E8; + unsigned __int8 field_2E9; + unsigned __int8 field_2EA; + unsigned __int8 field_2EB; + unsigned __int8 field_2EC; + unsigned __int8 field_2ED; + unsigned __int8 field_2EE; + unsigned __int8 field_2EF; + unsigned __int8 field_2F0; + unsigned __int8 field_2F1; + unsigned __int8 field_2F2; + unsigned __int8 field_2F3; + unsigned __int8 field_2F4; + unsigned __int8 field_2F5; + unsigned __int8 field_2F6; + unsigned __int8 field_2F7; + unsigned __int8 field_2F8; + unsigned __int8 field_2F9; + unsigned __int8 field_2FA; + unsigned __int8 field_2FB; + unsigned __int8 field_2FC; + unsigned __int8 field_2FD; + unsigned __int8 field_2FE; + unsigned __int8 field_2FF; + unsigned __int8 field_300; + unsigned __int8 field_301; + unsigned __int8 field_302; + unsigned __int8 field_303; + unsigned __int8 field_304; + unsigned __int8 field_305; + unsigned __int8 field_306; + unsigned __int8 field_307; + unsigned __int8 field_308; + unsigned __int8 field_309; + unsigned __int8 field_30A; + unsigned __int8 field_30B; + unsigned __int8 field_30C; + unsigned __int8 field_30D; + unsigned __int8 field_30E; + unsigned __int8 field_30F; + unsigned __int8 field_310; + unsigned __int8 field_311; + unsigned __int8 field_312; + unsigned __int8 field_313; + unsigned __int8 field_314; + unsigned __int8 field_315; + unsigned __int8 field_316; + unsigned __int8 field_317; + unsigned __int8 field_318; + unsigned __int8 field_319; + unsigned __int8 field_31A; + unsigned __int8 field_31B; + unsigned __int8 field_31C; + unsigned __int8 field_31D; + unsigned __int8 field_31E; + unsigned __int8 field_31F; + unsigned __int8 field_320; + unsigned __int8 field_321; + unsigned __int8 field_322; + unsigned __int8 field_323; + unsigned __int8 field_324; + unsigned __int8 field_325; + unsigned __int8 field_326; + unsigned __int8 field_327; + unsigned __int8 field_328; + unsigned __int8 field_329; + unsigned __int8 field_32A; + unsigned __int8 field_32B; + unsigned __int8 field_32C; + unsigned __int8 field_32D; + unsigned __int8 field_32E; + unsigned __int8 field_32F; + unsigned __int8 field_330; + unsigned __int8 field_331; + unsigned __int8 field_332; + unsigned __int8 field_333; + unsigned __int8 field_334; + unsigned __int8 field_335; + unsigned __int8 field_336; + unsigned __int8 field_337; + unsigned __int8 field_338; + unsigned __int8 field_339; + unsigned __int8 field_33A; + unsigned __int8 field_33B; + unsigned __int8 field_33C; + unsigned __int8 field_33D; + unsigned __int8 field_33E; + unsigned __int8 field_33F; + unsigned __int8 field_340; + unsigned __int8 field_341; + unsigned __int8 field_342; + unsigned __int8 field_343; + unsigned __int8 field_344; + unsigned __int8 field_345; + unsigned __int8 field_346; + unsigned __int8 field_347; + unsigned __int8 field_348; + unsigned __int8 field_349; + unsigned __int8 field_34A; + unsigned __int8 field_34B; + unsigned __int8 field_34C; + unsigned __int8 field_34D; + unsigned __int8 field_34E; + unsigned __int8 field_34F; + unsigned __int8 field_350; + unsigned __int8 field_351; + unsigned __int8 field_352; + unsigned __int8 field_353; + unsigned __int8 field_354; + unsigned __int8 field_355; + unsigned __int8 field_356; + unsigned __int8 field_357; + unsigned __int8 field_358; + unsigned __int8 field_359; + unsigned __int8 field_35A; + unsigned __int8 field_35B; + unsigned __int8 field_35C; + unsigned __int8 field_35D; + unsigned __int8 field_35E; + unsigned __int8 field_35F; + unsigned __int8 field_360; + unsigned __int8 field_361; + unsigned __int8 field_362; + unsigned __int8 field_363; + unsigned __int8 field_364; + unsigned __int8 field_365; + unsigned __int8 field_366; + unsigned __int8 field_367; + unsigned __int8 field_368; + unsigned __int8 field_369; + unsigned __int8 field_36A; + unsigned __int8 field_36B; + unsigned __int8 field_36C; + unsigned __int8 field_36D; + unsigned __int8 field_36E; + unsigned __int8 field_36F; + unsigned __int8 field_370; + unsigned __int8 field_371; + unsigned __int8 field_372; + unsigned __int8 field_373; + unsigned __int8 field_374; + unsigned __int8 field_375; + unsigned __int8 field_376; + unsigned __int8 field_377; + unsigned __int8 field_378; + unsigned __int8 field_379; + unsigned __int8 field_37A; + unsigned __int8 field_37B; + unsigned __int8 field_37C; + unsigned __int8 field_37D; + unsigned __int8 field_37E; + unsigned __int8 field_37F; + unsigned __int8 field_380; + unsigned __int8 field_381; + unsigned __int8 field_382; + unsigned __int8 field_383; + unsigned __int8 field_384; + unsigned __int8 field_385; + unsigned __int8 field_386; + unsigned __int8 field_387; + unsigned __int8 field_388; + unsigned __int8 field_389; + unsigned __int8 field_38A; + unsigned __int8 field_38B; + unsigned __int8 field_38C; + unsigned __int8 field_38D; + unsigned __int8 field_38E; + unsigned __int8 field_38F; + unsigned __int8 field_390; + unsigned __int8 field_391; + unsigned __int8 field_392; + unsigned __int8 field_393; + unsigned __int8 field_394; + unsigned __int8 field_395; + unsigned __int8 field_396; + unsigned __int8 field_397; + unsigned __int8 field_398; + unsigned __int8 field_399; + unsigned __int8 field_39A; + unsigned __int8 field_39B; + unsigned __int8 field_39C; + unsigned __int8 field_39D; + unsigned __int8 field_39E; + unsigned __int8 field_39F; + unsigned __int8 field_3A0; + unsigned __int8 field_3A1; + unsigned __int8 field_3A2; + unsigned __int8 field_3A3; + unsigned __int8 field_3A4; + unsigned __int8 field_3A5; + unsigned __int8 field_3A6; + unsigned __int8 field_3A7; + unsigned __int8 field_3A8; + unsigned __int8 field_3A9; + unsigned __int8 field_3AA; + unsigned __int8 field_3AB; + unsigned __int8 field_3AC; + unsigned __int8 field_3AD; + unsigned __int8 field_3AE; + unsigned __int8 field_3AF; + unsigned __int8 field_3B0; + unsigned __int8 field_3B1; + unsigned __int8 field_3B2; + unsigned __int8 field_3B3; + unsigned __int8 field_3B4; + unsigned __int8 field_3B5; + unsigned __int8 field_3B6; + unsigned __int8 field_3B7; + unsigned __int8 field_3B8; + unsigned __int8 field_3B9; + unsigned __int8 field_3BA; + unsigned __int8 field_3BB; + unsigned __int8 field_3BC; + unsigned __int8 field_3BD; + unsigned __int8 field_3BE; + unsigned __int8 field_3BF; + unsigned __int8 field_3C0; + unsigned __int8 field_3C1; + unsigned __int8 field_3C2; + unsigned __int8 field_3C3; + unsigned __int8 field_3C4; + unsigned __int8 field_3C5; + unsigned __int8 field_3C6; + unsigned __int8 field_3C7; + unsigned __int8 field_3C8; + unsigned __int8 field_3C9; + unsigned __int8 field_3CA; + unsigned __int8 field_3CB; + unsigned __int8 field_3CC; + unsigned __int8 field_3CD; + unsigned __int8 field_3CE; + unsigned __int8 field_3CF; + unsigned __int8 field_3D0; + unsigned __int8 field_3D1; + unsigned __int8 field_3D2; + unsigned __int8 field_3D3; + unsigned __int8 field_3D4; + unsigned __int8 field_3D5; + unsigned __int8 field_3D6; + unsigned __int8 field_3D7; + unsigned __int8 field_3D8; + unsigned __int8 field_3D9; + unsigned __int8 field_3DA; + unsigned __int8 field_3DB; + unsigned __int8 field_3DC; + unsigned __int8 field_3DD; + unsigned __int8 field_3DE; + unsigned __int8 field_3DF; + unsigned __int8 field_3E0; + unsigned __int8 field_3E1; + unsigned __int8 field_3E2; + unsigned __int8 field_3E3; + unsigned __int8 field_3E4; + unsigned __int8 field_3E5; + unsigned __int8 field_3E6; + unsigned __int8 field_3E7; + unsigned __int8 field_3E8; + unsigned __int8 field_3E9; + unsigned __int8 field_3EA; + unsigned __int8 field_3EB; + unsigned __int8 field_3EC; + unsigned __int8 field_3ED; + unsigned __int8 field_3EE; + unsigned __int8 field_3EF; + unsigned __int8 field_3F0; + unsigned __int8 field_3F1; + unsigned __int8 field_3F2; + unsigned __int8 field_3F3; + unsigned __int8 field_3F4; + unsigned __int8 field_3F5; + unsigned __int8 field_3F6; + unsigned __int8 field_3F7; + unsigned __int8 field_3F8; + unsigned __int8 field_3F9; + unsigned __int8 field_3FA; + unsigned __int8 field_3FB; + unsigned __int8 field_3FC; + unsigned __int8 field_3FD; + unsigned __int8 field_3FE; + unsigned __int8 field_3FF; + unsigned __int8 field_400; + unsigned __int8 field_401; + unsigned __int8 field_402; + unsigned __int8 field_403; + unsigned __int8 field_404; + unsigned __int8 field_405; + unsigned __int8 field_406; + unsigned __int8 field_407; +}; + + +struct CollisionHeatmapEntry +{ + int vertexCount; + float vertexDensity; + vec3_t minExtent; + vec3_t maxExtent; +}; + +struct Stage +{ + const char* name; + vec3_t origin; + unsigned __int16 triggerIndex; + unsigned __int8 sunPrimaryLightIndex; + unsigned int entityUID; + vec3_t skyRotationAngles; +}; + +struct __declspec(align(8)) clipMap_t +{ + const char* name; + int isInUse; + unsigned int numStaticModelCollisionModelLists; + StaticModelCollisionModelList* staticModelCollisionModelLists; + MapEnts* mapEnts; + Stage* stages; + unsigned __int8 stageCount; + MapTriggers stageTrigger; + vec3_t broadphaseMin; + vec3_t broadphaseMax; + PhysicsCapacities physicsCapacities; + unsigned int havokWorldShapeDataSize; + char* havokWorldShapeData; + unsigned int numCollisionHeatmapEntries; + CollisionHeatmapEntry* collisionHeatmap; + unsigned int totalGlassInitPieceCount; + unsigned int totalGlassPieceLimit; + uintptr_t topDownMapData; + const char* visionSetName; + unsigned int checksum; +}; + +struct __declspec(align(8)) WeaponDef +{ + const char* szOverlayName; + XModel* gunXModel; + XModel* gunXModelLeftHand; + XModel* gunXModelRightHand; + XModel* defaultViewModel; + XModel* defaultWorldModelLeftHand; + XModel* defaultWorldModelRightHand; + XModel* worldModel; + XModel* worldXModelLeftHand; + XModel* worldXModelRightHand; + XModel* defaultWorldModel; + XModel* censorshipWorldModel; + XModel* censorshipWorldModelLeftHand; + XModel* censorshipWorldModelRightHand; + XModel* playerShadowModel; + XModel* playerShadowModelLeftHand; + XModel* playerShadowModelRightHand; + XModel* handXModel; + WeaponAnimPackage* szXAnims; + WeaponAnimPackage* szXAnimsRightHanded; + WeaponAnimPackage* szXAnimsLeftHanded; + XAnimParts* turretRaiseAnim; + XAnimParts* turretIdleAnim; + XAnimParts* turretFireAnim; + WeaponDamageInfo damageInfo; + int iFireTime; + int iFireDelay; + int iFireTimeAkimbo; + int iFireDelayAkimbo; + float sprintOutTimerScale; + const char* szModeName; + scr_string_t* notetrackRumbleMapKeys; + scr_string_t* notetrackRumbleMapValues; + scr_string_t* notetrackFXMapKeys; + FxCombinedDef* notetrackFXMapValues; + scr_string_t* notetrackFXMapTagValues; + int playerAnimType; + int scriptedAnimEvent; + int scriptedAnimType; + int weapType; + int weapClass; + int penetrateType; + int inventoryType; + int fireType; + int turretFireType; + int burstCount; + int targetAssistType; + int targetAssistBehavior; + float targetAssistRange; + float targetAssistAngle; + float targetAssistLosOffsetForward; + float targetAssistLosOffsetRight; + float targetAssistLosOffsetUp; + bool targetAssistOnlyAvailableInAds; + int reloadType; + float burstFireCooldown; + bool burstFireAuto; + float viewPitchMaxSpeed; + float viewYawMaxSpeed; + bool alignBarrelWithTurretBody; + bool keepOrientationOnExit; + float kickBackForceMultiplier; + bool autoAdjust; + bool networkLODRangeOverride; + float networkLODRangeOverrideDistance; + int offhandClass; + int stance; + WeaponVFXPackage* vfxPackage; + WeaponSFXPackage* sfxPackage; + bool disableBreathOffhand; + int reticleType; + int hitmarkerType; + Material* reticleCenter; + Material* reticleSide; + Material* reticleOnePiece; + int iReticleCenterSize; + int iReticleSideSize; + int iReticleMinOfs; + bool reticleCenterPulse; + int iReticleShakeDuration; + int iReticleSettleDuration; + int iReticleNumBulletsToRapidFire; + int activeReticleType; + bool useTurretViewmodelAnims; + bool useTurret3pIK; + int turret3pAnimType; + float turretFireAnimMinTime; + vec3_t vStandOfs; + vec3_t vStandOfsRot; + vec3_t vStandOfsRotPivot; + vec3_t vStandMove; + vec3_t vStandRot; + vec3_t strafeMove; + vec3_t strafeRot; + int hipOffsetLerpType; + vec3_t vDuckedOfs; + vec3_t vDuckedOfsRot; + vec3_t vDuckedOfsRotPivot; + vec3_t vDuckedMove; + vec3_t vDuckedRot; + vec3_t vProneOfs; + vec3_t vProneMove; + vec3_t vProneRot; + float adsForwardOffset; + float adsRoll; + float fPosMoveRate; + float fPosProneMoveRate; + float fStandMoveMinSpeed; + float fDuckedMoveMinSpeed; + float fProneMoveMinSpeed; + float fPosRotRate; + float fPosProneRotRate; + float fDuckedOfsRotRate; + float fStandRotMinSpeed; + float fDuckedRotMinSpeed; + float fProneRotMinSpeed; + float fReticleShakeMagnitude; + float fReticleRapidFireMultiplier; + XModel* worldClipModel; + XModel* rocketModel; + GfxImage* hudIcon; + GfxImage* pickupIcon; + GfxImage* dangerIconImg; + GfxImage* throwBackIconImg; + Material* dangerIconMat; + Material* throwBackIconMat; + bool hideWarningIcons; + float warningIconsDelay; + int ammoCounterClip; + int iStartAmmo; + int iPerkStartAmmo; + int iPerkMaxAmmo; + const char* szAmmoName; + int iAmmoIndex; + int iMaxAmmo; + int shotCount; + const char* szSharedAmmoCapName; + int iSharedAmmoCapIndex; + int iSharedAmmoCap; + int iAmmoUsedPerShot; + bool requireAmmoUsedPerShot; + bool disableNoAmmoWarning; + float lowAmmoWarningThreshold; + int lowAmmoWarningCount; + int iDamageType; + int iMeleeDamage; + int iMeleeCountToFinisher; + bool hasMeleeFinisher; + float autoAimRange; + float aimAssistRange; + float aimAssistRangeAds; + float aimAssistPitchSlowdown; + float aimAssistPitchSlowdownAds; + float aimAssistYawSlowdown; + float aimAssistYawSlowdownAds; + float aimAssistLockonStrength; + float aimPadding; + float enemyCrosshairRange; + float moveSpeedScale; + float adsMoveSpeedScale; + float sprintDurationScale; + float sprintRestoreDelay; + ADSOverlay overlay; + int overlayInterface; + float fAdsBobFactor; + float fAdsViewBobMult; + float fAdsGunBobPitchScale; + float fAdsGunBobYawScale; + float fAdsGunBobTiltPitchScale; + float fAdsGunBobTiltYawScale; + float fAdsGunBobTiltRollScale; + float fAdsGunBobTiltBulletDirScale; + float fAdsGunBobTiltOffset; + float fAdsGunBobCrouchFactor; + float adsCrouchViewKickFactor; + float adsCrouchGunKickFactor; + float adsProneViewKickFactor; + float adsProneGunKickFactor; + float fHipSpreadStandMin; + float fHipSpreadDuckedMin; + float fHipSpreadProneMin; + float hipSpreadSprintMin; + float hipSpreadInAirMin; + float hipSpreadStandMax; + float hipSpreadDuckedMax; + float hipSpreadProneMax; + float hipSpreadSprintMax; + float hipSpreadInAirMax; + float fHipSpreadDecayRate; + float fHipSpreadFireAdd; + float fHipSpreadTurnAdd; + float fHipSpreadMoveAdd; + float fHipSpreadDuckedDecay; + float fHipSpreadProneDecay; + float hipSpreadSprintDecay; + float hipSpreadInAirDecay; + float fHipReticleSidePos; + float fAdsIdleAmount; + float fHipIdleAmount; + float adsIdleSpeed; + float hipIdleSpeed; + float fIdleCrouchFactor; + float fIdleProneFactor; + float fGunMaxPitch; + float fGunMaxYaw; + float fViewMaxPitch; + float fViewMaxYaw; + float adsIdleLerpStartTime; + float adsIdleLerpTime; + bool useUninterruptedAdsIdleMotion; + bool disableInputDrivenViewReturnDampening; + float slideSpreadMin; + float slideSpreadMax; + float slideSpreadDecayRate; + float slideSpreadFireAdd; + float slideSpreadTurnAdd; + SwaySettings swaySettings; + float adsFireRateScale; + float adsDamageRangeScale; + float adsFireAnimFrac; + float fireTimerLerpToAdsScale; + bool alwaysFireAtMaxRangeInAds; + bool adsAlignEnabled; + bool disableTagAlignX; + vec3_t adsAlignOffset; + int adsAlignOffsetLerpType; + int adsAlignLerpType; + float adsMovementAnimLerpStart; + float adsMovementAnimLerpEnd; + float dualWieldViewModelOffset; + float fScopeDriftDelay; + float fScopeDriftLerpInTime; + float fScopeDriftSteadyTime; + float fScopeDriftLerpOutTime; + float fScopeDriftSteadyFactor; + float fScopeDriftUnsteadyFactor; + int killIconRatio; + int iReloadAmmoAdd; + int iReloadStartAdd; + bool reloadTwoRound; + int ammoDropStockMin; + int ammoDropClipPercentMin; + int ammoDropClipPercentMax; + float cameraShakeScale; + int cameraShakeDuration; + float cameraShakeRadius; + int iExplosionRadius; + int iExplosionRadiusMin; + int iExplosionForceRadius; + int iExplosionInnerDamage; + int iExplosionOuterDamage; + float explosionForceScalar; + float damageConeAngle; + float bulletExplDmgMultMin; + float bulletExplDmgMult; + float bulletExplRadiusMult; + int iProjectileSpeed; + int iProjectileSpeedUp; + int iProjectileSpeedForward; + int iProjectileActivateDist; + int iProjectileDetonationRadius; + float projLifetime; + float projLifetimeStdDeviation; + float timeToAccelerate; + float projectileCurvature; + XModel* projectileModel; + int projExplosion; + FxCombinedDef projExplosionEffect; + FxCombinedDef projDudEffect; + FxCombinedDef projTimeoutEffect; + int iExplosionSteppedRadiusInner; + int iExplosionSteppedRadiusMid; + int iExplosionSteppedRadiusOuter; + int iExplosionSteppedDamageInner; + int iExplosionSteppedDamageMid; + int iExplosionSteppedDamageOuter; + float* parallelBounce; + float* perpendicularBounce; + FxCombinedDef vmProjBodyEffect; + FxCombinedDef projBodyEffect; + FxCombinedDef projTrailEffect; + FxCombinedDef projBeaconEffect; + vec3_t vProjectileColor; + int guidedMissileType; + float maxSteeringAccel; + int projIgnitionDelay; + FxCombinedDef projIgnitionEffect; + float fAdsAimPitch; + float adsInCrosshairAlphaStart; + float adsInCrosshairAlphaEnd; + float adsOutCrosshairAlphaStart; + float adsOutCrosshairAlphaEnd; + bool adsShouldShowCrosshair; + float fAdsGunKickPitchMin; + float fAdsGunKickPitchMax; + float fAdsGunKickYawMin; + float fAdsGunKickYawMax; + float fAdsGunKickMagMin; + float fAdsGunKickAccel; + float fAdsGunKickSpeedMax; + float fAdsGunKickSpeedDecay; + float fAdsGunKickStaticDecay; + float fAdsViewKickPitchMin; + float fAdsViewKickPitchMax; + float fAdsViewKickYawMin; + float fAdsViewKickYawMax; + float fAdsViewKickMagMin; + float fAdsViewScatterMin; + float fAdsViewScatterMax; + float fAdsSpread; + float fAdsSpreadNVG; + float adsSpreadStartFrac; + float adsSpreadEndFrac; + int iVisibilityAxis; + float fVisibilityUpOffset; + float fHipGunKickPitchMin; + float fHipGunKickPitchMax; + float fHipGunKickYawMin; + float fHipGunKickYawMax; + float fHipGunKickMagMin; + float fHipGunKickAccel; + float fHipGunKickSpeedMax; + float fHipGunKickSpeedDecay; + float fHipGunKickStaticDecay; + float fHipViewKickPitchMin; + float fHipViewKickPitchMax; + float fHipViewKickYawMin; + float fHipViewKickYawMax; + float fHipViewKickMagMin; + float fHipViewScatterMin; + float fHipViewScatterMax; + float multipleReloadClipPercentage; + float hipStartingGunKickPercent; + float hipStartingViewKickPercent; + int adsStartingKickBullets; + float adsStartingGunKickPercent; + float adsStartingViewKickPercent; + float hipEndingGunKickPercent; + float hipEndingViewKickPercent; + int adsEndingKickBullets; + float adsEndingGunKickPercent; + float adsEndingViewKickPercent; + float kickAlignedInputScalar; + float kickOpposedInputScalar; + float viewKickMaintainFraction; + float adsGunTiltPitchFactor; + float adsGunTiltYawFactor; + float adsGunTiltRollFactor; + float adsGunTiltOffset; + float hipGunTiltPitchFactor; + float hipGunTiltYawFactor; + float hipGunTiltRollFactor; + float hipGunTiltOffset; + bool useNewViewKick; + bool useNewGunKick; + bool useAngularViewKick; + bool useAngularGunKick; + float hipAngularViewKickDir[6]; + float hipAngularViewKickDev[6]; + float hipAngularViewKickStrengthMin[6]; + float hipAngularViewKickStrengthMax[6]; + float hipAngularViewKickPitchScale[6]; + float adsAngularViewKickDir[6]; + float adsAngularViewKickDev[6]; + float adsAngularViewKickStrengthMin[6]; + float adsAngularViewKickStrengthMax[6]; + float adsAngularViewKickPitchScale[6]; + int adsAngularViewKickBullet[6]; + bool adsAngularViewKickUseSet[6]; + float hipAngularGunKickDir[6]; + float hipAngularGunKickDev[6]; + float hipAngularGunKickStrengthMin[6]; + float hipAngularGunKickStrengthMax[6]; + float hipAngularGunKickPitchScale[6]; + float adsAngularGunKickDir[6]; + float adsAngularGunKickDev[6]; + float adsAngularGunKickStrengthMin[6]; + float adsAngularGunKickStrengthMax[6]; + float adsAngularGunKickPitchScale[6]; + int adsAngularGunKickBullet[6]; + bool adsAngularGunKickUseSet[6]; + float hipViewKickReturnAccelScale; + float adsViewKickReturnAccelScale; + float hipViewKickReturnSpeedCurveScale; + float adsViewKickReturnSpeedCurveScale; + float hipGunKickReturnAccelScale; + float adsGunKickReturnAccelScale; + float hipGunKickReturnSpeedCurveScale; + float adsGunKickReturnSpeedCurveScale; + float hipSpreadStandMoveMax; + float hipSpreadDuckedMoveMax; + float hipSpreadProneMoveMax; + float hipSpreadSprintMoveMax; + float hipSpreadInAirMoveMax; + float slideSpreadMoveMax; + WeaponOffsetCurveDescription weaponOffsetCurveHoldFireSlow; + WeaponOffsetCurveDescription weaponOffsetCurveHoldFireFast; + WeaponOffsetCurveDescription weaponOffsetCurveAds; + WeaponOffsetCurveDescription weaponOffsetCurveAlwaysOn; + WeaponOffsetCurveDescription weaponOffsetCurveKick; + WeaponOffsetCurveDescription weaponOffsetCurveSnapDecay; + int numWeaponOffsetPatterns; + WeaponOffsetPatternDescription* weaponOffsetPatterns; + int numWeaponOffsetPatternsKickOrSnapDecay; + WeaponOffsetPatternDescription** weaponOffsetPatternsKickOrSnapDecay; + float fightDist; + float maxDist; + const char* accuracyGraphName[2]; + vec2_t* originalAccuracyGraphKnots[2]; + unsigned __int16 originalAccuracyGraphKnotCount[2]; + int iPositionReloadTransTime; + float leftArc; + float rightArc; + float topArc; + float bottomArc; + float visualPitchLimitTop; + float visualPitchLimitBottom; + bool softLeftRightArc; + float accuracy; + float aiSpread; + float playerSpread; + float minTurnSpeed[2]; + float maxTurnSpeed[2]; + float pitchConvergenceTime; + float yawConvergenceTime; + float suppressTime; + float suppressTimeTargetKilled; + float aiReturnToDefaultSpeed[2]; + float maxRange; + float fAnimHorRotateInc; + float fPlayerPositionDist; + const char* szUseHintString; + const char* dropHintString; + unsigned int iUseHintStringIndex; + unsigned int dropHintStringIndex; + float horizViewJitter; + float vertViewJitter; + bool enableViewBounceFire; + float viewBounceFireDecay; + float viewBounceFireFrequency; + float viewBounceFirePitchScale; + float viewBounceFireRollScale; + float scanSpeed; + float scanAccel; + int scanPauseTime; + const char* szScript; + float adsSpeedMs[2]; + float adsAccelSec[2]; + bool deferDamageToParentVehicle; + bool useSteppedExplosionDamage; + float destabilizationRateTime; + float destabilizationCurvatureMax; + int destabilizeDistance; + float robotechMaxPitch; + float robotechMaxYaw; + float robotechFrequency; + float robotechVariancePitch; + float robotechVarianceYaw; + float robotechVarianceFrequency; + float* locationDamageMultipliers; + unsigned __int8* hitLocPriorityMap; + float unittypeMultipliers[7]; + RumbleInfo* fireRumble; + RumbleInfo* meleeImpactRumble; + float heatAccumulationPerShot; + float heatDissipationPerSecond; + float heatSmokeStartThreshold; + float heatSmokeStopThreshold; + bool heatIsOpenBolt; + int tracerStyle; + TracerDef* tracerType; + TracerDef* overchargeTracerType; + LaserDef* laserTypeViewModel; + LaserDef* laserTypeViewModelAlt; + LaserDef* laserTypeFriendly; + LaserDef* laserTypeEnemy; + bool turretADSEnabled; + float turretADSTime; + float turretFov; + float turretFovADS; + float turretScopeZoomRate; + float turretScopeZoomMin; + float turretScopeZoomMax; + float turretOverheatPenalty; + SndAliasLookup turretOverheatSound; + FxCombinedDef turretOverheatEffect; + RumbleInfo* turretBarrelSpinRumble; + float turretBarrelSpinSpeed; + float turretBarrelSpinUpTime; + float turretBarrelSpinDownTime; + SndAliasLookup turretBarrelSpinMaxSnd; + SndAliasLookup turretBarrelSpinUpSnd[4]; + SndAliasLookup turretBarrelSpinDownSnd[4]; + SndAliasLookup missileConeSoundAlias; + SndAliasLookup missileConeSoundAliasAtBase; + float missileConeSoundRadiusAtTop; + float missileConeSoundRadiusAtBase; + float missileConeSoundHeight; + float missileConeSoundOriginOffset; + float missileConeSoundVolumescaleAtCore; + float missileConeSoundVolumescaleAtEdge; + float missileConeSoundVolumescaleCoreSize; + float missileConeSoundPitchAtTop; + float missileConeSoundPitchAtBottom; + float missileConeSoundPitchTopSize; + float missileConeSoundPitchBottomSize; + float missileConeSoundCrossfadeTopSize; + float missileConeSoundCrossfadeBottomSize; + bool meleeOverrideValues; + float aim_automelee_lerp; + float aim_automelee_region_height; + float aim_automelee_region_width; + float aim_automelee_maxPitchMovement; + float aim_automelee_maxYawMovement; + float player_meleeHeight; + float player_meleeWidth; + float playerMeleeRangeStanding; + float playerMeleeRangeCrouched; + float playerMeleeRangeProne; + float playerMeleeRangeChargeStanding; + float playerMeleeRangeChargeCrouched; + float playerMeleeChargeHeightTolerance; + bool shieldAllowFiring; + int shieldMaxSpeed; + bool shieldAlwaysDisplay; + Gesture* shieldDeployGesture; + Gesture* shieldFireWeapGesture; + Gesture* shieldDeployWhileFiring; + Gesture* shieldRetractWhileFiring; + Gesture* shieldBashGesture; + FxCombinedDef shieldMeleeFx; + float shieldMeleeFxDelay; + float HitEarthquakeScale; + float HitEarthquakeDuration; + float HitEarthquakeRadius; + RumbleInfo* shieldHitRumble; + float MissEarthquakeScale; + float MissEarthquakeDuration; + float MissEarthquakeRadius; + RumbleInfo* shieldMissRumble; + int shieldDeployButton; + bool shieldUsesEnergy; + float shieldMaxEnergy; + float shieldConsumptionRate; + float shieldMeleeEnergyCost; + float shieldMeleeHitEnergyCost; + float reactiveMotionRadiusScale; + float reactiveMotionFrequencyScale; + float reactiveMotionAmplitudeScale; + float reactiveMotionFalloff; + float reactiveMotionLifetime; + unsigned __int8 transientBaseViewFlags; + unsigned __int8 transientBaseWorldFlags; + bool hasAnyTransientModels; + bool blendFireAnimations; + bool sharedAmmo; + bool lockonSupported; + bool requireLockonToFire; + bool isAirburstWeapon; + bool bigExplosion; + bool noAdsWhenMagEmpty; + bool avoidDropCleanup; + bool allowGrenadeSwitching; + bool inheritsPerks; + bool forceUse; + bool ladderWeapon; + bool executionVictimHiddenWeapon; + bool crosshairColorChange; + bool bRifleBullet; + bool bEnergyBullet; + bool bIncendiaryBullet; + bool armorPiercing; + bool impaling; + bool bBoltAction; + bool aimDownSight; + bool canHoldBreath; + bool meleeOnly; + bool supportsAlternateMelee; + bool bRechamberWhileAds; + bool reloadWhileAds; + bool bBulletExplosiveDamage; + bool bCookOffHold; + bool overCookIsNotLethal; + bool reticleSpin45; + bool bClipOnly; + bool bDoesNotConsumeAmmo; + bool bRemoveWeaponOnEmpty; + bool noAmmoPickup; + bool adsFireOnly; + bool cancelAutoHolsterWhenEmpty; + bool disableSwitchToWhenEmpty; + bool suppressAmmoPrimaryDisplay; + bool suppressAmmoReserveDisplay; + LaserSettings laserSettings; + bool markableViewmodel; + bool isPredictedProjectile; + int clientTrajectoryBlendOutTime; + int serverTrajectoryBlendInTime; + int dualWieldType; + bool flipKillIcon; + bool bNoPartialReload; + bool reloadDisabled; + bool blocksProne; + bool silenced; + bool doNotSuppressAI; + bool isRollingGrenade; + bool dropGrenadeHeldOnDeath; + bool projExplosionEffectForceNormalUp; + bool projExplosionEffectInheritParentDirection; + bool bProjImpactExplode; + bool spawnProjAtMuzzle; + bool correctBulletTrajectory; + float maxCorrectionAngle; + bool disableProjectileCrumpleCheck; + bool bProjTrajectoryEvents; + bool bProjWhizByEnabled; + bool stickToPlayers; + bool stickToVehicles; + bool stickToTurrets; + bool stickToNonStick; + bool projEnableMissileStickiness; + bool enableMissileRicochet; + bool thrownSideways; + bool disableFiring; + bool firesOnWeaponSwitch; + bool disableHolding; + bool timedDetonation; + float missileRicochetMinAngleOfIncidence; + float missileCrumpleMinSpeed; + int detonateType; + XModel* detonatorWorldModel; + int explosiveDamageDelay; + int fuseTime; + int aiFuseTime; + int maxHoldTime; + GrenadeRotationParams rotationParams; + bool holdButtonToThrow; + bool autoHold; + bool infiniteHold; + bool freezeMovementWhenFiring; + bool offhandAllowsSprint; + bool thermalScope; + bool thermalToggle; + bool outlineEnemies; + bool outlineDepthTest; + bool outlineFill; + float enemyOutlineR; + float enemyOutlineG; + float enemyOutlineB; + float enemyOutlineA; + float allyOutlineR; + float allyOutlineG; + float allyOutlineB; + float allyOutlineA; + bool depthScan; + float depthScanThickness; + float depthScanR; + float depthScanG; + float depthScanB; + float depthScanA; + float depthScanOutlineThickness; + float depthScanOutlineR; + float depthScanOutlineG; + float depthScanOutlineB; + float depthScanOutlineA; + bool depthScanOverlay; + float depthScanOverlayStrength; + float depthScanOverlayXTiles; + float depthScanOverlayYTiles; + float depthScanOverlayXScroll; + float depthScanOverlayYScroll; + float blurSceneAdsInFraction; + float blurSceneAdsOutFraction; + bool altModeSameWeapon; + bool playAltGesturesForOffhandWeapons; + bool turretBarrelSpinEnabled; + bool missileConeSoundEnabled; + bool missileConeSoundPitchshiftEnabled; + bool missileConeSoundCrossfadeEnabled; + bool offhandHoldIsCancelable; + bool doNotAllowAttachmentsToOverrideSpread; + bool useScopeDrift; + bool alwaysShatterGlassOnImpact; + bool jumpSpread; + bool noFullViewmodelAnimations; + float killcamOffset; + bool useDualFOV; + bool showViewModelInDualFOV; + bool syncedFOVInDualFOV; + bool disableDrop; + bool preferredDrop; + Gesture* gestureAnimation; + float gestureFireStateTime; + Gesture* gesturePullback; + Gesture* gesturePullbackAlt; + float minPullbackTime; + float minPullbackToThrowBlendTime; + float maxPullbackToThrowBlendTime; + Gesture* gestureThrow; + Gesture* gestureThrowAlt; + float gestureFireTime; + Gesture* gestureDetonate; + Gesture* gestureDetonateAlt; + float gestureDetonationTime; + bool gesturesDisablePrimary; + FxCombinedDef cameraFireEffect; + float cameraFireEffectDurationSec; + float changedFireTime; + float changedFireTimeAkimbo; + int changedFireTimeNumBullets; + int chargeType; + float chargeGain; + float chargeCostPerShot; + float chargeLossWhenIdle; + float chargeEmptyCooldown; + float chargeFireAtMaxDamageMultiplier; + int chargeMeterEffectBoneCount; + FxCombinedDef chargeMeterEffect; + SndAliasLookup chargeUpSound; + SndAliasLookup chargeDownSound; + SndAliasLookup chargeUpSoundPlayer; + SndAliasLookup chargeDownSoundPlayer; + SndAliasLookup chargeDownToUpSound; + SndAliasLookup chargeDownToUpSoundPlayer; + SndAliasLookup chargeUpToDownSound; + SndAliasLookup chargeUpToDownSoundPlayer; + SndAliasLookup chargeMaxSound; + SndAliasLookup chargeMaxSoundPlayer; + bool chargeHudReveal; + RumbleInfo* chargeRumble; + scr_string_t stowTag; + XModel* stowOffsetModel; + scr_string_t stowOffsetAttachTag; + int slot; + float maxTargetAngle; + bool spaceshipSecondaryWeapon; + float impulseFieldRadius; + float impulseFieldInitialSpeed; + float impulseFieldMaxSpeed; + float impulseFieldAcceleration; + float impulseFieldInAirImpulseMultiplier; + float impulseFieldInAirImpulseMultiplierInterpTime; + float impulseFieldSlideMultiplier; + float impulseFieldSlideMultiplierInterpTime; + bool impulseFieldIsPush; + bool impulseFieldAffectsFriendlies; + bool impulseFieldAffectsSelf; + bool impulseFieldAffectsProne; + bool regenerationEnabled; + int regenerationTimeMs; + int regenerationAddTimeMs; + int regenerationAmount; + bool regenerationConsumeStock; + bool regenerationDisableWhileFiring; + int deployType; + bool deployRequireOnWalkableSurface; + bool deployRequireOnNavmesh; + bool deployRequireSkyAbove; + bool deployRequireNoOverhang; + bool deployAlwaysUpright; + bool deployEdgeSnap; + float deployCylinderRadius; + float deployCylinderHeight; + float deployMaxDistance; + float deployMaxHeightAboveEye; + float deployEffectHeightOffset; + float deployMaxSlope; + FxCombinedDef deployEffect; + int deployValidGroupId; + int deployIndoorGroupId; + int deployInvalidGroupId; + int deployOutOfRangeGroupId; + int numAnimOverrides; + AnimOverride* animOverrides; + CarryAnimOverride carryAnimOverrides[5]; + int numSfxOverrides; + SFXOverride* sfxOverrides; + int numVfxOverrides; + VFXOverride* vfxOverrides; + float reactiveEmitterDelay; + float grenadeDangerIconDistance; + float bulletDirGunAngleModifierIdleHip; + float bulletDirGunAngleModifierIdleAds; + float bulletDirGunAngleModifierGunKickHip; + float bulletDirGunAngleModifierGunKickAds; + float bulletDirGunAngleModifierGunTiltHip; + float bulletDirGunAngleModifierGunTiltAds; + float viewClampPitchCatchUpTimeSec; + float viewClampYawCatchUpTimeSec; + bool mountTopEnable; + bool mountTopYawClamp; + float mountTopYawMax; + float mountTopGunKickScale; + float mountTopGunCenterScale; + float mountTopViewKickScale; + float mountTopViewCenterScale; + float mountTopGunIdleMotionScale; + float mountTopViewIdleMotionScale; + int mountTopEnterDurationMs; + int mountTopExitDurationMs; + float mountTopEdgeToEyeDistanceForward; + float mountTopEdgeToEyeDistanceAbove; + bool mountSideEnable; + bool mountSideTransitionEnable; + float mountSideRoll; + float mountSideRollStartFrac; + float mountSideRollEndFrac; + float mountSideGunKickScale; + float mountSideGunCenterScale; + float mountSideViewKickScale; + float mountSideViewCenterScale; + float mountSideGunIdleMotionScale; + float mountSideViewIdleMotionScale; + int mountSideEnterDurationMs; + int mountSideExitDurationMs; + float mountSideEdgeToEyeDistanceForward; + float mountSideEdgeToEyeDistanceAbove; + float mountViewmodelOffset; + float mountFOVScale; + RumbleInfo* mountRumble; + WeaponOffsetPatternScaleInfo mountWeaponOffsetPatternScaleInfo; + float adsFireMotionBlur; + int adsFireMotionBlurDurationMs; + float adsFireMotionBlurDecayExponent; + float hipFireMotionBlur; + int hipFireMotionBlurDurationMs; + float hipFireMotionBlurDecayExponent; + float adsCameraShakeRotationScale; + float adsCameraShakeTranslationScale; + AdvancedIdleSettings advancedIdleSettings; + WeaponOffsetPatternScaleInfo crouchedWeaponOffsetPatternScaleInfo; + WeaponOffsetPatternScaleInfo proneWeaponOffsetPatternScaleInfo; + BallisticInfo ballisticInfo; + WeaponEntityNotify* notifyTypes[2]; + float dlcFloat[6]; + bool dlcBool[3]; + bool enableWeaponInspect; + bool stowedOcclusionTestEnabled; + bool ignoreMinTracerSpawnDistance; + bool tracerOverrideEnabled; + bool boltActionReloadIncludesRechamber; +}; + + +struct WeaponCompleteDef +{ + const char* szInternalName; + WeaponDef weapDef; + const char* szDisplayName; + const char* szLootTable; + scr_string_t* hideTags; + AttachmentList attachments[14]; + unsigned int numLootVariants; + unsigned int numNotetrackSoundMappings; + scr_string_t* notetrackSoundMapKeys; + scr_string_t* notetrackSoundMapValues; + unsigned int numNotetrackOverrides; + void* /*NoteTrackToSoundEntry*/ notetrackOverrides; + unsigned int numNotetrackSuitEntries; + void* /*NoteTrackToSuitSoundEntry*/ notetrackSuitEntries; + ZoomSettings zoomSettings; + int iAdsTransInTime; + int iAdsTransOutTime; + int iAdsTransInToOutTime; + int iAdsTransOutToInTime; + int iClipSize; + int vfxImpactType; + float penetrateMultiplier; + float fAdsViewKickCenterSpeed; + float fHipViewKickCenterSpeed; + Material* killIconMat; + Material* dpadIconMat; + Material* dpadIconInactiveMat; + GfxImage* killIconImg; + GfxImage* dpadIconImg; + GfxImage* dpadIconInactiveImg; + int ammoDropStockMax; + bool useSceneDof; + float adsDofPhysicalFstop; + float adsDofPhysicalFocusDistance; + bool adsDofPhysicalFocalTag; + float adsDofPhysicalReloadFstop; + float adsDofPhysicalReloadFocusDistance; + unsigned __int16 accuracyGraphKnotCount[2]; + vec2_t* accuracyGraphKnots[2]; + bool enhanced; + bool dpadIconShowsAmmo; + bool luiWeaponInfoWidgetUsesScopeStencil; + const char* szAltModeInactiveName; + const char* dynamicIconAnimationName; + bool isUsingDynamicIcon; + const char* szLUIWeaponInfoWidgetName; + const char* szLUIWeaponInfoWidgetTag; + const char* szLUICrosshairWidget; +}; + +union XAssetHeader +{ + //PhysicsLibrary* physicsLibrary; + //PhysicsSFXEventAsset* physicsSFXEventAsset; + //PhysicsVFXEventAsset* physicsVFXEventAsset; + PhysicsAsset* physicsAsset; + //PhysicsFXPipeline* physicsFXPipeline; + //PhysicsFXShape* physicsFXShape; + //PhysicsDebugData* physicsDebugData; + //XAnimParts* parts; + //XModelSurfs* modelSurfs; + XModel* model; + //MayhemData* mayhem; + Material* material; + //ComputeShader* computeShader; + //MaterialSerializedShader* serializedShader; + //MaterialTechniqueSet* techniqueSet; + GfxImage* image; + //SndGlobals* soundGlobals; + //SndBankResident* soundBankResident; + //SndBankTransient* soundBankTransient; + clipMap_t* clipMap; + //ComWorld* comWorld; + //GlassWorld* glassWorld; + //PathData* pathData; + //NavMeshData* navMeshData; + //TacticalGraphData* tacGraphData; + MapEnts* mapEnts; + //FxWorld* fxWorld; + //GfxWorld* gfxWorld; + //GfxWorldTransientZone* gfxWorldTransientZone; + //GfxIESProfile* iesProfile; + //GfxLightDef* lightDef; + //GfxGradingClut* gradingClut; + //GfxFogSpline* fogSpline; + //AnimationClass* animClass; + //PlayerAnimScript* playerAnim; + Gesture* gesture; + LocalizeEntry* localize; + //WeaponAttachment* attachment; + WeaponCompleteDef* weapon; + //ParticleSystemDef* vfx; + //FxImpactTable* impactFx; + SurfaceFxTable* surfaceFx; + RawFile* rawfile; + ScriptFile* scriptfile; + ScriptDebugData* scriptDebugData; + StringTable* stringTable; + LeaderboardDef* leaderboardDef; + VirtualLeaderboardDef* virtualLeaderboardDef; + DDLFile* ddlFile; + TracerDef* tracerDef; + VehicleDef* vehDef; + AddonMapEnts* addonMapEnts; + NetConstStrings* netConstStrings; + LuaFile* luaFile; + ScriptableDef* scriptable; + EquipmentSoundTable* equipSndTable; + VectorField* vectorField; + FxParticleSimAnimation* particleSimAnimation; + StreamingInfo* streamingInfo; + LaserDef* laserDef; + TTFDef* ttfDef; + SuitDef* suitDef; + SuitAnimPackage* suitAnimPackage; + CameraDef* cameraDef; + HudOutlineDef* hudOutlineDef; + SpaceshipTargetDef* spaceshipTargetDef; + RumbleInfo* rumble; + RumbleGraph* rumbleGraph; + //WeaponAnimPackage* weaponAnimPackage; + //WeaponSFXPackage* weaponSFXPackage; + //WeaponVFXPackage* weaponVFXPackage; + //FootstepVFX* footstepVFX; + //BehaviorTree* behaviorTree; + //Animset* animset; + //ASM* asmAsset; + //XAnimProceduralBones* proceduralBones; + //XAnimDynamicBones* dynamicBones; + //ReticleDef* reticleDef; + //XAnimCurve* xanimCurve; + //CoverSelector* coverSelector; + //EnemySelector* enemySelector; + //ClientCharacter* clientCharacter; + //ClothAsset* clothAsset; + //CinematicMotionDef* cinematicMotion; + //AccessoryDef* accessory; + //LocDmgTable* locDmgTable; + //BulletPenetration* bulletPenetration; + //ScriptBundle* scriptBundle; + //BlendSpace2DDef* blendSpace2DDef; + //XCam* xcam; + //Camo* camo; + //XCompositeModelDef* compositeModel; + //XModelDetailCollision* modelDetailCollision; + //StreamKey* streamKey; + //StreamTreeOverride* streamTreeOverride; + //KeyValuePairs* keyValuePairs; + //StTerrain* stTerrain; + //NativeScriptPatchFile* nativeScriptPatch; + //CollisionTile* collisionTile; + //ExecutionDef* executionDef; + //CarryObjectDef* carryObjectDef; + //SoundBankListDef* soundBankListDef; + //GfxDecalVolumeMaterial* decalVolumeMaterial; + //GfxDecalVolumeMask* decalVolumeMask; + //DynEntityList* dynEntityList; + void* data; + //FxWorldTransientZone* fxWorldTransientZone; + //DLogSchema* dlogSchema; + //MapEdgeList* mapEdgeList; +}; + +enum XAssetType +{ + ASSET_TYPE_PHYSICSLIBRARY = 0x0, + ASSET_TYPE_PHYSICSSFXEVENTASSET = 0x1, + ASSET_TYPE_PHYSICSVFXEVENTASSET = 0x2, + ASSET_TYPE_PHYSICSASSET = 0x3, + ASSET_TYPE_PHYSICSFXPIPELINE = 0x4, + ASSET_TYPE_PHYSICSFXSHAPE = 0x5, + ASSET_TYPE_PHYSICSDEBUGDATA = 0x6, + ASSET_TYPE_XANIM = 0x7, + ASSET_TYPE_XMODELSURFS = 0x8, + ASSET_TYPE_XMODEL = 0x9, + ASSET_TYPE_MAYHEM = 0xA, + ASSET_TYPE_MATERIAL = 0xB, + ASSET_TYPE_COMPUTESHADER = 0xC, + ASSET_TYPE_LIBSHADER = 0xD, + ASSET_TYPE_VERTEXSHADER = 0xE, + ASSET_TYPE_HULLSHADER = 0xF, + ASSET_TYPE_DOMAINSHADER = 0x10, + ASSET_TYPE_PIXELSHADER = 0x11, + ASSET_TYPE_TECHSET = 0x12, + ASSET_TYPE_IMAGE = 0x13, + ASSET_TYPE_SOUNDGLOBALS = 0x14, + ASSET_TYPE_SOUNDBANK = 0x15, + ASSET_TYPE_SOUNDBANKTRANSIENT = 0x16, + ASSET_TYPE_COL_MAP = 0x17, + ASSET_TYPE_COM_MAP = 0x18, + ASSET_TYPE_GLASS_MAP = 0x19, + ASSET_TYPE_AIPATHS = 0x1A, + ASSET_TYPE_NAVMESH = 0x1B, + ASSET_TYPE_TACGRAPH = 0x1C, + ASSET_TYPE_MAP_ENTS = 0x1D, + ASSET_TYPE_FX_MAP = 0x1E, + ASSET_TYPE_GFX_MAP = 0x1F, + ASSET_TYPE_GFX_MAP_TRZONE = 0x20, + ASSET_TYPE_IESPROFILE = 0x21, + ASSET_TYPE_LIGHTDEF = 0x22, + ASSET_TYPE_GRADINGCLUT = 0x23, + ASSET_TYPE_UI_MAP = 0x24, + ASSET_TYPE_FOGSPLINE = 0x25, + ASSET_TYPE_ANIMCLASS = 0x26, + ASSET_TYPE_PLAYERANIM = 0x27, + ASSET_TYPE_GESTURE = 0x28, + ASSET_TYPE_LOCALIZE = 0x29, + ASSET_TYPE_ATTACHMENT = 0x2A, + ASSET_TYPE_WEAPON = 0x2B, + ASSET_TYPE_VFX = 0x2C, + ASSET_TYPE_IMPACTFX = 0x2D, + ASSET_TYPE_SURFACEFX = 0x2E, + ASSET_TYPE_AITYPE = 0x2F, + ASSET_TYPE_MPTYPE = 0x30, + ASSET_TYPE_CHARACTER = 0x31, + ASSET_TYPE_XMODELALIAS = 0x32, + ASSET_TYPE_RAWFILE = 0x33, + ASSET_TYPE_SCRIPTFILE = 0x34, + ASSET_TYPE_SCRIPTDEBUGDATA = 0x35, + ASSET_TYPE_STRINGTABLE = 0x36, + ASSET_TYPE_LEADERBOARDDEF = 0x37, + ASSET_TYPE_VIRTUALLEADERBOARDDEF = 0x38, + ASSET_TYPE_DDL = 0x39, + ASSET_TYPE_TRACER = 0x3A, + ASSET_TYPE_VEHICLE = 0x3B, + ASSET_TYPE_ADDON_MAP_ENTS = 0x3C, + ASSET_TYPE_NETCONSTSTRINGS = 0x3D, + ASSET_TYPE_LUAFILE = 0x3E, + ASSET_TYPE_SCRIPTABLE = 0x3F, + ASSET_TYPE_EQUIPSNDTABLE = 0x40, + ASSET_TYPE_VECTORFIELD = 0x41, + ASSET_TYPE_PARTICLESIMANIMATION = 0x42, + ASSET_TYPE_STREAMINGINFO = 0x43, + ASSET_TYPE_LASER = 0x44, + ASSET_TYPE_TTF = 0x45, + ASSET_TYPE_SUIT = 0x46, + ASSET_TYPE_SUITANIMPACKAGE = 0x47, + ASSET_TYPE_CAMERA = 0x48, + ASSET_TYPE_HUDOUTLINE = 0x49, + ASSET_TYPE_SPACESHIPTARGET = 0x4A, + ASSET_TYPE_RUMBLE = 0x4B, + ASSET_TYPE_RUMBLEGRAPH = 0x4C, + ASSET_TYPE_ANIMPKG = 0x4D, + ASSET_TYPE_SFXPKG = 0x4E, + ASSET_TYPE_VFXPKG = 0x4F, + ASSET_TYPE_FOOTSTEPVFX = 0x50, + ASSET_TYPE_BEHAVIORTREE = 0x51, + ASSET_TYPE_AIANIMSET = 0x52, + ASSET_TYPE_AIASM = 0x53, + ASSET_TYPE_PROCEDURALBONES = 0x54, + ASSET_TYPE_DYNAMICBONES = 0x55, + ASSET_TYPE_RETICLE = 0x56, + ASSET_TYPE_XANIMCURVE = 0x57, + ASSET_TYPE_COVERSELECTOR = 0x58, + ASSET_TYPE_ENEMYSELECTOR = 0x59, + ASSET_TYPE_CLIENTCHARACTER = 0x5A, + ASSET_TYPE_CLOTHASSET = 0x5B, + ASSET_TYPE_CINEMATICMOTION = 0x5C, + ASSET_TYPE_ACCESSORY = 0x5D, + ASSET_TYPE_LOCDMGTABLE = 0x5E, + ASSET_TYPE_BULLETPENETRATION = 0x5F, + ASSET_TYPE_SCRIPTBUNDLE = 0x60, + ASSET_TYPE_BLENDSPACE2D = 0x61, + ASSET_TYPE_XCAM = 0x62, + ASSET_TYPE_CAMO = 0x63, + ASSET_TYPE_XCOMPOSITEMODEL = 0x64, + ASSET_TYPE_XMODELDETAILCOLLISION = 0x65, + ASSET_TYPE_STREAMKEY = 0x66, + ASSET_TYPE_STREAMTREEOVERRIDE = 0x67, + ASSET_TYPE_KEYVALUEPAIRS = 0x68, + ASSET_TYPE_STTERRAIN = 0x69, + ASSET_TYPE_NATIVESCRIPTPATCH = 0x6A, + ASSET_TYPE_COLLISIONTILE = 0x6B, + ASSET_TYPE_EXECUTION = 0x6C, + ASSET_TYPE_CARRYOBJECT = 0x6D, + ASSET_TYPE_SOUNDBANKLIST = 0x6E, + ASSET_TYPE_DECALVOLUMEMATERIAL = 0x6F, + ASSET_TYPE_DECALVOLUMEMASK = 0x70, + ASSET_TYPE_DYNENTITYLIST = 0x71, + ASSET_TYPE_FX_MAP_TRZONE = 0x72, + ASSET_TYPE_DLOGSCHEMA = 0x73, + ASSET_TYPE_EDGELIST = 0x74, +}; + +struct XAsset +{ + XAssetType type; + XAssetHeader header; +}; + +struct ScriptStringList +{ + int count; + bool loaded; + const char** strings; +}; + +struct XAssetList +{ + ScriptStringList stringList; + unsigned int assetCount; + unsigned int assetReadPos; + XAsset* assets; +}; + diff --git a/hook_lib/common/exception/minidump.cpp b/hook_lib/common/exception/minidump.cpp index 41acbc3..a55d290 100644 --- a/hook_lib/common/exception/minidump.cpp +++ b/hook_lib/common/exception/minidump.cpp @@ -1,85 +1,85 @@ -#include "minidump.hpp" - -#include -#pragma comment(lib, "dbghelp.lib") - -namespace exception -{ - namespace - { - constexpr MINIDUMP_TYPE get_minidump_type() - { - constexpr auto type = MiniDumpIgnoreInaccessibleMemory // - | MiniDumpWithHandleData // - | MiniDumpScanMemory // - | MiniDumpWithProcessThreadData // - | MiniDumpWithFullMemoryInfo // - | MiniDumpWithThreadInfo // - | MiniDumpWithUnloadedModules; - - return static_cast(type); - } - - std::string get_temp_filename() - { - char filename[MAX_PATH] = {0}; - char pathname[MAX_PATH] = {0}; - - GetTempPathA(sizeof(pathname), pathname); - GetTempFileNameA(pathname, "boiii-", 0, filename); - return filename; - } - - HANDLE write_dump_to_temp_file(const LPEXCEPTION_POINTERS exceptioninfo) - { - MINIDUMP_EXCEPTION_INFORMATION minidump_exception_info = {GetCurrentThreadId(), exceptioninfo, FALSE}; - - auto* const file_handle = CreateFileA(get_temp_filename().data(), GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, - nullptr); - - if (!MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), file_handle, get_minidump_type(), - &minidump_exception_info, - nullptr, - nullptr)) - { - MessageBoxA(nullptr, "There was an error creating the minidump! Hit OK to close the program.", - "Minidump Error", MB_OK | MB_ICONERROR); - TerminateProcess(GetCurrentProcess(), 123); - } - - return file_handle; - } - - std::string read_file(const HANDLE file_handle) - { - FlushFileBuffers(file_handle); - SetFilePointer(file_handle, 0, nullptr, FILE_BEGIN); - - std::string buffer{}; - - DWORD bytes_read = 0; - char temp_bytes[0x2000]; - - do - { - if (!ReadFile(file_handle, temp_bytes, sizeof(temp_bytes), &bytes_read, nullptr)) - { - return {}; - } - - buffer.append(temp_bytes, bytes_read); - } - while (bytes_read == sizeof(temp_bytes)); - - return buffer; - } - } - - std::string create_minidump(const LPEXCEPTION_POINTERS exceptioninfo) - { - const utils::nt::handle file_handle = write_dump_to_temp_file(exceptioninfo); - return read_file(file_handle); - } -} +#include "minidump.hpp" + +#include +#pragma comment(lib, "dbghelp.lib") + +namespace exception +{ + namespace + { + constexpr MINIDUMP_TYPE get_minidump_type() + { + constexpr auto type = MiniDumpIgnoreInaccessibleMemory // + | MiniDumpWithHandleData // + | MiniDumpScanMemory // + | MiniDumpWithProcessThreadData // + | MiniDumpWithFullMemoryInfo // + | MiniDumpWithThreadInfo // + | MiniDumpWithUnloadedModules; + + return static_cast(type); + } + + std::string get_temp_filename() + { + char filename[MAX_PATH] = {0}; + char pathname[MAX_PATH] = {0}; + + GetTempPathA(sizeof(pathname), pathname); + GetTempFileNameA(pathname, "boiii-", 0, filename); + return filename; + } + + HANDLE write_dump_to_temp_file(const LPEXCEPTION_POINTERS exceptioninfo) + { + MINIDUMP_EXCEPTION_INFORMATION minidump_exception_info = {GetCurrentThreadId(), exceptioninfo, FALSE}; + + auto* const file_handle = CreateFileA(get_temp_filename().data(), GENERIC_WRITE | GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, + nullptr); + + if (!MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), file_handle, get_minidump_type(), + &minidump_exception_info, + nullptr, + nullptr)) + { + MessageBoxA(nullptr, "There was an error creating the minidump! Hit OK to close the program.", + "Minidump Error", MB_OK | MB_ICONERROR); + TerminateProcess(GetCurrentProcess(), 123); + } + + return file_handle; + } + + std::string read_file(const HANDLE file_handle) + { + FlushFileBuffers(file_handle); + SetFilePointer(file_handle, 0, nullptr, FILE_BEGIN); + + std::string buffer{}; + + DWORD bytes_read = 0; + char temp_bytes[0x2000]; + + do + { + if (!ReadFile(file_handle, temp_bytes, sizeof(temp_bytes), &bytes_read, nullptr)) + { + return {}; + } + + buffer.append(temp_bytes, bytes_read); + } + while (bytes_read == sizeof(temp_bytes)); + + return buffer; + } + } + + std::string create_minidump(const LPEXCEPTION_POINTERS exceptioninfo) + { + const utils::nt::handle file_handle = write_dump_to_temp_file(exceptioninfo); + return read_file(file_handle); + } +} diff --git a/hook_lib/common/exception/minidump.hpp b/hook_lib/common/exception/minidump.hpp index 0fa5c34..42b3a46 100644 --- a/hook_lib/common/exception/minidump.hpp +++ b/hook_lib/common/exception/minidump.hpp @@ -1,8 +1,8 @@ -#pragma once - -#include "../utils/nt.hpp" - -namespace exception -{ - std::string create_minidump(LPEXCEPTION_POINTERS exceptioninfo); -} +#pragma once + +#include "../utils/nt.hpp" + +namespace exception +{ + std::string create_minidump(LPEXCEPTION_POINTERS exceptioninfo); +} diff --git a/hook_lib/common/utils/MinHook.hpp b/hook_lib/common/utils/MinHook.hpp index deb22d1..492d83f 100644 --- a/hook_lib/common/utils/MinHook.hpp +++ b/hook_lib/common/utils/MinHook.hpp @@ -1,185 +1,185 @@ -/* - * MinHook - The Minimalistic API Hooking Library for x64/x86 - * Copyright (C) 2009-2017 Tsuda Kageyu. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) - #error MinHook supports only x86 and x64 systems. -#endif - -#include - -// MinHook Error Codes. -typedef enum MH_STATUS -{ - // Unknown error. Should not be returned. - MH_UNKNOWN = -1, - - // Successful. - MH_OK = 0, - - // MinHook is already initialized. - MH_ERROR_ALREADY_INITIALIZED, - - // MinHook is not initialized yet, or already uninitialized. - MH_ERROR_NOT_INITIALIZED, - - // The hook for the specified target function is already created. - MH_ERROR_ALREADY_CREATED, - - // The hook for the specified target function is not created yet. - MH_ERROR_NOT_CREATED, - - // The hook for the specified target function is already enabled. - MH_ERROR_ENABLED, - - // The hook for the specified target function is not enabled yet, or already - // disabled. - MH_ERROR_DISABLED, - - // The specified pointer is invalid. It points the address of non-allocated - // and/or non-executable region. - MH_ERROR_NOT_EXECUTABLE, - - // The specified target function cannot be hooked. - MH_ERROR_UNSUPPORTED_FUNCTION, - - // Failed to allocate memory. - MH_ERROR_MEMORY_ALLOC, - - // Failed to change the memory protection. - MH_ERROR_MEMORY_PROTECT, - - // The specified module is not loaded. - MH_ERROR_MODULE_NOT_FOUND, - - // The specified function is not found. - MH_ERROR_FUNCTION_NOT_FOUND -} -MH_STATUS; - -// Can be passed as a parameter to MH_EnableHook, MH_DisableHook, -// MH_QueueEnableHook or MH_QueueDisableHook. -#define MH_ALL_HOOKS NULL - -#ifdef __cplusplus -extern "C" { -#endif - - // Initialize the MinHook library. You must call this function EXACTLY ONCE - // at the beginning of your program. - MH_STATUS WINAPI MH_Initialize(VOID); - - // Uninitialize the MinHook library. You must call this function EXACTLY - // ONCE at the end of your program. - MH_STATUS WINAPI MH_Uninitialize(VOID); - - // Creates a hook for the specified target function, in disabled state. - // Parameters: - // pTarget [in] A pointer to the target function, which will be - // overridden by the detour function. - // pDetour [in] A pointer to the detour function, which will override - // the target function. - // ppOriginal [out] A pointer to the trampoline function, which will be - // used to call the original target function. - // This parameter can be NULL. - MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); - - // Creates a hook for the specified API function, in disabled state. - // Parameters: - // pszModule [in] A pointer to the loaded module name which contains the - // target function. - // pszProcName [in] A pointer to the target function name, which will be - // overridden by the detour function. - // pDetour [in] A pointer to the detour function, which will override - // the target function. - // ppOriginal [out] A pointer to the trampoline function, which will be - // used to call the original target function. - // This parameter can be NULL. - MH_STATUS WINAPI MH_CreateHookApi( - LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); - - // Creates a hook for the specified API function, in disabled state. - // Parameters: - // pszModule [in] A pointer to the loaded module name which contains the - // target function. - // pszProcName [in] A pointer to the target function name, which will be - // overridden by the detour function. - // pDetour [in] A pointer to the detour function, which will override - // the target function. - // ppOriginal [out] A pointer to the trampoline function, which will be - // used to call the original target function. - // This parameter can be NULL. - // ppTarget [out] A pointer to the target function, which will be used - // with other functions. - // This parameter can be NULL. - MH_STATUS WINAPI MH_CreateHookApiEx( - LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); - - // Removes an already created hook. - // Parameters: - // pTarget [in] A pointer to the target function. - MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); - - // Enables an already created hook. - // Parameters: - // pTarget [in] A pointer to the target function. - // If this parameter is MH_ALL_HOOKS, all created hooks are - // enabled in one go. - MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); - - // Disables an already created hook. - // Parameters: - // pTarget [in] A pointer to the target function. - // If this parameter is MH_ALL_HOOKS, all created hooks are - // disabled in one go. - MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); - - // Queues to enable an already created hook. - // Parameters: - // pTarget [in] A pointer to the target function. - // If this parameter is MH_ALL_HOOKS, all created hooks are - // queued to be enabled. - MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); - - // Queues to disable an already created hook. - // Parameters: - // pTarget [in] A pointer to the target function. - // If this parameter is MH_ALL_HOOKS, all created hooks are - // queued to be disabled. - MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); - - // Applies all queued changes in one go. - MH_STATUS WINAPI MH_ApplyQueued(VOID); - - // Translates the MH_STATUS to its name as a string. - const char * WINAPI MH_StatusToString(MH_STATUS status); - -#ifdef __cplusplus -} -#endif +/* + * MinHook - The Minimalistic API Hooking Library for x64/x86 + * Copyright (C) 2009-2017 Tsuda Kageyu. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) + #error MinHook supports only x86 and x64 systems. +#endif + +#include + +// MinHook Error Codes. +typedef enum MH_STATUS +{ + // Unknown error. Should not be returned. + MH_UNKNOWN = -1, + + // Successful. + MH_OK = 0, + + // MinHook is already initialized. + MH_ERROR_ALREADY_INITIALIZED, + + // MinHook is not initialized yet, or already uninitialized. + MH_ERROR_NOT_INITIALIZED, + + // The hook for the specified target function is already created. + MH_ERROR_ALREADY_CREATED, + + // The hook for the specified target function is not created yet. + MH_ERROR_NOT_CREATED, + + // The hook for the specified target function is already enabled. + MH_ERROR_ENABLED, + + // The hook for the specified target function is not enabled yet, or already + // disabled. + MH_ERROR_DISABLED, + + // The specified pointer is invalid. It points the address of non-allocated + // and/or non-executable region. + MH_ERROR_NOT_EXECUTABLE, + + // The specified target function cannot be hooked. + MH_ERROR_UNSUPPORTED_FUNCTION, + + // Failed to allocate memory. + MH_ERROR_MEMORY_ALLOC, + + // Failed to change the memory protection. + MH_ERROR_MEMORY_PROTECT, + + // The specified module is not loaded. + MH_ERROR_MODULE_NOT_FOUND, + + // The specified function is not found. + MH_ERROR_FUNCTION_NOT_FOUND +} +MH_STATUS; + +// Can be passed as a parameter to MH_EnableHook, MH_DisableHook, +// MH_QueueEnableHook or MH_QueueDisableHook. +#define MH_ALL_HOOKS NULL + +#ifdef __cplusplus +extern "C" { +#endif + + // Initialize the MinHook library. You must call this function EXACTLY ONCE + // at the beginning of your program. + MH_STATUS WINAPI MH_Initialize(VOID); + + // Uninitialize the MinHook library. You must call this function EXACTLY + // ONCE at the end of your program. + MH_STATUS WINAPI MH_Uninitialize(VOID); + + // Creates a hook for the specified target function, in disabled state. + // Parameters: + // pTarget [in] A pointer to the target function, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); + + // Creates a hook for the specified API function, in disabled state. + // Parameters: + // pszModule [in] A pointer to the loaded module name which contains the + // target function. + // pszProcName [in] A pointer to the target function name, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHookApi( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); + + // Creates a hook for the specified API function, in disabled state. + // Parameters: + // pszModule [in] A pointer to the loaded module name which contains the + // target function. + // pszProcName [in] A pointer to the target function name, which will be + // overridden by the detour function. + // pDetour [in] A pointer to the detour function, which will override + // the target function. + // ppOriginal [out] A pointer to the trampoline function, which will be + // used to call the original target function. + // This parameter can be NULL. + // ppTarget [out] A pointer to the target function, which will be used + // with other functions. + // This parameter can be NULL. + MH_STATUS WINAPI MH_CreateHookApiEx( + LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); + + // Removes an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); + + // Enables an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // enabled in one go. + MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); + + // Disables an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // disabled in one go. + MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); + + // Queues to enable an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // queued to be enabled. + MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); + + // Queues to disable an already created hook. + // Parameters: + // pTarget [in] A pointer to the target function. + // If this parameter is MH_ALL_HOOKS, all created hooks are + // queued to be disabled. + MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); + + // Applies all queued changes in one go. + MH_STATUS WINAPI MH_ApplyQueued(VOID); + + // Translates the MH_STATUS to its name as a string. + const char * WINAPI MH_StatusToString(MH_STATUS status); + +#ifdef __cplusplus +} +#endif diff --git a/hook_lib/common/utils/binary_resource.cpp b/hook_lib/common/utils/binary_resource.cpp index 7282df4..eed83b0 100644 --- a/hook_lib/common/utils/binary_resource.cpp +++ b/hook_lib/common/utils/binary_resource.cpp @@ -1,75 +1,75 @@ -#include "binary_resource.hpp" - -#include -#include "nt.hpp" -#include "io.hpp" - -namespace utils -{ - namespace - { - std::string get_temp_folder() - { - char path[MAX_PATH] = {0}; - if (!GetTempPathA(sizeof(path), path)) - { - throw std::runtime_error("Unable to get temp path"); - } - - return path; - } - - std::string write_existing_temp_file(const std::string& file, const std::string& data, - const bool fatal_if_overwrite_fails) - { - const auto temp = get_temp_folder(); - auto file_path = temp + file; - - std::string current_data; - if (!io::read_file(file_path, ¤t_data)) - { - if (!io::write_file(file_path, data)) - { - throw std::runtime_error("Failed to write file: " + file_path); - } - - return file_path; - } - - if (current_data == data || io::write_file(file_path, data) || !fatal_if_overwrite_fails) - { - return file_path; - } - - throw std::runtime_error( - "Temporary file was already written, but differs. It can't be overwritten as it's still in use: " + - file_path); - } - } - - binary_resource::binary_resource(const int id, std::string file) - : filename_(std::move(file)) - { - this->resource_ = nt::load_resource(id); - - if (this->resource_.empty()) - { - throw std::runtime_error("Unable to load resource: " + std::to_string(id)); - } - } - - std::string binary_resource::get_extracted_file(const bool fatal_if_overwrite_fails) - { - if (this->path_.empty()) - { - this->path_ = write_existing_temp_file(this->filename_, this->resource_, fatal_if_overwrite_fails); - } - - return this->path_; - } - - const std::string& binary_resource::get_data() const - { - return this->resource_; - } -} +#include "binary_resource.hpp" + +#include +#include "nt.hpp" +#include "io.hpp" + +namespace utils +{ + namespace + { + std::string get_temp_folder() + { + char path[MAX_PATH] = {0}; + if (!GetTempPathA(sizeof(path), path)) + { + throw std::runtime_error("Unable to get temp path"); + } + + return path; + } + + std::string write_existing_temp_file(const std::string& file, const std::string& data, + const bool fatal_if_overwrite_fails) + { + const auto temp = get_temp_folder(); + auto file_path = temp + file; + + std::string current_data; + if (!io::read_file(file_path, ¤t_data)) + { + if (!io::write_file(file_path, data)) + { + throw std::runtime_error("Failed to write file: " + file_path); + } + + return file_path; + } + + if (current_data == data || io::write_file(file_path, data) || !fatal_if_overwrite_fails) + { + return file_path; + } + + throw std::runtime_error( + "Temporary file was already written, but differs. It can't be overwritten as it's still in use: " + + file_path); + } + } + + binary_resource::binary_resource(const int id, std::string file) + : filename_(std::move(file)) + { + this->resource_ = nt::load_resource(id); + + if (this->resource_.empty()) + { + throw std::runtime_error("Unable to load resource: " + std::to_string(id)); + } + } + + std::string binary_resource::get_extracted_file(const bool fatal_if_overwrite_fails) + { + if (this->path_.empty()) + { + this->path_ = write_existing_temp_file(this->filename_, this->resource_, fatal_if_overwrite_fails); + } + + return this->path_; + } + + const std::string& binary_resource::get_data() const + { + return this->resource_; + } +} diff --git a/hook_lib/common/utils/binary_resource.hpp b/hook_lib/common/utils/binary_resource.hpp index 74f9d54..da19af1 100644 --- a/hook_lib/common/utils/binary_resource.hpp +++ b/hook_lib/common/utils/binary_resource.hpp @@ -1,20 +1,20 @@ -#pragma once - -#include - -namespace utils -{ - class binary_resource - { - public: - binary_resource(int id, std::string file); - - std::string get_extracted_file(bool fatal_if_overwrite_fails = false); - const std::string& get_data() const; - - private: - std::string resource_; - std::string filename_; - std::string path_; - }; -} +#pragma once + +#include + +namespace utils +{ + class binary_resource + { + public: + binary_resource(int id, std::string file); + + std::string get_extracted_file(bool fatal_if_overwrite_fails = false); + const std::string& get_data() const; + + private: + std::string resource_; + std::string filename_; + std::string path_; + }; +} diff --git a/hook_lib/common/utils/concurrency.hpp b/hook_lib/common/utils/concurrency.hpp index ffb322d..05c5d3a 100644 --- a/hook_lib/common/utils/concurrency.hpp +++ b/hook_lib/common/utils/concurrency.hpp @@ -1,46 +1,46 @@ -#pragma once - -#include - -namespace utils::concurrency -{ - template - class container - { - public: - template - R access(F&& accessor) const - { - std::lock_guard _{mutex_}; - return accessor(object_); - } - - template - R access(F&& accessor) - { - std::lock_guard _{mutex_}; - return accessor(object_); - } - - template - R access_with_lock(F&& accessor) const - { - std::unique_lock lock{mutex_}; - return accessor(object_, lock); - } - - template - R access_with_lock(F&& accessor) - { - std::unique_lock lock{mutex_}; - return accessor(object_, lock); - } - - T& get_raw() { return object_; } - const T& get_raw() const { return object_; } - - private: - mutable MutexType mutex_{}; - T object_{}; - }; -} +#pragma once + +#include + +namespace utils::concurrency +{ + template + class container + { + public: + template + R access(F&& accessor) const + { + std::lock_guard _{mutex_}; + return accessor(object_); + } + + template + R access(F&& accessor) + { + std::lock_guard _{mutex_}; + return accessor(object_); + } + + template + R access_with_lock(F&& accessor) const + { + std::unique_lock lock{mutex_}; + return accessor(object_, lock); + } + + template + R access_with_lock(F&& accessor) + { + std::unique_lock lock{mutex_}; + return accessor(object_, lock); + } + + T& get_raw() { return object_; } + const T& get_raw() const { return object_; } + + private: + mutable MutexType mutex_{}; + T object_{}; + }; +} diff --git a/hook_lib/common/utils/finally.hpp b/hook_lib/common/utils/finally.hpp index 3ed5cf5..2e4b6ba 100644 --- a/hook_lib/common/utils/finally.hpp +++ b/hook_lib/common/utils/finally.hpp @@ -1,54 +1,54 @@ -#pragma once -#include - -namespace utils -{ - /* - * Copied from here: https://github.com/microsoft/GSL/blob/e0880931ae5885eb988d1a8a57acf8bc2b8dacda/include/gsl/util#L57 - */ - - template - class final_action - { - public: - static_assert(!std::is_reference::value && !std::is_const::value && - !std::is_volatile::value, - "Final_action should store its callable by value"); - - explicit final_action(F f) noexcept : f_(std::move(f)) - { - } - - final_action(final_action&& other) noexcept - : f_(std::move(other.f_)), invoke_(std::exchange(other.invoke_, false)) - { - } - - final_action(const final_action&) = delete; - final_action& operator=(const final_action&) = delete; - final_action& operator=(final_action&&) = delete; - - ~final_action() noexcept - { - if (invoke_) f_(); - } - - // Added by momo5502 - void cancel() - { - invoke_ = false; - } - - private: - F f_; - bool invoke_{true}; - }; - - template - final_action::type>::type> - finally(F&& f) noexcept - { - return final_action::type>::type>( - std::forward(f)); - } +#pragma once +#include + +namespace utils +{ + /* + * Copied from here: https://github.com/microsoft/GSL/blob/e0880931ae5885eb988d1a8a57acf8bc2b8dacda/include/gsl/util#L57 + */ + + template + class final_action + { + public: + static_assert(!std::is_reference::value && !std::is_const::value && + !std::is_volatile::value, + "Final_action should store its callable by value"); + + explicit final_action(F f) noexcept : f_(std::move(f)) + { + } + + final_action(final_action&& other) noexcept + : f_(std::move(other.f_)), invoke_(std::exchange(other.invoke_, false)) + { + } + + final_action(const final_action&) = delete; + final_action& operator=(const final_action&) = delete; + final_action& operator=(final_action&&) = delete; + + ~final_action() noexcept + { + if (invoke_) f_(); + } + + // Added by momo5502 + void cancel() + { + invoke_ = false; + } + + private: + F f_; + bool invoke_{true}; + }; + + template + final_action::type>::type> + finally(F&& f) noexcept + { + return final_action::type>::type>( + std::forward(f)); + } } \ No newline at end of file diff --git a/hook_lib/common/utils/hardware_breakpoint.cpp b/hook_lib/common/utils/hardware_breakpoint.cpp index 94ba9c9..441c149 100644 --- a/hook_lib/common/utils/hardware_breakpoint.cpp +++ b/hook_lib/common/utils/hardware_breakpoint.cpp @@ -1,173 +1,173 @@ -#include "hardware_breakpoint.hpp" -#include "thread.hpp" - - -namespace utils::hardware_breakpoint -{ - namespace - { - void set_bits(uintptr_t& value, const uint32_t bit_index, const uint32_t bits, const uintptr_t new_value) - { - const uintptr_t range_mask = (1ull << bits) - 1ull; - const uintptr_t full_mask = ~(range_mask << bit_index); - value = (value & full_mask) | (new_value << bit_index); - } - - void validate_index(const uint32_t index) - { - if (index >= 4) - { - throw std::runtime_error("Invalid index"); - } - } - - uint32_t translate_length(const uint32_t length) - { - if (length != 1 && length != 2 && length != 4) - { - throw std::runtime_error("Invalid length"); - } - - return length - 1; - } - - class debug_context - { - public: - debug_context(uint32_t thread_id) - : handle_(thread_id, THREAD_SET_CONTEXT | THREAD_GET_CONTEXT) - { - if (!this->handle_) - { - throw std::runtime_error("Unable to access thread"); - } - - this->context_.ContextFlags = CONTEXT_DEBUG_REGISTERS; - - if (!GetThreadContext(this->handle_, &this->context_)) - { - throw std::runtime_error("Unable to get thread context"); - } - } - - ~debug_context() - { - SetThreadContext(this->handle_, &this->context_); - } - - debug_context(const debug_context&) = delete; - debug_context& operator=(const debug_context&) = delete; - - debug_context(debug_context&& obj) noexcept = delete; - debug_context& operator=(debug_context&& obj) noexcept = delete; - - CONTEXT* operator->() - { - return &this->context_; - } - - operator CONTEXT&() - { - return this->context_; - } - - private: - thread::handle handle_; - CONTEXT context_{}; - }; - - uint32_t find_free_index(const CONTEXT& context) - { - for (uint32_t i = 0; i < 4; ++i) - { - if ((context.Dr7 & (1ull << (i << 1ull))) == 0) - { - return i; - } - } - - throw std::runtime_error("No free index"); - } - } - - void set_branch_tracing(const bool enabled, CONTEXT& context) - { - set_bits(context.Dr7, 8, 1, enabled ? 1 : 0); - } - - void set_branch_tracing(const bool enabled, const uint32_t thread_id) - { - debug_context context(thread_id); - set_branch_tracing(enabled, context); - } - - uint32_t activate(const uintptr_t address, uint32_t length, const condition cond, CONTEXT& context) - { - const auto index = find_free_index(context); - length = translate_length(length); - - (&context.Dr0)[index] = address; - set_bits(context.Dr7, 16 + (index << 2ull), 2, cond); - set_bits(context.Dr7, 18 + (index << 2ull), 2, length); - set_bits(context.Dr7, index << 1ull, 1, 1); - - return index; - } - - uint32_t activate(void* address, const uint32_t length, const condition cond, const uint32_t thread_id) - { - return activate(reinterpret_cast(address), length, cond, thread_id); - } - - uint32_t activate(const uint64_t address, const uint32_t length, const condition cond, const uint32_t thread_id) - { - debug_context context(thread_id); - return activate(address, length, cond, context); - } - - void deactivate_address(const uint64_t address, CONTEXT& context) - { - for (auto i = 0; i < 4; ++i) - { - if ((&context.Dr0)[i] == address) - { - deactivate(i, context); - } - } - } - - void deactivate_address(void* address, const uint32_t thread_id) - { - return deactivate_address(reinterpret_cast(address), thread_id); - } - - void deactivate_address(const uint64_t address, const uint32_t thread_id) - { - debug_context context(thread_id); - deactivate_address(address, context); - } - - void deactivate(const uint32_t index, CONTEXT& context) - { - validate_index(index); - set_bits(context.Dr7, index << 1ull, 1, 0); - } - - void deactivate(const uint32_t index, const uint32_t thread_id) - { - debug_context context(thread_id); - deactivate(index, context); - } - - void deactivate_all(CONTEXT& context) - { - context.Dr7 = 0; - } - - void deactivate_all(const uint32_t thread_id) - { - debug_context context(thread_id); - deactivate_all(context); - } -} - +#include "hardware_breakpoint.hpp" +#include "thread.hpp" + + +namespace utils::hardware_breakpoint +{ + namespace + { + void set_bits(uintptr_t& value, const uint32_t bit_index, const uint32_t bits, const uintptr_t new_value) + { + const uintptr_t range_mask = (1ull << bits) - 1ull; + const uintptr_t full_mask = ~(range_mask << bit_index); + value = (value & full_mask) | (new_value << bit_index); + } + + void validate_index(const uint32_t index) + { + if (index >= 4) + { + throw std::runtime_error("Invalid index"); + } + } + + uint32_t translate_length(const uint32_t length) + { + if (length != 1 && length != 2 && length != 4) + { + throw std::runtime_error("Invalid length"); + } + + return length - 1; + } + + class debug_context + { + public: + debug_context(uint32_t thread_id) + : handle_(thread_id, THREAD_SET_CONTEXT | THREAD_GET_CONTEXT) + { + if (!this->handle_) + { + throw std::runtime_error("Unable to access thread"); + } + + this->context_.ContextFlags = CONTEXT_DEBUG_REGISTERS; + + if (!GetThreadContext(this->handle_, &this->context_)) + { + throw std::runtime_error("Unable to get thread context"); + } + } + + ~debug_context() + { + SetThreadContext(this->handle_, &this->context_); + } + + debug_context(const debug_context&) = delete; + debug_context& operator=(const debug_context&) = delete; + + debug_context(debug_context&& obj) noexcept = delete; + debug_context& operator=(debug_context&& obj) noexcept = delete; + + CONTEXT* operator->() + { + return &this->context_; + } + + operator CONTEXT&() + { + return this->context_; + } + + private: + thread::handle handle_; + CONTEXT context_{}; + }; + + uint32_t find_free_index(const CONTEXT& context) + { + for (uint32_t i = 0; i < 4; ++i) + { + if ((context.Dr7 & (1ull << (i << 1ull))) == 0) + { + return i; + } + } + + throw std::runtime_error("No free index"); + } + } + + void set_branch_tracing(const bool enabled, CONTEXT& context) + { + set_bits(context.Dr7, 8, 1, enabled ? 1 : 0); + } + + void set_branch_tracing(const bool enabled, const uint32_t thread_id) + { + debug_context context(thread_id); + set_branch_tracing(enabled, context); + } + + uint32_t activate(const uintptr_t address, uint32_t length, const condition cond, CONTEXT& context) + { + const auto index = find_free_index(context); + length = translate_length(length); + + (&context.Dr0)[index] = address; + set_bits(context.Dr7, 16 + (index << 2ull), 2, cond); + set_bits(context.Dr7, 18 + (index << 2ull), 2, length); + set_bits(context.Dr7, index << 1ull, 1, 1); + + return index; + } + + uint32_t activate(void* address, const uint32_t length, const condition cond, const uint32_t thread_id) + { + return activate(reinterpret_cast(address), length, cond, thread_id); + } + + uint32_t activate(const uint64_t address, const uint32_t length, const condition cond, const uint32_t thread_id) + { + debug_context context(thread_id); + return activate(address, length, cond, context); + } + + void deactivate_address(const uint64_t address, CONTEXT& context) + { + for (auto i = 0; i < 4; ++i) + { + if ((&context.Dr0)[i] == address) + { + deactivate(i, context); + } + } + } + + void deactivate_address(void* address, const uint32_t thread_id) + { + return deactivate_address(reinterpret_cast(address), thread_id); + } + + void deactivate_address(const uint64_t address, const uint32_t thread_id) + { + debug_context context(thread_id); + deactivate_address(address, context); + } + + void deactivate(const uint32_t index, CONTEXT& context) + { + validate_index(index); + set_bits(context.Dr7, index << 1ull, 1, 0); + } + + void deactivate(const uint32_t index, const uint32_t thread_id) + { + debug_context context(thread_id); + deactivate(index, context); + } + + void deactivate_all(CONTEXT& context) + { + context.Dr7 = 0; + } + + void deactivate_all(const uint32_t thread_id) + { + debug_context context(thread_id); + deactivate_all(context); + } +} + diff --git a/hook_lib/common/utils/hardware_breakpoint.hpp b/hook_lib/common/utils/hardware_breakpoint.hpp index f215698..869b955 100644 --- a/hook_lib/common/utils/hardware_breakpoint.hpp +++ b/hook_lib/common/utils/hardware_breakpoint.hpp @@ -1,32 +1,32 @@ -#pragma once -#include -#include "nt.hpp" - - -namespace utils::hardware_breakpoint -{ - enum condition - { - execute = 0, - write = 1, - read_write = 3 - }; - - - void set_branch_tracing(bool enabled, CONTEXT& context); - void set_branch_tracing(bool enabled, uint32_t thread_id = GetCurrentThreadId()); - - uint32_t activate(uint64_t address, uint32_t length, condition cond, CONTEXT& context); - uint32_t activate(void* address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId()); - uint32_t activate(uint64_t address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId()); - - void deactivate_address(uint64_t address, CONTEXT& context); - void deactivate_address(void* address, uint32_t thread_id = GetCurrentThreadId()); - void deactivate_address(uint64_t address, uint32_t thread_id = GetCurrentThreadId()); - - void deactivate(uint32_t index, CONTEXT& context); - void deactivate(uint32_t index, uint32_t thread_id = GetCurrentThreadId()); - - void deactivate_all(CONTEXT& context); - void deactivate_all(uint32_t thread_id = GetCurrentThreadId()); -} +#pragma once +#include +#include "nt.hpp" + + +namespace utils::hardware_breakpoint +{ + enum condition + { + execute = 0, + write = 1, + read_write = 3 + }; + + + void set_branch_tracing(bool enabled, CONTEXT& context); + void set_branch_tracing(bool enabled, uint32_t thread_id = GetCurrentThreadId()); + + uint32_t activate(uint64_t address, uint32_t length, condition cond, CONTEXT& context); + uint32_t activate(void* address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId()); + uint32_t activate(uint64_t address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId()); + + void deactivate_address(uint64_t address, CONTEXT& context); + void deactivate_address(void* address, uint32_t thread_id = GetCurrentThreadId()); + void deactivate_address(uint64_t address, uint32_t thread_id = GetCurrentThreadId()); + + void deactivate(uint32_t index, CONTEXT& context); + void deactivate(uint32_t index, uint32_t thread_id = GetCurrentThreadId()); + + void deactivate_all(CONTEXT& context); + void deactivate_all(uint32_t thread_id = GetCurrentThreadId()); +} diff --git a/hook_lib/common/utils/hook.cpp b/hook_lib/common/utils/hook.cpp index caa036a..0b1b86e 100644 --- a/hook_lib/common/utils/hook.cpp +++ b/hook_lib/common/utils/hook.cpp @@ -1,484 +1,484 @@ -#include "hook.hpp" - -#include - -#include "MinHook.hpp" - -#include "concurrency.hpp" -#include "string.hpp" -#include "nt.hpp" - -#ifdef max -#undef max -#endif - -#ifdef min -#undef min -#endif - -namespace utils::hook -{ - namespace - { - uint8_t* allocate_somewhere_near(const void* base_address, const size_t size) - { - size_t offset = 0; - while (true) - { - offset += size; - auto* target_address = static_cast(base_address) - offset; - if (is_relatively_far(base_address, target_address)) - { - return nullptr; - } - - const auto res = VirtualAlloc(const_cast(target_address), size, MEM_RESERVE | MEM_COMMIT, - PAGE_EXECUTE_READWRITE); - if (res) - { - if (is_relatively_far(base_address, target_address)) - { - VirtualFree(res, 0, MEM_RELEASE); - return nullptr; - } - - return static_cast(res); - } - } - } - - class memory - { - public: - memory() = default; - - memory(const void* ptr) - : memory() - { - this->length_ = 0x1000; - this->buffer_ = allocate_somewhere_near(ptr, this->length_); - if (!this->buffer_) - { - throw std::runtime_error("Failed to allocate"); - } - } - - ~memory() - { - if (this->buffer_) - { - VirtualFree(this->buffer_, 0, MEM_RELEASE); - } - } - - memory(memory&& obj) noexcept - : memory() - { - this->operator=(std::move(obj)); - } - - memory& operator=(memory&& obj) noexcept - { - if (this != &obj) - { - this->~memory(); - this->buffer_ = obj.buffer_; - this->length_ = obj.length_; - this->offset_ = obj.offset_; - - obj.buffer_ = nullptr; - obj.length_ = 0; - obj.offset_ = 0; - } - - return *this; - } - - void* allocate(const size_t length) - { - if (!this->buffer_) - { - return nullptr; - } - - if (this->offset_ + length > this->length_) - { - return nullptr; - } - - const auto ptr = this->get_ptr(); - this->offset_ += length; - return ptr; - } - - void* get_ptr() const - { - return this->buffer_ + this->offset_; - } - - private: - uint8_t* buffer_{}; - size_t length_{}; - size_t offset_{}; - }; - - void* get_memory_near(const void* address, const size_t size) - { - static concurrency::container> memory_container{}; - - return memory_container.access([&](std::vector& memories) - { - for (auto& memory : memories) - { - if (!is_relatively_far(address, memory.get_ptr())) - { - const auto buffer = memory.allocate(size); - if (buffer) - { - return buffer; - } - } - } - - memories.emplace_back(address); - return memories.back().allocate(size); - }); - } - - void* initialize_min_hook() - { - static class min_hook_init - { - public: - min_hook_init() - { - if (MH_Initialize() != MH_OK) - { - throw std::runtime_error("Failed to initialize MinHook"); - } - } - - ~min_hook_init() - { - MH_Uninitialize(); - } - } min_hook_init; - return &min_hook_init; - } - } - - - detour::detour() - { - (void)initialize_min_hook(); - } - - detour::detour(const size_t place, void* target) - : detour(reinterpret_cast(place), target) - { - } - - detour::detour(void* place, void* target) - : detour() - { - this->create(place, target); - } - - detour::~detour() - { - this->clear(); - } - - void detour::enable() - { - MH_EnableHook(this->place_); - if (!this->moved_data_.empty()) - { - this->move(); - } - } - - void detour::disable() - { - this->un_move(); - MH_DisableHook(this->place_); - } - - void detour::create(void* place, void* target) - { - this->clear(); - this->place_ = place; - - if (MH_CreateHook(this->place_, target, &this->original_) != MH_OK) - { - //throw std::runtime_error(string::va("Unable to create hook at location: %p", this->place_)); - } - - this->enable(); - } - - void detour::create(const size_t place, void* target) - { - MH_Initialize(); - this->create(reinterpret_cast(place), target); - } - - void detour::clear() - { - if (this->place_) - { - this->un_move(); - MH_RemoveHook(this->place_); - } - - this->place_ = nullptr; - this->original_ = nullptr; - this->moved_data_ = {}; - } - - void detour::move() - { - this->moved_data_ = move_hook(this->place_); - } - - void* detour::get_place() const - { - return this->place_; - } - - void* detour::get_original() const - { - return this->original_; - } - - void detour::un_move() - { - if (!this->moved_data_.empty()) - { - copy(this->place_, this->moved_data_.data(), this->moved_data_.size()); - } - } - - std::optional> iat(const nt::library& library, const std::string& target_library, const std::string& process, void* stub) - { - if (!library.is_valid()) return {}; - - auto* const ptr = library.get_iat_entry(target_library, process); - if (!ptr) return {}; - - DWORD protect; - VirtualProtect(ptr, sizeof(*ptr), PAGE_EXECUTE_READWRITE, &protect); - - std::swap(*ptr, stub); - - VirtualProtect(ptr, sizeof(*ptr), protect, &protect); - return {{ptr, stub}}; - } - - void nop(void* place, const size_t length) - { - DWORD old_protect{}; - VirtualProtect(place, length, PAGE_EXECUTE_READWRITE, &old_protect); - - std::memset(place, 0x90, length); - - VirtualProtect(place, length, old_protect, &old_protect); - FlushInstructionCache(GetCurrentProcess(), place, length); - } - - void nop(const size_t place, const size_t length) - { - nop(reinterpret_cast(place), length); - } - - void copy(void* place, const void* data, const size_t length) - { - DWORD old_protect{}; - VirtualProtect(place, length, PAGE_EXECUTE_READWRITE, &old_protect); - - std::memmove(place, data, length); - - VirtualProtect(place, length, old_protect, &old_protect); - FlushInstructionCache(GetCurrentProcess(), place, length); - } - - void copy(const size_t place, const void* data, const size_t length) - { - copy(reinterpret_cast(place), data, length); - } - - void copy_string(void* place, const char* str) - { - copy(reinterpret_cast(place), str, strlen(str) + 1); - } - - void copy_string(const size_t place, const char* str) - { - copy_string(reinterpret_cast(place), str); - } - - bool is_relatively_far(const void* pointer, const void* data, const int offset) - { - const int64_t diff = size_t(data) - (size_t(pointer) + offset); - const auto small_diff = int32_t(diff); - return diff != int64_t(small_diff); - } - - void call(void* pointer, void* data) - { - if (is_relatively_far(pointer, data)) - { - auto* trampoline = get_memory_near(pointer, 14); - if (!trampoline) - { - throw std::runtime_error("Too far away to create 32bit relative branch"); - } - - call(pointer, trampoline); - jump(trampoline, data, true, true); - return; - } - - uint8_t copy_data[5]; - copy_data[0] = 0xE8; - *reinterpret_cast(©_data[1]) = int32_t(size_t(data) - (size_t(pointer) + 5)); - - auto* patch_pointer = PBYTE(pointer); - copy(patch_pointer, copy_data, sizeof(copy_data)); - } - - void call(const size_t pointer, void* data) - { - return call(reinterpret_cast(pointer), data); - } - - void call(const size_t pointer, const size_t data) - { - return call(pointer, reinterpret_cast(data)); - } - - void jump(void* pointer, void* data, const bool use_far, const bool use_safe) - { - static const unsigned char jump_data[] = { - 0x48, 0xb8, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0xff, 0xe0 - }; - - static const unsigned char jump_data_safe[] = { - 0xFF, 0x25, 0x00, 0x00, 0x00, 0x00 - }; - - if (!use_far && is_relatively_far(pointer, data)) - { - auto* trampoline = get_memory_near(pointer, 14); - if (!trampoline) - { - throw std::runtime_error("Too far away to create 32bit relative branch"); - } - jump(pointer, trampoline, false, false); - jump(trampoline, data, true, true); - return; - } - - auto* patch_pointer = PBYTE(pointer); - - if (use_far) - { - if (use_safe) - { - uint8_t copy_data[sizeof(jump_data_safe) + sizeof(data)]; - memcpy(copy_data, jump_data_safe, sizeof(jump_data_safe)); - memcpy(copy_data + sizeof(jump_data_safe), &data, sizeof(data)); - - copy(patch_pointer, copy_data, sizeof(copy_data)); - } - else - { - uint8_t copy_data[sizeof(jump_data)]; - memcpy(copy_data, jump_data, sizeof(jump_data)); - memcpy(copy_data + 2, &data, sizeof(data)); - - copy(patch_pointer, copy_data, sizeof(copy_data)); - } - } - else - { - uint8_t copy_data[5]; - copy_data[0] = 0xE9; - *reinterpret_cast(©_data[1]) = int32_t(size_t(data) - (size_t(pointer) + 5)); - - copy(patch_pointer, copy_data, sizeof(copy_data)); - } - } - - void jump(const size_t pointer, void* data, const bool use_far, const bool use_safe) - { - return jump(reinterpret_cast(pointer), data, use_far, use_safe); - } - - void jump(const size_t pointer, const size_t data, const bool use_far, const bool use_safe) - { - return jump(pointer, reinterpret_cast(data), use_far, use_safe); - } - - - void inject(void* pointer, const void* data) - { - if (is_relatively_far(pointer, data, 4)) - { - throw std::runtime_error("Too far away to create 32bit relative branch"); - } - - set(pointer, int32_t(size_t(data) - (size_t(pointer) + 4))); - } - - void inject(const size_t pointer, const void* data) - { - return inject(reinterpret_cast(pointer), data); - } - - std::vector move_hook(void* pointer) - { - std::vector original_data{}; - - auto* data_ptr = static_cast(pointer); - if (data_ptr[0] == 0xE9) - { - original_data.resize(6); - memmove(original_data.data(), pointer, original_data.size()); - - auto* target = follow_branch(data_ptr); - nop(data_ptr, 1); - jump(data_ptr + 1, target); - } - else if (data_ptr[0] == 0xFF && data_ptr[1] == 0x25) - { - original_data.resize(15); - memmove(original_data.data(), pointer, original_data.size()); - - copy(data_ptr + 1, data_ptr, 14); - nop(data_ptr, 1); - } - else - { - throw std::runtime_error("No branch instruction found"); - } - - return original_data; - } - - std::vector move_hook(const size_t pointer) - { - return move_hook(reinterpret_cast(pointer)); - } - - void* follow_branch(void* address) - { - auto* const data = static_cast(address); - if (*data != 0xE8 && *data != 0xE9) - { - throw std::runtime_error("No branch instruction found"); - } - - return extract(data + 1); - } -} +#include "hook.hpp" + +#include + +#include "MinHook.hpp" + +#include "concurrency.hpp" +#include "string.hpp" +#include "nt.hpp" + +#ifdef max +#undef max +#endif + +#ifdef min +#undef min +#endif + +namespace utils::hook +{ + namespace + { + uint8_t* allocate_somewhere_near(const void* base_address, const size_t size) + { + size_t offset = 0; + while (true) + { + offset += size; + auto* target_address = static_cast(base_address) - offset; + if (is_relatively_far(base_address, target_address)) + { + return nullptr; + } + + const auto res = VirtualAlloc(const_cast(target_address), size, MEM_RESERVE | MEM_COMMIT, + PAGE_EXECUTE_READWRITE); + if (res) + { + if (is_relatively_far(base_address, target_address)) + { + VirtualFree(res, 0, MEM_RELEASE); + return nullptr; + } + + return static_cast(res); + } + } + } + + class memory + { + public: + memory() = default; + + memory(const void* ptr) + : memory() + { + this->length_ = 0x1000; + this->buffer_ = allocate_somewhere_near(ptr, this->length_); + if (!this->buffer_) + { + throw std::runtime_error("Failed to allocate"); + } + } + + ~memory() + { + if (this->buffer_) + { + VirtualFree(this->buffer_, 0, MEM_RELEASE); + } + } + + memory(memory&& obj) noexcept + : memory() + { + this->operator=(std::move(obj)); + } + + memory& operator=(memory&& obj) noexcept + { + if (this != &obj) + { + this->~memory(); + this->buffer_ = obj.buffer_; + this->length_ = obj.length_; + this->offset_ = obj.offset_; + + obj.buffer_ = nullptr; + obj.length_ = 0; + obj.offset_ = 0; + } + + return *this; + } + + void* allocate(const size_t length) + { + if (!this->buffer_) + { + return nullptr; + } + + if (this->offset_ + length > this->length_) + { + return nullptr; + } + + const auto ptr = this->get_ptr(); + this->offset_ += length; + return ptr; + } + + void* get_ptr() const + { + return this->buffer_ + this->offset_; + } + + private: + uint8_t* buffer_{}; + size_t length_{}; + size_t offset_{}; + }; + + void* get_memory_near(const void* address, const size_t size) + { + static concurrency::container> memory_container{}; + + return memory_container.access([&](std::vector& memories) + { + for (auto& memory : memories) + { + if (!is_relatively_far(address, memory.get_ptr())) + { + const auto buffer = memory.allocate(size); + if (buffer) + { + return buffer; + } + } + } + + memories.emplace_back(address); + return memories.back().allocate(size); + }); + } + + void* initialize_min_hook() + { + static class min_hook_init + { + public: + min_hook_init() + { + if (MH_Initialize() != MH_OK) + { + throw std::runtime_error("Failed to initialize MinHook"); + } + } + + ~min_hook_init() + { + MH_Uninitialize(); + } + } min_hook_init; + return &min_hook_init; + } + } + + + detour::detour() + { + (void)initialize_min_hook(); + } + + detour::detour(const size_t place, void* target) + : detour(reinterpret_cast(place), target) + { + } + + detour::detour(void* place, void* target) + : detour() + { + this->create(place, target); + } + + detour::~detour() + { + this->clear(); + } + + void detour::enable() + { + MH_EnableHook(this->place_); + if (!this->moved_data_.empty()) + { + this->move(); + } + } + + void detour::disable() + { + this->un_move(); + MH_DisableHook(this->place_); + } + + void detour::create(void* place, void* target) + { + this->clear(); + this->place_ = place; + + if (MH_CreateHook(this->place_, target, &this->original_) != MH_OK) + { + //throw std::runtime_error(string::va("Unable to create hook at location: %p", this->place_)); + } + + this->enable(); + } + + void detour::create(const size_t place, void* target) + { + MH_Initialize(); + this->create(reinterpret_cast(place), target); + } + + void detour::clear() + { + if (this->place_) + { + this->un_move(); + MH_RemoveHook(this->place_); + } + + this->place_ = nullptr; + this->original_ = nullptr; + this->moved_data_ = {}; + } + + void detour::move() + { + this->moved_data_ = move_hook(this->place_); + } + + void* detour::get_place() const + { + return this->place_; + } + + void* detour::get_original() const + { + return this->original_; + } + + void detour::un_move() + { + if (!this->moved_data_.empty()) + { + copy(this->place_, this->moved_data_.data(), this->moved_data_.size()); + } + } + + std::optional> iat(const nt::library& library, const std::string& target_library, const std::string& process, void* stub) + { + if (!library.is_valid()) return {}; + + auto* const ptr = library.get_iat_entry(target_library, process); + if (!ptr) return {}; + + DWORD protect; + VirtualProtect(ptr, sizeof(*ptr), PAGE_EXECUTE_READWRITE, &protect); + + std::swap(*ptr, stub); + + VirtualProtect(ptr, sizeof(*ptr), protect, &protect); + return {{ptr, stub}}; + } + + void nop(void* place, const size_t length) + { + DWORD old_protect{}; + VirtualProtect(place, length, PAGE_EXECUTE_READWRITE, &old_protect); + + std::memset(place, 0x90, length); + + VirtualProtect(place, length, old_protect, &old_protect); + FlushInstructionCache(GetCurrentProcess(), place, length); + } + + void nop(const size_t place, const size_t length) + { + nop(reinterpret_cast(place), length); + } + + void copy(void* place, const void* data, const size_t length) + { + DWORD old_protect{}; + VirtualProtect(place, length, PAGE_EXECUTE_READWRITE, &old_protect); + + std::memmove(place, data, length); + + VirtualProtect(place, length, old_protect, &old_protect); + FlushInstructionCache(GetCurrentProcess(), place, length); + } + + void copy(const size_t place, const void* data, const size_t length) + { + copy(reinterpret_cast(place), data, length); + } + + void copy_string(void* place, const char* str) + { + copy(reinterpret_cast(place), str, strlen(str) + 1); + } + + void copy_string(const size_t place, const char* str) + { + copy_string(reinterpret_cast(place), str); + } + + bool is_relatively_far(const void* pointer, const void* data, const int offset) + { + const int64_t diff = size_t(data) - (size_t(pointer) + offset); + const auto small_diff = int32_t(diff); + return diff != int64_t(small_diff); + } + + void call(void* pointer, void* data) + { + if (is_relatively_far(pointer, data)) + { + auto* trampoline = get_memory_near(pointer, 14); + if (!trampoline) + { + throw std::runtime_error("Too far away to create 32bit relative branch"); + } + + call(pointer, trampoline); + jump(trampoline, data, true, true); + return; + } + + uint8_t copy_data[5]; + copy_data[0] = 0xE8; + *reinterpret_cast(©_data[1]) = int32_t(size_t(data) - (size_t(pointer) + 5)); + + auto* patch_pointer = PBYTE(pointer); + copy(patch_pointer, copy_data, sizeof(copy_data)); + } + + void call(const size_t pointer, void* data) + { + return call(reinterpret_cast(pointer), data); + } + + void call(const size_t pointer, const size_t data) + { + return call(pointer, reinterpret_cast(data)); + } + + void jump(void* pointer, void* data, const bool use_far, const bool use_safe) + { + static const unsigned char jump_data[] = { + 0x48, 0xb8, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0xff, 0xe0 + }; + + static const unsigned char jump_data_safe[] = { + 0xFF, 0x25, 0x00, 0x00, 0x00, 0x00 + }; + + if (!use_far && is_relatively_far(pointer, data)) + { + auto* trampoline = get_memory_near(pointer, 14); + if (!trampoline) + { + throw std::runtime_error("Too far away to create 32bit relative branch"); + } + jump(pointer, trampoline, false, false); + jump(trampoline, data, true, true); + return; + } + + auto* patch_pointer = PBYTE(pointer); + + if (use_far) + { + if (use_safe) + { + uint8_t copy_data[sizeof(jump_data_safe) + sizeof(data)]; + memcpy(copy_data, jump_data_safe, sizeof(jump_data_safe)); + memcpy(copy_data + sizeof(jump_data_safe), &data, sizeof(data)); + + copy(patch_pointer, copy_data, sizeof(copy_data)); + } + else + { + uint8_t copy_data[sizeof(jump_data)]; + memcpy(copy_data, jump_data, sizeof(jump_data)); + memcpy(copy_data + 2, &data, sizeof(data)); + + copy(patch_pointer, copy_data, sizeof(copy_data)); + } + } + else + { + uint8_t copy_data[5]; + copy_data[0] = 0xE9; + *reinterpret_cast(©_data[1]) = int32_t(size_t(data) - (size_t(pointer) + 5)); + + copy(patch_pointer, copy_data, sizeof(copy_data)); + } + } + + void jump(const size_t pointer, void* data, const bool use_far, const bool use_safe) + { + return jump(reinterpret_cast(pointer), data, use_far, use_safe); + } + + void jump(const size_t pointer, const size_t data, const bool use_far, const bool use_safe) + { + return jump(pointer, reinterpret_cast(data), use_far, use_safe); + } + + + void inject(void* pointer, const void* data) + { + if (is_relatively_far(pointer, data, 4)) + { + throw std::runtime_error("Too far away to create 32bit relative branch"); + } + + set(pointer, int32_t(size_t(data) - (size_t(pointer) + 4))); + } + + void inject(const size_t pointer, const void* data) + { + return inject(reinterpret_cast(pointer), data); + } + + std::vector move_hook(void* pointer) + { + std::vector original_data{}; + + auto* data_ptr = static_cast(pointer); + if (data_ptr[0] == 0xE9) + { + original_data.resize(6); + memmove(original_data.data(), pointer, original_data.size()); + + auto* target = follow_branch(data_ptr); + nop(data_ptr, 1); + jump(data_ptr + 1, target); + } + else if (data_ptr[0] == 0xFF && data_ptr[1] == 0x25) + { + original_data.resize(15); + memmove(original_data.data(), pointer, original_data.size()); + + copy(data_ptr + 1, data_ptr, 14); + nop(data_ptr, 1); + } + else + { + throw std::runtime_error("No branch instruction found"); + } + + return original_data; + } + + std::vector move_hook(const size_t pointer) + { + return move_hook(reinterpret_cast(pointer)); + } + + void* follow_branch(void* address) + { + auto* const data = static_cast(address); + if (*data != 0xE8 && *data != 0xE9) + { + throw std::runtime_error("No branch instruction found"); + } + + return extract(data + 1); + } +} diff --git a/hook_lib/common/utils/hook.hpp b/hook_lib/common/utils/hook.hpp index 12bc5b4..81883c0 100644 --- a/hook_lib/common/utils/hook.hpp +++ b/hook_lib/common/utils/hook.hpp @@ -1,186 +1,186 @@ -#pragma once -#include "signature.hpp" - -#pragma comment(lib, "minhook.lib") - -namespace utils::hook -{ - namespace detail - { - template - std::vector get_iota_functions() - { - if constexpr (Entries == 0) - { - std::vector functions; - return functions; - } - else - { - auto functions = get_iota_functions(); - functions.emplace_back([]() - { - return Entries - 1; - }); - return functions; - } - } - } - - // Gets the pointer to the entry in the v-table. - // It seems otherwise impossible to get this. - // This is ugly as fuck and only safely works on x64 - // Example: - // ID3D11Device* device = ... - // auto entry = get_vtable_entry(device, &ID3D11Device::CreateTexture2D); - template - void** get_vtable_entry(Class* obj, T (Class::* entry)(Args ...)) - { - union - { - decltype(entry) func; - void* pointer; - }; - - func = entry; - - auto iota_functions = detail::get_iota_functions(); - auto* object = iota_functions.data(); - - using fake_func = size_t(__thiscall*)(void* self); - auto index = static_cast(pointer)(&object); - - void** obj_v_table = *reinterpret_cast(obj); - return &obj_v_table[index]; - } - - - class detour - { - public: - detour(); - detour(void* place, void* target); - detour(size_t place, void* target); - ~detour(); - - detour(detour&& other) noexcept - { - this->operator=(std::move(other)); - } - - detour& operator=(detour&& other) noexcept - { - if (this != &other) - { - this->clear(); - - this->place_ = other.place_; - this->original_ = other.original_; - this->moved_data_ = other.moved_data_; - - other.place_ = nullptr; - other.original_ = nullptr; - other.moved_data_ = {}; - } - - return *this; - } - - detour(const detour&) = delete; - detour& operator=(const detour&) = delete; - - void enable(); - void disable(); - - void create(void* place, void* target); - void create(size_t place, void* target); - void clear(); - - void move(); - - void* get_place() const; - - template - T* get() const - { - return static_cast(this->get_original()); - } - - template - T stub(Args ... args) - { - return static_cast(this->get_original())(args...); - } - - [[nodiscard]] void* get_original() const; - - private: - std::vector moved_data_{}; - void* place_{}; - void* original_{}; - - void un_move(); - }; - - std::optional> iat(const nt::library& library, const std::string& target_library, - const std::string& process, void* stub); - - void nop(void* place, size_t length); - void nop(size_t place, size_t length); - - void copy(void* place, const void* data, size_t length); - void copy(size_t place, const void* data, size_t length); - - void copy_string(void* place, const char* str); - void copy_string(size_t place, const char* str); - - bool is_relatively_far(const void* pointer, const void* data, int offset = 5); - - void call(void* pointer, void* data); - void call(size_t pointer, void* data); - void call(size_t pointer, size_t data); - - void jump(void* pointer, void* data, bool use_far = false, bool use_safe = false); - void jump(size_t pointer, void* data, bool use_far = false, bool use_safe = false); - void jump(size_t pointer, size_t data, bool use_far = false, bool use_safe = false); - - void inject(void* pointer, const void* data); - void inject(size_t pointer, const void* data); - - std::vector move_hook(void* pointer); - std::vector move_hook(size_t pointer); - - template - T extract(void* address) - { - auto* const data = static_cast(address); - const auto offset = *reinterpret_cast(data); - return reinterpret_cast(data + offset + 4); - } - - void* follow_branch(void* address); - - template - static void set(void* place, T value = false) - { - copy(place, &value, sizeof(value)); - } - - template - static void set(const size_t place, T value = false) - { - return set(reinterpret_cast(place), value); - } - - template - static T invoke(size_t func, Args ... args) - { - return reinterpret_cast(func)(args...); - } - - template - static T invoke(void* func, Args ... args) - { - return static_cast(func)(args...); - } -} +#pragma once +#include "signature.hpp" + +#pragma comment(lib, "minhook.lib") + +namespace utils::hook +{ + namespace detail + { + template + std::vector get_iota_functions() + { + if constexpr (Entries == 0) + { + std::vector functions; + return functions; + } + else + { + auto functions = get_iota_functions(); + functions.emplace_back([]() + { + return Entries - 1; + }); + return functions; + } + } + } + + // Gets the pointer to the entry in the v-table. + // It seems otherwise impossible to get this. + // This is ugly as fuck and only safely works on x64 + // Example: + // ID3D11Device* device = ... + // auto entry = get_vtable_entry(device, &ID3D11Device::CreateTexture2D); + template + void** get_vtable_entry(Class* obj, T (Class::* entry)(Args ...)) + { + union + { + decltype(entry) func; + void* pointer; + }; + + func = entry; + + auto iota_functions = detail::get_iota_functions(); + auto* object = iota_functions.data(); + + using fake_func = size_t(__thiscall*)(void* self); + auto index = static_cast(pointer)(&object); + + void** obj_v_table = *reinterpret_cast(obj); + return &obj_v_table[index]; + } + + + class detour + { + public: + detour(); + detour(void* place, void* target); + detour(size_t place, void* target); + ~detour(); + + detour(detour&& other) noexcept + { + this->operator=(std::move(other)); + } + + detour& operator=(detour&& other) noexcept + { + if (this != &other) + { + this->clear(); + + this->place_ = other.place_; + this->original_ = other.original_; + this->moved_data_ = other.moved_data_; + + other.place_ = nullptr; + other.original_ = nullptr; + other.moved_data_ = {}; + } + + return *this; + } + + detour(const detour&) = delete; + detour& operator=(const detour&) = delete; + + void enable(); + void disable(); + + void create(void* place, void* target); + void create(size_t place, void* target); + void clear(); + + void move(); + + void* get_place() const; + + template + T* get() const + { + return static_cast(this->get_original()); + } + + template + T stub(Args ... args) + { + return static_cast(this->get_original())(args...); + } + + [[nodiscard]] void* get_original() const; + + private: + std::vector moved_data_{}; + void* place_{}; + void* original_{}; + + void un_move(); + }; + + std::optional> iat(const nt::library& library, const std::string& target_library, + const std::string& process, void* stub); + + void nop(void* place, size_t length); + void nop(size_t place, size_t length); + + void copy(void* place, const void* data, size_t length); + void copy(size_t place, const void* data, size_t length); + + void copy_string(void* place, const char* str); + void copy_string(size_t place, const char* str); + + bool is_relatively_far(const void* pointer, const void* data, int offset = 5); + + void call(void* pointer, void* data); + void call(size_t pointer, void* data); + void call(size_t pointer, size_t data); + + void jump(void* pointer, void* data, bool use_far = false, bool use_safe = false); + void jump(size_t pointer, void* data, bool use_far = false, bool use_safe = false); + void jump(size_t pointer, size_t data, bool use_far = false, bool use_safe = false); + + void inject(void* pointer, const void* data); + void inject(size_t pointer, const void* data); + + std::vector move_hook(void* pointer); + std::vector move_hook(size_t pointer); + + template + T extract(void* address) + { + auto* const data = static_cast(address); + const auto offset = *reinterpret_cast(data); + return reinterpret_cast(data + offset + 4); + } + + void* follow_branch(void* address); + + template + static void set(void* place, T value = false) + { + copy(place, &value, sizeof(value)); + } + + template + static void set(const size_t place, T value = false) + { + return set(reinterpret_cast(place), value); + } + + template + static T invoke(size_t func, Args ... args) + { + return reinterpret_cast(func)(args...); + } + + template + static T invoke(void* func, Args ... args) + { + return static_cast(func)(args...); + } +} diff --git a/hook_lib/common/utils/http.cpp b/hook_lib/common/utils/http.cpp index 9b7f73e..3cb5999 100644 --- a/hook_lib/common/utils/http.cpp +++ b/hook_lib/common/utils/http.cpp @@ -1,48 +1,48 @@ -#include "http.hpp" -#include "nt.hpp" -#include - -namespace utils::http -{ - std::optional get_data(const std::string& url) - { - CComPtr stream; - - if (FAILED(URLOpenBlockingStreamA(nullptr, url.data(), &stream, 0, nullptr))) - { - return {}; - } - - char buffer[0x1000]; - std::string result; - - HRESULT status{}; - - do - { - DWORD bytes_read = 0; - status = stream->Read(buffer, sizeof(buffer), &bytes_read); - - if (bytes_read > 0) - { - result.append(buffer, bytes_read); - } - } - while (SUCCEEDED(status) && status != S_FALSE); - - if (FAILED(status)) - { - return {}; - } - - return {result}; - } - - std::future> get_data_async(const std::string& url) - { - return std::async(std::launch::async, [url]() - { - return get_data(url); - }); - } -} +#include "http.hpp" +#include "nt.hpp" +#include + +namespace utils::http +{ + std::optional get_data(const std::string& url) + { + CComPtr stream; + + if (FAILED(URLOpenBlockingStreamA(nullptr, url.data(), &stream, 0, nullptr))) + { + return {}; + } + + char buffer[0x1000]; + std::string result; + + HRESULT status{}; + + do + { + DWORD bytes_read = 0; + status = stream->Read(buffer, sizeof(buffer), &bytes_read); + + if (bytes_read > 0) + { + result.append(buffer, bytes_read); + } + } + while (SUCCEEDED(status) && status != S_FALSE); + + if (FAILED(status)) + { + return {}; + } + + return {result}; + } + + std::future> get_data_async(const std::string& url) + { + return std::async(std::launch::async, [url]() + { + return get_data(url); + }); + } +} diff --git a/hook_lib/common/utils/http.hpp b/hook_lib/common/utils/http.hpp index cd4aba4..cdfb79c 100644 --- a/hook_lib/common/utils/http.hpp +++ b/hook_lib/common/utils/http.hpp @@ -1,13 +1,13 @@ -#pragma once - -#include -#include -#include - -#pragma comment(lib, "Urlmon.lib") - -namespace utils::http -{ - std::optional get_data(const std::string& url); - std::future> get_data_async(const std::string& url); -} +#pragma once + +#include +#include +#include + +#pragma comment(lib, "Urlmon.lib") + +namespace utils::http +{ + std::optional get_data(const std::string& url); + std::future> get_data_async(const std::string& url); +} diff --git a/hook_lib/common/utils/io.cpp b/hook_lib/common/utils/io.cpp index 163d205..45f2ab9 100644 --- a/hook_lib/common/utils/io.cpp +++ b/hook_lib/common/utils/io.cpp @@ -1,130 +1,130 @@ -#include "io.hpp" -#include "nt.hpp" -#include - -namespace utils::io -{ - bool remove_file(const std::filesystem::path& file) - { - if(DeleteFileW(file.wstring().data()) != FALSE) - { - return true; - } - - return GetLastError() == ERROR_FILE_NOT_FOUND; - } - - bool move_file(const std::filesystem::path& src, const std::filesystem::path& target) - { - return MoveFileW(src.wstring().data(), target.wstring().data()) == TRUE; - } - - bool file_exists(const std::string& file) - { - return std::ifstream(file).good(); - } - - bool write_file(const std::string& file, const std::string& data, const bool append) - { - const auto pos = file.find_last_of("/\\"); - if (pos != std::string::npos) - { - create_directory(file.substr(0, pos)); - } - - std::ofstream stream( - file, std::ios::binary | std::ofstream::out | (append ? std::ofstream::app : 0)); - - if (stream.is_open()) - { - stream.write(data.data(), static_cast(data.size())); - stream.close(); - return true; - } - - return false; - } - - std::string read_file(const std::string& file) - { - std::string data; - read_file(file, &data); - return data; - } - - bool read_file(const std::string& file, std::string* data) - { - if (!data) return false; - data->clear(); - - if (file_exists(file)) - { - std::ifstream stream(file, std::ios::binary); - if (!stream.is_open()) return false; - - stream.seekg(0, std::ios::end); - const std::streamsize size = stream.tellg(); - stream.seekg(0, std::ios::beg); - - if (size > -1) - { - data->resize(static_cast(size)); - stream.read(data->data(), size); - stream.close(); - return true; - } - } - - return false; - } - - std::size_t file_size(const std::string& file) - { - if (file_exists(file)) - { - std::ifstream stream(file, std::ios::binary); - - if (stream.good()) - { - stream.seekg(0, std::ios::end); - return static_cast(stream.tellg()); - } - } - - return 0; - } - - bool create_directory(const std::filesystem::path& directory) - { - return std::filesystem::create_directories(directory); - } - - bool directory_exists(const std::filesystem::path& directory) - { - return std::filesystem::is_directory(directory); - } - - bool directory_is_empty(const std::filesystem::path& directory) - { - return std::filesystem::is_empty(directory); - } - - std::vector list_files(const std::filesystem::path& directory) - { - std::vector files; - - for (auto& file : std::filesystem::directory_iterator(directory)) - { - files.push_back(file.path().generic_string()); - } - - return files; - } - - void copy_folder(const std::filesystem::path& src, const std::filesystem::path& target) - { - std::filesystem::copy(src, target, - std::filesystem::copy_options::overwrite_existing | - std::filesystem::copy_options::recursive); - } -} +#include "io.hpp" +#include "nt.hpp" +#include + +namespace utils::io +{ + bool remove_file(const std::filesystem::path& file) + { + if(DeleteFileW(file.wstring().data()) != FALSE) + { + return true; + } + + return GetLastError() == ERROR_FILE_NOT_FOUND; + } + + bool move_file(const std::filesystem::path& src, const std::filesystem::path& target) + { + return MoveFileW(src.wstring().data(), target.wstring().data()) == TRUE; + } + + bool file_exists(const std::string& file) + { + return std::ifstream(file).good(); + } + + bool write_file(const std::string& file, const std::string& data, const bool append) + { + const auto pos = file.find_last_of("/\\"); + if (pos != std::string::npos) + { + create_directory(file.substr(0, pos)); + } + + std::ofstream stream( + file, std::ios::binary | std::ofstream::out | (append ? std::ofstream::app : 0)); + + if (stream.is_open()) + { + stream.write(data.data(), static_cast(data.size())); + stream.close(); + return true; + } + + return false; + } + + std::string read_file(const std::string& file) + { + std::string data; + read_file(file, &data); + return data; + } + + bool read_file(const std::string& file, std::string* data) + { + if (!data) return false; + data->clear(); + + if (file_exists(file)) + { + std::ifstream stream(file, std::ios::binary); + if (!stream.is_open()) return false; + + stream.seekg(0, std::ios::end); + const std::streamsize size = stream.tellg(); + stream.seekg(0, std::ios::beg); + + if (size > -1) + { + data->resize(static_cast(size)); + stream.read(data->data(), size); + stream.close(); + return true; + } + } + + return false; + } + + std::size_t file_size(const std::string& file) + { + if (file_exists(file)) + { + std::ifstream stream(file, std::ios::binary); + + if (stream.good()) + { + stream.seekg(0, std::ios::end); + return static_cast(stream.tellg()); + } + } + + return 0; + } + + bool create_directory(const std::filesystem::path& directory) + { + return std::filesystem::create_directories(directory); + } + + bool directory_exists(const std::filesystem::path& directory) + { + return std::filesystem::is_directory(directory); + } + + bool directory_is_empty(const std::filesystem::path& directory) + { + return std::filesystem::is_empty(directory); + } + + std::vector list_files(const std::filesystem::path& directory) + { + std::vector files; + + for (auto& file : std::filesystem::directory_iterator(directory)) + { + files.push_back(file.path().generic_string()); + } + + return files; + } + + void copy_folder(const std::filesystem::path& src, const std::filesystem::path& target) + { + std::filesystem::copy(src, target, + std::filesystem::copy_options::overwrite_existing | + std::filesystem::copy_options::recursive); + } +} diff --git a/hook_lib/common/utils/io.hpp b/hook_lib/common/utils/io.hpp index 1bf1b19..5247683 100644 --- a/hook_lib/common/utils/io.hpp +++ b/hook_lib/common/utils/io.hpp @@ -1,21 +1,21 @@ -#pragma once - -#include -#include -#include - -namespace utils::io -{ - bool remove_file(const std::filesystem::path& file); - bool move_file(const std::filesystem::path& src, const std::filesystem::path& target); - bool file_exists(const std::string& file); - bool write_file(const std::string& file, const std::string& data, bool append = false); - bool read_file(const std::string& file, std::string* data); - std::string read_file(const std::string& file); - size_t file_size(const std::string& file); - bool create_directory(const std::filesystem::path& directory); - bool directory_exists(const std::filesystem::path& directory); - bool directory_is_empty(const std::filesystem::path& directory); - std::vector list_files(const std::filesystem::path& directory); - void copy_folder(const std::filesystem::path& src, const std::filesystem::path& target); -} +#pragma once + +#include +#include +#include + +namespace utils::io +{ + bool remove_file(const std::filesystem::path& file); + bool move_file(const std::filesystem::path& src, const std::filesystem::path& target); + bool file_exists(const std::string& file); + bool write_file(const std::string& file, const std::string& data, bool append = false); + bool read_file(const std::string& file, std::string* data); + std::string read_file(const std::string& file); + size_t file_size(const std::string& file); + bool create_directory(const std::filesystem::path& directory); + bool directory_exists(const std::filesystem::path& directory); + bool directory_is_empty(const std::filesystem::path& directory); + std::vector list_files(const std::filesystem::path& directory); + void copy_folder(const std::filesystem::path& src, const std::filesystem::path& target); +} diff --git a/hook_lib/common/utils/memory.cpp b/hook_lib/common/utils/memory.cpp index 1ac255e..5fdbd80 100644 --- a/hook_lib/common/utils/memory.cpp +++ b/hook_lib/common/utils/memory.cpp @@ -1,170 +1,170 @@ -#include "memory.hpp" -#include "nt.hpp" - -namespace utils -{ - memory::allocator memory::mem_allocator_; - - memory::allocator::~allocator() - { - this->clear(); - } - - void memory::allocator::clear() - { - std::lock_guard _(this->mutex_); - - for (auto& data : this->pool_) - { - memory::free(data); - } - - this->pool_.clear(); - } - - void memory::allocator::free(void* data) - { - std::lock_guard _(this->mutex_); - - const auto j = std::find(this->pool_.begin(), this->pool_.end(), data); - if (j != this->pool_.end()) - { - memory::free(data); - this->pool_.erase(j); - } - } - - void memory::allocator::free(const void* data) - { - this->free(const_cast(data)); - } - - void* memory::allocator::allocate(const size_t length) - { - std::lock_guard _(this->mutex_); - - const auto data = memory::allocate(length); - this->pool_.push_back(data); - return data; - } - - bool memory::allocator::empty() const - { - return this->pool_.empty(); - } - - char* memory::allocator::duplicate_string(const std::string& string) - { - std::lock_guard _(this->mutex_); - - const auto data = memory::duplicate_string(string); - this->pool_.push_back(data); - return data; - } - - bool memory::allocator::find(const void* data) - { - std::lock_guard _(this->mutex_); - - const auto j = std::find(this->pool_.begin(), this->pool_.end(), data); - return j != this->pool_.end(); - } - - void* memory::allocate(const size_t length) - { - return std::calloc(length, 1); - } - - char* memory::duplicate_string(const std::string& string) - { - const auto new_string = allocate_array(string.size() + 1); - std::memcpy(new_string, string.data(), string.size()); - return new_string; - } - - void memory::free(void* data) - { - std::free(data); - } - - void memory::free(const void* data) - { - free(const_cast(data)); - } - - bool memory::is_set(const void* mem, const char chr, const size_t length) - { - const auto mem_arr = static_cast(mem); - - for (size_t i = 0; i < length; ++i) - { - if (mem_arr[i] != chr) - { - return false; - } - } - - return true; - } - - bool memory::is_bad_read_ptr(const void* ptr) - { - MEMORY_BASIC_INFORMATION mbi = {}; - if (VirtualQuery(ptr, &mbi, sizeof(mbi))) - { - const DWORD mask = (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_READ | - PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); - auto b = !(mbi.Protect & mask); - // check the page is not a guard page - if (mbi.Protect & (PAGE_GUARD | PAGE_NOACCESS)) b = true; - - return b; - } - return true; - } - - bool memory::is_bad_code_ptr(const void* ptr) - { - MEMORY_BASIC_INFORMATION mbi = {}; - if (VirtualQuery(ptr, &mbi, sizeof(mbi))) - { - const DWORD mask = (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); - auto b = !(mbi.Protect & mask); - // check the page is not a guard page - if (mbi.Protect & (PAGE_GUARD | PAGE_NOACCESS)) b = true; - - return b; - } - return true; - } - - bool memory::is_rdata_ptr(void* pointer) - { - const std::string rdata = ".rdata"; - const auto pointer_lib = utils::nt::library::get_by_address(pointer); - - for (const auto& section : pointer_lib.get_section_headers()) - { - const auto size = sizeof(section->Name); - char name[size + 1]; - name[size] = 0; - std::memcpy(name, section->Name, size); - - if (name == rdata) - { - const auto target = size_t(pointer); - const size_t source_start = size_t(pointer_lib.get_ptr()) + section->PointerToRawData; - const size_t source_end = source_start + section->SizeOfRawData; - - return target >= source_start && target <= source_end; - } - } - - return false; - } - - memory::allocator* memory::get_allocator() - { - return &memory::mem_allocator_; - } -} +#include "memory.hpp" +#include "nt.hpp" + +namespace utils +{ + memory::allocator memory::mem_allocator_; + + memory::allocator::~allocator() + { + this->clear(); + } + + void memory::allocator::clear() + { + std::lock_guard _(this->mutex_); + + for (auto& data : this->pool_) + { + memory::free(data); + } + + this->pool_.clear(); + } + + void memory::allocator::free(void* data) + { + std::lock_guard _(this->mutex_); + + const auto j = std::find(this->pool_.begin(), this->pool_.end(), data); + if (j != this->pool_.end()) + { + memory::free(data); + this->pool_.erase(j); + } + } + + void memory::allocator::free(const void* data) + { + this->free(const_cast(data)); + } + + void* memory::allocator::allocate(const size_t length) + { + std::lock_guard _(this->mutex_); + + const auto data = memory::allocate(length); + this->pool_.push_back(data); + return data; + } + + bool memory::allocator::empty() const + { + return this->pool_.empty(); + } + + char* memory::allocator::duplicate_string(const std::string& string) + { + std::lock_guard _(this->mutex_); + + const auto data = memory::duplicate_string(string); + this->pool_.push_back(data); + return data; + } + + bool memory::allocator::find(const void* data) + { + std::lock_guard _(this->mutex_); + + const auto j = std::find(this->pool_.begin(), this->pool_.end(), data); + return j != this->pool_.end(); + } + + void* memory::allocate(const size_t length) + { + return std::calloc(length, 1); + } + + char* memory::duplicate_string(const std::string& string) + { + const auto new_string = allocate_array(string.size() + 1); + std::memcpy(new_string, string.data(), string.size()); + return new_string; + } + + void memory::free(void* data) + { + std::free(data); + } + + void memory::free(const void* data) + { + free(const_cast(data)); + } + + bool memory::is_set(const void* mem, const char chr, const size_t length) + { + const auto mem_arr = static_cast(mem); + + for (size_t i = 0; i < length; ++i) + { + if (mem_arr[i] != chr) + { + return false; + } + } + + return true; + } + + bool memory::is_bad_read_ptr(const void* ptr) + { + MEMORY_BASIC_INFORMATION mbi = {}; + if (VirtualQuery(ptr, &mbi, sizeof(mbi))) + { + const DWORD mask = (PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_READ | + PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); + auto b = !(mbi.Protect & mask); + // check the page is not a guard page + if (mbi.Protect & (PAGE_GUARD | PAGE_NOACCESS)) b = true; + + return b; + } + return true; + } + + bool memory::is_bad_code_ptr(const void* ptr) + { + MEMORY_BASIC_INFORMATION mbi = {}; + if (VirtualQuery(ptr, &mbi, sizeof(mbi))) + { + const DWORD mask = (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); + auto b = !(mbi.Protect & mask); + // check the page is not a guard page + if (mbi.Protect & (PAGE_GUARD | PAGE_NOACCESS)) b = true; + + return b; + } + return true; + } + + bool memory::is_rdata_ptr(void* pointer) + { + const std::string rdata = ".rdata"; + const auto pointer_lib = utils::nt::library::get_by_address(pointer); + + for (const auto& section : pointer_lib.get_section_headers()) + { + const auto size = sizeof(section->Name); + char name[size + 1]; + name[size] = 0; + std::memcpy(name, section->Name, size); + + if (name == rdata) + { + const auto target = size_t(pointer); + const size_t source_start = size_t(pointer_lib.get_ptr()) + section->PointerToRawData; + const size_t source_end = source_start + section->SizeOfRawData; + + return target >= source_start && target <= source_end; + } + } + + return false; + } + + memory::allocator* memory::get_allocator() + { + return &memory::mem_allocator_; + } +} diff --git a/hook_lib/common/utils/memory.hpp b/hook_lib/common/utils/memory.hpp index e449c45..6c8455c 100644 --- a/hook_lib/common/utils/memory.hpp +++ b/hook_lib/common/utils/memory.hpp @@ -1,77 +1,77 @@ -#pragma once - -#include -#include - -namespace utils -{ - class memory final - { - public: - class allocator final - { - public: - ~allocator(); - - void clear(); - - void free(void* data); - - void free(const void* data); - - void* allocate(size_t length); - - template - T* allocate() - { - return this->allocate_array(1); - } - - template - T* allocate_array(const size_t count = 1) - { - return static_cast(this->allocate(count * sizeof(T))); - } - - bool empty() const; - - char* duplicate_string(const std::string& string); - - bool find(const void* data); - - private: - std::mutex mutex_; - std::vector pool_; - }; - - static void* allocate(size_t length); - - template - static T* allocate() - { - return allocate_array(1); - } - - template - static T* allocate_array(const size_t count = 1) - { - return static_cast(allocate(count * sizeof(T))); - } - - static char* duplicate_string(const std::string& string); - - static void free(void* data); - static void free(const void* data); - - static bool is_set(const void* mem, char chr, size_t length); - - static bool is_bad_read_ptr(const void* ptr); - static bool is_bad_code_ptr(const void* ptr); - static bool is_rdata_ptr(void* ptr); - - static allocator* get_allocator(); - - private: - static allocator mem_allocator_; - }; -} +#pragma once + +#include +#include + +namespace utils +{ + class memory final + { + public: + class allocator final + { + public: + ~allocator(); + + void clear(); + + void free(void* data); + + void free(const void* data); + + void* allocate(size_t length); + + template + T* allocate() + { + return this->allocate_array(1); + } + + template + T* allocate_array(const size_t count = 1) + { + return static_cast(this->allocate(count * sizeof(T))); + } + + bool empty() const; + + char* duplicate_string(const std::string& string); + + bool find(const void* data); + + private: + std::mutex mutex_; + std::vector pool_; + }; + + static void* allocate(size_t length); + + template + static T* allocate() + { + return allocate_array(1); + } + + template + static T* allocate_array(const size_t count = 1) + { + return static_cast(allocate(count * sizeof(T))); + } + + static char* duplicate_string(const std::string& string); + + static void free(void* data); + static void free(const void* data); + + static bool is_set(const void* mem, char chr, size_t length); + + static bool is_bad_read_ptr(const void* ptr); + static bool is_bad_code_ptr(const void* ptr); + static bool is_rdata_ptr(void* ptr); + + static allocator* get_allocator(); + + private: + static allocator mem_allocator_; + }; +} diff --git a/hook_lib/common/utils/nt.cpp b/hook_lib/common/utils/nt.cpp index 713a03a..f6b07ad 100644 --- a/hook_lib/common/utils/nt.cpp +++ b/hook_lib/common/utils/nt.cpp @@ -1,291 +1,291 @@ -#include "nt.hpp" - -namespace utils::nt -{ - library library::load(const char* name) - { - return library(LoadLibraryA(name)); - } - - library library::load(const std::string& name) - { - return library::load(name.data()); - } - - library library::load(const std::filesystem::path& path) - { - return library::load(path.generic_string()); - } - - library library::get_by_address(const void* address) - { - HMODULE handle = nullptr; - GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - static_cast(address), &handle); - return library(handle); - } - - library::library() - : module_(GetModuleHandleA(nullptr)) - { - } - - library::library(const std::string& name) - : module_(GetModuleHandleA(name.data())) - { - } - - library::library(const HMODULE handle) - : module_(handle) - { - } - - bool library::operator==(const library& obj) const - { - return this->module_ == obj.module_; - } - - library::operator bool() const - { - return this->is_valid(); - } - - library::operator HMODULE() const - { - return this->get_handle(); - } - - PIMAGE_NT_HEADERS library::get_nt_headers() const - { - if (!this->is_valid()) return nullptr; - return reinterpret_cast(this->get_ptr() + this->get_dos_header()->e_lfanew); - } - - PIMAGE_DOS_HEADER library::get_dos_header() const - { - return reinterpret_cast(this->get_ptr()); - } - - PIMAGE_OPTIONAL_HEADER library::get_optional_header() const - { - if (!this->is_valid()) return nullptr; - return &this->get_nt_headers()->OptionalHeader; - } - - std::vector library::get_section_headers() const - { - std::vector headers; - - auto nt_headers = this->get_nt_headers(); - auto section = IMAGE_FIRST_SECTION(nt_headers); - - for (uint16_t i = 0; i < nt_headers->FileHeader.NumberOfSections; ++i, ++section) - { - if (section) headers.push_back(section); - else OutputDebugStringA("There was an invalid section :O"); - } - - return headers; - } - - std::uint8_t* library::get_ptr() const - { - return reinterpret_cast(this->module_); - } - - void library::unprotect() const - { - if (!this->is_valid()) return; - - DWORD protection; - VirtualProtect(this->get_ptr(), this->get_optional_header()->SizeOfImage, PAGE_EXECUTE_READWRITE, - &protection); - } - - size_t library::get_relative_entry_point() const - { - if (!this->is_valid()) return 0; - return this->get_nt_headers()->OptionalHeader.AddressOfEntryPoint; - } - - void* library::get_entry_point() const - { - if (!this->is_valid()) return nullptr; - return this->get_ptr() + this->get_relative_entry_point(); - } - - bool library::is_valid() const - { - return this->module_ != nullptr && this->get_dos_header()->e_magic == IMAGE_DOS_SIGNATURE; - } - - std::string library::get_name() const - { - if (!this->is_valid()) return {}; - - const auto path = this->get_path(); - const auto pos = path.generic_string().find_last_of("/\\"); - if (pos == std::string::npos) return path.generic_string(); - - return path.generic_string().substr(pos + 1); - } - - std::filesystem::path library::get_path() const - { - if (!this->is_valid()) return {}; - - wchar_t name[MAX_PATH] = {0}; - GetModuleFileNameW(this->module_, name, MAX_PATH); - - return {name}; - } - - std::filesystem::path library::get_folder() const - { - if (!this->is_valid()) return {}; - - const auto path = std::filesystem::path(this->get_path()); - return path.parent_path().generic_string(); - } - - void library::free() - { - if (this->is_valid()) - { - FreeLibrary(this->module_); - this->module_ = nullptr; - } - } - - HMODULE library::get_handle() const - { - return this->module_; - } - - void** library::get_iat_entry(const std::string& module_name, const std::string& proc_name) const - { - if (!this->is_valid()) return nullptr; - - const library other_module(module_name); - if (!other_module.is_valid()) return nullptr; - - auto* const target_function = other_module.get_proc(proc_name); - if (!target_function) return nullptr; - - auto* header = this->get_optional_header(); - if (!header) return nullptr; - - auto* import_descriptor = reinterpret_cast(this->get_ptr() + header->DataDirectory - [IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); - - while (import_descriptor->Name) - { - if (!_stricmp(reinterpret_cast(this->get_ptr() + import_descriptor->Name), module_name.data())) - { - auto* original_thunk_data = reinterpret_cast(import_descriptor-> - OriginalFirstThunk + this->get_ptr()); - auto* thunk_data = reinterpret_cast(import_descriptor->FirstThunk + this-> - get_ptr()); - - while (original_thunk_data->u1.AddressOfData) - { - if (thunk_data->u1.Function == reinterpret_cast(target_function)) - { - return reinterpret_cast(&thunk_data->u1.Function); - } - - const size_t ordinal_number = original_thunk_data->u1.AddressOfData & 0xFFFFFFF; - - if (ordinal_number <= 0xFFFF) - { - auto* proc = GetProcAddress(other_module.module_, reinterpret_cast(ordinal_number)); - if (reinterpret_cast(proc) == target_function) - { - return reinterpret_cast(&thunk_data->u1.Function); - } - } - - ++original_thunk_data; - ++thunk_data; - } - - //break; - } - - ++import_descriptor; - } - - return nullptr; - } - - bool is_wine() - { - static const auto has_wine_export = []() -> bool - { - const library ntdll("ntdll.dll"); - return ntdll.get_proc("wine_get_version"); - }(); - - return has_wine_export; - } - - bool is_shutdown_in_progress() - { - static auto* shutdown_in_progress = [] - { - const library ntdll("ntdll.dll"); - return ntdll.get_proc("RtlDllShutdownInProgress"); - }(); - - return shutdown_in_progress(); - } - - void raise_hard_exception() - { - int data = false; - const library ntdll("ntdll.dll"); - ntdll.invoke_pascal("RtlAdjustPrivilege", 19, true, false, &data); - ntdll.invoke_pascal("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); - _Exit(0); - } - - std::string load_resource(const int id) - { - const auto lib = library::get_by_address(load_resource); - auto* const res = FindResource(lib, MAKEINTRESOURCE(id), RT_RCDATA); - if (!res) return {}; - - auto* const handle = LoadResource(lib, res); - if (!handle) return {}; - - return std::string(LPSTR(LockResource(handle)), SizeofResource(lib, res)); - } - - void relaunch_self() - { - const auto self = utils::nt::library::get_by_address(relaunch_self); - - STARTUPINFOA startup_info; - PROCESS_INFORMATION process_info; - - ZeroMemory(&startup_info, sizeof(startup_info)); - ZeroMemory(&process_info, sizeof(process_info)); - startup_info.cb = sizeof(startup_info); - - char current_dir[MAX_PATH]; - GetCurrentDirectoryA(sizeof(current_dir), current_dir); - auto* const command_line = GetCommandLineA(); - - CreateProcessA(self.get_path().generic_string().data(), command_line, nullptr, nullptr, false, NULL, nullptr, current_dir, - &startup_info, &process_info); - - if (process_info.hThread && process_info.hThread != INVALID_HANDLE_VALUE) CloseHandle(process_info.hThread); - if (process_info.hProcess && process_info.hProcess != INVALID_HANDLE_VALUE) CloseHandle(process_info.hProcess); - } - - void terminate(const uint32_t code) - { - TerminateProcess(GetCurrentProcess(), code); - _Exit(code); - } -} +#include "nt.hpp" + +namespace utils::nt +{ + library library::load(const char* name) + { + return library(LoadLibraryA(name)); + } + + library library::load(const std::string& name) + { + return library::load(name.data()); + } + + library library::load(const std::filesystem::path& path) + { + return library::load(path.generic_string()); + } + + library library::get_by_address(const void* address) + { + HMODULE handle = nullptr; + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + static_cast(address), &handle); + return library(handle); + } + + library::library() + : module_(GetModuleHandleA(nullptr)) + { + } + + library::library(const std::string& name) + : module_(GetModuleHandleA(name.data())) + { + } + + library::library(const HMODULE handle) + : module_(handle) + { + } + + bool library::operator==(const library& obj) const + { + return this->module_ == obj.module_; + } + + library::operator bool() const + { + return this->is_valid(); + } + + library::operator HMODULE() const + { + return this->get_handle(); + } + + PIMAGE_NT_HEADERS library::get_nt_headers() const + { + if (!this->is_valid()) return nullptr; + return reinterpret_cast(this->get_ptr() + this->get_dos_header()->e_lfanew); + } + + PIMAGE_DOS_HEADER library::get_dos_header() const + { + return reinterpret_cast(this->get_ptr()); + } + + PIMAGE_OPTIONAL_HEADER library::get_optional_header() const + { + if (!this->is_valid()) return nullptr; + return &this->get_nt_headers()->OptionalHeader; + } + + std::vector library::get_section_headers() const + { + std::vector headers; + + auto nt_headers = this->get_nt_headers(); + auto section = IMAGE_FIRST_SECTION(nt_headers); + + for (uint16_t i = 0; i < nt_headers->FileHeader.NumberOfSections; ++i, ++section) + { + if (section) headers.push_back(section); + else OutputDebugStringA("There was an invalid section :O"); + } + + return headers; + } + + std::uint8_t* library::get_ptr() const + { + return reinterpret_cast(this->module_); + } + + void library::unprotect() const + { + if (!this->is_valid()) return; + + DWORD protection; + VirtualProtect(this->get_ptr(), this->get_optional_header()->SizeOfImage, PAGE_EXECUTE_READWRITE, + &protection); + } + + size_t library::get_relative_entry_point() const + { + if (!this->is_valid()) return 0; + return this->get_nt_headers()->OptionalHeader.AddressOfEntryPoint; + } + + void* library::get_entry_point() const + { + if (!this->is_valid()) return nullptr; + return this->get_ptr() + this->get_relative_entry_point(); + } + + bool library::is_valid() const + { + return this->module_ != nullptr && this->get_dos_header()->e_magic == IMAGE_DOS_SIGNATURE; + } + + std::string library::get_name() const + { + if (!this->is_valid()) return {}; + + const auto path = this->get_path(); + const auto pos = path.generic_string().find_last_of("/\\"); + if (pos == std::string::npos) return path.generic_string(); + + return path.generic_string().substr(pos + 1); + } + + std::filesystem::path library::get_path() const + { + if (!this->is_valid()) return {}; + + wchar_t name[MAX_PATH] = {0}; + GetModuleFileNameW(this->module_, name, MAX_PATH); + + return {name}; + } + + std::filesystem::path library::get_folder() const + { + if (!this->is_valid()) return {}; + + const auto path = std::filesystem::path(this->get_path()); + return path.parent_path().generic_string(); + } + + void library::free() + { + if (this->is_valid()) + { + FreeLibrary(this->module_); + this->module_ = nullptr; + } + } + + HMODULE library::get_handle() const + { + return this->module_; + } + + void** library::get_iat_entry(const std::string& module_name, const std::string& proc_name) const + { + if (!this->is_valid()) return nullptr; + + const library other_module(module_name); + if (!other_module.is_valid()) return nullptr; + + auto* const target_function = other_module.get_proc(proc_name); + if (!target_function) return nullptr; + + auto* header = this->get_optional_header(); + if (!header) return nullptr; + + auto* import_descriptor = reinterpret_cast(this->get_ptr() + header->DataDirectory + [IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + + while (import_descriptor->Name) + { + if (!_stricmp(reinterpret_cast(this->get_ptr() + import_descriptor->Name), module_name.data())) + { + auto* original_thunk_data = reinterpret_cast(import_descriptor-> + OriginalFirstThunk + this->get_ptr()); + auto* thunk_data = reinterpret_cast(import_descriptor->FirstThunk + this-> + get_ptr()); + + while (original_thunk_data->u1.AddressOfData) + { + if (thunk_data->u1.Function == reinterpret_cast(target_function)) + { + return reinterpret_cast(&thunk_data->u1.Function); + } + + const size_t ordinal_number = original_thunk_data->u1.AddressOfData & 0xFFFFFFF; + + if (ordinal_number <= 0xFFFF) + { + auto* proc = GetProcAddress(other_module.module_, reinterpret_cast(ordinal_number)); + if (reinterpret_cast(proc) == target_function) + { + return reinterpret_cast(&thunk_data->u1.Function); + } + } + + ++original_thunk_data; + ++thunk_data; + } + + //break; + } + + ++import_descriptor; + } + + return nullptr; + } + + bool is_wine() + { + static const auto has_wine_export = []() -> bool + { + const library ntdll("ntdll.dll"); + return ntdll.get_proc("wine_get_version"); + }(); + + return has_wine_export; + } + + bool is_shutdown_in_progress() + { + static auto* shutdown_in_progress = [] + { + const library ntdll("ntdll.dll"); + return ntdll.get_proc("RtlDllShutdownInProgress"); + }(); + + return shutdown_in_progress(); + } + + void raise_hard_exception() + { + int data = false; + const library ntdll("ntdll.dll"); + ntdll.invoke_pascal("RtlAdjustPrivilege", 19, true, false, &data); + ntdll.invoke_pascal("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); + _Exit(0); + } + + std::string load_resource(const int id) + { + const auto lib = library::get_by_address(load_resource); + auto* const res = FindResource(lib, MAKEINTRESOURCE(id), RT_RCDATA); + if (!res) return {}; + + auto* const handle = LoadResource(lib, res); + if (!handle) return {}; + + return std::string(LPSTR(LockResource(handle)), SizeofResource(lib, res)); + } + + void relaunch_self() + { + const auto self = utils::nt::library::get_by_address(relaunch_self); + + STARTUPINFOA startup_info; + PROCESS_INFORMATION process_info; + + ZeroMemory(&startup_info, sizeof(startup_info)); + ZeroMemory(&process_info, sizeof(process_info)); + startup_info.cb = sizeof(startup_info); + + char current_dir[MAX_PATH]; + GetCurrentDirectoryA(sizeof(current_dir), current_dir); + auto* const command_line = GetCommandLineA(); + + CreateProcessA(self.get_path().generic_string().data(), command_line, nullptr, nullptr, false, NULL, nullptr, current_dir, + &startup_info, &process_info); + + if (process_info.hThread && process_info.hThread != INVALID_HANDLE_VALUE) CloseHandle(process_info.hThread); + if (process_info.hProcess && process_info.hProcess != INVALID_HANDLE_VALUE) CloseHandle(process_info.hProcess); + } + + void terminate(const uint32_t code) + { + TerminateProcess(GetCurrentProcess(), code); + _Exit(code); + } +} diff --git a/hook_lib/common/utils/nt.hpp b/hook_lib/common/utils/nt.hpp index ae7a886..962ed6d 100644 --- a/hook_lib/common/utils/nt.hpp +++ b/hook_lib/common/utils/nt.hpp @@ -1,177 +1,177 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN -#include - -// min and max is required by gdi, therefore NOMINMAX won't work -#ifdef max -#undef max -#endif - -#ifdef min -#undef min -#endif - -#include -#include -#include - -namespace utils::nt -{ - class library final - { - public: - static library load(const char* name); - static library load(const std::string& name); - static library load(const std::filesystem::path& path); - static library get_by_address(const void* address); - - library(); - explicit library(const std::string& name); - explicit library(HMODULE handle); - - library(const library& a) : module_(a.module_) - { - } - - bool operator!=(const library& obj) const { return !(*this == obj); }; - bool operator==(const library& obj) const; - - operator bool() const; - operator HMODULE() const; - - void unprotect() const; - [[nodiscard]] void* get_entry_point() const; - [[nodiscard]] size_t get_relative_entry_point() const; - - [[nodiscard]] bool is_valid() const; - [[nodiscard]] std::string get_name() const; - [[nodiscard]] std::filesystem::path get_path() const; - [[nodiscard]] std::filesystem::path get_folder() const; - [[nodiscard]] std::uint8_t* get_ptr() const; - void free(); - - [[nodiscard]] HMODULE get_handle() const; - - template - [[nodiscard]] T get_proc(const std::string& process) const - { - if (!this->is_valid()) T{}; - return reinterpret_cast(GetProcAddress(this->module_, process.data())); - } - - template - [[nodiscard]] std::function get(const std::string& process) const - { - if (!this->is_valid()) return std::function(); - return static_cast(this->get_proc(process)); - } - - template - T invoke(const std::string& process, Args ... args) const - { - auto method = this->get(process); - if (method) return method(args...); - return T(); - } - - template - T invoke_pascal(const std::string& process, Args ... args) const - { - auto method = this->get(process); - if (method) return method(args...); - return T(); - } - - template - T invoke_this(const std::string& process, void* this_ptr, Args ... args) const - { - auto method = this->get(this_ptr, process); - if (method) return method(args...); - return T(); - } - - [[nodiscard]] std::vector get_section_headers() const; - - [[nodiscard]] PIMAGE_NT_HEADERS get_nt_headers() const; - [[nodiscard]] PIMAGE_DOS_HEADER get_dos_header() const; - [[nodiscard]] PIMAGE_OPTIONAL_HEADER get_optional_header() const; - - [[nodiscard]] void** get_iat_entry(const std::string& module_name, const std::string& proc_name) const; - - private: - HMODULE module_; - }; - - template - class handle - { - public: - handle() = default; - - handle(const HANDLE h) - : handle_(h) - { - } - - ~handle() - { - if (*this) - { - CloseHandle(this->handle_); - this->handle_ = InvalidHandle; - } - } - - handle(const handle&) = delete; - handle& operator=(const handle&) = delete; - - handle(handle&& obj) noexcept - : handle() - { - this->operator=(std::move(obj)); - } - - handle& operator=(handle&& obj) noexcept - { - if (this != &obj) - { - this->~handle(); - this->handle_ = obj.handle_; - obj.handle_ = InvalidHandle; - } - - return *this; - } - - handle& operator=(HANDLE h) noexcept - { - this->~handle(); - this->handle_ = h; - - return *this; - } - - operator bool() const - { - return this->handle_ != InvalidHandle; - } - - operator HANDLE() const - { - return this->handle_; - } - - private: - HANDLE handle_{InvalidHandle}; - }; - - bool is_wine(); - bool is_shutdown_in_progress(); - - __declspec(noreturn) void raise_hard_exception(); - std::string load_resource(int id); - - void relaunch_self(); - __declspec(noreturn) void terminate(uint32_t code = 0); -} +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include + +// min and max is required by gdi, therefore NOMINMAX won't work +#ifdef max +#undef max +#endif + +#ifdef min +#undef min +#endif + +#include +#include +#include + +namespace utils::nt +{ + class library final + { + public: + static library load(const char* name); + static library load(const std::string& name); + static library load(const std::filesystem::path& path); + static library get_by_address(const void* address); + + library(); + explicit library(const std::string& name); + explicit library(HMODULE handle); + + library(const library& a) : module_(a.module_) + { + } + + bool operator!=(const library& obj) const { return !(*this == obj); }; + bool operator==(const library& obj) const; + + operator bool() const; + operator HMODULE() const; + + void unprotect() const; + [[nodiscard]] void* get_entry_point() const; + [[nodiscard]] size_t get_relative_entry_point() const; + + [[nodiscard]] bool is_valid() const; + [[nodiscard]] std::string get_name() const; + [[nodiscard]] std::filesystem::path get_path() const; + [[nodiscard]] std::filesystem::path get_folder() const; + [[nodiscard]] std::uint8_t* get_ptr() const; + void free(); + + [[nodiscard]] HMODULE get_handle() const; + + template + [[nodiscard]] T get_proc(const std::string& process) const + { + if (!this->is_valid()) T{}; + return reinterpret_cast(GetProcAddress(this->module_, process.data())); + } + + template + [[nodiscard]] std::function get(const std::string& process) const + { + if (!this->is_valid()) return std::function(); + return static_cast(this->get_proc(process)); + } + + template + T invoke(const std::string& process, Args ... args) const + { + auto method = this->get(process); + if (method) return method(args...); + return T(); + } + + template + T invoke_pascal(const std::string& process, Args ... args) const + { + auto method = this->get(process); + if (method) return method(args...); + return T(); + } + + template + T invoke_this(const std::string& process, void* this_ptr, Args ... args) const + { + auto method = this->get(this_ptr, process); + if (method) return method(args...); + return T(); + } + + [[nodiscard]] std::vector get_section_headers() const; + + [[nodiscard]] PIMAGE_NT_HEADERS get_nt_headers() const; + [[nodiscard]] PIMAGE_DOS_HEADER get_dos_header() const; + [[nodiscard]] PIMAGE_OPTIONAL_HEADER get_optional_header() const; + + [[nodiscard]] void** get_iat_entry(const std::string& module_name, const std::string& proc_name) const; + + private: + HMODULE module_; + }; + + template + class handle + { + public: + handle() = default; + + handle(const HANDLE h) + : handle_(h) + { + } + + ~handle() + { + if (*this) + { + CloseHandle(this->handle_); + this->handle_ = InvalidHandle; + } + } + + handle(const handle&) = delete; + handle& operator=(const handle&) = delete; + + handle(handle&& obj) noexcept + : handle() + { + this->operator=(std::move(obj)); + } + + handle& operator=(handle&& obj) noexcept + { + if (this != &obj) + { + this->~handle(); + this->handle_ = obj.handle_; + obj.handle_ = InvalidHandle; + } + + return *this; + } + + handle& operator=(HANDLE h) noexcept + { + this->~handle(); + this->handle_ = h; + + return *this; + } + + operator bool() const + { + return this->handle_ != InvalidHandle; + } + + operator HANDLE() const + { + return this->handle_; + } + + private: + HANDLE handle_{InvalidHandle}; + }; + + bool is_wine(); + bool is_shutdown_in_progress(); + + __declspec(noreturn) void raise_hard_exception(); + std::string load_resource(int id); + + void relaunch_self(); + __declspec(noreturn) void terminate(uint32_t code = 0); +} diff --git a/hook_lib/common/utils/signature.cpp b/hook_lib/common/utils/signature.cpp index 3e0602a..90cf7d1 100644 --- a/hook_lib/common/utils/signature.cpp +++ b/hook_lib/common/utils/signature.cpp @@ -1,220 +1,220 @@ -#include "signature.hpp" -#include -#include - -#include - -#ifdef max -#undef max -#endif - -#ifdef min -#undef min -#endif - -namespace utils::hook -{ - void signature::load_pattern(const std::string& pattern) - { - this->mask_.clear(); - this->pattern_.clear(); - - uint8_t nibble = 0; - auto has_nibble = false; - - for (auto val : pattern) - { - if (val == ' ') continue; - if (val == '?') - { - this->mask_.push_back(val); - this->pattern_.push_back(0); - } - else - { - if ((val < '0' || val > '9') && (val < 'A' || val > 'F') && (val < 'a' || val > 'f')) - { - throw std::runtime_error("Invalid pattern"); - } - - char str[] = {val, 0}; - const auto current_nibble = static_cast(strtol(str, nullptr, 16)); - - if (!has_nibble) - { - has_nibble = true; - nibble = current_nibble; - } - else - { - has_nibble = false; - const uint8_t byte = current_nibble | (nibble << 4); - - this->mask_.push_back('x'); - this->pattern_.push_back(byte); - } - } - } - - while (!this->mask_.empty() && this->mask_.back() == '?') - { - this->mask_.pop_back(); - this->pattern_.pop_back(); - } - - if (this->has_sse_support()) - { - while (this->pattern_.size() < 16) - { - this->pattern_.push_back(0); - } - } - - if (has_nibble) - { - throw std::runtime_error("Invalid pattern"); - } - } - - signature::signature_result signature::process_range(uint8_t* start, const size_t length) const - { - if (this->has_sse_support()) return this->process_range_vectorized(start, length); - return this->process_range_linear(start, length); - } - - signature::signature_result signature::process_range_linear(uint8_t* start, const size_t length) const - { - std::vector result; - - for (size_t i = 0; i < length; ++i) - { - const auto address = start + i; - - size_t j = 0; - for (; j < this->mask_.size(); ++j) - { - if (this->mask_[j] != '?' && this->pattern_[j] != address[j]) - { - break; - } - } - - if (j == this->mask_.size()) - { - result.push_back(address); - } - } - - return result; - } - - signature::signature_result signature::process_range_vectorized(uint8_t* start, const size_t length) const - { - std::vector result; - __declspec(align(16)) char desired_mask[16] = {0}; - - for (size_t i = 0; i < this->mask_.size(); i++) - { - desired_mask[i / 8] |= (this->mask_[i] == '?' ? 0 : 1) << i % 8; - } - - const auto mask = _mm_load_si128(reinterpret_cast(desired_mask)); - const auto comparand = _mm_loadu_si128(reinterpret_cast(this->pattern_.data())); - - for (size_t i = 0; i < length; ++i) - { - const auto address = start + i; - const auto value = _mm_loadu_si128(reinterpret_cast(address)); - const auto comparison = _mm_cmpestrm(value, 16, comparand, static_cast(this->mask_.size()), - _SIDD_CMP_EQUAL_EACH); - - const auto matches = _mm_and_si128(mask, comparison); - const auto equivalence = _mm_xor_si128(mask, matches); - - if (_mm_test_all_zeros(equivalence, equivalence)) - { - result.push_back(address); - } - } - - return result; - } - - signature::signature_result signature::process() const - { - const auto range = this->length_ - this->mask_.size(); - const auto cores = std::max(1u, std::thread::hardware_concurrency()); - - if (range <= cores * 10ull) return this->process_serial(); - return this->process_parallel(); - } - - signature::signature_result signature::process_serial() const - { - const auto sub = this->has_sse_support() ? 16 : this->mask_.size(); - return {this->process_range(this->start_, this->length_ - sub)}; - } - - signature::signature_result signature::process_parallel() const - { - const auto sub = this->has_sse_support() ? 16 : this->mask_.size(); - const auto range = this->length_ - sub; - const auto cores = std::max(1u, std::thread::hardware_concurrency() / 2); - // Only use half of the available cores - const auto grid = range / cores; - - std::mutex mutex; - std::vector result; - std::vector threads; - - for (auto i = 0u; i < cores; ++i) - { - const auto start = this->start_ + (grid * i); - const auto length = (i + 1 == cores) ? (this->start_ + this->length_ - sub) - start : grid; - threads.emplace_back([&, start, length]() - { - const auto local_result = this->process_range(start, length); - if (local_result.empty()) return; - - std::lock_guard _(mutex); - for (const auto& address : local_result) - { - result.push_back(address); - } - }); - } - - for (auto& t : threads) - { - if (t.joinable()) - { - t.join(); - } - } - - std::sort(result.begin(), result.end()); - return {std::move(result)}; - } - - bool signature::has_sse_support() const - { - if (this->mask_.size() <= 16) - { - int cpu_id[4]; - __cpuid(cpu_id, 0); - - if (cpu_id[0] >= 1) - { - __cpuidex(cpu_id, 1, 0); - return (cpu_id[2] & (1 << 20)) != 0; - } - } - - return false; - } -} - -utils::hook::signature::signature_result operator"" _sig(const char* str, const size_t len) -{ - return utils::hook::signature(std::string(str, len)).process(); -} +#include "signature.hpp" +#include +#include + +#include + +#ifdef max +#undef max +#endif + +#ifdef min +#undef min +#endif + +namespace utils::hook +{ + void signature::load_pattern(const std::string& pattern) + { + this->mask_.clear(); + this->pattern_.clear(); + + uint8_t nibble = 0; + auto has_nibble = false; + + for (auto val : pattern) + { + if (val == ' ') continue; + if (val == '?') + { + this->mask_.push_back(val); + this->pattern_.push_back(0); + } + else + { + if ((val < '0' || val > '9') && (val < 'A' || val > 'F') && (val < 'a' || val > 'f')) + { + throw std::runtime_error("Invalid pattern"); + } + + char str[] = {val, 0}; + const auto current_nibble = static_cast(strtol(str, nullptr, 16)); + + if (!has_nibble) + { + has_nibble = true; + nibble = current_nibble; + } + else + { + has_nibble = false; + const uint8_t byte = current_nibble | (nibble << 4); + + this->mask_.push_back('x'); + this->pattern_.push_back(byte); + } + } + } + + while (!this->mask_.empty() && this->mask_.back() == '?') + { + this->mask_.pop_back(); + this->pattern_.pop_back(); + } + + if (this->has_sse_support()) + { + while (this->pattern_.size() < 16) + { + this->pattern_.push_back(0); + } + } + + if (has_nibble) + { + throw std::runtime_error("Invalid pattern"); + } + } + + signature::signature_result signature::process_range(uint8_t* start, const size_t length) const + { + if (this->has_sse_support()) return this->process_range_vectorized(start, length); + return this->process_range_linear(start, length); + } + + signature::signature_result signature::process_range_linear(uint8_t* start, const size_t length) const + { + std::vector result; + + for (size_t i = 0; i < length; ++i) + { + const auto address = start + i; + + size_t j = 0; + for (; j < this->mask_.size(); ++j) + { + if (this->mask_[j] != '?' && this->pattern_[j] != address[j]) + { + break; + } + } + + if (j == this->mask_.size()) + { + result.push_back(address); + } + } + + return result; + } + + signature::signature_result signature::process_range_vectorized(uint8_t* start, const size_t length) const + { + std::vector result; + __declspec(align(16)) char desired_mask[16] = {0}; + + for (size_t i = 0; i < this->mask_.size(); i++) + { + desired_mask[i / 8] |= (this->mask_[i] == '?' ? 0 : 1) << i % 8; + } + + const auto mask = _mm_load_si128(reinterpret_cast(desired_mask)); + const auto comparand = _mm_loadu_si128(reinterpret_cast(this->pattern_.data())); + + for (size_t i = 0; i < length; ++i) + { + const auto address = start + i; + const auto value = _mm_loadu_si128(reinterpret_cast(address)); + const auto comparison = _mm_cmpestrm(value, 16, comparand, static_cast(this->mask_.size()), + _SIDD_CMP_EQUAL_EACH); + + const auto matches = _mm_and_si128(mask, comparison); + const auto equivalence = _mm_xor_si128(mask, matches); + + if (_mm_test_all_zeros(equivalence, equivalence)) + { + result.push_back(address); + } + } + + return result; + } + + signature::signature_result signature::process() const + { + const auto range = this->length_ - this->mask_.size(); + const auto cores = std::max(1u, std::thread::hardware_concurrency()); + + if (range <= cores * 10ull) return this->process_serial(); + return this->process_parallel(); + } + + signature::signature_result signature::process_serial() const + { + const auto sub = this->has_sse_support() ? 16 : this->mask_.size(); + return {this->process_range(this->start_, this->length_ - sub)}; + } + + signature::signature_result signature::process_parallel() const + { + const auto sub = this->has_sse_support() ? 16 : this->mask_.size(); + const auto range = this->length_ - sub; + const auto cores = std::max(1u, std::thread::hardware_concurrency() / 2); + // Only use half of the available cores + const auto grid = range / cores; + + std::mutex mutex; + std::vector result; + std::vector threads; + + for (auto i = 0u; i < cores; ++i) + { + const auto start = this->start_ + (grid * i); + const auto length = (i + 1 == cores) ? (this->start_ + this->length_ - sub) - start : grid; + threads.emplace_back([&, start, length]() + { + const auto local_result = this->process_range(start, length); + if (local_result.empty()) return; + + std::lock_guard _(mutex); + for (const auto& address : local_result) + { + result.push_back(address); + } + }); + } + + for (auto& t : threads) + { + if (t.joinable()) + { + t.join(); + } + } + + std::sort(result.begin(), result.end()); + return {std::move(result)}; + } + + bool signature::has_sse_support() const + { + if (this->mask_.size() <= 16) + { + int cpu_id[4]; + __cpuid(cpu_id, 0); + + if (cpu_id[0] >= 1) + { + __cpuidex(cpu_id, 1, 0); + return (cpu_id[2] & (1 << 20)) != 0; + } + } + + return false; + } +} + +utils::hook::signature::signature_result operator"" _sig(const char* str, const size_t len) +{ + return utils::hook::signature(std::string(str, len)).process(); +} diff --git a/hook_lib/common/utils/signature.hpp b/hook_lib/common/utils/signature.hpp index ade80b4..054e6b4 100644 --- a/hook_lib/common/utils/signature.hpp +++ b/hook_lib/common/utils/signature.hpp @@ -1,49 +1,49 @@ -#pragma once -#include "nt.hpp" -#include - -namespace utils::hook -{ - class signature final - { - public: - using signature_result = std::vector; - - explicit signature(const std::string& pattern, const nt::library& library = {}) - : signature(pattern, library.get_ptr(), library.get_optional_header()->SizeOfImage) - { - } - - signature(const std::string& pattern, void* start, void* end) - : signature(pattern, start, size_t(end) - size_t(start)) - { - } - - signature(const std::string& pattern, void* start, const size_t length) - : start_(static_cast(start)), length_(length) - { - this->load_pattern(pattern); - } - - signature_result process() const; - - private: - std::string mask_; - std::basic_string pattern_; - - uint8_t* start_; - size_t length_; - - void load_pattern(const std::string& pattern); - - signature_result process_parallel() const; - signature_result process_serial() const; - signature_result process_range(uint8_t* start, size_t length) const; - signature_result process_range_linear(uint8_t* start, size_t length) const; - signature_result process_range_vectorized(uint8_t* start, size_t length) const; - - bool has_sse_support() const; - }; -} - -utils::hook::signature::signature_result operator"" _sig(const char* str, size_t len); +#pragma once +#include "nt.hpp" +#include + +namespace utils::hook +{ + class signature final + { + public: + using signature_result = std::vector; + + explicit signature(const std::string& pattern, const nt::library& library = {}) + : signature(pattern, library.get_ptr(), library.get_optional_header()->SizeOfImage) + { + } + + signature(const std::string& pattern, void* start, void* end) + : signature(pattern, start, size_t(end) - size_t(start)) + { + } + + signature(const std::string& pattern, void* start, const size_t length) + : start_(static_cast(start)), length_(length) + { + this->load_pattern(pattern); + } + + signature_result process() const; + + private: + std::string mask_; + std::basic_string pattern_; + + uint8_t* start_; + size_t length_; + + void load_pattern(const std::string& pattern); + + signature_result process_parallel() const; + signature_result process_serial() const; + signature_result process_range(uint8_t* start, size_t length) const; + signature_result process_range_linear(uint8_t* start, size_t length) const; + signature_result process_range_vectorized(uint8_t* start, size_t length) const; + + bool has_sse_support() const; + }; +} + +utils::hook::signature::signature_result operator"" _sig(const char* str, size_t len); diff --git a/hook_lib/common/utils/smbios.cpp b/hook_lib/common/utils/smbios.cpp index 84de22c..a3282c2 100644 --- a/hook_lib/common/utils/smbios.cpp +++ b/hook_lib/common/utils/smbios.cpp @@ -1,94 +1,94 @@ -#include "smbios.hpp" -#include "memory.hpp" - -#define WIN32_LEAN_AND_MEAN -#include -#include - -namespace utils::smbios -{ - namespace - { -#pragma warning(push) -#pragma warning(disable: 4200) - struct RawSMBIOSData - { - BYTE Used20CallingMethod; - BYTE SMBIOSMajorVersion; - BYTE SMBIOSMinorVersion; - BYTE DmiRevision; - DWORD Length; - BYTE SMBIOSTableData[]; - }; - - typedef struct - { - BYTE type; - BYTE length; - WORD handle; - } dmi_header; -#pragma warning(pop) - - std::vector get_smbios_data() - { - DWORD size = 0; - std::vector data{}; - - size = GetSystemFirmwareTable('RSMB', 0, nullptr, size); - data.resize(size); - GetSystemFirmwareTable('RSMB', 0, data.data(), size); - - return data; - } - - std::string parse_uuid(const uint8_t* data) - { - if (utils::memory::is_set(data, 0, 16) || utils::memory::is_set(data, -1, 16)) - { - return {}; - } - - char uuid[16] = {0}; - *reinterpret_cast(uuid + 0) = - _byteswap_ulong(*reinterpret_cast(data + 0)); - *reinterpret_cast(uuid + 4) = - _byteswap_ushort(*reinterpret_cast(data + 4)); - *reinterpret_cast(uuid + 6) = - _byteswap_ushort(*reinterpret_cast(data + 6)); - memcpy(uuid + 8, data + 8, 8); - - return std::string(uuid, sizeof(uuid)); - } - } - - std::string get_uuid() - { - auto smbios_data = get_smbios_data(); - auto* raw_data = reinterpret_cast(smbios_data.data()); - - auto* data = raw_data->SMBIOSTableData; - for (DWORD i = 0; i + sizeof(dmi_header) < raw_data->Length;) - { - auto* header = reinterpret_cast(data + i); - if (header->length < 4) - { - return {}; - } - - if (header->type == 0x01 && header->length >= 0x19) - { - return parse_uuid(data + i + 0x8); - } - - i += header->length; - while ((i + 1) < raw_data->Length && *reinterpret_cast(data + i) != 0) - { - ++i; - } - - i += 2; - } - - return {}; - } -} +#include "smbios.hpp" +#include "memory.hpp" + +#define WIN32_LEAN_AND_MEAN +#include +#include + +namespace utils::smbios +{ + namespace + { +#pragma warning(push) +#pragma warning(disable: 4200) + struct RawSMBIOSData + { + BYTE Used20CallingMethod; + BYTE SMBIOSMajorVersion; + BYTE SMBIOSMinorVersion; + BYTE DmiRevision; + DWORD Length; + BYTE SMBIOSTableData[]; + }; + + typedef struct + { + BYTE type; + BYTE length; + WORD handle; + } dmi_header; +#pragma warning(pop) + + std::vector get_smbios_data() + { + DWORD size = 0; + std::vector data{}; + + size = GetSystemFirmwareTable('RSMB', 0, nullptr, size); + data.resize(size); + GetSystemFirmwareTable('RSMB', 0, data.data(), size); + + return data; + } + + std::string parse_uuid(const uint8_t* data) + { + if (utils::memory::is_set(data, 0, 16) || utils::memory::is_set(data, -1, 16)) + { + return {}; + } + + char uuid[16] = {0}; + *reinterpret_cast(uuid + 0) = + _byteswap_ulong(*reinterpret_cast(data + 0)); + *reinterpret_cast(uuid + 4) = + _byteswap_ushort(*reinterpret_cast(data + 4)); + *reinterpret_cast(uuid + 6) = + _byteswap_ushort(*reinterpret_cast(data + 6)); + memcpy(uuid + 8, data + 8, 8); + + return std::string(uuid, sizeof(uuid)); + } + } + + std::string get_uuid() + { + auto smbios_data = get_smbios_data(); + auto* raw_data = reinterpret_cast(smbios_data.data()); + + auto* data = raw_data->SMBIOSTableData; + for (DWORD i = 0; i + sizeof(dmi_header) < raw_data->Length;) + { + auto* header = reinterpret_cast(data + i); + if (header->length < 4) + { + return {}; + } + + if (header->type == 0x01 && header->length >= 0x19) + { + return parse_uuid(data + i + 0x8); + } + + i += header->length; + while ((i + 1) < raw_data->Length && *reinterpret_cast(data + i) != 0) + { + ++i; + } + + i += 2; + } + + return {}; + } +} diff --git a/hook_lib/common/utils/smbios.hpp b/hook_lib/common/utils/smbios.hpp index 62e8c0e..bbd1939 100644 --- a/hook_lib/common/utils/smbios.hpp +++ b/hook_lib/common/utils/smbios.hpp @@ -1,8 +1,8 @@ -#pragma once - -#include - -namespace utils::smbios -{ - std::string get_uuid(); -} +#pragma once + +#include + +namespace utils::smbios +{ + std::string get_uuid(); +} diff --git a/hook_lib/common/utils/string.cpp b/hook_lib/common/utils/string.cpp index f2de62b..3313eca 100644 --- a/hook_lib/common/utils/string.cpp +++ b/hook_lib/common/utils/string.cpp @@ -1,177 +1,177 @@ -#include "string.hpp" -#include -#include -#include - -#include "nt.hpp" - -namespace utils::string -{ - const char* va(const char* fmt, ...) - { - static thread_local va_provider<8, 256> provider; - - va_list ap; - va_start(ap, fmt); - - const char* result = provider.get(fmt, ap); - - va_end(ap); - return result; - } - - std::vector split(const std::string& s, const char delim) - { - std::stringstream ss(s); - std::string item; - std::vector elems; - - while (std::getline(ss, item, delim)) - { - elems.push_back(item); // elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson) - } - - return elems; - } - - std::string to_lower(std::string text) - { - std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) - { - return static_cast(std::tolower(input)); - }); - - return text; - } - - std::string to_upper(std::string text) - { - std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) - { - return static_cast(std::toupper(input)); - }); - - return text; - } - - bool starts_with(const std::string& text, const std::string& substring) - { - return text.find(substring) == 0; - } - - bool ends_with(const std::string& text, const std::string& substring) - { - if (substring.size() > text.size()) return false; - return std::equal(substring.rbegin(), substring.rend(), text.rbegin()); - } - - std::string dump_hex(const std::string& data, const std::string& separator) - { - std::string result; - - for (unsigned int i = 0; i < data.size(); ++i) - { - if (i > 0) - { - result.append(separator); - } - - result.append(va("%02X", data[i] & 0xFF)); - } - - return result; - } - - std::string get_clipboard_data() - { - if (OpenClipboard(nullptr)) - { - std::string data; - - auto* const clipboard_data = GetClipboardData(1u); - if (clipboard_data) - { - auto* const cliptext = static_cast(GlobalLock(clipboard_data)); - if (cliptext) - { - data.append(cliptext); - GlobalUnlock(clipboard_data); - } - } - CloseClipboard(); - - return data; - } - return {}; - } - - void strip(const char* in, char* out, size_t max) - { - if (!in || !out) return; - - max--; - size_t current = 0; - while (*in != 0 && current < max) - { - const auto color_index = (*(in + 1) - 48) >= 0xC ? 7 : (*(in + 1) - 48); - - if (*in == '^' && (color_index != 7 || *(in + 1) == '7')) - { - ++in; - } - else - { - *out = *in; - ++out; - ++current; - } - - ++in; - } - - *out = '\0'; - } - - std::string convert(const std::wstring& wstr) - { - std::string result; - result.reserve(wstr.size()); - - for (const auto& chr : wstr) - { - result.push_back(static_cast(chr)); - } - - return result; - } - - std::wstring convert(const std::string& str) - { - std::wstring result; - result.reserve(str.size()); - - for (const auto& chr : str) - { - result.push_back(static_cast(chr)); - } - - return result; - } - - std::string replace(std::string str, const std::string& from, const std::string& to) - { - if (from.empty()) - { - return str; - } - - size_t start_pos = 0; - while ((start_pos = str.find(from, start_pos)) != std::string::npos) - { - str.replace(start_pos, from.length(), to); - start_pos += to.length(); - } - - return str; - } -} +#include "string.hpp" +#include +#include +#include + +#include "nt.hpp" + +namespace utils::string +{ + const char* va(const char* fmt, ...) + { + static thread_local va_provider<8, 256> provider; + + va_list ap; + va_start(ap, fmt); + + const char* result = provider.get(fmt, ap); + + va_end(ap); + return result; + } + + std::vector split(const std::string& s, const char delim) + { + std::stringstream ss(s); + std::string item; + std::vector elems; + + while (std::getline(ss, item, delim)) + { + elems.push_back(item); // elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson) + } + + return elems; + } + + std::string to_lower(std::string text) + { + std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) + { + return static_cast(std::tolower(input)); + }); + + return text; + } + + std::string to_upper(std::string text) + { + std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) + { + return static_cast(std::toupper(input)); + }); + + return text; + } + + bool starts_with(const std::string& text, const std::string& substring) + { + return text.find(substring) == 0; + } + + bool ends_with(const std::string& text, const std::string& substring) + { + if (substring.size() > text.size()) return false; + return std::equal(substring.rbegin(), substring.rend(), text.rbegin()); + } + + std::string dump_hex(const std::string& data, const std::string& separator) + { + std::string result; + + for (unsigned int i = 0; i < data.size(); ++i) + { + if (i > 0) + { + result.append(separator); + } + + result.append(va("%02X", data[i] & 0xFF)); + } + + return result; + } + + std::string get_clipboard_data() + { + if (OpenClipboard(nullptr)) + { + std::string data; + + auto* const clipboard_data = GetClipboardData(1u); + if (clipboard_data) + { + auto* const cliptext = static_cast(GlobalLock(clipboard_data)); + if (cliptext) + { + data.append(cliptext); + GlobalUnlock(clipboard_data); + } + } + CloseClipboard(); + + return data; + } + return {}; + } + + void strip(const char* in, char* out, size_t max) + { + if (!in || !out) return; + + max--; + size_t current = 0; + while (*in != 0 && current < max) + { + const auto color_index = (*(in + 1) - 48) >= 0xC ? 7 : (*(in + 1) - 48); + + if (*in == '^' && (color_index != 7 || *(in + 1) == '7')) + { + ++in; + } + else + { + *out = *in; + ++out; + ++current; + } + + ++in; + } + + *out = '\0'; + } + + std::string convert(const std::wstring& wstr) + { + std::string result; + result.reserve(wstr.size()); + + for (const auto& chr : wstr) + { + result.push_back(static_cast(chr)); + } + + return result; + } + + std::wstring convert(const std::string& str) + { + std::wstring result; + result.reserve(str.size()); + + for (const auto& chr : str) + { + result.push_back(static_cast(chr)); + } + + return result; + } + + std::string replace(std::string str, const std::string& from, const std::string& to) + { + if (from.empty()) + { + return str; + } + + size_t start_pos = 0; + while ((start_pos = str.find(from, start_pos)) != std::string::npos) + { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + + return str; + } +} diff --git a/hook_lib/common/utils/string.hpp b/hook_lib/common/utils/string.hpp index 292bca9..edc5cc1 100644 --- a/hook_lib/common/utils/string.hpp +++ b/hook_lib/common/utils/string.hpp @@ -1,97 +1,97 @@ -#pragma once -#include "memory.hpp" - -template -constexpr auto ARRAY_COUNT(Type (&)[n]) { return n; } - -namespace utils::string -{ - template - class va_provider final - { - public: - static_assert(Buffers != 0 && MinBufferSize != 0, "Buffers and MinBufferSize mustn't be 0"); - - va_provider() : current_buffer_(0) - { - } - - char* get(const char* format, const va_list ap) - { - ++this->current_buffer_ %= ARRAY_COUNT(this->string_pool_); - auto entry = &this->string_pool_[this->current_buffer_]; - - if (!entry->size || !entry->buffer) - { - throw std::runtime_error("String pool not initialized"); - } - - while (true) - { - const int res = vsnprintf_s(entry->buffer, entry->size, _TRUNCATE, format, ap); - if (res > 0) break; // Success - if (res == 0) return nullptr; // Error - - entry->double_size(); - } - - return entry->buffer; - } - - private: - class entry final - { - public: - entry(const size_t _size = MinBufferSize) : size(_size), buffer(nullptr) - { - if (this->size < MinBufferSize) this->size = MinBufferSize; - this->allocate(); - } - - ~entry() - { - if (this->buffer) memory::get_allocator()->free(this->buffer); - this->size = 0; - this->buffer = nullptr; - } - - void allocate() - { - if (this->buffer) memory::get_allocator()->free(this->buffer); - this->buffer = memory::get_allocator()->allocate_array(this->size + 1); - } - - void double_size() - { - this->size *= 2; - this->allocate(); - } - - size_t size{}; - char* buffer{nullptr}; - }; - - size_t current_buffer_{}; - entry string_pool_[Buffers]{}; - }; - - const char* va(const char* fmt, ...); - - std::vector split(const std::string& s, char delim); - - std::string to_lower(std::string text); - std::string to_upper(std::string text); - bool starts_with(const std::string& text, const std::string& substring); - bool ends_with(const std::string& text, const std::string& substring); - - std::string dump_hex(const std::string& data, const std::string& separator = " "); - - std::string get_clipboard_data(); - - void strip(const char* in, char* out, size_t max); - - std::string convert(const std::wstring& wstr); - std::wstring convert(const std::string& str); - - std::string replace(std::string str, const std::string& from, const std::string& to); -} +#pragma once +#include "memory.hpp" + +template +constexpr auto ARRAY_COUNT(Type (&)[n]) { return n; } + +namespace utils::string +{ + template + class va_provider final + { + public: + static_assert(Buffers != 0 && MinBufferSize != 0, "Buffers and MinBufferSize mustn't be 0"); + + va_provider() : current_buffer_(0) + { + } + + char* get(const char* format, const va_list ap) + { + ++this->current_buffer_ %= ARRAY_COUNT(this->string_pool_); + auto entry = &this->string_pool_[this->current_buffer_]; + + if (!entry->size || !entry->buffer) + { + throw std::runtime_error("String pool not initialized"); + } + + while (true) + { + const int res = vsnprintf_s(entry->buffer, entry->size, _TRUNCATE, format, ap); + if (res > 0) break; // Success + if (res == 0) return nullptr; // Error + + entry->double_size(); + } + + return entry->buffer; + } + + private: + class entry final + { + public: + entry(const size_t _size = MinBufferSize) : size(_size), buffer(nullptr) + { + if (this->size < MinBufferSize) this->size = MinBufferSize; + this->allocate(); + } + + ~entry() + { + if (this->buffer) memory::get_allocator()->free(this->buffer); + this->size = 0; + this->buffer = nullptr; + } + + void allocate() + { + if (this->buffer) memory::get_allocator()->free(this->buffer); + this->buffer = memory::get_allocator()->allocate_array(this->size + 1); + } + + void double_size() + { + this->size *= 2; + this->allocate(); + } + + size_t size{}; + char* buffer{nullptr}; + }; + + size_t current_buffer_{}; + entry string_pool_[Buffers]{}; + }; + + const char* va(const char* fmt, ...); + + std::vector split(const std::string& s, char delim); + + std::string to_lower(std::string text); + std::string to_upper(std::string text); + bool starts_with(const std::string& text, const std::string& substring); + bool ends_with(const std::string& text, const std::string& substring); + + std::string dump_hex(const std::string& data, const std::string& separator = " "); + + std::string get_clipboard_data(); + + void strip(const char* in, char* out, size_t max); + + std::string convert(const std::wstring& wstr); + std::wstring convert(const std::string& str); + + std::string replace(std::string str, const std::string& from, const std::string& to); +} diff --git a/hook_lib/common/utils/thread.cpp b/hook_lib/common/utils/thread.cpp index 7649c65..582ed5c 100644 --- a/hook_lib/common/utils/thread.cpp +++ b/hook_lib/common/utils/thread.cpp @@ -1,116 +1,116 @@ -#include "thread.hpp" -#include "string.hpp" -#include "finally.hpp" - -#include - -namespace utils::thread -{ - /*bool set_name(const HANDLE t, const std::string& name) - { - const nt::library kernel32("kernel32.dll"); - if (!kernel32) - { - return false; - } - - const auto set_description = kernel32.get_proc("SetThreadDescription"); - if (!set_description) - { - return false; - } - - return SUCCEEDED(set_description(t, string::convert(name).data())); - } - - bool set_name(const DWORD id, const std::string& name) - { - auto* const t = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, id); - if (!t) return false; - - const auto _ = utils::finally([t]() - { - CloseHandle(t); - }); - - return set_name(t, name); - } - - bool set_name(std::thread& t, const std::string& name) - { - return set_name(t.native_handle(), name); - } - - bool set_name(const std::string& name) - { - return set_name(GetCurrentThread(), name); - } - */ - std::vector get_thread_ids() - { - nt::handle h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId()); - if (!h) - { - return {}; - } - - THREADENTRY32 entry{}; - entry.dwSize = sizeof(entry); - if (!Thread32First(h, &entry)) - { - return {}; - } - - std::vector ids{}; - - do - { - const auto check_size = entry.dwSize < FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) - + sizeof(entry.th32OwnerProcessID); - entry.dwSize = sizeof(entry); - - if (check_size && entry.th32OwnerProcessID == GetCurrentProcessId()) - { - ids.emplace_back(entry.th32ThreadID); - } - } while (Thread32Next(h, &entry)); - - return ids; - } - - void for_each_thread(const std::function& callback, const DWORD access) - { - const auto ids = get_thread_ids(); - - for (const auto& id : ids) - { - handle thread(id, access); - if (thread) - { - callback(thread); - } - } - } - - void suspend_other_threads() - { - for_each_thread([](const HANDLE thread) - { - if (GetThreadId(thread) != GetCurrentThreadId()) - { - SuspendThread(thread); - } - }); - } - - void resume_other_threads() - { - for_each_thread([](const HANDLE thread) - { - if (GetThreadId(thread) != GetCurrentThreadId()) - { - ResumeThread(thread); - } - }); - } -} +#include "thread.hpp" +#include "string.hpp" +#include "finally.hpp" + +#include + +namespace utils::thread +{ + /*bool set_name(const HANDLE t, const std::string& name) + { + const nt::library kernel32("kernel32.dll"); + if (!kernel32) + { + return false; + } + + const auto set_description = kernel32.get_proc("SetThreadDescription"); + if (!set_description) + { + return false; + } + + return SUCCEEDED(set_description(t, string::convert(name).data())); + } + + bool set_name(const DWORD id, const std::string& name) + { + auto* const t = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, id); + if (!t) return false; + + const auto _ = utils::finally([t]() + { + CloseHandle(t); + }); + + return set_name(t, name); + } + + bool set_name(std::thread& t, const std::string& name) + { + return set_name(t.native_handle(), name); + } + + bool set_name(const std::string& name) + { + return set_name(GetCurrentThread(), name); + } + */ + std::vector get_thread_ids() + { + nt::handle h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId()); + if (!h) + { + return {}; + } + + THREADENTRY32 entry{}; + entry.dwSize = sizeof(entry); + if (!Thread32First(h, &entry)) + { + return {}; + } + + std::vector ids{}; + + do + { + const auto check_size = entry.dwSize < FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + + sizeof(entry.th32OwnerProcessID); + entry.dwSize = sizeof(entry); + + if (check_size && entry.th32OwnerProcessID == GetCurrentProcessId()) + { + ids.emplace_back(entry.th32ThreadID); + } + } while (Thread32Next(h, &entry)); + + return ids; + } + + void for_each_thread(const std::function& callback, const DWORD access) + { + const auto ids = get_thread_ids(); + + for (const auto& id : ids) + { + handle thread(id, access); + if (thread) + { + callback(thread); + } + } + } + + void suspend_other_threads() + { + for_each_thread([](const HANDLE thread) + { + if (GetThreadId(thread) != GetCurrentThreadId()) + { + SuspendThread(thread); + } + }); + } + + void resume_other_threads() + { + for_each_thread([](const HANDLE thread) + { + if (GetThreadId(thread) != GetCurrentThreadId()) + { + ResumeThread(thread); + } + }); + } +} diff --git a/hook_lib/common/utils/thread.hpp b/hook_lib/common/utils/thread.hpp index f1365c1..b656226 100644 --- a/hook_lib/common/utils/thread.hpp +++ b/hook_lib/common/utils/thread.hpp @@ -1,47 +1,47 @@ -#pragma once -#include -#include "nt.hpp" - -namespace utils::thread -{ - //bool set_name(HANDLE t, const std::string& name); - //bool set_name(DWORD id, const std::string& name); - //bool set_name(std::thread& t, const std::string& name); - //bool set_name(const std::string& name); - - template - std::thread create_named_thread(const std::string& name, Args&&... args) - { - auto t = std::thread(std::forward(args)...); - set_name(t, name); - return t; - } - - class handle - { - public: - handle(const DWORD thread_id, const DWORD access = THREAD_ALL_ACCESS) - : handle_(OpenThread(access, FALSE, thread_id)) - { - } - - operator bool() const - { - return this->handle_; - } - - operator HANDLE() const - { - return this->handle_; - } - - private: - nt::handle<> handle_{}; - }; - - std::vector get_thread_ids(); - void for_each_thread(const std::function& callback, DWORD access = THREAD_ALL_ACCESS); - - void suspend_other_threads(); - void resume_other_threads(); -} +#pragma once +#include +#include "nt.hpp" + +namespace utils::thread +{ + //bool set_name(HANDLE t, const std::string& name); + //bool set_name(DWORD id, const std::string& name); + //bool set_name(std::thread& t, const std::string& name); + //bool set_name(const std::string& name); + + template + std::thread create_named_thread(const std::string& name, Args&&... args) + { + auto t = std::thread(std::forward(args)...); + set_name(t, name); + return t; + } + + class handle + { + public: + handle(const DWORD thread_id, const DWORD access = THREAD_ALL_ACCESS) + : handle_(OpenThread(access, FALSE, thread_id)) + { + } + + operator bool() const + { + return this->handle_; + } + + operator HANDLE() const + { + return this->handle_; + } + + private: + nt::handle<> handle_{}; + }; + + std::vector get_thread_ids(); + void for_each_thread(const std::function& callback, DWORD access = THREAD_ALL_ACCESS); + + void suspend_other_threads(); + void resume_other_threads(); +} diff --git a/hook_lib/functions.cpp b/hook_lib/functions.cpp index be31eb9..53f627d 100644 --- a/hook_lib/functions.cpp +++ b/hook_lib/functions.cpp @@ -1,379 +1,406 @@ -#include "functions.hpp" - -void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler) { - utils::nt::library ntdll("ntdll.dll"); - ntdll.invoke("RtlAddVectoredExceptionHandler", First, Handler); - return nullptr; -} - -NTSTATUS NtContinue(PCONTEXT threadContext, BOOLEAN raiseAlert) { - utils::nt::library ntdll("ntdll.dll"); - return ntdll.invoke("NtContinue", threadContext, raiseAlert); -} - -#pragma region //game functions - -const char* (*va)(const char* fmt, ...); - -void Live_FakeUserSignIn(int controllerIndex, const char* gamertag) { - auto func = reinterpret_cast(0x1413FDA40_g); - func(controllerIndex, gamertag); -} - -void R_AddCmdDrawText(const char* text, int maxChars, void /* GfxFont */* font, int fontHeight, float x, float y, float xScale, float yScale, float rotation, const float* color, const void /* FontGlowStyle */* glowStyle, bool usePost) { - auto func = reinterpret_cast(0x00000001419653E0_g); - func(text, maxChars, font, fontHeight, x, y, xScale, yScale, rotation, color, glowStyle, usePost); -} - -bool CG_WorldPosToScreenPosReal(int localClientNum, const uintptr_t scrPlace, const float* worldPos, float* outScreenPos) { - auto func = reinterpret_cast(0x141696AA0_g); - return func(localClientNum, scrPlace, worldPos, outScreenPos); -} - -void CG_DrawRotatedPicPhysical(uintptr_t scrPlace, float x, float y, float width, float height, float angle, const float* color, uintptr_t material) { - auto func = reinterpret_cast(0x141695B20_g); - func(scrPlace, x, y, width, height, angle, color, material); -} - -uintptr_t FS_ReadFile(const char* qpath, const char** buffer) { - auto func = reinterpret_cast(0x1413DA530_g); - return func(qpath, buffer); -} - -const char* Dvar_GetStringSafe(const char* dvar) { - auto func = reinterpret_cast(0x1413E69B0_g); - return func(dvar); -} - -unsigned int* GetRandSeed() { - auto func = reinterpret_cast(0x1413DD630_g); - return func(); -} - -unsigned __int64 Sys_Microseconds() { - auto func = reinterpret_cast(0x14148FC10_g); - return func(); -} - -int I_irand(int min, int max) { - auto func = reinterpret_cast(0x1413DD8B0_g); - return func(min, max); -} - -unsigned __int64 I_atoui64_hex(const char* str) { - auto func = reinterpret_cast(0x1413F3310_g); - return func(str); -} - -unsigned __int64 I_atoui64(const char* str) { - auto func = reinterpret_cast(0x1413F3300_g); - return func(str); -} - -uintptr_t Dvar_FindVarByName(const char* dvarName) { - auto func = reinterpret_cast(0x1413E63A0_g); - return func(dvarName); -} - -void CL_DrawText(const uintptr_t scrPlace, const char* text, int maxChars, uintptr_t font, float x, float y, int horzAlign, int vertAlign, float xScale, float yScale, const float* color, int style) { - auto func = reinterpret_cast(0x1415AAAA0_g); - func(scrPlace, text, maxChars, font, x, y, horzAlign, vertAlign, xScale, yScale, color, style); -} - -dvar_t* Dvar_RegisterString(const char* dvarName, const char* value, unsigned int flags, const char* description) { - auto func = reinterpret_cast(0x1413E7A70_g); - return func(dvarName, value, flags, description); -} - -dvar_t* Dvar_RegisterBool(const char* dvarName, bool value, unsigned int flags, const char* description) { - auto func = reinterpret_cast(0x1413E7670_g); - return func(dvarName, value, flags, description); -} - -void LUI_CoD_LuaCall_ExecNow(uintptr_t luaVM, const char* str) { - lua_getfield(luaVM, -10002, "Engine"); - lua_getfield(luaVM, -1, "DAGFFDGFII"); - lua_remove(luaVM, -2); - lua_pushstring(luaVM, str); - LuaShared_PCall(luaVM, 1, 1); -} - -bool LUI_LuaCall_Game_IsEntityAlive(uintptr_t luaVM, int entityNum) { - lua_getfield(luaVM, -10002, "Game"); - lua_getfield(luaVM, -1, "JDAIJCDEB"); - lua_remove(luaVM, -2); - lua_pushinteger(luaVM, 0); - lua_pushinteger(luaVM, entityNum); - LuaShared_PCall(luaVM, 2, 1); - return lua_toboolean(luaVM, 0); -} - -void Cbuf_AddText(const char* cmd) { - uintptr_t luaVM = *reinterpret_cast(0x151868880_g); - if (luaVM) { - LUI_CoD_LuaCall_ExecNow(luaVM, cmd); - } -} - -bool lua_toboolean(uintptr_t L, int idx) { - auto func = reinterpret_cast(0x1420848D0_g); - return func(L, idx); -} - -void lua_pushboolean(uintptr_t L, int b) { - auto func = reinterpret_cast(0x142083E80_g); - func(L, b); -} - -void lua_remove(uintptr_t L, int idx) { - auto func = reinterpret_cast(0x142084420_g); - func(L, idx); -} - -void lua_call(uintptr_t L, int nargs, int nresults) { - auto func = reinterpret_cast(0x1420831D0_g); - func(L, nargs, nresults); -} - -void lua_getfield(uintptr_t L, int idx, const char* k) { - auto func = reinterpret_cast(0x1420836E0_g); - func(L, idx, k); -} - -void lua_pushvalue(uintptr_t L, int idx) { - auto func = reinterpret_cast(0x142084200_g); - func(L, idx); -} - -void lua_pushstring(uintptr_t L, const char* str) { - auto func = reinterpret_cast(0x142084120_g); - func(L, str); -} - -void lua_pushinteger(uintptr_t L, int n) { - auto func = reinterpret_cast(0x142083FE0_g); - func(L, n); -} - -void lua_settop(uintptr_t L, int idx) { - auto func = reinterpret_cast(0x142084790_g); - func(L, idx); -} - -int LuaShared_PCall(uintptr_t luaVM, int nargs, int nresults) { - auto func = reinterpret_cast(0x1419B7570_g); - return func(luaVM, nargs, nresults); -} - -bool CG_DObjGetWorldBoneMatrix(uintptr_t pose, uintptr_t obj, int boneIndex, uintptr_t outTagMat, float* outOrigin) { - auto func = reinterpret_cast(0x1416A59D0_g); - return func(pose, obj, boneIndex, outTagMat, outOrigin); -} - -void CG_DrawLine(float X1, float Y1, float X2, float Y2, const float* color, float Width) { - float X, Y, Angle, L1, L2, H1; - H1 = Y2 - Y1; - L1 = X2 - X1; - L2 = sqrtf(L1 * L1 + H1 * H1); - X = X1 + ((L1 - L2) / 2); - Y = Y1 + (H1 / 2); - Angle = atan(H1 / L1) * (180 / 3.14159265358979323846); - CG_DrawRotatedPicPhysical(0x14EF2DEA0_g, X, Y, L2, Width, Angle, color, *reinterpret_cast(0x152C465A0_g)); -} - -void CG_DrawBone(int entIndex, uintptr_t ent, int from, int to, const float* color) { - float bone1[3], bone2[3]; - float fromPos[2], toPos[2]; - char tmat33[0x24]; - short* clientObjMap = (short*)(0x14D45EC60_g); - uintptr_t s_objBuf = *reinterpret_cast(0x14D45EC50_g); - uintptr_t dobj = s_objBuf + (0x150 * clientObjMap[entIndex]); - if (CG_DObjGetWorldBoneMatrix(ent, dobj, from, (uintptr_t)&tmat33, bone1) && CG_DObjGetWorldBoneMatrix(ent, dobj, to, (uintptr_t)&tmat33, bone2)) { - if (CG_WorldPosToScreenPosReal(0, 0x14EF2DEA0_g, bone1, fromPos) && CG_WorldPosToScreenPosReal(0, 0x14EF2DEA0_g, bone2, toPos)) { - CG_DrawLine(fromPos[0], fromPos[1], toPos[0], toPos[1], color, 1); - } - } -} - -void CG_DrawBones(int entIndex, uintptr_t ent, const float* color) { - //spine - CG_DrawBone(entIndex, ent, 41, 35, color); - CG_DrawBone(entIndex, ent, 35, 7, color); - CG_DrawBone(entIndex, ent, 7, 6, color); - CG_DrawBone(entIndex, ent, 6, 30, color); - CG_DrawBone(entIndex, ent, 30, 55, color); - CG_DrawBone(entIndex, ent, 55, 54, color); - CG_DrawBone(entIndex, ent, 54, 53, color); - CG_DrawBone(entIndex, ent, 53, 2, color); - - //hips - CG_DrawBone(entIndex, ent, 2, 63, color); - CG_DrawBone(entIndex, ent, 2, 64, color); -} - -bool CheatsOk(int entNum) { - SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * entNum)); - uintptr_t client = g_entities[entNum].get(0x150); - if (sv_cheats->current.enabled) { - return true; - } - else { - ms_clients->SendServerCommand(1, "f \"Cheats are not enabled on this server!\""); - return false; - } -} - -//ingame removed functions -void Cmd_Noclip_f(int entNum) -{ - SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * entNum)); - uintptr_t client = g_entities[entNum].get(0x150); - if (client) { - int v6 = *reinterpret_cast(client + 0x5DD0); - if ((*reinterpret_cast(client + 0x5DD0) & 1) != 0) { - v6 = *reinterpret_cast(client + 0x5DD0) & 0xFFFFFFFE; - ms_clients->SendServerCommand(1, "f \"Noclip: ^1OFF\""); - } - else { - v6 = *reinterpret_cast(client + 0x5DD0) | 1; - ms_clients->SendServerCommand(1, "f \"Noclip: ^2ON\""); - } - *reinterpret_cast(client + 0x5DD0) = v6; - } -} - -void SV_Cmd_ArgvBuffer(int arg, char* buffer, unsigned __int64 bufferLength) { - auto func = reinterpret_cast(0x141298B40_g); - func(arg, buffer, bufferLength); -} - -void Cmd_ArgvBuffer(int arg, char* buffer, int bufferLength) { - if (arg >= cmd_args->argc[cmd_args->nesting]) - strcpy_s(buffer, bufferLength, ""); - else - strcpy_s(buffer, bufferLength, cmd_args->argv[cmd_args->nesting][arg]); -} - -int Cmd_Argc() { - return cmd_args->argc[cmd_args->nesting]; -} - -int SV_Cmd_Argc() { - auto func = reinterpret_cast(0x141298AF0_g); - return func(); -} - -void Cmd_AddCommandInternal(const char* cmdName, void(__fastcall* function)(), cmd_function_s* allocedCmd) { - auto func = reinterpret_cast(0x1412965F0_g); - func(cmdName, function, allocedCmd); -} - -ClActiveClient* GetClActiveClient() { - ms_activeClients = *reinterpret_cast(0x14EE854F8_g); - return ms_activeClients; -} - -int ClActiveClient_GetCmdNumber(ClActiveClient* activeClient) { - return activeClient->cmdNumber ^ ((activeClient->get(0x8700) ^ (activeClient->cmdNumber) * ((activeClient->get(0x8700) ^ activeClient->cmdNumber) + 2))); -} - -usercmd_s* CL_GetUserCmd(int cmdNumber) { - ms_activeClients = *reinterpret_cast(0x14EE854F8_g); - return &ms_activeClients->cmds[cmdNumber & 0x7F]; -} - -void AddReliableCommand(uintptr_t _this, const char* commandBuffer, const int reliableCmdSize, int type) { - auto func = reinterpret_cast(0x1415E0440_g); - func(_this, commandBuffer, reliableCmdSize, type); -} - -unsigned int MSG_WriteReliableCommandToBuffer(const char* pszCommand, char* pszBuffer, unsigned int iBufferSize) { - auto func = reinterpret_cast(0x1412DDBF0_g); - return func(pszCommand, pszBuffer, iBufferSize); -} - -void CL_Main_AddReliableCommand(const char* cmd) { - uintptr_t ms_connections = *reinterpret_cast(0x14EE85570_g); - char buf[1024]; - int cmdSize = MSG_WriteReliableCommandToBuffer(cmd, buf, 1024); - AddReliableCommand(ms_connections, buf, cmdSize, 0); -} - -bool BG_Weapons_GetFullWeaponForName(const char* name, Weapon* outWeapon, Weapon* (*getWeaponFunc)(Weapon* result, const char*)) { - auto func = reinterpret_cast(0x141158130_g); - return func(name, outWeapon, getWeaponFunc); -} - -void Scr_AddString(scrContext_t* scrContext, const char* value) { - auto func = reinterpret_cast(0x141322D90_g); - func(scrContext, value); -} - -unsigned int GScr_ExecEntThread(gentity_s* ent, int handle, unsigned int paramcount) { - auto func = reinterpret_cast(0x141257D70_g); - return func(ent, handle, paramcount); -} - -void Scr_FreeThread(scrContext_t* scrContext, unsigned int handle) { - auto func = reinterpret_cast(0x1413242E0_g); - func(scrContext, handle); -} - -int G_Weapon_GivePlayerWeapon(uintptr_t ps, uintptr_t scrContext, Weapon* weapon, int dualWield, int startInAltMode, int usedBefore) { - auto func = reinterpret_cast(0x14127C8B0_g); - return func(ps, scrContext, weapon, dualWield, startInAltMode, usedBefore); -} - -void G_Items_AddAmmo(uintptr_t ps, Weapon* weapon, bool isAlternate, int count, int fillClip) { - auto func = reinterpret_cast(0x141216860_g); - func(ps, weapon, isAlternate, count, fillClip); -} - -void G_Weapon_SelectWeapon(int clientNum, Weapon* weapon) { - auto func = reinterpret_cast(0x14127F840_g); -} - -Weapon* BG_FindBaseWeaponForName(Weapon* result, const char* name) { - auto func = reinterpret_cast(0x1411570F0_g); - return func(result, name); -} - -scrContext_t* ScriptContext_Server() { - auto func = reinterpret_cast(0x1412E0E70_g); - return func(); -} - -const char* SL_ConvertToString(int id) { - auto func = reinterpret_cast(0x14131AA20_g); - return func(id); -} - -XAssetHeader DB_FindXAssetHeader(XAssetType type, const char* givenName, int allowCreateDefault) { - auto func = reinterpret_cast(0x1411AA890_g); - return func(type, givenName, allowCreateDefault); -} - -#pragma endregion - -dvar_t* player_name; -dvar_t* sv_cheats; -dvar_t* spawn_br_gas; -dvar_t* show_watermark; -dvar_t* player_sustainammo; - -cmd_function_s set_byte_f_VAR; -cmd_function_s set_short_f_VAR; -cmd_function_s set_int_f_VAR; -cmd_function_s set_pointer_f_VAR; -cmd_function_s quit_f_VAR; -cmd_function_s openmenu_f_VAR; -cmd_function_s addbot_f_VAR; -cmd_function_s ddldump_f_VAR; -cmd_function_s weapondefdump_f_VAR; -cmd_function_s view_vehicle_ents_f_VAR; -cmd_function_s loadout_save_f_VAR; -cmd_function_s FastRestart_f_VAR; - -CmdArgs* cmd_args; - +#include "functions.hpp" + +void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler) { + utils::nt::library ntdll("ntdll.dll"); + ntdll.invoke("RtlAddVectoredExceptionHandler", First, Handler); + return nullptr; +} + +NTSTATUS NtContinue(PCONTEXT threadContext, BOOLEAN raiseAlert) { + utils::nt::library ntdll("ntdll.dll"); + return ntdll.invoke("NtContinue", threadContext, raiseAlert); +} + +#pragma region //game functions + +const char* (*va)(const char* fmt, ...); + +void Live_FakeUserSignIn(int controllerIndex, const char* gamertag) { + auto func = reinterpret_cast(0x1413FDA40_g); + func(controllerIndex, gamertag); +} + +void R_AddCmdDrawText(const char* text, int maxChars, void /* GfxFont */* font, int fontHeight, float x, float y, float xScale, float yScale, float rotation, const float* color, const void /* FontGlowStyle */* glowStyle, bool usePost) { + auto func = reinterpret_cast(0x00000001419653E0_g); + func(text, maxChars, font, fontHeight, x, y, xScale, yScale, rotation, color, glowStyle, usePost); +} + +bool CG_WorldPosToScreenPosReal(int localClientNum, const uintptr_t scrPlace, const float* worldPos, float* outScreenPos) { + auto func = reinterpret_cast(0x141696AA0_g); + return func(localClientNum, scrPlace, worldPos, outScreenPos); +} + +void CG_DrawRotatedPicPhysical(uintptr_t scrPlace, float x, float y, float width, float height, float angle, const float* color, uintptr_t material) { + auto func = reinterpret_cast(0x141695B20_g); + func(scrPlace, x, y, width, height, angle, color, material); +} + +uintptr_t FS_ReadFile(const char* qpath, const char** buffer) { + auto func = reinterpret_cast(0x1413DA530_g); + return func(qpath, buffer); +} + +const char* Dvar_GetStringSafe(const char* dvar) { + auto func = reinterpret_cast(0x1413E69B0_g); + return func(dvar); +} + +bool Dvar_GetBoolSafe(const char* dvar) +{ + auto func = reinterpret_cast(0x1413E6820_g); + return func(dvar); +} + +int Dvar_GetIntSafe(const char* dvar) +{ + auto func = reinterpret_cast(0x1413E6960_g); + return func(dvar); +} + +unsigned int* GetRandSeed() { + auto func = reinterpret_cast(0x1413DD630_g); + return func(); +} + +unsigned __int64 Sys_Microseconds() { + auto func = reinterpret_cast(0x14148FC10_g); + return func(); +} + +int I_irand(int min, int max) { + auto func = reinterpret_cast(0x1413DD8B0_g); + return func(min, max); +} + +unsigned __int64 I_atoui64_hex(const char* str) { + auto func = reinterpret_cast(0x1413F3310_g); + return func(str); +} + +unsigned __int64 I_atoui64(const char* str) { + auto func = reinterpret_cast(0x1413F3300_g); + return func(str); +} + +uintptr_t Dvar_FindVarByName(const char* dvarName) { + auto func = reinterpret_cast(0x1413E63A0_g); + return func(dvarName); +} + +void CL_DrawText(const uintptr_t scrPlace, const char* text, int maxChars, uintptr_t font, float x, float y, int horzAlign, int vertAlign, float xScale, float yScale, const float* color, int style) { + auto func = reinterpret_cast(0x1415AAAA0_g); + func(scrPlace, text, maxChars, font, x, y, horzAlign, vertAlign, xScale, yScale, color, style); +} + +dvar_t* Dvar_RegisterString(const char* dvarName, const char* value, unsigned int flags, const char* description) { + auto func = reinterpret_cast(0x1413E7A70_g); + return func(dvarName, value, flags, description); +} + +dvar_t* Dvar_RegisterBool(const char* dvarName, bool value, unsigned int flags, const char* description) { + auto func = reinterpret_cast(0x1413E7670_g); + return func(dvarName, value, flags, description); +} + +void LUI_CoD_LuaCall_ExecNow(uintptr_t luaVM, const char* str) { + lua_getfield(luaVM, -10002, "Engine"); + lua_getfield(luaVM, -1, "DAGFFDGFII"); + lua_remove(luaVM, -2); + lua_pushstring(luaVM, str); + LuaShared_PCall(luaVM, 1, 1); +} + +bool LUI_LuaCall_Game_IsEntityAlive(uintptr_t luaVM, int entityNum) { + lua_getfield(luaVM, -10002, "Game"); + lua_getfield(luaVM, -1, "JDAIJCDEB"); + lua_remove(luaVM, -2); + lua_pushinteger(luaVM, 0); + lua_pushinteger(luaVM, entityNum); + LuaShared_PCall(luaVM, 2, 1); + return lua_toboolean(luaVM, 0); +} + +void Cbuf_AddText(const char* cmd) { + uintptr_t luaVM = *reinterpret_cast(0x151868880_g); + if (luaVM) { + LUI_CoD_LuaCall_ExecNow(luaVM, cmd); + } +} + +bool lua_toboolean(uintptr_t L, int idx) { + auto func = reinterpret_cast(0x1420848D0_g); + return func(L, idx); +} + +void lua_pushboolean(uintptr_t L, int b) { + auto func = reinterpret_cast(0x142083E80_g); + func(L, b); +} + +void lua_remove(uintptr_t L, int idx) { + auto func = reinterpret_cast(0x142084420_g); + func(L, idx); +} + +void lua_call(uintptr_t L, int nargs, int nresults) { + auto func = reinterpret_cast(0x1420831D0_g); + func(L, nargs, nresults); +} + +void lua_getfield(uintptr_t L, int idx, const char* k) { + auto func = reinterpret_cast(0x1420836E0_g); + func(L, idx, k); +} + +void lua_pushvalue(uintptr_t L, int idx) { + auto func = reinterpret_cast(0x142084200_g); + func(L, idx); +} + +void lua_pushstring(uintptr_t L, const char* str) { + auto func = reinterpret_cast(0x142084120_g); + func(L, str); +} + +void lua_pushinteger(uintptr_t L, int n) { + auto func = reinterpret_cast(0x142083FE0_g); + func(L, n); +} + +void lua_settop(uintptr_t L, int idx) { + auto func = reinterpret_cast(0x142084790_g); + func(L, idx); +} + +int LuaShared_PCall(uintptr_t luaVM, int nargs, int nresults) { + auto func = reinterpret_cast(0x1419B7570_g); + return func(luaVM, nargs, nresults); +} + +bool CG_DObjGetWorldBoneMatrix(uintptr_t pose, uintptr_t obj, int boneIndex, uintptr_t outTagMat, float* outOrigin) { + auto func = reinterpret_cast(0x1416A59D0_g); + return func(pose, obj, boneIndex, outTagMat, outOrigin); +} + +void CG_DrawLine(float X1, float Y1, float X2, float Y2, const float* color, float Width) { + float X, Y, Angle, L1, L2, H1; + H1 = Y2 - Y1; + L1 = X2 - X1; + L2 = sqrtf(L1 * L1 + H1 * H1); + X = X1 + ((L1 - L2) / 2); + Y = Y1 + (H1 / 2); + Angle = atan(H1 / L1) * (180 / 3.14159265358979323846); + CG_DrawRotatedPicPhysical(0x14EF2DEA0_g, X, Y, L2, Width, Angle, color, *reinterpret_cast(0x152C465A0_g)); +} + +void CG_DrawBone(int entIndex, uintptr_t ent, int from, int to, const float* color) { + float bone1[3], bone2[3]; + float fromPos[2], toPos[2]; + char tmat33[0x24]; + short* clientObjMap = (short*)(0x14D45EC60_g); + uintptr_t s_objBuf = *reinterpret_cast(0x14D45EC50_g); + uintptr_t dobj = s_objBuf + (0x150 * clientObjMap[entIndex]); + if (CG_DObjGetWorldBoneMatrix(ent, dobj, from, (uintptr_t)&tmat33, bone1) && CG_DObjGetWorldBoneMatrix(ent, dobj, to, (uintptr_t)&tmat33, bone2)) { + if (CG_WorldPosToScreenPosReal(0, 0x14EF2DEA0_g, bone1, fromPos) && CG_WorldPosToScreenPosReal(0, 0x14EF2DEA0_g, bone2, toPos)) { + CG_DrawLine(fromPos[0], fromPos[1], toPos[0], toPos[1], color, 1); + } + } +} + +void CG_DrawBones(int entIndex, uintptr_t ent, const float* color) { + //spine + CG_DrawBone(entIndex, ent, 41, 35, color); + CG_DrawBone(entIndex, ent, 35, 7, color); + CG_DrawBone(entIndex, ent, 7, 6, color); + CG_DrawBone(entIndex, ent, 6, 30, color); + CG_DrawBone(entIndex, ent, 30, 55, color); + CG_DrawBone(entIndex, ent, 55, 54, color); + CG_DrawBone(entIndex, ent, 54, 53, color); + CG_DrawBone(entIndex, ent, 53, 2, color); + + //hips + CG_DrawBone(entIndex, ent, 2, 63, color); + CG_DrawBone(entIndex, ent, 2, 64, color); +} + +bool CheatsOk(int entNum) { + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * entNum)); + uintptr_t client = g_entities[entNum].get(0x150); + if (sv_cheats->current.enabled) { + return true; + } + else { + ms_clients->SendServerCommand(1, "f \"Cheats are not enabled on this server!\""); + return false; + } +} + +//ingame removed functions +void Cmd_Noclip_f(int entNum) +{ + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * entNum)); + uintptr_t client = g_entities[entNum].get(0x150); + if (client) { + int v6 = *reinterpret_cast(client + 0x5DD0); + if ((*reinterpret_cast(client + 0x5DD0) & 1) != 0) { + v6 = *reinterpret_cast(client + 0x5DD0) & 0xFFFFFFFE; + ms_clients->SendServerCommand(1, "f \"Noclip: ^1OFF\""); + } + else { + v6 = *reinterpret_cast(client + 0x5DD0) | 1; + ms_clients->SendServerCommand(1, "f \"Noclip: ^2ON\""); + } + *reinterpret_cast(client + 0x5DD0) = v6; + } +} + +void Cmd_God_f(int entNum) +{ + SvClient* ms_clients = *reinterpret_cast(0x14E17F690_g + (8 * entNum)); + gentity_s ent = g_entities[entNum]; +} + +void SV_Cmd_ArgvBuffer(int arg, char* buffer, unsigned __int64 bufferLength) { + auto func = reinterpret_cast(0x141298B40_g); + func(arg, buffer, bufferLength); +} + +void Cmd_ArgvBuffer(int arg, char* buffer, int bufferLength) { + if (arg >= cmd_args->argc[cmd_args->nesting]) + strcpy_s(buffer, bufferLength, ""); + else + strcpy_s(buffer, bufferLength, cmd_args->argv[cmd_args->nesting][arg]); +} + +int Cmd_Argc() { + return cmd_args->argc[cmd_args->nesting]; +} + +int SV_Cmd_Argc() { + auto func = reinterpret_cast(0x141298AF0_g); + return func(); +} + +void Cmd_AddCommandInternal(const char* cmdName, void(__fastcall* function)(), cmd_function_s* allocedCmd) { + auto func = reinterpret_cast(0x1412965F0_g); + func(cmdName, function, allocedCmd); +} + +ClActiveClient* GetClActiveClient() { + ms_activeClients = *reinterpret_cast(0x14EE854F8_g); + return ms_activeClients; +} + +int ClActiveClient_GetCmdNumber(ClActiveClient* activeClient) { + return activeClient->cmdNumber ^ ((activeClient->get(0x8700) ^ (activeClient->cmdNumber) * ((activeClient->get(0x8700) ^ activeClient->cmdNumber) + 2))); +} + +usercmd_s* CL_GetUserCmd(int cmdNumber) { + ms_activeClients = *reinterpret_cast(0x14EE854F8_g); + return &ms_activeClients->cmds[cmdNumber & 0x7F]; +} + +void AddReliableCommand(uintptr_t _this, const char* commandBuffer, const int reliableCmdSize, int type) { + auto func = reinterpret_cast(0x1415E0440_g); + func(_this, commandBuffer, reliableCmdSize, type); +} + +unsigned int MSG_WriteReliableCommandToBuffer(const char* pszCommand, char* pszBuffer, unsigned int iBufferSize) { + auto func = reinterpret_cast(0x1412DDBF0_g); + return func(pszCommand, pszBuffer, iBufferSize); +} + +void CL_Main_AddReliableCommand(const char* cmd) { + uintptr_t ms_connections = *reinterpret_cast(0x14EE85570_g); + char buf[1024]; + int cmdSize = MSG_WriteReliableCommandToBuffer(cmd, buf, 1024); + AddReliableCommand(ms_connections, buf, cmdSize, 0); +} + +bool BG_Weapons_GetFullWeaponForName(const char* name, Weapon* outWeapon, Weapon* (*getWeaponFunc)(Weapon* result, const char*)) { + auto func = reinterpret_cast(0x141158130_g); + return func(name, outWeapon, getWeaponFunc); +} + +void Scr_AddString(scrContext_t* scrContext, const char* value) { + auto func = reinterpret_cast(0x141322D90_g); + func(scrContext, value); +} + +unsigned int GScr_ExecEntThread(gentity_s* ent, int handle, unsigned int paramcount) { + auto func = reinterpret_cast(0x141257D70_g); + return func(ent, handle, paramcount); +} + +void Scr_FreeThread(scrContext_t* scrContext, unsigned int handle) { + auto func = reinterpret_cast(0x1413242E0_g); + func(scrContext, handle); +} + +int G_Weapon_GivePlayerWeapon(uintptr_t ps, uintptr_t scrContext, Weapon* weapon, int dualWield, int startInAltMode, int usedBefore) { + auto func = reinterpret_cast(0x14127C8B0_g); + return func(ps, scrContext, weapon, dualWield, startInAltMode, usedBefore); +} + +void G_Items_AddAmmo(uintptr_t ps, Weapon* weapon, bool isAlternate, int count, int fillClip) { + auto func = reinterpret_cast(0x141216860_g); + func(ps, weapon, isAlternate, count, fillClip); +} + +void G_Weapon_SelectWeapon(int clientNum, Weapon* weapon) { + auto func = reinterpret_cast(0x14127F840_g); +} + +Weapon* BG_FindBaseWeaponForName(Weapon* result, const char* name) { + auto func = reinterpret_cast(0x1411570F0_g); + return func(result, name); +} + +scrContext_t* ScriptContext_Server() { + auto func = reinterpret_cast(0x1412E0E70_g); + return func(); +} + +const char* SL_ConvertToString(int id) { + auto func = reinterpret_cast(0x14131AA20_g); + return func(id); +} + +XAssetHeader DB_FindXAssetHeader(XAssetType type, const char* givenName, int allowCreateDefault) { + auto func = reinterpret_cast(0x1411AA890_g); + return func(type, givenName, allowCreateDefault); +} + +void Com_SetErrorMessage(const char* errorMessage) { + auto func = reinterpret_cast(0x1412B3710_g); + return func(errorMessage); +} + +#pragma endregion + +dvar_t* player_name; +dvar_t* sv_cheats; +dvar_t* spawn_br_gas; +dvar_t* show_watermark; +dvar_t* player_sustainammo; + +cmd_function_s set_byte_f_VAR; +cmd_function_s set_short_f_VAR; +cmd_function_s set_int_f_VAR; +cmd_function_s set_float_f_VAR; +cmd_function_s set_pointer_f_VAR; +cmd_function_s quit_f_VAR; +cmd_function_s openmenu_f_VAR; +cmd_function_s addbot_f_VAR; +cmd_function_s ddldump_f_VAR; +cmd_function_s weapondefdump_f_VAR; +cmd_function_s view_vehicle_ents_f_VAR; +cmd_function_s loadout_save_f_VAR; +cmd_function_s FastRestart_f_VAR; +cmd_function_s MapRestart_f_VAR; +cmd_function_s omnvar_set_f_VAR; +cmd_function_s omnvar_dump_f_VAR; + +CmdArgs* cmd_args; + Addresses g_Addrs; \ No newline at end of file diff --git a/hook_lib/functions.hpp b/hook_lib/functions.hpp index 9eca864..9d646c7 100644 --- a/hook_lib/functions.hpp +++ b/hook_lib/functions.hpp @@ -1,224 +1,234 @@ -#pragma once -#include "Main.hpp" - -struct gentity_s; - -struct CmdArgs; - -struct Addresses { - uintptr_t ModuleBase; - uintptr_t jmp_rbx; -}; - -union DvarValue -{ - bool enabled; - int integer; - unsigned int unsignedInt; - __int64 integer64; - unsigned __int64 unsignedInt64; - float value; - float vector[4]; - const char* string; - unsigned __int8 color[4]; -}; - -struct BbConstUsageFlags -{ - bool initialized; - DvarValue codeValue; -}; - -struct netadr_t; - -struct dvar_t -{ - const char* name; - unsigned int checksum; - const char* description; - unsigned int flags; - char level[1]; - unsigned __int8 type; - bool modified; - unsigned __int16 hashNext; - DvarValue current; - DvarValue latched; - DvarValue reset; - char domain[0x10]; - BbConstUsageFlags BbConstUsageFlags; -}; - -struct EncryptionHeader -{ - unsigned int isEncrypted; - unsigned __int8 IV[16]; -}; - -struct __declspec(align(8)) XFile -{ - unsigned __int64 size; - unsigned __int64 preloadWalkSize; - unsigned __int64 blockSize[11]; - EncryptionHeader encryption; -}; - -struct DB_FFHeader -{ - unsigned __int64 magic; - unsigned int headerVersion; - unsigned int xfileVersion; - bool dashCompressBuild; - bool dashEncryptBuild; - unsigned __int8 transientFileType[1]; - unsigned int residentPartSize; - unsigned int residentHash; - unsigned int alwaysLoadedPartSize; - XFile xfileHeader; -}; - -struct EncryptionInfo -{ - EncryptionHeader header; - unsigned __int8 privateKey[32]; -}; - -struct DBFileHandle -{ - unsigned __int8 fileID[4]; - unsigned __int64 dcacheFileID; -}; - -struct cmd_function_s -{ - cmd_function_s* next; - const char* name; - const char** autoCompleteList; - unsigned int autoCompleteListCount; - void(__fastcall* function)(); -}; - -struct DBFile -{ - char name[64]; - DBFileHandle dbFileHandle; - bool isSecured; - EncryptionInfo encryption; -}; - -struct Weapon; -struct scrContext_t; - -extern dvar_t* player_name; -extern dvar_t* sv_cheats; -extern dvar_t* spawn_br_gas; -extern dvar_t* show_watermark; -extern dvar_t* player_sustainammo; - -extern cmd_function_s set_byte_f_VAR; -extern cmd_function_s set_short_f_VAR; -extern cmd_function_s set_int_f_VAR; -extern cmd_function_s set_pointer_f_VAR; -extern cmd_function_s quit_f_VAR; -extern cmd_function_s openmenu_f_VAR; -extern cmd_function_s addbot_f_VAR; -extern cmd_function_s ddldump_f_VAR; -extern cmd_function_s weapondefdump_f_VAR; -extern cmd_function_s view_vehicle_ents_f_VAR; -extern cmd_function_s loadout_save_f_VAR; -extern cmd_function_s FastRestart_f_VAR; -extern CmdArgs* cmd_args; - -void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler); -NTSTATUS NtContinue(PCONTEXT threadContext, BOOLEAN raiseAlert); - -#pragma region //game functions - -extern const char* (*va)(const char* fmt, ...); - -void Live_FakeUserSignIn(int controllerIndex, const char* gamertag); - -void R_AddCmdDrawText(const char* text, int maxChars, void /* GfxFont */* font, int fontHeight, float x, float y, float xScale, float yScale, float rotation, const float* color, const void /* FontGlowStyle */* glowStyle, bool usePost); - -bool CG_WorldPosToScreenPosReal(int localClientNum, const uintptr_t scrPlace, const float* worldPos, float* outScreenPos); - -void CG_DrawRotatedPicPhysical(uintptr_t scrPlace, float x, float y, float width, float height, float angle, const float* color, uintptr_t material); - -inline bool file_exists(const char* name) { - struct stat buffer; - return (stat(name, &buffer) == 0); -} - -uintptr_t FS_ReadFile(const char* qpath, const char** buffer); -const char* Dvar_GetStringSafe(const char* dvar); - -unsigned int* GetRandSeed(); -unsigned __int64 Sys_Microseconds(); -int I_irand(int min, int max); -unsigned __int64 I_atoui64_hex(const char* str); -unsigned __int64 I_atoui64(const char* str); -uintptr_t Dvar_FindVarByName(const char* dvarName); - -void CL_DrawText(const uintptr_t scrPlace, const char* text, int maxChars, uintptr_t font, float x, float y, int horzAlign, int vertAlign, float xScale, float yScale, const float* color, int style); -dvar_t* Dvar_RegisterString(const char* dvarName, const char* value, unsigned int flags, const char* description); -dvar_t* Dvar_RegisterBool(const char* dvarName, bool value, unsigned int flags, const char* description); - -void LUI_CoD_LuaCall_ExecNow(uintptr_t luaVM, const char* str); -bool LUI_LuaCall_Game_IsEntityAlive(uintptr_t luaVM, int entityNum); - -void Cbuf_AddText(const char* cmd); - -bool lua_toboolean(uintptr_t L, int idx); - -void lua_pushboolean(uintptr_t L, int b); -void lua_remove(uintptr_t L, int idx); -void lua_call(uintptr_t L, int nargs, int nresults); -void lua_getfield(uintptr_t L, int idx, const char* k); -void lua_pushvalue(uintptr_t L, int idx); -void lua_pushstring(uintptr_t L, const char* str); -void lua_pushinteger(uintptr_t L, int n); -void lua_settop(uintptr_t L, int idx); -int LuaShared_PCall(uintptr_t luaVM, int nargs, int nresults); - -bool CG_DObjGetWorldBoneMatrix(uintptr_t pose, uintptr_t obj, int boneIndex, uintptr_t outTagMat, float* outOrigin); - -void CG_DrawLine(float X1, float Y1, float X2, float Y2, const float* color, float Width); -void CG_DrawBone(int entIndex, uintptr_t ent, int from, int to, const float* color); -void CG_DrawBones(int entIndex, uintptr_t ent, const float* color); - -bool CheatsOk(int entNum); - -void Cmd_Noclip_f(int entNum); - -void SV_Cmd_ArgvBuffer(int arg, char* buffer, unsigned __int64 bufferLength); -void Cmd_ArgvBuffer(int arg, char* buffer, int bufferLength); -int Cmd_Argc(); -int SV_Cmd_Argc(); - -void Cmd_AddCommandInternal(const char* cmdName, void(__fastcall* function)(), cmd_function_s* allocedCmd); - -void AddReliableCommand(uintptr_t _this, const char* commandBuffer, const int reliableCmdSize, int type); -unsigned int MSG_WriteReliableCommandToBuffer(const char* pszCommand, char* pszBuffer, unsigned int iBufferSize); - -void CL_Main_AddReliableCommand(const char* cmd); - -bool BG_Weapons_GetFullWeaponForName(const char* name, Weapon* outWeapon, Weapon* (__fastcall* getWeaponFunc)(Weapon* result, const char*)); - -void Scr_AddString(scrContext_t* scrContext, const char* value); -unsigned int GScr_ExecEntThread(gentity_s* ent, int handle, unsigned int paramcount); -void Scr_FreeThread(scrContext_t* scrContext, unsigned int handle); - -int G_Weapon_GivePlayerWeapon(uintptr_t ps, uintptr_t scrContext, Weapon* weapon, int dualWield, int startInAltMode, int usedBefore); -void G_Items_AddAmmo(uintptr_t ps, Weapon* weapon, bool isAlternate, int count, int fillClip); - -void G_Weapon_SelectWeapon(int clientNum, Weapon* weapon); -Weapon* BG_FindBaseWeaponForName(Weapon* result, const char* name); - -scrContext_t* ScriptContext_Server(); - -const char* SL_ConvertToString(int id); - -union XAssetHeader DB_FindXAssetHeader(enum XAssetType type, const char* givenName, int allowCreateDefault); - -#pragma endregion - +#pragma once +#include "Main.hpp" + +struct gentity_s; + +struct CmdArgs; + +struct Addresses { + uintptr_t ModuleBase; + uintptr_t jmp_rbx; +}; + +union DvarValue +{ + bool enabled; + int integer; + unsigned int unsignedInt; + __int64 integer64; + unsigned __int64 unsignedInt64; + float value; + float vector[4]; + const char* string; + unsigned __int8 color[4]; +}; + +struct BbConstUsageFlags +{ + bool initialized; + DvarValue codeValue; +}; + +struct netadr_t; + +struct dvar_t +{ + const char* name; + unsigned int checksum; + const char* description; + unsigned int flags; + char level[1]; + unsigned __int8 type; + bool modified; + unsigned __int16 hashNext; + DvarValue current; + DvarValue latched; + DvarValue reset; + char domain[0x10]; + BbConstUsageFlags BbConstUsageFlags; +}; + +struct EncryptionHeader +{ + unsigned int isEncrypted; + unsigned __int8 IV[16]; +}; + +struct __declspec(align(8)) XFile +{ + unsigned __int64 size; + unsigned __int64 preloadWalkSize; + unsigned __int64 blockSize[11]; + EncryptionHeader encryption; +}; + +struct DB_FFHeader +{ + unsigned __int64 magic; + unsigned int headerVersion; + unsigned int xfileVersion; + bool dashCompressBuild; + bool dashEncryptBuild; + unsigned __int8 transientFileType[1]; + unsigned int residentPartSize; + unsigned int residentHash; + unsigned int alwaysLoadedPartSize; + XFile xfileHeader; +}; + +struct EncryptionInfo +{ + EncryptionHeader header; + unsigned __int8 privateKey[32]; +}; + +struct DBFileHandle +{ + unsigned __int8 fileID[4]; + unsigned __int64 dcacheFileID; +}; + +struct cmd_function_s +{ + cmd_function_s* next; + const char* name; + const char** autoCompleteList; + unsigned int autoCompleteListCount; + void(__fastcall* function)(); +}; + +struct DBFile +{ + char name[64]; + DBFileHandle dbFileHandle; + bool isSecured; + EncryptionInfo encryption; +}; + +struct Weapon; +struct scrContext_t; + +extern dvar_t* player_name; +extern dvar_t* sv_cheats; +extern dvar_t* spawn_br_gas; +extern dvar_t* show_watermark; +extern dvar_t* player_sustainammo; + +extern cmd_function_s set_byte_f_VAR; +extern cmd_function_s set_short_f_VAR; +extern cmd_function_s set_int_f_VAR; +extern cmd_function_s set_float_f_VAR; +extern cmd_function_s set_pointer_f_VAR; +extern cmd_function_s quit_f_VAR; +extern cmd_function_s openmenu_f_VAR; +extern cmd_function_s addbot_f_VAR; +extern cmd_function_s ddldump_f_VAR; +extern cmd_function_s weapondefdump_f_VAR; +extern cmd_function_s view_vehicle_ents_f_VAR; +extern cmd_function_s loadout_save_f_VAR; +extern cmd_function_s FastRestart_f_VAR; +extern cmd_function_s MapRestart_f_VAR; +extern cmd_function_s omnvar_set_f_VAR; +extern cmd_function_s omnvar_dump_f_VAR; +extern CmdArgs* cmd_args; + +void* RtlAddVectoredExceptionHandler(LONG First, PVECTORED_EXCEPTION_HANDLER Handler); +NTSTATUS NtContinue(PCONTEXT threadContext, BOOLEAN raiseAlert); + +#pragma region //game functions + +extern const char* (*va)(const char* fmt, ...); + +void Live_FakeUserSignIn(int controllerIndex, const char* gamertag); + +void R_AddCmdDrawText(const char* text, int maxChars, void /* GfxFont */* font, int fontHeight, float x, float y, float xScale, float yScale, float rotation, const float* color, const void /* FontGlowStyle */* glowStyle, bool usePost); + +bool CG_WorldPosToScreenPosReal(int localClientNum, const uintptr_t scrPlace, const float* worldPos, float* outScreenPos); + +void CG_DrawRotatedPicPhysical(uintptr_t scrPlace, float x, float y, float width, float height, float angle, const float* color, uintptr_t material); + +inline bool file_exists(const char* name) { + struct stat buffer; + return (stat(name, &buffer) == 0); +} + +uintptr_t FS_ReadFile(const char* qpath, const char** buffer); +const char* Dvar_GetStringSafe(const char* dvar); +bool Dvar_GetBoolSafe(const char* dvar); +int Dvar_GetIntSafe(const char* dvar); + +unsigned int* GetRandSeed(); +unsigned __int64 Sys_Microseconds(); +int I_irand(int min, int max); +unsigned __int64 I_atoui64_hex(const char* str); +unsigned __int64 I_atoui64(const char* str); +uintptr_t Dvar_FindVarByName(const char* dvarName); + +void CL_DrawText(const uintptr_t scrPlace, const char* text, int maxChars, uintptr_t font, float x, float y, int horzAlign, int vertAlign, float xScale, float yScale, const float* color, int style); +dvar_t* Dvar_RegisterString(const char* dvarName, const char* value, unsigned int flags, const char* description); +dvar_t* Dvar_RegisterBool(const char* dvarName, bool value, unsigned int flags, const char* description); + +void LUI_CoD_LuaCall_ExecNow(uintptr_t luaVM, const char* str); +bool LUI_LuaCall_Game_IsEntityAlive(uintptr_t luaVM, int entityNum); + +void Cbuf_AddText(const char* cmd); + +bool lua_toboolean(uintptr_t L, int idx); + +void lua_pushboolean(uintptr_t L, int b); +void lua_remove(uintptr_t L, int idx); +void lua_call(uintptr_t L, int nargs, int nresults); +void lua_getfield(uintptr_t L, int idx, const char* k); +void lua_pushvalue(uintptr_t L, int idx); +void lua_pushstring(uintptr_t L, const char* str); +void lua_pushinteger(uintptr_t L, int n); +void lua_settop(uintptr_t L, int idx); +int LuaShared_PCall(uintptr_t luaVM, int nargs, int nresults); + +bool CG_DObjGetWorldBoneMatrix(uintptr_t pose, uintptr_t obj, int boneIndex, uintptr_t outTagMat, float* outOrigin); + +void CG_DrawLine(float X1, float Y1, float X2, float Y2, const float* color, float Width); +void CG_DrawBone(int entIndex, uintptr_t ent, int from, int to, const float* color); +void CG_DrawBones(int entIndex, uintptr_t ent, const float* color); + +bool CheatsOk(int entNum); + +void Cmd_Noclip_f(int entNum); + +void Cmd_God_f(int entNum); + +void SV_Cmd_ArgvBuffer(int arg, char* buffer, unsigned __int64 bufferLength); +void Cmd_ArgvBuffer(int arg, char* buffer, int bufferLength); +int Cmd_Argc(); +int SV_Cmd_Argc(); + +void Cmd_AddCommandInternal(const char* cmdName, void(__fastcall* function)(), cmd_function_s* allocedCmd); + +void AddReliableCommand(uintptr_t _this, const char* commandBuffer, const int reliableCmdSize, int type); +unsigned int MSG_WriteReliableCommandToBuffer(const char* pszCommand, char* pszBuffer, unsigned int iBufferSize); + +void CL_Main_AddReliableCommand(const char* cmd); + +bool BG_Weapons_GetFullWeaponForName(const char* name, Weapon* outWeapon, Weapon* (__fastcall* getWeaponFunc)(Weapon* result, const char*)); + +void Scr_AddString(scrContext_t* scrContext, const char* value); +unsigned int GScr_ExecEntThread(gentity_s* ent, int handle, unsigned int paramcount); +void Scr_FreeThread(scrContext_t* scrContext, unsigned int handle); + +int G_Weapon_GivePlayerWeapon(uintptr_t ps, uintptr_t scrContext, Weapon* weapon, int dualWield, int startInAltMode, int usedBefore); +void G_Items_AddAmmo(uintptr_t ps, Weapon* weapon, bool isAlternate, int count, int fillClip); + +void G_Weapon_SelectWeapon(int clientNum, Weapon* weapon); +Weapon* BG_FindBaseWeaponForName(Weapon* result, const char* name); + +scrContext_t* ScriptContext_Server(); + +const char* SL_ConvertToString(int id); + +union XAssetHeader DB_FindXAssetHeader(enum XAssetType type, const char* givenName, int allowCreateDefault); + +void Com_SetErrorMessage(const char* errorMessage); + +#pragma endregion + extern Addresses g_Addrs; \ No newline at end of file diff --git a/hook_lib/hook_lib.vcxproj b/hook_lib/hook_lib.vcxproj index 7d7f092..6ac3836 100644 --- a/hook_lib/hook_lib.vcxproj +++ b/hook_lib/hook_lib.vcxproj @@ -48,7 +48,7 @@ DynamicLibrary false - v143 + v142 true MultiByte false @@ -81,10 +81,12 @@ true discord_game_sdk + D:\Dokumente\CoDMW19\codUPLOADER\mw19-of-main\lib;$(LibraryPath) false discord_game_sdk + D:\Dokumente\CoDMW19\codUPLOADER\mw19-of-main\lib;$(LibraryPath) @@ -136,13 +138,13 @@ true NOMINMAX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpplatest + stdcpp20 Console true true - true + false minhook.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) @@ -181,7 +183,6 @@ - diff --git a/hook_lib/hook_lib.vcxproj.filters b/hook_lib/hook_lib.vcxproj.filters index 5b68d98..81664c9 100644 --- a/hook_lib/hook_lib.vcxproj.filters +++ b/hook_lib/hook_lib.vcxproj.filters @@ -1,143 +1,142 @@ - - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {9ba1aab7-3c29-4043-88a2-0733bdba52af} - - - {67571f10-529c-4ebd-94b6-2cebbbb62a35} - - - {03fd645c-a59f-4d26-950c-b411df71f725} - - - {997a4fac-6cde-43a6-84df-2e0e58b4b7fc} - - - {0999b80b-b47c-4d8e-8776-f5c778bcac9f} - - - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\exception - - - hook_lib - - - hook_lib\game - - - common\utils - - - hook_lib\game - - - hook_lib\game - - - hook_lib\game - - - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\utils - - - common\exception - - - hook_lib - - - common\utils - - - hook_lib\game - - - common\utils - - - hook_lib\game - - - hook_lib\game - - - hook_lib\game - - - hook_lib\game - - - + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {9ba1aab7-3c29-4043-88a2-0733bdba52af} + + + {67571f10-529c-4ebd-94b6-2cebbbb62a35} + + + {03fd645c-a59f-4d26-950c-b411df71f725} + + + {997a4fac-6cde-43a6-84df-2e0e58b4b7fc} + + + {0999b80b-b47c-4d8e-8776-f5c778bcac9f} + + + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\exception + + + hook_lib + + + hook_lib\game + + + common\utils + + + hook_lib\game + + + hook_lib\game + + + hook_lib\game + + + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\utils + + + common\exception + + + hook_lib + + + common\utils + + + hook_lib\game + + + common\utils + + + hook_lib\game + + + hook_lib\game + + + hook_lib\game + + + hook_lib\game + + \ No newline at end of file diff --git a/hook_lib/hook_lib.vcxproj.user b/hook_lib/hook_lib.vcxproj.user index bf444be..0f14913 100644 --- a/hook_lib/hook_lib.vcxproj.user +++ b/hook_lib/hook_lib.vcxproj.user @@ -1,15 +1,4 @@  - - true - - - D:\Games\CODMWDebug\Call of Duty Modern Warfare %282019%29\game_dx12_ship_replay.exe - WindowsLocalDebugger - - - D:\Games\CODMWDebug\Call of Duty Modern Warfare %282019%29\game_dx12_ship_replay.exe - WindowsLocalDebugger - ..\..\..\..\Games\CODMWDebug\Call of Duty Modern Warfare %282019%29 - + \ No newline at end of file diff --git a/hook_lib/ini.h b/hook_lib/ini.h index bf759f7..cb0b801 100644 --- a/hook_lib/ini.h +++ b/hook_lib/ini.h @@ -1,789 +1,789 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Danijel Durakovic - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - - /////////////////////////////////////////////////////////////////////////////// - // - // /mINI/ v0.9.14 - // An INI file reader and writer for the modern age. - // - /////////////////////////////////////////////////////////////////////////////// - // - // A tiny utility library for manipulating INI files with a straightforward - // API and a minimal footprint. It conforms to the (somewhat) standard INI - // format - sections and keys are case insensitive and all leading and - // trailing whitespace is ignored. Comments are lines that begin with a - // semicolon. Trailing comments are allowed on section lines. - // - // Files are read on demand, upon which data is kept in memory and the file - // is closed. This utility supports lazy writing, which only writes changes - // and updates to a file and preserves custom formatting and comments. A lazy - // write invoked by a write() call will read the output file, find what - // changes have been made and update the file accordingly. If you only need to - // generate files, use generate() instead. Section and key order is preserved - // on read, write and insert. - // - /////////////////////////////////////////////////////////////////////////////// - // - // /* BASIC USAGE EXAMPLE: */ - // - // /* read from file */ - // mINI::INIFile file("myfile.ini"); - // mINI::INIStructure ini; - // file.read(ini); - // - // /* read value; gets a reference to actual value in the structure. - // if key or section don't exist, a new empty value will be created */ - // std::string& value = ini["section"]["key"]; - // - // /* read value safely; gets a copy of value in the structure. - // does not alter the structure */ - // std::string value = ini.get("section").get("key"); - // - // /* set or update values */ - // ini["section"]["key"] = "value"; - // - // /* set multiple values */ - // ini["section2"].set({ - // {"key1", "value1"}, - // {"key2", "value2"} - // }); - // - // /* write updates back to file, preserving comments and formatting */ - // file.write(ini); - // - // /* or generate a file (overwrites the original) */ - // file.generate(ini); - // - /////////////////////////////////////////////////////////////////////////////// - // - // Long live the INI file!!! - // - /////////////////////////////////////////////////////////////////////////////// - -#ifndef MINI_INI_H_ -#define MINI_INI_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mINI -{ - namespace INIStringUtil - { - const char* const whitespaceDelimiters = " \t\n\r\f\v"; - inline void trim(std::string& str) - { - str.erase(str.find_last_not_of(whitespaceDelimiters) + 1); - str.erase(0, str.find_first_not_of(whitespaceDelimiters)); - } -#ifndef MINI_CASE_SENSITIVE - inline void toLower(std::string& str) - { - std::transform(str.begin(), str.end(), str.begin(), [](const char c) { - return static_cast(std::tolower(c)); - }); - } -#endif - inline void replace(std::string& str, std::string const& a, std::string const& b) - { - if (!a.empty()) - { - std::size_t pos = 0; - while ((pos = str.find(a, pos)) != std::string::npos) - { - str.replace(pos, a.size(), b); - pos += b.size(); - } - } - } -#ifdef _WIN32 - const char* const endl = "\r\n"; -#else - const char* const endl = "\n"; -#endif - } - - template - class INIMap - { - private: - using T_DataIndexMap = std::unordered_map; - using T_DataItem = std::pair; - using T_DataContainer = std::vector; - using T_MultiArgs = typename std::vector>; - - T_DataIndexMap dataIndexMap; - T_DataContainer data; - - inline std::size_t setEmpty(std::string& key) - { - std::size_t index = data.size(); - dataIndexMap[key] = index; - data.emplace_back(key, T()); - return index; - } - - public: - using const_iterator = typename T_DataContainer::const_iterator; - - INIMap() { } - - INIMap(INIMap const& other) - { - std::size_t data_size = other.data.size(); - for (std::size_t i = 0; i < data_size; ++i) - { - auto const& key = other.data[i].first; - auto const& obj = other.data[i].second; - data.emplace_back(key, obj); - } - dataIndexMap = T_DataIndexMap(other.dataIndexMap); - } - - T& operator[](std::string key) - { - INIStringUtil::trim(key); -#ifndef MINI_CASE_SENSITIVE - INIStringUtil::toLower(key); -#endif - auto it = dataIndexMap.find(key); - bool hasIt = (it != dataIndexMap.end()); - std::size_t index = (hasIt) ? it->second : setEmpty(key); - return data[index].second; - } - T get(std::string key) const - { - INIStringUtil::trim(key); -#ifndef MINI_CASE_SENSITIVE - INIStringUtil::toLower(key); -#endif - auto it = dataIndexMap.find(key); - if (it == dataIndexMap.end()) - { - return T(); - } - return T(data[it->second].second); - } - bool has(std::string key) const - { - INIStringUtil::trim(key); -#ifndef MINI_CASE_SENSITIVE - INIStringUtil::toLower(key); -#endif - return (dataIndexMap.count(key) == 1); - } - void set(std::string key, T obj) - { - INIStringUtil::trim(key); -#ifndef MINI_CASE_SENSITIVE - INIStringUtil::toLower(key); -#endif - auto it = dataIndexMap.find(key); - if (it != dataIndexMap.end()) - { - data[it->second].second = obj; - } - else - { - dataIndexMap[key] = data.size(); - data.emplace_back(key, obj); - } - } - void set(T_MultiArgs const& multiArgs) - { - for (auto const& it : multiArgs) - { - auto const& key = it.first; - auto const& obj = it.second; - set(key, obj); - } - } - bool remove(std::string key) - { - INIStringUtil::trim(key); -#ifndef MINI_CASE_SENSITIVE - INIStringUtil::toLower(key); -#endif - auto it = dataIndexMap.find(key); - if (it != dataIndexMap.end()) - { - std::size_t index = it->second; - data.erase(data.begin() + index); - dataIndexMap.erase(it); - for (auto& it2 : dataIndexMap) - { - auto& vi = it2.second; - if (vi > index) - { - vi--; - } - } - return true; - } - return false; - } - void clear() - { - data.clear(); - dataIndexMap.clear(); - } - std::size_t size() const - { - return data.size(); - } - const_iterator begin() const { return data.begin(); } - const_iterator end() const { return data.end(); } - }; - - using INIStructure = INIMap>; - - namespace INIParser - { - using T_ParseValues = std::pair; - - enum class PDataType : char - { - PDATA_NONE, - PDATA_COMMENT, - PDATA_SECTION, - PDATA_KEYVALUE, - PDATA_UNKNOWN - }; - - inline PDataType parseLine(std::string line, T_ParseValues& parseData) - { - parseData.first.clear(); - parseData.second.clear(); - INIStringUtil::trim(line); - if (line.empty()) - { - return PDataType::PDATA_NONE; - } - char firstCharacter = line[0]; - if (firstCharacter == ';') - { - return PDataType::PDATA_COMMENT; - } - if (firstCharacter == '[') - { - auto commentAt = line.find_first_of(';'); - if (commentAt != std::string::npos) - { - line = line.substr(0, commentAt); - } - auto closingBracketAt = line.find_last_of(']'); - if (closingBracketAt != std::string::npos) - { - auto section = line.substr(1, closingBracketAt - 1); - INIStringUtil::trim(section); - parseData.first = section; - return PDataType::PDATA_SECTION; - } - } - auto lineNorm = line; - INIStringUtil::replace(lineNorm, "\\=", " "); - auto equalsAt = lineNorm.find_first_of('='); - if (equalsAt != std::string::npos) - { - auto key = line.substr(0, equalsAt); - INIStringUtil::trim(key); - INIStringUtil::replace(key, "\\=", "="); - auto value = line.substr(equalsAt + 1); - INIStringUtil::trim(value); - parseData.first = key; - parseData.second = value; - return PDataType::PDATA_KEYVALUE; - } - return PDataType::PDATA_UNKNOWN; - } - } - - class INIReader - { - public: - using T_LineData = std::vector; - using T_LineDataPtr = std::shared_ptr; - - bool isBOM = false; - - private: - std::ifstream fileReadStream; - T_LineDataPtr lineData; - - T_LineData readFile() - { - fileReadStream.seekg(0, std::ios::end); - const std::size_t fileSize = static_cast(fileReadStream.tellg()); - fileReadStream.seekg(0, std::ios::beg); - if (fileSize >= 3) { - const char header[3] = { - static_cast(fileReadStream.get()), - static_cast(fileReadStream.get()), - static_cast(fileReadStream.get()) - }; - isBOM = ( - header[0] == static_cast(0xEF) && - header[1] == static_cast(0xBB) && - header[2] == static_cast(0xBF) - ); - } - else { - isBOM = false; - } - std::string fileContents; - fileContents.resize(fileSize); - fileReadStream.seekg(isBOM ? 3 : 0, std::ios::beg); - fileReadStream.read(&fileContents[0], fileSize); - fileReadStream.close(); - T_LineData output; - if (fileSize == 0) - { - return output; - } - std::string buffer; - buffer.reserve(50); - for (std::size_t i = 0; i < fileSize; ++i) - { - char& c = fileContents[i]; - if (c == '\n') - { - output.emplace_back(buffer); - buffer.clear(); - continue; - } - if (c != '\0' && c != '\r') - { - buffer += c; - } - } - output.emplace_back(buffer); - return output; - } - - public: - INIReader(std::string const& filename, bool keepLineData = false) - { - fileReadStream.open(filename, std::ios::in | std::ios::binary); - if (keepLineData) - { - lineData = std::make_shared(); - } - } - ~INIReader() { } - - bool operator>>(INIStructure& data) - { - if (!fileReadStream.is_open()) - { - return false; - } - T_LineData fileLines = readFile(); - std::string section; - bool inSection = false; - INIParser::T_ParseValues parseData; - for (auto const& line : fileLines) - { - auto parseResult = INIParser::parseLine(line, parseData); - if (parseResult == INIParser::PDataType::PDATA_SECTION) - { - inSection = true; - data[section = parseData.first]; - } - else if (inSection && parseResult == INIParser::PDataType::PDATA_KEYVALUE) - { - auto const& key = parseData.first; - auto const& value = parseData.second; - data[section][key] = value; - } - if (lineData && parseResult != INIParser::PDataType::PDATA_UNKNOWN) - { - if (parseResult == INIParser::PDataType::PDATA_KEYVALUE && !inSection) - { - continue; - } - lineData->emplace_back(line); - } - } - return true; - } - T_LineDataPtr getLines() - { - return lineData; - } - }; - - class INIGenerator - { - private: - std::ofstream fileWriteStream; - - public: - bool prettyPrint = false; - - INIGenerator(std::string const& filename) - { - fileWriteStream.open(filename, std::ios::out | std::ios::binary); - } - ~INIGenerator() { } - - bool operator<<(INIStructure const& data) - { - if (!fileWriteStream.is_open()) - { - return false; - } - if (!data.size()) - { - return true; - } - auto it = data.begin(); - for (;;) - { - auto const& section = it->first; - auto const& collection = it->second; - fileWriteStream - << "[" - << section - << "]"; - if (collection.size()) - { - fileWriteStream << INIStringUtil::endl; - auto it2 = collection.begin(); - for (;;) - { - auto key = it2->first; - INIStringUtil::replace(key, "=", "\\="); - auto value = it2->second; - INIStringUtil::trim(value); - fileWriteStream - << key - << ((prettyPrint) ? " = " : "=") - << value; - if (++it2 == collection.end()) - { - break; - } - fileWriteStream << INIStringUtil::endl; - } - } - if (++it == data.end()) - { - break; - } - fileWriteStream << INIStringUtil::endl; - if (prettyPrint) - { - fileWriteStream << INIStringUtil::endl; - } - } - return true; - } - }; - - class INIWriter - { - private: - using T_LineData = std::vector; - using T_LineDataPtr = std::shared_ptr; - - std::string filename; - - T_LineData getLazyOutput(T_LineDataPtr const& lineData, INIStructure& data, INIStructure& original) - { - T_LineData output; - INIParser::T_ParseValues parseData; - std::string sectionCurrent; - bool parsingSection = false; - bool continueToNextSection = false; - bool discardNextEmpty = false; - bool writeNewKeys = false; - std::size_t lastKeyLine = 0; - for (auto line = lineData->begin(); line != lineData->end(); ++line) - { - if (!writeNewKeys) - { - auto parseResult = INIParser::parseLine(*line, parseData); - if (parseResult == INIParser::PDataType::PDATA_SECTION) - { - if (parsingSection) - { - writeNewKeys = true; - parsingSection = false; - --line; - continue; - } - sectionCurrent = parseData.first; - if (data.has(sectionCurrent)) - { - parsingSection = true; - continueToNextSection = false; - discardNextEmpty = false; - output.emplace_back(*line); - lastKeyLine = output.size(); - } - else - { - continueToNextSection = true; - discardNextEmpty = true; - continue; - } - } - else if (parseResult == INIParser::PDataType::PDATA_KEYVALUE) - { - if (continueToNextSection) - { - continue; - } - if (data.has(sectionCurrent)) - { - auto& collection = data[sectionCurrent]; - auto const& key = parseData.first; - auto const& value = parseData.second; - if (collection.has(key)) - { - auto outputValue = collection[key]; - if (value == outputValue) - { - output.emplace_back(*line); - } - else - { - INIStringUtil::trim(outputValue); - auto lineNorm = *line; - INIStringUtil::replace(lineNorm, "\\=", " "); - auto equalsAt = lineNorm.find_first_of('='); - auto valueAt = lineNorm.find_first_not_of( - INIStringUtil::whitespaceDelimiters, - equalsAt + 1 - ); - std::string outputLine = line->substr(0, valueAt); - if (prettyPrint && equalsAt + 1 == valueAt) - { - outputLine += " "; - } - outputLine += outputValue; - output.emplace_back(outputLine); - } - lastKeyLine = output.size(); - } - } - } - else - { - if (discardNextEmpty && line->empty()) - { - discardNextEmpty = false; - } - else if (parseResult != INIParser::PDataType::PDATA_UNKNOWN) - { - output.emplace_back(*line); - } - } - } - if (writeNewKeys || std::next(line) == lineData->end()) - { - T_LineData linesToAdd; - if (data.has(sectionCurrent) && original.has(sectionCurrent)) - { - auto const& collection = data[sectionCurrent]; - auto const& collectionOriginal = original[sectionCurrent]; - for (auto const& it : collection) - { - auto key = it.first; - if (collectionOriginal.has(key)) - { - continue; - } - auto value = it.second; - INIStringUtil::replace(key, "=", "\\="); - INIStringUtil::trim(value); - linesToAdd.emplace_back( - key + ((prettyPrint) ? " = " : "=") + value - ); - } - } - if (!linesToAdd.empty()) - { - output.insert( - output.begin() + lastKeyLine, - linesToAdd.begin(), - linesToAdd.end() - ); - } - if (writeNewKeys) - { - writeNewKeys = false; - --line; - } - } - } - for (auto const& it : data) - { - auto const& section = it.first; - if (original.has(section)) - { - continue; - } - if (prettyPrint && output.size() > 0 && !output.back().empty()) - { - output.emplace_back(); - } - output.emplace_back("[" + section + "]"); - auto const& collection = it.second; - for (auto const& it2 : collection) - { - auto key = it2.first; - auto value = it2.second; - INIStringUtil::replace(key, "=", "\\="); - INIStringUtil::trim(value); - output.emplace_back( - key + ((prettyPrint) ? " = " : "=") + value - ); - } - } - return output; - } - - public: - bool prettyPrint = false; - - INIWriter(std::string const& filename) - : filename(filename) - { - } - ~INIWriter() { } - - bool operator<<(INIStructure& data) - { - struct stat buf; - bool fileExists = (stat(filename.c_str(), &buf) == 0); - if (!fileExists) - { - INIGenerator generator(filename); - generator.prettyPrint = prettyPrint; - return generator << data; - } - INIStructure originalData; - T_LineDataPtr lineData; - bool readSuccess = false; - bool fileIsBOM = false; - { - INIReader reader(filename, true); - if ((readSuccess = reader >> originalData)) - { - lineData = reader.getLines(); - fileIsBOM = reader.isBOM; - } - } - if (!readSuccess) - { - return false; - } - T_LineData output = getLazyOutput(lineData, data, originalData); - std::ofstream fileWriteStream(filename, std::ios::out | std::ios::binary); - if (fileWriteStream.is_open()) - { - if (fileIsBOM) { - const char utf8_BOM[3] = { - static_cast(0xEF), - static_cast(0xBB), - static_cast(0xBF) - }; - fileWriteStream.write(utf8_BOM, 3); - } - if (output.size()) - { - auto line = output.begin(); - for (;;) - { - fileWriteStream << *line; - if (++line == output.end()) - { - break; - } - fileWriteStream << INIStringUtil::endl; - } - } - return true; - } - return false; - } - }; - - class INIFile - { - private: - std::string filename; - - public: - INIFile(std::string const& filename) - : filename(filename) - { } - - ~INIFile() { } - - bool read(INIStructure& data) const - { - if (data.size()) - { - data.clear(); - } - if (filename.empty()) - { - return false; - } - INIReader reader(filename); - return reader >> data; - } - bool generate(INIStructure const& data, bool pretty = false) const - { - if (filename.empty()) - { - return false; - } - INIGenerator generator(filename); - generator.prettyPrint = pretty; - return generator << data; - } - bool write(INIStructure& data, bool pretty = false) const - { - if (filename.empty()) - { - return false; - } - INIWriter writer(filename); - writer.prettyPrint = pretty; - return writer << data; - } - }; -} - +/* + * The MIT License (MIT) + * Copyright (c) 2018 Danijel Durakovic + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + + /////////////////////////////////////////////////////////////////////////////// + // + // /mINI/ v0.9.14 + // An INI file reader and writer for the modern age. + // + /////////////////////////////////////////////////////////////////////////////// + // + // A tiny utility library for manipulating INI files with a straightforward + // API and a minimal footprint. It conforms to the (somewhat) standard INI + // format - sections and keys are case insensitive and all leading and + // trailing whitespace is ignored. Comments are lines that begin with a + // semicolon. Trailing comments are allowed on section lines. + // + // Files are read on demand, upon which data is kept in memory and the file + // is closed. This utility supports lazy writing, which only writes changes + // and updates to a file and preserves custom formatting and comments. A lazy + // write invoked by a write() call will read the output file, find what + // changes have been made and update the file accordingly. If you only need to + // generate files, use generate() instead. Section and key order is preserved + // on read, write and insert. + // + /////////////////////////////////////////////////////////////////////////////// + // + // /* BASIC USAGE EXAMPLE: */ + // + // /* read from file */ + // mINI::INIFile file("myfile.ini"); + // mINI::INIStructure ini; + // file.read(ini); + // + // /* read value; gets a reference to actual value in the structure. + // if key or section don't exist, a new empty value will be created */ + // std::string& value = ini["section"]["key"]; + // + // /* read value safely; gets a copy of value in the structure. + // does not alter the structure */ + // std::string value = ini.get("section").get("key"); + // + // /* set or update values */ + // ini["section"]["key"] = "value"; + // + // /* set multiple values */ + // ini["section2"].set({ + // {"key1", "value1"}, + // {"key2", "value2"} + // }); + // + // /* write updates back to file, preserving comments and formatting */ + // file.write(ini); + // + // /* or generate a file (overwrites the original) */ + // file.generate(ini); + // + /////////////////////////////////////////////////////////////////////////////// + // + // Long live the INI file!!! + // + /////////////////////////////////////////////////////////////////////////////// + +#ifndef MINI_INI_H_ +#define MINI_INI_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace mINI +{ + namespace INIStringUtil + { + const char* const whitespaceDelimiters = " \t\n\r\f\v"; + inline void trim(std::string& str) + { + str.erase(str.find_last_not_of(whitespaceDelimiters) + 1); + str.erase(0, str.find_first_not_of(whitespaceDelimiters)); + } +#ifndef MINI_CASE_SENSITIVE + inline void toLower(std::string& str) + { + std::transform(str.begin(), str.end(), str.begin(), [](const char c) { + return static_cast(std::tolower(c)); + }); + } +#endif + inline void replace(std::string& str, std::string const& a, std::string const& b) + { + if (!a.empty()) + { + std::size_t pos = 0; + while ((pos = str.find(a, pos)) != std::string::npos) + { + str.replace(pos, a.size(), b); + pos += b.size(); + } + } + } +#ifdef _WIN32 + const char* const endl = "\r\n"; +#else + const char* const endl = "\n"; +#endif + } + + template + class INIMap + { + private: + using T_DataIndexMap = std::unordered_map; + using T_DataItem = std::pair; + using T_DataContainer = std::vector; + using T_MultiArgs = typename std::vector>; + + T_DataIndexMap dataIndexMap; + T_DataContainer data; + + inline std::size_t setEmpty(std::string& key) + { + std::size_t index = data.size(); + dataIndexMap[key] = index; + data.emplace_back(key, T()); + return index; + } + + public: + using const_iterator = typename T_DataContainer::const_iterator; + + INIMap() { } + + INIMap(INIMap const& other) + { + std::size_t data_size = other.data.size(); + for (std::size_t i = 0; i < data_size; ++i) + { + auto const& key = other.data[i].first; + auto const& obj = other.data[i].second; + data.emplace_back(key, obj); + } + dataIndexMap = T_DataIndexMap(other.dataIndexMap); + } + + T& operator[](std::string key) + { + INIStringUtil::trim(key); +#ifndef MINI_CASE_SENSITIVE + INIStringUtil::toLower(key); +#endif + auto it = dataIndexMap.find(key); + bool hasIt = (it != dataIndexMap.end()); + std::size_t index = (hasIt) ? it->second : setEmpty(key); + return data[index].second; + } + T get(std::string key) const + { + INIStringUtil::trim(key); +#ifndef MINI_CASE_SENSITIVE + INIStringUtil::toLower(key); +#endif + auto it = dataIndexMap.find(key); + if (it == dataIndexMap.end()) + { + return T(); + } + return T(data[it->second].second); + } + bool has(std::string key) const + { + INIStringUtil::trim(key); +#ifndef MINI_CASE_SENSITIVE + INIStringUtil::toLower(key); +#endif + return (dataIndexMap.count(key) == 1); + } + void set(std::string key, T obj) + { + INIStringUtil::trim(key); +#ifndef MINI_CASE_SENSITIVE + INIStringUtil::toLower(key); +#endif + auto it = dataIndexMap.find(key); + if (it != dataIndexMap.end()) + { + data[it->second].second = obj; + } + else + { + dataIndexMap[key] = data.size(); + data.emplace_back(key, obj); + } + } + void set(T_MultiArgs const& multiArgs) + { + for (auto const& it : multiArgs) + { + auto const& key = it.first; + auto const& obj = it.second; + set(key, obj); + } + } + bool remove(std::string key) + { + INIStringUtil::trim(key); +#ifndef MINI_CASE_SENSITIVE + INIStringUtil::toLower(key); +#endif + auto it = dataIndexMap.find(key); + if (it != dataIndexMap.end()) + { + std::size_t index = it->second; + data.erase(data.begin() + index); + dataIndexMap.erase(it); + for (auto& it2 : dataIndexMap) + { + auto& vi = it2.second; + if (vi > index) + { + vi--; + } + } + return true; + } + return false; + } + void clear() + { + data.clear(); + dataIndexMap.clear(); + } + std::size_t size() const + { + return data.size(); + } + const_iterator begin() const { return data.begin(); } + const_iterator end() const { return data.end(); } + }; + + using INIStructure = INIMap>; + + namespace INIParser + { + using T_ParseValues = std::pair; + + enum class PDataType : char + { + PDATA_NONE, + PDATA_COMMENT, + PDATA_SECTION, + PDATA_KEYVALUE, + PDATA_UNKNOWN + }; + + inline PDataType parseLine(std::string line, T_ParseValues& parseData) + { + parseData.first.clear(); + parseData.second.clear(); + INIStringUtil::trim(line); + if (line.empty()) + { + return PDataType::PDATA_NONE; + } + char firstCharacter = line[0]; + if (firstCharacter == ';') + { + return PDataType::PDATA_COMMENT; + } + if (firstCharacter == '[') + { + auto commentAt = line.find_first_of(';'); + if (commentAt != std::string::npos) + { + line = line.substr(0, commentAt); + } + auto closingBracketAt = line.find_last_of(']'); + if (closingBracketAt != std::string::npos) + { + auto section = line.substr(1, closingBracketAt - 1); + INIStringUtil::trim(section); + parseData.first = section; + return PDataType::PDATA_SECTION; + } + } + auto lineNorm = line; + INIStringUtil::replace(lineNorm, "\\=", " "); + auto equalsAt = lineNorm.find_first_of('='); + if (equalsAt != std::string::npos) + { + auto key = line.substr(0, equalsAt); + INIStringUtil::trim(key); + INIStringUtil::replace(key, "\\=", "="); + auto value = line.substr(equalsAt + 1); + INIStringUtil::trim(value); + parseData.first = key; + parseData.second = value; + return PDataType::PDATA_KEYVALUE; + } + return PDataType::PDATA_UNKNOWN; + } + } + + class INIReader + { + public: + using T_LineData = std::vector; + using T_LineDataPtr = std::shared_ptr; + + bool isBOM = false; + + private: + std::ifstream fileReadStream; + T_LineDataPtr lineData; + + T_LineData readFile() + { + fileReadStream.seekg(0, std::ios::end); + const std::size_t fileSize = static_cast(fileReadStream.tellg()); + fileReadStream.seekg(0, std::ios::beg); + if (fileSize >= 3) { + const char header[3] = { + static_cast(fileReadStream.get()), + static_cast(fileReadStream.get()), + static_cast(fileReadStream.get()) + }; + isBOM = ( + header[0] == static_cast(0xEF) && + header[1] == static_cast(0xBB) && + header[2] == static_cast(0xBF) + ); + } + else { + isBOM = false; + } + std::string fileContents; + fileContents.resize(fileSize); + fileReadStream.seekg(isBOM ? 3 : 0, std::ios::beg); + fileReadStream.read(&fileContents[0], fileSize); + fileReadStream.close(); + T_LineData output; + if (fileSize == 0) + { + return output; + } + std::string buffer; + buffer.reserve(50); + for (std::size_t i = 0; i < fileSize; ++i) + { + char& c = fileContents[i]; + if (c == '\n') + { + output.emplace_back(buffer); + buffer.clear(); + continue; + } + if (c != '\0' && c != '\r') + { + buffer += c; + } + } + output.emplace_back(buffer); + return output; + } + + public: + INIReader(std::string const& filename, bool keepLineData = false) + { + fileReadStream.open(filename, std::ios::in | std::ios::binary); + if (keepLineData) + { + lineData = std::make_shared(); + } + } + ~INIReader() { } + + bool operator>>(INIStructure& data) + { + if (!fileReadStream.is_open()) + { + return false; + } + T_LineData fileLines = readFile(); + std::string section; + bool inSection = false; + INIParser::T_ParseValues parseData; + for (auto const& line : fileLines) + { + auto parseResult = INIParser::parseLine(line, parseData); + if (parseResult == INIParser::PDataType::PDATA_SECTION) + { + inSection = true; + data[section = parseData.first]; + } + else if (inSection && parseResult == INIParser::PDataType::PDATA_KEYVALUE) + { + auto const& key = parseData.first; + auto const& value = parseData.second; + data[section][key] = value; + } + if (lineData && parseResult != INIParser::PDataType::PDATA_UNKNOWN) + { + if (parseResult == INIParser::PDataType::PDATA_KEYVALUE && !inSection) + { + continue; + } + lineData->emplace_back(line); + } + } + return true; + } + T_LineDataPtr getLines() + { + return lineData; + } + }; + + class INIGenerator + { + private: + std::ofstream fileWriteStream; + + public: + bool prettyPrint = false; + + INIGenerator(std::string const& filename) + { + fileWriteStream.open(filename, std::ios::out | std::ios::binary); + } + ~INIGenerator() { } + + bool operator<<(INIStructure const& data) + { + if (!fileWriteStream.is_open()) + { + return false; + } + if (!data.size()) + { + return true; + } + auto it = data.begin(); + for (;;) + { + auto const& section = it->first; + auto const& collection = it->second; + fileWriteStream + << "[" + << section + << "]"; + if (collection.size()) + { + fileWriteStream << INIStringUtil::endl; + auto it2 = collection.begin(); + for (;;) + { + auto key = it2->first; + INIStringUtil::replace(key, "=", "\\="); + auto value = it2->second; + INIStringUtil::trim(value); + fileWriteStream + << key + << ((prettyPrint) ? " = " : "=") + << value; + if (++it2 == collection.end()) + { + break; + } + fileWriteStream << INIStringUtil::endl; + } + } + if (++it == data.end()) + { + break; + } + fileWriteStream << INIStringUtil::endl; + if (prettyPrint) + { + fileWriteStream << INIStringUtil::endl; + } + } + return true; + } + }; + + class INIWriter + { + private: + using T_LineData = std::vector; + using T_LineDataPtr = std::shared_ptr; + + std::string filename; + + T_LineData getLazyOutput(T_LineDataPtr const& lineData, INIStructure& data, INIStructure& original) + { + T_LineData output; + INIParser::T_ParseValues parseData; + std::string sectionCurrent; + bool parsingSection = false; + bool continueToNextSection = false; + bool discardNextEmpty = false; + bool writeNewKeys = false; + std::size_t lastKeyLine = 0; + for (auto line = lineData->begin(); line != lineData->end(); ++line) + { + if (!writeNewKeys) + { + auto parseResult = INIParser::parseLine(*line, parseData); + if (parseResult == INIParser::PDataType::PDATA_SECTION) + { + if (parsingSection) + { + writeNewKeys = true; + parsingSection = false; + --line; + continue; + } + sectionCurrent = parseData.first; + if (data.has(sectionCurrent)) + { + parsingSection = true; + continueToNextSection = false; + discardNextEmpty = false; + output.emplace_back(*line); + lastKeyLine = output.size(); + } + else + { + continueToNextSection = true; + discardNextEmpty = true; + continue; + } + } + else if (parseResult == INIParser::PDataType::PDATA_KEYVALUE) + { + if (continueToNextSection) + { + continue; + } + if (data.has(sectionCurrent)) + { + auto& collection = data[sectionCurrent]; + auto const& key = parseData.first; + auto const& value = parseData.second; + if (collection.has(key)) + { + auto outputValue = collection[key]; + if (value == outputValue) + { + output.emplace_back(*line); + } + else + { + INIStringUtil::trim(outputValue); + auto lineNorm = *line; + INIStringUtil::replace(lineNorm, "\\=", " "); + auto equalsAt = lineNorm.find_first_of('='); + auto valueAt = lineNorm.find_first_not_of( + INIStringUtil::whitespaceDelimiters, + equalsAt + 1 + ); + std::string outputLine = line->substr(0, valueAt); + if (prettyPrint && equalsAt + 1 == valueAt) + { + outputLine += " "; + } + outputLine += outputValue; + output.emplace_back(outputLine); + } + lastKeyLine = output.size(); + } + } + } + else + { + if (discardNextEmpty && line->empty()) + { + discardNextEmpty = false; + } + else if (parseResult != INIParser::PDataType::PDATA_UNKNOWN) + { + output.emplace_back(*line); + } + } + } + if (writeNewKeys || std::next(line) == lineData->end()) + { + T_LineData linesToAdd; + if (data.has(sectionCurrent) && original.has(sectionCurrent)) + { + auto const& collection = data[sectionCurrent]; + auto const& collectionOriginal = original[sectionCurrent]; + for (auto const& it : collection) + { + auto key = it.first; + if (collectionOriginal.has(key)) + { + continue; + } + auto value = it.second; + INIStringUtil::replace(key, "=", "\\="); + INIStringUtil::trim(value); + linesToAdd.emplace_back( + key + ((prettyPrint) ? " = " : "=") + value + ); + } + } + if (!linesToAdd.empty()) + { + output.insert( + output.begin() + lastKeyLine, + linesToAdd.begin(), + linesToAdd.end() + ); + } + if (writeNewKeys) + { + writeNewKeys = false; + --line; + } + } + } + for (auto const& it : data) + { + auto const& section = it.first; + if (original.has(section)) + { + continue; + } + if (prettyPrint && output.size() > 0 && !output.back().empty()) + { + output.emplace_back(); + } + output.emplace_back("[" + section + "]"); + auto const& collection = it.second; + for (auto const& it2 : collection) + { + auto key = it2.first; + auto value = it2.second; + INIStringUtil::replace(key, "=", "\\="); + INIStringUtil::trim(value); + output.emplace_back( + key + ((prettyPrint) ? " = " : "=") + value + ); + } + } + return output; + } + + public: + bool prettyPrint = false; + + INIWriter(std::string const& filename) + : filename(filename) + { + } + ~INIWriter() { } + + bool operator<<(INIStructure& data) + { + struct stat buf; + bool fileExists = (stat(filename.c_str(), &buf) == 0); + if (!fileExists) + { + INIGenerator generator(filename); + generator.prettyPrint = prettyPrint; + return generator << data; + } + INIStructure originalData; + T_LineDataPtr lineData; + bool readSuccess = false; + bool fileIsBOM = false; + { + INIReader reader(filename, true); + if ((readSuccess = reader >> originalData)) + { + lineData = reader.getLines(); + fileIsBOM = reader.isBOM; + } + } + if (!readSuccess) + { + return false; + } + T_LineData output = getLazyOutput(lineData, data, originalData); + std::ofstream fileWriteStream(filename, std::ios::out | std::ios::binary); + if (fileWriteStream.is_open()) + { + if (fileIsBOM) { + const char utf8_BOM[3] = { + static_cast(0xEF), + static_cast(0xBB), + static_cast(0xBF) + }; + fileWriteStream.write(utf8_BOM, 3); + } + if (output.size()) + { + auto line = output.begin(); + for (;;) + { + fileWriteStream << *line; + if (++line == output.end()) + { + break; + } + fileWriteStream << INIStringUtil::endl; + } + } + return true; + } + return false; + } + }; + + class INIFile + { + private: + std::string filename; + + public: + INIFile(std::string const& filename) + : filename(filename) + { } + + ~INIFile() { } + + bool read(INIStructure& data) const + { + if (data.size()) + { + data.clear(); + } + if (filename.empty()) + { + return false; + } + INIReader reader(filename); + return reader >> data; + } + bool generate(INIStructure const& data, bool pretty = false) const + { + if (filename.empty()) + { + return false; + } + INIGenerator generator(filename); + generator.prettyPrint = pretty; + return generator << data; + } + bool write(INIStructure& data, bool pretty = false) const + { + if (filename.empty()) + { + return false; + } + INIWriter writer(filename); + writer.prettyPrint = pretty; + return writer << data; + } + }; +} + #endif // MINI_INI_H_ \ No newline at end of file diff --git a/hook_lib/json.hpp b/hook_lib/json.hpp index 5292177..0457c72 100644 --- a/hook_lib/json.hpp +++ b/hook_lib/json.hpp @@ -1,24673 +1,24673 @@ -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - -/****************************************************************************\ - * Note on documentation: The source files contain links to the online * - * documentation of the public API at https://json.nlohmann.me. This URL * - * contains the most recent documentation and should also be applicable to * - * previous versions; documentation for deprecated functions is not * - * removed, but marked deprecated. See "Generate documentation" section in * - * file docs/README.md. * -\****************************************************************************/ - -#ifndef INCLUDE_NLOHMANN_JSON_HPP_ -#define INCLUDE_NLOHMANN_JSON_HPP_ - -#include // all_of, find, for_each -#include // nullptr_t, ptrdiff_t, size_t -#include // hash, less -#include // initializer_list -#ifndef JSON_NO_IO -#include // istream, ostream -#endif // JSON_NO_IO -#include // random_access_iterator_tag -#include // unique_ptr -#include // string, stoi, to_string -#include // declval, forward, move, pair, swap -#include // vector - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -// This file contains all macro definitions affecting or depending on the ABI - -#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK -#if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) -#if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 -#warning "Already included a different version of the library!" -#endif -#endif -#endif - -#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) -#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) -#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) - -#ifndef JSON_DIAGNOSTICS -#define JSON_DIAGNOSTICS 0 -#endif - -#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON -#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 -#endif - -#if JSON_DIAGNOSTICS -#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag -#else -#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS -#endif - -#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON -#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp -#else -#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON -#endif - -#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION -#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 -#endif - -// Construct the namespace ABI tags component -#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b -#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ - NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) - -#define NLOHMANN_JSON_ABI_TAGS \ - NLOHMANN_JSON_ABI_TAGS_CONCAT( \ - NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ - NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) - -// Construct the namespace version component -#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ - _v ## major ## _ ## minor ## _ ## patch -#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ - NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) - -#if NLOHMANN_JSON_NAMESPACE_NO_VERSION -#define NLOHMANN_JSON_NAMESPACE_VERSION -#else -#define NLOHMANN_JSON_NAMESPACE_VERSION \ - NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ - NLOHMANN_JSON_VERSION_MINOR, \ - NLOHMANN_JSON_VERSION_PATCH) -#endif - -// Combine namespace components -#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b -#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ - NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) - -#ifndef NLOHMANN_JSON_NAMESPACE -#define NLOHMANN_JSON_NAMESPACE \ - nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ - NLOHMANN_JSON_ABI_TAGS, \ - NLOHMANN_JSON_NAMESPACE_VERSION) -#endif - -#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN -#define NLOHMANN_JSON_NAMESPACE_BEGIN \ - namespace nlohmann \ - { \ - inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ - NLOHMANN_JSON_ABI_TAGS, \ - NLOHMANN_JSON_NAMESPACE_VERSION) \ - { -#endif - -#ifndef NLOHMANN_JSON_NAMESPACE_END -#define NLOHMANN_JSON_NAMESPACE_END \ - } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ - } // namespace nlohmann -#endif - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // transform -#include // array -#include // forward_list -#include // inserter, front_inserter, end -#include // map -#include // string -#include // tuple, make_tuple -#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible -#include // unordered_map -#include // pair, declval -#include // valarray - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // nullptr_t -#include // exception -#if JSON_DIAGNOSTICS -#include // accumulate -#endif -#include // runtime_error -#include // to_string -#include // vector - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // array -#include // size_t -#include // uint8_t -#include // string - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // declval, pair -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - template struct make_void - { - using type = void; - }; - template using void_t = typename make_void::type; - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - // https://en.cppreference.com/w/cpp/experimental/is_detected - struct nonesuch - { - nonesuch() = delete; - ~nonesuch() = delete; - nonesuch(nonesuch const&) = delete; - nonesuch(nonesuch const&&) = delete; - void operator=(nonesuch const&) = delete; - void operator=(nonesuch&&) = delete; - }; - - template class Op, - class... Args> - struct detector - { - using value_t = std::false_type; - using type = Default; - }; - - template class Op, class... Args> - struct detector>, Op, Args...> - { - using value_t = std::true_type; - using type = Op; - }; - - template class Op, class... Args> - using is_detected = typename detector::value_t; - - template class Op, class... Args> - struct is_detected_lazy : is_detected { }; - - template class Op, class... Args> - using detected_t = typename detector::type; - - template class Op, class... Args> - using detected_or = detector; - - template class Op, class... Args> - using detected_or_t = typename detected_or::type; - - template class Op, class... Args> - using is_detected_exact = std::is_same>; - - template class Op, class... Args> - using is_detected_convertible = - std::is_convertible, To>; - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include - - -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson -// SPDX-License-Identifier: MIT - -/* Hedley - https://nemequ.github.io/hedley - * Created by Evan Nemerson - */ - -#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) -#if defined(JSON_HEDLEY_VERSION) -#undef JSON_HEDLEY_VERSION -#endif -#define JSON_HEDLEY_VERSION 15 - -#if defined(JSON_HEDLEY_STRINGIFY_EX) -#undef JSON_HEDLEY_STRINGIFY_EX -#endif -#define JSON_HEDLEY_STRINGIFY_EX(x) #x - -#if defined(JSON_HEDLEY_STRINGIFY) -#undef JSON_HEDLEY_STRINGIFY -#endif -#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) - -#if defined(JSON_HEDLEY_CONCAT_EX) -#undef JSON_HEDLEY_CONCAT_EX -#endif -#define JSON_HEDLEY_CONCAT_EX(a,b) a##b - -#if defined(JSON_HEDLEY_CONCAT) -#undef JSON_HEDLEY_CONCAT -#endif -#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) - -#if defined(JSON_HEDLEY_CONCAT3_EX) -#undef JSON_HEDLEY_CONCAT3_EX -#endif -#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c - -#if defined(JSON_HEDLEY_CONCAT3) -#undef JSON_HEDLEY_CONCAT3 -#endif -#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) - -#if defined(JSON_HEDLEY_VERSION_ENCODE) -#undef JSON_HEDLEY_VERSION_ENCODE -#endif -#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) - -#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) -#undef JSON_HEDLEY_VERSION_DECODE_MAJOR -#endif -#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) - -#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) -#undef JSON_HEDLEY_VERSION_DECODE_MINOR -#endif -#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) - -#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) -#undef JSON_HEDLEY_VERSION_DECODE_REVISION -#endif -#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) - -#if defined(JSON_HEDLEY_GNUC_VERSION) -#undef JSON_HEDLEY_GNUC_VERSION -#endif -#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) -#define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) -#elif defined(__GNUC__) -#define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) -#endif - -#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) -#undef JSON_HEDLEY_GNUC_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_GNUC_VERSION) -#define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_MSVC_VERSION) -#undef JSON_HEDLEY_MSVC_VERSION -#endif -#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) -#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) -#elif defined(_MSC_FULL_VER) && !defined(__ICL) -#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) -#elif defined(_MSC_VER) && !defined(__ICL) -#define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) -#endif - -#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) -#undef JSON_HEDLEY_MSVC_VERSION_CHECK -#endif -#if !defined(JSON_HEDLEY_MSVC_VERSION) -#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) -#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) -#elif defined(_MSC_VER) && (_MSC_VER >= 1200) -#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) -#else -#define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) -#endif - -#if defined(JSON_HEDLEY_INTEL_VERSION) -#undef JSON_HEDLEY_INTEL_VERSION -#endif -#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) -#define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) -#elif defined(__INTEL_COMPILER) && !defined(__ICL) -#define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) -#endif - -#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) -#undef JSON_HEDLEY_INTEL_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_INTEL_VERSION) -#define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_INTEL_CL_VERSION) -#undef JSON_HEDLEY_INTEL_CL_VERSION -#endif -#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) -#define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) -#endif - -#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) -#undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_INTEL_CL_VERSION) -#define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_PGI_VERSION) -#undef JSON_HEDLEY_PGI_VERSION -#endif -#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) -#define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) -#endif - -#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) -#undef JSON_HEDLEY_PGI_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_PGI_VERSION) -#define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_SUNPRO_VERSION) -#undef JSON_HEDLEY_SUNPRO_VERSION -#endif -#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) -#define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) -#elif defined(__SUNPRO_C) -#define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) -#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) -#define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) -#elif defined(__SUNPRO_CC) -#define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) -#endif - -#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) -#undef JSON_HEDLEY_SUNPRO_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_SUNPRO_VERSION) -#define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) -#undef JSON_HEDLEY_EMSCRIPTEN_VERSION -#endif -#if defined(__EMSCRIPTEN__) -#define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) -#endif - -#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) -#undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) -#define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_ARM_VERSION) -#undef JSON_HEDLEY_ARM_VERSION -#endif -#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) -#define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) -#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) -#define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) -#endif - -#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) -#undef JSON_HEDLEY_ARM_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_ARM_VERSION) -#define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_IBM_VERSION) -#undef JSON_HEDLEY_IBM_VERSION -#endif -#if defined(__ibmxl__) -#define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) -#elif defined(__xlC__) && defined(__xlC_ver__) -#define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) -#elif defined(__xlC__) -#define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) -#endif - -#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) -#undef JSON_HEDLEY_IBM_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_IBM_VERSION) -#define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_VERSION) -#undef JSON_HEDLEY_TI_VERSION -#endif -#if \ - defined(__TI_COMPILER_VERSION__) && \ - ( \ - defined(__TMS470__) || defined(__TI_ARM__) || \ - defined(__MSP430__) || \ - defined(__TMS320C2000__) \ - ) -#if (__TI_COMPILER_VERSION__ >= 16000000) -#define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif -#endif - -#if defined(JSON_HEDLEY_TI_VERSION_CHECK) -#undef JSON_HEDLEY_TI_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_VERSION) -#define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_CL2000_VERSION) -#undef JSON_HEDLEY_TI_CL2000_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) -#define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) -#undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_CL2000_VERSION) -#define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_CL430_VERSION) -#undef JSON_HEDLEY_TI_CL430_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) -#define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) -#undef JSON_HEDLEY_TI_CL430_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_CL430_VERSION) -#define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) -#undef JSON_HEDLEY_TI_ARMCL_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) -#define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) -#undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) -#define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_CL6X_VERSION) -#undef JSON_HEDLEY_TI_CL6X_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) -#define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) -#undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_CL6X_VERSION) -#define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_CL7X_VERSION) -#undef JSON_HEDLEY_TI_CL7X_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) -#define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) -#undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_CL7X_VERSION) -#define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) -#undef JSON_HEDLEY_TI_CLPRU_VERSION -#endif -#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) -#define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif - -#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) -#undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) -#define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_CRAY_VERSION) -#undef JSON_HEDLEY_CRAY_VERSION -#endif -#if defined(_CRAYC) -#if defined(_RELEASE_PATCHLEVEL) -#define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) -#else -#define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) -#endif -#endif - -#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) -#undef JSON_HEDLEY_CRAY_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_CRAY_VERSION) -#define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_IAR_VERSION) -#undef JSON_HEDLEY_IAR_VERSION -#endif -#if defined(__IAR_SYSTEMS_ICC__) -#if __VER__ > 1000 -#define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) -#else -#define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) -#endif -#endif - -#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) -#undef JSON_HEDLEY_IAR_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_IAR_VERSION) -#define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_TINYC_VERSION) -#undef JSON_HEDLEY_TINYC_VERSION -#endif -#if defined(__TINYC__) -#define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) -#endif - -#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) -#undef JSON_HEDLEY_TINYC_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_TINYC_VERSION) -#define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_DMC_VERSION) -#undef JSON_HEDLEY_DMC_VERSION -#endif -#if defined(__DMC__) -#define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) -#endif - -#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) -#undef JSON_HEDLEY_DMC_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_DMC_VERSION) -#define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_COMPCERT_VERSION) -#undef JSON_HEDLEY_COMPCERT_VERSION -#endif -#if defined(__COMPCERT_VERSION__) -#define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) -#endif - -#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) -#undef JSON_HEDLEY_COMPCERT_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_COMPCERT_VERSION) -#define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_PELLES_VERSION) -#undef JSON_HEDLEY_PELLES_VERSION -#endif -#if defined(__POCC__) -#define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) -#endif - -#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) -#undef JSON_HEDLEY_PELLES_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_PELLES_VERSION) -#define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_MCST_LCC_VERSION) -#undef JSON_HEDLEY_MCST_LCC_VERSION -#endif -#if defined(__LCC__) && defined(__LCC_MINOR__) -#define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) -#endif - -#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) -#undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_MCST_LCC_VERSION) -#define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_GCC_VERSION) -#undef JSON_HEDLEY_GCC_VERSION -#endif -#if \ - defined(JSON_HEDLEY_GNUC_VERSION) && \ - !defined(__clang__) && \ - !defined(JSON_HEDLEY_INTEL_VERSION) && \ - !defined(JSON_HEDLEY_PGI_VERSION) && \ - !defined(JSON_HEDLEY_ARM_VERSION) && \ - !defined(JSON_HEDLEY_CRAY_VERSION) && \ - !defined(JSON_HEDLEY_TI_VERSION) && \ - !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ - !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ - !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ - !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ - !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ - !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ - !defined(__COMPCERT__) && \ - !defined(JSON_HEDLEY_MCST_LCC_VERSION) -#define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION -#endif - -#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) -#undef JSON_HEDLEY_GCC_VERSION_CHECK -#endif -#if defined(JSON_HEDLEY_GCC_VERSION) -#define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) -#else -#define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) -#endif - -#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) -#undef JSON_HEDLEY_HAS_ATTRIBUTE -#endif -#if \ - defined(__has_attribute) && \ - ( \ - (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ - ) -# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) -#else -# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) -#undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE -#endif -#if defined(__has_attribute) -#define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) -#else -#define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) -#undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE -#endif -#if defined(__has_attribute) -#define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) -#else -#define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) -#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE -#endif -#if \ - defined(__has_cpp_attribute) && \ - defined(__cplusplus) && \ - (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) -#define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) -#else -#define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) -#endif - -#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) -#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS -#endif -#if !defined(__cplusplus) || !defined(__has_cpp_attribute) -#define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) -#elif \ - !defined(JSON_HEDLEY_PGI_VERSION) && \ - !defined(JSON_HEDLEY_IAR_VERSION) && \ - (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ - (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) -#define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) -#else -#define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) -#undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE -#endif -#if defined(__has_cpp_attribute) && defined(__cplusplus) -#define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) -#else -#define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) -#undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE -#endif -#if defined(__has_cpp_attribute) && defined(__cplusplus) -#define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) -#else -#define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_BUILTIN) -#undef JSON_HEDLEY_HAS_BUILTIN -#endif -#if defined(__has_builtin) -#define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) -#else -#define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) -#undef JSON_HEDLEY_GNUC_HAS_BUILTIN -#endif -#if defined(__has_builtin) -#define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) -#else -#define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) -#undef JSON_HEDLEY_GCC_HAS_BUILTIN -#endif -#if defined(__has_builtin) -#define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) -#else -#define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_FEATURE) -#undef JSON_HEDLEY_HAS_FEATURE -#endif -#if defined(__has_feature) -#define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) -#else -#define JSON_HEDLEY_HAS_FEATURE(feature) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) -#undef JSON_HEDLEY_GNUC_HAS_FEATURE -#endif -#if defined(__has_feature) -#define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) -#else -#define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) -#undef JSON_HEDLEY_GCC_HAS_FEATURE -#endif -#if defined(__has_feature) -#define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) -#else -#define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_EXTENSION) -#undef JSON_HEDLEY_HAS_EXTENSION -#endif -#if defined(__has_extension) -#define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) -#else -#define JSON_HEDLEY_HAS_EXTENSION(extension) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) -#undef JSON_HEDLEY_GNUC_HAS_EXTENSION -#endif -#if defined(__has_extension) -#define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) -#else -#define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) -#undef JSON_HEDLEY_GCC_HAS_EXTENSION -#endif -#if defined(__has_extension) -#define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) -#else -#define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) -#undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE -#endif -#if defined(__has_declspec_attribute) -#define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) -#else -#define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) -#undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE -#endif -#if defined(__has_declspec_attribute) -#define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) -#else -#define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) -#undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE -#endif -#if defined(__has_declspec_attribute) -#define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) -#else -#define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_HAS_WARNING) -#undef JSON_HEDLEY_HAS_WARNING -#endif -#if defined(__has_warning) -#define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) -#else -#define JSON_HEDLEY_HAS_WARNING(warning) (0) -#endif - -#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) -#undef JSON_HEDLEY_GNUC_HAS_WARNING -#endif -#if defined(__has_warning) -#define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) -#else -#define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_GCC_HAS_WARNING) -#undef JSON_HEDLEY_GCC_HAS_WARNING -#endif -#if defined(__has_warning) -#define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) -#else -#define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ - defined(__clang__) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) -#define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) -#define JSON_HEDLEY_PRAGMA(value) __pragma(value) -#else -#define JSON_HEDLEY_PRAGMA(value) -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) -#undef JSON_HEDLEY_DIAGNOSTIC_PUSH -#endif -#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) -#undef JSON_HEDLEY_DIAGNOSTIC_POP -#endif -#if defined(__clang__) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) -#define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) -#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") -#elif \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) -#define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") -#define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") -#else -#define JSON_HEDLEY_DIAGNOSTIC_PUSH -#define JSON_HEDLEY_DIAGNOSTIC_POP -#endif - - /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for - HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ -#endif -#if defined(__cplusplus) -# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") -# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") -# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") -# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ - _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ - _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ - xpr \ - JSON_HEDLEY_DIAGNOSTIC_POP -# else -# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ - _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ - xpr \ - JSON_HEDLEY_DIAGNOSTIC_POP -# endif -# else -# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ - xpr \ - JSON_HEDLEY_DIAGNOSTIC_POP -# endif -# endif -#endif -#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x -#endif - -#if defined(JSON_HEDLEY_CONST_CAST) -#undef JSON_HEDLEY_CONST_CAST -#endif -#if defined(__cplusplus) -# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) -#elif \ - JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - ((T) (expr)); \ - JSON_HEDLEY_DIAGNOSTIC_POP \ - })) -#else -# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) -#endif - -#if defined(JSON_HEDLEY_REINTERPRET_CAST) -#undef JSON_HEDLEY_REINTERPRET_CAST -#endif -#if defined(__cplusplus) -#define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) -#else -#define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) -#endif - -#if defined(JSON_HEDLEY_STATIC_CAST) -#undef JSON_HEDLEY_STATIC_CAST -#endif -#if defined(__cplusplus) -#define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) -#else -#define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) -#endif - -#if defined(JSON_HEDLEY_CPP_CAST) -#undef JSON_HEDLEY_CPP_CAST -#endif -#if defined(__cplusplus) -# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") -# define JSON_HEDLEY_CPP_CAST(T, expr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ - ((T) (expr)) \ - JSON_HEDLEY_DIAGNOSTIC_POP -# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) -# define JSON_HEDLEY_CPP_CAST(T, expr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("diag_suppress=Pe137") \ - JSON_HEDLEY_DIAGNOSTIC_POP -# else -# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) -# endif -#else -# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) -#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") -#elif \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") -#else -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) -#elif \ - JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") -#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") -#else -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") -#elif \ - JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") -#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") -#else -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") -#else -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL -#endif - -#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) -#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) -#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") -#else -#define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION -#endif - -#if defined(JSON_HEDLEY_DEPRECATED) -#undef JSON_HEDLEY_DEPRECATED -#endif -#if defined(JSON_HEDLEY_DEPRECATED_FOR) -#undef JSON_HEDLEY_DEPRECATED_FOR -#endif -#if \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) -#elif \ - (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) -#elif defined(__cplusplus) && (__cplusplus >= 201402L) -#define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) -#elif \ - JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) -#define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") -#else -#define JSON_HEDLEY_DEPRECATED(since) -#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) -#endif - -#if defined(JSON_HEDLEY_UNAVAILABLE) -#undef JSON_HEDLEY_UNAVAILABLE -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) -#else -#define JSON_HEDLEY_UNAVAILABLE(available_since) -#endif - -#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) -#undef JSON_HEDLEY_WARN_UNUSED_RESULT -#endif -#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) -#undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) -#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) -#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) -#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) -#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) -#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) -#define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) -#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) -#elif defined(_Check_return_) /* SAL */ -#define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ -#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ -#else -#define JSON_HEDLEY_WARN_UNUSED_RESULT -#define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) -#endif - -#if defined(JSON_HEDLEY_SENTINEL) -#undef JSON_HEDLEY_SENTINEL -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) -#else -#define JSON_HEDLEY_SENTINEL(position) -#endif - -#if defined(JSON_HEDLEY_NO_RETURN) -#undef JSON_HEDLEY_NO_RETURN -#endif -#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_NO_RETURN __noreturn -#elif \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define JSON_HEDLEY_NO_RETURN _Noreturn -#elif defined(__cplusplus) && (__cplusplus >= 201103L) -#define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) -#elif \ - JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) -#define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) -#define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_NO_RETURN __declspec(noreturn) -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) -#define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") -#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) -#define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) -#define JSON_HEDLEY_NO_RETURN __declspec(noreturn) -#else -#define JSON_HEDLEY_NO_RETURN -#endif - -#if defined(JSON_HEDLEY_NO_ESCAPE) -#undef JSON_HEDLEY_NO_ESCAPE -#endif -#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) -#define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) -#else -#define JSON_HEDLEY_NO_ESCAPE -#endif - -#if defined(JSON_HEDLEY_UNREACHABLE) -#undef JSON_HEDLEY_UNREACHABLE -#endif -#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) -#undef JSON_HEDLEY_UNREACHABLE_RETURN -#endif -#if defined(JSON_HEDLEY_ASSUME) -#undef JSON_HEDLEY_ASSUME -#endif -#if \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_ASSUME(expr) __assume(expr) -#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) -#define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) -#elif \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) -#if defined(__cplusplus) -#define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) -#else -#define JSON_HEDLEY_ASSUME(expr) _nassert(expr) -#endif -#endif -#if \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() -#elif defined(JSON_HEDLEY_ASSUME) -#define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) -#endif -#if !defined(JSON_HEDLEY_ASSUME) -#if defined(JSON_HEDLEY_UNREACHABLE) -#define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) -#else -#define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) -#endif -#endif -#if defined(JSON_HEDLEY_UNREACHABLE) -#if \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) -#define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) -#else -#define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() -#endif -#else -#define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) -#endif -#if !defined(JSON_HEDLEY_UNREACHABLE) -#define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) -#endif - - JSON_HEDLEY_DIAGNOSTIC_PUSH -#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") -#pragma clang diagnostic ignored "-Wpedantic" -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) -#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" -#endif -#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wvariadic-macros" -#elif defined(JSON_HEDLEY_GCC_VERSION) -#pragma GCC diagnostic ignored "-Wvariadic-macros" -#endif -#endif -#if defined(JSON_HEDLEY_NON_NULL) -#undef JSON_HEDLEY_NON_NULL -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) -#define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) -#else -#define JSON_HEDLEY_NON_NULL(...) -#endif - JSON_HEDLEY_DIAGNOSTIC_POP - -#if defined(JSON_HEDLEY_PRINTF_FORMAT) -#undef JSON_HEDLEY_PRINTF_FORMAT -#endif -#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) -#define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) -#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) -#define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) -#elif \ - JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) -#define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) -#else -#define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) -#endif - -#if defined(JSON_HEDLEY_CONSTEXPR) -#undef JSON_HEDLEY_CONSTEXPR -#endif -#if defined(__cplusplus) -#if __cplusplus >= 201103L -#define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) -#endif -#endif -#if !defined(JSON_HEDLEY_CONSTEXPR) -#define JSON_HEDLEY_CONSTEXPR -#endif - -#if defined(JSON_HEDLEY_PREDICT) -#undef JSON_HEDLEY_PREDICT -#endif -#if defined(JSON_HEDLEY_LIKELY) -#undef JSON_HEDLEY_LIKELY -#endif -#if defined(JSON_HEDLEY_UNLIKELY) -#undef JSON_HEDLEY_UNLIKELY -#endif -#if defined(JSON_HEDLEY_UNPREDICTABLE) -#undef JSON_HEDLEY_UNPREDICTABLE -#endif -#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) -#define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) -#endif -#if \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) -# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) -# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) -# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) -# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) -#elif \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ - (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) -# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ - (__extension__ ({ \ - double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ - })) -# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ - (__extension__ ({ \ - double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ - })) -# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) -# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) -#else -# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) -# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) -# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) -# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) -# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) -#endif -#if !defined(JSON_HEDLEY_UNPREDICTABLE) -#define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) -#endif - -#if defined(JSON_HEDLEY_MALLOC) -#undef JSON_HEDLEY_MALLOC -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) -#define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_MALLOC __declspec(restrict) -#else -#define JSON_HEDLEY_MALLOC -#endif - -#if defined(JSON_HEDLEY_PURE) -#undef JSON_HEDLEY_PURE -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -# define JSON_HEDLEY_PURE __attribute__((__pure__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) -# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") -#elif defined(__cplusplus) && \ - ( \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ - ) -# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") -#else -# define JSON_HEDLEY_PURE -#endif - -#if defined(JSON_HEDLEY_CONST) -#undef JSON_HEDLEY_CONST -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_CONST __attribute__((__const__)) -#elif \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) -#define JSON_HEDLEY_CONST _Pragma("no_side_effect") -#else -#define JSON_HEDLEY_CONST JSON_HEDLEY_PURE -#endif - -#if defined(JSON_HEDLEY_RESTRICT) -#undef JSON_HEDLEY_RESTRICT -#endif -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) -#define JSON_HEDLEY_RESTRICT restrict -#elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ - defined(__clang__) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_RESTRICT __restrict -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) -#define JSON_HEDLEY_RESTRICT _Restrict -#else -#define JSON_HEDLEY_RESTRICT -#endif - -#if defined(JSON_HEDLEY_INLINE) -#undef JSON_HEDLEY_INLINE -#endif -#if \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ - (defined(__cplusplus) && (__cplusplus >= 199711L)) -#define JSON_HEDLEY_INLINE inline -#elif \ - defined(JSON_HEDLEY_GCC_VERSION) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) -#define JSON_HEDLEY_INLINE __inline__ -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_INLINE __inline -#else -#define JSON_HEDLEY_INLINE -#endif - -#if defined(JSON_HEDLEY_ALWAYS_INLINE) -#undef JSON_HEDLEY_ALWAYS_INLINE -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) -# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -# define JSON_HEDLEY_ALWAYS_INLINE __forceinline -#elif defined(__cplusplus) && \ - ( \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ - ) -# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") -#else -# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE -#endif - -#if defined(JSON_HEDLEY_NEVER_INLINE) -#undef JSON_HEDLEY_NEVER_INLINE -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) -#define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) -#define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) -#define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -#define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") -#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) -#define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) -#define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) -#else -#define JSON_HEDLEY_NEVER_INLINE -#endif - -#if defined(JSON_HEDLEY_PRIVATE) -#undef JSON_HEDLEY_PRIVATE -#endif -#if defined(JSON_HEDLEY_PUBLIC) -#undef JSON_HEDLEY_PUBLIC -#endif -#if defined(JSON_HEDLEY_IMPORT) -#undef JSON_HEDLEY_IMPORT -#endif -#if defined(_WIN32) || defined(__CYGWIN__) -# define JSON_HEDLEY_PRIVATE -# define JSON_HEDLEY_PUBLIC __declspec(dllexport) -# define JSON_HEDLEY_IMPORT __declspec(dllimport) -#else -# if \ - JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - ( \ - defined(__TI_EABI__) && \ - ( \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ - ) \ - ) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) -# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) -# else -# define JSON_HEDLEY_PRIVATE -# define JSON_HEDLEY_PUBLIC -# endif -# define JSON_HEDLEY_IMPORT extern -#endif - -#if defined(JSON_HEDLEY_NO_THROW) -#undef JSON_HEDLEY_NO_THROW -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) -#define JSON_HEDLEY_NO_THROW __declspec(nothrow) -#else -#define JSON_HEDLEY_NO_THROW -#endif - -#if defined(JSON_HEDLEY_FALL_THROUGH) -#undef JSON_HEDLEY_FALL_THROUGH -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) -#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) -#define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) -#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) -#define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) -#elif defined(__fallthrough) /* SAL */ -#define JSON_HEDLEY_FALL_THROUGH __fallthrough -#else -#define JSON_HEDLEY_FALL_THROUGH -#endif - -#if defined(JSON_HEDLEY_RETURNS_NON_NULL) -#undef JSON_HEDLEY_RETURNS_NON_NULL -#endif -#if \ - JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) -#elif defined(_Ret_notnull_) /* SAL */ -#define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ -#else -#define JSON_HEDLEY_RETURNS_NON_NULL -#endif - -#if defined(JSON_HEDLEY_ARRAY_PARAM) -#undef JSON_HEDLEY_ARRAY_PARAM -#endif -#if \ - defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ - !defined(__STDC_NO_VLA__) && \ - !defined(__cplusplus) && \ - !defined(JSON_HEDLEY_PGI_VERSION) && \ - !defined(JSON_HEDLEY_TINYC_VERSION) -#define JSON_HEDLEY_ARRAY_PARAM(name) (name) -#else -#define JSON_HEDLEY_ARRAY_PARAM(name) -#endif - -#if defined(JSON_HEDLEY_IS_CONSTANT) -#undef JSON_HEDLEY_IS_CONSTANT -#endif -#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) -#undef JSON_HEDLEY_REQUIRE_CONSTEXPR -#endif - /* JSON_HEDLEY_IS_CONSTEXPR_ is for - HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ -#if defined(JSON_HEDLEY_IS_CONSTEXPR_) -#undef JSON_HEDLEY_IS_CONSTEXPR_ -#endif -#if \ - JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) -#define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) -#endif -#if !defined(__cplusplus) -# if \ - JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) -#if defined(__INTPTR_TYPE__) -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) -#else -#include -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) -#endif -# elif \ - ( \ - defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ - !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ - !defined(JSON_HEDLEY_PGI_VERSION) && \ - !defined(JSON_HEDLEY_IAR_VERSION)) || \ - (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) -#if defined(__INTPTR_TYPE__) -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) -#else -#include -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) -#endif -# elif \ - defined(JSON_HEDLEY_GCC_VERSION) || \ - defined(JSON_HEDLEY_INTEL_VERSION) || \ - defined(JSON_HEDLEY_TINYC_VERSION) || \ - defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ - defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ - defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ - defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ - defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ - defined(__clang__) -# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ - sizeof(void) != \ - sizeof(*( \ - 1 ? \ - ((void*) ((expr) * 0L) ) : \ -((struct { char v[sizeof(void) * 2]; } *) 1) \ - ) \ - ) \ - ) -# endif -#endif -#if defined(JSON_HEDLEY_IS_CONSTEXPR_) -#if !defined(JSON_HEDLEY_IS_CONSTANT) -#define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) -#endif -#define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) -#else -#if !defined(JSON_HEDLEY_IS_CONSTANT) -#define JSON_HEDLEY_IS_CONSTANT(expr) (0) -#endif -#define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) -#endif - -#if defined(JSON_HEDLEY_BEGIN_C_DECLS) -#undef JSON_HEDLEY_BEGIN_C_DECLS -#endif -#if defined(JSON_HEDLEY_END_C_DECLS) -#undef JSON_HEDLEY_END_C_DECLS -#endif -#if defined(JSON_HEDLEY_C_DECL) -#undef JSON_HEDLEY_C_DECL -#endif -#if defined(__cplusplus) -#define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { -#define JSON_HEDLEY_END_C_DECLS } -#define JSON_HEDLEY_C_DECL extern "C" -#else -#define JSON_HEDLEY_BEGIN_C_DECLS -#define JSON_HEDLEY_END_C_DECLS -#define JSON_HEDLEY_C_DECL -#endif - -#if defined(JSON_HEDLEY_STATIC_ASSERT) -#undef JSON_HEDLEY_STATIC_ASSERT -#endif -#if \ - !defined(__cplusplus) && ( \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ - (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - defined(_Static_assert) \ - ) -# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) -#elif \ - (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ - JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) -#else -# define JSON_HEDLEY_STATIC_ASSERT(expr, message) -#endif - -#if defined(JSON_HEDLEY_NULL) -#undef JSON_HEDLEY_NULL -#endif -#if defined(__cplusplus) -#if __cplusplus >= 201103L -#define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) -#elif defined(NULL) -#define JSON_HEDLEY_NULL NULL -#else -#define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) -#endif -#elif defined(NULL) -#define JSON_HEDLEY_NULL NULL -#else -#define JSON_HEDLEY_NULL ((void*) 0) -#endif - -#if defined(JSON_HEDLEY_MESSAGE) -#undef JSON_HEDLEY_MESSAGE -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") -# define JSON_HEDLEY_MESSAGE(msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - JSON_HEDLEY_PRAGMA(message msg) \ - JSON_HEDLEY_DIAGNOSTIC_POP -#elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) -#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) -# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) -# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) -# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) -#else -# define JSON_HEDLEY_MESSAGE(msg) -#endif - -#if defined(JSON_HEDLEY_WARNING) -#undef JSON_HEDLEY_WARNING -#endif -#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") -# define JSON_HEDLEY_WARNING(msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - JSON_HEDLEY_PRAGMA(clang warning msg) \ - JSON_HEDLEY_DIAGNOSTIC_POP -#elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) -# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) -#elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) -#else -# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) -#endif - -#if defined(JSON_HEDLEY_REQUIRE) -#undef JSON_HEDLEY_REQUIRE -#endif -#if defined(JSON_HEDLEY_REQUIRE_MSG) -#undef JSON_HEDLEY_REQUIRE_MSG -#endif -#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) -# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") -# define JSON_HEDLEY_REQUIRE(expr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ - __attribute__((diagnose_if(!(expr), #expr, "error"))) \ - JSON_HEDLEY_DIAGNOSTIC_POP -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ - __attribute__((diagnose_if(!(expr), msg, "error"))) \ - JSON_HEDLEY_DIAGNOSTIC_POP -# else -# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) -# endif -#else -# define JSON_HEDLEY_REQUIRE(expr) -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) -#endif - -#if defined(JSON_HEDLEY_FLAGS) -#undef JSON_HEDLEY_FLAGS -#endif -#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) -#define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) -#else -#define JSON_HEDLEY_FLAGS -#endif - -#if defined(JSON_HEDLEY_FLAGS_CAST) -#undef JSON_HEDLEY_FLAGS_CAST -#endif -#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) -# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("warning(disable:188)") \ - ((T) (expr)); \ - JSON_HEDLEY_DIAGNOSTIC_POP \ - })) -#else -# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) -#endif - -#if defined(JSON_HEDLEY_EMPTY_BASES) -#undef JSON_HEDLEY_EMPTY_BASES -#endif -#if \ - (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -#define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) -#else -#define JSON_HEDLEY_EMPTY_BASES -#endif - - /* Remaining macros are deprecated. */ - -#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) -#undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK -#endif -#if defined(__clang__) -#define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) -#else -#define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif - -#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) -#undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE -#endif -#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) - -#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) -#undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE -#endif -#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) - -#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) -#undef JSON_HEDLEY_CLANG_HAS_BUILTIN -#endif -#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) - -#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) -#undef JSON_HEDLEY_CLANG_HAS_FEATURE -#endif -#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) - -#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) -#undef JSON_HEDLEY_CLANG_HAS_EXTENSION -#endif -#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) - -#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) -#undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE -#endif -#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) - -#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) -#undef JSON_HEDLEY_CLANG_HAS_WARNING -#endif -#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) - -#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ - - -// This file contains all internal macro definitions (except those affecting ABI) -// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them - -// #include - - -// exclude unsupported compilers -#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) -#if defined(__clang__) -#if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 -#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" -#endif -#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) -#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 -#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" -#endif -#endif -#endif - -// C++ language standard detection -// if the user manually specified the used c++ version this is skipped -#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) -#if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) -#define JSON_HAS_CPP_20 -#define JSON_HAS_CPP_17 -#define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 -#define JSON_HAS_CPP_17 -#define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) -#define JSON_HAS_CPP_14 -#endif -// the cpp 11 flag is always specified because it is the minimal required version -#define JSON_HAS_CPP_11 -#endif - -#ifdef __has_include -#if __has_include() -#include -#endif -#endif - -#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) -#ifdef JSON_HAS_CPP_17 -#if defined(__cpp_lib_filesystem) -#define JSON_HAS_FILESYSTEM 1 -#elif defined(__cpp_lib_experimental_filesystem) -#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 -#elif !defined(__has_include) -#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 -#elif __has_include() -#define JSON_HAS_FILESYSTEM 1 -#elif __has_include() -#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 -#endif - -// std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ -#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif - -// no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support -#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif - -// no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support -#if defined(__clang_major__) && __clang_major__ < 7 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif - -// no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support -#if defined(_MSC_VER) && _MSC_VER < 1914 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif - -// no filesystem support before iOS 13 -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif - -// no filesystem support before macOS Catalina -#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#endif -#endif -#endif - -#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM -#define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 -#endif - -#ifndef JSON_HAS_FILESYSTEM -#define JSON_HAS_FILESYSTEM 0 -#endif - -#ifndef JSON_HAS_THREE_WAY_COMPARISON -#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ - && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L -#define JSON_HAS_THREE_WAY_COMPARISON 1 -#else -#define JSON_HAS_THREE_WAY_COMPARISON 0 -#endif -#endif - -#ifndef JSON_HAS_RANGES - // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error -#if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 -#define JSON_HAS_RANGES 0 -#elif defined(__cpp_lib_ranges) -#define JSON_HAS_RANGES 1 -#else -#define JSON_HAS_RANGES 0 -#endif -#endif - -#ifdef JSON_HAS_CPP_17 -#define JSON_INLINE_VARIABLE inline -#else -#define JSON_INLINE_VARIABLE -#endif - -#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) -#define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] -#else -#define JSON_NO_UNIQUE_ADDRESS -#endif - -// disable documentation warnings on clang -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" -#pragma clang diagnostic ignored "-Wdocumentation-unknown-command" -#endif - -// allow disabling exceptions -#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) -#define JSON_THROW(exception) throw exception -#define JSON_TRY try -#define JSON_CATCH(exception) catch(exception) -#define JSON_INTERNAL_CATCH(exception) catch(exception) -#else -#include -#define JSON_THROW(exception) std::abort() -#define JSON_TRY if(true) -#define JSON_CATCH(exception) if(false) -#define JSON_INTERNAL_CATCH(exception) if(false) -#endif - -// override exception macros -#if defined(JSON_THROW_USER) -#undef JSON_THROW -#define JSON_THROW JSON_THROW_USER -#endif -#if defined(JSON_TRY_USER) -#undef JSON_TRY -#define JSON_TRY JSON_TRY_USER -#endif -#if defined(JSON_CATCH_USER) -#undef JSON_CATCH -#define JSON_CATCH JSON_CATCH_USER -#undef JSON_INTERNAL_CATCH -#define JSON_INTERNAL_CATCH JSON_CATCH_USER -#endif -#if defined(JSON_INTERNAL_CATCH_USER) -#undef JSON_INTERNAL_CATCH -#define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER -#endif - -// allow overriding assert -#if !defined(JSON_ASSERT) -#include // assert -#define JSON_ASSERT(x) assert(x) -#endif - -// allow to access some private functions (needed by the test suite) -#if defined(JSON_TESTS_PRIVATE) -#define JSON_PRIVATE_UNLESS_TESTED public -#else -#define JSON_PRIVATE_UNLESS_TESTED private -#endif - -/*! -@brief macro to briefly define a mapping between an enum and JSON -@def NLOHMANN_JSON_SERIALIZE_ENUM -@since version 3.4.0 -*/ -#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ - template \ - inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ - { \ - static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if(std::begin(m), std::end(m), \ - [e](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.first == e; \ - }); \ - j = ((it != std::end(m)) ? it : std::begin(m))->second; \ - } \ - template \ - inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ - { \ - static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if(std::begin(m), std::end(m), \ - [&j](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.second == j; \ - }); \ - e = ((it != std::end(m)) ? it : std::begin(m))->first; \ - } - -// Ugly macros to avoid uglier copy-paste when specializing basic_json. They -// may be removed in the future once the class is split. - -#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ - template class ObjectType, \ - template class ArrayType, \ - class StringType, class BooleanType, class NumberIntegerType, \ - class NumberUnsignedType, class NumberFloatType, \ - template class AllocatorType, \ - template class JSONSerializer, \ - class BinaryType, \ - class CustomBaseClass> - -#define NLOHMANN_BASIC_JSON_TPL \ - basic_json - -// Macros to simplify conversion from/to types - -#define NLOHMANN_JSON_EXPAND( x ) x -#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME -#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ - NLOHMANN_JSON_PASTE64, \ - NLOHMANN_JSON_PASTE63, \ - NLOHMANN_JSON_PASTE62, \ - NLOHMANN_JSON_PASTE61, \ - NLOHMANN_JSON_PASTE60, \ - NLOHMANN_JSON_PASTE59, \ - NLOHMANN_JSON_PASTE58, \ - NLOHMANN_JSON_PASTE57, \ - NLOHMANN_JSON_PASTE56, \ - NLOHMANN_JSON_PASTE55, \ - NLOHMANN_JSON_PASTE54, \ - NLOHMANN_JSON_PASTE53, \ - NLOHMANN_JSON_PASTE52, \ - NLOHMANN_JSON_PASTE51, \ - NLOHMANN_JSON_PASTE50, \ - NLOHMANN_JSON_PASTE49, \ - NLOHMANN_JSON_PASTE48, \ - NLOHMANN_JSON_PASTE47, \ - NLOHMANN_JSON_PASTE46, \ - NLOHMANN_JSON_PASTE45, \ - NLOHMANN_JSON_PASTE44, \ - NLOHMANN_JSON_PASTE43, \ - NLOHMANN_JSON_PASTE42, \ - NLOHMANN_JSON_PASTE41, \ - NLOHMANN_JSON_PASTE40, \ - NLOHMANN_JSON_PASTE39, \ - NLOHMANN_JSON_PASTE38, \ - NLOHMANN_JSON_PASTE37, \ - NLOHMANN_JSON_PASTE36, \ - NLOHMANN_JSON_PASTE35, \ - NLOHMANN_JSON_PASTE34, \ - NLOHMANN_JSON_PASTE33, \ - NLOHMANN_JSON_PASTE32, \ - NLOHMANN_JSON_PASTE31, \ - NLOHMANN_JSON_PASTE30, \ - NLOHMANN_JSON_PASTE29, \ - NLOHMANN_JSON_PASTE28, \ - NLOHMANN_JSON_PASTE27, \ - NLOHMANN_JSON_PASTE26, \ - NLOHMANN_JSON_PASTE25, \ - NLOHMANN_JSON_PASTE24, \ - NLOHMANN_JSON_PASTE23, \ - NLOHMANN_JSON_PASTE22, \ - NLOHMANN_JSON_PASTE21, \ - NLOHMANN_JSON_PASTE20, \ - NLOHMANN_JSON_PASTE19, \ - NLOHMANN_JSON_PASTE18, \ - NLOHMANN_JSON_PASTE17, \ - NLOHMANN_JSON_PASTE16, \ - NLOHMANN_JSON_PASTE15, \ - NLOHMANN_JSON_PASTE14, \ - NLOHMANN_JSON_PASTE13, \ - NLOHMANN_JSON_PASTE12, \ - NLOHMANN_JSON_PASTE11, \ - NLOHMANN_JSON_PASTE10, \ - NLOHMANN_JSON_PASTE9, \ - NLOHMANN_JSON_PASTE8, \ - NLOHMANN_JSON_PASTE7, \ - NLOHMANN_JSON_PASTE6, \ - NLOHMANN_JSON_PASTE5, \ - NLOHMANN_JSON_PASTE4, \ - NLOHMANN_JSON_PASTE3, \ - NLOHMANN_JSON_PASTE2, \ - NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) -#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) -#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) -#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) -#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) -#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) -#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) -#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) -#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) -#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) -#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) -#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) -#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) -#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) -#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) -#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) -#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) -#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) -#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) -#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) -#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) -#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) -#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) -#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) -#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) -#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) -#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) -#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) -#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) -#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) -#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) -#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) -#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) -#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) -#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) -#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) -#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) -#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) -#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) -#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) -#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) -#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) -#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) -#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) -#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) -#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) -#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) -#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) -#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) -#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) -#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) -#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) -#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) -#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) -#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) -#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) -#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) -#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) -#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) -#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) -#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) -#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) -#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) -#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) - -#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; -#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); -#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); - -/*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_INTRUSIVE -@since version 3.9.0 -*/ -#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ - friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } - -#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ - friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } - -/*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE -@since version 3.9.0 -*/ -#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ - inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } - -#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ - inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } - - -// inspired from https://stackoverflow.com/a/26745591 -// allows to call any std function as if (e.g. with begin): -// using std::begin; begin(x); -// -// it allows using the detected idiom to retrieve the return type -// of such an expression -#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ - namespace detail { \ - using std::std_name; \ - \ - template \ - using result_of_##std_name = decltype(std_name(std::declval()...)); \ - } \ - \ - namespace detail2 { \ - struct std_name##_tag \ - { \ - }; \ - \ - template \ - std_name##_tag std_name(T&&...); \ - \ - template \ - using result_of_##std_name = decltype(std_name(std::declval()...)); \ - \ - template \ - struct would_call_std_##std_name \ - { \ - static constexpr auto const value = ::nlohmann::detail:: \ - is_detected_exact::value; \ - }; \ - } /* namespace detail2 */ \ - \ - template \ - struct would_call_std_##std_name : detail2::would_call_std_##std_name \ - { \ - } - -#ifndef JSON_USE_IMPLICIT_CONVERSIONS -#define JSON_USE_IMPLICIT_CONVERSIONS 1 -#endif - -#if JSON_USE_IMPLICIT_CONVERSIONS -#define JSON_EXPLICIT -#else -#define JSON_EXPLICIT explicit -#endif - -#ifndef JSON_DISABLE_ENUM_SERIALIZATION -#define JSON_DISABLE_ENUM_SERIALIZATION 0 -#endif - -#ifndef JSON_USE_GLOBAL_UDLS -#define JSON_USE_GLOBAL_UDLS 1 -#endif - -#if JSON_HAS_THREE_WAY_COMPARISON -#include // partial_ordering -#endif - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - /////////////////////////// - // JSON type enumeration // - /////////////////////////// - - /*! - @brief the JSON type enumeration - - This enumeration collects the different JSON types. It is internally used to - distinguish the stored values, and the functions @ref basic_json::is_null(), - @ref basic_json::is_object(), @ref basic_json::is_array(), - @ref basic_json::is_string(), @ref basic_json::is_boolean(), - @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), - @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), - @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and - @ref basic_json::is_structured() rely on it. - - @note There are three enumeration entries (number_integer, number_unsigned, and - number_float), because the library distinguishes these three types for numbers: - @ref basic_json::number_unsigned_t is used for unsigned integers, - @ref basic_json::number_integer_t is used for signed integers, and - @ref basic_json::number_float_t is used for floating-point numbers or to - approximate integers which do not fit in the limits of their respective type. - - @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON - value with the default value for a given type - - @since version 1.0.0 - */ - enum class value_t : std::uint8_t - { - null, ///< null value - object, ///< object (unordered set of name/value pairs) - array, ///< array (ordered collection of values) - string, ///< string value - boolean, ///< boolean value - number_integer, ///< number value (signed integer) - number_unsigned, ///< number value (unsigned integer) - number_float, ///< number value (floating-point) - binary, ///< binary array (ordered collection of bytes) - discarded ///< discarded by the parser callback function - }; - - /*! - @brief comparison operator for JSON types - - Returns an ordering that is similar to Python: - - order: null < boolean < number < object < array < string < binary - - furthermore, each type is not smaller than itself - - discarded values are not comparable - - binary is represented as a b"" string in python and directly comparable to a - string; however, making a binary array directly comparable with a string would - be surprising behavior in a JSON file. - - @since version 1.0.0 - */ -#if JSON_HAS_THREE_WAY_COMPARISON - inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* -#else - inline bool operator<(const value_t lhs, const value_t rhs) noexcept -#endif - { - static constexpr std::array order = { { - 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, - 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, - 6 /* binary */ - } - }; - - const auto l_index = static_cast(lhs); - const auto r_index = static_cast(rhs); -#if JSON_HAS_THREE_WAY_COMPARISON - if (l_index < order.size() && r_index < order.size()) - { - return order[l_index] <=> order[r_index]; // *NOPAD* - } - return std::partial_ordering::unordered; -#else - return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; -#endif - } - - // GCC selects the built-in operator< over an operator rewritten from - // a user-defined spaceship operator - // Clang, MSVC, and ICC select the rewritten candidate - // (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) -#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) - inline bool operator<(const value_t lhs, const value_t rhs) noexcept - { - return std::is_lt(lhs <=> rhs); // *NOPAD* - } -#endif - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - /*! - @brief replace all occurrences of a substring by another string - - @param[in,out] s the string to manipulate; changed so that all - occurrences of @a f are replaced with @a t - @param[in] f the substring to replace with @a t - @param[in] t the string to replace @a f - - @pre The search string @a f must not be empty. **This precondition is - enforced with an assertion.** - - @since version 2.0.0 - */ - template - inline void replace_substring(StringType& s, const StringType& f, - const StringType& t) - { - JSON_ASSERT(!f.empty()); - for (auto pos = s.find(f); // find first occurrence of f - pos != StringType::npos; // make sure f was found - s.replace(pos, f.size(), t), // replace with t, and - pos = s.find(f, pos + t.size())) // find next occurrence of f - { - } - } - - /*! - * @brief string escaping as described in RFC 6901 (Sect. 4) - * @param[in] s string to escape - * @return escaped string - * - * Note the order of escaping "~" to "~0" and "/" to "~1" is important. - */ - template - inline StringType escape(StringType s) - { - replace_substring(s, StringType{ "~" }, StringType{ "~0" }); - replace_substring(s, StringType{ "/" }, StringType{ "~1" }); - return s; - } - - /*! - * @brief string unescaping as described in RFC 6901 (Sect. 4) - * @param[in] s string to unescape - * @return unescaped string - * - * Note the order of escaping "~1" to "/" and "~0" to "~" is important. - */ - template - static void unescape(StringType& s) - { - replace_substring(s, StringType{ "~1" }, StringType{ "/" }); - replace_substring(s, StringType{ "~0" }, StringType{ "~" }); - } - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // size_t - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - /// struct to capture the start position of the current token - struct position_t - { - /// the total number of characters read - std::size_t chars_read_total = 0; - /// the number of characters read in the current line - std::size_t chars_read_current_line = 0; - /// the number of lines read - std::size_t lines_read = 0; - - /// conversion to size_t to preserve SAX interface - constexpr operator size_t() const - { - return chars_read_total; - } - }; - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-FileCopyrightText: 2018 The Abseil Authors -// SPDX-License-Identifier: MIT - - - -#include // array -#include // size_t -#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type -#include // index_sequence, make_index_sequence, index_sequence_for - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - template - using uncvref_t = typename std::remove_cv::type>::type; - -#ifdef JSON_HAS_CPP_14 - - // the following utilities are natively available in C++14 - using std::enable_if_t; - using std::index_sequence; - using std::make_index_sequence; - using std::index_sequence_for; - -#else - - // alias templates to reduce boilerplate - template - using enable_if_t = typename std::enable_if::type; - - // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h - // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. - - //// START OF CODE FROM GOOGLE ABSEIL - - // integer_sequence - // - // Class template representing a compile-time integer sequence. An instantiation - // of `integer_sequence` has a sequence of integers encoded in its - // type through its template arguments (which is a common need when - // working with C++11 variadic templates). `absl::integer_sequence` is designed - // to be a drop-in replacement for C++14's `std::integer_sequence`. - // - // Example: - // - // template< class T, T... Ints > - // void user_function(integer_sequence); - // - // int main() - // { - // // user_function's `T` will be deduced to `int` and `Ints...` - // // will be deduced to `0, 1, 2, 3, 4`. - // user_function(make_integer_sequence()); - // } - template - struct integer_sequence - { - using value_type = T; - static constexpr std::size_t size() noexcept - { - return sizeof...(Ints); - } - }; - - // index_sequence - // - // A helper template for an `integer_sequence` of `size_t`, - // `absl::index_sequence` is designed to be a drop-in replacement for C++14's - // `std::index_sequence`. - template - using index_sequence = integer_sequence; - - namespace utility_internal - { - - template - struct Extend; - - // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. - template - struct Extend, SeqSize, 0> - { - using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; - }; - - template - struct Extend, SeqSize, 1> - { - using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; - }; - - // Recursion helper for 'make_integer_sequence'. - // 'Gen::type' is an alias for 'integer_sequence'. - template - struct Gen - { - using type = - typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; - }; - - template - struct Gen - { - using type = integer_sequence; - }; - - } // namespace utility_internal - - // Compile-time sequences of integers - - // make_integer_sequence - // - // This template alias is equivalent to - // `integer_sequence`, and is designed to be a drop-in - // replacement for C++14's `std::make_integer_sequence`. - template - using make_integer_sequence = typename utility_internal::Gen::type; - - // make_index_sequence - // - // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, - // and is designed to be a drop-in replacement for C++14's - // `std::make_index_sequence`. - template - using make_index_sequence = make_integer_sequence; - - // index_sequence_for - // - // Converts a typename pack into an index sequence of the same length, and - // is designed to be a drop-in replacement for C++14's - // `std::index_sequence_for()` - template - using index_sequence_for = make_index_sequence; - - //// END OF CODE FROM GOOGLE ABSEIL - -#endif - -// dispatch utility (taken from ranges-v3) - template struct priority_tag : priority_tag < N - 1 > {}; - template<> struct priority_tag<0> {}; - - // taken from ranges-v3 - template - struct static_const - { - static JSON_INLINE_VARIABLE constexpr T value{}; - }; - -#ifndef JSON_HAS_CPP_17 - template - constexpr T static_const::value; -#endif - - template - inline constexpr std::array make_array(Args&& ... args) - { - return std::array { {static_cast(std::forward(args))...}}; - } - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // numeric_limits -#include // false_type, is_constructible, is_integral, is_same, true_type -#include // declval -#include // tuple - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -#include // random_access_iterator_tag - -// #include - -// #include - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN -namespace detail -{ - - template - struct iterator_types {}; - - template - struct iterator_types < - It, - void_t> - { - using difference_type = typename It::difference_type; - using value_type = typename It::value_type; - using pointer = typename It::pointer; - using reference = typename It::reference; - using iterator_category = typename It::iterator_category; - }; - - // This is required as some compilers implement std::iterator_traits in a way that - // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. - template - struct iterator_traits - { - }; - - template - struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> - : iterator_types - { - }; - - template - struct iterator_traits::value>> - { - using iterator_category = std::random_access_iterator_tag; - using value_type = T; - using difference_type = ptrdiff_t; - using pointer = T*; - using reference = T&; - }; - -} // namespace detail -NLOHMANN_JSON_NAMESPACE_END - -// #include - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN - -NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); - -NLOHMANN_JSON_NAMESPACE_END - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - - - -// #include - - -NLOHMANN_JSON_NAMESPACE_BEGIN - -NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); - -NLOHMANN_JSON_NAMESPACE_END - -// #include - -// #include - -// #include -// __ _____ _____ _____ -// __| | __| | | | JSON for Modern C++ -// | | |__ | | | | | | version 3.11.2 -// |_____|_____|_____|_|___| https://github.com/nlohmann/json -// -// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann -// SPDX-License-Identifier: MIT - -#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ -#define INCLUDE_NLOHMANN_JSON_FWD_HPP_ - -#include // int64_t, uint64_t -#include // map -#include // allocator -#include // string -#include // vector - -// #include - - -/*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -NLOHMANN_JSON_NAMESPACE_BEGIN - -/*! -@brief default JSONSerializer template argument - -This serializer ignores the template arguments and uses ADL -([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) -for serialization. -*/ -template -struct adl_serializer; - -/// a class to store JSON values -/// @sa https://json.nlohmann.me/api/basic_json/ -template class ObjectType = - std::map, - template class ArrayType = std::vector, - class StringType = std::string, class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = - adl_serializer, - class BinaryType = std::vector, // cppcheck-suppress syntaxError - class CustomBaseClass = void> - class basic_json; - -/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document -/// @sa https://json.nlohmann.me/api/json_pointer/ -template -class json_pointer; - -/*! -@brief default specialization -@sa https://json.nlohmann.me/api/json/ -*/ -using json = basic_json<>; - -/// @brief a minimal map-like container that preserves insertion order -/// @sa https://json.nlohmann.me/api/ordered_map/ -template -struct ordered_map; - -/// @brief specialization that maintains the insertion order of object keys -/// @sa https://json.nlohmann.me/api/ordered_json/ -using ordered_json = basic_json; - -NLOHMANN_JSON_NAMESPACE_END - -#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ - - -NLOHMANN_JSON_NAMESPACE_BEGIN -/*! -@brief detail namespace with internal helper functions - -This namespace collects functions that should not be exposed, -implementations of some @ref basic_json methods, and meta-programming helpers. - -@since version 2.1.0 -*/ -namespace detail -{ - - ///////////// - // helpers // - ///////////// - - // Note to maintainers: - // - // Every trait in this file expects a non CV-qualified type. - // The only exceptions are in the 'aliases for detected' section - // (i.e. those of the form: decltype(T::member_function(std::declval()))) - // - // In this case, T has to be properly CV-qualified to constraint the function arguments - // (e.g. to_json(BasicJsonType&, const T&)) - - template struct is_basic_json : std::false_type {}; - - NLOHMANN_BASIC_JSON_TPL_DECLARATION - struct is_basic_json : std::true_type {}; - - // used by exceptions create() member functions - // true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t - // false_type otherwise - template - struct is_basic_json_context : - std::integral_constant < bool, - is_basic_json::type>::type>::value - || std::is_same::value > - {}; - - ////////////////////// - // json_ref helpers // - ////////////////////// - - template - class json_ref; - - template - struct is_json_ref : std::false_type {}; - - template - struct is_json_ref> : std::true_type {}; - - ////////////////////////// - // aliases for detected // - ////////////////////////// - - template - using mapped_type_t = typename T::mapped_type; - - template - using key_type_t = typename T::key_type; - - template - using value_type_t = typename T::value_type; - - template - using difference_type_t = typename T::difference_type; - - template - using pointer_t = typename T::pointer; - - template - using reference_t = typename T::reference; - - template - using iterator_category_t = typename T::iterator_category; - - template - using to_json_function = decltype(T::to_json(std::declval()...)); - - template - using from_json_function = decltype(T::from_json(std::declval()...)); - - template - using get_template_function = decltype(std::declval().template get()); - - // trait checking if JSONSerializer::from_json(json const&, udt&) exists - template - struct has_from_json : std::false_type {}; - - // trait checking if j.get is valid - // use this trait instead of std::is_constructible or std::is_convertible, - // both rely on, or make use of implicit conversions, and thus fail when T - // has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) - template - struct is_getable - { - static constexpr bool value = is_detected::value; - }; - - template - struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> - { - using serializer = typename BasicJsonType::template json_serializer; - - static constexpr bool value = - is_detected_exact::value; - }; - - // This trait checks if JSONSerializer::from_json(json const&) exists - // this overload is used for non-default-constructible user-defined-types - template - struct has_non_default_from_json : std::false_type {}; - - template - struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> - { - using serializer = typename BasicJsonType::template json_serializer; - - static constexpr bool value = - is_detected_exact::value; - }; - - // This trait checks if BasicJsonType::json_serializer::to_json exists - // Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. - template - struct has_to_json : std::false_type {}; - - template - struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> - { - using serializer = typename BasicJsonType::template json_serializer; - - static constexpr bool value = - is_detected_exact::value; - }; - - template - using detect_key_compare = typename T::key_compare; - - template - struct has_key_compare : std::integral_constant::value> {}; - - // obtains the actual object key comparator - template - struct actual_object_comparator - { - using object_t = typename BasicJsonType::object_t; - using object_comparator_t = typename BasicJsonType::default_object_comparator_t; - using type = typename std::conditional < has_key_compare::value, - typename object_t::key_compare, object_comparator_t>::type; - }; - - template - using actual_object_comparator_t = typename actual_object_comparator::type; - - /////////////////// - // is_ functions // - /////////////////// - - // https://en.cppreference.com/w/cpp/types/conjunction - template struct conjunction : std::true_type { }; - template struct conjunction : B { }; - template - struct conjunction - : std::conditional(B::value), conjunction, B>::type {}; - - // https://en.cppreference.com/w/cpp/types/negation - template struct negation : std::integral_constant < bool, !B::value > { }; - - // Reimplementation of is_constructible and is_default_constructible, due to them being broken for - // std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). - // This causes compile errors in e.g. clang 3.5 or gcc 4.9. - template - struct is_default_constructible : std::is_default_constructible {}; - - template - struct is_default_constructible> - : conjunction, is_default_constructible> {}; - - template - struct is_default_constructible> - : conjunction, is_default_constructible> {}; - - template - struct is_default_constructible> - : conjunction...> {}; - - template - struct is_default_constructible> - : conjunction...> {}; - - - template - struct is_constructible : std::is_constructible {}; - - template - struct is_constructible> : is_default_constructible> {}; - - template - struct is_constructible> : is_default_constructible> {}; - - template - struct is_constructible> : is_default_constructible> {}; - - template - struct is_constructible> : is_default_constructible> {}; - - - template - struct is_iterator_traits : std::false_type {}; - - template - struct is_iterator_traits> - { - private: - using traits = iterator_traits; - - public: - static constexpr auto value = - is_detected::value && - is_detected::value && - is_detected::value && - is_detected::value && - is_detected::value; - }; - - template - struct is_range - { - private: - using t_ref = typename std::add_lvalue_reference::type; - - using iterator = detected_t; - using sentinel = detected_t; - - // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator - // and https://en.cppreference.com/w/cpp/iterator/sentinel_for - // but reimplementing these would be too much work, as a lot of other concepts are used underneath - static constexpr auto is_iterator_begin = - is_iterator_traits>::value; - - public: - static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; - }; - - template - using iterator_t = enable_if_t::value, result_of_begin())>>; - - template - using range_value_t = value_type_t>>; - - // The following implementation of is_complete_type is taken from - // https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ - // and is written by Xiang Fan who agreed to using it in this library. - - template - struct is_complete_type : std::false_type {}; - - template - struct is_complete_type : std::true_type {}; - - template - struct is_compatible_object_type_impl : std::false_type {}; - - template - struct is_compatible_object_type_impl < - BasicJsonType, CompatibleObjectType, - enable_if_t < is_detected::value&& - is_detected::value >> - { - using object_t = typename BasicJsonType::object_t; - - // macOS's is_constructible does not play well with nonesuch... - static constexpr bool value = - is_constructible::value && - is_constructible::value; - }; - - template - struct is_compatible_object_type - : is_compatible_object_type_impl {}; - - template - struct is_constructible_object_type_impl : std::false_type {}; - - template - struct is_constructible_object_type_impl < - BasicJsonType, ConstructibleObjectType, - enable_if_t < is_detected::value&& - is_detected::value >> - { - using object_t = typename BasicJsonType::object_t; - - static constexpr bool value = - (is_default_constructible::value && - (std::is_move_assignable::value || - std::is_copy_assignable::value) && - (is_constructible::value && - std::is_same < - typename object_t::mapped_type, - typename ConstructibleObjectType::mapped_type >::value)) || - (has_from_json::value || - has_non_default_from_json < - BasicJsonType, - typename ConstructibleObjectType::mapped_type >::value); - }; - - template - struct is_constructible_object_type - : is_constructible_object_type_impl {}; - - template - struct is_compatible_string_type - { - static constexpr auto value = - is_constructible::value; - }; - - template - struct is_constructible_string_type - { - // launder type through decltype() to fix compilation failure on ICPC -#ifdef __INTEL_COMPILER - using laundered_type = decltype(std::declval()); -#else - using laundered_type = ConstructibleStringType; -#endif - - static constexpr auto value = - conjunction < - is_constructible, - is_detected_exact>::value; - }; - - template - struct is_compatible_array_type_impl : std::false_type {}; - - template - struct is_compatible_array_type_impl < - BasicJsonType, CompatibleArrayType, - enable_if_t < - is_detected::value&& - is_iterator_traits>>::value && - // special case for types like std::filesystem::path whose iterator's value_type are themselves - // c.f. https://github.com/nlohmann/json/pull/3073 - !std::is_same>::value >> - { - static constexpr bool value = - is_constructible>::value; - }; - - template - struct is_compatible_array_type - : is_compatible_array_type_impl {}; - - template - struct is_constructible_array_type_impl : std::false_type {}; - - template - struct is_constructible_array_type_impl < - BasicJsonType, ConstructibleArrayType, - enable_if_t::value >> - : std::true_type {}; - - template - struct is_constructible_array_type_impl < - BasicJsonType, ConstructibleArrayType, - enable_if_t < !std::is_same::value && - !is_compatible_string_type::value&& - is_default_constructible::value && - (std::is_move_assignable::value || - std::is_copy_assignable::value) && - is_detected::value&& - is_iterator_traits>>::value&& - is_detected::value && - // special case for types like std::filesystem::path whose iterator's value_type are themselves - // c.f. https://github.com/nlohmann/json/pull/3073 - !std::is_same>::value&& - is_complete_type < - detected_t>::value >> - { - using value_type = range_value_t; - - static constexpr bool value = - std::is_same::value || - has_from_json::value || - has_non_default_from_json < - BasicJsonType, - value_type >::value; - }; - - template - struct is_constructible_array_type - : is_constructible_array_type_impl {}; - - template - struct is_compatible_integer_type_impl : std::false_type {}; - - template - struct is_compatible_integer_type_impl < - RealIntegerType, CompatibleNumberIntegerType, - enable_if_t < std::is_integral::value&& - std::is_integral::value && - !std::is_same::value >> - { - // is there an assert somewhere on overflows? - using RealLimits = std::numeric_limits; - using CompatibleLimits = std::numeric_limits; - - static constexpr auto value = - is_constructible::value && - CompatibleLimits::is_integer && - RealLimits::is_signed == CompatibleLimits::is_signed; - }; - - template - struct is_compatible_integer_type - : is_compatible_integer_type_impl {}; - - template - struct is_compatible_type_impl : std::false_type {}; - - template - struct is_compatible_type_impl < - BasicJsonType, CompatibleType, - enable_if_t::value >> - { - static constexpr bool value = - has_to_json::value; - }; - - template - struct is_compatible_type - : is_compatible_type_impl {}; - - template - struct is_constructible_tuple : std::false_type {}; - - template - struct is_constructible_tuple> : conjunction...> {}; - - template - struct is_json_iterator_of : std::false_type {}; - - template - struct is_json_iterator_of : std::true_type {}; - - template - struct is_json_iterator_of : std::true_type - {}; - - // checks if a given type T is a template specialization of Primary - template