Comments (1)
I would say that in general the game directory search code is poorly designed in terms of performance and this is definitely my fault (but at the time I did it I didn't really think about optimization at all), since at the moment every time the function is called to get the game directory, a large number of different operations take place (allocating and freeing of 1024 bytes for local variable [max game directory length in engine code is 260
, so that 1024 size is even incorrect], strlen
/ while
loops / strncpy
from COM_FileBase to convert from absolute to relative path, and we also convert it all to lowercase at the end) as a result of which we will have the same result throughout the entire process (since the initial data, i.e. the game directory can only change when restarting or exiting the game, the rest of the time it will be the same)
This means that we need initialize only once, store the result globally in memory, and simply return that for all subsequent calls to that function
This also includes setting boolean variables that serve to identify some of the games; we can set them once in the same function in which we initialize the process of finding and processing the game directory and use this
This is what I did in #516 request:
https://github.com/SmileyAG/BunnymodXT/blob/b1082da20599e1da86e1daeb34537c49fa8cf02b/BunnymodXT/modules/ClientDLL.cpp#L1183-L1211
https://github.com/SmileyAG/BunnymodXT/blob/b1082da20599e1da86e1daeb34537c49fa8cf02b/BunnymodXT/helper_functions.hpp#L34-L52
https://github.com/SmileyAG/BunnymodXT/blob/b1082da20599e1da86e1daeb34537c49fa8cf02b/BunnymodXT/helper_functions.cpp#L268-L284
https://github.com/SmileyAG/BunnymodXT/blob/b1082da20599e1da86e1daeb34537c49fa8cf02b/BunnymodXT/helper_functions.cpp#L485-L512
Another question is that it is not particularly clear where exactly it is best to call in the game functions, because we prefer to call immediately after the game directory has already been initialized, preferably this should use the hooks we already have (it would great if it would be exported ones such as HUD_Init
)
So, as a temporary and alternative solution, macros were placed to initialize the game directory in those places where they are used if the directory has not yet been initialized
from bunnymodxt.
Related Issues (20)
- Read the class name, member name, offset and size from our specified global variable by modification that support us HOT 1
- [Windows] Find cmd functions from linked list instead of using patterns
- Detailed guideline of how to support other versions/mods, better ways of implementing features and strict code design
- Logging CRC32 or MD5 of client, server binaries and map to BXT data
- Use save data to find offsets for the most of class variables
- CoF: always return a positive result for -launchapp or -nolaunchappwarn in 'hudCheckParm' engine function
- Set IN_JUMP for m_afButtonPressed in CBasePlayer::Jump to fix the incorrect behavior of bxt_autojump
- Pattern-less implementation of bxt_render_far_entities
- CoF: pattern-less implementation of bypassing the noclip unset
- Support of loading larger maps
- Give an error and close the game if metamod is enabled HOT 8
- Concept of expanding origin limit for temp entities HOT 3
- Setting noclip velocity
- KZ Timer
- MPBhop
- SDL2 and libSDL2 error when using HLSR to inject BXT HOT 2
- Reformat patterns file
- Crash problem HOT 4
- cant find bunnymodxt.dll HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bunnymodxt.