Remove if 0 code

This commit is contained in:
libretroadmin 2022-06-10 07:35:26 +02:00
parent d772723e91
commit c8cb36811e
11 changed files with 0 additions and 332 deletions

View File

@ -91,12 +91,6 @@ INLINE void MemoryStream::grow_if_necessary(uint64 new_required_size)
if(new_required_alloced < new_required_size || new_required_alloced > SIZE_MAX)
new_required_alloced = SIZE_MAX;
#if 0
// If constrained alloc size isn't enough, throw an out-of-memory/address-space type error.
if(new_required_alloced < new_required_size)
throw MDFN_Error(ErrnoHolder(ENOMEM));
#endif
new_data_buffer = (uint8*)realloc(data_buffer, new_required_alloced);
//
@ -129,11 +123,6 @@ void MemoryStream::write(const void *data, uint64 count)
{
uint64 nrs = position + count;
#if 0
if(nrs < position)
throw MDFN_Error(ErrnoHolder(EFBIG));
#endif
grow_if_necessary(nrs);
memmove(&data_buffer[position], data, count);

View File

@ -139,12 +139,7 @@ static size_t UnQuotify(const std::string &src, size_t source_offset, std::strin
{
source_offset++;
// Not sure which behavior is most useful(or correct :b).
#if 0
in_quote = false;
already_normal = true;
#else
break;
#endif
}
else
in_quote = 1;
@ -508,17 +503,9 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
} // end to TRACK
else if(cmdbuf == "SILENCE")
{
#if 0
log_cb(RETRO_LOG_INFO, "Unsupported directive: %s\n", cmdbuf.c_str());
return false;
#endif
}
else if(cmdbuf == "ZERO")
{
#if 0
log_cb(RETRO_LOG_INFO, "Unsupported directive: %s\n", cmdbuf.c_str());
return false;
#endif
}
else if(cmdbuf == "FIFO")
{
@ -638,13 +625,6 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache)
disc_type = DISC_TYPE_CDDA_OR_M1;
else if(cmdbuf == "CD_ROM_XA")
disc_type = DISC_TYPE_CD_XA;
else
{
#if 0
log_cb(RETRO_LOG_ERROR, "Unsupported directive: %s", cmdbuf.c_str());
return false;
#endif
}
// TODO: CATALOG
} /*********** END TOC HANDLING ************/

View File

