Skip to content
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

Emulator Freezing #1757

Open
RaijinXBlade opened this issue Jan 8, 2025 · 8 comments
Open

Emulator Freezing #1757

RaijinXBlade opened this issue Jan 8, 2025 · 8 comments

Comments

@RaijinXBlade
Copy link

Sorry if this has been reported somewhere already, but the Emulator freezes when clicking a menu too fast after launching it, and can only be closed through the Task Manager (Win10 here).

Reproduce simply by opening the emulator and trying to click Load, Settings, or Help right away.

Expected behavior would be for the drop down to appear with some delay after the Emulator finishes loading I suppose, or maybe to forego user inputs until it's done.

@remutro
Copy link
Contributor

remutro commented Jan 8, 2025

I'm not sure if the root cause will be the same as when I experienced this problem but I did run into something similar. You normally can't click on anything in the menu until the app is fully initialized and you know it is complete when the word "unloaded" appears in the bottom right of the status bar. It was taking up to 45 seconds sometimes on my system (which isn't slow by any means). I had tracked it down to SDL input initialization and it appeared to be some interaction with DirectInput. It wasn't just ares, I couldn't open the controller control panel app (joy.cpl) without it hanging/freezing all the time also.

Try doing the following and see if the problem goes away . Create an environment variable with the following name and value assigned:

Variable Name: SDL_DIRECTINPUT_ENABLED
Variable Value: 0

After the environment variable is set, relaunch ares. With any luck, initialization should be almost instant. Please report back if this works for you.

@RaijinXBlade
Copy link
Author

I gave it a try, but it still freezes.

@remutro
Copy link
Contributor

remutro commented Jan 8, 2025

Hmm... OK. Can you open task manager and then open ares and see if the amount of memory ares is using is continuing to climb?

If you wait long enough, like a minute or two, does it eventually initialize (you don't want to click or interact with the window until it is fully initialized).

@RaijinXBlade
Copy link
Author

It only takes a couple of seconds for Ares to finish initialisation, and RAM gets to about ~135MB. I'm not sure what you mean by waiting for minutes. Maybe I explained something poorly.

@remutro
Copy link
Contributor

remutro commented Jan 8, 2025

I suppose I'm misunderstanding. If it only takes a few seconds to load then there shouldn't be too much of an issue. But if you do start clicking on the menu prior to initialization completing, which you know is done when "unloaded" is visible in the bottom right of the status bar, and that is because the initialization and window handling occurs on the same thread at the moment and clicking prior to init complete it can jam things up some times. We are looking at moving some of this stuff off the main GUI thread so that it always remains responsive.

So if it initializes in seconds (again, with "unloaded" appearing in the bottom right of the status bar), just don't click before it appears. If it happens after init complete and "unloaded" is visible then that is a different scenario and I'm not aware of any menu issues after init.

@RaijinXBlade
Copy link
Author

Yeah, you got it. It happens by clicking before initilisation has finished. I know you simply have to wait for it, but of course I reported it because it's an odd one that I run into sometimes by clicking something too fast due to forgetting about it. It appears like it's a known issue though by what you say, so that's good.

@FitzRoyX
Copy link
Contributor

On Win11 I haven't experienced as many problems with this. But the long and short of it is that ares has a cross platform wrapper called hiro, and translation layers rarely work as well as native implementations. Every API wants things done in a specific order and the featuresets are not the same. In this case, I don't think Windows likes the fact that ares is trying to dynamically create and destroy things in the menu based on what rom is loaded.

@RaijinXBlade
Copy link
Author

RaijinXBlade commented Jan 13, 2025

From what you say, it seems to suggest that I loaded a rom, but there isn't any rom loading, just the emulator itself is opened and initialising, though I'm no programmer and may be misunderstanding. I figured I had already understood from what remutro said before though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants