Skip to content

Commit e1629e1

Browse files
committed
Move configuration and save files from WAD directory to appropriate subdirectory of frontend-defined save path
1 parent 713a0f9 commit e1629e1

File tree

19 files changed

+3432
-2
lines changed

19 files changed

+3432
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.o

Makefile.common

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ endif
1818

1919
SOURCES_C := $(LIBRETRO_DIR)/libretro.c \
2020
$(LIBRETRO_DIR)/libretro_sound.c \
21+
$(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \
22+
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
23+
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
24+
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
25+
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
26+
$(LIBRETRO_COMM_DIR)/file/file_path.c
2127

2228
SOURCES_C += $(DEPS_DIR)/libmad/bit.c \
2329
$(DEPS_DIR)/libmad/decoder.c \
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/* Copyright (C) 2010-2017 The RetroArch team
2+
*
3+
* ---------------------------------------------------------------------------------------
4+
* The following license statement only applies to this file (compat_posix_string.c).
5+
* ---------------------------------------------------------------------------------------
6+
*
7+
* Permission is hereby granted, free of charge,
8+
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
9+
* to deal in the Software without restriction, including without limitation the rights to
10+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11+
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
#include <ctype.h>
24+
25+
#include <compat/posix_string.h>
26+
27+
#ifdef _WIN32
28+
29+
#undef strcasecmp
30+
#undef strdup
31+
#undef isblank
32+
#undef strtok_r
33+
#include <ctype.h>
34+
#include <stdlib.h>
35+
#include <stddef.h>
36+
#include <compat/strl.h>
37+
38+
#include <string.h>
39+
40+
int retro_strcasecmp__(const char *a, const char *b)
41+
{
42+
while (*a && *b)
43+
{
44+
int a_ = tolower(*a);
45+
int b_ = tolower(*b);
46+
47+
if (a_ != b_)
48+
return a_ - b_;
49+
50+
a++;
51+
b++;
52+
}
53+
54+
return tolower(*a) - tolower(*b);
55+
}
56+
57+
char *retro_strdup__(const char *orig)
58+
{
59+
size_t len = strlen(orig) + 1;
60+
char *ret = (char*)malloc(len);
61+
if (!ret)
62+
return NULL;
63+
64+
strlcpy(ret, orig, len);
65+
return ret;
66+
}
67+
68+
int retro_isblank__(int c)
69+
{
70+
return (c == ' ') || (c == '\t');
71+
}
72+
73+
char *retro_strtok_r__(char *str, const char *delim, char **saveptr)
74+
{
75+
char *first = NULL;
76+
if (!saveptr || !delim)
77+
return NULL;
78+
79+
if (str)
80+
*saveptr = str;
81+
82+
do
83+
{
84+
char *ptr = NULL;
85+
first = *saveptr;
86+
while (*first && strchr(delim, *first))
87+
*first++ = '\0';
88+
89+
if (*first == '\0')
90+
return NULL;
91+
92+
ptr = first + 1;
93+
94+
while (*ptr && !strchr(delim, *ptr))
95+
ptr++;
96+
97+
*saveptr = ptr + (*ptr ? 1 : 0);
98+
*ptr = '\0';
99+
} while (strlen(first) == 0);
100+
101+
return first;
102+
}
103+
104+
#endif
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* Copyright (C) 2010-2017 The RetroArch team
2+
*
3+
* ---------------------------------------------------------------------------------------
4+
* The following license statement only applies to this file (compat_strcasestr.c).
5+
* ---------------------------------------------------------------------------------------
6+
*
7+
* Permission is hereby granted, free of charge,
8+
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
9+
* to deal in the Software without restriction, including without limitation the rights to
10+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11+
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
#include <ctype.h>
24+
25+
#include <compat/strcasestr.h>
26+
27+
/* Pretty much strncasecmp. */
28+
static int casencmp(const char *a, const char *b, size_t n)
29+
{
30+
size_t i;
31+
32+
for (i = 0; i < n; i++)
33+
{
34+
int a_lower = tolower(a[i]);
35+
int b_lower = tolower(b[i]);
36+
if (a_lower != b_lower)
37+
return a_lower - b_lower;
38+
}
39+
40+
return 0;
41+
}
42+
43+
char *strcasestr_retro__(const char *haystack, const char *needle)
44+
{
45+
size_t i, search_off;
46+
size_t hay_len = strlen(haystack);
47+
size_t needle_len = strlen(needle);
48+
49+
if (needle_len > hay_len)
50+
return NULL;
51+
52+
search_off = hay_len - needle_len;
53+
for (i = 0; i <= search_off; i++)
54+
if (!casencmp(haystack + i, needle, needle_len))
55+
return (char*)haystack + i;
56+
57+
return NULL;
58+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* Copyright (C) 2010-2015 The RetroArch team
2+
*
3+
* ---------------------------------------------------------------------------------------
4+
* The following license statement only applies to this file (compat_strl.c).
5+
* ---------------------------------------------------------------------------------------
6+
*
7+
* Permission is hereby granted, free of charge,
8+
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
9+
* to deal in the Software without restriction, including without limitation the rights to
10+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11+
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
#include <ctype.h>
24+
25+
#include <compat/strl.h>
26+
#include <compat/posix_string.h>
27+
28+
#include <retro_assert.h>
29+
30+
/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
31+
32+
#ifndef __MACH__
33+
34+
size_t strlcpy(char *dest, const char *source, size_t size)
35+
{
36+
size_t src_size = 0;
37+
size_t n = size;
38+
39+
if (n)
40+
while (--n && (*dest++ = *source++)) src_size++;
41+
42+
if (!n)
43+
{
44+
if (size) *dest = '\0';
45+
while (*source++) src_size++;
46+
}
47+
48+
return src_size;
49+
}
50+
51+
size_t strlcat(char *dest, const char *source, size_t size)
52+
{
53+
size_t len = strlen(dest);
54+
55+
dest += len;
56+
57+
if (len > size)
58+
size = 0;
59+
else
60+
size -= len;
61+
62+
return len + strlcpy(dest, source, size);
63+
}
64+
65+
#endif

0 commit comments

Comments
 (0)