Skip to content

Commit

Permalink
Merge pull request #100 from negativeExponent/updates
Browse files Browse the repository at this point in the history
input multitap disable feature, fixes and cleanup
  • Loading branch information
inactive123 authored Sep 25, 2020
2 parents 361089d + 0a9ba07 commit e3953f9
Show file tree
Hide file tree
Showing 70 changed files with 2,308 additions and 1,231 deletions.
3 changes: 2 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,6 @@ ifneq ($(STATIC_LINKING), 1)
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
$(LIBRETRO_COMM_DIR)/memmap/memalign.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/time/rtime.c
endif
5 changes: 5 additions & 0 deletions deps/zlib/gzguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/

#ifndef GZGUTS_H
#define GZGUTS_H

#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
Expand Down Expand Up @@ -191,3 +194,5 @@ char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
unsigned ZLIB_INTERNAL gz_intmax OF((void));
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif

#endif /* GZGUTS_H */
5 changes: 5 additions & 0 deletions deps/zlib/inffast.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
subject to change. Applications should only use zlib.h.
*/

#ifndef INFFAST_H
#define INFFAST_H

void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));

#endif /* INFFAST_H */
6 changes: 6 additions & 0 deletions deps/zlib/inflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
the crc code when it is not needed. For shared libraries, gzip decoding
should be left enabled. */

#ifndef INFLATE_H
#define INFLATE_H

#ifndef NO_GZIP
# define GUNZIP
#endif
Expand Down Expand Up @@ -120,3 +124,5 @@ struct inflate_state {
int back; /* bits back of last unprocessed length/lit */
unsigned was; /* initial length of match */
};

#endif /* INFLATE_H */
5 changes: 5 additions & 0 deletions deps/zlib/inftrees.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
subject to change. Applications should only use zlib.h.
*/

#ifndef INFTREES_H
#define INFTREES_H

/* Structure for decoding tables. Each entry provides either the
information needed to do the operation requested by the code that
indexed that table entry, or it provides a pointer to another
Expand Down Expand Up @@ -60,3 +63,5 @@ typedef enum {
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work));

#endif /* INFTREES_H */
57 changes: 38 additions & 19 deletions libretro-common/cdrom/cdrom.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2019 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (cdrom.c).
Expand Down Expand Up @@ -96,6 +96,7 @@ void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame)
*frame = (*frame < 74) ? (*frame + 1) : 0;
}

#ifdef CDROM_DEBUG
static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
{
unsigned i;
Expand Down Expand Up @@ -252,6 +253,7 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)

fflush(stdout);
}
#endif

#if defined(_WIN32) && !defined(_XBOX)
static int cdrom_send_command_win32(const libretro_vfs_implementation_file *stream, CDROM_CMD_Direction dir, void *buf, size_t len, unsigned char *cmd, size_t cmd_len, unsigned char *sense, size_t sense_len)
Expand Down Expand Up @@ -519,7 +521,9 @@ static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CM
}
else
{
#ifdef CDROM_DEBUG
cdrom_print_sense_data(sense, sizeof(sense));
#endif

/* INQUIRY/TEST/SENSE should never fail, don't retry. */
/* READ ATIP seems to fail outright on some drives with pressed discs, skip retries. */
Expand Down Expand Up @@ -672,7 +676,9 @@ int cdrom_get_sense(libretro_vfs_implementation_file *stream, unsigned char *sen
if (rv)
return 1;

#ifdef CDROM_DEBUG
cdrom_print_sense_data(buf, sizeof(buf));
#endif

return 0;
}
Expand Down Expand Up @@ -1336,22 +1342,26 @@ struct string_list* cdrom_get_available_drives(void)

for (i = 0; i < (int)dir_list->size; i++)
{
if (strstr(dir_list->elems[i].data, "/dev/sg"))
if (string_starts_with_size(dir_list->elems[i].data, "/dev/sg",
STRLEN_CONST("/dev/sg")))
{
char drive_model[32] = {0};
char drive_string[33] = {0};
union string_list_elem_attr attr = {0};
int dev_index = 0;
RFILE *file = filestream_open(dir_list->elems[i].data, RETRO_VFS_FILE_ACCESS_READ, 0);
libretro_vfs_implementation_file *stream;
bool is_cdrom = false;
char drive_model[32] = {0};
char drive_string[33] = {0};
union string_list_elem_attr attr = {0};
int dev_index = 0;
RFILE *file = filestream_open(
dir_list->elems[i].data, RETRO_VFS_FILE_ACCESS_READ, 0);
bool is_cdrom = false;

found = true;

if (!file)
{
#ifdef CDROM_DEBUG
printf("[CDROM] Could not open %s, please check permissions.\n", dir_list->elems[i].data);
fflush(stdout);
#endif
continue;
}

Expand All @@ -1362,10 +1372,11 @@ struct string_list* cdrom_get_available_drives(void)
if (!is_cdrom)
continue;

sscanf(dir_list->elems[i].data + strlen("/dev/sg"), "%d", &dev_index);
sscanf(dir_list->elems[i].data + STRLEN_CONST("/dev/sg"),
"%d", &dev_index);

dev_index = '0' + dev_index;
attr.i = dev_index;
attr.i = dev_index;

if (!string_is_empty(drive_model))
strlcat(drive_string, drive_model, sizeof(drive_string));
Expand All @@ -1378,29 +1389,34 @@ struct string_list* cdrom_get_available_drives(void)

if (!found)
{
char *buf = NULL;
char *buf = NULL;
int64_t len = 0;

if (filestream_read_file("/proc/modules", (void**)&buf, &len))
{
struct string_list *mods = string_split(buf, "\n");
bool found = false;
#ifdef CDROM_DEBUG
bool found = false;
#endif
struct string_list mods = {0};

if (mods)
string_list_initialize(&mods);

if (string_split_noalloc(&mods, buf, "\n"))
{

for (i = 0; i < mods->size; i++)
for (i = 0; i < mods.size; i++)
{
if (strcasestr(mods->elems[i].data, "sg "))
if (strcasestr(mods.elems[i].data, "sg "))
{
#ifdef CDROM_DEBUG
found = true;
#endif
break;
}
}

string_list_free(mods);
}
string_list_deinitialize(&mods);

#ifdef CDROM_DEBUG
if (found)
{
printf("[CDROM] No sg devices found but kernel module is loaded.\n");
Expand All @@ -1411,12 +1427,15 @@ struct string_list* cdrom_get_available_drives(void)
printf("[CDROM] No sg devices found and sg kernel module is not loaded.\n");
fflush(stdout);
}
#endif
}
#ifdef CDROM_DEBUG
else
{
printf("[CDROM] No sg devices found, could not check if sg kernel module is loaded.\n");
fflush(stdout);
}
#endif
}

string_list_free(dir_list);
Expand Down
2 changes: 1 addition & 1 deletion libretro-common/compat/compat_posix_string.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_posix_string.c).
Expand Down
2 changes: 1 addition & 1 deletion libretro-common/compat/compat_snprintf.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_snprintf.c).
Expand Down
2 changes: 1 addition & 1 deletion libretro-common/compat/compat_strcasestr.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_strcasestr.c).
Expand Down
2 changes: 1 addition & 1 deletion libretro-common/compat/compat_strl.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_strl.c).
Expand Down
2 changes: 1 addition & 1 deletion libretro-common/compat/fopen_utf8.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (fopen_utf8.c).
Expand Down
Loading

0 comments on commit e3953f9

Please sign in to comment.