Commit 5de4db03 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

(CDROM) Update

parent b894df52
......@@ -356,6 +356,7 @@ bool CDAccess_Image::LoadSBI(const std::string& sbi_path)
memcpy(SubQReplaceMap[aba].data(), tmpq, 12);
}
log_cb(RETRO_LOG_INFO, "Loaded Q subchannel replacements for %zu sectors.\n", SubQReplaceMap.size());
return true;
}
......@@ -501,7 +502,7 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
}
if(TmpTrack.DIFormat == DI_FORMAT_AUDIO)
TmpTrack.RawAudioMSBFirst = true; // Silly cdrdao...
TmpTrack.RawAudioMSBFirst = true; /* Silly cdrdao... */
if(!strcasecmp(args[1].c_str(), "RW"))
{
......@@ -820,7 +821,7 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
else if(cmdbuf == "CDTEXTFILE" || cmdbuf == "CATALOG" || cmdbuf == "ISRC" ||
cmdbuf == "TITLE" || cmdbuf == "PERFORMER" || cmdbuf == "SONGWRITER")
{
log_cb(RETRO_LOG_INFO, "Unsupported CUE sheet directive: \"%s\".\n", cmdbuf.c_str()); /* FIXME, generic logger passed by pointer to constructor */
log_cb(RETRO_LOG_WARN, "Unsupported CUE sheet directive: \"%s\".\n", cmdbuf.c_str()); /* FIXME, generic logger passed by pointer to constructor */
}
else
{
......@@ -1308,12 +1309,13 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
if(!SubQReplaceMap.empty())
{
//printf("%d\n", lba);
auto it = SubQReplaceMap.find(LBA_to_ABA(lba));
std::map<uint32_t, stl_array<uint8_t, 12> >::const_iterator it = SubQReplaceMap.find(LBA_to_ABA(lba));
if(it != SubQReplaceMap.end())
{
//printf("Replace: %d\n", lba);
memcpy(buf, it->second.data(), 12);
memcpy(buf, (void*)it->second.data(), 12);
}
}
......
......@@ -2,7 +2,6 @@
#define __MDFN_CDACCESS_IMAGE_H
#include <map>
#include <array>
#include "CDUtility.h"
......@@ -35,6 +34,23 @@ struct CDRFILE_TRACK_INFO
CDAFReader *AReader;
};
template<typename T, size_t N>
class stl_array {
T m_data[N];
public:
T* begin() { return m_data; }
T* end() { return m_data + N; }
T& operator[](size_t i) { return m_data[i]; }
size_t size() { return N; }
bool empty() { return N == 0; }
T* data() { return m_data; }
const T* begin() const { return m_data; }
const T* end() const { return m_data + N; }
const T& operator[](size_t i) const { return m_data[i]; }
const T* data() const { return m_data; }
};
class CDAccess_Image : public CDAccess
{
public:
......@@ -58,7 +74,7 @@ class CDAccess_Image : public CDAccess
CDRFILE_TRACK_INFO Tracks[100]; // Track #0(HMM?) through 99
TOC toc;
std::map<uint32_t, std::array<uint8_t, 12>> SubQReplaceMap;
std::map<uint32_t, stl_array<uint8_t, 12> > SubQReplaceMap;
std::string base_dir;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment