Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 60 additions & 34 deletions gfx/common/win32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#ifdef HAVE_DYLIB
#include <dynamic/dylib.h>
#endif

#ifdef HAVE_CONFIG_H
#include "../../config.h"
Expand Down Expand Up @@ -569,11 +572,24 @@ static LRESULT CALLBACK wnd_proc_common(
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
task_push_load_new_core(
td->path, NULL,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL);
if (task_push_load_new_core(
td->path, NULL,
&content_info,
CORE_TYPE_PLAIN,
NULL, NULL))
{
#ifdef HAVE_MENU
/* Force the main menu to rebuild so that entries
* which depend on a loaded core (Start Core for
* contentless cores, Unload Core, etc.) appear
* on the fly instead of only after the next
* user-driven menu interaction. */
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->flags |=
MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE;
#endif
}
break;
case WIN32_BROWSER_MODE_LOAD_CONTENT:
win32_load_content_from_gui(td->path);
Expand Down Expand Up @@ -1991,50 +2007,57 @@ bool win32_window_init(WNDCLASSEX *wndclass,
* IDR_MENU → win32_resources_create_menu() [in ui_win32.c]
* IDR_ACCELERATOR1 → win32_resources_get_accelerator()
* IDD_PICKCORE → win32_resources_pick_core_dialog() [in ui_win32.c]
* rarch.manifest → apply_dpi_awareness() (called from _init)
* rarch.manifest → win32_apply_dpi_awareness()
* (called from the top of rarch_main, before
* any window is created)
* ---------------------------------------------------------------- */

static HACCEL s_accel_table = NULL;

/* DPI AWARENESS (replaces media/rarch.manifest)
* The manifest contained <dpiAware>true</dpiAware>.
* We call the equivalent API at runtime. */
* We call the equivalent API at runtime.
*
* Must be called before the process creates any HWND (direct or
* transitive, e.g. via CoInitialize or AllocConsole). Once any
* top-level window exists, SetProcessDpiAwareness returns
* E_ACCESSDENIED and the process stays Unaware — meaning GetDeviceCaps
* reports a fixed 96 DPI regardless of monitor or scaling settings.
* See call site in retroarch.c (top of rarch_main). */
typedef HRESULT (WINAPI *pfn_SetProcessDpiAwareness)(int);
typedef BOOL (WINAPI *pfn_SetProcessDPIAware)(void);

static void apply_dpi_awareness(void)
void win32_apply_dpi_awareness(void)
{
HMODULE shcore = LoadLibraryW(L"shcore.dll");
if (shcore)
#ifdef HAVE_DYLIB
dylib_t lib;

/* Windows 8.1+: SetProcessDpiAwareness in shcore.dll. */
if ((lib = dylib_load("shcore.dll")))
{
union {
FARPROC proc;
pfn_SetProcessDpiAwareness func;
} u;
u.proc = GetProcAddress(shcore, "SetProcessDpiAwareness");
if (u.func)
pfn_SetProcessDpiAwareness fn = (pfn_SetProcessDpiAwareness)
dylib_proc(lib, "SetProcessDpiAwareness");
if (fn)
{
u.func(1); /* PROCESS_SYSTEM_DPI_AWARE */
FreeLibrary(shcore);
fn(1); /* PROCESS_SYSTEM_DPI_AWARE */
dylib_close(lib);
return;
}
FreeLibrary(shcore);
dylib_close(lib);
}
/* Fallback for Vista / Win7 without shcore.
* Load dynamically so we still link on XP / MSVC 2005. */

/* Vista / Win 7 / Win 8 fallback: SetProcessDPIAware in user32.dll. */
if ((lib = dylib_load("user32.dll")))
{
HMODULE user32 = GetModuleHandleW(L"user32.dll");
if (user32)
{
typedef BOOL (WINAPI *pfn_SetProcessDPIAware)(void);
union {
FARPROC proc;
pfn_SetProcessDPIAware func;
} u;
u.proc = GetProcAddress(user32, "SetProcessDPIAware");
if (u.func)
u.func();
}
pfn_SetProcessDPIAware fn = (pfn_SetProcessDPIAware)
dylib_proc(lib, "SetProcessDPIAware");
if (fn)
fn();
dylib_close(lib);
}
/* Older than Vista: no API available; process stays DPI-Unaware,
* which is the correct behaviour for those systems anyway. */
#endif
}

/* ACCELERATOR TABLE (replaces IDR_ACCELERATOR1)
Expand All @@ -2055,7 +2078,10 @@ static HACCEL create_accelerator_table(void)

void win32_resources_init(void)
{
apply_dpi_awareness();
/* NOTE: DPI awareness is applied separately, at the very top of
* rarch_main(), to guarantee it runs before any window is created
* (including the hidden OLE window CoInitialize may create).
* See win32_apply_dpi_awareness(). */
s_accel_table = create_accelerator_table();
}

Expand Down
12 changes: 11 additions & 1 deletion gfx/common/win32_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,18 @@ void win32_setup_pixel_format(HDC hdc, bool supports_gl);
* so that the .exe has an embedded icon visible in Explorer.
* Everything else is created at runtime via Win32 API calls. */

/* Mark the process as DPI-aware (replaces the <dpiAware>true</dpiAware>
* entry that used to live in media/rarch.manifest).
*
* MUST be called before any HWND is created — directly or transitively
* (e.g. via CoInitialize or AllocConsole). Call it at the very top of
* rarch_main(), before anything else. Safe to call on any Windows
* version: falls back from SetProcessDpiAwareness (Win8.1+) to
* SetProcessDPIAware (Vista/7), and is a no-op on older systems. */
void win32_apply_dpi_awareness(void);

/* Call once before creating any windows.
* Applies DPI awareness and creates the accelerator table. */
* Creates the accelerator table and other programmatic resources. */
void win32_resources_init(void);

/* Release resources created by win32_resources_init(). */
Expand Down
14 changes: 7 additions & 7 deletions gfx/video_shader_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,13 @@ static const char *video_shader_wrap_mode_to_str(enum gfx_wrap_type type)
**/
static enum gfx_wrap_type video_shader_wrap_str_to_mode(const char *wrap_mode)
{
if (memcmp(wrap_mode, "clamp_to_border", sizeof("clamp_to_border")) == 0)
if (!strcmp(wrap_mode, "clamp_to_border"))
return RARCH_WRAP_BORDER;
else if (memcmp(wrap_mode, "clamp_to_edge", sizeof("clamp_to_edge")) == 0)
else if (!strcmp(wrap_mode, "clamp_to_edge"))
return RARCH_WRAP_EDGE;
else if (memcmp(wrap_mode, "repeat", sizeof("repeat")) == 0)
else if (!strcmp(wrap_mode, "repeat"))
return RARCH_WRAP_REPEAT;
else if (memcmp(wrap_mode, "mirrored_repeat", sizeof("mirrored_repeat")) == 0)
else if (!strcmp(wrap_mode, "mirrored_repeat"))
return RARCH_WRAP_MIRRORED_REPEAT;
RARCH_WARN("[Shaders] Invalid wrapping type \"%s\". Valid ones are: \"clamp_to_border\" "
"(default), \"clamp_to_edge\", \"repeat\" and \"mirrored_repeat\". Falling back to default.\n",
Expand Down Expand Up @@ -760,11 +760,11 @@ static bool video_shader_parse_pass(config_file_t *conf,

if (*scale_type_y)
{
if (memcmp(scale_type_y, "source", sizeof("source")) == 0)
if (!strcmp(scale_type_y, "source"))
scale->type_y = RARCH_SCALE_INPUT;
else if (memcmp(scale_type_y, "viewport", sizeof("viewport")) == 0)
else if (!strcmp(scale_type_y, "viewport"))
scale->type_y = RARCH_SCALE_VIEWPORT;
else if (memcmp(scale_type_y, "absolute", sizeof("absolute")) == 0)
else if (!strcmp(scale_type_y, "absolute"))
scale->type_y = RARCH_SCALE_ABSOLUTE;
else
{
Expand Down
8 changes: 8 additions & 0 deletions intl/msg_hash_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -2659,6 +2659,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_WASAPI_SH_BUFFER_LENGTH,
"Zwischenspeicher-Größe (in Frames), wenn der WASAPI-Treiber im gemeinsamen Modus verwendet wird."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_ASIO_CONTROL_PANEL,
"ASIO Control Panel öffnen"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_ASIO_CONTROL_PANEL,
"Die ASIO-Treiber-Systemsteuerung öffnen, um die Geräte-Routing- und Puffereinstellungen zu konfigurieren."
)

/* Settings > Audio > Output */

Expand Down
Loading
Loading