Git Product home page Git Product logo

Comments (9)

BLCRAFT210 avatar BLCRAFT210 commented on August 17, 2024

Actually, I just tested the above program using a different savestate and it worked just fine. I don't know why it works with one savestate but not the other.

from dolphin.

BLCRAFT210 avatar BLCRAFT210 commented on August 17, 2024

Actually, I just tested the above program using a different savestate and it worked just fine. I don't know why it works with one savestate but not the other.

I found some potential clues to what causes these freezes. The savestate I mention here freezes on the second load when V-Sync is enabled, but it works fine again when V-Sync is disabled. I then found an easier fix which worked for all savestates I tested: setting the emulation speed limit to 10%.

I don't know much about how Dolphin or this branch works, but I have some guesses for what's going on here. I think the problem isn't with loading a savestate twice; it's with loading a savestate in the middle of emulation. It appears that somehow, giving Dolphin more time to fully load a savestate before it advances to the next frame fixes this problem. Therefore, this freeze may be caused by Dolphin trying to step to the next frame while savestate.load_from_file is in the middle of loading a savestate. Perhaps the Python function is missing something that Dolphin's savestate implementation does to prevent this problem.

from dolphin.

BLCRAFT210 avatar BLCRAFT210 commented on August 17, 2024

Also, as @VIPTankz found out, adding time.sleep(1) before loading the savestate fixes this.

from dolphin.

JimB16 avatar JimB16 commented on August 17, 2024

I use the savestate.load_from_file function a lot myself and I haven't had any big problems with it (Emulation Speed is 200% most of the times). I assume the reason is that I load my savestates while dolphin is interrupted with the frameadvance() event. The few times I seemed to have run into a problem I also assumed a timing misbehavior, but I haven't had any bigger issues that I could reproduce.

Looking at dolphins MainWindow::StateLoad() implementation of its GUI I can't see any code that would make sure that the timing is right for the SaveState loading or halt the emulation.

from dolphin.

BLCRAFT210 avatar BLCRAFT210 commented on August 17, 2024

@JimB16 what's an example of a program that loads savestates properly?

from dolphin.

Felk avatar Felk commented on August 17, 2024

Yeah, it's possible there's a bunch of issues wrt race conditions. I'll have to make a stresstest and see if more rigorous synchronization between python code and emulation will fix it. Thanks for bringing it up, I'll leave this issue open for now.

from dolphin.

benjaminjmiddleton avatar benjaminjmiddleton commented on August 17, 2024

I'm also experiencing the same issue, only none of the workarounds here seem to fix it, disabling VSync, making new save states, slowing emulator speed, using time.sleep() before or after loading.

Throwing my own (much more convoluted) workaround in for anyone else with this issue:

from pynput.keyboard import Controller, Key

keyboard = Controller()

# some code

# then, replace your savestate.load_from_slot(1) with the following
keyboard.press(Key.f1)
time.sleep(0.1)
keyboard.release(Key.f1)

This workaround requires that the highlighted window is Dolphin, and requires external packages. But it's working for me, so I'm throwing it out for anyone that might have the same issue.

from dolphin.

BLCRAFT210 avatar BLCRAFT210 commented on August 17, 2024

This should work even if the window isn't highlighted after checking Background Input in controller settings. I'll check if this works for me tomorrow.

from dolphin.

benjaminjmiddleton avatar benjaminjmiddleton commented on August 17, 2024

Thanks, I didn't know about that setting! I will try that when I get the chance later this week.

from dolphin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.