Changes of Revision 3
libretro-picodrive.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Wed Sep 02 09:34:14 UTC 2020 - i@guoyunhe.me
4
+
5
+- Update to version 0~git20200816:
6
+ * Fix non-MSVC builds
7
+ * Fixed MSVC compilation, VFS
8
+
9
+-------------------------------------------------------------------
10
Sun Aug 09 10:56:09 UTC 2020 - i@guoyunhe.me
11
12
- Update to version 0~git20200716:
13
libretro-picodrive.spec
Changed
10
1
2
3
4
Name: libretro-picodrive
5
-Version: 0~git20200716
6
+Version: 0~git20200816
7
Release: 0
8
Summary: PicoDrive libretro core for MegaDrive/Genesis emulation
9
License: NonFree
10
_servicedata
Changed
9
1
2
<servicedata>
3
<service name="tar_scm">
4
<param name="url">https://github.com/libretro/picodrive.git</param>
5
- <param name="changesrevision">e6b80af200f19d8d518d427dc20314606e9d8510</param></service></servicedata>
6
\ No newline at end of file
7
+ <param name="changesrevision">68329d146bff07b3e8a827ed718d86422cebb67b</param></service></servicedata>
8
\ No newline at end of file
9
libretro-picodrive-0~git20200716.tar.xz/Makefile -> libretro-picodrive-0~git20200816.tar.xz/Makefile
Changed
9
1
2
ifeq "$(PLATFORM)" "libretro"
3
OBJS += platform/libretro/libretro.o
4
ifeq "$(USE_LIBRETRO_VFS)" "1"
5
+OBJS += platform/libretro/libretro-common/compat/compat_posix_string.o
6
OBJS += platform/libretro/libretro-common/compat/compat_strl.o
7
OBJS += platform/libretro/libretro-common/compat/fopen_utf8.o
8
OBJS += platform/libretro/libretro-common/encodings/encoding_utf.o
9
libretro-picodrive-0~git20200716.tar.xz/cpu/sh2/compiler.c -> libretro-picodrive-0~git20200816.tar.xz/cpu/sh2/compiler.c
Changed
81
1
2
// SR must and R0 should by all means be statically mapped.
3
// XXX the static definition of SR MUST match that in compiler.h
4
5
-#ifdef __arm__
6
+#if defined(__arm__) || defined(_M_ARM)
7
#include "../drc/emit_arm.c"
8
-#elif defined(__aarch64__)
9
+#elif defined(__aarch64__) || defined(_M_ARM64)
10
#include "../drc/emit_arm64.c"
11
#elif defined(__mips__)
12
#include "../drc/emit_mips.c"
13
14
#include "../drc/emit_riscv.c"
15
#elif defined(__powerpc__)
16
#include "../drc/emit_ppc.c"
17
-#elif defined(__i386__)
18
+#elif defined(__i386__) || defined(_M_X86)
19
#include "../drc/emit_x86.c"
20
-#elif defined(__x86_64__)
21
+#elif defined(__x86_64__) || defined(_M_X64)
22
#include "../drc/emit_x86.c"
23
#else
24
#error unsupported arch
25
26
emith_jump_patch(jump, bl->blx, &jump);
27
emith_jump_at(bl->blx, be->tcache_ptr);
28
if ((((uintptr_t)bl->blx & 0x1f) + emith_jump_at_size()-1) > 0x1f)
29
- host_instructions_updated(bl->blx, bl->blx + emith_jump_at_size()-1);
30
+ host_instructions_updated(bl->blx, (char*)bl->blx + emith_jump_at_size()-1);
31
}
32
} else {
33
printf("unknown BL type %d\n", bl->type);
34
35
// via blx: @jump near jumpcc to blx; @blx load target_pc, far jump
36
emith_jump_patch(bl->jump, bl->blx, &jump);
37
memcpy(bl->blx, bl->jdisp, emith_jump_at_size());
38
- host_instructions_updated(bl->blx, bl->blx + emith_jump_at_size()-1);
39
+ host_instructions_updated(bl->blx, (char*)bl->blx + emith_jump_at_size()-1);
40
} else {
41
printf("unknown BL type %d\n", bl->type);
42
exit(1);
43
44
case 0x03: // MOV Rm,Rn 0110nnnnmmmm0011
45
emit_move_r_r(GET_Rn(), GET_Rm());
46
goto end_op;
47
- case 0x07 ... 0x0f:
48
+ case 0x07:
49
+ case 0x08:
50
+ case 0x09:
51
+ case 0x0a:
52
+ case 0x0b:
53
+ case 0x0c:
54
+ case 0x0d:
55
+ case 0x0e:
56
+ case 0x0f:
57
tmp = rcache_get_reg(GET_Rm(), RC_GR_READ, NULL);
58
tmp2 = rcache_get_reg(GET_Rn(), RC_GR_WRITE, NULL);
59
switch (op & 0x0f)
60
61
// fill blx backup; do this last to backup final patched code
62
for (i = 0; i < block->entry_count; i++)
63
for (bl = block->entryp[i].o_links; bl; bl = bl->o_next)
64
- memcpy(bl->jdisp, bl->blx ?: bl->jump, emith_jump_at_size());
65
+ memcpy(bl->jdisp, bl->blx ? bl->blx : bl->jump, emith_jump_at_size());
66
67
ring_alloc(&tcache_ring[tcache_id], tcache_ptr - block_entry_ptr);
68
host_instructions_updated(block_entry_ptr, tcache_ptr);
69
70
71
*end_pc_out = end_pc;
72
if (base_literals_out != NULL)
73
- *base_literals_out = (lowest_literal ?: end_pc);
74
+ *base_literals_out = (lowest_literal ? lowest_literal : end_pc);
75
if (end_literals_out != NULL)
76
- *end_literals_out = (end_literals ?: end_pc);
77
+ *end_literals_out = (end_literals ? lowest_literal : end_pc);
78
79
// crc overflow handling, twice to collect all overflows
80
crc = (crc & 0xffff) + (crc >> 16);
81
libretro-picodrive-0~git20200716.tar.xz/pico/32x/memory.c -> libretro-picodrive-0~git20200816.tar.xz/pico/32x/memory.c
Changed
50
1
2
static void REGPARM(3) sh2_write32_sdram(u32 a, u32 d, SH2 *sh2)
3
{
4
u32 a1 = a & 0x3fffc;
5
- *(u32 *)(sh2->p_sdram + a1) = (d << 16) | (d >> 16);
6
+ *(u32 *)((char*)sh2->p_sdram + a1) = (d << 16) | (d >> 16);
7
#ifdef DRC_SH2
8
u8 *p = sh2->p_drcblk_ram;
9
u32 t = p[a1 >> SH2_DRCBLK_RAM_SHIFT];
10
11
} else if ((a & 0xc6000000) == 0x02000000) {
12
// banked ROM. Return bank address
13
u32 bank = carthw_ssf2_banks[(a >> 19) & 7] << 19;
14
- ret = sh2->p_rom + bank;
15
+ ret = (char*)sh2->p_rom + bank;
16
*mask = 0x07ffff;
17
}
18
19
20
return 0;
21
if ((ps = p32x_sh2_get_mem_ptr(src, &mask, sh2)) == (void *)-1)
22
return 0;
23
+#if _MSC_VER
24
+ (char*)ps += src & mask;
25
+#else
26
ps += src & mask;
27
+#endif
28
len = count * size;
29
30
// DRAM in byte access is always in overwrite mode
31
32
// align dst to halfword
33
if (dst & 1) {
34
p32x_sh2_write8(dst, *(u8 *)((uptr)ps ^ 1), sh2);
35
+#if _MSC_VER
36
+ ((char*)ps)++, dst++, len --;
37
+#else
38
ps++, dst++, len --;
39
+#endif
40
}
41
42
// copy data
43
if ((uptr)ps & 1) {
44
// unaligned, use halfword copy mode to reduce memory bandwidth
45
- u16 *sp = (u16 *)(ps - 1);
46
+ u16 *sp = (u16 *)((char*)ps - 1);
47
u16 dl, dh = *sp++;
48
for (i = 0; i < (len & ~1); i += 2, dst += 2, sp++) {
49
dl = dh, dh = *sp;
50
libretro-picodrive-0~git20200716.tar.xz/pico/draw.c -> libretro-picodrive-0~git20200816.tar.xz/pico/draw.c
Changed
10
1
2
if (dest != NULL) {
3
DrawLineDestBase = dest;
4
DrawLineDestIncrement = increment;
5
- Pico.est.DrawLineDest = DrawLineDestBase + Pico.est.DrawScanline * increment;
6
+ Pico.est.DrawLineDest = (char*)DrawLineDestBase + Pico.est.DrawScanline * increment;
7
}
8
else {
9
DrawLineDestBase = DefOutBuff;
10
libretro-picodrive-0~git20200816.tar.xz/platform/libretro/libretro-common/compat/compat_posix_string.c
Added
106
1
2
+/* Copyright (C) 2010-2018 The RetroArch team
3
+ *
4
+ * ---------------------------------------------------------------------------------------
5
+ * The following license statement only applies to this file (compat_posix_string.c).
6
+ * ---------------------------------------------------------------------------------------
7
+ *
8
+ * Permission is hereby granted, free of charge,
9
+ * to any person obtaining a copy of this software and associated documentation files (the "Software"),
10
+ * to deal in the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
12
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+#include <ctype.h>
25
+
26
+#include <compat/posix_string.h>
27
+
28
+#ifdef _WIN32
29
+
30
+#undef strcasecmp
31
+#undef strdup
32
+#undef isblank
33
+#undef strtok_r
34
+#include <ctype.h>
35
+#include <stdlib.h>
36
+#include <stddef.h>
37
+#include <compat/strl.h>
38
+
39
+#include <string.h>
40
+
41
+int retro_strcasecmp__(const char *a, const char *b)
42
+{
43
+ while (*a && *b)
44
+ {
45
+ int a_ = tolower(*a);
46
+ int b_ = tolower(*b);
47
+
48
+ if (a_ != b_)
49
+ return a_ - b_;
50
+
51
+ a++;
52
+ b++;
53
+ }
54
+
55
+ return tolower(*a) - tolower(*b);
56
+}
57
+
58
+char *retro_strdup__(const char *orig)
59
+{
60
+ size_t len = strlen(orig) + 1;
61
+ char *ret = (char*)malloc(len);
62
+ if (!ret)
63
+ return NULL;
64
+
65
+ strlcpy(ret, orig, len);
66
+ return ret;
67
+}
68
+
69
+int retro_isblank__(int c)
70
+{
71
+ return (c == ' ') || (c == '\t');
72
+}
73
+
74
+char *retro_strtok_r__(char *str, const char *delim, char **saveptr)
75
+{
76
+ char *first = NULL;
77
+ if (!saveptr || !delim)
78
+ return NULL;
79
+
80
+ if (str)
81
+ *saveptr = str;
82
+
83
+ do
84
+ {
85
+ char *ptr = NULL;
86
+ first = *saveptr;
87
+ while (*first && strchr(delim, *first))
88
+ *first++ = '\0';
89
+
90
+ if (*first == '\0')
91
+ return NULL;
92
+
93
+ ptr = first + 1;
94
+
95
+ while (*ptr && !strchr(delim, *ptr))
96
+ ptr++;
97
+
98
+ *saveptr = ptr + (*ptr ? 1 : 0);
99
+ *ptr = '\0';
100
+ } while (strlen(first) == 0);
101
+
102
+ return first;
103
+}
104
+
105
+#endif
106
libretro-picodrive-0~git20200816.tar.xz/platform/libretro/libretro-common/include/file
Added
2
1
+(directory)
2
libretro-picodrive-0~git20200816.tar.xz/platform/libretro/libretro-common/include/file/file_path.h
Added
533
1
2
+/* Copyright (C) 2010-2019 The RetroArch team
3
+ *
4
+ * ---------------------------------------------------------------------------------------
5
+ * The following license statement only applies to this file (file_path.h).
6
+ * ---------------------------------------------------------------------------------------
7
+ *
8
+ * Permission is hereby granted, free of charge,
9
+ * to any person obtaining a copy of this software and associated documentation files (the "Software"),
10
+ * to deal in the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
12
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+#ifndef __LIBRETRO_SDK_FILE_PATH_H
25
+#define __LIBRETRO_SDK_FILE_PATH_H
26
+
27
+#include <stdio.h>
28
+#include <stdint.h>
29
+#include <stddef.h>
30
+#include <sys/types.h>
31
+
32
+#include <libretro.h>
33
+#include <retro_common_api.h>
34
+
35
+#include <boolean.h>
36
+
37
+RETRO_BEGIN_DECLS
38
+
39
+#define PATH_REQUIRED_VFS_VERSION 3
40
+
41
+void path_vfs_init(const struct retro_vfs_interface_info* vfs_info);
42
+
43
+/* Order in this enum is equivalent to negative sort order in filelist
44
+ * (i.e. DIRECTORY is on top of PLAIN_FILE) */
45
+enum
46
+{
47
+ RARCH_FILETYPE_UNSET,
48
+ RARCH_PLAIN_FILE,
49
+ RARCH_COMPRESSED_FILE_IN_ARCHIVE,
50
+ RARCH_COMPRESSED_ARCHIVE,
51
+ RARCH_DIRECTORY,
52
+ RARCH_FILE_UNSUPPORTED
53
+};
54
+
55
+/**
56
+ * path_is_compressed_file:
57
+ * @path : path
58
+ *
59
+ * Checks if path is a compressed file.
60
+ *
61
+ * Returns: true (1) if path is a compressed file, otherwise false (0).
62
+ **/
63
+bool path_is_compressed_file(const char *path);
64
+
65
+/**
66
+ * path_contains_compressed_file:
67
+ * @path : path
68
+ *
69
+ * Checks if path contains a compressed file.
70
+ *
71
+ * Currently we only check for hash symbol (#) inside the pathname.
72
+ * If path is ever expanded to a general URI, we should check for that here.
73
+ *
74
+ * Example: Somewhere in the path there might be a compressed file
75
+ * E.g.: /path/to/file.7z#mygame.img
76
+ *
77
+ * Returns: true (1) if path contains compressed file, otherwise false (0).
78
+ **/
79
+#define path_contains_compressed_file(path) (path_get_archive_delim((path)) != NULL)
80
+
81
+/**
82
+ * path_get_archive_delim:
83
+ * @path : path
84
+ *
85
+ * Gets delimiter of an archive file. Only the first '#'
86
+ * after a compression extension is considered.
87
+ *
88
+ * Returns: pointer to the delimiter in the path if it contains
89
+ * a compressed file, otherwise NULL.
90
+ */
91
+const char *path_get_archive_delim(const char *path);
92
+
93
+/**
94
+ * path_get_extension:
95
+ * @path : path
96
+ *
97
+ * Gets extension of file. Only '.'s
98
+ * after the last slash are considered.
99
+ *
100
+ * Returns: extension part from the path.
101
+ */
102
+const char *path_get_extension(const char *path);
103
+
104
+/**
105
+ * path_remove_extension:
106
+ * @path : path
107
+ *
108
+ * Mutates path by removing its extension. Removes all
109
+ * text after and including the last '.'.
110
+ * Only '.'s after the last slash are considered.
111
+ *
112
+ * Returns:
113
+ * 1) If path has an extension, returns path with the
114
+ * extension removed.
115
+ * 2) If there is no extension, returns NULL.
116
+ * 3) If path is empty or NULL, returns NULL
117
+ */
118
+char *path_remove_extension(char *path);
119
+
120
+/**
121
+ * path_basename:
122
+ * @path : path
123
+ *
124
+ * Get basename from @path.
125
+ *
126
+ * Returns: basename from path.
127
+ **/
128
+const char *path_basename(const char *path);
129
+
130
+/**
131
+ * path_basedir:
132
+ * @path : path
133
+ *
134
+ * Extracts base directory by mutating path.
135
+ * Keeps trailing '/'.
136
+ **/
137
+void path_basedir(char *path);
138
+
139
+/**
140
+ * path_parent_dir:
141
+ * @path : path
142
+ *
143
+ * Extracts parent directory by mutating path.
144
+ * Assumes that path is a directory. Keeps trailing '/'.
145
+ * If the path was already at the root directory, returns empty string
146
+ **/
147
+void path_parent_dir(char *path);
148
+
149
+/**
150
+ * path_resolve_realpath:
151
+ * @buf : input and output buffer for path
152
+ * @size : size of buffer
153
+ * @resolve_symlinks : whether to resolve symlinks or not
154
+ *
155
+ * Resolves use of ".", "..", multiple slashes etc in absolute paths.
156
+ *
157
+ * Relative paths are rebased on the current working dir.
158
+ *
159
+ * Returns: @buf if successful, NULL otherwise.
160
+ * Note: Not implemented on consoles
161
+ * Note: Symlinks are only resolved on Unix-likes
162
+ * Note: The current working dir might not be what you expect,
163
+ * e.g. on Android it is "/"
164
+ * Use of fill_pathname_resolve_relative() should be prefered
165
+ **/
166
+char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks);
167
+
168
+/**
169
+ * path_relative_to:
170
+ * @out : buffer to write the relative path to
171
+ * @path : path to be expressed relatively
172
+ * @base : relative to this
173
+ * @size : size of output buffer
174
+ *
175
+ * Turns @path into a path relative to @base and writes it to @out.
176
+ *
177
+ * @base is assumed to be a base directory, i.e. a path ending with '/' or '\'.
178
+ * Both @path and @base are assumed to be absolute paths without "." or "..".
179
+ *
180
+ * E.g. path /a/b/e/f.cgp with base /a/b/c/d/ turns into ../../e/f.cgp
181
+ **/
182
+void path_relative_to(char *out, const char *path, const char *base, size_t size);
183
+
184
+/**
185
+ * path_is_absolute:
186
+ * @path : path
187
+ *
188
+ * Checks if @path is an absolute path or a relative path.
189
+ *
190
+ * Returns: true if path is absolute, false if path is relative.
191
+ **/
192
+bool path_is_absolute(const char *path);
193
+
194
+/**
195
+ * fill_pathname:
196
+ * @out_path : output path
197
+ * @in_path : input path
198
+ * @replace : what to replace
199
+ * @size : buffer size of output path
200
+ *
201
+ * FIXME: Verify
202
+ *
203
+ * Replaces filename extension with 'replace' and outputs result to out_path.
204
+ * The extension here is considered to be the string from the last '.'
205
+ * to the end.
206
+ *
207
+ * Only '.'s after the last slash are considered as extensions.
208
+ * If no '.' is present, in_path and replace will simply be concatenated.
209
+ * 'size' is buffer size of 'out_path'.
210
+ * E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
211
+ * out_path = "/foo/bar/baz/boo.asm"
212
+ * E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" =>
213
+ * out_path = "/foo/bar/baz/boo"
214
+ */
215
+void fill_pathname(char *out_path, const char *in_path,
216
+ const char *replace, size_t size);
217
+
218
+/**
219
+ * fill_dated_filename:
220
+ * @out_filename : output filename
221
+ * @ext : extension of output filename
222
+ * @size : buffer size of output filename
223
+ *
224
+ * Creates a 'dated' filename prefixed by 'RetroArch', and
225
+ * concatenates extension (@ext) to it.
226
+ *
227
+ * E.g.:
228
+ * out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}"
229
+ **/
230
+void fill_dated_filename(char *out_filename,
231
+ const char *ext, size_t size);
232
+
233
+/**
234
+ * fill_str_dated_filename:
235
+ * @out_filename : output filename
236
+ * @in_str : input string
237
+ * @ext : extension of output filename
238
+ * @size : buffer size of output filename
239
+ *
240
+ * Creates a 'dated' filename prefixed by the string @in_str, and
241
+ * concatenates extension (@ext) to it.
242
+ *
243
+ * E.g.:
244
+ * out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}"
245
+ **/
246
+void fill_str_dated_filename(char *out_filename,
247
+ const char *in_str, const char *ext, size_t size);
248
+
249
+/**
250
+ * fill_pathname_noext:
251
+ * @out_path : output path
252
+ * @in_path : input path
253
+ * @replace : what to replace
254
+ * @size : buffer size of output path
255
+ *
256
+ * Appends a filename extension 'replace' to 'in_path', and outputs
257
+ * result in 'out_path'.
258
+ *
259
+ * Assumes in_path has no extension. If an extension is still
260
+ * present in 'in_path', it will be ignored.
261
+ *
262
+ */
263
+void fill_pathname_noext(char *out_path, const char *in_path,
264
+ const char *replace, size_t size);
265
+
266
+/**
267
+ * find_last_slash:
268
+ * @str : input path
269
+ *
270
+ * Gets a pointer to the last slash in the input path.
271
+ *
272
+ * Returns: a pointer to the last slash in the input path.
273
+ **/
274
+char *find_last_slash(const char *str);
275
+
276
+/**
277
+ * fill_pathname_dir:
278
+ * @in_dir : input directory path
279
+ * @in_basename : input basename to be appended to @in_dir
280
+ * @replace : replacement to be appended to @in_basename
281
+ * @size : size of buffer
282
+ *
283
+ * Appends basename of 'in_basename', to 'in_dir', along with 'replace'.
284
+ * Basename of in_basename is the string after the last '/' or '\\',
285
+ * i.e the filename without directories.
286
+ *
287
+ * If in_basename has no '/' or '\\', the whole 'in_basename' will be used.
288
+ * 'size' is buffer size of 'in_dir'.
289
+ *
290
+ * E.g..: in_dir = "/tmp/some_dir", in_basename = "/some_content/foo.c",
291
+ * replace = ".asm" => in_dir = "/tmp/some_dir/foo.c.asm"
292
+ **/
293
+void fill_pathname_dir(char *in_dir, const char *in_basename,
294
+ const char *replace, size_t size);
295
+
296
+/**
297
+ * fill_pathname_base:
298
+ * @out : output path
299
+ * @in_path : input path
300
+ * @size : size of output path
301
+ *
302
+ * Copies basename of @in_path into @out_path.
303
+ **/
304
+void fill_pathname_base(char *out_path, const char *in_path, size_t size);
305
+
306
+void fill_pathname_base_noext(char *out_dir,
307
+ const char *in_path, size_t size);
308
+
309
+void fill_pathname_base_ext(char *out,
310
+ const char *in_path, const char *ext,
311
+ size_t size);
312
+
313
+/**
314
+ * fill_pathname_basedir:
315
+ * @out_dir : output directory
316
+ * @in_path : input path
317
+ * @size : size of output directory
318
+ *
319
+ * Copies base directory of @in_path into @out_path.
320
+ * If in_path is a path without any slashes (relative current directory),
321
+ * @out_path will get path "./".
322
+ **/
323
+void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
324
+
325
+void fill_pathname_basedir_noext(char *out_dir,
326
+ const char *in_path, size_t size);
327
+
328
+/**
329
+ * fill_pathname_parent_dir_name:
330
+ * @out_dir : output directory
331
+ * @in_dir : input directory
332
+ * @size : size of output directory
333
+ *
334
+ * Copies only the parent directory name of @in_dir into @out_dir.
335
+ * The two buffers must not overlap. Removes trailing '/'.
336
+ * Returns true on success, false if a slash was not found in the path.
337
+ **/
338
+bool fill_pathname_parent_dir_name(char *out_dir,
339
+ const char *in_dir, size_t size);
340
+
341
+/**
342
+ * fill_pathname_parent_dir:
343
+ * @out_dir : output directory
344
+ * @in_dir : input directory
345
+ * @size : size of output directory
346
+ *
347
+ * Copies parent directory of @in_dir into @out_dir.
348
+ * Assumes @in_dir is a directory. Keeps trailing '/'.
349
+ * If the path was already at the root directory, @out_dir will be an empty string.
350
+ **/
351
+void fill_pathname_parent_dir(char *out_dir,
352
+ const char *in_dir, size_t size);
353
+
354
+/**
355
+ * fill_pathname_resolve_relative:
356
+ * @out_path : output path
357
+ * @in_refpath : input reference path
358
+ * @in_path : input path
359
+ * @size : size of @out_path
360
+ *
361
+ * Joins basedir of @in_refpath together with @in_path.
362
+ * If @in_path is an absolute path, out_path = in_path.
363
+ * E.g.: in_refpath = "/foo/bar/baz.a", in_path = "foobar.cg",
364
+ * out_path = "/foo/bar/foobar.cg".
365
+ **/
366
+void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
367
+ const char *in_path, size_t size);
368
+
369
+/**
370
+ * fill_pathname_join:
371
+ * @out_path : output path
372
+ * @dir : directory
373
+ * @path : path
374
+ * @size : size of output path
375
+ *
376
+ * Joins a directory (@dir) and path (@path) together.
377
+ * Makes sure not to get two consecutive slashes
378
+ * between directory and path.
379
+ **/
380
+void fill_pathname_join(char *out_path, const char *dir,
381
+ const char *path, size_t size);
382
+
383
+void fill_pathname_join_special_ext(char *out_path,
384
+ const char *dir, const char *path,
385
+ const char *last, const char *ext,
386
+ size_t size);
387
+
388
+void fill_pathname_join_concat_noext(char *out_path,
389
+ const char *dir, const char *path,
390
+ const char *concat,
391
+ size_t size);
392
+
393
+void fill_pathname_join_concat(char *out_path,
394
+ const char *dir, const char *path,
395
+ const char *concat,
396
+ size_t size);
397
+
398
+void fill_pathname_join_noext(char *out_path,
399
+ const char *dir, const char *path, size_t size);
400
+
401
+/**
402
+ * fill_pathname_join_delim:
403
+ * @out_path : output path
404
+ * @dir : directory
405
+ * @path : path
406
+ * @delim : delimiter
407
+ * @size : size of output path
408
+ *
409
+ * Joins a directory (@dir) and path (@path) together
410
+ * using the given delimiter (@delim).
411
+ **/
412
+void fill_pathname_join_delim(char *out_path, const char *dir,
413
+ const char *path, const char delim, size_t size);
414
+
415
+void fill_pathname_join_delim_concat(char *out_path, const char *dir,
416
+ const char *path, const char delim, const char *concat,
417
+ size_t size);
418
+
419
+/**
420
+ * fill_short_pathname_representation:
421
+ * @out_rep : output representation
422
+ * @in_path : input path
423
+ * @size : size of output representation
424
+ *
425
+ * Generates a short representation of path. It should only
426
+ * be used for displaying the result; the output representation is not
427
+ * binding in any meaningful way (for a normal path, this is the same as basename)
428
+ * In case of more complex URLs, this should cut everything except for
429
+ * the main image file.
430
+ *
431
+ * E.g.: "/path/to/game.img" -> game.img
432
+ * "/path/to/myarchive.7z#folder/to/game.img" -> game.img
433
+ */
434
+void fill_short_pathname_representation(char* out_rep,
435
+ const char *in_path, size_t size);
436
+
437
+void fill_short_pathname_representation_noext(char* out_rep,
438
+ const char *in_path, size_t size);
439
+
440
+void fill_pathname_expand_special(char *out_path,
441
+ const char *in_path, size_t size);
442
+
443
+void fill_pathname_abbreviate_special(char *out_path,
444
+ const char *in_path, size_t size);
445
+
446
+/**
447
+ * path_basedir:
448
+ * @path : path
449
+ *
450
+ * Extracts base directory by mutating path.
451
+ * Keeps trailing '/'.
452
+ **/
453
+void path_basedir_wrapper(char *path);
454
+
455
+/**
456
+ * path_char_is_slash:
457
+ * @c : character
458
+ *
459
+ * Checks if character (@c) is a slash.
460
+ *
461
+ * Returns: true (1) if character is a slash, otherwise false (0).
462
+ */
463
+#ifdef _WIN32
464
+#define path_char_is_slash(c) (((c) == '/') || ((c) == '\\'))
465
+#else
466
+#define path_char_is_slash(c) ((c) == '/')
467
+#endif
468
+
469
+/**
470
+ * path_default_slash and path_default_slash_c:
471
+ *
472
+ * Gets the default slash separator.
473
+ *
474
+ * Returns: default slash separator.
475
+ */
476
+#ifdef _WIN32
477
+#define path_default_slash() "\\"
478
+#define path_default_slash_c() '\\'
479
+#else
480
+#define path_default_slash() "/"
481
+#define path_default_slash_c() '/'
482
+#endif
483
+
484
+/**
485
+ * fill_pathname_slash:
486
+ * @path : path
487
+ * @size : size of path
488
+ *
489
+ * Assumes path is a directory. Appends a slash
490
+ * if not already there.
491
+ **/
492
+void fill_pathname_slash(char *path, size_t size);
493
+
494
+#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
495
+void fill_pathname_application_path(char *buf, size_t size);
496
+void fill_pathname_application_dir(char *buf, size_t size);
497
+void fill_pathname_home_dir(char *buf, size_t size);
498
+#endif
499
+
500
+/**
501
+ * path_mkdir:
502
+ * @dir : directory
503
+ *
504
+ * Create directory on filesystem.
505
+ *
506
+ * Returns: true (1) if directory could be created, otherwise false (0).
507
+ **/
508
+bool path_mkdir(const char *dir);
509
+
510
+/**
511
+ * path_is_directory:
512
+ * @path : path
513
+ *
514
+ * Checks if path is a directory.
515
+ *
516
+ * Returns: true (1) if path is a directory, otherwise false (0).
517
+ */
518
+bool path_is_directory(const char *path);
519
+
520
+bool path_is_character_special(const char *path);
521
+
522
+int path_stat(const char *path);
523
+
524
+bool path_is_valid(const char *path);
525
+
526
+int32_t path_get_size(const char *path);
527
+
528
+bool is_path_accessible_using_standard_io(const char *path);
529
+
530
+RETRO_END_DECLS
531
+
532
+#endif
533
libretro-picodrive-0~git20200816.tar.xz/platform/libretro/libretro-common/include/vfs/vfs.h
Added
113
1
2
+/* Copyright (C) 2010-2019 The RetroArch team
3
+*
4
+* ---------------------------------------------------------------------------------------
5
+* The following license statement only applies to this file (vfs_implementation.h).
6
+* ---------------------------------------------------------------------------------------
7
+*
8
+* Permission is hereby granted, free of charge,
9
+* to any person obtaining a copy of this software and associated documentation files (the "Software"),
10
+* to deal in the Software without restriction, including without limitation the rights to
11
+* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
12
+* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
+*
14
+* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15
+*
16
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17
+* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+*/
23
+
24
+#ifndef __LIBRETRO_SDK_VFS_H
25
+#define __LIBRETRO_SDK_VFS_H
26
+
27
+#include <retro_common_api.h>
28
+#include <boolean.h>
29
+
30
+#ifdef RARCH_INTERNAL
31
+#ifndef VFS_FRONTEND
32
+#define VFS_FRONTEND
33
+#endif
34
+#endif
35
+
36
+RETRO_BEGIN_DECLS
37
+
38
+#ifdef _WIN32
39
+typedef void* HANDLE;
40
+#endif
41
+
42
+#ifdef HAVE_CDROM
43
+typedef struct
44
+{
45
+ char *cue_buf;
46
+ size_t cue_len;
47
+ int64_t byte_pos;
48
+ char drive;
49
+ unsigned char cur_min;
50
+ unsigned char cur_sec;
51
+ unsigned char cur_frame;
52
+ unsigned char cur_track;
53
+ unsigned cur_lba;
54
+ unsigned last_frame_lba;
55
+ unsigned char last_frame[2352];
56
+ bool last_frame_valid;
57
+} vfs_cdrom_t;
58
+#endif
59
+
60
+enum vfs_scheme
61
+{
62
+ VFS_SCHEME_NONE = 0,
63
+ VFS_SCHEME_CDROM
64
+};
65
+
66
+#ifndef __WINRT__
67
+#ifdef VFS_FRONTEND
68
+struct retro_vfs_file_handle
69
+#else
70
+struct libretro_vfs_implementation_file
71
+#endif
72
+{
73
+ int fd;
74
+ unsigned hints;
75
+ int64_t size;
76
+ char *buf;
77
+ FILE *fp;
78
+#ifdef _WIN32
79
+ HANDLE fh;
80
+#endif
81
+ char* orig_path;
82
+ uint64_t mappos;
83
+ uint64_t mapsize;
84
+ uint8_t *mapped;
85
+ enum vfs_scheme scheme;
86
+#ifdef HAVE_CDROM
87
+ vfs_cdrom_t cdrom;
88
+#endif
89
+};
90
+#endif
91
+
92
+/* Replace the following symbol with something appropriate
93
+ * to signify the file is being compiled for a front end instead of a core.
94
+ * This allows the same code to act as reference implementation
95
+ * for VFS and as fallbacks for when the front end does not provide VFS functionality.
96
+ */
97
+
98
+#ifdef VFS_FRONTEND
99
+typedef struct retro_vfs_file_handle libretro_vfs_implementation_file;
100
+#else
101
+typedef struct libretro_vfs_implementation_file libretro_vfs_implementation_file;
102
+#endif
103
+
104
+#ifdef VFS_FRONTEND
105
+typedef struct retro_vfs_dir_handle libretro_vfs_implementation_dir;
106
+#else
107
+typedef struct libretro_vfs_implementation_dir libretro_vfs_implementation_dir;
108
+#endif
109
+
110
+RETRO_END_DECLS
111
+
112
+#endif
113