Skip to content

Commit

Permalink
Avoid override of variable throttle for turbo.
Browse files Browse the repository at this point in the history
It is not needed to set `throttle` on neither case. There is actually a
bug when using turbo/speedup and closing the emulator. The test case
is the following:

#627

On Windows:

1. use opengl;
2. load GBA game;
3. set throttle to `100%`;
4. set turbo throttle to `200%`;
5. enable turbo on menu;
6. save game;
7. close emulator && open emulator;
8. load GBA game;

==>

throttle is `200%`.

This is definitely not expected.
  • Loading branch information
denisfa committed Jun 17, 2020
1 parent bd2483c commit 6b257d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gb/GB.cpp
Expand Up @@ -4953,7 +4953,7 @@ void gbEmulate(int ticksToStop)
if (turbo_button_pressed) {
if (!speedup_throttle_set && throttle != speedup_throttle) {
last_throttle = throttle;
throttle = speedup_throttle;
//throttle = speedup_throttle;
soundSetThrottle(speedup_throttle);
speedup_throttle_set = true;
}
Expand All @@ -4970,7 +4970,7 @@ void gbEmulate(int ticksToStop)
framesToSkip = speedup_frame_skip;
}
else if (speedup_throttle_set) {
throttle = last_throttle;
//throttle = last_throttle;
soundSetThrottle(last_throttle);

speedup_throttle_set = false;
Expand Down
4 changes: 2 additions & 2 deletions src/gba/GBA.cpp
Expand Up @@ -3799,7 +3799,7 @@ void CPULoop(int ticks)
if (turbo_button_pressed) {
if (!speedup_throttle_set && throttle != speedup_throttle) {
last_throttle = throttle;
throttle = speedup_throttle;
//throttle = speedup_throttle;
soundSetThrottle(speedup_throttle);
speedup_throttle_set = true;
}
Expand All @@ -3816,7 +3816,7 @@ void CPULoop(int ticks)
framesToSkip = speedup_frame_skip;
}
else if (speedup_throttle_set) {
throttle = last_throttle;
//throttle = last_throttle;
soundSetThrottle(last_throttle);

speedup_throttle_set = false;
Expand Down

0 comments on commit 6b257d5

Please sign in to comment.