-
Notifications
You must be signed in to change notification settings - Fork 2
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
Locating textures in the map without reloading #2
base: main
Are you sure you want to change the base?
Locating textures in the map without reloading #2
Conversation
Wow this is truly amazing! Thanks a lot for the impressive work! I've never thought of anything like this. On the other hand, as BVE5 is not open-source, and the BVE5 community has a strong atmosphere of copyright, since a lot of reflection is used on the assembly of BVE in order to obtain the references, I am a bit afraid that some community members would consider it reverse-engineering, consider reverse-engineering copyright infringement, and accuse us for this. |
Thank you for your reply!
Yes, but since the class searches for textures in a way that is independent of the BVE5/6 sources enough, I do not think this implementation is a copyright infringement. The most important point is that the class searches for textures simply by enumerating instances created by BVE - it means largely independent of the structure of BVE's own classes. DXDynamicTexture/TextureManager.PostInstantiateTexturePatcher.cs Lines 81 to 129 in e1cb61c
Here are the BVE5/6 sources on which the The fact that "main form has a Time and Position form type field"DXDynamicTexture/TextureManager.PostInstantiateTexturePatcher.cs Lines 34 to 36 in e1cb61c
The class searches for an instance of the Time and Position form from the main form of BVE, which is publicly accessible by The name of the Time and Position form
The class references the A class that defines
|
P.S. Sorry for that the article is written all in Japanese. According to the article, a 2019 amendment to Japan's Copyright Act made it legal to reverse-engineer in order to develop some software that works with another software. There does not seem to be a legal issue in Japan, too! |
Thanks a lot for your help! |
I'm terribly sorry to keep you waiting for such a long time. Primarily speaking, I wonder if something could be done to further increase the speed of enumerating textures. It mainly breaks down to:
I have wanted to test them out myself, but I am currently being occupied by some school activities, so I figured I'll just write them down for now. You can try these if you feel like to, or I'll get back to it later after the activities settle down, probably after a few months. |
Don't worry about it! Give priority to schoolwork. |
Thanks for the help! I'd recommend replacing LINQ with plain for loops; some LINQ calls aren't very efficient in execution speed. If it can be done fast enough, we can even remove Harmony and do all texture patching with this method, so that we can eliminate a (potentially instable) dependency. |
LINQ - Since all elements of Caching - I cannot understand why I didn't make those members static... Changed them to static and set only once. Expression, generating bytecode - Now WIP! For now, I've succeeded in reducing the processing time to 10-12 seconds. Hopefully I can reduce it further. |
b6c950d
to
fc36f14
Compare
I refactored my code. Replaced some of the LINQ with plain loops, made the FieldInfos static and set only once, and changed a few other small things. Here is a comparison of processing speeds:
* Tested five times for each case. I think 3 seconds to patch the texture is not too slow, what do you think? Do you think it is fast enough to remove Harmony? I would be glad to try it on your computer and get your opinion (no rush!). |
I'm so sorry that I sorta abandoned the project and kept you waiting for so long. In view of the rapid development of your AtsEX plugin, which is of high quality and rich in feature, I think it already appears as a superset of DXDynamicTexture, thus it makes less sense to use DXDynamicTexture alone and it has now became proper to integrate DXDynamicTexture's entire functionality into AtsEX. May I hear your opinion on this? |
This PR allows to locate textures in the map without reloading the scenario.
Changes
TextureManager.PostInstantiateTexturePatcher
classTexture
ofMaterial
, and replace the target textures.ProgressForm
class, which displays the current progress of searching and replacing (see "UI Sample" for more details)TextureManager.PreInstantiateTexturePatcher
classbool
parameter toTextureManager.Initialize
methodUI Sample
DXDTTest.mp4
NOTE: If all of
TextureManager.Handles
have been created (=TextureManager.Handles.All(h => h.IsCreated)
), the search and replace process is skipped even if theTextureManager.Initialize
method parameter istrue
.