diff --git a/mednafen/MemoryStream.cpp b/mednafen/MemoryStream.cpp index 188fa4c..7c593ba 100644 --- a/mednafen/MemoryStream.cpp +++ b/mednafen/MemoryStream.cpp @@ -1,5 +1,11 @@ -#include "MemoryStream.h" #include +#include "MemoryStream.h" + +#ifdef _XBOX +#ifndef SIZE_MAX +#define SIZE_MAX _UI32_MAX +#endif +#endif /* TODO: diff --git a/mednafen/cdrom/pcecd.cpp b/mednafen/cdrom/pcecd.cpp index d48619f..9354164 100644 --- a/mednafen/cdrom/pcecd.cpp +++ b/mednafen/cdrom/pcecd.cpp @@ -106,7 +106,7 @@ static int32 lastts; static int32 scsicd_ne = 0; // ADPCM variables and whatnot -#define ADPCM_DEBUG(x, ...) { /*printf("[Half=%d, End=%d, Playing=%d] "x, ADPCM.HalfReached, ADPCM.EndReached, ADPCM.Playing, ## __VA_ARGS__);*/ } +//#define ADPCM_DEBUG(x, ...) { /*printf("[Half=%d, End=%d, Playing=%d] "x, ADPCM.HalfReached, ADPCM.EndReached, ADPCM.Playing, ## __VA_ARGS__);*/ } typedef Blip_Synth ADSynth; static ADSynth ADPCMSynth; @@ -607,7 +607,7 @@ uint8 PCECD_Read(uint32 timestamp, uint32 A, int32 &next_event, const bool PeekM case 0xa: if(!PeekMode) { - ADPCM_DEBUG("ReadBuffer\n"); + //ADPCM_DEBUG("ReadBuffer\n"); ADPCM.ReadPending = 19 * 3; //24 * 3; } @@ -744,12 +744,12 @@ int32 PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data) ADPCM.Addr &= 0xFF00; ADPCM.Addr |= V; - ADPCM_DEBUG("SAL: %02x, %d\n", V, timestamp); + //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_DEBUG("Set length(crazy way L): %04x\n", ADPCM.Addr); ADPCM.LengthCount = ADPCM.Addr; } break; @@ -761,12 +761,12 @@ int32 PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data) ADPCM.Addr &= 0x00FF; ADPCM.Addr |= V << 8; - ADPCM_DEBUG("SAH: %02x, %d\n", V, timestamp); + //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_DEBUG("Set length(crazy way H): %04x\n", ADPCM.Addr); ADPCM.LengthCount = ADPCM.Addr; } break; @@ -778,7 +778,7 @@ int32 PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data) break; case 0xb: // adpcm dma - ADPCM_DEBUG("DMA: %02x\n", V); + //ADPCM_DEBUG("DMA: %02x\n", V); _Port[0xb] = data; break; @@ -786,7 +786,7 @@ int32 PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data) break; case 0xd: - ADPCM_DEBUG("Write180D: %02x\n", V); + //ADPCM_DEBUG("Write180D: %02x\n", V); if(data & 0x80) { ADPCM.Addr = 0; @@ -824,7 +824,7 @@ int32 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_DEBUG("Set length: %04x\n", ADPCM.Addr); ADPCM.LengthCount = ADPCM.Addr; ADPCM.EndReached = false; } @@ -837,7 +837,7 @@ int32 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); + //ADPCM_DEBUG("Set ReadAddr: %04x, %06x\n", ADPCM.Addr, ADPCM.ReadAddr); } // D0 and D1 control write address @@ -846,7 +846,7 @@ int32 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_DEBUG("Set WriteAddr: %04x, %06x\n", ADPCM.Addr, ADPCM.WriteAddr); } ADPCM.LastCmd = data; UpdateADPCMIRQState(); @@ -858,7 +858,7 @@ int32 PCECD_Write(uint32 timestamp, uint32 physAddr, uint8 data) ADPCM.SampleFreq = freq; - ADPCM_DEBUG("Freq: %02x\n", freq); + //ADPCM_DEBUG("Freq: %02x\n", freq); } break; diff --git a/mednafen/cdrom/scsicd-pce-commands.inc b/mednafen/cdrom/scsicd-pce-commands.inc index 8593e7c..6174ef9 100644 --- a/mednafen/cdrom/scsicd-pce-commands.inc +++ b/mednafen/cdrom/scsicd-pce-commands.inc @@ -10,7 +10,8 @@ static void DoNEC_PCE_SAPSP(const uint8 *cdb) //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: SCSIDBG("Unknown SAPSP 9: %02x\n", cdb[9]); + default: + //SCSIDBG("Unknown SAPSP 9: %02x\n", cdb[9]); case 0x00: new_read_sec_start = (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; break; @@ -86,8 +87,8 @@ static void DoNEC_PCE_SAPEP(const uint8 *cdb) switch (cdb[9] & 0xc0) { - default: SCSIDBG("Unknown SAPEP 9: %02x\n", cdb[9]); - + default: + //SCSIDBG("Unknown SAPEP 9: %02x\n", cdb[9]); case 0x00: new_read_sec_end = (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; break; diff --git a/mednafen/cdrom/scsicd.cpp b/mednafen/cdrom/scsicd.cpp index 9eca304..6e0c479 100644 --- a/mednafen/cdrom/scsicd.cpp +++ b/mednafen/cdrom/scsicd.cpp @@ -23,7 +23,7 @@ #include "cdromif.h" #include "SimpleFIFO.h" -#define SCSIDBG(format, ...) { printf("SCSI: " format "\n", ## __VA_ARGS__); } +//#define SCSIDBG(format, ...) { printf("SCSI: " format "\n", ## __VA_ARGS__); } //#define SCSIDBG(format, ...) { } using namespace CDUtility; @@ -304,11 +304,13 @@ static void GenSubQFromSubPW(void) // printf("%02x ", SubQBuf[i]); //printf("\n"); +#if 0 if(!subq_check_checksum(SubQBuf)) { SCSIDBG("SubQ checksum error!"); } else +#endif { memcpy(cd.SubQBuf_Last, SubQBuf, 0xC); @@ -1153,7 +1155,7 @@ static void DoMODESENSE6(const uint8 *cdb) uint8 PageMatchOR = 0x00; bool AnyPageMatch = false; - SCSIDBG("Mode sense 6: %02x %d %d %d\n", PageCode, PC, DBD, AllocSize); + //SCSIDBG("Mode sense 6: %02x %d %d %d\n", PageCode, PC, DBD, AllocSize); if(!AllocSize) { @@ -1256,14 +1258,14 @@ static void DoSTARTSTOPUNIT6(const uint8 *cdb) bool LoEj = cdb[4] & 0x02; bool Start = cdb[4] & 0x01; - SCSIDBG("Do start stop unit 6: %d %d %d\n", Immed, LoEj, Start); + //SCSIDBG("Do start stop unit 6: %d %d %d\n", Immed, LoEj, Start); SendStatusAndMessage(STATUS_GOOD, 0x00); } static void DoREZEROUNIT(const uint8 *cdb) { - SCSIDBG("Rezero Unit: %02x\n", cdb[5]); + //SCSIDBG("Rezero Unit: %02x\n", cdb[5]); SendStatusAndMessage(STATUS_GOOD, 0x00); } @@ -2163,12 +2165,14 @@ static void DoREADBase(uint32 sa, uint32 sc) return; } +#if 0 if(SCSILog) { int Track = toc.FindTrackByLBA(sa); uint32 Offset = sa - toc.tracks[Track].lba; //Cur_CDIF->GetTrackStartPositionLBA(Track); SCSILog("SCSI", "Read: start=0x%08x(track=%d, offs=0x%08x), cnt=0x%08x", sa, Track, Offset, sc); } +#endif SectorAddr = sa; SectorCount = sc; @@ -2201,7 +2205,7 @@ static void DoREAD6(const uint8 *cdb) // TODO: confirm real PCE does this(PC-FX does at least). if(!sc) { - SCSIDBG("READ(6) with count == 0.\n"); + //SCSIDBG("READ(6) with count == 0.\n"); sc = 256; } @@ -2508,7 +2512,7 @@ static void DoNEC_SCAN(const uint8 *cdb) switch (cdb[9] & 0xc0) { default: - SCSIDBG("Unknown NECSCAN format"); + //SCSIDBG("Unknown NECSCAN format"); break; case 0x00: @@ -2963,6 +2967,7 @@ uint32 SCSICD_Run(scsicd_timestamp_t system_timestamp) while(cmd_info_ptr->pretty_name && cmd_info_ptr->cmd != cd.command_buffer[0]) cmd_info_ptr++; +#if 0 if(SCSILog) { char log_buffer[1024]; @@ -2976,28 +2981,33 @@ uint32 SCSICD_Run(scsicd_timestamp_t system_timestamp) for(int i = 0; i < RequiredCDBLen[cd.command_buffer[0] >> 4]; i++) lb_pos += trio_snprintf(log_buffer + lb_pos, 1024 - lb_pos, "%02x ", cd.command_buffer[i]); - SCSILog("SCSI", "%s", log_buffer); + //SCSILog("SCSI", "%s", log_buffer); //puts(log_buffer); } +#endif if(cmd_info_ptr->pretty_name == NULL) // Command not found! { CommandCCError(SENSEKEY_ILLEGAL_REQUEST, NSE_INVALID_COMMAND); - SCSIDBG("Bad Command: %02x\n", cd.command_buffer[0]); + //SCSIDBG("Bad Command: %02x\n", cd.command_buffer[0]); +#if 0 if(SCSILog) SCSILog("SCSI", "Bad Command: %02x", cd.command_buffer[0]); +#endif cd.command_buffer_pos = 0; } else { +#if 0 if(cmd_info_ptr->flags & SCF_UNTESTED) { SCSIDBG("Untested SCSI command: %02x, %s", cd.command_buffer[0], cmd_info_ptr->pretty_name); } +#endif if(cd.TrayOpen && (cmd_info_ptr->flags & SCF_REQUIRES_MEDIUM)) { diff --git a/mednafen/hw_cpu/huc6280/ops.inc b/mednafen/hw_cpu/huc6280/ops.inc index c02310d..f058325 100644 --- a/mednafen/hw_cpu/huc6280/ops.inc +++ b/mednafen/hw_cpu/huc6280/ops.inc @@ -219,29 +219,36 @@ case 0x82: OP_CLEARR(X); // CLX case 0xC2: OP_CLEARR(Y); // CLY // The optional argument(s) will run at the end, immediately before the break. -#define OP_CLEARF(f, ...) { ADDCYC(1); LASTCYCLE; P &= ~f; __VA_ARGS__ break; } -#define OP_SETF(f, ...) { ADDCYC(1); LASTCYCLE; P |= f; __VA_ARGS__ break; } +//#define OP_CLEARF(f, ...) { ADDCYC(1); LASTCYCLE; P &= ~f; __VA_ARGS__ break; } +//#define OP_SETF(f, ...) { ADDCYC(1); LASTCYCLE; P |= f; __VA_ARGS__ break; } case 0x18: /* CLC */ - OP_CLEARF(C_FLAG); + //OP_CLEARF(C_FLAG); +{ ADDCYC(1); LASTCYCLE; P &= ~C_FLAG; break; } case 0xD8: /* CLD */ - OP_CLEARF(D_FLAG); + //OP_CLEARF(D_FLAG); + { ADDCYC(1); LASTCYCLE; P &= ~D_FLAG; break; } case 0x58: /* CLI */ - OP_CLEARF(I_FLAG, REDOPIMCACHE();); + //OP_CLEARF(I_FLAG, REDOPIMCACHE();); + { ADDCYC(1); LASTCYCLE; P &= ~I_FLAG; REDOPIMCACHE(); break; } case 0xB8: /* CLV */ - OP_CLEARF(V_FLAG); + //OP_CLEARF(V_FLAG); + { ADDCYC(1); LASTCYCLE; P &= ~V_FLAG; break; } case 0x38: /* SEC */ - OP_SETF(C_FLAG); + //OP_SETF(C_FLAG); + { ADDCYC(1); LASTCYCLE; P |= C_FLAG; break; } case 0xF8: /* SED */ - OP_SETF(D_FLAG); + //OP_SETF(D_FLAG); + { ADDCYC(1); LASTCYCLE; P |= D_FLAG; break; } case 0x78: /* SEI */ - OP_SETF(I_FLAG, REDOPIMCACHE();); + //OP_SETF(I_FLAG, REDOPIMCACHE();); + { ADDCYC(1); LASTCYCLE; P |= I_FLAG; REDOPIMCACHE(); break; } case 0xF4: /* SET */ //puts("SET"); diff --git a/mednafen/hw_sound/pce_psg/pce_psg.cpp b/mednafen/hw_sound/pce_psg/pce_psg.cpp index 502ee06..66a17a9 100644 --- a/mednafen/hw_sound/pce_psg/pce_psg.cpp +++ b/mednafen/hw_sound/pce_psg/pce_psg.cpp @@ -373,7 +373,7 @@ PCE_PSG::PCE_PSG(Blip_Buffer *bb_l, Blip_Buffer *bb_r, int want_revision) double flub = 1; if(vl) - flub /= pow(2, (double)1 / 4 * vl); // ~1.5dB reduction per increment of vl + flub /= powf(2, (double)1 / 4 * vl); // ~1.5dB reduction per increment of vl if(vl == 0x1F) flub = 0; diff --git a/mednafen/hw_video/huc6270/vdc_video.cpp b/mednafen/hw_video/huc6270/vdc_video.cpp index 196693d..9577a2a 100644 --- a/mednafen/hw_video/huc6270/vdc_video.cpp +++ b/mednafen/hw_video/huc6270/vdc_video.cpp @@ -25,13 +25,13 @@ #include #include "vdc.h" -#define VDC_DEBUG(x, ...) { } +//#define VDC_DEBUG(x, ...) { } //#define VDC_DEBUG(x, ...) printf(x ": HPhase=%d, HPhaseCounter=%d, RCRCount=%d\n", ## __VA_ARGS__, HPhase, HPhaseCounter, RCRCount); -#define VDC_UNDEFINED(format, ...) { } +//#define VDC_UNDEFINED(format, ...) { } //#define VDC_UNDEFINED(format, ...) printf(format " RCRCount=%d" "\n", ## __VA_ARGS__, RCRCount) -#define VDC_WARNING(format, ...) { } +//#define VDC_WARNING(format, ...) { } //#define VDC_WARNING(format, ...) { printf(format "\n", ## __VA_ARGS__); } #define ULE_BG 1 @@ -301,7 +301,7 @@ void VDC::RunSATDMA(int32 cycles, bool force_completion) { if(DCR & 0x01) { - VDC_DEBUG("Sprite DMA IRQ"); + //VDC_DEBUG("Sprite DMA IRQ"); status |= VDCS_DS; IRQHook(TRUE); } @@ -331,8 +331,10 @@ void VDC::RunDMA(int32 cycles, bool force_completion) { if(!DMAReadWrite) { +#if 0 if(SOUR >= VRAM_Size) VDC_UNDEFINED("Unmapped VRAM DMA read"); +#endif DMAReadBuffer = VRAM[SOUR]; //printf("DMA Read: %04x, %04x\n", SOUR, DMAReadBuffer); @@ -359,7 +361,7 @@ void VDC::RunDMA(int32 cycles, bool force_completion) { status |= VDCS_DV; IRQHook(TRUE); - VDC_DEBUG("DMA IRQ"); + //VDC_DEBUG("DMA IRQ"); } break; } @@ -444,7 +446,7 @@ void VDC::IncRCR(void) if((int)RCRCount == ((int)RCR - 0x40) && (CR & 0x04)) { - VDC_DEBUG("RCR IRQ"); + //VDC_DEBUG("RCR IRQ"); status |= VDCS_RR; IRQHook(TRUE); } @@ -454,7 +456,7 @@ void VDC::DoVBIRQTest(void) { if(CR & 0x08) { - VDC_DEBUG("VBlank IRQ"); + //VDC_DEBUG("VBlank IRQ"); status |= VDCS_VD; IRQHook(TRUE); } @@ -495,7 +497,7 @@ void VDC::HDS_Start(void) if(sprite_cg_fetch_counter > 0) { - VDC_WARNING("Sprite truncation on %d. Wanted sprites: %d, cycles needed but not left: %d\n", RCRCount, active_sprites, sprite_cg_fetch_counter); + //VDC_WARNING("Sprite truncation on %d. Wanted sprites: %d, cycles needed but not left: %d\n", RCRCount, active_sprites, sprite_cg_fetch_counter); sprite_cg_fetch_counter = 0; CheckAndCommitPending(); } @@ -505,7 +507,7 @@ void VDC::HDS_Start(void) HDW_cache = M_vdc_HDW; HDE_cache = M_vdc_HDE; - VDC_DEBUG("HDS Start! HSW: %d, HDW: %d, HDW: %d, HDE: %d\n", HSW_cache, HDS_cache, HDW_cache, HDE_cache); + //VDC_DEBUG("HDS Start! HSW: %d, HDW: %d, HDW: %d, HDE: %d\n", HSW_cache, HDS_cache, HDW_cache, HDE_cache); CR_cache = CR; @@ -636,8 +638,10 @@ int32 VDC::Run(int32 clocks, uint16 *pixels, bool skip) sat_dma_counter = 1024; +#if 0 if(DVSSR > (VRAM_Size - 0x100)) VDC_UNDEFINED("Unmapped VRAM DVSSR DMA read"); +#endif if(DVSSR < VRAM_Size) { @@ -655,7 +659,7 @@ int32 VDC::Run(int32 clocks, uint16 *pixels, bool skip) if(DMAPending && burst_mode) { - VDC_DEBUG("DMA Started"); + //VDC_DEBUG("DMA Started"); DMAPending = false; DMARunning = true; VDMA_CycleCounter = 0; @@ -880,8 +884,10 @@ void VDC::DrawBG(uint16 *target, int enabled) raw_pixel = bg_tile_cache[bat & 0xFFF][BG_YOffset & 7][BG_XOffset & 0x7] & dohmask; target[x] = palette_index | raw_pixel | pal_or; +#if 0 if((bat & 0xFFF) > VRAM_BGTileNoMask) VDC_UNDEFINED("Unmapped BG tile read"); +#endif BG_XOffset++; } @@ -897,8 +903,10 @@ void VDC::DrawBG(uint16 *target, int enabled) const uint8 pal_or = ((bat >> 8) & 0xF0); uint8 *pix_lut = bg_tile_cache[bat & 0xFFF][line_sub]; +#if 0 if((bat & 0xFFF) > VRAM_BGTileNoMask) VDC_UNDEFINED("Unmapped BG tile read"); +#endif (target + 0)[x] = (pix_lut[0] & dohmask) | pal_or; @@ -923,8 +931,10 @@ void VDC::DrawBG(uint16 *target, int enabled) const uint8 pal_or = ((bat >> 8) & 0xF0); uint8 *pix_lut = bg_tile_cache[bat & 0xFFF][line_sub]; +#if 0 if((bat & 0xFFF) > VRAM_BGTileNoMask) VDC_UNDEFINED("Unmapped BG tile read"); +#endif #ifdef LSB_FIRST #if SIZEOF_LONG == 8 @@ -1020,7 +1030,7 @@ void VDC::FetchSpriteData(void) { status |= VDCS_OR; IRQHook(TRUE); - VDC_DEBUG("Overflow IRQ"); + //VDC_DEBUG("Overflow IRQ"); } if(!unlimited_sprites) break; @@ -1045,8 +1055,10 @@ void VDC::FetchSpriteData(void) SpriteList[active_sprites].x = x; SpriteList[active_sprites].palette_index = palette_index; +#if 0 if((no * 64) >= VRAM_Size) VDC_UNDEFINED("Unmapped VRAM sprite tile read"); +#endif if((MWR_cache & 0xC) == 4) { @@ -1137,7 +1149,7 @@ void VDC::DrawSprites(uint16 *target, int enabled) if(sprite_line_buf[tx] & 0xF) { status |= VDCS_CR; - VDC_DEBUG("Sprite hit IRQ"); + //VDC_DEBUG("Sprite hit IRQ"); IRQHook(TRUE); } sprite_line_buf[tx] = pi | raw_pixel | prio_or; @@ -1203,13 +1215,13 @@ void VDC::DoWaitStates(void) { if(DMARunning) { - VDC_WARNING("VRAM DMA completion forced."); + //VDC_WARNING("VRAM DMA completion forced."); RunDMA(0, TRUE); } if(sat_dma_counter > 0) { - VDC_WARNING("SAT DMA completion forced."); + //VDC_WARNING("SAT DMA completion forced."); RunSATDMA(0, TRUE); } @@ -1337,8 +1349,10 @@ void VDC::CheckAndCommitPending(void) if(pending_read) { +#if 0 if(pending_read_addr >= VRAM_Size) VDC_UNDEFINED("Unmapped VRAM VRR read"); +#endif read_buffer = VRAM[pending_read_addr]; pending_read = FALSE; @@ -1429,6 +1443,7 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) case 0x0d: VDC_REGSETP(VDR, V, msb); break; case 0x0e: VDC_REGSETP(VCR, V, msb); break; case 0x0f: VDC_REGSETP(DCR, V, msb); +#if 0 if(DMARunning) { VDC_UNDEFINED("Set DCR during DMA: %04x\n", DCR); @@ -1438,10 +1453,12 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) { VDC_UNDEFINED("Set DCR while DMAPending: %04x\n", DCR); } +#endif break; case 0x10: VDC_REGSETP(SOUR, V, msb); +#if 0 if(DMARunning) { VDC_UNDEFINED("Set SOUR during DMA: %04x\n", SOUR); @@ -1451,9 +1468,11 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) { VDC_UNDEFINED("Set SOUR while DMAPending: %04x\n", SOUR); } +#endif break; case 0x11: VDC_REGSETP(DESR, V, msb); +#if 0 if(DMARunning) { VDC_UNDEFINED("Set DESR during DMA: %04x\n", DESR); @@ -1462,9 +1481,11 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) { VDC_UNDEFINED("Set DESR while DMAPending: %04x\n", DESR); } +#endif break; case 0x12: VDC_REGSETP(LENR, V, msb); +#if 0 if(DMARunning) { VDC_UNDEFINED("Set LENR during DMA: %04x\n", LENR); @@ -1474,10 +1495,11 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) { VDC_UNDEFINED("Set LENR while DMAPending: %04x\n", LENR); } +#endif if(msb) { - VDC_DEBUG("DMA: %04x %04x %04x, %02x", SOUR, DESR, LENR, DCR); + //VDC_DEBUG("DMA: %04x %04x %04x, %02x", SOUR, DESR, LENR, DCR); DMAPending = 1; } break; @@ -1486,7 +1508,7 @@ void VDC::Write(uint32 A, uint8 V, int32 &next_event) SATBPending = 1; break; - default: VDC_WARNING("Unknown VDC register write: %04x %02x", select, V); + default: //VDC_WARNING("Unknown VDC register write: %04x %02x", select, V); break; } break; @@ -1553,6 +1575,7 @@ void VDC::Write16(bool A, uint16 V) case 0x0e: VCR = V; break; case 0x0f: DCR = V; +#if 0 if(DMARunning) { VDC_UNDEFINED("Set DCR during DMA: %04x\n", DCR); @@ -1562,10 +1585,12 @@ void VDC::Write16(bool A, uint16 V) { VDC_UNDEFINED("Set DCR while DMAPending: %04x\n", DCR); } +#endif break; case 0x10: SOUR = V; +#if 0 if(DMARunning) { VDC_UNDEFINED("Set SOUR during DMA: %04x\n", SOUR); @@ -1575,9 +1600,11 @@ void VDC::Write16(bool A, uint16 V) { VDC_UNDEFINED("Set SOUR while DMAPending: %04x\n", SOUR); } +#endif break; case 0x11: DESR = V; +#if 0 if(DMARunning) { VDC_UNDEFINED("Set DESR during DMA: %04x\n", DESR); @@ -1586,9 +1613,11 @@ void VDC::Write16(bool A, uint16 V) { VDC_UNDEFINED("Set DESR while DMAPending: %04x\n", DESR); } +#endif break; case 0x12: LENR = V; +#if 0 if(DMARunning) { VDC_UNDEFINED("Set LENR during DMA: %04x\n", LENR); @@ -1598,8 +1627,9 @@ void VDC::Write16(bool A, uint16 V) { VDC_UNDEFINED("Set LENR while DMAPending: %04x\n", LENR); } +#endif - VDC_DEBUG("DMA: %04x %04x %04x, %02x", SOUR, DESR, LENR, DCR); + //VDC_DEBUG("DMA: %04x %04x %04x, %02x", SOUR, DESR, LENR, DCR); DMAPending = 1; break; @@ -1608,7 +1638,7 @@ void VDC::Write16(bool A, uint16 V) SATBPending = 1; break; - default: VDC_WARNING("Oops 2: %04x %02x", select, V); + default: //VDC_WARNING("Oops 2: %04x %02x", select, V); break; } } diff --git a/mednafen/include/blip/Blip_Buffer.h b/mednafen/include/blip/Blip_Buffer.h index 1afe528..f021441 100644 --- a/mednafen/include/blip/Blip_Buffer.h +++ b/mednafen/include/blip/Blip_Buffer.h @@ -269,11 +269,7 @@ public: Silent_Blip_Buffer(); }; - #if defined (__GNUC__) || _MSC_VER >= 1100 - #define BLIP_RESTRICT __restrict - #else - #define BLIP_RESTRICT - #endif +#define BLIP_RESTRICT // Optimized reading from Blip_Buffer, for use in custom sample output diff --git a/mednafen/mednafen-types.h b/mednafen/mednafen-types.h index dad0269..2c84007 100644 --- a/mednafen/mednafen-types.h +++ b/mednafen/mednafen-types.h @@ -31,7 +31,7 @@ typedef uint64_t uint64; #elif defined(_MSC_VER) #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) - #define INLINE inline __forceinline + #define INLINE inline #define NO_INLINE #define MDFN_FASTCALL diff --git a/mednafen/mednafen.h b/mednafen/mednafen.h index 0aea965..c96e3fb 100644 --- a/mednafen/mednafen.h +++ b/mednafen/mednafen.h @@ -25,9 +25,6 @@ void MDFN_DispMessage(const char *format, ...); void MDFN_DebugPrintReal(const char *file, const int line, const char *format, ...); -#define gettext_noop(format, ...) (format) -#define MDFN_DebugPrint(format, ...) MDFN_DebugPrintReal(__FILE__, __LINE__, format, ## __VA_ARGS__) - void MDFN_LoadGameCheats(void *override); void MDFN_FlushGameCheats(int nosave); diff --git a/mednafen/pce_fast/huc.cpp b/mednafen/pce_fast/huc.cpp index 03fd4d5..eccd013 100644 --- a/mednafen/pce_fast/huc.cpp +++ b/mednafen/pce_fast/huc.cpp @@ -260,9 +260,9 @@ int HuCLoadCD(const char *bios_path) { static const FileExtensionSpecStruct KnownBIOSExtensions[] = { - { ".pce", gettext_noop("PC Engine ROM Image") }, - { ".bin", gettext_noop("PC Engine ROM Image") }, - { ".bios", gettext_noop("BIOS Image") }, + { ".pce", "PC Engine ROM Image" }, + { ".bin", "PC Engine ROM Image" }, + { ".bios", "BIOS Image" }, { NULL, NULL } }; diff --git a/mednafen/pce_fast/pce.cpp b/mednafen/pce_fast/pce.cpp index f818314..f7d5800 100644 --- a/mednafen/pce_fast/pce.cpp +++ b/mednafen/pce_fast/pce.cpp @@ -624,22 +624,22 @@ static MDFNSetting PCESettings[] = { "pce_fast.input.port5", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, gettext_noop("Input device for input port 5."), NULL, MDFNST_STRING, "gamepad", NULL, NULL }, */ - { "pce_fast.correct_aspect", MDFNSF_CAT_VIDEO, gettext_noop("Correct the aspect ratio."), NULL, MDFNST_BOOL, "1" }, - { "pce_fast.slstart", MDFNSF_NOFLAGS, gettext_noop("First rendered scanline."), NULL, MDFNST_UINT, "4", "0", "239" }, - { "pce_fast.slend", MDFNSF_NOFLAGS, gettext_noop("Last rendered scanline."), NULL, MDFNST_UINT, "235", "0", "239" }, - { "pce_fast.mouse_sensitivity", MDFNSF_NOFLAGS, gettext_noop("Mouse sensitivity."), NULL, MDFNST_FLOAT, "0.50", NULL, NULL, NULL, PCEINPUT_SettingChanged }, - { "pce_fast.disable_softreset", MDFNSF_NOFLAGS, gettext_noop("If set, when RUN+SEL are pressed simultaneously, disable both buttons temporarily."), NULL, MDFNST_BOOL, "0", NULL, NULL, NULL, PCEINPUT_SettingChanged }, - { "pce_fast.forcesgx", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, gettext_noop("Force SuperGrafx emulation."), NULL, MDFNST_BOOL, "0" }, - { "pce_fast.arcadecard", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, gettext_noop("Enable Arcade Card emulation."), NULL, MDFNST_BOOL, "1" }, - { "pce_fast.ocmultiplier", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, gettext_noop("CPU overclock multiplier."), NULL, MDFNST_UINT, "1", "1", "100"}, - { "pce_fast.cdspeed", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, gettext_noop("CD-ROM data transfer speed multiplier."), NULL, MDFNST_UINT, "1", "1", "100" }, - { "pce_fast.nospritelimit", MDFNSF_NOFLAGS, gettext_noop("Remove 16-sprites-per-scanline hardware limit."), NULL, MDFNST_BOOL, "0" }, + { "pce_fast.correct_aspect", MDFNSF_CAT_VIDEO, "Correct the aspect ratio.", NULL, MDFNST_BOOL, "1" }, + { "pce_fast.slstart", MDFNSF_NOFLAGS, "First rendered scanline.", NULL, MDFNST_UINT, "4", "0", "239" }, + { "pce_fast.slend", MDFNSF_NOFLAGS, "Last rendered scanline.", NULL, MDFNST_UINT, "235", "0", "239" }, + { "pce_fast.mouse_sensitivity", MDFNSF_NOFLAGS, "Mouse sensitivity.", NULL, MDFNST_FLOAT, "0.50", NULL, NULL, NULL, PCEINPUT_SettingChanged }, + { "pce_fast.disable_softreset", MDFNSF_NOFLAGS, "If set, when RUN+SEL are pressed simultaneously, disable both buttons temporarily.", NULL, MDFNST_BOOL, "0", NULL, NULL, NULL, PCEINPUT_SettingChanged }, + { "pce_fast.forcesgx", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Force SuperGrafx emulation.", NULL, MDFNST_BOOL, "0" }, + { "pce_fast.arcadecard", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Enable Arcade Card emulation.", NULL, MDFNST_BOOL, "1" }, + { "pce_fast.ocmultiplier", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "CPU overclock multiplier.", NULL, MDFNST_UINT, "1", "1", "100"}, + { "pce_fast.cdspeed", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "CD-ROM data transfer speed multiplier.", NULL, MDFNST_UINT, "1", "1", "100" }, + { "pce_fast.nospritelimit", MDFNSF_NOFLAGS, "Remove 16-sprites-per-scanline hardware limit.", NULL, MDFNST_BOOL, "0" }, - { "pce_fast.cdbios", MDFNSF_EMU_STATE, gettext_noop("Path to the CD BIOS"), NULL, MDFNST_STRING, "syscard3.pce" }, - { "pce_fast.adpcmlp", MDFNSF_NOFLAGS, gettext_noop("Enable lowpass filter dependent on playback-frequency."), NULL, MDFNST_BOOL, "0" }, - { "pce_fast.cdpsgvolume", MDFNSF_NOFLAGS, gettext_noop("PSG volume when playing a CD game."), NULL, MDFNST_UINT, "100", "0", "200" }, - { "pce_fast.cddavolume", MDFNSF_NOFLAGS, gettext_noop("CD-DA volume."), NULL, MDFNST_UINT, "100", "0", "200" }, - { "pce_fast.adpcmvolume", MDFNSF_NOFLAGS, gettext_noop("ADPCM volume."), NULL, MDFNST_UINT, "100", "0", "200" }, + { "pce_fast.cdbios", MDFNSF_EMU_STATE, "Path to the CD BIOS", NULL, MDFNST_STRING, "syscard3.pce" }, + { "pce_fast.adpcmlp", MDFNSF_NOFLAGS, "Enable lowpass filter dependent on playback-frequency.", NULL, MDFNST_BOOL, "0" }, + { "pce_fast.cdpsgvolume", MDFNSF_NOFLAGS, "PSG volume when playing a CD game.", NULL, MDFNST_UINT, "100", "0", "200" }, + { "pce_fast.cddavolume", MDFNSF_NOFLAGS, "CD-DA volume.", NULL, MDFNST_UINT, "100", "0", "200" }, + { "pce_fast.adpcmvolume", MDFNSF_NOFLAGS, "ADPCM volume.", NULL, MDFNST_UINT, "100", "0", "200" }, { NULL } }; @@ -650,9 +650,9 @@ static uint8 MemRead(uint32 addr) static const FileExtensionSpecStruct KnownExtensions[] = { - { ".pce", gettext_noop("PC Engine ROM Image") }, - { ".hes", gettext_noop("PC Engine Music Rip") }, - { ".sgx", gettext_noop("SuperGrafx ROM Image") }, + { ".pce", "PC Engine ROM Image" }, + { ".hes", "PC Engine Music Rip" }, + { ".sgx", "SuperGrafx ROM Image" }, { NULL, NULL } }; diff --git a/msvc/pce-fast/msvc-2003-xbox1.sln b/msvc/pce-fast/msvc-2003-xbox1.sln new file mode 100644 index 0000000..d1db1f3 --- /dev/null +++ b/msvc/pce-fast/msvc-2003-xbox1.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-2003-xbox1", "msvc-2003-xbox1/msvc-2003-xbox1.vcproj", "{8FD514E6-2E2A-4599-99B1-9A413535492F}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Profile = Profile + Profile_FastCap = Profile_FastCap + Release = Release + Release_LTCG = Release_LTCG + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Debug.ActiveCfg = Debug|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Debug.Build.0 = Debug|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Profile.ActiveCfg = Profile|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Profile.Build.0 = Profile|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Profile_FastCap.ActiveCfg = Profile_FastCap|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Profile_FastCap.Build.0 = Profile_FastCap|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Release.ActiveCfg = Release|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Release.Build.0 = Release|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Release_LTCG.ActiveCfg = Release_LTCG|Xbox + {8FD514E6-2E2A-4599-99B1-9A413535492F}.Release_LTCG.Build.0 = Release_LTCG|Xbox + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/msvc/pce-fast/msvc-2003-xbox1/msvc-2003-xbox1.vcproj b/msvc/pce-fast/msvc-2003-xbox1/msvc-2003-xbox1.vcproj new file mode 100644 index 0000000..46c5553 --- /dev/null +++ b/msvc/pce-fast/msvc-2003-xbox1/msvc-2003-xbox1.vcproj @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/pce-fast/msvc-2003-xbox1/stdint.h b/msvc/pce-fast/msvc-2003-xbox1/stdint.h new file mode 100644 index 0000000..9d8fe7b --- /dev/null +++ b/msvc/pce-fast/msvc-2003-xbox1/stdint.h @@ -0,0 +1,249 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// +#ifndef __RARCH_STDINT_H +#define __RARCH_STDINT_H + +#if _MSC_VER && (_MSC_VER < 1600) +//pre-MSVC 2010 needs an implementation of stdint.h + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + +#else +//sanity for everything else +#include +#endif + +#endif