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

Add support for frame advance #24

Closed
BLCRAFT210 opened this issue Nov 4, 2022 · 6 comments
Closed

Add support for frame advance #24

BLCRAFT210 opened this issue Nov 4, 2022 · 6 comments

Comments

@BLCRAFT210
Copy link

I would like to make a script that sets an input map, advances a frame or two, and then analyzes the graphical output before any further action. Is it possible to add a function that tells Dolphin to frame advance?

@Felk
Copy link
Owner

Felk commented Nov 6, 2022

Hello,

I'm afraid I don't quite understand what you are asking, because advancing frames is already possible, either with await event.frameadvance() or event.on_frameadvance(some_callback), as described in the readme. The only known problem in that regard is #13
Is there anything in particular you are missing?

@BLCRAFT210
Copy link
Author

BLCRAFT210 commented Nov 6, 2022

These two functions wait for Dolphin to advance a frame and then execute some code. I'm looking for a function that will let me control when Dolphin will advance a frame. In other words, I'm looking for a function that will do the equivalent of pressing F with my Hotkey setup:
image
There would be no callback or async, it would just be something like event.advance_frame()

@Felk
Copy link
Owner

Felk commented Nov 6, 2022

To better understand your usecase, what would the script be doing before advancing a frame? Is it waiting for a specific event? Would it be busylooping? And would you be running such a script while the game is paused?

@BLCRAFT210
Copy link
Author

I'm working on a project that will take a video of a Mario Kart Wii time trial and try to produce the same exact run on Dolphin so that we can recover lost ghosts. My basic idea for how to implement this is the following loop:

  1. Create a savestate of the current frame.
  2. Try a likely input configuration and advance a frame (maybe two or more are necessary, I'll have to figure it out later).
  3. Determine if Dolphin's output matches up with the video using computer vision.
  4. If yes, then we have the input for that frame figured out. If not, then load the savestate of the original frame and try a different likely input configuration.

This is just a rough draft of my program, but I believe that a frame advance function is necessary for this loop.

@BLCRAFT210
Copy link
Author

My project has changed at this point, but I would still like to be able to control frame advance.

@BLCRAFT210
Copy link
Author

Hello,

I'm afraid I don't quite understand what you are asking, because advancing frames is already possible, either with await event.frameadvance() or event.on_frameadvance(some_callback), as described in the readme. The only known problem in that regard is #13 Is there anything in particular you are missing?

Never mind, I understand what you mean here. Dolphin already waits for scripting advancing a frame, so frame advance isn't needed.

Felk pushed a commit that referenced this issue Sep 12, 2023
When a guest register is an immediate, it may be necessary to move this
value into a register. This is handled by gpr.R(), which lacks context
on how the register will be used. This leads to cases where the
immediate is written to a register, only for it to be overwritten. Take
for example this code generated by srwx:

0x5280031b   mov    w27, #0x18
0x53187edb   lsr    w27, w22, #24

gpr.BindToRegister() does have this context through the do_load
parameter, but didn't handle immediates. By adding this logic, we can
intelligently skip the write when do_load is false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants