mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-22 23:39:50 +00:00
Cleanups
This commit is contained in:
parent
81d4c9d07a
commit
df6dfccd08
@ -677,13 +677,11 @@ static DECLFW(HuCSF2Write)
|
||||
|
||||
static DECLFR(PCEBusRead)
|
||||
{
|
||||
//printf("BUS Read: %02x %04x\n", A >> 13, A);
|
||||
return(0xFF);
|
||||
}
|
||||
|
||||
static DECLFW(PCENullWrite)
|
||||
{
|
||||
//printf("Null Write: %02x, %08x %02x\n", A >> 13, A, V);
|
||||
}
|
||||
|
||||
static DECLFR(BaseRAMRead)
|
||||
@ -1350,10 +1348,6 @@ extern "C" int StateAction(StateMem *sm, int load, int data_only)
|
||||
SFEND
|
||||
};
|
||||
|
||||
//for(int i = 8192; i < 32768; i++)
|
||||
// if(BaseRAM[i] != 0xFF)
|
||||
// printf("%d %02x\n", i, BaseRAM[i]);
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAIN", false);
|
||||
|
||||
ret &= HuC6280_StateAction(sm, load, data_only);
|
||||
|
@ -6,8 +6,6 @@
|
||||
// TODO?: BufferedStream, no virtual functions, yes inline functions, constructor takes a Stream* argument.
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <stdio.h> // For SEEK_* defines, which we will use in Stream out of FORCE OF HABIT.
|
||||
#include <string>
|
||||
|
||||
#include "mednafen-types.h"
|
||||
|
@ -37,7 +37,6 @@ class CDAFReader
|
||||
|
||||
if(LastReadPos != frame_offset)
|
||||
{
|
||||
//puts("SEEK");
|
||||
if(!Seek_(frame_offset))
|
||||
return(0);
|
||||
LastReadPos = frame_offset;
|
||||
|
@ -53,7 +53,6 @@ static T CCD_ReadInt(CCD_Section &s, const std::string &propname, const bool hav
|
||||
{
|
||||
if(have_defval)
|
||||
return defval;
|
||||
printf("Missing property: %s", propname.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -77,10 +76,7 @@ static T CCD_ReadInt(CCD_Section &s, const std::string &propname, const bool hav
|
||||
ret = strtoul(vp, &ep, scan_base);
|
||||
|
||||
if(!vp[0] || ep[0])
|
||||
{
|
||||
printf("Property %s: Malformed integer: %s", propname.c_str(), v.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -140,8 +136,6 @@ bool CDAccess_CCD::Load(const std::string& 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)
|
||||
@ -208,8 +202,6 @@ bool CDAccess_CCD::Load(const std::string& path, bool image_memcache)
|
||||
return false;
|
||||
}
|
||||
|
||||
//printf("MOO: %d\n", toc_entries);
|
||||
|
||||
for(unsigned te = 0; te < toc_entries; te++)
|
||||
{
|
||||
char tmpbuf[64];
|
||||
@ -351,8 +343,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)
|
||||
@ -392,7 +382,6 @@ bool CDAccess_CCD::CheckSubQSanity(void)
|
||||
}
|
||||
}
|
||||
|
||||
//printf("%u/%u\n", checksum_pass_counter, img_numsectors);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,6 @@ bool CDAccess_CHD::Load(const std::string &path, bool image_memcache)
|
||||
toc.tracks[NumTracks].lba = plba;
|
||||
|
||||
fileOffset += Tracks[NumTracks].pregap_dv;
|
||||
//printf("Tracks[%d].fileOffset=%d\n",NumTracks, fileOffset);
|
||||
Tracks[NumTracks].fileOffset = fileOffset;
|
||||
fileOffset += frames - Tracks[NumTracks].pregap_dv;
|
||||
fileOffset += Tracks[NumTracks].postgap;
|
||||
@ -179,8 +178,6 @@ bool CDAccess_CHD::Load(const std::string &path, bool image_memcache)
|
||||
|
||||
toc.first_track = 1;
|
||||
toc.last_track = NumTracks;
|
||||
|
||||
//printf("Track=%d pregap=%d pregap_dv=%d sectors=%d LBA=%d\n", NumTracks, Tracks[NumTracks].pregap, Tracks[NumTracks].pregap_dv, Tracks[NumTracks].sectors, Tracks[NumTracks].LBA);
|
||||
}
|
||||
|
||||
FirstTrack = 1;
|
||||
@ -371,7 +368,6 @@ bool CDAccess_CHD::Read_Raw_Sector(uint8_t *buf, int32_t 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
|
||||
{
|
||||
@ -462,7 +458,6 @@ int32_t CDAccess_CHD::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -478,12 +473,9 @@ int32_t CDAccess_CHD::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(buf, 0, 0xC);
|
||||
buf[0] = (adr << 0) | (control << 4);
|
||||
|
@ -179,8 +179,6 @@ uint32_t CDAccess_Image::GetSectorCount(CDRFILE_TRACK_INFO *track)
|
||||
else
|
||||
{
|
||||
const int64_t size = track->fp->size();
|
||||
|
||||
//printf("%d %d %d\n", (int)stat_buf.st_size, (int)track->FileOffset, (int)stat_buf.st_size - (int)track->FileOffset);
|
||||
if(track->SubchannelMode)
|
||||
return((size - track->FileOffset) / (2352 + 96));
|
||||
return((size - track->FileOffset) / 2352);
|
||||
@ -255,7 +253,6 @@ bool CDAccess_Image::ParseTOCFileLineInfo(CDRFILE_TRACK_INFO *track, const int t
|
||||
|
||||
track->FileOffset = offset; // Make sure this is set before calling GetSectorCount()!
|
||||
sectors = GetSectorCount(track);
|
||||
//printf("Track: %d, offset: %ld, %ld\n", tracknum, offset, sectors);
|
||||
|
||||
if(length)
|
||||
{
|
||||
@ -352,11 +349,6 @@ bool CDAccess_Image::LoadSBI(const std::string& sbi_path)
|
||||
tmpq[11] ^= 0xFF;
|
||||
//
|
||||
|
||||
//printf("%02x:%02x:%02x --- ", ed[0], ed[1], ed[2]);
|
||||
//for(unsigned i = 0; i < 12; i++)
|
||||
// printf("%02x ", tmpq[i]);
|
||||
//printf("\n");
|
||||
|
||||
uint32_t aba = AMSF_to_ABA(BCD_to_U8(ed[0]), BCD_to_U8(ed[1]), BCD_to_U8(ed[2]));
|
||||
|
||||
memcpy(SubQReplaceMap[aba].data(), tmpq, 12);
|
||||
@ -462,8 +454,6 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
|
||||
MDFN_strtoupper(cmdbuf);
|
||||
}
|
||||
|
||||
//printf("%s\n", cmdbuf.c_str()); //: %s %s %s %s\n", cmdbuf.c_str(), args[0].c_str(), args[1].c_str(), args[2].c_str(), args[3].c_str());
|
||||
|
||||
if(IsTOC)
|
||||
{
|
||||
if(cmdbuf == "TRACK")
|
||||
@ -554,7 +544,6 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
|
||||
msfoffset = args[1].c_str();
|
||||
length = args[2].c_str();
|
||||
}
|
||||
//printf("%s, %s, %s, %s\n", args[0].c_str(), binoffset, msfoffset, length);
|
||||
if (!ParseTOCFileLineInfo(&TmpTrack, active_track, args[0], binoffset, msfoffset, length, image_memcache, toc_streamcache))
|
||||
return false;
|
||||
}
|
||||
@ -949,11 +938,9 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
|
||||
Tracks[x].sectors = Tracks[x + 1].index[0] - Tracks[x].index[1]; //Tracks[x + 1].index - Tracks[x].index;
|
||||
}
|
||||
|
||||
//printf("Poo: %d %d\n", x, Tracks[x].sectors);
|
||||
RunningLBA += Tracks[x].sectors;
|
||||
RunningLBA += Tracks[x].postgap;
|
||||
|
||||
//printf("%d, %ld %d %d %d %d\n", x, FileOffset, Tracks[x].index, Tracks[x].pregap, Tracks[x].sectors, Tracks[x].LBA);
|
||||
|
||||
FileOffset += Tracks[x].sectors * DI_Size_Table[Tracks[x].DIFormat];
|
||||
} // end to cue sheet handling
|
||||
@ -1118,7 +1105,6 @@ bool CDAccess_Image::Read_Raw_Sector(uint8_t *buf, int32_t 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
|
||||
{
|
||||
@ -1130,10 +1116,7 @@ bool CDAccess_Image::Read_Raw_Sector(uint8_t *buf, int32_t lba)
|
||||
ct->LastSamplePos += frames_read;
|
||||
|
||||
if(frames_read > 588) // This shouldn't happen.
|
||||
{
|
||||
printf("Error: frames_read out of range: %llu\n", (unsigned long long)frames_read);
|
||||
frames_read = 0;
|
||||
}
|
||||
|
||||
if(frames_read < 588)
|
||||
memset((uint8_t *)AudioBuf + frames_read * 2 * sizeof(int16_t), 0, (588 - frames_read) * 2 * sizeof(int16_t));
|
||||
@ -1268,10 +1251,7 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
|
||||
// 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
|
||||
{
|
||||
@ -1285,12 +1265,9 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memset(buf, 0, 0xC);
|
||||
@ -1329,16 +1306,11 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
|
||||
if(!SubQReplaceMap.empty())
|
||||
{
|
||||
//printf("%d\n", 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, (void*)it->second.data(), 12);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 96; i++)
|
||||
SubPWBuf[i] |= (((buf[i >> 3] >> (7 - (i & 0x7))) & 1) ? 0x40 : 0x00) | pause_or;
|
||||
|
@ -81,9 +81,6 @@ static void InitScrambleTable(void)
|
||||
|
||||
scramble_table[i - 12] = z;
|
||||
}
|
||||
|
||||
//for(int i = 0; i < 2352 - 12; i++)
|
||||
// printf("0x%02x, ", scramble_table[i]);
|
||||
}
|
||||
|
||||
void CDUtility_Init(void)
|
||||
@ -319,20 +316,12 @@ void subpw_synth_udapp_lba(const TOC& toc, const int32_t lba, const int32_t lba_
|
||||
uint32_t lba_relative;
|
||||
uint32_t ma, sa, fa;
|
||||
uint32_t m, s, f;
|
||||
|
||||
#if 0
|
||||
if(lba < -150 || lba >= 0)
|
||||
printf("[BUG] subpw_synth_udapp_lba() lba out of range --- %d\n", lba);
|
||||
#endif
|
||||
|
||||
{
|
||||
int32_t lba_tmp = lba + lba_subq_relative_offs;
|
||||
|
||||
if(lba_tmp < 0)
|
||||
lba_relative = 0 - 1 - lba_tmp;
|
||||
else
|
||||
lba_relative = lba_tmp - 0;
|
||||
}
|
||||
|
||||
f = (lba_relative % 75);
|
||||
s = ((lba_relative / 75) % 60);
|
||||
|
@ -83,10 +83,7 @@ int CDIF::ReadSector(uint8_t* buf, int32_t lba, uint32_t sector_count, bool supp
|
||||
uint8_t tmpbuf[2352 + 96];
|
||||
|
||||
if(!ReadRawSector(tmpbuf, lba))
|
||||
{
|
||||
puts("CDIF Raw Read error");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if(!ValidateRawSector(tmpbuf))
|
||||
{
|
||||
@ -102,18 +99,11 @@ int CDIF::ReadSector(uint8_t* buf, int32_t lba, uint32_t sector_count, bool supp
|
||||
ret = mode;
|
||||
|
||||
if(mode == 1)
|
||||
{
|
||||
memcpy(buf, &tmpbuf[12 + 4], 2048);
|
||||
}
|
||||
else if(mode == 2)
|
||||
{
|
||||
memcpy(buf, &tmpbuf[12 + 4 + 8], 2048);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("CDIF_ReadSector() invalid sector type at LBA=%u\n", (unsigned int)lba);
|
||||
return(false);
|
||||
}
|
||||
|
||||
buf += 2048;
|
||||
lba++;
|
||||
@ -130,16 +120,9 @@ int CDIF::ReadSector(uint8_t* buf, int32_t lba, uint32_t sector_count, bool supp
|
||||
|
||||
CDIF_ST::CDIF_ST(CDAccess *cda) : CDIF(cda)
|
||||
{
|
||||
//puts("***WARNING USING SINGLE-THREADED CD READER***");
|
||||
|
||||
UnrecoverableError = false;
|
||||
|
||||
disc_cdaccess->Read_TOC(&disc_toc);
|
||||
|
||||
if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track)
|
||||
{
|
||||
printf("TOC first(%d)/last(%d) track numbers bad.", disc_toc.first_track, disc_toc.last_track);
|
||||
}
|
||||
}
|
||||
|
||||
CDIF_ST::~CDIF_ST()
|
||||
@ -162,7 +145,6 @@ bool CDIF_ST::ReadRawSector(uint8_t *buf, int32_t lba)
|
||||
|
||||
if(lba < LBA_Read_Minimum || lba > LBA_Read_Maximum)
|
||||
{
|
||||
printf("Attempt to read sector out of bounds; LBA=%d\n", lba);
|
||||
memset(buf, 0, 2352 + 96);
|
||||
return(false);
|
||||
}
|
||||
@ -182,7 +164,6 @@ bool CDIF_ST::ReadRawSectorPWOnly(uint8_t* pwbuf, int32_t lba, bool hint_fullrea
|
||||
|
||||
if(lba < LBA_Read_Minimum || lba > LBA_Read_Maximum)
|
||||
{
|
||||
printf("Attempt to read sector out of bounds; LBA=%d\n", lba);
|
||||
memset(pwbuf, 0, 96);
|
||||
return(false);
|
||||
}
|
||||
|
@ -62,14 +62,6 @@ GaloisTables* CreateGaloisTables(int32_t gf_generator)
|
||||
b = b ^ gf_generator;
|
||||
}
|
||||
|
||||
if(b!=1)
|
||||
{
|
||||
#if 0
|
||||
printf("Failed to create the Galois field log tables!\n");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* we're even closed using infinity (makes things easier) */
|
||||
|
||||
gt->indexOf[0] = GF_ALPHA0; /* log(0) = inf */
|
||||
|
@ -590,96 +590,3 @@ void lec_scramble(uint8_t *sector)
|
||||
*p++ = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *infile;
|
||||
char *outfile;
|
||||
int fd_in, fd_out;
|
||||
uint8_t buffer1[2352];
|
||||
uint8_t buffer2[2352];
|
||||
uint32_t lba;
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < 2048; i++)
|
||||
buffer1[i + 16] = 234;
|
||||
|
||||
lba = 150;
|
||||
|
||||
for (i = 0; i < 100000; i++) {
|
||||
lec_encode_mode1_sector(lba, buffer1);
|
||||
lec_scramble(buffer2);
|
||||
lba++;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (argc != 3)
|
||||
return 1;
|
||||
|
||||
infile = argv[1];
|
||||
outfile = argv[2];
|
||||
|
||||
|
||||
if ((fd_in = open(infile, O_RDONLY)) < 0) {
|
||||
perror("Cannot open input file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((fd_out = open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) {
|
||||
perror("Cannot open output file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
lba = 150;
|
||||
|
||||
do {
|
||||
if (read(fd_in, buffer1, 2352) != 2352)
|
||||
break;
|
||||
|
||||
switch (*(buffer1 + 12 + 3)) {
|
||||
case 1:
|
||||
memcpy(buffer2 + 16, buffer1 + 16, 2048);
|
||||
|
||||
lec_encode_mode1_sector(lba, buffer2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ((*(buffer1 + 12 + 4 + 2) & 0x20) != 0) {
|
||||
/* form 2 sector */
|
||||
memcpy(buffer2 + 16, buffer1 + 16, 2324 + 8);
|
||||
lec_encode_mode2_form2_sector(lba, buffer2);
|
||||
}
|
||||
else {
|
||||
/* form 1 sector */
|
||||
memcpy(buffer2 + 16, buffer1 + 16, 2048 + 8);
|
||||
lec_encode_mode2_form1_sector(lba, buffer2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (memcmp(buffer1, buffer2, 2352) != 0) {
|
||||
printf("Verify error at lba %ld\n", lba);
|
||||
}
|
||||
|
||||
lec_scramble(buffer2);
|
||||
write(fd_out, buffer2, 2352);
|
||||
|
||||
lba++;
|
||||
} while (1);
|
||||
|
||||
close(fd_in);
|
||||
close(fd_out);
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -62,15 +62,10 @@ int CheckEDC(const unsigned char *cd_frame, bool xa_mode)
|
||||
real_crc = EDCCrc32(cd_frame+16, 2056);
|
||||
else
|
||||
real_crc = EDCCrc32(cd_frame, 2064);
|
||||
|
||||
if(expected_crc == real_crc)
|
||||
return(1);
|
||||
else
|
||||
{
|
||||
//printf("Bad EDC CRC: Calculated: %08x, Recorded: %08x\n", real_crc, expected_crc);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** A very simple L-EC error correction.
|
||||
|
@ -15,7 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -31,40 +31,20 @@ static INLINE void ACAutoIncrement(ACPort_t *port)
|
||||
if(port->control & 0x1)
|
||||
{
|
||||
if(port->control & 0x10)
|
||||
{
|
||||
//if(port->control & 0x4)
|
||||
//{
|
||||
// printf("BOONY: %04x\n", port->increment);
|
||||
// port->base = (port->base + port->increment + 0xFF0000) & 0xFFFFFF;
|
||||
// printf("%04x\n", port->base);
|
||||
//}
|
||||
//else
|
||||
port->base = (port->base + port->increment) & 0xFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
port->offset = (port->offset + port->increment) & 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8 ArcadeCard::Read(uint32 A, bool peek)
|
||||
{
|
||||
//printf("AC Read: %04x\n", A);
|
||||
if((A & 0x1F00) != 0x1A00)
|
||||
{
|
||||
//if(!peek)
|
||||
// printf("AC unknown read: %08x\n", A);
|
||||
return(0xFF);
|
||||
}
|
||||
if(A < 0x1A80)
|
||||
{
|
||||
ACPort_t *port = &AC.ports[(A >> 4) & 0x3];
|
||||
|
||||
// if(!peek)
|
||||
// if(A & 0x40)
|
||||
// printf("AC mirrored port read: %08x\n", A); // Madou Monogatari does!
|
||||
|
||||
switch(A & 0xF)
|
||||
{
|
||||
case 0x00:
|
||||
@ -121,19 +101,13 @@ uint8 ArcadeCard::Read(uint32 A, bool peek)
|
||||
}
|
||||
}
|
||||
|
||||
//if(!peek)
|
||||
// printf("AC unknown read: %08x\n", A);
|
||||
return(0xFF);
|
||||
}
|
||||
|
||||
void ArcadeCard::Write(uint32 A, uint8 V)
|
||||
{
|
||||
//printf("AC Write: %04x %02x\n", A, V);
|
||||
if((A & 0x1F00) != 0x1A00)
|
||||
{
|
||||
//printf("AC unknown write: %08x:%02x\n", A, V);
|
||||
return;
|
||||
}
|
||||
|
||||
if(A < 0x1A80)
|
||||
{
|
||||
@ -141,7 +115,7 @@ void ArcadeCard::Write(uint32 A, uint8 V)
|
||||
|
||||
switch(A & 0xF)
|
||||
{
|
||||
default: //printf("AC unknown write: %08x:%02x\n", A, V);
|
||||
default:
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
@ -218,15 +192,12 @@ void ArcadeCard::Write(uint32 A, uint8 V)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//if(A & 0x40)
|
||||
// printf("AC mirrored port write: %08x:%02x\n", A, V);
|
||||
}
|
||||
else if(A >= 0x1AE0)
|
||||
{
|
||||
switch(A & 0x1F)
|
||||
{
|
||||
default: //printf("Unknown AC write: %04x %02x\n", A, V);
|
||||
default:
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
|
@ -273,7 +273,6 @@ static bool TestConditions(const char *string)
|
||||
unsigned int bytelen;
|
||||
bool passed = 1;
|
||||
|
||||
//printf("TR: %s\n", string);
|
||||
while(sscanf(string, "%u %c %63s %63s %63s", &bytelen, &endian, address, operation, value) == 5 && passed)
|
||||
{
|
||||
uint32 v_address;
|
||||
@ -302,7 +301,6 @@ static bool TestConditions(const char *string)
|
||||
value_at_address |= MemRead(v_address + x) << shiftie;
|
||||
}
|
||||
|
||||
//printf("A: %08x, V: %08llx, VA: %08llx, OP: %s\n", v_address, v_value, value_at_address, operation);
|
||||
if(!strcmp(operation, ">="))
|
||||
{
|
||||
if(!(value_at_address >= v_value))
|
||||
|
@ -21,13 +21,6 @@
|
||||
|
||||
const int OKIADPCM_StepSizes[49] =
|
||||
{
|
||||
// These can also be generated like:
|
||||
// double start = 16;
|
||||
// for(int x = 0; x < 49; x++)
|
||||
// {
|
||||
// printf("%d, ", (int)start);
|
||||
// start *= 1.1;
|
||||
// }
|
||||
16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50,
|
||||
55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157,
|
||||
173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449,
|
||||
|
@ -677,7 +677,6 @@ void HuC6280_Run(int32 cycles)
|
||||
}
|
||||
} // end if(HU_IRQlow)
|
||||
|
||||
//printf("%04x\n", GetRealPC());
|
||||
HU_PI = HU_P;
|
||||
HuCPU.IRQMaskDelay = HuCPU.IRQMask;
|
||||
|
||||
|
@ -18,8 +18,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define TEST_WEIRD_TFLAG(n) { /* if(HU_P & T_FLAG) puts("RAWR" n); */}
|
||||
|
||||
case 0x00: /* BRK */
|
||||
IncPC();
|
||||
HU_P &= ~T_FLAG;
|
||||
@ -44,9 +42,6 @@ case 0x40: /* RTI */
|
||||
/* HU_PI=HU_P; This is probably incorrect, so it's commented out. */
|
||||
HU_PI = HU_P;
|
||||
POP_PC();
|
||||
|
||||
// T-flag handling here:
|
||||
TEST_WEIRD_TFLAG("RTI");
|
||||
break;
|
||||
|
||||
case 0x60: /* RTS */
|
||||
@ -89,9 +84,6 @@ case 0x7A: // PLY 65C02
|
||||
case 0x28: /* PLP */
|
||||
HU_P = POP();
|
||||
EXPAND_FLAGS();
|
||||
|
||||
// T-flag handling here:
|
||||
TEST_WEIRD_TFLAG("PLP");
|
||||
break;
|
||||
|
||||
case 0x4C:
|
||||
@ -216,7 +208,6 @@ case 0x58: /* CLI */
|
||||
((RdOp(GetRealPC() + 1) & 0x3) == 0) && ((RdOp(GetRealPC() + 2) & 0xFC) == 0))
|
||||
{
|
||||
HU_IRQlow |= 0x200;
|
||||
//puts("CLI/LDA madness!");
|
||||
}
|
||||
}
|
||||
HU_P&=~I_FLAG;
|
||||
@ -568,7 +559,7 @@ case 0xF4: /* SET */
|
||||
|
||||
switch(RdAtPC())
|
||||
{
|
||||
default: //puts("Bad SET");
|
||||
default:
|
||||
break;
|
||||
|
||||
case 0x69: IncPC(); LD_IM(ADC);
|
||||
|
@ -55,12 +55,6 @@ static int32 ClearACKDelay;
|
||||
static int32 lastts;
|
||||
static int32 pcecd_drive_ne = 0;
|
||||
|
||||
// ADPCM variables and whatnot
|
||||
static inline void ADPCM_DEBUG(const char *format, ...)
|
||||
{
|
||||
/*printf("[Half=%d, End=%d, Playing=%d] "x, ADPCM.HalfReached, ADPCM.EndReached, ADPCM.Playing, ## __VA_ARGS__);*/
|
||||
}
|
||||
|
||||
typedef Blip_Synth ADSynth;
|
||||
static ADSynth ADPCMSynth;
|
||||
static OKIADPCM_Decoder<OKIADPCM_MSM5205> MSM5205;
|
||||
@ -413,7 +407,6 @@ uint8 PCECD_Read(uint32 timestamp, uint32 A)
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
ADPCM_DEBUG("ReadBuffer\n");
|
||||
ADPCM.ReadPending = 19 * 3; //24 * 3;
|
||||
ret = ADPCM.ReadBuffer;
|
||||
break;
|
||||
@ -423,7 +416,6 @@ uint8 PCECD_Read(uint32 timestamp, uint32 A)
|
||||
break;
|
||||
|
||||
case 0xc:
|
||||
//printf("ADPCM Status Read: %d\n", timestamp);
|
||||
ret = 0x00;
|
||||
|
||||
ret |= (ADPCM.EndReached) ? 0x01 : 0x00;
|
||||
@ -531,14 +523,9 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
ADPCM.Addr &= 0xFF00;
|
||||
ADPCM.Addr |= V;
|
||||
|
||||
ADPCM_DEBUG("SAL: %02x, %d\n", V, timestamp);
|
||||
|
||||
// Length appears to be constantly latched when D4 is set(tested on a real system)
|
||||
if(ADPCM.LastCmd & 0x10)
|
||||
{
|
||||
ADPCM_DEBUG("Set length(crazy way L): %04x\n", ADPCM.Addr);
|
||||
ADPCM.LengthCount = ADPCM.Addr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x9: // Set ADPCM address high
|
||||
@ -548,24 +535,17 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
ADPCM.Addr &= 0x00FF;
|
||||
ADPCM.Addr |= V << 8;
|
||||
|
||||
ADPCM_DEBUG("SAH: %02x, %d\n", V, timestamp);
|
||||
|
||||
// Length appears to be constantly latched when D4 is set(tested on a real system)
|
||||
if(ADPCM.LastCmd & 0x10)
|
||||
{
|
||||
ADPCM_DEBUG("Set length(crazy way H): %04x\n", ADPCM.Addr);
|
||||
ADPCM.LengthCount = ADPCM.Addr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
//ADPCM_DEBUG("Write: %02x, %d\n", V, timestamp);
|
||||
ADPCM.WritePending = 3 * 11;
|
||||
ADPCM.WritePendingValue = data;
|
||||
break;
|
||||
|
||||
case 0xb: // adpcm dma
|
||||
ADPCM_DEBUG("DMA: %02x\n", V);
|
||||
_Port[0xb] = data;
|
||||
break;
|
||||
|
||||
@ -573,7 +553,6 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
break;
|
||||
|
||||
case 0xd:
|
||||
ADPCM_DEBUG("Write180D: %02x\n", V);
|
||||
if(data & 0x80)
|
||||
{
|
||||
ADPCM.Addr = 0;
|
||||
@ -611,7 +590,6 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
// Length appears to be constantly latched when D4 is set(tested on a real system)
|
||||
if(data & 0x10)
|
||||
{
|
||||
ADPCM_DEBUG("Set length: %04x\n", ADPCM.Addr);
|
||||
ADPCM.LengthCount = ADPCM.Addr;
|
||||
ADPCM.EndReached = false;
|
||||
}
|
||||
@ -624,7 +602,6 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
else
|
||||
ADPCM.ReadAddr = (ADPCM.Addr - 1) & 0xFFFF;
|
||||
|
||||
ADPCM_DEBUG("Set ReadAddr: %04x, %06x\n", ADPCM.Addr, ADPCM.ReadAddr);
|
||||
}
|
||||
|
||||
// D0 and D1 control write address
|
||||
@ -633,7 +610,6 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
ADPCM.WriteAddr = ADPCM.Addr;
|
||||
if(!(data & 0x1))
|
||||
ADPCM.WriteAddr = (ADPCM.WriteAddr - 1) & 0xFFFF;
|
||||
ADPCM_DEBUG("Set WriteAddr: %04x, %06x\n", ADPCM.Addr, ADPCM.WriteAddr);
|
||||
}
|
||||
ADPCM.LastCmd = data;
|
||||
UpdateADPCMIRQState();
|
||||
@ -642,10 +618,7 @@ void PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data)
|
||||
case 0xe: // Set ADPCM playback rate
|
||||
{
|
||||
uint8 freq = V & 0x0F;
|
||||
|
||||
ADPCM.SampleFreq = freq;
|
||||
|
||||
ADPCM_DEBUG("Freq: %02x\n", freq);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -728,7 +701,6 @@ static INLINE void ADPCM_PB_Run(int32 basetime, int32 run_time)
|
||||
|
||||
static INLINE void ADPCM_Run(const int32 clocks, const int32 timestamp)
|
||||
{
|
||||
//printf("ADPCM Run: %d\n", clocks);
|
||||
ADPCM_PB_Run(timestamp, clocks);
|
||||
|
||||
if(ADPCM.WritePending)
|
||||
@ -794,9 +766,6 @@ extern "C" void PCECD_Run(uint32 in_timestamp)
|
||||
int32 clocks = in_timestamp - lastts;
|
||||
int32 running_ts = lastts;
|
||||
|
||||
//printf("Run Begin: Clocks=%d(%d - %d), cl=%d\n", clocks, in_timestamp, lastts, CalcNextEvent);
|
||||
//fflush(stdout);
|
||||
|
||||
while(clocks > 0)
|
||||
{
|
||||
int32 chunk_clocks = CalcNextEvent(clocks);
|
||||
|
@ -217,25 +217,21 @@ void PCECD_Drive_Power(pcecd_drive_timestamp_t system_timestamp)
|
||||
void PCECD_Drive_SetDB(uint8 data)
|
||||
{
|
||||
cd_bus.DB = data;
|
||||
//printf("Set DB: %02x\n", data);
|
||||
}
|
||||
|
||||
void PCECD_Drive_SetACK(bool set)
|
||||
{
|
||||
SetkingACK(set);
|
||||
//printf("Set ACK: %d\n", set);
|
||||
}
|
||||
|
||||
void PCECD_Drive_SetSEL(bool set)
|
||||
{
|
||||
SetkingSEL(set);
|
||||
//printf("Set SEL: %d\n", set);
|
||||
}
|
||||
|
||||
void PCECD_Drive_SetRST(bool set)
|
||||
{
|
||||
SetkingRST(set);
|
||||
//printf("Set RST: %d\n", set);
|
||||
}
|
||||
|
||||
static void GenSubQFromSubPW(void)
|
||||
@ -244,12 +240,6 @@ static void GenSubQFromSubPW(void)
|
||||
|
||||
subq_deinterleave(cd.SubPWBuf, SubQBuf);
|
||||
|
||||
//printf("Real %d/ SubQ %d - ", read_sec, BCD_to_U8(SubQBuf[7]) * 75 * 60 + BCD_to_U8(SubQBuf[8]) * 75 + BCD_to_U8(SubQBuf[9]) - 150);
|
||||
// Debug code, remove me.
|
||||
//for(int i = 0; i < 0xC; i++)
|
||||
// printf("%02x ", SubQBuf[i]);
|
||||
//printf("\n");
|
||||
|
||||
if(subq_check_checksum(SubQBuf))
|
||||
{
|
||||
memcpy(cd.SubQBuf_Last, SubQBuf, 0xC);
|
||||
@ -258,10 +248,6 @@ static void GenSubQFromSubPW(void)
|
||||
|
||||
if(adr <= 0x3)
|
||||
memcpy(cd.SubQBuf[adr], SubQBuf, 0xC);
|
||||
|
||||
//if(adr == 0x02)
|
||||
//for(int i = 0; i < 12; i++)
|
||||
// printf("%02x\n", cd.SubQBuf[0x2][i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +291,6 @@ static void GenSubQFromSubPW(void)
|
||||
|
||||
static void ChangePhase(const unsigned int new_phase)
|
||||
{
|
||||
//printf("New phase: %d %lld\n", new_phase, monotonic_timestamp);
|
||||
switch(new_phase)
|
||||
{
|
||||
case PHASE_BUS_FREE:
|
||||
@ -524,7 +509,6 @@ static void DoNEC_PCE_SAPSP(const uint8 *cdb)
|
||||
{
|
||||
uint32 new_read_sec_start;
|
||||
|
||||
//printf("Set audio start: %02x %02x %02x %02x %02x %02x %02x\n", cdb[9], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6]);
|
||||
switch (cdb[9] & 0xc0)
|
||||
{
|
||||
default:
|
||||
@ -550,7 +534,6 @@ static void DoNEC_PCE_SAPSP(const uint8 *cdb)
|
||||
break;
|
||||
}
|
||||
|
||||
//printf("%lld\n", (long long)(monotonic_timestamp - pce_lastsapsp_timestamp) * 1000 / System_Clock);
|
||||
if(cdda.CDDAStatus == CDDASTATUS_PLAYING && new_read_sec_start == read_sec_start && ((int64)(monotonic_timestamp - pce_lastsapsp_timestamp) * 1000 / System_Clock) < 190)
|
||||
{
|
||||
pce_lastsapsp_timestamp = monotonic_timestamp;
|
||||
@ -595,8 +578,6 @@ static void DoNEC_PCE_SAPEP(const uint8 *cdb)
|
||||
{
|
||||
uint32 new_read_sec_end;
|
||||
|
||||
//printf("Set audio end: %02x %02x %02x %02x %02x %02x %02x\n", cdb[9], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6]);
|
||||
|
||||
switch (cdb[9] & 0xc0)
|
||||
{
|
||||
default:
|
||||
@ -963,12 +944,7 @@ static INLINE void RunCDRead(uint32 system_timestamp, int32 run_time)
|
||||
{
|
||||
if(din.CanWrite() < 2048)
|
||||
{
|
||||
//printf("Carp: %d %d %d\n", din.CanWrite(), SectorCount, CDReadTimer);
|
||||
//CDReadTimer = (cd.data_in_size - cd.data_in_pos) * 10;
|
||||
|
||||
CDReadTimer += (uint64) 1 * 2048 * System_Clock / CD_DATA_TRANSFER_RATE;
|
||||
|
||||
//CDReadTimer += (uint64) 1 * 128 * System_Clock / CD_DATA_TRANSFER_RATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1045,10 +1021,7 @@ uint32 PCECD_Drive_Run(pcecd_drive_timestamp_t system_timestamp)
|
||||
cd.last_RST_signal = RST_signal;
|
||||
|
||||
if(ResetNeeded)
|
||||
{
|
||||
//puts("RST");
|
||||
VirtualReset();
|
||||
}
|
||||
else switch(CurrentPhase)
|
||||
{
|
||||
case PHASE_BUS_FREE:
|
||||
@ -1061,7 +1034,6 @@ uint32 PCECD_Drive_Run(pcecd_drive_timestamp_t system_timestamp)
|
||||
case PHASE_COMMAND:
|
||||
if(REQ_signal && ACK_signal) // Data bus is valid nowww
|
||||
{
|
||||
//printf("Command Phase Byte I->T: %02x, %d\n", cd_bus.DB, cd.command_buffer_pos);
|
||||
cd.command_buffer[cd.command_buffer_pos++] = cd_bus.DB;
|
||||
SetREQ(FALSE);
|
||||
}
|
||||
@ -1131,7 +1103,6 @@ uint32 PCECD_Drive_Run(pcecd_drive_timestamp_t system_timestamp)
|
||||
case PHASE_DATA_IN:
|
||||
if(!REQ_signal && !ACK_signal)
|
||||
{
|
||||
//puts("REQ and ACK false");
|
||||
if(din.in_count == 0) // aaand we're done!
|
||||
{
|
||||
CDIRQCallback(0x8000 | PCECD_Drive_IRQ_DATA_TRANSFER_READY);
|
||||
@ -1151,7 +1122,6 @@ uint32 PCECD_Drive_Run(pcecd_drive_timestamp_t system_timestamp)
|
||||
}
|
||||
if(REQ_signal && ACK_signal)
|
||||
{
|
||||
//puts("REQ and ACK true");
|
||||
SetREQ(FALSE);
|
||||
}
|
||||
break;
|
||||
@ -1296,7 +1266,6 @@ int PCECD_Drive_StateAction(StateMem * sm, int load, int data_only, const char *
|
||||
|
||||
if(cdda.CDDADiv <= 0)
|
||||
cdda.CDDADiv = 1;
|
||||
//printf("%d %d %d\n", din.in_count, din.read_pos, din.write_pos);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
|
@ -101,8 +101,6 @@ void PCEFast_PSG::RecalcUOFunc(int chnum)
|
||||
{
|
||||
psg_channel *ch = &channel[chnum];
|
||||
|
||||
//printf("UO Update: %d, %02x\n", chnum, ch->control);
|
||||
|
||||
if(!(ch->control & 0xC0))
|
||||
ch->UpdateOutput = &PCEFast_PSG::UpdateOutput_Off;
|
||||
else if(ch->noisectrl & ch->control & 0x80)
|
||||
@ -154,8 +152,6 @@ void PCEFast_PSG::RecalcNoiseFreqCache(int chnum)
|
||||
|
||||
PCEFast_PSG::PCEFast_PSG(Blip_Buffer *bb_l, Blip_Buffer *bb_r)
|
||||
{
|
||||
//printf("Test: %u, %u\n", sizeof(psg_channel), (uint8*)&channel[0].balance - (uint8*)&channel[0].waveform[0]);
|
||||
|
||||
sbuf[0] = bb_l;
|
||||
sbuf[1] = bb_r;
|
||||
|
||||
@ -235,9 +231,6 @@ void PCEFast_PSG::Write(int32 timestamp, uint8 A, uint8 V)
|
||||
|
||||
psg_channel *ch = &channel[select];
|
||||
|
||||
//if(A == 0x01 || select == 5)
|
||||
// printf("Write Ch: %d %04x %02x, %d\n", select, A, V, timestamp);
|
||||
|
||||
switch(A)
|
||||
{
|
||||
default: break;
|
||||
@ -330,11 +323,9 @@ void PCEFast_PSG::Write(int32 timestamp, uint8 A, uint8 V)
|
||||
|
||||
case 0x08: /* LFO frequency */
|
||||
lfofreq = V & 0xFF;
|
||||
//printf("LFO Freq: %02x\n", V);
|
||||
break;
|
||||
|
||||
case 0x09: /* LFO trigger and control */
|
||||
//printf("LFO Ctrl: %02x\n", V);
|
||||
if(V & 0x80)
|
||||
{
|
||||
channel[1].waveform_index = 0;
|
||||
@ -504,23 +495,14 @@ void PCEFast_PSG::Update(int32 timestamp)
|
||||
|
||||
if(!phase)
|
||||
{
|
||||
//printf("Volume update(Read, %d since last): ch=%d, lr=%d, ts=%d\n", running_timestamp - last_read, chnum, lr, running_timestamp);
|
||||
|
||||
if(chnum < 6)
|
||||
{
|
||||
vol_update_vllatch = GetVL(chnum, lr);
|
||||
}
|
||||
//last_read = running_timestamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("Volume update(Apply): ch=%d, lr=%d, ts=%d\n", chnum, lr, running_timestamp);
|
||||
if(chnum < 6)
|
||||
{
|
||||
channel[chnum].vl[lr] = vol_update_vllatch;
|
||||
}
|
||||
//last_apply = running_timestamp;
|
||||
}
|
||||
vol_update_which = (vol_update_which + 1) & 0x1F;
|
||||
|
||||
if(vol_update_which)
|
||||
|
@ -128,13 +128,8 @@ static INLINE void CheckFixSpriteTileCache(vdc_t *which_vdc, uint16 no, uint32 s
|
||||
if((special | 0x80) == which_vdc->spr_tile_clean[no])
|
||||
return;
|
||||
|
||||
//printf("Oops: %d, %d, %d\n", no, special | 0x100, which_vdc->spr_tile_clean[no]);
|
||||
if((no * 64) >= VRAM_Size)
|
||||
{
|
||||
//printf("Unmapped: %d\n", no);
|
||||
//VDC_UNDEFINED("Unmapped VRAM sprite tile read");
|
||||
// Unnecessary, since we reset the sprite tile cache to 0 on reset/init anyway.
|
||||
//memset(which_vdc->spr_tile_cache[no], 0x00, 16 * 16 * sizeof(uint16));
|
||||
}
|
||||
else if(special)
|
||||
{
|
||||
@ -301,7 +296,6 @@ DECLFR(VCE_Read)
|
||||
|
||||
DECLFW(VCE_Write)
|
||||
{
|
||||
//printf("%04x %02x, %04x\n", A, V, HuCPU.PC);
|
||||
switch(A&0x7)
|
||||
{
|
||||
case 0: SetVCECR(V); break;
|
||||
@ -327,7 +321,6 @@ void VDC_SetLayerEnableMask(uint64 mask)
|
||||
|
||||
void MDFN_FASTCALL VDC_Write_ST(uint32 A, uint8 V)
|
||||
{
|
||||
//printf("WriteST: %04x %02x\n", A, V);
|
||||
VDC_Write(A, V);
|
||||
}
|
||||
|
||||
@ -353,9 +346,6 @@ static void DoDMA(vdc_t *vdc)
|
||||
vdc->spr_tile_clean[vdc->DESR >> 6] = 0;
|
||||
}
|
||||
|
||||
//if(vdc->DCR & 0xC)
|
||||
//printf("Pllal: %02x\n", vdc->DCR);
|
||||
|
||||
vdc->SOUR += (((vdc->DCR & 0x4) >> 1) ^ 2) - 1;
|
||||
vdc->DESR += (((vdc->DCR & 0x8) >> 2) ^ 2) - 1;
|
||||
vdc->LENR--;
|
||||
@ -381,9 +371,6 @@ DECLFW(VDC_Write)
|
||||
int chip = 0;
|
||||
|
||||
A &= 0x3;
|
||||
//if((A == 0x2 || A == 0x3) && ((vdc->select & 0x1f) >= 0x09) && ((vdc->select & 0x1f) <= 0x13))
|
||||
|
||||
//printf("%04x, %02x: %02x, %d\n", A, vdc->select, V, vdc->display_counter);
|
||||
|
||||
switch(A)
|
||||
{
|
||||
@ -415,11 +402,6 @@ DECLFW(VDC_Write)
|
||||
FixTileCache(vdc, vdc->MAWR);
|
||||
vdc->spr_tile_clean[vdc->MAWR >> 6] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//VDC_UNDEFINED("Unmapped VRAM write");
|
||||
//printf("VROOM: %04x, %02x\n", vdc->MAWR, (vdc->CR >> 11) & 0x3);
|
||||
}
|
||||
vdc->MAWR += vram_inc_tab[(vdc->CR >> 11) & 0x3];
|
||||
}
|
||||
break;
|
||||
@ -428,7 +410,6 @@ DECLFW(VDC_Write)
|
||||
case 0x07: REGSETP(vdc->BXR, V, msb); vdc->BXR &= 0x3FF; break;
|
||||
case 0x08: REGSETP(vdc->BYR, V, msb); vdc->BYR &= 0x1FF;
|
||||
vdc->BG_YOffset = vdc->BYR; // Set it on LSB and MSB writes(only changing on MSB breaks Youkai Douchuuki)
|
||||
//printf("%04x\n", HuCPU.PC);
|
||||
break;
|
||||
case 0x09: REGSETP(vdc->MWR, V, msb); break;
|
||||
case 0x0a: REGSETP(vdc->HSR, V, msb); break;
|
||||
@ -456,7 +437,6 @@ DECLFW(VDC_Write)
|
||||
}
|
||||
break;
|
||||
case 0x13: REGSETP(vdc->SATB, V, msb); vdc->SATBPending = 1; break;
|
||||
// default: printf("Oops 2: %04x %02x\n", vdc->select, V);break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -637,7 +617,6 @@ static void DrawSprites(vdc_t *vdc, const int32 end, uint16 *spr_linebuf)
|
||||
|
||||
SpriteList[active_sprites].flags = flags;
|
||||
|
||||
//printf("Found: %d %d\n", vdc->RCRCount, x);
|
||||
SpriteList[active_sprites].x = x;
|
||||
SpriteList[active_sprites].palette_index = palette_index;
|
||||
|
||||
@ -774,8 +753,6 @@ static void MixNone(const uint32 count, uint16_t *target)
|
||||
static void DrawOverscan(const vdc_t *vdc, uint16_t *target, const MDFN_Rect *lw, const bool full, const int32 vpl, const int32 vpr)
|
||||
{
|
||||
uint32 os_color = vce.color_table_cache[0x100];
|
||||
|
||||
//printf("%d %d\n", lw->x, lw->w);
|
||||
int x = lw->x;
|
||||
|
||||
if(!full)
|
||||
@ -845,31 +822,6 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
|
||||
line_leadin1 = cyc_tot;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
{
|
||||
int vdc_to_master = 4;
|
||||
|
||||
line_leadin1 = 1365 - ((M_vdc_HDW + 1) * 8 - 4 + 6) * vdc_to_master;
|
||||
|
||||
if(line_leadin1 < 0)
|
||||
{
|
||||
line_leadin1 = 0;
|
||||
puts("Eep");
|
||||
}
|
||||
|
||||
if(M_vdc_HDS > 2)
|
||||
line_leadin1 += 2;
|
||||
|
||||
line_leadin1 = line_leadin1 / 3;
|
||||
}
|
||||
|
||||
if(line_leadin1 < 0)
|
||||
line_leadin1 = 0;
|
||||
else if(line_leadin1 > 400)
|
||||
line_leadin1 = 400;
|
||||
#endif
|
||||
|
||||
//printf("%d\n", line_leadin1);
|
||||
if(max_dc < vce.dot_clock)
|
||||
max_dc = vce.dot_clock;
|
||||
|
||||
@ -1108,7 +1060,6 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
|
||||
}
|
||||
|
||||
frame_counter = (frame_counter + 1) % (vce.lc263 ? 263 : 262);
|
||||
//printf("%d\n", vce.lc263);
|
||||
} while(frame_counter != VBlankFL); // big frame loop!
|
||||
|
||||
DisplayRect->w = defined_width[vce.dot_clock];
|
||||
|
@ -9,9 +9,7 @@
|
||||
#define REGGETP(_reg, _msb) ((_reg >> ((_msb) ? 8 : 0)) & 0xFF)
|
||||
|
||||
#define VDC_DEBUG(x)
|
||||
//printf("%s: %d\n", x, vdc->display_counter);
|
||||
#define VDC_UNDEFINED(x) { }
|
||||
//{ printf("%s: %d\n", x, vdc->display_counter); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -157,14 +155,10 @@ static INLINE uint8 VDC_Read(unsigned int A, bool SGX)
|
||||
break;
|
||||
}
|
||||
|
||||
//if(HuCPU.isopread && (A == 1 || A == 3)) //(A == 2 || A == 3)) // && A == 1)
|
||||
if(A == 1)
|
||||
{
|
||||
//if(vdc->display_counter >= (VDS + VSW) && vdc->display_counter < (VDS + VSW + VDW + 1) && vce.dot_clock > 0)
|
||||
if(vce.dot_clock > 0)
|
||||
ret = 0x40;
|
||||
//printf("%d %d %02x\n", vdc->display_counter, vce.dot_clock, ret);
|
||||
//ret = 0x40;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -27,6 +26,10 @@
|
||||
#include "mednafen-endian.h"
|
||||
#include "state.h"
|
||||
|
||||
#define SSEEK_END 2
|
||||
#define SSEEK_CUR 1
|
||||
#define SSEEK_SET 0
|
||||
|
||||
#define RLSB MDFNSTATE_RLSB /* 0x80000000 */
|
||||
|
||||
/* Forward declaration */
|
||||
@ -67,13 +70,13 @@ static int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
|
||||
{
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
case SSEEK_SET:
|
||||
st->loc = offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
case SSEEK_END:
|
||||
st->loc = st->len - offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
case SSEEK_CUR:
|
||||
st->loc += offset;
|
||||
break;
|
||||
}
|
||||
@ -109,7 +112,7 @@ static int smem_read32le(StateMem *st, uint32_t *b)
|
||||
return(4);
|
||||
}
|
||||
|
||||
static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
static bool SubWrite(StateMem *st, SFORMAT *sf)
|
||||
{
|
||||
/* Size can sometimes be zero, so also check for the
|
||||
* text name. These two should both be zero only at
|
||||
@ -128,7 +131,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
|
||||
if(sf->size == (uint32_t)~0) /* Link to another struct. */
|
||||
{
|
||||
if(!SubWrite(st, (SFORMAT *)sf->v, name_prefix))
|
||||
if(!SubWrite(st, (SFORMAT *)sf->v))
|
||||
return(0);
|
||||
|
||||
sf++;
|
||||
@ -137,14 +140,8 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
|
||||
bytesize = sf->size;
|
||||
|
||||
if (name_prefix)
|
||||
slen = snprintf(
|
||||
nameo + 1, 256, "%s%s", name_prefix, sf->name);
|
||||
else
|
||||
{
|
||||
slen = strlcpy(nameo + 1, sf->name, 256);
|
||||
nameo[256] = 0;
|
||||
}
|
||||
nameo[0] = slen;
|
||||
|
||||
smem_write(st, nameo, 1 + nameo[0]);
|
||||
@ -221,14 +218,14 @@ static int WriteStateChunk(StateMem *st, const char *sname, SFORMAT *sf)
|
||||
|
||||
data_start_pos = st->loc;
|
||||
|
||||
if(!SubWrite(st, sf, NULL))
|
||||
if(!SubWrite(st, sf))
|
||||
return(0);
|
||||
|
||||
end_pos = st->loc;
|
||||
|
||||
smem_seek(st, data_start_pos - 4, SEEK_SET);
|
||||
smem_seek(st, data_start_pos - 4, SSEEK_SET);
|
||||
smem_write32le(st, end_pos - data_start_pos);
|
||||
smem_seek(st, end_pos, SEEK_SET);
|
||||
smem_seek(st, end_pos, SSEEK_SET);
|
||||
|
||||
return(end_pos - data_start_pos);
|
||||
}
|
||||
@ -292,7 +289,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
|
||||
if(recorded_size != expected_size)
|
||||
{
|
||||
if(smem_seek(st, recorded_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, recorded_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
@ -322,7 +319,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(smem_seek(st, recorded_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, recorded_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@ -360,13 +357,13 @@ static int MDFNSS_StateAction_internal(void *st_p, int load, int data_only, stru
|
||||
}
|
||||
else
|
||||
{
|
||||
if(smem_seek(st, tmp_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, tmp_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
if(smem_seek(st, -total, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, -total, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
if(!found && !section->optional) /* Not found. We are sad! */
|
||||
if(!found) /* Not found. We are sad! */
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
@ -385,7 +382,6 @@ int MDFNSS_StateAction(void *st_p, int load, int data_only, SFORMAT *sf, const c
|
||||
|
||||
love.sf = sf;
|
||||
love.name = name;
|
||||
love.optional = optional;
|
||||
|
||||
return(MDFNSS_StateAction_internal(st, load, 0, &love));
|
||||
}
|
||||
@ -410,7 +406,7 @@ int MDFNSS_SaveSM(void *st_p, int a, int b, const void *c, const void *d, const
|
||||
return(0);
|
||||
|
||||
sizy = st->loc;
|
||||
smem_seek(st, 16 + 4, SEEK_SET);
|
||||
smem_seek(st, 16 + 4, SSEEK_SET);
|
||||
smem_write32le(st, sizy);
|
||||
|
||||
return(1);
|
||||
|
@ -38,7 +38,6 @@ struct SSDescriptor
|
||||
{
|
||||
SFORMAT *sf;
|
||||
const char *name;
|
||||
bool optional;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -520,339 +520,3 @@ unsigned char *oggpack_get_buffer(oggpack_buffer *b){
|
||||
unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
|
||||
return oggpack_get_buffer(b);
|
||||
}
|
||||
|
||||
/* Self test of the bitwise routines; everything else is based on
|
||||
them, so they damned well better be solid. */
|
||||
|
||||
#ifdef _V_SELFTEST
|
||||
#include <stdio.h>
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
oggpack_buffer o;
|
||||
oggpack_buffer r;
|
||||
|
||||
void report(char *in){
|
||||
fprintf(stderr,"%s",in);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
|
||||
long bytes,i;
|
||||
unsigned char *buffer;
|
||||
|
||||
oggpack_reset(&o);
|
||||
for(i=0;i<vals;i++)
|
||||
oggpack_write(&o,b[i],bits?bits:ilog(b[i]));
|
||||
buffer=oggpack_get_buffer(&o);
|
||||
bytes=oggpack_bytes(&o);
|
||||
if(bytes!=compsize)report("wrong number of bytes!\n");
|
||||
for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
|
||||
for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
|
||||
report("wrote incorrect value!\n");
|
||||
}
|
||||
oggpack_readinit(&r,buffer,bytes);
|
||||
for(i=0;i<vals;i++){
|
||||
int tbit=bits?bits:ilog(b[i]);
|
||||
if(oggpack_look(&r,tbit)==-1)
|
||||
report("out of data!\n");
|
||||
if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit]))
|
||||
report("looked at incorrect value!\n");
|
||||
if(tbit==1)
|
||||
if(oggpack_look1(&r)!=(b[i]&mask[tbit]))
|
||||
report("looked at single bit incorrect value!\n");
|
||||
if(tbit==1){
|
||||
if(oggpack_read1(&r)!=(b[i]&mask[tbit]))
|
||||
report("read incorrect single bit value!\n");
|
||||
}else{
|
||||
if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit]))
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
}
|
||||
if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
|
||||
}
|
||||
|
||||
void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
|
||||
long bytes,i;
|
||||
unsigned char *buffer;
|
||||
|
||||
oggpackB_reset(&o);
|
||||
for(i=0;i<vals;i++)
|
||||
oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
|
||||
buffer=oggpackB_get_buffer(&o);
|
||||
bytes=oggpackB_bytes(&o);
|
||||
if(bytes!=compsize)report("wrong number of bytes!\n");
|
||||
for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
|
||||
for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
|
||||
report("wrote incorrect value!\n");
|
||||
}
|
||||
oggpackB_readinit(&r,buffer,bytes);
|
||||
for(i=0;i<vals;i++){
|
||||
int tbit=bits?bits:ilog(b[i]);
|
||||
if(oggpackB_look(&r,tbit)==-1)
|
||||
report("out of data!\n");
|
||||
if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit]))
|
||||
report("looked at incorrect value!\n");
|
||||
if(tbit==1)
|
||||
if(oggpackB_look1(&r)!=(b[i]&mask[tbit]))
|
||||
report("looked at single bit incorrect value!\n");
|
||||
if(tbit==1){
|
||||
if(oggpackB_read1(&r)!=(b[i]&mask[tbit]))
|
||||
report("read incorrect single bit value!\n");
|
||||
}else{
|
||||
if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit]))
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
}
|
||||
if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
|
||||
}
|
||||
|
||||
int main(void){
|
||||
unsigned char *buffer;
|
||||
long bytes,i;
|
||||
static unsigned long testbuffer1[]=
|
||||
{18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
|
||||
567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
|
||||
int test1size=43;
|
||||
|
||||
static unsigned long testbuffer2[]=
|
||||
{216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
|
||||
1233432,534,5,346435231,14436467,7869299,76326614,167548585,
|
||||
85525151,0,12321,1,349528352};
|
||||
int test2size=21;
|
||||
|
||||
static unsigned long testbuffer3[]=
|
||||
{1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
|
||||
0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
|
||||
int test3size=56;
|
||||
|
||||
static unsigned long large[]=
|
||||
{2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
|
||||
1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
|
||||
85525151,0,12321,1,2146528352};
|
||||
|
||||
int onesize=33;
|
||||
static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
|
||||
34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
|
||||
223,4};
|
||||
static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222,
|
||||
8,139,145,227,126,34,55,244,171,85,100,39,195,173,18,
|
||||
245,251,128};
|
||||
|
||||
int twosize=6;
|
||||
static int two[6]={61,255,255,251,231,29};
|
||||
static int twoB[6]={247,63,255,253,249,120};
|
||||
|
||||
int threesize=54;
|
||||
static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
|
||||
142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
|
||||
58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
|
||||
100,52,4,14,18,86,77,1};
|
||||
static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183,
|
||||
130,59,240,121,59,85,223,19,228,180,134,33,107,74,98,
|
||||
233,253,196,135,63,2,110,114,50,155,90,127,37,170,104,
|
||||
200,20,254,4,58,106,176,144,0};
|
||||
|
||||
int foursize=38;
|
||||
static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
|
||||
132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
|
||||
28,2,133,0,1};
|
||||
static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41,
|
||||
1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67,
|
||||
129,10,4,32};
|
||||
|
||||
int fivesize=45;
|
||||
static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
|
||||
241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
|
||||
84,75,159,2,1,0,132,192,8,0,0,18,22};
|
||||
static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226,
|
||||
124,105,12,0,133,128,0,162,233,242,67,152,77,205,77,
|
||||
172,150,169,129,79,128,0,6,4,32,0,27,9,0};
|
||||
|
||||
int sixsize=7;
|
||||
static int six[7]={17,177,170,242,169,19,148};
|
||||
static int sixB[7]={136,141,85,79,149,200,41};
|
||||
|
||||
/* Test read/write together */
|
||||
/* Later we test against pregenerated bitstreams */
|
||||
oggpack_writeinit(&o);
|
||||
|
||||
fprintf(stderr,"\nSmall preclipped packing (LSb): ");
|
||||
cliptest(testbuffer1,test1size,0,one,onesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nNull bit call (LSb): ");
|
||||
cliptest(testbuffer3,test3size,0,two,twosize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge preclipped packing (LSb): ");
|
||||
cliptest(testbuffer2,test2size,0,three,threesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
|
||||
oggpack_reset(&o);
|
||||
for(i=0;i<test2size;i++)
|
||||
oggpack_write(&o,large[i],32);
|
||||
buffer=oggpack_get_buffer(&o);
|
||||
bytes=oggpack_bytes(&o);
|
||||
oggpack_readinit(&r,buffer,bytes);
|
||||
for(i=0;i<test2size;i++){
|
||||
if(oggpack_look(&r,32)==-1)report("out of data. failed!");
|
||||
if(oggpack_look(&r,32)!=large[i]){
|
||||
fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i],
|
||||
oggpack_look(&r,32),large[i]);
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
oggpack_adv(&r,32);
|
||||
}
|
||||
if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSmall unclipped packing (LSb): ");
|
||||
cliptest(testbuffer1,test1size,7,four,foursize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge unclipped packing (LSb): ");
|
||||
cliptest(testbuffer2,test2size,17,five,fivesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
|
||||
cliptest(testbuffer3,test3size,1,six,sixsize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nTesting read past end (LSb): ");
|
||||
oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
|
||||
for(i=0;i<64;i++){
|
||||
if(oggpack_read(&r,1)!=0){
|
||||
fprintf(stderr,"failed; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(oggpack_look(&r,1)!=-1 ||
|
||||
oggpack_read(&r,1)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
|
||||
if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){
|
||||
fprintf(stderr,"failed 2; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(oggpack_look(&r,18)!=0 ||
|
||||
oggpack_look(&r,18)!=0){
|
||||
fprintf(stderr,"failed 3; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
if(oggpack_look(&r,19)!=-1 ||
|
||||
oggpack_look(&r,19)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
if(oggpack_look(&r,32)!=-1 ||
|
||||
oggpack_look(&r,32)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
oggpack_writeclear(&o);
|
||||
fprintf(stderr,"ok.\n");
|
||||
|
||||
/********** lazy, cut-n-paste retest with MSb packing ***********/
|
||||
|
||||
/* Test read/write together */
|
||||
/* Later we test against pregenerated bitstreams */
|
||||
oggpackB_writeinit(&o);
|
||||
|
||||
fprintf(stderr,"\nSmall preclipped packing (MSb): ");
|
||||
cliptestB(testbuffer1,test1size,0,oneB,onesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nNull bit call (MSb): ");
|
||||
cliptestB(testbuffer3,test3size,0,twoB,twosize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge preclipped packing (MSb): ");
|
||||
cliptestB(testbuffer2,test2size,0,threeB,threesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\n32 bit preclipped packing (MSb): ");
|
||||
oggpackB_reset(&o);
|
||||
for(i=0;i<test2size;i++)
|
||||
oggpackB_write(&o,large[i],32);
|
||||
buffer=oggpackB_get_buffer(&o);
|
||||
bytes=oggpackB_bytes(&o);
|
||||
oggpackB_readinit(&r,buffer,bytes);
|
||||
for(i=0;i<test2size;i++){
|
||||
if(oggpackB_look(&r,32)==-1)report("out of data. failed!");
|
||||
if(oggpackB_look(&r,32)!=large[i]){
|
||||
fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i],
|
||||
oggpackB_look(&r,32),large[i]);
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
oggpackB_adv(&r,32);
|
||||
}
|
||||
if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSmall unclipped packing (MSb): ");
|
||||
cliptestB(testbuffer1,test1size,7,fourB,foursize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge unclipped packing (MSb): ");
|
||||
cliptestB(testbuffer2,test2size,17,fiveB,fivesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSingle bit unclipped packing (MSb): ");
|
||||
cliptestB(testbuffer3,test3size,1,sixB,sixsize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nTesting read past end (MSb): ");
|
||||
oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
|
||||
for(i=0;i<64;i++){
|
||||
if(oggpackB_read(&r,1)!=0){
|
||||
fprintf(stderr,"failed; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(oggpackB_look(&r,1)!=-1 ||
|
||||
oggpackB_read(&r,1)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
|
||||
if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){
|
||||
fprintf(stderr,"failed 2; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(oggpackB_look(&r,18)!=0 ||
|
||||
oggpackB_look(&r,18)!=0){
|
||||
fprintf(stderr,"failed 3; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
if(oggpackB_look(&r,19)!=-1 ||
|
||||
oggpackB_look(&r,19)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
if(oggpackB_look(&r,32)!=-1 ||
|
||||
oggpackB_look(&r,32)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
oggpackB_writeclear(&o);
|
||||
fprintf(stderr,"ok.\n\n");
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* _V_SELFTEST */
|
||||
|
||||
#undef BUFFER_INCREMENT
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ogg.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,6 @@ extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ivorbiscodec.h"
|
||||
|
||||
#define CHUNKSIZE 1024
|
||||
|
@ -16,7 +16,6 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "ogg.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ogg.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
@ -28,6 +27,10 @@
|
||||
#include "os.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define VSEEK_END 2
|
||||
#define VSEEK_CUR 1
|
||||
#define VSEEK_SET 0
|
||||
|
||||
/* A 'chained bitstream' is a Vorbis bitstream that contains more than
|
||||
one logical bitstream arranged end to end (the only form of Ogg
|
||||
multiplexing allowed in a Vorbis bitstream; grouping [parallel
|
||||
@ -86,7 +89,7 @@ static long _get_data(OggVorbis_File *vf){
|
||||
static int _seek_helper(OggVorbis_File *vf,int64_t offset){
|
||||
if(vf->datasource){
|
||||
if(!(vf->callbacks.seek_func)||
|
||||
(vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET) == -1)
|
||||
(vf->callbacks.seek_func)(vf->datasource, offset, VSEEK_SET) == -1)
|
||||
return OV_EREAD;
|
||||
vf->offset=offset;
|
||||
ogg_sync_reset(&vf->oy);
|
||||
@ -635,7 +638,7 @@ static int _open_seekable2(OggVorbis_File *vf){
|
||||
|
||||
/* we can seek, so set out learning all about this file */
|
||||
if(vf->callbacks.seek_func && vf->callbacks.tell_func){
|
||||
(vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
|
||||
(vf->callbacks.seek_func)(vf->datasource,0,VSEEK_END);
|
||||
vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
|
||||
}else{
|
||||
vf->offset=vf->end=-1;
|
||||
@ -874,16 +877,9 @@ static int _fetch_and_process_packet(OggVorbis_File *vf,
|
||||
}
|
||||
}
|
||||
|
||||
/* if, eg, 64 bit stdio is configured by default, this will build with
|
||||
fseek64 */
|
||||
static int _fseek64_wrap(FILE *f,int64_t off,int whence){
|
||||
if(f==NULL)return(-1);
|
||||
return fseek(f,off,whence);
|
||||
}
|
||||
|
||||
static int _ov_open1(void *f,OggVorbis_File *vf,const char *initial,
|
||||
long ibytes, ov_callbacks callbacks){
|
||||
int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,SEEK_CUR):-1);
|
||||
int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,VSEEK_CUR):-1);
|
||||
uint32_t *serialno_list=NULL;
|
||||
int serialno_list_size=0;
|
||||
int ret;
|
||||
|
Loading…
Reference in New Issue
Block a user