From 6a31522981f428a92ce364c3654710e6e4ee4d60 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Mon, 20 Jun 2022 06:07:40 +0200 Subject: [PATCH] Get rid of mostly dead code --- src/boards/n106.c | 5 +-- src/cart.c | 2 -- src/fds.c | 6 ---- src/filter.c | 24 +------------- src/fir/toh.c | 24 -------------- src/input/bworld.c | 1 - src/input/ftrainer.c | 1 - src/input/mahjong.c | 11 ++----- src/input/oekakids.c | 2 -- src/input/quiz.c | 10 ------ src/ntsc/nes_ntsc_impl.h | 9 ------ src/ops.h | 6 ---- src/palettes/conv.c | 70 ---------------------------------------- src/sound.c | 4 --- 14 files changed, 5 insertions(+), 170 deletions(-) delete mode 100644 src/fir/toh.c delete mode 100644 src/palettes/conv.c diff --git a/src/boards/n106.c b/src/boards/n106.c index a0f0639..1f26048 100644 --- a/src/boards/n106.c +++ b/src/boards/n106.c @@ -130,8 +130,6 @@ static void FixNTAR(void) { static void FASTAPASS(2) DoCHRRAMROM(int x, uint8 V) { CHR[x] = V; if (!is210 && !((gorfus >> ((x >> 2) + 6)) & 1) && (V >= 0xE0)) { -/* printf("BLAHAHA: %d, %02x\n",x,V); */ -/* setchr1r(0x10,x<<10,V&7); */ } else setchr1(x << 10, V); } @@ -338,9 +336,8 @@ static void DoNamcoSound(int32 *Wave, int Count) { envelope = EnvCache[P]; lengo = LengthCache[P]; - if (!freq) { /*printf("Ack");*/ + if (!freq) continue; - } { int c = ((IRAM[0x7F] >> 4) & 7) + 1; diff --git a/src/cart.c b/src/cart.c index 5bf0704..9d4a5d6 100644 --- a/src/cart.c +++ b/src/cart.c @@ -139,7 +139,6 @@ DECLFR(CartBR) { } DECLFW(CartBW) { - /* printf("Ok: %04x:%02x, %d\n",A,V,PRGIsRAM[A>>11]); */ if (PRGIsRAM[A >> 11] && Page[A >> 11]) Page[A >> 11][A] = V; } @@ -493,7 +492,6 @@ void FixGenieMap(void) { VPageR = VPage; FlushGenieRW(); - /* printf("Rightyo\n"); */ for (x = 0; x < 3; x++) if ((modcon >> (4 + x)) & 1) { readfunc tmp[3] = { GenieFix1, GenieFix2, GenieFix3 }; diff --git a/src/fds.c b/src/fds.c index 14f8eee..ea658cd 100644 --- a/src/fds.c +++ b/src/fds.c @@ -256,9 +256,6 @@ static DECLFR(FDSRead4031) { break; case 14: mapperFDS_filesize |= ret << 8; - /* char fdsfile[10]; */ - /* strncpy(fdsfile, (char*)&diskdata[InDisk][mapperFDS_blockstart + 3], 8); */ - /* printf("Read file: %s (size: %d)\n"), fdsfile, mapperFDS_filesize); */ break; } mapperFDS_diskaddr++; @@ -338,9 +335,6 @@ static DECLFW(FDSWrite) { case 13: mapperFDS_filesize = V; break; case 14: mapperFDS_filesize |= V << 8; - /* char fdsfile[10]; */ - /* strncpy(fdsfile, (char*)&diskdata[InDisk][mapperFDS_blockstart + 3], 8); */ - /* printf("Write file: %s (size: %d)\n"), fdsfile, mapperFDS_filesize); */ break; } mapperFDS_diskaddr++; diff --git a/src/filter.c b/src/filter.c index a5fc0f5..fcc752e 100644 --- a/src/filter.c +++ b/src/filter.c @@ -21,7 +21,6 @@ void SexyFilter2(int32 *in, int32 count) { p = ((double)2 - cos(x)) - sqrt(pow((double)2 - cos(x), 2) - 1); c = p * 0x100000; - /* printf("%f\n",(double)c/0x100000); */ #endif static int64 acc = 0; @@ -58,11 +57,9 @@ void SexyFilter(int32 *in, int32 *out, int32 count) { int64 ino = (int64) * in * vmul; sexyfilter_acc1 += ((ino - sexyfilter_acc1) * mul1) >> 16; sexyfilter_acc2 += ((ino - sexyfilter_acc1 - sexyfilter_acc2) * mul2) >> 16; - /* printf("%d ",*in); */ *in = 0; { int32 t = (sexyfilter_acc1 - ino + sexyfilter_acc2) >> 16; - /* if(t>32767 || t<-32768) printf("Flow: %d\n",t); */ if (t > 32767) t = 32767; if (t < -32768) t = -32768; *out = t; @@ -87,17 +84,9 @@ void SexyFilter(int32 *in, int32 *out, int32 count) { int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover) { uint32 x; - uint32 max; int32 *outsave = out; int32 count = 0; - -#if 0 - for(x=0;xmva) { mva=in[x]; printf("%ld\n",in[x]);} - } -#endif - max = (inlen - 1) << 16; + uint32 max = (inlen - 1) << 16; if (FSettings.soundq == 2) { for (x = mrindex; x < max; x += mrratio) { @@ -181,15 +170,4 @@ void MakeFilters(int32 rate) { else for (x = 0; x < (NCOEFFS >> 1); x++) coeffs[x] = coeffs[NCOEFFS - 1 - x] = tmp[x]; - - #ifdef MOO - /* Some tests involving precision and error. */ - { - static int64 acc = 0; - int x; - for (x = 0; x < SQ2NCOEFFS; x++) - acc += (int64)32767 * sq2coeffs[x]; - printf("Foo: %lld\n", acc); - } - #endif } diff --git a/src/fir/toh.c b/src/fir/toh.c deleted file mode 100644 index 5ae4f0b..0000000 --- a/src/fir/toh.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#define MAX 512 - -void main(void) -{ - char buf[256]; - int count=0; - - while(fgets(buf,256,stdin)>0) - { - double p; - - if(sscanf(buf,"%lf",&p)==1) - { - p*=65536*16; - printf("%ld,\n",(long)p); - count++; - if(count==MAX) break; - } - - } - -} diff --git a/src/input/bworld.c b/src/input/bworld.c index cf22a8c..92a15c0 100644 --- a/src/input/bworld.c +++ b/src/input/bworld.c @@ -44,7 +44,6 @@ static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret) { } static void FP_FASTAPASS(1) Write(uint8 V) { - /* printf("%02x\n",V); */ } static void FP_FASTAPASS(2) Update(void *data, int arg) { diff --git a/src/input/ftrainer.c b/src/input/ftrainer.c index 46bafe6..a018e9c 100644 --- a/src/input/ftrainer.c +++ b/src/input/ftrainer.c @@ -35,7 +35,6 @@ static uint8 FP_FASTAPASS(2) FT_Read(int w, uint8 ret) { static void FP_FASTAPASS(1) FT_Write(uint8 V) { FTValR = 0; - /* printf("%08x\n",FTVal); */ if (!(V & 0x1)) FTValR = (FTVal >> 8); else if (!(V & 0x2)) diff --git a/src/input/mahjong.c b/src/input/mahjong.c index 1f9472d..497563a 100644 --- a/src/input/mahjong.c +++ b/src/input/mahjong.c @@ -46,21 +46,16 @@ static void FP_FASTAPASS(1) MJ_Write(uint8 v) { v >>= 1; v &= 3; - if (v == 3) { + if (v == 3) MRet = (MReal >> 14) & 0x7F; - /* MRet=((MRet&0x1F) |((MRet&0x40)>>1)|((MRet&0x20)<<1)) <<1; */ /* (MReal>>13)&0x7F; */ - } else if (v == 2) { + else if (v == 2) MRet = MReal & 0xFF; - } else if (v == 1) { + else if (v == 1) MRet = (MReal >> 8) & 0x3F; - } -/* HSValR=HSVal<<1; */ } static void FP_FASTAPASS(2) MJ_Update(void *data, int arg) { MReal = *(uint32*)data; - /* printf("%08x\n",MReal>>13); */ - /* HSVal=*(uint8*)data; */ } static INPUTCFC Mahjong = { MJ_Read, MJ_Write, 0, MJ_Update, 0, 0 }; diff --git a/src/input/oekakids.c b/src/input/oekakids.c index 19ed512..a6a5c57 100644 --- a/src/input/oekakids.c +++ b/src/input/oekakids.c @@ -36,7 +36,6 @@ static void FP_FASTAPASS(1) OK_Write(uint8 V) { if (!(V & 0x1)) { int32 vx, vy; - /* puts("Redo"); */ OKValR = OKData = 0; if (OKB) OKData |= 1; @@ -66,7 +65,6 @@ static void FP_FASTAPASS(1) OK_Write(uint8 V) { } static void FP_FASTAPASS(2) OK_Update(void *data, int arg) { - /* puts("Sync"); */ OKX = ((uint32*)data)[0]; OKY = ((uint32*)data)[1]; OKB = ((uint32*)data)[2]; diff --git a/src/input/quiz.c b/src/input/quiz.c index 6775828..77bbb4f 100644 --- a/src/input/quiz.c +++ b/src/input/quiz.c @@ -26,18 +26,10 @@ static uint8 FunkyMode; static uint8 FP_FASTAPASS(2) QZ_Read(int w, uint8 ret) { if (w) { - /* if(X.PC==0xdc7d) return(0xFF); - printf("Blah: %04x\n",X.PC); - FCEUI_DumpMem("dmp2",0xc000,0xffff); - */ - ret |= (QZValR & 0x7) << 2; QZValR = QZValR >> 3; if (FunkyMode) { - /*ret=0x14; - puts("Funky"); - */ QZValR |= 0x28; } else { QZValR |= 0x38; @@ -48,11 +40,9 @@ static uint8 FP_FASTAPASS(2) QZ_Read(int w, uint8 ret) { static void QZ_Strobe(void) { QZValR = QZVal; - /* puts("Strobe"); */ } static void FP_FASTAPASS(1) QZ_Write(uint8 V) { - /* printf("Wr: %02x\n",V); */ FunkyMode = V & 4; } diff --git a/src/ntsc/nes_ntsc_impl.h b/src/ntsc/nes_ntsc_impl.h index de3672b..43e45bb 100644 --- a/src/ntsc/nes_ntsc_impl.h +++ b/src/ntsc/nes_ntsc_impl.h @@ -159,15 +159,6 @@ static void init_filters( init_t* impl, nes_ntsc_setup_t const* setup ) } } - /* - printf( "luma:\n" ); - for ( i = kernel_size; i < kernel_size * 2; i++ ) - printf( "%f\n", kernels [i] ); - printf( "chroma:\n" ); - for ( i = 0; i < kernel_size; i++ ) - printf( "%f\n", kernels [i] ); - */ - /* generate linear rescale kernels */ #if rescale_out > 1 { diff --git a/src/ops.h b/src/ops.h index 20253c5..db8e9f2 100644 --- a/src/ops.h +++ b/src/ops.h @@ -322,12 +322,6 @@ case 0x50: JR(!(_P&V_FLAG)); break; /* BVS */ case 0x70: JR(_P&V_FLAG); break; -/* default: printf("Bad %02x at $%04x\n",b1,X.PC);break; */ -/* ifdef moo */ -/* Here comes the undocumented instructions block. Note that this implementation - may be "wrong". If so, please tell me. -*/ - /* AAC */ case 0x2B: case 0x0B: LD_IM(AND;_P&=~C_FLAG;_P|=_A>>7); diff --git a/src/palettes/conv.c b/src/palettes/conv.c deleted file mode 100644 index f712879..0000000 --- a/src/palettes/conv.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Quick conversion stuff for MAME->FCE Ultra */ - -#include -#include "../fceu-types.h" -#include "../palette.h" -#include "palettes.h" - -/* check 0x08 */ -static uint8 rp2c04001_colortable[] = -{ - 0x35, 0x23, 0x16, 0x22, 0x1c, 0x09, 0xff, 0x15, /* 0x00 - 0x07 */ - 0x20, 0x00, 0x27, 0x05, 0x04, 0x27, 0x08, 0x30, /* 0x08 - 0x0f */ - 0x21, 0xff, 0xff, 0x29, 0x3c, 0x32, 0x36, 0x12, /* 0x10 - 0x17 */ - 0xff, 0x2b, 0x0f, 0xff, 0x20, 0x10, 0x24, 0x01, /* 0x18 - 0x1f */ - 0xff, 0x31, 0xff, 0x2a, 0x2c, 0x0c, 0xff, 0xff, /* 0x20 - 0x27 */ - 0xff, 0x07, 0x34, 0x06, 0x13, 0x02, 0x26, 0x0f, /* 0x28 - 0x2f */ - 0xff, 0x19, 0x10, 0x0a, 0x39, 0xff, 0x37, 0x17, /* 0x30 - 0x37 */ - 0xff, 0x11, 0x09, 0xff, 0x39, 0x25, 0x18, 0xff /* 0x38 - 0x3f */ -}; - -/* RP2C04-002 */ -static uint8 rp2c04002_colortable[] = -{ - 0x0f, 0x27, 0x18, 0xff, 0x3a, 0x25, 0xff, 0x31, /* 0x00 - 0x07 */ - 0x16, 0x13, 0x38, 0x34, 0x20, 0x23, 0xff, 0x0b, /* 0x08 - 0x0f */ - 0xff, 0x21, 0x06, 0xff, 0x1b, 0x29, 0xff, 0x22, /* 0x10 - 0x17 */ - 0xff, 0x24, 0xff, 0x2b, 0xff, 0x08, 0xff, 0x03, /* 0x18 - 0x1f */ - 0xff, 0x36, 0x26, 0x33, 0x11, 0xff, 0x10, 0x02, /* 0x20 - 0x27 */ - 0x14, 0xff, 0x00, 0x09, 0x12, 0x0f, 0x37, 0x30, /* 0x28 - 0x2f */ - 0xff, 0xff, 0x2a, 0x17, 0x0c, 0x01, 0x15, 0x19, /* 0x30 - 0x37 */ - 0xff, 0x2c, 0x07, 0x37, 0xff, 0x05, 0x0a, 0x00 /* 0x38 - 0x3f */ -}; - -/* RP2C04-003 */ -/* Check 0x00. Used in Dr Mario. */ -static uint8 rp2c04003_colortable[] = -{ - 0x03, 0xff, 0xff, 0x00, 0x1a, 0x30, 0x31, 0x09, /* 0x00 - 0x07 */ - 0x01, 0x0f, 0x36, 0x08, 0x15, 0xff, 0xff, 0x30, /* 0x08 - 0x0f */ - 0x22, 0x1c, 0xff, 0x12, 0x19, 0x18, 0x17, 0x1b, /* 0x10 - 0x17 */ - 0x00, 0xff, 0xff, 0x02, 0x16, 0x06, 0xff, 0x35, /* 0x18 - 0x1f */ - 0x23, 0xff, 0x0f, 0x37, 0xff, 0x27, 0x26, 0x30, /* 0x20 - 0x27 */ - 0x29, 0xff, 0x21, 0x24, 0x11, 0xff, 0x0f, 0xff, /* 0x28 - 0x2f */ - 0x2c, 0xff, 0xff, 0xff, 0x07, 0x2a, 0x28, 0xff, /* 0x30 - 0x37 */ - 0x0a, 0xff, 0x32, 0x37, 0x13, 0xff, 0xff, 0x0c /* 0x38 - 0x3f */ -}; - -/* RP2C05-004 */ -/* check 0x1d, 0x38 */ -static uint8 rp2c05004_colortable[] = -{ - 0x18, 0xff, 0x1c, 0x28, 0xff, 0xff, 0x01, 0x17, /* 0x00 - 0x07 */ - 0x10, 0x0f, 0x2a, 0x0f, 0x36, 0x37, 0x1a, 0xff, /* 0x08 - 0x0f */ - 0x25, 0xff, 0x12, 0xff, 0x0f, 0xff, 0xff, 0x26, /* 0x10 - 0x17 */ - 0xff, 0xff, 0x22, 0x19, 0xff, 0x0f, 0x3a, 0x21, /* 0x18 - 0x1f */ - 0x05, 0x0a, 0x07, 0x01, 0x13, 0xff, 0x00, 0x15, /* 0x20 - 0x27 */ - 0x0c, 0xff, 0x11, 0xff, 0xff, 0x38, 0xff, 0xff, /* 0x28 - 0x2f */ - 0xff, 0xff, 0x08, 0x16, 0xff, 0xff, 0x30, 0x3c, /* 0x30 - 0x37 */ - 0x0f, 0x27, 0xff, 0x31, 0x29, 0xff, 0x30, 0x09 /* 0x38 - 0x3f */ -}; - - -void main(void) -{ - int x; - for (x = 0; x < 64; x++) - printf("{0x%02x, 0x%02x, 0x%02x},\n", palette[rp2c04001_colortable[x] & 0x3F].r, - palette[rp2c04001_colortable[x] & 0x3F].g, - palette[rp2c04001_colortable[x] & 0x3F].b); -} diff --git a/src/sound.c b/src/sound.c index cc58117..f802b0d 100644 --- a/src/sound.c +++ b/src/sound.c @@ -187,7 +187,6 @@ static void SQReload(int x, uint8 V) { } static DECLFW(Write_PSG) { -/* FCEU_printf("APU1 %04x:%04x\n",A,V); */ A &= 0x1F; switch (A) { case 0x0: @@ -271,7 +270,6 @@ static DECLFW(Write_PSG) { } static DECLFW(Write_DMCRegs) { -/* FCEU_printf("APU1 %04x:%04x\n",A,V); */ A &= 0xF; switch (A) { @@ -306,7 +304,6 @@ static DECLFW(Write_DMCRegs) { static DECLFW(StatusWrite) { int x; -/* FCEU_printf("APU1 %04x:%04x\n",A,V); */ DoSQ1(); DoSQ2(); @@ -552,7 +549,6 @@ static INLINE void RDoSQ(int x) { amp = EnvUnits[x].Speed; else amp = EnvUnits[x].decvolume; - /* printf("%d\n",amp); */ /* Modify Square wave volume based on channel volume modifiers * Note: the formulat x = x * y /100 does not yield exact results,