@ -404,16 +404,6 @@ void synth_udapp_sector_lba(uint8_t mode, const TOC& toc, const int32_t lba, int
}
}
#if 0
bool subq_extrapolate(const uint8_t *subq_input, int32_t position_delta, uint8_t *subq_output)
{
assert(subq_check_checksum(subq_input));
subq_generate_checksum(subq_output);
}
#endif
void scrambleize_data_sector(uint8_t *sector_data)
{
unsigned i;

View File

@ -34,32 +34,6 @@ class SimpleFIFO
in_count %= (data.size() + 1);
}
#if 0
INLINE int StateAction(StateMem *sm, int load, int data_only, const char* sname)
{
SFORMAT StateRegs[] =
{
std::vector<T> data;
uint32 size;
SFVAR(read_pos),
SFVAR(write_pos),
SFVAR(in_count),
SFEND;
}
int ret = MDFNSS_StateAction(sm, load, data_only, sname);
if(load)
{
read_pos %= data.size();
write_pos %= data.size();
in_count %= (data.size() + 1);
}
return(ret);
}
#endif
INLINE uint32 CanWrite(void)
{
return(size - in_count);

View File

@ -132,19 +132,6 @@ ReedSolomonTables *CreateReedSolomonTables(GaloisTables *gt,
for(i=0; i<=rt->nroots; i++)
rt->gpoly[i] = gt->indexOf[rt->gpoly[i]];
#if 0
/* for the precalculated unrolled loops only */
for(i=gt->nroots-1; i>0; i--)
PrintCLI(
" par_idx[((++spk)&%d)] ^= enc_alpha_to[feedback + %3d];\n",
nroots-1,gt->gpoly[i]);
PrintCLI(" par_idx[sp] = enc_alpha_to[feedback + %3d];\n",
gt->gpoly[0]);
#endif
return rt;
}

View File

@ -105,27 +105,6 @@ static void gf8_create_log_tables()
*/
#define gf8_add(a, b) (a) ^ (b)
/* Multiplication in the GF(8) domain: add the logarithms (modulo 255)
* and return the inverse logarithm. Not used!
*/
#if 0
static gf8_t gf8_mult(gf8_t a, gf8_t b)
{
int16_t sum;
if (a == 0 || b == 0)
return 0;
sum = GF8_LOG[a] + GF8_LOG[b];
if (sum >= 255)
sum -= 255;
return GF8_ILOG[sum];
}
#endif
/* Division in the GF(8) domain: Like multiplication but logarithms a
* subtracted.
*/
@ -593,96 +572,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

View File

@ -986,27 +986,6 @@ static void DoREZEROUNIT(const uint8_t *cdb)
SendStatusAndMessage(STATUS_GOOD, 0x00);
}
// This data was originally taken from a PC-FXGA software loader, but
// while it was mostly correct(maybe it is correct for the FXGA, but not for the PC-FX?),
// it was 3 bytes too long, and the last real byte was 0x45 instead of 0x20.
// TODO: Investigate this discrepancy by testing an FXGA with the official loader software.
#if 0
static const uint8_t InqData[0x24] =
{
// Standard
0x05, 0x80, 0x02, 0x00,
// Additional Length
0x1F,
// Vendor Specific
0x00, 0x00, 0x00, 0x4E, 0x45, 0x43, 0x20, 0x20,
0x20, 0x20, 0x20, 0x43, 0x44, 0x2D, 0x52, 0x4F,
0x4D, 0x20, 0x44, 0x52, 0x49, 0x56, 0x45, 0x3A,
0x46, 0x58, 0x20, 0x31, 0x2E, 0x30, 0x20
};
#endif
// Miraculum behaves differently if the last byte(offset 0x23) of the inquiry data is 0x45(ASCII character 'E'). Relavent code is at PC=0x3E382
// If it's = 0x45, it will run MODE SELECT, and transfer this data to the CD unit: 00 00 00 00 29 01 00
static const uint8_t InqData[0x24] =
@ -2463,16 +2442,6 @@ static INLINE void RunCDDA(uint32_t system_timestamp, int32_t run_time)
if(TrayOpen || !Cur_CDIF)
{
cdda.CDDAStatus = CDDASTATUS_STOPPED;
#if 0
cd.data_transfer_done = FALSE;
cd.key_pending = SENSEKEY_NOT_READY;
cd.asc_pending = ASC_MEDIUM_NOT_PRESENT;
cd.ascq_pending = 0x00;
cd.fru_pending = 0x00;
SendStatusAndMessage(STATUS_CHECK_CONDITION, 0x00);
#endif
break;
}
@ -2537,28 +2506,6 @@ static INLINE void RunCDDA(uint32_t system_timestamp, int32_t run_time)
cdda.sr[1] = cdda.CDDASectorBuffer[cdda.CDDAReadPos * 2 + cdda.OutPortChSelectCache[1]];
}
#if 0
{
static int16 wv = 0x7FFF; //0x5000;
static unsigned counter = 0;
static double phase = 0;
static double phase_inc = 0;
static const double phase_inc_inc = 0.000003 / 2;
cdda.sr[0] = 32767 * sin(phase);
cdda.sr[1] = 32767 * sin(phase);
//cdda.sr[0] = wv;
//cdda.sr[1] = wv;
if(counter == 0)
wv = -wv;
counter = (counter + 1) & 1;
phase += phase_inc;
phase_inc += phase_inc_inc;
}
#endif
{
const unsigned obwp = cdda.OversamplePos >> 1;
cdda.OversampleBuffer[0][obwp] = cdda.OversampleBuffer[0][0x10 + obwp] = cdda.sr[0];

View File

@ -47,40 +47,3 @@ int cputest_get_flags(void)
checked = 1;
return flags;
}
#if 0
//#ifdef TEST
#undef printf
#include <stdio.h>
int main(void)
{
int cpu_flags = av_get_cpu_flags();
printf("cpu_flags = 0x%08X\n", cpu_flags);
printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
#if ARCH_ARM
cpu_flags & CPUTEST_FLAG_IWMMXT ? "IWMMXT " : "",
#elif ARCH_POWERPC
cpu_flags & CPUTEST_FLAG_ALTIVEC ? "ALTIVEC " : "",
#elif ARCH_X86
cpu_flags & CPUTEST_FLAG_MMX ? "MMX " : "",
cpu_flags & CPUTEST_FLAG_MMX2 ? "MMX2 " : "",
cpu_flags & CPUTEST_FLAG_SSE ? "SSE " : "",
cpu_flags & CPUTEST_FLAG_SSE2 ? "SSE2 " : "",
cpu_flags & CPUTEST_FLAG_SSE2SLOW ? "SSE2(slow) " : "",
cpu_flags & CPUTEST_FLAG_SSE3 ? "SSE3 " : "",
cpu_flags & CPUTEST_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
cpu_flags & CPUTEST_FLAG_SSSE3 ? "SSSE3 " : "",
cpu_flags & CPUTEST_FLAG_ATOM ? "Atom " : "",
cpu_flags & CPUTEST_FLAG_SSE4 ? "SSE4.1 " : "",
cpu_flags & CPUTEST_FLAG_SSE42 ? "SSE4.2 " : "",
cpu_flags & CPUTEST_FLAG_AVX ? "AVX " : "",
cpu_flags & CPUTEST_FLAG_3DNOW ? "3DNow " : "",
cpu_flags & CPUTEST_FLAG_3DNOWEXT ? "3DNowExt " : "");
#endif
return 0;
}
#endif

