-
-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow load custom IMG containers #1677
Conversation
A new way to replace model. This way uses separate thread to read model file. Edit: it was debug code |
I thought i can allocate new object models only after img functions. I will add another PR only with this feature. |
The thing with |
This reverts commit bfa404d.
Theres an issue, called Heres the stream memory => cache memory mapping. It's totally wrong, as vehicle models can be a few megabytes in size now. mtasa-blue/Client/core/CModelCacheManager.cpp Lines 222 to 228 in 3f93481
The solution is to either:
I did a test (removed all the code of it), and everything seems to work just fine. @Dutchman101 there is some crash fixing code (related to vehicle upgrades), do you know what it fixes? @ccw808 Any idea what it was built for, what issues does it fix? Edit - Used git blame in VS, and found commit the commit in which it was added (fefd088). I really want to just remove it, but it seems like there's a good reason for its existence. Sadly it uses way too much RAM with this PR. (And also glitches out the game, as these models basically can't be freed by GTA) |
I don't really know, but because that crash fix uses report ID 8544 i can tell (from metrics) that approximately 70 users have had it trigger during the past month. Maybe it's very old but after all it's still firing for those users, so i guess if it was cut out they would've crashed there. But as if it appears to be the report ID is only used in a certain condition (not the entire crashfix - just "if LowestUnsafeUpgrade has fallen"), true averted crash count will probably be higher. So unless you understand the crash reason and how to fix it in a better way I'd advise not to touch it. |
Yeah, but the issue is that, people now may replace these upgrades with the img, and if the upgrades are big (in file size), then this will use a lot of memory (as from what I understand all upgrades are pre-streamed). |
Is it ready? I think it is a useful feature. |
No, but on the wiki is an usefun function that works as well. |
This feature is ready now |
Merge conflicts must be resolved. |
Fixed |
@TheNormalnij For objects seems not working properly. Collisions loaded, used only restream Test resource: |
Can be avoided via |
Yes, it's working fine with timer, tested. Maybe put a warning/infobox into wiki when this will be merged. But i've found another thing, when you load vehicle model to incomatible model (eg. car mod to bike) game will instant crash. |
#2866 makes timer unnecessary
I think, we can't fix all cases. Any additional checks will slow down performance, when you link IMG files to models. |
I've noticed something, all engine* functions are supporting raw data except this. Possible to add raw data support to engineLoadIMG? Cause if you wan't to protect your models, you need to compile it with some method like tea, aes128 and impossible to load if function doesn't supporting it. |
What do you mean by "raw data"? |
This feature will save client RAM memory and model replacing time.
API:
How to replace model with this feature:
Test:
cv 411
Limits:
You can load 2 IMG's. It's GTA limitation, but I hope limit can be changed.
IMG size can't bigger that 1GB (MTA limitation)