mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
(PR https://gitlab.com/Mr_Goldberg/goldberg_emulator/-/merge_requests/42) dll/wrap: fix build for glibc 2.33
I don't think I need the step that converting to legacy struct. Signed-off-by: ayaka <ayaka@soulik.info>
This commit is contained in:
parent
475342f0d8
commit
3b6663ca99
@ -112,7 +112,6 @@ inline void reset_LastError()
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
@ -205,4 +204,4 @@ inline std::string ascii_to_lowercase(std::string data) {
|
|||||||
|
|
||||||
#define LOBBY_CONNECT_APPID ((uint32)-2)
|
#define LOBBY_CONNECT_APPID ((uint32)-2)
|
||||||
|
|
||||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
#endif//__INCLUDED_COMMON_INCLUDES__
|
||||||
|
67
dll/wrap.cpp
67
dll/wrap.cpp
@ -25,6 +25,7 @@
|
|||||||
// Nothing to be done here
|
// Nothing to be done here
|
||||||
#else
|
#else
|
||||||
#define STEAM_API_FUNCTIONS_IMPL
|
#define STEAM_API_FUNCTIONS_IMPL
|
||||||
|
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
#include "dll.h"
|
#include "dll.h"
|
||||||
|
|
||||||
@ -34,6 +35,26 @@
|
|||||||
const char *STEAM_PATH;
|
const char *STEAM_PATH;
|
||||||
size_t STEAM_PATH_SIZE;
|
size_t STEAM_PATH_SIZE;
|
||||||
|
|
||||||
|
#ifndef __x86_64__
|
||||||
|
# define _STAT_VER_LINUX_OLD 1
|
||||||
|
# define _STAT_VER_KERNEL 1
|
||||||
|
# define _STAT_VER_SVR4 2
|
||||||
|
# define _STAT_VER_LINUX 3
|
||||||
|
# define _MKNOD_VER_LINUX 1
|
||||||
|
# define _MKNOD_VER_SVR4 2
|
||||||
|
#else
|
||||||
|
# define _STAT_VER_KERNEL 0
|
||||||
|
# define _STAT_VER_LINUX 1
|
||||||
|
# define _MKNOD_VER_LINUX 0
|
||||||
|
#endif
|
||||||
|
#define _STAT_VER _STAT_VER_LINUX
|
||||||
|
#define _MKNOD_VER _MKNOD_VER_LINUX
|
||||||
|
|
||||||
|
/* From kernel_stat.h It help me save some condition */
|
||||||
|
#define XSTAT_IS_XSTAT64 1
|
||||||
|
#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64
|
||||||
|
#define STAT_IS_KERNEL_STAT 1
|
||||||
|
|
||||||
// Returns a '/' terminated absolute path to the steam folder in user's home,
|
// Returns a '/' terminated absolute path to the steam folder in user's home,
|
||||||
// root is returned if env home is not set
|
// root is returned if env home is not set
|
||||||
const char *get_steam_path()
|
const char *get_steam_path()
|
||||||
@ -290,7 +311,16 @@ STEAMAPI_API int __wrap_access(const char *path, int mode)
|
|||||||
STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf)
|
STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf)
|
||||||
{
|
{
|
||||||
const char *path_lowercased = lowercase_path(path, false, false);
|
const char *path_lowercased = lowercase_path(path, false, false);
|
||||||
int result = __xstat(ver, path_lowercased, stat_buf);
|
int result;
|
||||||
|
|
||||||
|
switch (ver) {
|
||||||
|
case _STAT_VER_KERNEL:
|
||||||
|
result = stat(path_lowercased, stat_buf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (path_lowercased != path) {
|
if (path_lowercased != path) {
|
||||||
free((void *)path_lowercased);
|
free((void *)path_lowercased);
|
||||||
}
|
}
|
||||||
@ -305,7 +335,16 @@ STEAMAPI_API int __wrap_stat(const char * path, struct stat * stat_buf)
|
|||||||
STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf)
|
STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf)
|
||||||
{
|
{
|
||||||
const char *path_lowercased = lowercase_path(path, false, false);
|
const char *path_lowercased = lowercase_path(path, false, false);
|
||||||
int result = __lxstat(ver, path_lowercased, stat_buf);
|
int result;
|
||||||
|
|
||||||
|
switch (ver) {
|
||||||
|
case _STAT_VER_KERNEL:
|
||||||
|
result = lstat(path_lowercased, stat_buf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (path_lowercased != path) {
|
if (path_lowercased != path) {
|
||||||
free((void *)path_lowercased);
|
free((void *)path_lowercased);
|
||||||
}
|
}
|
||||||
@ -350,7 +389,16 @@ STEAMAPI_API DIR *__wrap_opendir(const char *path)
|
|||||||
STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf)
|
STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf)
|
||||||
{
|
{
|
||||||
const char *path_lowercased = lowercase_path(path, false, false);
|
const char *path_lowercased = lowercase_path(path, false, false);
|
||||||
int result = __xstat64(ver, path_lowercased, stat_buf);
|
int result;
|
||||||
|
|
||||||
|
switch (ver) {
|
||||||
|
case _STAT_VER_KERNEL:
|
||||||
|
result = stat64(path_lowercased, stat_buf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (path_lowercased != path) {
|
if (path_lowercased != path) {
|
||||||
free((void *)path_lowercased);
|
free((void *)path_lowercased);
|
||||||
}
|
}
|
||||||
@ -360,7 +408,16 @@ STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat
|
|||||||
STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf)
|
STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf)
|
||||||
{
|
{
|
||||||
const char *path_lowercased = lowercase_path(path, false, false);
|
const char *path_lowercased = lowercase_path(path, false, false);
|
||||||
int result = __lxstat64(ver, path_lowercased, stat_buf);
|
int result;
|
||||||
|
|
||||||
|
switch (ver) {
|
||||||
|
case _STAT_VER_KERNEL:
|
||||||
|
result = lstat64(path_lowercased, stat_buf);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (path_lowercased != path) {
|
if (path_lowercased != path) {
|
||||||
free((void *)path_lowercased);
|
free((void *)path_lowercased);
|
||||||
}
|
}
|
||||||
@ -448,7 +505,7 @@ STEAMAPI_API int __wrap_link(const char *path1, const char *path2)
|
|||||||
STEAMAPI_API int __wrap_mknod(const char *path, mode_t mode, dev_t dev)
|
STEAMAPI_API int __wrap_mknod(const char *path, mode_t mode, dev_t dev)
|
||||||
{
|
{
|
||||||
const char *path_lowercased = lowercase_path(path, true, true);
|
const char *path_lowercased = lowercase_path(path, true, true);
|
||||||
int result = __xmknod(1, path_lowercased, mode, &dev);
|
int result = mknod(path_lowercased, mode, dev);
|
||||||
if (path_lowercased != path) {
|
if (path_lowercased != path) {
|
||||||
free((void *)path_lowercased);
|
free((void *)path_lowercased);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user