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
Fix SYSCONF movie settings #10839
Fix SYSCONF movie settings #10839
Conversation
dade6eb
to
e5c6be0
Compare
|
I'm not convinced your first change actually does anything? It already returns a nonconst pointer and I see no place that could possibly produce a copy. |
|
Also you probably need to explain the second one in more detail, how exactly does that fix the issue? e: Is that even safe? The generated loader (and layer) stores a pointer to the passed header, which would go out of scope at the end of |
Yep, the explanation seems a bit dubious to me. A const iterator (an iterator that is const) and a const_iterator are not the same thing, and the same overload of begin/end is being called regardless of the constness of the iterator variable in which you store the result of find_if. |
It's UB. You aren't allowed to modify the object from a const_iterator. I'm just saying the behavior I observed from this (I assume this is some "protection" against modification).
The header is only read once on construction from what I saw. I could change it to just use tmpHeader (or maybe just make this instance static there). It fixes the issue as it now stores the relevant sysconf settings to the movie layer, allowing it to pass the later predicate used for setting sysconf: dolphin/Source/Core/Core/BootManager.cpp Line 162 in 128fa8a
The type is const std::vector::const_iterator. This can plainly be seen in a debugger. You are not allowed to modify the object from a const_iterator. |
But there's no reason why For what it's worth, the inline type display in VS2022 shows it as |
|
It says |
Yes, when it's auto it's iterator, as the above function (that this PR modifies to be just auto rather than const auto) has. The below function is const auto, which has const_iterator. |
|
Again, that doesn't make any sense. Whether the member function is const qualified is what determines whether the const overload of begin/end gets called (and whether you get const_iterator or not). Const qualifying the variable does absolutely nothing and definitely does not change an iterator into a const_iterator. Note the underscore; those are different types. |
|
Ok, seems to go to iterator adding back the const auto. Weird, not sure what I was seeing then. Apologies then, I'll just revert that change back. |
8b8229c
to
9985680
Compare
|
Regarding the now remaining change: Doesn't this make it so that the "placeholder" header you're creating will override the user's settings? |
|
The "placeholder" header only contains settings the DTM would normally have and is filled with current settings at the time of starting the movie (with the |
|
Ah, so |
The movie config layer is not active for recording, only playback. Thus, recording ends up stuck with default SYSCONF settings. The fix is simply to add in the movie config layer when recording. The way it's done is a bit hacky, but seems to work.
9985680
to
581fd2b
Compare
|
Is there anything blocking this from being merged? |
|
Personally I'm not happy with more global state, and I also don't really understand why this works -- which also means I can't tell if this breaks anything. |
|
fwiw since I think our TAS setup logic needs a big overhaul anyway (like, in terms of letting the user configure what settings they want to start with) and since you're part of the TASing community (I think so, yeah?) if you're sure this works we can merge for now, probably... |
|
It works because the SYSCONF settings when recording a movie try to take them from the movie config layer specifically, and uses "default" settings otherwise (not sure how this is decided exactly, but moot anyways). This is intended so SYSCONF is set only with movie settings and other settings not exposed in the DTM go to predictable defaults rather than whatever is set otherwise. This movie config layer is only set when playing back a movie, not recording one, so this ends up breaking when recording a movie. Language is hit hard since "default" here means "English" even for e.g. Japanese games, which can just cause the game to immediately crash. Other SYSCONF settings are also affected but probably don't have the same impact language has here? This PR simply actually adds the movie config layer when recording a movie (also proceeds to remove it once the movie is done playing/recording, as it shouldn't be needed anymore). |
|
I'm still not 100% happy here but since this is well documented as a hack and very tiny, sure, whatever. |


The movie config layer is not active for recording, only playback. Thus, recording ends up stuck with default SYSCONF settings.
The fix somewhat hacky, but seems to work.
This fixes https://bugs.dolphin-emu.org/issues/12822