From 7f59757eea364f99c34e3a3efdbf628a9bffa5d8 Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Wed, 18 Dec 2024 21:43:52 +0000 Subject: [PATCH] 3rdparty/libchdr: Purge almost all remaining patches Leaving only the chd_read_header_* functions, of which exists an equivalent in later libchdr versions --- 3rdparty/libchdr/include/libchdr/cdrom.h | 26 ++++++++------------- 3rdparty/libchdr/include/libchdr/chd.h | 2 +- 3rdparty/libchdr/src/libchdr_cdrom.c | 29 ------------------------ 3rdparty/libchdr/src/libchdr_chd.c | 3 +-- 4 files changed, 11 insertions(+), 49 deletions(-) diff --git a/3rdparty/libchdr/include/libchdr/cdrom.h b/3rdparty/libchdr/include/libchdr/cdrom.h index 0e978473e6..816e6a5c4f 100644 --- a/3rdparty/libchdr/include/libchdr/cdrom.h +++ b/3rdparty/libchdr/include/libchdr/cdrom.h @@ -10,12 +10,10 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __CDROM_H__ +#define __CDROM_H__ #include -#include #include /*************************************************************************** @@ -49,15 +47,11 @@ enum enum { - CD_SUB_NONE = 0, /* no subcode data stored */ - CD_SUB_RAW_INTERLEAVED, /* raw interleaved 96 bytes per sector */ - CD_SUB_RAW, /* raw non-interleaved 96 bytes per sector */ + CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */ + CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */ + CD_SUB_NONE /* no subcode data stored */ }; -const char* cdrom_get_subtype_string(uint32_t subtype); -bool cdrom_parse_subtype_string(const char* typestring, uint32_t* subtype, uint32_t* subsize); - - #define CD_FLAG_GDROM 0x00000001 /* disc is a GD-ROM, all tracks should be stored with GD-ROM metadata */ #define CD_FLAG_GDROMLE 0x00000002 /* legacy GD-ROM, with little-endian CDDA data */ @@ -87,10 +81,10 @@ static inline uint32_t lba_to_msf(uint32_t lba) { uint8_t m, s, f; - m = (uint8_t)(lba / (60 * 75)); + m = lba / (60 * 75); lba -= m * (60 * 75); - s = (uint8_t)(lba / 75); - f = (uint8_t)(lba % 75); + s = lba / 75; + f = lba % 75; return ((m / 10) << 20) | ((m % 10) << 16) | ((s / 10) << 12) | ((s % 10) << 8) | @@ -113,6 +107,4 @@ static inline uint32_t lba_to_msf_alt(int lba) return ret; } -#ifdef __cplusplus -} // extern "C" -#endif \ No newline at end of file +#endif /* __CDROM_H__ */ diff --git a/3rdparty/libchdr/include/libchdr/chd.h b/3rdparty/libchdr/include/libchdr/chd.h index f4b7aae0f8..e13dca03a4 100644 --- a/3rdparty/libchdr/include/libchdr/chd.h +++ b/3rdparty/libchdr/include/libchdr/chd.h @@ -48,7 +48,6 @@ extern "C" { #include #include -#include /*************************************************************************** @@ -393,6 +392,7 @@ CHD_EXPORT core_file *chd_core_file(chd_file *chd); CHD_EXPORT const char *chd_error_string(chd_error err); + /* ----- CHD header management ----- */ /* return a pointer to the extracted CHD header data */ diff --git a/3rdparty/libchdr/src/libchdr_cdrom.c b/3rdparty/libchdr/src/libchdr_cdrom.c index aa06b49247..112ea2e147 100644 --- a/3rdparty/libchdr/src/libchdr_cdrom.c +++ b/3rdparty/libchdr/src/libchdr_cdrom.c @@ -20,35 +20,6 @@ #include -const char* cdrom_get_subtype_string(uint32_t subtype) -{ - switch (subtype) - { - case CD_SUB_RAW: return "RW"; - case CD_SUB_RAW_INTERLEAVED: return "RW_RAW"; - default: return "NONE"; - } -} - -bool cdrom_parse_subtype_string(const char* typestring, uint32_t* subtype, uint32_t* subsize) -{ - // https://github.com/mamedev/mame/blob/d2d54fb8ed53a2e86d308067da8414f85b5929b0/src/lib/util/cdrom.cpp#L767 - if (!strcmp(typestring, "RW")) - { - *subtype = CD_SUB_RAW; - *subsize = 96; - return true; - } - else if (!strcmp(typestring, "RW_RAW")) - { - *subtype = CD_SUB_RAW_INTERLEAVED; - *subsize = 96; - return true; - } - - return false; -} - #ifdef WANT_RAW_DATA_SECTOR /*************************************************************************** diff --git a/3rdparty/libchdr/src/libchdr_chd.c b/3rdparty/libchdr/src/libchdr_chd.c index 97c0632008..ec37a490dc 100644 --- a/3rdparty/libchdr/src/libchdr_chd.c +++ b/3rdparty/libchdr/src/libchdr_chd.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -1951,7 +1950,7 @@ cleanup: memory -------------------------------------------------*/ -CHD_EXPORT chd_error chd_precache(chd_file* chd) +CHD_EXPORT chd_error chd_precache(chd_file *chd) { INT64 count; UINT64 size;