From a8d3b205ca4dd069e3bae6e6e642d711d596539d Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Sat, 5 Aug 2017 20:06:11 +0000 Subject: [PATCH 1/4] update CHANGES.md --- CHANGES.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index afb55b0acb..bb69c5fb77 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,14 +3,16 @@ - ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices - 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. - LOCALIZATION: Update Russian translation +- 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. From 944eb01fb41da2d2f634230623f0c1e2bd80924d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 6 Aug 2017 01:29:41 +0200 Subject: [PATCH 2/4] Updates --- libretro-common/rthreads/rthreads.c | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index c4ffce1d5c..1abcf1a3ed 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -437,11 +437,17 @@ 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 = { .QuadPart = 0 }; + LARGE_INTEGER tsBegin; +#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 +459,27 @@ 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 (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 +521,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) From e259a8c63bda0de1e89d3fff99bf0f4f15fcdbd0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 6 Aug 2017 01:44:34 +0200 Subject: [PATCH 3/4] Try to avoid direct initialization --- libretro-common/rthreads/rthreads.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 1abcf1a3ed..a059bc2f04 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -441,8 +441,9 @@ static bool _scond_wait_win32(scond_t *cond, slock_t *lock, DWORD dwMilliseconds struct QueueEntry **ptr; #if _WIN32_WINNT >= 0x0500 - static LARGE_INTEGER performanceCounterFrequency = { .QuadPart = 0 }; + static LARGE_INTEGER performanceCounterFrequency; LARGE_INTEGER tsBegin; + static bool first_init = true; #else static bool beginPeriod = false; DWORD tsBegin; @@ -460,6 +461,12 @@ 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); From 86f7972aa8af0d2f20b2775e49f0e89a8c918e51 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 6 Aug 2017 04:40:55 +0200 Subject: [PATCH 4/4] (Wii) Backport https://github.com/SuperrSonic/RA-SS/commit/0574b91595a231e15bafa9f2778d1b9b14944ba6 - untested --- gfx/drivers/gx_gfx.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) 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; }