mirror of
https://git.suyu.dev/suyu/Yucom.git
synced 2026-01-04 21:54:42 +01:00
lsteamclient: Convert glyph paths in new ISteamInput005 methods
CW-Bug-Id: #19517
This commit is contained in:
parent
4b9b102b31
commit
f9eef72c88
18 changed files with 234 additions and 109 deletions
|
|
@ -16,6 +16,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
|||
#pragma pop_macro("__cdecl")
|
||||
#include "steamclient_private.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
extern "C" {
|
||||
#define SDKVER_152
|
||||
#include "struct_converters.h"
|
||||
|
|
@ -38,4 +40,104 @@ void cppISteamInput_SteamInput005_EnableActionEventCallbacks(void *linux_side, w
|
|||
((ISteamInput*)linux_side)->EnableActionEventCallbacks(pCallback ? &lin_SteamInputActionEventCallbackPointer : NULL);
|
||||
}
|
||||
|
||||
/***** convert and cache ISteamInput glyph paths *****/
|
||||
static std::unordered_map<int /*EInputActionOrigin*/, char *> cached_input_glyphs;
|
||||
static std::unordered_map<int /*EInputActionOrigin*/, char *> cached_input_glyphs_svg;
|
||||
static std::unordered_map<int /*EInputActionOrigin*/, char *> cached_input_glyphs_png[3 /* ESteamInputGlyphSize */];
|
||||
|
||||
static const char *steamclient_isteaminput_getglyph_png(int origin, int size, const char *lin_path)
|
||||
{
|
||||
if(!lin_path)
|
||||
return NULL;
|
||||
|
||||
if(cached_input_glyphs_png[size].find(origin) == cached_input_glyphs_png[size].end()){
|
||||
char *dos_path = (char *)HeapAlloc(GetProcessHeap(), 0, PATH_MAX);
|
||||
|
||||
steamclient_unix_path_to_dos_path(1, lin_path, dos_path, PATH_MAX, 0);
|
||||
|
||||
cached_input_glyphs_png[size][origin] = dos_path;
|
||||
}
|
||||
|
||||
return cached_input_glyphs_png[size][origin];
|
||||
}
|
||||
|
||||
static const char *steamclient_isteaminput_getglyph_svg(int origin, const char *lin_path)
|
||||
{
|
||||
if(!lin_path)
|
||||
return NULL;
|
||||
|
||||
if(cached_input_glyphs_svg.find(origin) == cached_input_glyphs_svg.end()){
|
||||
char *dos_path = (char *)HeapAlloc(GetProcessHeap(), 0, PATH_MAX);
|
||||
|
||||
steamclient_unix_path_to_dos_path(1, lin_path, dos_path, PATH_MAX, 0);
|
||||
|
||||
cached_input_glyphs_svg[origin] = dos_path;
|
||||
}
|
||||
|
||||
return cached_input_glyphs_svg[origin];
|
||||
}
|
||||
|
||||
const char *steamclient_isteaminput_getglyph(int origin, const char *lin_path)
|
||||
{
|
||||
if(!lin_path)
|
||||
return NULL;
|
||||
|
||||
if(cached_input_glyphs.find(origin) == cached_input_glyphs.end()){
|
||||
char *dos_path = (char *)HeapAlloc(GetProcessHeap(), 0, PATH_MAX);
|
||||
|
||||
steamclient_unix_path_to_dos_path(1, lin_path, dos_path, PATH_MAX, 0);
|
||||
|
||||
cached_input_glyphs[origin] = dos_path;
|
||||
}
|
||||
|
||||
return cached_input_glyphs[origin];
|
||||
}
|
||||
|
||||
const char * cppISteamInput_SteamInput005_GetGlyphPNGForActionOrigin(void *linux_side, EInputActionOrigin eOrigin, ESteamInputGlyphSize eSize, uint32 unFlags)
|
||||
{
|
||||
const char *path_result;
|
||||
path_result = ((ISteamInput*)linux_side)->GetGlyphPNGForActionOrigin((EInputActionOrigin)eOrigin, eSize, unFlags);
|
||||
return steamclient_isteaminput_getglyph_png(eOrigin, eSize, path_result);
|
||||
}
|
||||
|
||||
const char * cppISteamInput_SteamInput005_GetGlyphSVGForActionOrigin(void *linux_side, EInputActionOrigin eOrigin, uint32 unFlags)
|
||||
{
|
||||
const char *path_result;
|
||||
path_result = ((ISteamInput*)linux_side)->GetGlyphSVGForActionOrigin((EInputActionOrigin)eOrigin, unFlags);
|
||||
return steamclient_isteaminput_getglyph_svg(eOrigin, path_result);
|
||||
}
|
||||
|
||||
const char * cppISteamInput_SteamInput005_GetGlyphForActionOrigin_Legacy(void *linux_side, EInputActionOrigin eOrigin)
|
||||
{
|
||||
const char *path_result;
|
||||
path_result = ((ISteamInput*)linux_side)->GetGlyphForActionOrigin_Legacy((EInputActionOrigin)eOrigin);
|
||||
return steamclient_isteaminput_getglyph(eOrigin, path_result);
|
||||
}
|
||||
|
||||
/***** convert and cache ISteamController glyph paths *****/
|
||||
static std::unordered_map<int /*EControllerActionOrigin*/, char *> cached_controller_glyphs;
|
||||
|
||||
const char *steamclient_isteamcontroller_getglyph(int origin, const char *lin_path)
|
||||
{
|
||||
if(!lin_path)
|
||||
return NULL;
|
||||
|
||||
if(cached_controller_glyphs.find(origin) == cached_controller_glyphs.end()){
|
||||
char *dos_path = (char *)HeapAlloc(GetProcessHeap(), 0, PATH_MAX);
|
||||
|
||||
steamclient_unix_path_to_dos_path(1, lin_path, dos_path, PATH_MAX, 0);
|
||||
|
||||
cached_controller_glyphs[origin] = dos_path;
|
||||
}
|
||||
|
||||
return cached_controller_glyphs[origin];
|
||||
}
|
||||
|
||||
const char * cppISteamController_SteamController008_GetGlyphForActionOrigin(void *linux_side, EControllerActionOrigin eOrigin)
|
||||
{
|
||||
const char *path_result;
|
||||
path_result = ((ISteamController*)linux_side)->GetGlyphForActionOrigin((EControllerActionOrigin)eOrigin);
|
||||
return steamclient_isteamcontroller_getglyph(eOrigin, path_result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue