Commit 4a73adc2 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Cleanups/buildfix

parent e74142b9
Pipeline #67373 canceled with stage
......@@ -15,17 +15,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../mednafen.h"
#include "../error.h"
#include "../general.h"
#include <stdio.h>
#include <compat/msvc.h>
#include "CDAccess_CCD.h"
#include "CDUtility.h"
#include <limits>
#include <limits.h>
#include <map>
#include "../mednafen.h"
#include "../error.h"
#include "../general.h"
#include "CDAccess_CCD.h"
#include "CDUtility.h"
typedef std::map<std::string, std::string> CCD_Section;
template<typename T>
......@@ -124,8 +126,6 @@ bool CDAccess_CCD::Load(const char *path, bool image_memcache)
}
}
//printf("%s %d %d %d\n", file_ext.c_str(), extupt[0], extupt[1], extupt[2]);
linebuf.reserve(256);
while(cf.get_line(linebuf) >= 0)
......@@ -189,8 +189,6 @@ bool CDAccess_CCD::Load(const char *path, bool image_memcache)
return false;
}
//printf("MOO: %d\n", toc_entries);
for(te = 0; te < toc_entries; te++)
{
char tmpbuf[64];
......@@ -341,8 +339,6 @@ bool CDAccess_CCD::CheckSubQSanity(void)
uint8_t as_bcd = buf.qbuf[8];
uint8_t af_bcd = buf.qbuf[9];
//printf("%2x %2x %2x\n", am_bcd, as_bcd, af_bcd);
if(!BCD_is_valid(track_bcd) || !BCD_is_valid(index_bcd) || !BCD_is_valid(rm_bcd) || !BCD_is_valid(rs_bcd) || !BCD_is_valid(rf_bcd) ||
!BCD_is_valid(am_bcd) || !BCD_is_valid(as_bcd) || !BCD_is_valid(af_bcd) ||
rs_bcd > 0x59 || rf_bcd > 0x74 || as_bcd > 0x59 || af_bcd > 0x74)
......@@ -367,8 +363,6 @@ bool CDAccess_CCD::CheckSubQSanity(void)
}
}
//printf("%u/%u\n", checksum_pass_counter, img_numsectors);
return true;
}
......
......@@ -147,7 +147,6 @@ bool CDAccess_CHD::ImageOpen(const char *path, bool image_memcache)
Tracks[tkid].index[1] = 0;
fileOffset += Tracks[tkid].pregap_dv;
//printf("Tracks[%d].fileOffset=%d\n",NumTracks, fileOffset);
Tracks[tkid].FileOffset = fileOffset;
fileOffset += frames - Tracks[tkid].pregap_dv;
fileOffset += Tracks[tkid].postgap;
......@@ -252,13 +251,9 @@ int32_t CDAccess_CHD::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
}
}
//printf("%d %d\n", Tracks[1].LBA, Tracks[1].sectors);
if(!track_found)
{
printf("MakeSubPQ error for sector %u!", lba);
track = FirstTrack;
}
lba_relative = abs((int32)lba - Tracks[track].LBA);
......@@ -275,10 +270,7 @@ int32_t CDAccess_CHD::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
// Handle pause(D7 of interleaved subchannel byte) bit, should be set to 1 when in pregap or postgap.
if((lba < Tracks[track].LBA) || (lba >= Tracks[track].LBA + Tracks[track].sectors))
{
//printf("pause_or = 0x80 --- %d\n", lba);
pause_or = 0x80;
}
// Handle pregap between audio->data track
{
......@@ -292,10 +284,7 @@ int32_t CDAccess_CHD::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
if(pg_offset < -150)
{
if((Tracks[track].subq_control & SUBQ_CTRLF_DATA) && (FirstTrack < track) && !(Tracks[track - 1].subq_control & SUBQ_CTRLF_DATA))
{
//printf("Pregap part 1 audio->data: lba=%d track_lba=%d\n", lba, Tracks[track].LBA);
control = Tracks[track - 1].subq_control;
}
}
}
......@@ -322,14 +311,10 @@ int32_t CDAccess_CHD::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
if(!SubQReplaceMap.empty())
{
//printf("%d\n", lba);
std::map<uint32, cpp11_array_doodad>::const_iterator it = SubQReplaceMap.find(LBA_to_ABA(lba));
if(it != SubQReplaceMap.end())
{
//printf("Replace: %d\n", lba);
memcpy(buf, it->second.data, 12);
}
}
for (i = 0; i < 96; i++)
......@@ -412,7 +397,6 @@ bool CDAccess_CHD::Read_Raw_Sector(uint8 *buf, int32 lba)
// TODO: Zero out optional(?) checksum bytes?
break;
}
printf("Pre/post-gap read, LBA=%d(LBA-track_start_LBA=%d)\n", lba, lba - ct->LBA);
}
else
{
......@@ -520,9 +504,6 @@ int CDAccess_CHD::LoadSBI(const char* sbi_path)
memcpy(SubQReplaceMap[aba].data, tmpq, 12);
}
#if 0
MDFN_printf("Loaded Q subchannel replacements for %zu sectors.\n", SubQReplaceMap.size());
#endif
log_cb(RETRO_LOG_INFO, "[CHD] Loaded SBI file %s\n", sbi_path);
return 0;
}
......
......@@ -256,13 +256,8 @@ void CDAccess_PBP::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
}
}
//printf("%d %d\n", Tracks[1].LBA, Tracks[1].sectors);
if(!track_found)
{
printf("MakeSubPQ error for sector %u!", lba);
track = FirstTrack;
}
lba_relative = abs((int32)lba - Tracks[track].LBA);
......@@ -279,10 +274,7 @@ void CDAccess_PBP::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
// Handle pause(D7 of interleaved subchannel byte) bit, should be set to 1 when in pregap or postgap.
if((lba < Tracks[track].LBA) || (lba >= Tracks[track].LBA + Tracks[track].sectors))
{
//printf("pause_or = 0x80 --- %d\n", lba);
pause_or = 0x80;
}
// Handle pregap between audio->data track
{
......@@ -296,10 +288,7 @@ void CDAccess_PBP::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
if(pg_offset < -150)
{
if((Tracks[track].subq_control & SUBQ_CTRLF_DATA) && (FirstTrack < track) && !(Tracks[track - 1].subq_control & SUBQ_CTRLF_DATA))
{
//printf("Pregap part 1 audio->data: lba=%d track_lba=%d\n", lba, Tracks[track].LBA);
control = Tracks[track - 1].subq_control;
}
}
}
......@@ -326,14 +315,10 @@ void CDAccess_PBP::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
if(!SubQReplaceMap.empty())
{
//printf("%d\n", lba);
std::map<uint32, cpp11_array_doodad>::const_iterator it = SubQReplaceMap.find(LBA_to_ABA(lba));
if(it != SubQReplaceMap.end())
{
//printf("Replace: %d\n", lba);
memcpy(buf, it->second.data, 12);
}
}
for (i = 0; i < 96; i++)
......@@ -717,9 +702,6 @@ int CDAccess_PBP::LoadSBI(const char* sbi_path)
memcpy(SubQReplaceMap[aba].data, tmpq, 12);
}
#if 0
MDFN_printf("Loaded Q subchannel replacements for %zu sectors.\n", SubQReplaceMap.size());
#endif
log_cb(RETRO_LOG_INFO, "[PBP] Loaded SBI file %s\n", sbi_path);
filestream_close(sbis);
return 0;
......
......@@ -362,10 +362,7 @@ int CDIF_MT::ReadThreadStart()
// Don't read >= the "end" of the disc, silly snake. Slither.
if(ra_count && ra_lba == disc_toc.tracks[100].lba)
{
ra_count = 0;
//printf("Ephemeral scarabs: %d!\n", ra_lba);
}
if(ra_count)
{
......@@ -451,10 +448,7 @@ bool CDIF_MT::ReadRawSector(uint8 *buf, uint32 lba, int64 timeout_us)
// This shouldn't happen, the emulated-system-specific CDROM emulation code should make sure the emulated program doesn't try
// to read past the last "real" sector of the disc.
if(lba >= disc_toc.tracks[100].lba)
{
printf("Attempt to read LBA %d, >= LBA %d\n", lba, disc_toc.tracks[100].lba);
return(false);
}
ReadThreadQueue.Write(CDIF_Message(CDIF_MSG_READ_SECTOR, lba));
......@@ -506,7 +500,6 @@ bool CDIF_MT::ReadRawSectorPWOnly(uint8 *buf, uint32 lba, bool hint_fullread)
// to read past the last "real" sector of the disc.
if(lba >= disc_toc.tracks[100].lba)
{
printf("Attempt to read LBA %d, >= LBA %d\n", lba, disc_toc.tracks[100].lba);
memset(buf, 0, 96);
return(false);
}
......@@ -587,7 +580,6 @@ int CDIF::ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors)
memcpy(pBuf, &tmpbuf[12 + 4 + 8], 2048);
break;
default:
printf("CDIF_ReadSector() invalid sector type at LBA=%u\n", (unsigned int)lba);
return(false);
}
......@@ -650,7 +642,6 @@ bool CDIF_ST::ReadRawSectorPWOnly(uint8 *buf, uint32 lba, bool hint_fullread)
// to read past the last "real" sector of the disc.
if(lba >= disc_toc.tracks[100].lba)
{
printf("Attempt to read LBA %d, >= LBA %d\n", lba, disc_toc.tracks[100].lba);
memset(buf, 0, 96);
return(false);
}
......
......@@ -60,12 +60,6 @@ GaloisTables* CreateGaloisTables(int32_t gf_generator)
b = b ^ gf_generator;
}
if(b!=1)
{
printf("Failed to create the Galois field log tables!\n");
exit(1);
}
/* we're even closed using infinity (makes things easier) */
gt->indexOf[0] = GF_ALPHA0; /* log(0) = inf */
......
......@@ -69,8 +69,6 @@ int CheckEDC(const unsigned char *cd_frame, bool xa_mode)
if(expected_crc == real_crc)
return(1);
//printf("Bad EDC CRC: Calculated: %08x, Recorded: %08x\n", real_crc, expected_crc);
return(0);
}
......
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