Skip to content

Commit 0bfdf09

Browse files
committed
unlock video sync earlier and slightly increase audio sample rate
1 parent b84f16a commit 0bfdf09

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

source/switch/draw.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ extern u32 currentFBHeight;
3636
#define COLOR_GREY_MEDIUM MakeColor(94, 94, 94, 255)
3737
#define COLOR_GREY_LIGHT MakeColor(138, 138, 138, 255)
3838

39-
#define font24 7
40-
#define font16 5
41-
#define font14 4
39+
enum
40+
{
41+
font24 = 7,
42+
font16 = 5,
43+
font14 = 4,
44+
fontSizesCount = 3
45+
};
4246

4347
extern u8* currentFB;
4448
extern u32 currentFBWidth;

source/switch/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ u32 currentFBHeight;
3434
#define MIN(a, b) ((a) < (b) ? (a) : (b))
3535
#define MAX(a, b) ((a) > (b) ? (a) : (b))
3636
#define SECONDS_PER_TICKS (1.0 / 19200000)
37-
#define TARGET_FRAMETIME (1.0 / 59.8260982880808)
37+
#define TARGET_FRAMETIME (1.0 / 60.0)
3838

3939
uint8_t libretro_save_buf[0x20000 + 0x2000]; /* Workaround for broken-by-design GBA save semantics. */
4040

@@ -225,7 +225,7 @@ static void gba_init(void) {
225225

226226
doMirroring(mirroringEnable);
227227

228-
soundSetSampleRate(AUDIO_SAMPLERATE);
228+
soundSetSampleRate(AUDIO_SAMPLERATE + 10); // slight oversampling makes the sound better
229229

230230
#if HAVE_HLE_BIOS
231231
bool usebios = false;
@@ -556,6 +556,8 @@ int main(int argc, char *argv[]) {
556556
rgba8888dst += 8 * 4;
557557
}
558558

559+
mutexUnlock(&videoLock);
560+
559561
condvarWakeOne(&requestFrameCond);
560562

561563
u32 *srcImage = conversionBuffer;
@@ -615,8 +617,6 @@ int main(int argc, char *argv[]) {
615617
dst = ((u32 *)currentFB) + offsetX + (y * intScale + offsetY) * currentFBWidth;
616618
}
617619
}
618-
619-
mutexUnlock(&videoLock);
620620
}
621621

622622
bool actionStopEmulation = false;
@@ -758,7 +758,7 @@ int main(int argc, char *argv[]) {
758758
frameTimeFrames = 0;
759759
}
760760
#endif
761-
761+
762762
gfxFlushBuffers();
763763
gfxSwapBuffers();
764764
gfxWaitForVsync();

0 commit comments

Comments
 (0)