Skip to content

Commit

Permalink
Merge remote-tracking branch 'aerisarn-RetroArch-uwp/master' into Mes…
Browse files Browse the repository at this point in the history
…aBuild

Merges Tag alpha-2-resfix-correction
  • Loading branch information
Misunderstood-Wookiee committed May 13, 2024
2 parents a05f44c + 14c92a4 commit 2464896
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 29 deletions.
12 changes: 10 additions & 2 deletions intl/msg_hash_be.h
Original file line number Diff line number Diff line change
Expand Up @@ -3972,6 +3972,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS,
"Змяніць адлюстраванне элементаў меню RetroArch."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SETTINGS,
"Выгляд"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SETTINGS,
"Змяніць налады выгляду экраннага меню."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_APPICON_SETTINGS,
"Значок праграмы"
Expand Down Expand Up @@ -4841,7 +4849,7 @@ MSG_HASH(

MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEEVOS_APPEARANCE_SETTINGS,
"Вонкавы выгляд"
"Выгляд"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEEVOS_APPEARANCE_ANCHOR_TOPLEFT,
Expand Down Expand Up @@ -7945,7 +7953,7 @@ MSG_HASH(
)
MSG_HASH(
MSG_CAPABILITIES,
"Здольнасці"
"Магчымасці"
)
MSG_HASH(
MSG_FETCHING_CORE_LIST,
Expand Down
8 changes: 8 additions & 0 deletions intl/msg_hash_hu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6550,6 +6550,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES,
"A \"Kedvencekhez ad\" lehetőség jelenjen meg."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_PLAYLIST,
"\"Hozzáadás játéklistához\" látható"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_PLAYLIST,
"A \"Hozzáadás játéklistához\" lehetőség jelenjen meg."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SET_CORE_ASSOCIATION,
"\"Társítás maghoz\" látható"
Expand Down
2 changes: 1 addition & 1 deletion intl/progress.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#define LANGUAGE_PROGRESS_CROATIAN_APPROVED 0

/* Hungarian */
#define LANGUAGE_PROGRESS_HUNGARIAN_TRANSLATED 99
#define LANGUAGE_PROGRESS_HUNGARIAN_TRANSLATED 100
#define LANGUAGE_PROGRESS_HUNGARIAN_APPROVED 0

/* Indonesian */
Expand Down
53 changes: 45 additions & 8 deletions menu/drivers/materialui.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#endif

#include "../../frontend/frontend_driver.h"
#include "../../ui/ui_companion_driver.h"

#include "../menu_driver.h"
#include "../menu_screensaver.h"
Expand Down Expand Up @@ -175,7 +176,8 @@ enum materialui_node_icon_type
MUI_ICON_TYPE_MENU_EXPLORE,
MUI_ICON_TYPE_PLAYLIST,
MUI_ICON_TYPE_MENU_CONTENTLESS_CORE,
MUI_ICON_TYPE_ACHIEVEMENT
MUI_ICON_TYPE_ACHIEVEMENT,
MUI_ICON_TYPE_APPICON
};

/* Defines all standard menu textures */
Expand Down Expand Up @@ -4011,6 +4013,14 @@ static void materialui_render_menu_entry_default(
uintptr_t icon_texture = 0;
bool draw_text_outside = (x_offset != 0);
gfx_display_t *p_disp = disp_get_ptr();
uico_driver_state_t *uico_st = uico_state_get_ptr();

static float color_white[16] = {
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
};

if (!p_disp->dispctx->handles_transform)
{
Expand Down Expand Up @@ -4076,12 +4086,6 @@ static void materialui_render_menu_entry_default(
if (icon_texture)
{
/* draw the icon ourselves - the draw_icon below tints it to match the theme */
static float color_white[16] = {
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
};
materialui_draw_icon(
userdata, p_disp,
video_width,
Expand Down Expand Up @@ -4116,6 +4120,33 @@ static void materialui_render_menu_entry_default(
}
break;
#endif
case MUI_ICON_TYPE_APPICON:
if (uico_st->drv && uico_st->drv->get_app_icon_texture)
{
icon_texture = uico_st->drv->get_app_icon_texture(entry_label);
if (icon_texture)
{
/* draw the icon ourselves - the draw_icon below tints it to match the theme */
materialui_draw_icon(
userdata, p_disp,
video_width,
video_height,
mui->icon_size,
(uintptr_t)icon_texture,
entry_x + (int)mui->landscape_optimization.entry_margin,
entry_y + (node->entry_height / 2.0f) - (mui->icon_size / 2.0f),
0,
1,
color_white,
&mymat);

entry_margin += mui->icon_size;
usable_width -= mui->icon_size;

icon_texture = 0; /* prevent drawing tinted icon */
}
}
break;
default:
switch (entry_file_type)
{
Expand Down Expand Up @@ -10481,6 +10512,13 @@ static void materialui_list_insert(
case MENU_SETTING_ACTION_CONTENTLESS_CORE_RUN:
node->icon_type = MUI_ICON_TYPE_MENU_CONTENTLESS_CORE;
break;
case MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM:
if (atoi(fullpath) == MENU_ENUM_LABEL_APPICON_SETTINGS)
{
node->icon_type = MUI_ICON_TYPE_APPICON;
}
/* for other types we don't have an icon */
break;
case FILE_TYPE_RPL_ENTRY:
case MENU_SETTING_DROPDOWN_ITEM:
case MENU_SETTING_DROPDOWN_ITEM_RESOLUTION:
Expand All @@ -10498,7 +10536,6 @@ static void materialui_list_insert(
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION:
case MENU_SETTING_DROPDOWN_ITEM_INPUT_DESCRIPTION_KBD:
case MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
Expand Down
3 changes: 2 additions & 1 deletion pkg/msvc-uwp/RetroArch-msvcUWP/MESA/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# MESA PreBuilt Libraries

The Binaries in this folder are compiled from a custom version of [MESA](https://github.com/aerisarn/mesa-uwp).
These are based on this [tag](https://github.com/aerisarn/mesa-uwp/releases/tag/alpha-2-resfix).
These are based on this [branch](https://github.com/aerisarn/mesa-uwp/releases/tag/alpha-2-hack-fixes), which is the
stable branch for MESA integration into Retroarch.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libEGL.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libGLESv2.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libgallium_wgl.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/libglapi.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/opengl32.dll
Binary file not shown.
Binary file modified pkg/msvc-uwp/RetroArch-msvcUWP/MESA/x64/z-1.dll
Binary file not shown.
1 change: 1 addition & 0 deletions ui/drivers/ui_cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ static void ui_companion_cocoa_event_command(void *data, enum event_command cmd)
NULL, /* is_active */
NULL, /* get_app_icons */
NULL, /* set_app_icon */
NULL, /* get_app_icon_texture */
&ui_browser_window_cocoa,
&ui_msg_window_cocoa,
&ui_window_cocoa,
Expand Down
51 changes: 35 additions & 16 deletions ui/drivers/ui_cocoatouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,40 @@ static void ui_companion_cocoatouch_set_app_icon(const char *iconName)
[[UIApplication sharedApplication] setAlternateIconName:str completionHandler:nil];
}

static uintptr_t ui_companion_cocoatouch_get_app_icon_texture(const char *icon)
{
static NSMutableDictionary<NSString *, NSNumber *> *textures = nil;
static dispatch_once_t once;
dispatch_once(&once, ^{
textures = [NSMutableDictionary dictionaryWithCapacity:6];
});

NSString *iconName = [NSString stringWithUTF8String:icon];
if (!textures[iconName])
{
UIImage *img = [UIImage imageNamed:iconName];
if (!img)
{
RARCH_LOG("could not load %s\n", icon);
return NULL;
}
NSData *png = UIImagePNGRepresentation(img);
if (!png)
{
RARCH_LOG("could not get png for %s\n", icon);
return NULL;
}

uintptr_t item;
gfx_display_reset_textures_list_buffer(&item, TEXTURE_FILTER_MIPMAP_LINEAR,
(void*)[png bytes], (unsigned int)[png length], IMAGE_TYPE_PNG,
NULL, NULL);
textures[iconName] = [NSNumber numberWithUnsignedLong:item];
}

return [textures[iconName] unsignedLongValue];
}

static void rarch_draw_observer(CFRunLoopObserverRef observer,
CFRunLoopActivity activity, void *info)
{
Expand Down Expand Up @@ -506,22 +540,6 @@ - (void)handleAudioSessionInterruption:(NSNotification *)notification
}
}

- (NSData *)pngForIcon:(NSString *)iconName
{
UIImage *img;
NSData *png;
img = [UIImage imageNamed:iconName];
if (!img)
NSLog(@"could not load %@\n", iconName);
else
{
png = UIImagePNGRepresentation(img);
if (!png)
NSLog(@"could not get png for %@\n", iconName);
}
return png;
}

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
char arguments[] = "retroarch";
Expand Down Expand Up @@ -763,6 +781,7 @@ - (void)didReceiveDiagnosticPayloads:(NSArray<MXDiagnosticPayload *> *)payloads
NULL, /* is_active */
ui_companion_cocoatouch_get_app_icons,
ui_companion_cocoatouch_set_app_icon,
ui_companion_cocoatouch_get_app_icon_texture,
NULL, /* browser_window */
NULL, /* msg_window */
NULL, /* window */
Expand Down
1 change: 1 addition & 0 deletions ui/drivers/ui_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4992,6 +4992,7 @@ ui_companion_driver_t ui_companion_qt = {
ui_companion_qt_is_active,
NULL, /* get_app_icons */
NULL, /* set_app_icon */
NULL, /* get_app_icon_texture */
&ui_browser_window_qt,
&ui_msg_window_qt,
&ui_window_qt,
Expand Down
1 change: 1 addition & 0 deletions ui/drivers/ui_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ ui_companion_driver_t ui_companion_win32 = {
NULL, /* is_active */
NULL, /* get_app_icons */
NULL, /* set_app_icon */
NULL, /* get_app_icon_texture */
&ui_browser_window_win32,
&ui_msg_window_win32,
&ui_window_win32,
Expand Down
1 change: 1 addition & 0 deletions ui/ui_companion_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static ui_companion_driver_t ui_companion_null = {
NULL, /* is_active */
NULL, /* get_app_icons */
NULL, /* set_app_icon */
NULL, /* get_app_icon_texture */
NULL, /* browser_window */
NULL, /* msg_window */
NULL, /* window */
Expand Down
1 change: 1 addition & 0 deletions ui/ui_companion_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ typedef struct ui_companion_driver
bool (*is_active)(void *data);
struct string_list *(*get_app_icons)(void);
void (*set_app_icon)(const char *icon);
uintptr_t (*get_app_icon_texture)(const char *icon);
ui_browser_window_t *browser_window;
ui_msg_window_t *msg_window;
ui_window_t *window;
Expand Down
13 changes: 12 additions & 1 deletion uwp/uwp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,13 @@ extern "C" {
return (void*)CoreWindow::GetForCurrentThread();
}

int current_height = -1;

int uwp_get_height(void)
{
if (current_height != -1)
return current_height;

/* This function must be performed within UI thread,
* otherwise it will cause a crash in specific cases
* https://github.com/libretro/RetroArch/issues/13491 */
Expand Down Expand Up @@ -974,11 +979,17 @@ extern "C" {
if (corewindow)
corewindow->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);
}
current_height = ret;
return ret;
}

int current_width = -1;

int uwp_get_width(void)
{
if (current_width != -1)
return current_width;

/* This function must be performed within UI thread,
* otherwise it will cause a crash in specific cases
* https://github.com/libretro/RetroArch/issues/13491 */
Expand Down Expand Up @@ -1012,7 +1023,7 @@ extern "C" {
if (corewindow)
corewindow->Dispatcher->ProcessEvents(Windows::UI::Core::CoreProcessEventsOption::ProcessAllIfPresent);
}

current_width = returnValue;
return returnValue;
}

Expand Down

0 comments on commit 2464896

Please sign in to comment.