mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
Add fast forward option
This commit is contained in:
@@ -3002,3 +3002,6 @@ msgstr ""
|
||||
|
||||
msgid "&Allow recompilation"
|
||||
msgstr ""
|
||||
|
||||
msgid "&Fast forward"
|
||||
msgstr ""
|
||||
|
||||
@@ -100,6 +100,7 @@ extern int qt_nvr_save(void);
|
||||
extern void exit_pause(void);
|
||||
|
||||
bool cpu_thread_running = false;
|
||||
bool fast_forward = false;
|
||||
}
|
||||
|
||||
#include <locale.h>
|
||||
@@ -452,7 +453,7 @@ main_thread_fn()
|
||||
#endif
|
||||
drawits += static_cast<int>(new_time - old_time);
|
||||
old_time = new_time;
|
||||
if (drawits > 0 && !dopause) {
|
||||
if ((drawits > 0 || fast_forward) && !dopause) {
|
||||
/* Yes, so run frames now. */
|
||||
do {
|
||||
#ifdef USE_INSTRUMENT
|
||||
@@ -478,8 +479,9 @@ main_thread_fn()
|
||||
}
|
||||
|
||||
drawits -= force_10ms ? 10 : 1;
|
||||
if (drawits > 50)
|
||||
if (drawits > 50 || fast_forward)
|
||||
drawits = 0;
|
||||
|
||||
} while (drawits > 0);
|
||||
} else {
|
||||
/* Just so we dont overload the host OS. */
|
||||
|
||||
@@ -65,6 +65,7 @@ extern int qt_nvr_save(void);
|
||||
#endif
|
||||
|
||||
extern bool cpu_thread_running;
|
||||
extern bool fast_forward;
|
||||
};
|
||||
|
||||
#include <QGuiApplication>
|
||||
@@ -2135,6 +2136,12 @@ MainWindow::on_actionUpdate_mouse_every_CPU_frame_triggered()
|
||||
config_save();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_action_Fast_forward_triggered()
|
||||
{
|
||||
fast_forward ^= 1;
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionRemember_size_and_position_triggered()
|
||||
{
|
||||
|
||||
@@ -141,6 +141,7 @@ private slots:
|
||||
void on_actionPreferences_triggered();
|
||||
void on_actionEnable_Discord_integration_triggered(bool checked);
|
||||
void on_actionRenderer_options_triggered();
|
||||
void on_action_Fast_forward_triggered();
|
||||
|
||||
void refreshMediaMenu();
|
||||
void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool *done = nullptr);
|
||||
|
||||
@@ -78,6 +78,8 @@
|
||||
<addaction name="actionAuto_pause"/>
|
||||
<addaction name="actionPause"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Fast_forward"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionForce_interpretation"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionHard_Reset"/>
|
||||
@@ -311,6 +313,8 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionTake_screenshot"/>
|
||||
<addaction name="actionCopy_screenshot"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Fast_forward"/>
|
||||
</widget>
|
||||
<action name="actionForce_interpretation">
|
||||
<property name="icon">
|
||||
@@ -1069,6 +1073,18 @@
|
||||
<string>&8x</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Fast_forward">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qt_resources.qrc">
|
||||
<normaloff>:/settings/qt/icons/fast_forward.ico</normaloff>:/settings/qt/icons/fast_forward.ico</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Fast forward</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <sys/audioio.h>
|
||||
#include <sys/param.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#define I_MIDI 6
|
||||
|
||||
static int audio[7] = {-1, -1, -1, -1, -1, -1, -1};
|
||||
extern bool fast_forward;
|
||||
|
||||
#ifdef USE_NEW_API
|
||||
static struct audio_swpar info[7];
|
||||
@@ -104,7 +106,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size)
|
||||
double gain;
|
||||
int target_rate;
|
||||
|
||||
if(audio[src] == -1)
|
||||
if(audio[src] == -1 || fast_forward)
|
||||
return;
|
||||
|
||||
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#undef AL_API
|
||||
#undef ALC_API
|
||||
@@ -313,6 +314,7 @@ inital(void)
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
extern bool fast_forward;
|
||||
void
|
||||
givealbuffer_common(const void *buf, const uint8_t src, const int size, const int freq)
|
||||
{
|
||||
@@ -320,7 +322,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in
|
||||
int state;
|
||||
ALuint buffer;
|
||||
|
||||
if (!initialized)
|
||||
if (!initialized || fast_forward)
|
||||
return;
|
||||
|
||||
alGetSourcei(source[src], AL_SOURCE_STATE, &state);
|
||||
@@ -331,7 +333,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in
|
||||
|
||||
alGetSourcei(source[src], AL_BUFFERS_PROCESSED, &processed);
|
||||
if (processed >= 1) {
|
||||
const double gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
const double gain = (sound_muted) ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
alListenerf(AL_GAIN, (float) gain);
|
||||
|
||||
alSourceUnqueueBuffers(source[src], 1, &buffer);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@@ -32,6 +33,7 @@
|
||||
#define I_FDD 5
|
||||
#define I_HDD 6
|
||||
|
||||
extern bool fast_forward;
|
||||
static struct sio_hdl* audio[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
static struct sio_par info[7];
|
||||
static int freqs[7] = { SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, SOUND_FREQ, 0 };
|
||||
@@ -83,7 +85,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size)
|
||||
int conv_size;
|
||||
double gain;
|
||||
int target_rate;
|
||||
if (audio[src] == NULL)
|
||||
if (audio[src] == NULL || fast_forward)
|
||||
return;
|
||||
|
||||
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -56,6 +57,8 @@ static IXAudio2SourceVoice *srcvoicecd = NULL;
|
||||
static IXAudio2SourceVoice *srcvoicefdd = NULL;
|
||||
static IXAudio2SourceVoice *srcvoicehdd = NULL;
|
||||
|
||||
extern bool fast_forward;
|
||||
|
||||
#define FREQ SOUND_FREQ
|
||||
#define BUFLEN SOUNDBUFLEN
|
||||
|
||||
@@ -258,7 +261,7 @@ closeal(void)
|
||||
void
|
||||
givealbuffer_common(const void *buf, IXAudio2SourceVoice *sourcevoice, const size_t buflen)
|
||||
{
|
||||
if (!initialized)
|
||||
if (!initialized || fast_forward)
|
||||
return;
|
||||
|
||||
(void) IXAudio2MasteringVoice_SetVolume(mastervoice, sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0),
|
||||
|
||||
@@ -63,6 +63,7 @@ int update_icons;
|
||||
int kbd_req_capture;
|
||||
int hide_status_bar;
|
||||
int hide_tool_bar;
|
||||
bool fast_forward = false; // Technically unused.
|
||||
int fixed_size_x = 640;
|
||||
int fixed_size_y = 480;
|
||||
extern int title_set;
|
||||
@@ -596,10 +597,10 @@ main_thread(UNUSED(void *param))
|
||||
#endif
|
||||
|
||||
old_time = new_time;
|
||||
if (drawits > 0 && !dopause) {
|
||||
if ((drawits > 0 || fast_forward) && !dopause) {
|
||||
/* Yes, so do one frame now. */
|
||||
drawits -= force_10ms ? 10 : 1;
|
||||
if (drawits > 50)
|
||||
if (drawits > 50 || fast_forward)
|
||||
drawits = 0;
|
||||
|
||||
/* Run a block of code. */
|
||||
|
||||
Reference in New Issue
Block a user