diff --git a/CHANGES.md b/CHANGES.md index e8562f4c35..beeb72682c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,16 +4,18 @@ - ANDROID: Provide default save / system / state / screenshot locations - AUDIO: Audio mixer supports MOD/S3M/XM file types now! - INPUT: input swap override flag (for remotes) is cleared correctly -- COMMON: Add 'Delete Core'option to Core Information menu. +- COMMON: Add 'Delete Core' option to Core Information menu. - COMMON: Allow Max Timing Skew to be set to 0. - COMMON: Change the "content dir" behavior so it works on either a flag or an empty directory setting, now platform drivers can provide defaults for save / system / state / screenshot dirs and still allow the content dir functionality, these settings are under settings / saving and flagged as advanced - LOCALIZATION: Update Russian translation - WINDOWS: Provide default save / system / state / screenshot locations +- LOBBIES: Show what country the host is in +- MENU: Enable OSD text rendering for gdi and libcaca drivers - WINDOWS 98/ME/2K: Set default directory for MSVC 2005 RetroArch version. - WIIU: Exception handler rewritten. # 1.6.3 -- IOS: Fix GL regression - 32bit color format cores were no longer rendering +- IOS: Fix GL regression - 32bit color format cores were no longer rendering - CHEEVOS: Add support for N64 cheevos and other small fixes. - CHEEVOS: Add 'Achievements -> Achievements Verbose Mode'. Ability to display cheevos related messages in OSD, useful for RetroAchievements users. - AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted. diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index f7f6cfeef8..1b1e050642 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -92,6 +92,9 @@ static volatile bool g_draw_done = false; static bool g_vsync = false; static uint32_t g_orientation = 0; +static uint32_t retraceCount; +static uint32_t referenceRetraceCount; + static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32); static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32); static size_t display_list_size; @@ -213,9 +216,15 @@ unsigned menu_gx_resolutions[][2] = { static void retrace_callback(u32 retrace_count) { + u32 level = 0; + (void)retrace_count; + g_draw_done = true; OSSignalCond(g_video_cond); + _CPU_ISR_Disable(level); + retraceCount = retrace_count; + _CPU_ISR_Restore(level); } static bool gx_isValidXOrigin(int origin) @@ -249,7 +258,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, VIDEO_SetPostRetraceCallback(NULL); g_draw_done = false; /* wait for next even field */ - /* this prevents screen artefacts when switching + /* this prevents screen artifacts when switching * between interlaced & non-interlaced modes */ do VIDEO_WaitVSync(); while (!VIDEO_GetNextField()); @@ -293,13 +302,13 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, max_height = VI_MAX_HEIGHT_MPAL; break; case VI_EURGB60: - max_width = VI_MAX_WIDTH_NTSC; - max_height = VI_MAX_HEIGHT_NTSC; + max_width = VI_MAX_WIDTH_EURGB60; + max_height = VI_MAX_HEIGHT_EURGB60; break; default: tvmode = VI_NTSC; - max_width = VI_MAX_WIDTH_EURGB60; - max_height = VI_MAX_HEIGHT_EURGB60; + max_width = VI_MAX_WIDTH_NTSC; + max_height = VI_MAX_HEIGHT_NTSC; break; } @@ -575,6 +584,10 @@ static void init_vtx(void *data, const video_info_t *video) { Mtx44 m; gx_video_t *gx = (gx_video_t*)data; + u32 level = 0; + _CPU_ISR_Disable(level); + referenceRetraceCount = retraceCount; + _CPU_ISR_Restore(level); GX_SetCullMode(GX_CULL_NONE); GX_SetClipMode(GX_CLIP_DISABLE); @@ -1440,6 +1453,7 @@ static bool gx_frame(void *data, const void *frame, char fps_text_buf[128]; gx_video_t *gx = (gx_video_t*)data; u8 clear_efb = GX_FALSE; + u32 level = 0; fps_text_buf[0] = '\0'; @@ -1524,6 +1538,12 @@ static bool gx_frame(void *data, const void *frame, gx_render_overlay(gx); #endif + _CPU_ISR_Disable(level); + if (referenceRetraceCount > retraceCount) + VIDEO_WaitVSync(); + referenceRetraceCount = retraceCount; + _CPU_ISR_Restore(level); + GX_DrawDone(); if (video_info->fps_show) @@ -1564,6 +1584,10 @@ static bool gx_frame(void *data, const void *frame, VIDEO_SetNextFramebuffer(gx->framebuf[g_current_framebuf]); VIDEO_Flush(); + CPU_ISR_Disable(level); + ++referenceRetraceCount; + _CPU_ISR_Restore(level); + return true; } diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index c4ffce1d5c..a059bc2f04 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -437,11 +437,18 @@ void scond_free(scond_t *cond) #ifdef USE_WIN32_THREADS static bool _scond_wait_win32(scond_t *cond, slock_t *lock, DWORD dwMilliseconds) { - static bool beginPeriod = false; - struct QueueEntry myentry; struct QueueEntry **ptr; + +#if _WIN32_WINNT >= 0x0500 + static LARGE_INTEGER performanceCounterFrequency; + LARGE_INTEGER tsBegin; + static bool first_init = true; +#else + static bool beginPeriod = false; DWORD tsBegin; +#endif + DWORD waitResult; DWORD dwFinalTimeout = dwMilliseconds; /* Careful! in case we begin in the head, we don't do the hot potato stuff, @@ -453,16 +460,33 @@ static bool _scond_wait_win32(scond_t *cond, slock_t *lock, DWORD dwMilliseconds /* since this library is meant for realtime game software * I have no problem setting this to 1 and forgetting about it. */ +#if _WIN32_WINNT >= 0x0500 + if (first_init) + { + performanceCounterFrequency.QuadPart = 0; + first_init = false; + } + + if (performanceCounterFrequency.QuadPart == 0) + { + QueryPerformanceFrequency(&performanceCounterFrequency); + } +#else if (!beginPeriod) { beginPeriod = true; timeBeginPeriod(1); } +#endif /* Now we can take a good timestamp for use in faking the timeout ourselves. */ /* But don't bother unless we need to (to save a little time) */ if (dwMilliseconds != INFINITE) +#if _WIN32_WINNT >= 0x0500 + QueryPerformanceCounter(&tsBegin); +#else tsBegin = timeGetTime(); +#endif /* add ourselves to a queue of waiting threads */ ptr = &cond->head; @@ -504,8 +528,16 @@ static bool _scond_wait_win32(scond_t *cond, slock_t *lock, DWORD dwMilliseconds /* Assess the remaining timeout time */ if (dwMilliseconds != INFINITE) { - DWORD now = timeGetTime(); +#if _WIN32_WINNT >= 0x0500 + LARGE_INTEGER now; + QueryPerformanceCounter(&now); + LONGLONG elapsed = now.QuadPart - tsBegin.QuadPart; + elapsed *= 1000; + elapsed /= performanceCounterFrequency.QuadPart; +#else + DWORD now = timeGetTime(); DWORD elapsed = now - tsBegin; +#endif /* Try one last time with a zero timeout (keeps the code simpler) */ if (elapsed > dwMilliseconds)