View File

@ -8,10 +8,6 @@
#include "state.h"
#include "video.h"
#if 0
template<typename T> void showtype(T foo);
#endif
enum
{
MDFN_ROTATE0 = 0,

View File

@ -135,26 +135,10 @@ void MDFNMP_InstallReadPatches(void)
unsigned x;
std::vector<SUBCHEAT>::iterator chit;
if(!CheatsActive) return;
#if 0
for(x = 0; x < 8; x++)
{
for(chit = SubCheats[x].begin(); chit != SubCheats[x].end(); chit++)
{
if(MDFNGameInfo->InstallReadPatch)
MDFNGameInfo->InstallReadPatch(chit->addr);
}
}
#endif
}
void MDFNMP_RemoveReadPatches(void)
{
#if 0
if(MDFNGameInfo->RemoveReadPatches)
MDFNGameInfo->RemoveReadPatches();
#endif
}
static void CheatMemErr(void)

View File

@ -182,27 +182,6 @@ static DECLFW(MCG_WriteHandler)
mcg->Write(HuCPU.Timestamp(), A, V);
}
static void LoadSaveMemory(const std::string& path, uint8* const data, const uint64 len, bool possibly_gz = false)
{
#if 0
try
{
std::unique_ptr<Stream> fp((Stream*)(new FileStream(path, FileStream::MODE_READ)));
const uint64 fp_size_tmp = fp->size();
if(fp_size_tmp != len)
throw MDFN_Error("Save game memory file \"%s\" is an incorrect size(%llu bytes). The correct size is %llu bytes.", path.c_str(), (unsigned long long)fp_size_tmp, (unsigned long long)len);
fp->read(data, len);
}
catch(MDFN_Error &e)
{
if(e.GetErrno() != ENOENT)
throw;
}
#endif
}
uint32 HuC_Load(const uint8_t *data, size_t size, bool DisableBRAM, SysCardType syscard)
{
uint32 crc = 0;
@ -287,7 +266,6 @@ uint32 HuC_Load(const uint8_t *data, size_t size, bool DisableBRAM, SysCardType
tmp_buf.resize(nvs);
//LoadSaveMemory(MDFN_MakeFName(MDFNMKF_SAV, 0, buf), &tmp_buf[0], tmp_buf.size(), false);
mcg->WriteNV(i, &tmp_buf[0], 0, tmp_buf.size());
}
}
@ -386,8 +364,6 @@ uint32 HuC_Load(const uint8_t *data, size_t size, bool DisableBRAM, SysCardType
PopRAM = new uint8[32768];
memset(PopRAM, 0xFF, 32768);
//LoadSaveMemory(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), PopRAM, 32768);
IsPopulous = 1;
for(int x = 0x40; x < 0x44; x++)
{
@ -404,8 +380,6 @@ uint32 HuC_Load(const uint8_t *data, size_t size, bool DisableBRAM, SysCardType
TsushinRAM = new uint8[0x8000];
memset(TsushinRAM, 0xFF, 0x8000);
//LoadSaveMemory(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), TsushinRAM, 32768);
IsTsushin = 1;
for(int x = 0x88; x < 0x8C; x++)
{
@ -449,8 +423,6 @@ BRAM_Init:
memset(SaveRAM, 0x00, 2048);
memcpy(SaveRAM, BRAM_Init_String, 8);
//LoadSaveMemory(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav"), SaveRAM, 2048);
HuCPU.SetWriteHandler(0xF7, SaveRAMWrite);
HuCPU.SetReadHandler(0xF7, SaveRAMRead);
MDFNMP_AddRAM(2048, 0xF7 * 8192, SaveRAM);