mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-02-25 21:11:14 +03:00
vrclient: Move unix to dos path conversions to the unix side.
CW-Bug-Id: #22729
This commit is contained in:
parent
c95536019c
commit
1e8d243065
@ -798,6 +798,14 @@ def handle_method_cpp(method, classname, out):
|
|||||||
for name, param in sorted(need_output.items()):
|
for name, param in sorted(need_output.items()):
|
||||||
out(f' if (params->{name}) *params->{name} = u_{name};\n')
|
out(f' if (params->{name}) *params->{name} = u_{name};\n')
|
||||||
|
|
||||||
|
path_conv_utow = PATH_CONV_METHODS_UTOW.get(f'{klass.name}_{method.spelling}', {})
|
||||||
|
|
||||||
|
for name, conv in filter(lambda x: x[0] in names, path_conv_utow.items()):
|
||||||
|
out(u' ')
|
||||||
|
if "ret_size" in path_conv_utow:
|
||||||
|
out(u'params->_ret = ')
|
||||||
|
out(f'vrclient_unix_path_to_dos_path( params->_ret, params->{name}, params->{name}, params->{conv["len"]} );\n')
|
||||||
|
|
||||||
for name in filter(lambda x: x in names, sorted(path_conv_wtou)):
|
for name in filter(lambda x: x in names, sorted(path_conv_wtou)):
|
||||||
out(f' vrclient_free_path( u_{name} );\n')
|
out(f' vrclient_free_path( u_{name} );\n')
|
||||||
|
|
||||||
@ -851,8 +859,6 @@ def handle_method_c(klass, method, winclassname, out):
|
|||||||
out(f' .{name} = {name},\n')
|
out(f' .{name} = {name},\n')
|
||||||
out(u' };\n')
|
out(u' };\n')
|
||||||
|
|
||||||
path_conv_utow = PATH_CONV_METHODS_UTOW.get(f'{klass.name}_{method.spelling}', {})
|
|
||||||
|
|
||||||
out(u' TRACE("%p\\n", _this);\n')
|
out(u' TRACE("%p\\n", _this);\n')
|
||||||
|
|
||||||
if 'eTextureType' in names:
|
if 'eTextureType' in names:
|
||||||
@ -860,12 +866,6 @@ def handle_method_c(klass, method, winclassname, out):
|
|||||||
|
|
||||||
out(f' VRCLIENT_CALL( {method.full_name}, ¶ms );\n')
|
out(f' VRCLIENT_CALL( {method.full_name}, ¶ms );\n')
|
||||||
|
|
||||||
for name, conv in filter(lambda x: x[0] in names, path_conv_utow.items()):
|
|
||||||
out(u' ')
|
|
||||||
if "ret_size" in path_conv_utow:
|
|
||||||
out(u'params._ret = ')
|
|
||||||
out(f'vrclient_unix_path_to_dos_path( params._ret, {name}, {name}, {conv["len"]} );\n')
|
|
||||||
|
|
||||||
if not returns_void:
|
if not returns_void:
|
||||||
out(u' return params._ret;\n')
|
out(u' return params._ret;\n')
|
||||||
out(u'}\n\n')
|
out(u'}\n\n')
|
||||||
|
@ -34,6 +34,7 @@ NTSTATUS IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename( void *
|
|||||||
struct IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename_params *params = (struct IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename_params *)args;
|
struct IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename_params *params = (struct IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename_params *)args;
|
||||||
struct u_IVRScreenshots_IVRScreenshots_001 *iface = (struct u_IVRScreenshots_IVRScreenshots_001 *)params->linux_side;
|
struct u_IVRScreenshots_IVRScreenshots_001 *iface = (struct u_IVRScreenshots_IVRScreenshots_001 *)params->linux_side;
|
||||||
params->_ret = (uint32_t)iface->GetScreenshotPropertyFilename( params->screenshotHandle, params->filenameType, params->pchFilename, params->cchFilename, params->pError );
|
params->_ret = (uint32_t)iface->GetScreenshotPropertyFilename( params->screenshotHandle, params->filenameType, params->pchFilename, params->cchFilename, params->pError );
|
||||||
|
params->_ret = vrclient_unix_path_to_dos_path( params->_ret, params->pchFilename, params->pchFilename, params->cchFilename );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,32 @@ void vrclient_free_path( char *path )
|
|||||||
HeapFree( GetProcessHeap(), 0, path );
|
HeapFree( GetProcessHeap(), 0, path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns the number of bytes written to dst, not including the NUL terminator */
|
||||||
|
unsigned int vrclient_unix_path_to_dos_path( bool api_result, const char *src, char *dst, uint32_t dst_bytes )
|
||||||
|
{
|
||||||
|
WCHAR *dosW;
|
||||||
|
uint32_t r;
|
||||||
|
|
||||||
|
if (!src || !*src || !api_result || !dst || !dst_bytes)
|
||||||
|
{
|
||||||
|
if (dst && dst_bytes) *dst = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dosW = wine_get_dos_file_name( src );
|
||||||
|
if (!dosW)
|
||||||
|
{
|
||||||
|
WARN( "Unable to convert unix filename to DOS: %s\n", src );
|
||||||
|
*dst = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = WideCharToMultiByte( CP_ACP, 0, dosW, -1, dst, dst_bytes, NULL, NULL );
|
||||||
|
HeapFree( GetProcessHeap(), 0, dosW );
|
||||||
|
|
||||||
|
return r == 0 ? 0 : r - 1;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
static bool ends_with(const std::string &s, char c)
|
static bool ends_with(const std::string &s, char c)
|
||||||
|
@ -31,6 +31,7 @@ extern NTSTATUS vrclient_VRClientCoreFactory( void *args );
|
|||||||
|
|
||||||
extern char *vrclient_dos_to_unix_path( const char *src );
|
extern char *vrclient_dos_to_unix_path( const char *src );
|
||||||
extern void vrclient_free_path( char *path );
|
extern void vrclient_free_path( char *path );
|
||||||
|
extern unsigned int vrclient_unix_path_to_dos_path( bool api_result, const char *src, char *dst, uint32_t dst_bytes );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -57,36 +57,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns the number of bytes written to dst, not including the NUL terminator */
|
|
||||||
unsigned int vrclient_unix_path_to_dos_path(bool api_result, const char *src, char *dst, uint32_t dst_bytes)
|
|
||||||
{
|
|
||||||
WCHAR *dosW;
|
|
||||||
uint32_t r;
|
|
||||||
|
|
||||||
if(!dst || !dst_bytes)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(!src || !api_result){
|
|
||||||
*dst = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dosW = wine_get_dos_file_name(src);
|
|
||||||
*dst = 0;
|
|
||||||
|
|
||||||
if(!dosW){
|
|
||||||
WARN("Unable to convert unix filename to DOS: %s\n", src);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = WideCharToMultiByte(CP_ACP, 0, dosW, -1, dst, dst_bytes,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, dosW);
|
|
||||||
|
|
||||||
return r == 0 ? 0 : r - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
|
static BOOL array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
|
||||||
{
|
{
|
||||||
SIZE_T max_capacity, new_capacity;
|
SIZE_T max_capacity, new_capacity;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
typedef void (*vtable_ptr)(void);
|
typedef void (*vtable_ptr)(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int vrclient_unix_path_to_dos_path(bool api_result, const char *src, char *dst, uint32_t dst_bytes);
|
|
||||||
void *create_LinuxMatchmakingServerListResponse(void *win);
|
void *create_LinuxMatchmakingServerListResponse(void *win);
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
@ -70,7 +70,6 @@ uint32_t __thiscall winIVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFi
|
|||||||
};
|
};
|
||||||
TRACE("%p\n", _this);
|
TRACE("%p\n", _this);
|
||||||
VRCLIENT_CALL( IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename, ¶ms );
|
VRCLIENT_CALL( IVRScreenshots_IVRScreenshots_001_GetScreenshotPropertyFilename, ¶ms );
|
||||||
params._ret = vrclient_unix_path_to_dos_path( params._ret, pchFilename, pchFilename, cchFilename );
|
|
||||||
return params._ret;
|
return params._ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user