-
Notifications
You must be signed in to change notification settings - Fork 990
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
Feat(plugins): Reload game data without restarting the game #9868
base: master
Are you sure you want to change the base?
Conversation
I think we should have an apply button so it doesnt reload at every click of a plugin? |
what do you mean? |
|
|
so you would suggest an extra button next to open plugins? |
Maybe a new button at the right of the |
as I said:
|
Since when there's an uninstall button? |
there is not but I dont want conflicts between my own PRs: #9068 |
Oh I see! Then maybe on the left of the |
that feels like the wrong location, but sure |
I know, but that's the most 'non-wrong' free location if we take in count your other PR #9068... |
I think I will wait if someone else comes up with a better solution cause editing panels is a pain 😅 |
I dont think that would match ES UI style but I will keep the idea in mind |
True... |
Cant we just have uninstall to the right (as a plugin specific option) and restart to the left (next to open plugins)? |
Ah yes that would make sense |
This is amazing. |
Ahah yes. |
The loading circle now works properly |
I'm pretty sure I stumbled onto a bug / race condition. I was unloading this plugin and the game just kept showing 'now reloading data' with my cpu at 100%... Most of that is from kernel stuff which makes me think it's either some IO thing or locks not being managed properly. Interestingly, this issue only appears if I load and then unload the plugin in the same session; it does not happen if it was loaded on startup. It doesn't seem to matter if I do anything between loading and unloading the plugin, though. So far I have not found any other plugin that I can reproduce the issue with. |
That "Reload to apply changes" text seems to be a little close to the line for some reason? Also, probably a nitpick but I think just "Reloading plugin data..." without the "Now" would look better. |
I did not change that, it has the same position as in main branch
did that 👍 |
I can reproduce this. It seems to be stuck drawing an absurdly large starfield with logical-garbage looking parameters. When I Re-run using a libasan build, it crashes almost immediately when I click on the Reload button. It claims that the StarField is referencing a sprite that no longer exists:
Which it said was deleted here:
|
Is there a way to hide the reload button if there are no changes? Or do we want it to stay there as it could be useful for plugin development? |
That was my thought |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to quickly disable/enable a plugin but don't like to restart the game every time you switch between plugins?
But if you simply reload everything, what difference is there? You're just saving a couple of clicks on the executable. Is that worth it?
if(texture[0]) glDeleteTextures(1, &texture[0]); | ||
if(texture[1]) glDeleteTextures(1, &texture[1]); | ||
if(swizzleMask[0]) glDeleteTextures(1, &swizzleMask[0]); | ||
if(swizzleMask[1]) glDeleteTextures(1, &swizzleMask[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does adding this cause a delay when closing the game? Presumably it will? If so, we might want to manually unload the sprites instead of relying on the destructor.
Is this the case for sounds as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it out with high dpi and some other large plugins, and didn't really feel the difference. I didn't have a bunch of custom sounds to try it out with, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not notice any difference because either you do it here or the OS does it by itself at program end, will be the same result. only difference would be the checks, but I dont think that will make a large difference
|
||
// This loop is for the case of a data reload. | ||
do { | ||
Messenger::SetReload(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really a clean way of solving the problem. Probably best to do it using the existing Panel infrastructure instead of drawing this manually here in main. So say like clearing all panels, adding a new panel (kinda similar to GameLoadingPanel) that reloads all the resources.
Maybe you can even reuse GameLoadingPanel by doing some refactoring? Say by moving some common initializing code there instead of doing it in main. I'm not sure though.
|
Actually you save a lot of malloc calls because I just use clear(), which should lead to a quicker loading sequence. |
Feature
Related issue: #9137
Related PR: #9068
Summary
You want to quickly disable/enable a plugin but don't like to restart the game every time you switch between plugins?
In that case this PR is for you, this PR allows to reload all game data including images and sounds while in the game.
This will be even more helpful when it will be possible to install plugins in game, I always find it annoying to have to restart the game when I install something new.
As of now it is only possible to reload data when something got changed inside the plugins menu, I could make it so that it is always possible, which I imagine would be helpful to plugin authors who would be able to make changes while the game is running.
Some of the more technical aspects:
I know the visuals could be improved but I see that as a problem for later.
I also know that there might be alternative approaches like splitting game data between plugins and base game but I think that would make the code far more complex and is not worth the work.
Screenshots
Testing Done
Yes, I disabled a previously enabled plugin, used the button and all the content was gone, did the same in the other direction.
Performance Impact
N/A