From 3da55ff81c34c5eb4d66517d7eac9d6de768d202 Mon Sep 17 00:00:00 2001 From: Rupert Carmichael <5050061-carmiker@users.noreply.gitlab.com> Date: Tue, 4 Mar 2025 19:59:01 -0500 Subject: [PATCH] core: Fix narrowing --- source/core/NstApu.cpp | 142 +++++++++--------- source/core/NstCartridgeUnif.cpp | 8 +- source/core/NstCpu.cpp | 34 ++--- source/core/NstFds.cpp | 60 ++++---- source/core/NstPpu.cpp | 22 +-- source/core/NstStream.cpp | 28 ++-- source/core/NstVideoRenderer.cpp | 1 - source/core/api/NstApiCheats.cpp | 16 +- source/core/board/NstBoardAcclaimMcAcc.cpp | 8 +- source/core/board/NstBoardBandai24c0x.cpp | 12 +- source/core/board/NstBoardBandaiLz93d50.cpp | 10 +- source/core/board/NstBoardBandaiLz93d50ex.cpp | 8 +- source/core/board/NstBoardBmcCtc65.cpp | 2 +- source/core/board/NstBoardBmcFk23c.cpp | 2 +- source/core/board/NstBoardBmcGamestarA.cpp | 6 +- source/core/board/NstBoardBmcHero.cpp | 10 +- .../core/board/NstBoardBmcMarioParty7in1.cpp | 4 +- source/core/board/NstBoardBmcSuper24in1.cpp | 6 +- source/core/board/NstBoardBtlMarioBaby.cpp | 6 +- source/core/board/NstBoardBtlSmb2a.cpp | 4 +- source/core/board/NstBoardBtlSmb2b.cpp | 6 +- source/core/board/NstBoardBtlSmb2c.cpp | 4 +- source/core/board/NstBoardBtlSmb3.cpp | 6 +- source/core/board/NstBoardCony.cpp | 9 +- source/core/board/NstBoardFfe.cpp | 4 +- source/core/board/NstBoardFutureMedia.cpp | 6 +- source/core/board/NstBoardIremG101.cpp | 4 +- source/core/board/NstBoardIremH3001.cpp | 10 +- source/core/board/NstBoardJalecoSs88006.cpp | 12 +- source/core/board/NstBoardJyCompany.cpp | 78 +++++----- source/core/board/NstBoardKaiser.cpp | 10 +- source/core/board/NstBoardKasing.cpp | 4 +- source/core/board/NstBoardKayH2288.cpp | 4 +- source/core/board/NstBoardKayPandaPrince.cpp | 4 +- source/core/board/NstBoardKonamiVrc3.cpp | 4 +- source/core/board/NstBoardKonamiVrc4.cpp | 10 +- source/core/board/NstBoardKonamiVrc6.cpp | 14 +- source/core/board/NstBoardKonamiVrc7.cpp | 6 +- source/core/board/NstBoardMmc1.cpp | 4 +- source/core/board/NstBoardMmc2.cpp | 2 +- source/core/board/NstBoardMmc3.cpp | 14 +- source/core/board/NstBoardMmc5.cpp | 68 ++++----- source/core/board/NstBoardNamcot163.cpp | 6 +- source/core/board/NstBoardNanjing.cpp | 2 +- .../core/board/NstBoardSachenStreetHeroes.cpp | 4 +- source/core/board/NstBoardSunsoft3.cpp | 6 +- source/core/board/NstBoardSunsoft4.cpp | 6 +- source/core/board/NstBoardSunsoft5b.cpp | 20 +-- source/core/board/NstBoardSunsoftFme7.cpp | 6 +- .../core/board/NstBoardSuperGameLionKing.cpp | 4 +- .../board/NstBoardSuperGamePocahontas2.cpp | 6 +- source/core/board/NstBoardTaitoX1017.cpp | 2 +- source/core/board/NstBoardTengenRambo1.cpp | 12 +- source/core/board/NstBoardUnlA9746.cpp | 4 +- .../core/board/NstBoardUnlMmc3BigPrgRom.cpp | 8 +- source/core/board/NstBoardUnlN625092.cpp | 2 +- source/core/board/NstBoardUnlRetX7Gbl.cpp | 4 +- source/core/board/NstBoardUnlTf1201.cpp | 4 +- source/core/board/NstBoardWaixingFfv.cpp | 2 +- source/core/board/NstBoardWaixingFs304.cpp | 7 +- source/core/input/NstInpAdapter.cpp | 4 +- source/core/input/NstInpMouse.cpp | 2 +- source/core/input/NstInpPad.cpp | 2 +- source/core/input/NstInpPowerGlove.cpp | 4 +- source/core/input/NstInpRob.cpp | 10 +- source/core/input/NstInpTurboFile.cpp | 6 +- source/core/input/NstInpZapper.cpp | 4 +- 67 files changed, 410 insertions(+), 399 deletions(-) diff --git a/source/core/NstApu.cpp b/source/core/NstApu.cpp index ba6ddbb1..8d87787d 100644 --- a/source/core/NstApu.cpp +++ b/source/core/NstApu.cpp @@ -470,10 +470,10 @@ namespace Nes const byte data[4] = { - ctrl, - clock & 0xFF, - clock >> 8, - cycles.frameDivider + static_cast(ctrl), + static_cast(clock & 0xFF), + static_cast(clock >> 8), + static_cast(cycles.frameDivider) }; state.Begin( AsciiId<'F','R','M'>::V ).Write( data ).End(); @@ -494,9 +494,9 @@ namespace Nes const byte data[3] = { - clock & 0xFF, - clock >> 8, - cycles.frameIrqRepeat % 3 + static_cast(clock & 0xFF), + static_cast(clock >> 8), + static_cast(cycles.frameIrqRepeat % 3) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); @@ -532,10 +532,10 @@ namespace Nes { const byte data[4] = { - cycles.rateCounter & 0xFFU, - cycles.rateCounter >> 8, - cycles.rateCounter >> 16, - cycles.rateCounter >> 24, + static_cast(cycles.rateCounter & 0xFFU), + static_cast(cycles.rateCounter >> 8), + static_cast(cycles.rateCounter >> 16), + static_cast(cycles.rateCounter >> 24), }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); @@ -1065,7 +1065,7 @@ namespace Nes const byte data[3] = { count, - regs[0] | (reset ? 0x80U : 0x00U), + static_cast(regs[0] | (reset ? 0x80U : 0x00U)), regs[1] }; @@ -1158,18 +1158,18 @@ namespace Nes { const byte data[12] = { - acc & 0xFFU, - acc >> 8, - acc >> 16, - acc >> 24, - prev & 0xFFU, - prev >> 8, - prev >> 16, - prev >> 24, - next & 0xFFU, - next >> 8, - next >> 16, - next >> 24, + static_cast(acc & 0xFFU), + static_cast(acc >> 8), + static_cast(acc >> 16), + static_cast(acc >> 24), + static_cast(prev & 0xFFU), + static_cast(prev >> 8), + static_cast(prev >> 16), + static_cast(prev >> 24), + static_cast(next & 0xFFU), + static_cast(next >> 8), + static_cast(next >> 16), + static_cast(next >> 24), }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); @@ -1380,19 +1380,19 @@ namespace Nes { const byte data[13] = { - step, - timer & 0xFFU, - timer >> 8, - timer >> 16, - timer >> 24, - frequency & 0xFFU, - frequency >> 8, - frequency >> 16, - frequency >> 24, - amp & 0xFFU, - amp >> 8, - amp >> 16, - amp >> 24, + static_cast(step), + static_cast(timer & 0xFFU), + static_cast(timer >> 8), + static_cast(timer >> 16), + static_cast(timer >> 24), + static_cast(frequency & 0xFFU), + static_cast(frequency >> 8), + static_cast(frequency >> 16), + static_cast(frequency >> 24), + static_cast(amp & 0xFFU), + static_cast(amp >> 8), + static_cast(amp >> 16), + static_cast(amp >> 24), }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); @@ -1682,10 +1682,10 @@ namespace Nes { const byte data[4] = { - waveLength & 0xFFU, - waveLength >> 8, - linearCounter | (uint(status) << 7), - linearCtrl + static_cast(waveLength & 0xFFU), + static_cast(waveLength >> 8), + static_cast(linearCounter | (uint(status) << 7)), + static_cast(linearCtrl) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); @@ -1696,15 +1696,15 @@ namespace Nes { const byte data[9] = { - step, - timer & 0xFFU, - timer >> 8, - timer >> 16, - timer >> 24, - amp & 0xFFU, - amp >> 8, - amp >> 16, - amp >> 24, + static_cast(step), + static_cast(timer & 0xFFU), + static_cast(timer >> 8), + static_cast(timer >> 16), + static_cast(timer >> 24), + static_cast(amp & 0xFFU), + static_cast(amp >> 8), + static_cast(amp >> 16), + static_cast(amp >> 24), }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); @@ -1925,12 +1925,12 @@ namespace Nes { const byte data[6] = { - bits & 0xFFU, - bits >> 8, - timer & 0xFFU, - timer >> 8, - timer >> 16, - timer >> 24 + static_cast(bits & 0xFFU), + static_cast(bits >> 8), + static_cast(timer & 0xFFU), + static_cast(timer >> 8), + static_cast(timer >> 16), + static_cast(timer >> 24) }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); @@ -2147,21 +2147,21 @@ namespace Nes { const byte data[12] = { - dmcClock & 0xFF, - dmcClock >> 8, - ( + static_cast(dmcClock & 0xFF), + static_cast(dmcClock >> 8), + static_cast(( ( ( regs.ctrl & REG0_FREQUENCY ) ) | ( ( regs.ctrl & REG0_LOOP ) ? 0x10U : 0U ) | ( ( regs.ctrl & REG0_IRQ_ENABLE ) ? 0x20U : 0U ) | ( ( dma.lengthCounter ) ? 0x40U : 0U ) - ), - (regs.address - 0xC000U) >> 6, - (regs.lengthCounter - 1U) >> 4, - (dma.address >> 0 & 0xFFU), - (dma.address >> 8 & 0x7FU) | (dma.buffered ? 0x80 : 0x00), - dma.lengthCounter ? (dma.lengthCounter - 1U) >> 4 : 0, - dma.buffer, - 7 - out.shifter, + )), + static_cast((regs.address - 0xC000U) >> 6), + static_cast((regs.lengthCounter - 1U) >> 4), + static_cast((dma.address >> 0 & 0xFFU)), + static_cast((dma.address >> 8 & 0x7FU) | (dma.buffered ? 0x80 : 0x00)), + static_cast(dma.lengthCounter ? (dma.lengthCounter - 1U) >> 4 : 0), + static_cast(dma.buffer), + static_cast(7 - out.shifter), out.buffer, out.dac, }; @@ -2172,10 +2172,10 @@ namespace Nes { const byte data[4] = { - linSample & 0xFFU, - linSample >> 8, - dma.lengthCounter & 0xFFU, - dma.lengthCounter >> 8, + static_cast(linSample & 0xFFU), + static_cast(linSample >> 8), + static_cast(dma.lengthCounter & 0xFFU), + static_cast(dma.lengthCounter >> 8), }; state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End(); diff --git a/source/core/NstCartridgeUnif.cpp b/source/core/NstCartridgeUnif.cpp index 96b0f756..00c366e3 100644 --- a/source/core/NstCartridgeUnif.cpp +++ b/source/core/NstCartridgeUnif.cpp @@ -738,10 +738,10 @@ namespace Nes { const byte bytes[] = { - id >> 0 & 0xFF, - id >> 8 & 0xFF, - id >> 16 & 0xFF, - id >> 24 & 0xFF, + static_cast(id >> 0 & 0xFF), + static_cast(id >> 8 & 0xFF), + static_cast(id >> 16 & 0xFF), + static_cast(id >> 24 & 0xFF), 0 }; diff --git a/source/core/NstCpu.cpp b/source/core/NstCpu.cpp index 5e0f288b..28c41ce2 100644 --- a/source/core/NstCpu.cpp +++ b/source/core/NstCpu.cpp @@ -343,13 +343,13 @@ namespace Nes { const byte data[7] = { - pc & 0xFF, - pc >> 8, - sp, - a, - x, - y, - flags.Pack() + static_cast(pc & 0xFF), + static_cast(pc >> 8), + static_cast(sp), + static_cast(a), + static_cast(x), + static_cast(y), + static_cast(flags.Pack()) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); @@ -360,16 +360,16 @@ namespace Nes { const byte data[5] = { - ((interrupt.nmiClock != CYCLE_MAX) ? 0x01U : 0x00U) | - ((interrupt.low & IRQ_FRAME) ? 0x02U : 0x00U) | - ((interrupt.low & IRQ_DMC) ? 0x04U : 0x00U) | - ((interrupt.low & IRQ_EXT) ? 0x08U : 0x00U) | - (jammed ? 0x40U : 0x00U) | - (model == CPU_RP2A07 ? 0x80U : model == CPU_DENDY ? 0x20U : 0x00U), - cycles.count & 0xFF, - cycles.count >> 8, - (interrupt.nmiClock != CYCLE_MAX) ? interrupt.nmiClock+1 : 0, - (interrupt.irqClock != CYCLE_MAX) ? interrupt.irqClock+1 : 0 + static_cast(((interrupt.nmiClock != CYCLE_MAX) ? 0x01U : 0x00U) | + ((interrupt.low & IRQ_FRAME) ? 0x02U : 0x00U) | + ((interrupt.low & IRQ_DMC) ? 0x04U : 0x00U) | + ((interrupt.low & IRQ_EXT) ? 0x08U : 0x00U) | + (jammed ? 0x40U : 0x00U) | + (model == CPU_RP2A07 ? 0x80U : model == CPU_DENDY ? 0x20U : 0x00U)), + static_cast(cycles.count & 0xFF), + static_cast(cycles.count >> 8), + static_cast((interrupt.nmiClock != CYCLE_MAX) ? interrupt.nmiClock+1 : 0), + static_cast((interrupt.irqClock != CYCLE_MAX) ? interrupt.irqClock+1 : 0) }; state.Begin( AsciiId<'F','R','M'>::V ).Write( data ).End(); diff --git a/source/core/NstFds.cpp b/source/core/NstFds.cpp index ccbebd3a..8efb171c 100644 --- a/source/core/NstFds.cpp +++ b/source/core/NstFds.cpp @@ -487,10 +487,10 @@ namespace Nes { const byte data[4] = { - disks.sides.count, - (disks.current != Disks::EJECTED) | (disks.writeProtected ? 0x2U : 0x0U), - disks.current != Disks::EJECTED ? disks.current : 0xFF, - disks.current != Disks::EJECTED ? disks.mounting : 0 + static_cast(disks.sides.count), + static_cast((disks.current != Disks::EJECTED) | (disks.writeProtected ? 0x2U : 0x0U)), + static_cast(disks.current != Disks::EJECTED ? disks.current : 0xFF), + static_cast(disks.current != Disks::EJECTED ? disks.mounting : 0) }; state.Begin( AsciiId<'D','S','K'>::V ).Write( data ).End(); @@ -1255,12 +1255,12 @@ namespace Nes { const byte data[7] = { - unit.timer.ctrl, - unit.status, - unit.timer.latch & 0xFFU, - unit.timer.latch >> 8, - unit.timer.count & 0xFFU, - unit.timer.count >> 8, + static_cast(unit.timer.ctrl), + static_cast(unit.status), + static_cast(unit.timer.latch & 0xFFU), + static_cast(unit.timer.latch >> 8), + static_cast(unit.timer.count & 0xFFU), + static_cast(unit.timer.count >> 8), 0 }; @@ -1274,20 +1274,20 @@ namespace Nes { unit.drive.ctrl, unit.drive.status, - unit.drive.in & 0xFFU, + static_cast(unit.drive.in & 0xFFU), unit.drive.out, - unit.drive.count ? headPos & 0xFF : 0, - unit.drive.count ? headPos >> 8 : 0, - unit.drive.count ? unit.drive.dataPos & 0xFFU : 0, - unit.drive.count ? unit.drive.dataPos >> 8 : 0, - unit.drive.count ? unit.drive.gap & 0xFFU : 0, - unit.drive.count ? unit.drive.gap >> 8 : 0, - unit.drive.count ? unit.drive.length & 0xFFU : 0, - unit.drive.count ? unit.drive.length >> 8 : 0, - unit.drive.count >> 0 & 0xFF, - unit.drive.count >> 8 & 0xFF, - unit.drive.count >> 16, - unit.drive.in >> 8 + static_cast(unit.drive.count ? headPos & 0xFF : 0), + static_cast(unit.drive.count ? headPos >> 8 : 0), + static_cast(unit.drive.count ? unit.drive.dataPos & 0xFFU : 0), + static_cast(unit.drive.count ? unit.drive.dataPos >> 8 : 0), + static_cast(unit.drive.count ? unit.drive.gap & 0xFFU : 0), + static_cast(unit.drive.count ? unit.drive.gap >> 8 : 0), + static_cast(unit.drive.count ? unit.drive.length & 0xFFU : 0), + static_cast(unit.drive.count ? unit.drive.length >> 8 : 0), + static_cast(unit.drive.count >> 0 & 0xFF), + static_cast(unit.drive.count >> 8 & 0xFF), + static_cast(unit.drive.count >> 16), + static_cast(unit.drive.in >> 8) }; state.Begin( AsciiId<'D','R','V'>::V ).Write( data ).End(); @@ -1695,11 +1695,11 @@ namespace Nes { byte data[6] = { - ((status & STATUS_OUTPUT_ENABLED) ? 0U : uint(REG3_OUTPUT_DISABLE)) | - ((status & STATUS_ENVELOPES_ENABLED) ? 0U : uint(REG3_ENVELOPE_DISABLE)), - wave.writing ? REG9_WRITE_MODE : 0, - wave.length & 0xFFU, - wave.length >> 8, + static_cast(((status & STATUS_OUTPUT_ENABLED) ? 0U : uint(REG3_OUTPUT_DISABLE)) | + ((status & STATUS_ENVELOPES_ENABLED) ? 0U : uint(REG3_ENVELOPE_DISABLE))), + static_cast(wave.writing ? REG9_WRITE_MODE : 0), + static_cast(wave.length & 0xFFU), + static_cast(wave.length >> 8), envelopes.length, envelopes.counter }; @@ -1729,8 +1729,8 @@ namespace Nes { const byte data[4] = { - modulator.length & 0xFF, - modulator.length >> 8 | (modulator.writing ? REG7_MOD_WRITE_MODE : 0), + static_cast(modulator.length & 0xFF), + static_cast(modulator.length >> 8 | (modulator.writing ? REG7_MOD_WRITE_MODE : 0)), modulator.sweep, modulator.pos }; diff --git a/source/core/NstPpu.cpp b/source/core/NstPpu.cpp index 99f7b301..082bde87 100644 --- a/source/core/NstPpu.cpp +++ b/source/core/NstPpu.cpp @@ -312,17 +312,17 @@ namespace Nes { const byte data[11] = { - regs.ctrl[0], - regs.ctrl[1], - regs.status, - scroll.address & 0xFF, - scroll.address >> 8, - scroll.latch & 0xFF, - scroll.latch >> 8, - scroll.xFine | scroll.toggle << 3, - regs.oam, - io.buffer, - io.latch + static_cast(regs.ctrl[0]), + static_cast(regs.ctrl[1]), + static_cast(regs.status), + static_cast(scroll.address & 0xFF), + static_cast(scroll.address >> 8), + static_cast(scroll.latch & 0xFF), + static_cast(scroll.latch >> 8), + static_cast(scroll.xFine | scroll.toggle << 3), + static_cast(regs.oam), + static_cast(io.buffer), + static_cast(io.latch) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); diff --git a/source/core/NstStream.cpp b/source/core/NstStream.cpp index b7e7207e..da64c067 100644 --- a/source/core/NstStream.cpp +++ b/source/core/NstStream.cpp @@ -314,8 +314,8 @@ namespace Nes const byte d[2] = { - data >> 0 & 0xFF, - data >> 8 & 0xFF + static_cast(data >> 0 & 0xFF), + static_cast(data >> 8 & 0xFF) }; Write( d, 2 ); @@ -327,10 +327,10 @@ namespace Nes const byte d[4] = { - data >> 0 & 0xFF, - data >> 8 & 0xFF, - data >> 16 & 0xFF, - data >> 24 & 0xFF + static_cast(data >> 0 & 0xFF), + static_cast(data >> 8 & 0xFF), + static_cast(data >> 16 & 0xFF), + static_cast(data >> 24 & 0xFF) }; Write( d, 4 ); @@ -340,14 +340,14 @@ namespace Nes { const byte d[8] = { - data >> 0 & 0xFF, - data >> 8 & 0xFF, - data >> 16 & 0xFF, - data >> 24 & 0xFF, - data >> 32 & 0xFF, - data >> 40 & 0xFF, - data >> 48 & 0xFF, - data >> 56 & 0xFF + static_cast(data >> 0 & 0xFF), + static_cast(data >> 8 & 0xFF), + static_cast(data >> 16 & 0xFF), + static_cast(data >> 24 & 0xFF), + static_cast(data >> 32 & 0xFF), + static_cast(data >> 40 & 0xFF), + static_cast(data >> 48 & 0xFF), + static_cast(data >> 56 & 0xFF) }; Write( d, 8 ); diff --git a/source/core/NstVideoRenderer.cpp b/source/core/NstVideoRenderer.cpp index d1d1d92b..e55d2643 100644 --- a/source/core/NstVideoRenderer.cpp +++ b/source/core/NstVideoRenderer.cpp @@ -28,7 +28,6 @@ #include "NstCore.hpp" #include "NstAssert.hpp" #include "NstFpuPrecision.hpp" -#include "api/NstApiVideo.hpp" #include "NstVideoRenderer.hpp" #include "NstVideoFilterNone.hpp" diff --git a/source/core/api/NstApiCheats.cpp b/source/core/api/NstApiCheats.cpp index 7bd56766..e7a402b5 100644 --- a/source/core/api/NstApiCheats.cpp +++ b/source/core/api/NstApiCheats.cpp @@ -43,14 +43,14 @@ namespace Nes const byte codes[8] = { - (code.value >> 0 & 0x7U) | (code.value >> 4 & 0x8U), - (code.value >> 4 & 0x7U) | (code.address >> 4 & 0x8U), - (code.address >> 4 & 0x7U) | (code.useCompare ? 0x8U : 0x0U), - (code.address >> 12 & 0x7U) | (code.address >> 0 & 0x8U), - (code.address >> 0 & 0x7U) | (code.address >> 8 & 0x8U), - (code.address >> 8 & 0x7U) | ((code.useCompare ? code.compare : code.value) & 0x8U), - (code.useCompare ? ((code.compare >> 0 & 0x7U) | (code.compare >> 4 & 0x8U)) : 0), - (code.useCompare ? ((code.compare >> 4 & 0x7U) | (code.value >> 0 & 0x8U)) : 0) + static_cast((code.value >> 0 & 0x7U) | (code.value >> 4 & 0x8U)), + static_cast((code.value >> 4 & 0x7U) | (code.address >> 4 & 0x8U)), + static_cast((code.address >> 4 & 0x7U) | (code.useCompare ? 0x8U : 0x0U)), + static_cast((code.address >> 12 & 0x7U) | (code.address >> 0 & 0x8U)), + static_cast((code.address >> 0 & 0x7U) | (code.address >> 8 & 0x8U)), + static_cast((code.address >> 8 & 0x7U) | ((code.useCompare ? code.compare : code.value) & 0x8U)), + static_cast((code.useCompare ? ((code.compare >> 0 & 0x7U) | (code.compare >> 4 & 0x8U)) : 0)), + static_cast((code.useCompare ? ((code.compare >> 4 & 0x7U) | (code.value >> 0 & 0x8U)) : 0)) }; uint i = (code.useCompare ? 8 : 6); diff --git a/source/core/board/NstBoardAcclaimMcAcc.cpp b/source/core/board/NstBoardAcclaimMcAcc.cpp index 3447d3ba..6c66c3ee 100644 --- a/source/core/board/NstBoardAcclaimMcAcc.cpp +++ b/source/core/board/NstBoardAcclaimMcAcc.cpp @@ -132,14 +132,14 @@ namespace Nes const byte data[12] = { - regs.ctrl0, - regs.ctrl1, + static_cast(regs.ctrl0), + static_cast(regs.ctrl1), banks.prg[0], banks.prg[1], 0x3E, 0x3F, - banks.chr[0] >> 1, - banks.chr[2] >> 1, + static_cast(banks.chr[0] >> 1), + static_cast(banks.chr[2] >> 1), banks.chr[4], banks.chr[5], banks.chr[6], diff --git a/source/core/board/NstBoardBandai24c0x.cpp b/source/core/board/NstBoardBandai24c0x.cpp index 016b7a7e..68bc2eb1 100644 --- a/source/core/board/NstBoardBandai24c0x.cpp +++ b/source/core/board/NstBoardBandai24c0x.cpp @@ -62,12 +62,12 @@ namespace Nes const byte data[6] = { - line.scl | line.sda, - uint(mode << 0) | uint(next << 4), - latch.address, - latch.data, - latch.bit, - output | (rw ? 0x80 : 0x00) + static_cast(line.scl | line.sda), + static_cast(uint(mode << 0) | uint(next << 4)), + static_cast(latch.address), + static_cast(latch.data), + static_cast(latch.bit), + static_cast(output | (rw ? 0x80 : 0x00)) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardBandaiLz93d50.cpp b/source/core/board/NstBoardBandaiLz93d50.cpp index 09fa1c91..a1f58f8c 100644 --- a/source/core/board/NstBoardBandaiLz93d50.cpp +++ b/source/core/board/NstBoardBandaiLz93d50.cpp @@ -155,11 +155,11 @@ namespace Nes const byte data[5] = { - irq.Connected() ? 0x1 : 0x0, - irq.unit.latch >> 0 & 0xFF, - irq.unit.latch >> 8 & 0xFF, - irq.unit.count >> 0 & 0xFF, - irq.unit.count >> 8 & 0xFF + static_cast(irq.Connected() ? 0x1 : 0x0), + static_cast(irq.unit.latch >> 0 & 0xFF), + static_cast(irq.unit.latch >> 8 & 0xFF), + static_cast(irq.unit.count >> 0 & 0xFF), + static_cast(irq.unit.count >> 8 & 0xFF) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardBandaiLz93d50ex.cpp b/source/core/board/NstBoardBandaiLz93d50ex.cpp index e11d19ac..cbe94594 100644 --- a/source/core/board/NstBoardBandaiLz93d50ex.cpp +++ b/source/core/board/NstBoardBandaiLz93d50ex.cpp @@ -90,8 +90,8 @@ namespace Nes { const File::LoadBlock block[] = { - { x24c02 ? x24c02->GetData() : NULL, x24c02 ? X24C02::SIZE : 0 }, - { x24c01 ? x24c01->GetData() : NULL, x24c01 ? X24C01::SIZE : 0 } + { x24c02 ? x24c02->GetData() : NULL, static_cast(x24c02 ? X24C02::SIZE : 0) }, + { x24c01 ? x24c01->GetData() : NULL, static_cast(x24c01 ? X24C01::SIZE : 0) } }; file.Load( File::EEPROM, block ); @@ -101,8 +101,8 @@ namespace Nes { const File::SaveBlock block[] = { - { x24c02 ? x24c02->GetData() : NULL, x24c02 ? X24C02::SIZE : 0 }, - { x24c01 ? x24c01->GetData() : NULL, x24c01 ? X24C01::SIZE : 0 } + { x24c02 ? x24c02->GetData() : NULL, static_cast(x24c02 ? X24C02::SIZE : 0) }, + { x24c01 ? x24c01->GetData() : NULL, static_cast(x24c01 ? X24C01::SIZE : 0) } }; file.Save( File::EEPROM, block ); diff --git a/source/core/board/NstBoardBmcCtc65.cpp b/source/core/board/NstBoardBmcCtc65.cpp index 2d9822d6..e318b249 100644 --- a/source/core/board/NstBoardBmcCtc65.cpp +++ b/source/core/board/NstBoardBmcCtc65.cpp @@ -76,7 +76,7 @@ namespace Nes void Ctc65::SubSave(State::Saver& state) const { - const byte data[2] = {regs[0],regs[1]}; + const byte data[2] = { static_cast(regs[0]), static_cast(regs[1]) }; state.Begin( AsciiId<'B','C','T'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); } diff --git a/source/core/board/NstBoardBmcFk23c.cpp b/source/core/board/NstBoardBmcFk23c.cpp index 58f495a8..a80b9635 100644 --- a/source/core/board/NstBoardBmcFk23c.cpp +++ b/source/core/board/NstBoardBmcFk23c.cpp @@ -272,7 +272,7 @@ namespace Nes exRegs[5], exRegs[6], exRegs[7], - unromChr | (cartSwitches ? cartSwitches->GetMode() << 2 : 0) + static_cast(unromChr | (cartSwitches ? cartSwitches->GetMode() << 2 : 0)) }; state.Begin( AsciiId<'B','F','K'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBmcGamestarA.cpp b/source/core/board/NstBoardBmcGamestarA.cpp index e1395051..1126cd48 100644 --- a/source/core/board/NstBoardBmcGamestarA.cpp +++ b/source/core/board/NstBoardBmcGamestarA.cpp @@ -207,9 +207,9 @@ namespace Nes { const byte data[3] = { - cartSwitches ? cartSwitches->GetMode() : 0, - regs[0], - regs[1] + static_cast(cartSwitches ? cartSwitches->GetMode() : 0), + static_cast(regs[0]), + static_cast(regs[1]) }; state.Begin( AsciiId<'B','G','A'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBmcHero.cpp b/source/core/board/NstBoardBmcHero.cpp index ed502100..deb71d0f 100644 --- a/source/core/board/NstBoardBmcHero.cpp +++ b/source/core/board/NstBoardBmcHero.cpp @@ -80,11 +80,11 @@ namespace Nes const byte data[5] = { - exRegs[0], - exRegs[1], - exRegs[2], - exRegs[3], - exRegs[4] + static_cast(exRegs[0]), + static_cast(exRegs[1]), + static_cast(exRegs[2]), + static_cast(exRegs[3]), + static_cast(exRegs[4]) }; state.Begin( AsciiId<'B','H','R'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBmcMarioParty7in1.cpp b/source/core/board/NstBoardBmcMarioParty7in1.cpp index 821066a4..854f696f 100644 --- a/source/core/board/NstBoardBmcMarioParty7in1.cpp +++ b/source/core/board/NstBoardBmcMarioParty7in1.cpp @@ -80,8 +80,8 @@ namespace Nes const byte data[2] = { - exRegs[0], - exRegs[1] + static_cast(exRegs[0]), + static_cast(exRegs[1]) }; state.Begin( AsciiId<'B','M','P'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBmcSuper24in1.cpp b/source/core/board/NstBoardBmcSuper24in1.cpp index 3625c622..4bd25d10 100644 --- a/source/core/board/NstBoardBmcSuper24in1.cpp +++ b/source/core/board/NstBoardBmcSuper24in1.cpp @@ -84,9 +84,9 @@ namespace Nes const byte data[3] = { - exRegs[0], - exRegs[1], - exRegs[2] + static_cast(exRegs[0]), + static_cast(exRegs[1]), + static_cast(exRegs[2]) }; state.Begin( AsciiId<'B','2','4'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBtlMarioBaby.cpp b/source/core/board/NstBoardBtlMarioBaby.cpp index 493eed43..fd9beedf 100644 --- a/source/core/board/NstBoardBtlMarioBaby.cpp +++ b/source/core/board/NstBoardBtlMarioBaby.cpp @@ -90,9 +90,9 @@ namespace Nes { const byte data[3] = { - irq.Connected() ? 0x1 : 0x0, - irq.unit.count >> 0 & 0xFF, - irq.unit.count >> 8 & 0x7F + static_cast(irq.Connected() ? 0x1 : 0x0), + static_cast(irq.unit.count >> 0 & 0xFF), + static_cast(irq.unit.count >> 8 & 0x7F) }; state.Begin( AsciiId<'B','M','B'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBtlSmb2a.cpp b/source/core/board/NstBoardBtlSmb2a.cpp index cc0f4724..89c36eb1 100644 --- a/source/core/board/NstBoardBtlSmb2a.cpp +++ b/source/core/board/NstBoardBtlSmb2a.cpp @@ -83,8 +83,8 @@ namespace Nes const byte data[3] = { irq.unit.enabled != 0, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'B','2','A'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBtlSmb2b.cpp b/source/core/board/NstBoardBtlSmb2b.cpp index 539e2153..0498a548 100644 --- a/source/core/board/NstBoardBtlSmb2b.cpp +++ b/source/core/board/NstBoardBtlSmb2b.cpp @@ -88,9 +88,9 @@ namespace Nes { const byte data[3] = { - irq.Connected() ? 0x1 : 0x0, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.Connected() ? 0x1 : 0x0), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'S','2','B'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBtlSmb2c.cpp b/source/core/board/NstBoardBtlSmb2c.cpp index 10eeffbf..a1439471 100644 --- a/source/core/board/NstBoardBtlSmb2c.cpp +++ b/source/core/board/NstBoardBtlSmb2c.cpp @@ -85,8 +85,8 @@ namespace Nes const byte data[3] = { irq.unit.enabled != 0, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'B','2','C'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardBtlSmb3.cpp b/source/core/board/NstBoardBtlSmb3.cpp index 85bf423a..61306023 100644 --- a/source/core/board/NstBoardBtlSmb3.cpp +++ b/source/core/board/NstBoardBtlSmb3.cpp @@ -94,9 +94,9 @@ namespace Nes { const byte data[3] = { - irq.unit.enabled ? 0x1 : 0x0, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.unit.enabled ? 0x1 : 0x0), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'B','S','3'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardCony.cpp b/source/core/board/NstBoardCony.cpp index 2dd075e1..667672b0 100644 --- a/source/core/board/NstBoardCony.cpp +++ b/source/core/board/NstBoardCony.cpp @@ -251,7 +251,7 @@ namespace Nes { const byte data[1+5] = { - regs.ctrl, + static_cast(regs.ctrl), regs.prg[0], regs.prg[1], regs.prg[2], @@ -267,10 +267,9 @@ namespace Nes { const byte data[3] = { - (irq.unit.enabled ? 0x1U : 0x0U) | - (irq.unit.step == 1 ? 0x0U : 0x2U), - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast((irq.unit.enabled ? 0x1U : 0x0U) | (irq.unit.step == 1 ? 0x0U : 0x2U)), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardFfe.cpp b/source/core/board/NstBoardFfe.cpp index b4771d65..b923f8b8 100644 --- a/source/core/board/NstBoardFfe.cpp +++ b/source/core/board/NstBoardFfe.cpp @@ -169,8 +169,8 @@ namespace Nes const byte data[3] = { irq->unit.enabled != false, - irq->unit.count & 0xFF, - irq->unit.count >> 8 + static_cast(irq->unit.count & 0xFF), + static_cast(irq->unit.count >> 8) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardFutureMedia.cpp b/source/core/board/NstBoardFutureMedia.cpp index 6a5392ad..c8ee7ba7 100644 --- a/source/core/board/NstBoardFutureMedia.cpp +++ b/source/core/board/NstBoardFutureMedia.cpp @@ -98,9 +98,9 @@ namespace Nes { const byte data[3] = { - irq.unit.enabled ? 0x1 : 0x0, - irq.unit.latch, - irq.unit.count + static_cast(irq.unit.enabled ? 0x1 : 0x0), + static_cast(irq.unit.latch), + static_cast(irq.unit.count) }; state.Begin( AsciiId<'F','D','A'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardIremG101.cpp b/source/core/board/NstBoardIremG101.cpp index fbe0f5f4..67d3139f 100644 --- a/source/core/board/NstBoardIremG101.cpp +++ b/source/core/board/NstBoardIremG101.cpp @@ -89,8 +89,8 @@ namespace Nes { const byte data[2] = { - regs[0], - regs[1] + static_cast(regs[0]), + static_cast(regs[1]) }; state.Begin( AsciiId<'I','G','1'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardIremH3001.cpp b/source/core/board/NstBoardIremH3001.cpp index e7912e0c..5e535038 100644 --- a/source/core/board/NstBoardIremH3001.cpp +++ b/source/core/board/NstBoardIremH3001.cpp @@ -100,11 +100,11 @@ namespace Nes { const byte data[5] = { - irq.unit.enabled ? 0x1 : 0x0, - irq.unit.latch & 0xFF, - irq.unit.latch >> 8, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.unit.enabled ? 0x1 : 0x0), + static_cast(irq.unit.latch & 0xFF), + static_cast(irq.unit.latch >> 8), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'I','H','3'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardJalecoSs88006.cpp b/source/core/board/NstBoardJalecoSs88006.cpp index df310644..ff778c33 100644 --- a/source/core/board/NstBoardJalecoSs88006.cpp +++ b/source/core/board/NstBoardJalecoSs88006.cpp @@ -168,17 +168,17 @@ namespace Nes const byte data[5] = { - (irq.Connected() ? 0x1U : 0x0U) | + static_cast((irq.Connected() ? 0x1U : 0x0U) | ( irq.unit.mask == 0x000F ? 0x8U : irq.unit.mask == 0x00FF ? 0x4U : irq.unit.mask == 0x0FFF ? 0x2U : 0x0U - ), - irq.unit.latch & 0xFF, - irq.unit.latch >> 8, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + )), + static_cast(irq.unit.latch & 0xFF), + static_cast(irq.unit.latch >> 8), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardJyCompany.cpp b/source/core/board/NstBoardJyCompany.cpp index f7f91e1e..302d1611 100644 --- a/source/core/board/NstBoardJyCompany.cpp +++ b/source/core/board/NstBoardJyCompany.cpp @@ -272,41 +272,41 @@ namespace Nes { const byte data[35] = { - regs.ctrl[0], - regs.ctrl[1], - regs.ctrl[2], - regs.ctrl[3], - regs.mul[0], - regs.mul[1], - regs.tmp, - banks.prg[0], - banks.prg[1], - banks.prg[2], - banks.prg[3], - banks.chr[0] & 0xFF, - banks.chr[0] >> 8, - banks.chr[1] & 0xFF, - banks.chr[1] >> 8, - banks.chr[2] & 0xFF, - banks.chr[2] >> 8, - banks.chr[3] & 0xFF, - banks.chr[3] >> 8, - banks.chr[4] & 0xFF, - banks.chr[4] >> 8, - banks.chr[5] & 0xFF, - banks.chr[5] >> 8, - banks.chr[6] & 0xFF, - banks.chr[6] >> 8, - banks.chr[7] & 0xFF, - banks.chr[7] >> 8, - banks.nmt[0] & 0xFF, - banks.nmt[0] >> 8, - banks.nmt[1] & 0xFF, - banks.nmt[1] >> 8, - banks.nmt[2] & 0xFF, - banks.nmt[2] >> 8, - banks.nmt[3] & 0xFF, - banks.nmt[3] >> 8 + static_cast(regs.ctrl[0]), + static_cast(regs.ctrl[1]), + static_cast(regs.ctrl[2]), + static_cast(regs.ctrl[3]), + static_cast(regs.mul[0]), + static_cast(regs.mul[1]), + static_cast(regs.tmp), + static_cast(banks.prg[0]), + static_cast(banks.prg[1]), + static_cast(banks.prg[2]), + static_cast(banks.prg[3]), + static_cast(banks.chr[0] & 0xFF), + static_cast(banks.chr[0] >> 8), + static_cast(banks.chr[1] & 0xFF), + static_cast(banks.chr[1] >> 8), + static_cast(banks.chr[2] & 0xFF), + static_cast(banks.chr[2] >> 8), + static_cast(banks.chr[3] & 0xFF), + static_cast(banks.chr[3] >> 8), + static_cast(banks.chr[4] & 0xFF), + static_cast(banks.chr[4] >> 8), + static_cast(banks.chr[5] & 0xFF), + static_cast(banks.chr[5] >> 8), + static_cast(banks.chr[6] & 0xFF), + static_cast(banks.chr[6] >> 8), + static_cast(banks.chr[7] & 0xFF), + static_cast(banks.chr[7] >> 8), + static_cast(banks.nmt[0] & 0xFF), + static_cast(banks.nmt[0] >> 8), + static_cast(banks.nmt[1] & 0xFF), + static_cast(banks.nmt[1] >> 8), + static_cast(banks.nmt[2] & 0xFF), + static_cast(banks.nmt[2] >> 8), + static_cast(banks.nmt[3] & 0xFF), + static_cast(banks.nmt[3] >> 8) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); @@ -319,10 +319,10 @@ namespace Nes const byte data[5] = { irq.enabled != 0, - irq.mode, - irq.prescaler & 0xFF, - irq.count, - irq.flip + static_cast(irq.mode), + static_cast(irq.prescaler & 0xFF), + static_cast(irq.count), + static_cast(irq.flip) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardKaiser.cpp b/source/core/board/NstBoardKaiser.cpp index e48ff179..bd074d1b 100644 --- a/source/core/board/NstBoardKaiser.cpp +++ b/source/core/board/NstBoardKaiser.cpp @@ -353,11 +353,11 @@ namespace Nes const byte data[5] = { - irq.unit.ctrl, - irq.unit.count & 0xFF, - irq.unit.count >> 8, - irq.unit.latch & 0xFF, - irq.unit.latch >> 8 + static_cast(irq.unit.ctrl), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8), + static_cast(irq.unit.latch & 0xFF), + static_cast(irq.unit.latch >> 8) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardKasing.cpp b/source/core/board/NstBoardKasing.cpp index e942a6f7..6671064c 100644 --- a/source/core/board/NstBoardKasing.cpp +++ b/source/core/board/NstBoardKasing.cpp @@ -77,8 +77,8 @@ namespace Nes const byte data[2] = { - exRegs[0], - exRegs[1] + static_cast(exRegs[0]), + static_cast(exRegs[1]) }; state.Begin( AsciiId<'K','A','S'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardKayH2288.cpp b/source/core/board/NstBoardKayH2288.cpp index 1dc60a33..349166c2 100644 --- a/source/core/board/NstBoardKayH2288.cpp +++ b/source/core/board/NstBoardKayH2288.cpp @@ -84,8 +84,8 @@ namespace Nes const byte data[2] = { - exRegs[0], - exRegs[1] + static_cast(exRegs[0]), + static_cast(exRegs[1]) }; state.Begin( AsciiId<'K','H','2'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardKayPandaPrince.cpp b/source/core/board/NstBoardKayPandaPrince.cpp index dab327d6..9b317b5c 100644 --- a/source/core/board/NstBoardKayPandaPrince.cpp +++ b/source/core/board/NstBoardKayPandaPrince.cpp @@ -80,7 +80,9 @@ namespace Nes const byte data[] = { - exRegs[0], exRegs[1], exRegs[2] + static_cast(exRegs[0]), + static_cast(exRegs[1]), + static_cast(exRegs[2]) }; state.Begin( AsciiId<'K','P','P'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardKonamiVrc3.cpp b/source/core/board/NstBoardKonamiVrc3.cpp index 4243208b..c90993f1 100644 --- a/source/core/board/NstBoardKonamiVrc3.cpp +++ b/source/core/board/NstBoardKonamiVrc3.cpp @@ -88,8 +88,8 @@ namespace Nes const byte data[3] = { irq.unit.enabled != 0, - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'K','V','3'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardKonamiVrc4.cpp b/source/core/board/NstBoardKonamiVrc4.cpp index 38d97b0e..de296080 100644 --- a/source/core/board/NstBoardKonamiVrc4.cpp +++ b/source/core/board/NstBoardKonamiVrc4.cpp @@ -165,11 +165,11 @@ namespace Nes { const byte data[5] = { - unit.ctrl | (Connected() ? BaseIrq::ENABLE_0 : 0), - unit.latch, - unit.count[0] & 0xFF, - unit.count[0] >> 8, - unit.count[1] + static_cast(unit.ctrl | (Connected() ? BaseIrq::ENABLE_0 : 0)), + static_cast(unit.latch), + static_cast(unit.count[0] & 0xFF), + static_cast(unit.count[0] >> 8), + static_cast(unit.count[1]) }; state.Begin( chunk ).Write( data ).End(); diff --git a/source/core/board/NstBoardKonamiVrc6.cpp b/source/core/board/NstBoardKonamiVrc6.cpp index e28d161c..a8a83dea 100644 --- a/source/core/board/NstBoardKonamiVrc6.cpp +++ b/source/core/board/NstBoardKonamiVrc6.cpp @@ -261,10 +261,10 @@ namespace Nes { const byte data[4] = { - (enabled ? 0x1U : 0x0U) | (digitized ? 0x2U : 0x0U), - waveLength & 0xFF, - waveLength >> 8, - (duty - 1) | ((volume / VOLUME) << 3) + static_cast((enabled ? 0x1U : 0x0U) | (digitized ? 0x2U : 0x0U)), + static_cast(waveLength & 0xFF), + static_cast(waveLength >> 8), + static_cast((duty - 1) | ((volume / VOLUME) << 3)) }; state.Begin( chunk ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); @@ -298,9 +298,9 @@ namespace Nes { const byte data[3] = { - (enabled != 0) | (phase << 1), - waveLength & 0xFF, - waveLength >> 8 + static_cast((enabled != 0) | (phase << 1)), + static_cast(waveLength & 0xFF), + static_cast(waveLength >> 8) }; state.Begin( chunk ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardKonamiVrc7.cpp b/source/core/board/NstBoardKonamiVrc7.cpp index 1c9d1d52..4b871c27 100644 --- a/source/core/board/NstBoardKonamiVrc7.cpp +++ b/source/core/board/NstBoardKonamiVrc7.cpp @@ -431,9 +431,9 @@ namespace Nes patch.custom[5], patch.custom[6], patch.custom[7], - frequency & REG8_FRQ_LO, - (frequency >> 8) | (block << 1) | (sustain ? REG9_SUSTAIN : 0) | (key ? REG9_KEY : 0), - (volume >> 2) | (patch.instrument << 4) + static_cast(frequency & REG8_FRQ_LO), + static_cast((frequency >> 8) | (block << 1) | (sustain ? REG9_SUSTAIN : 0) | (key ? REG9_KEY : 0)), + static_cast((volume >> 2) | (patch.instrument << 4)) }; state.Begin( chunk ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardMmc1.cpp b/source/core/board/NstBoardMmc1.cpp index a4ef0825..abd12acf 100644 --- a/source/core/board/NstBoardMmc1.cpp +++ b/source/core/board/NstBoardMmc1.cpp @@ -109,8 +109,8 @@ namespace Nes regs[1], regs[2], regs[3], - serial.buffer, - serial.shifter + static_cast(serial.buffer), + static_cast(serial.shifter) }; state.Begin( AsciiId<'M','M','1'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardMmc2.cpp b/source/core/board/NstBoardMmc2.cpp index 0d5fdb33..2ebcae97 100644 --- a/source/core/board/NstBoardMmc2.cpp +++ b/source/core/board/NstBoardMmc2.cpp @@ -91,7 +91,7 @@ namespace Nes banks[1], banks[2], banks[3], - selector[0] | (selector[1] - 2) << 1 + static_cast(selector[0] | (selector[1] - 2) << 1) }; state.Begin( AsciiId<'M','M','2'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardMmc3.cpp b/source/core/board/NstBoardMmc3.cpp index 5a6e0de0..0b872832 100644 --- a/source/core/board/NstBoardMmc3.cpp +++ b/source/core/board/NstBoardMmc3.cpp @@ -115,9 +115,9 @@ namespace Nes { const byte data[3] = { - (enabled ? 0x1U : 0x0U) | (reload ? 0x2U : 0x0U), - count, - latch + static_cast((enabled ? 0x1U : 0x0U) | (reload ? 0x2U : 0x0U)), + static_cast(count), + static_cast(latch) }; state.Begin( chunk ).Write( data ).End(); @@ -169,14 +169,14 @@ namespace Nes const byte data[12] = { - regs.ctrl0, - regs.ctrl1, + static_cast(regs.ctrl0), + static_cast(regs.ctrl1), banks.prg[0], banks.prg[1], 0x3E, 0x3F, - banks.chr[0] >> 1, - banks.chr[2] >> 1, + static_cast(banks.chr[0] >> 1), + static_cast(banks.chr[2] >> 1), banks.chr[4], banks.chr[5], banks.chr[6], diff --git a/source/core/board/NstBoardMmc5.cpp b/source/core/board/NstBoardMmc5.cpp index 474468c7..a64f6051 100644 --- a/source/core/board/NstBoardMmc5.cpp +++ b/source/core/board/NstBoardMmc5.cpp @@ -272,53 +272,53 @@ namespace Nes { const byte data[32] = { - regs.prgMode | (regs.chrMode << 2) | (regs.exRamMode << 4), + static_cast(regs.prgMode | (regs.chrMode << 2) | (regs.exRamMode << 4)), banks.prg[0], banks.prg[1], banks.prg[2], banks.prg[3], - banks.security & (Banks::READABLE_6|Banks::WRITABLE_6|Regs::WRK_WRITABLE_A|Regs::WRK_WRITABLE_B), - banks.nmt, - banks.chrA[0] & 0xFFU, - banks.chrA[1] & 0xFFU, - banks.chrA[2] & 0xFFU, - banks.chrA[3] & 0xFFU, - banks.chrA[4] & 0xFFU, - banks.chrA[5] & 0xFFU, - banks.chrA[6] & 0xFFU, - banks.chrA[7] & 0xFFU, - banks.chrB[0] & 0xFFU, - banks.chrB[1] & 0xFFU, - banks.chrB[2] & 0xFFU, - banks.chrB[3] & 0xFFU, - uint(banks.chrA[0]) >> 8 | uint(banks.chrA[1]) >> 8 << 2 | uint(banks.chrA[2]) >> 8 << 4 | uint(banks.chrA[3]) >> 8 << 6, - uint(banks.chrA[4]) >> 8 | uint(banks.chrA[5]) >> 8 << 2 | uint(banks.chrA[6]) >> 8 << 4 | uint(banks.chrA[7]) >> 8 << 6, - uint(banks.chrB[0]) >> 8 | uint(banks.chrB[1]) >> 8 << 2 | uint(banks.chrB[2]) >> 8 << 4 | uint(banks.chrB[3]) >> 8 << 6, - (banks.chrHigh >> 6) | (banks.lastChr != Banks::LAST_CHR_A ? 0x80 : 0x00), - filler.tile, - (filler.attribute & 0x3) | (spliter.tile >> 2 & 0xF8), - exRam.tile, - spliter.ctrl, - spliter.yStart, - spliter.chrBank >> 12, - spliter.tile & 0x1F, - spliter.x, - spliter.y + static_cast(banks.security & (Banks::READABLE_6|Banks::WRITABLE_6|Regs::WRK_WRITABLE_A|Regs::WRK_WRITABLE_B)), + static_cast(banks.nmt), + static_cast(banks.chrA[0] & 0xFFU), + static_cast(banks.chrA[1] & 0xFFU), + static_cast(banks.chrA[2] & 0xFFU), + static_cast(banks.chrA[3] & 0xFFU), + static_cast(banks.chrA[4] & 0xFFU), + static_cast(banks.chrA[5] & 0xFFU), + static_cast(banks.chrA[6] & 0xFFU), + static_cast(banks.chrA[7] & 0xFFU), + static_cast(banks.chrB[0] & 0xFFU), + static_cast(banks.chrB[1] & 0xFFU), + static_cast(banks.chrB[2] & 0xFFU), + static_cast(banks.chrB[3] & 0xFFU), + static_cast(uint(banks.chrA[0]) >> 8 | uint(banks.chrA[1]) >> 8 << 2 | uint(banks.chrA[2]) >> 8 << 4 | uint(banks.chrA[3]) >> 8 << 6), + static_cast(uint(banks.chrA[4]) >> 8 | uint(banks.chrA[5]) >> 8 << 2 | uint(banks.chrA[6]) >> 8 << 4 | uint(banks.chrA[7]) >> 8 << 6), + static_cast(uint(banks.chrB[0]) >> 8 | uint(banks.chrB[1]) >> 8 << 2 | uint(banks.chrB[2]) >> 8 << 4 | uint(banks.chrB[3]) >> 8 << 6), + static_cast((banks.chrHigh >> 6) | (banks.lastChr != Banks::LAST_CHR_A ? 0x80 : 0x00)), + static_cast(filler.tile), + static_cast((filler.attribute & 0x3) | (spliter.tile >> 2 & 0xF8)), + static_cast(exRam.tile), + static_cast(spliter.ctrl), + static_cast(spliter.yStart), + static_cast(spliter.chrBank >> 12), + static_cast(spliter.tile & 0x1F), + static_cast(spliter.x), + static_cast(spliter.y) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); } { - const byte data[2] = { regs.mul[0], regs.mul[1] }; + const byte data[2] = { static_cast(regs.mul[0]), static_cast(regs.mul[1]) }; state.Begin( AsciiId<'M','U','L'>::V ).Write( data ).End(); } { const byte data[2] = { - irq.state, - irq.target + static_cast(irq.state), + static_cast(irq.target) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); @@ -474,9 +474,9 @@ namespace Nes { const byte data[3] = { - waveLength & 0xFF, - waveLength >> 8, - duty + static_cast(waveLength & 0xFF), + static_cast(waveLength >> 8), + static_cast(duty) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardNamcot163.cpp b/source/core/board/NstBoardNamcot163.cpp index de72fc42..8a80f7a4 100644 --- a/source/core/board/NstBoardNamcot163.cpp +++ b/source/core/board/NstBoardNamcot163.cpp @@ -251,9 +251,9 @@ namespace Nes const byte data[3] = { - irq.unit.count >> 15, - irq.unit.count >> 0 & 0xFF, - irq.unit.count >> 8 & 0x7F + static_cast(irq.unit.count >> 15), + static_cast(irq.unit.count >> 0 & 0xFF), + static_cast(irq.unit.count >> 8 & 0x7F) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardNanjing.cpp b/source/core/board/NstBoardNanjing.cpp index 1a7a4100..fbde89c0 100644 --- a/source/core/board/NstBoardNanjing.cpp +++ b/source/core/board/NstBoardNanjing.cpp @@ -112,7 +112,7 @@ namespace Nes } { - const byte data[3] = { strobe, trigger ? 0x1 : 0x0, security }; + const byte data[3] = { strobe, static_cast(trigger ? 0x1 : 0x0), static_cast(security) }; state.Begin( AsciiId<'S','E','C'>::V ).Write( data ).End(); } diff --git a/source/core/board/NstBoardSachenStreetHeroes.cpp b/source/core/board/NstBoardSachenStreetHeroes.cpp index 1a2ccb00..ebef8b57 100644 --- a/source/core/board/NstBoardSachenStreetHeroes.cpp +++ b/source/core/board/NstBoardSachenStreetHeroes.cpp @@ -129,8 +129,8 @@ namespace Nes const byte data[2] = { - cartSwitches.GetRegion() ? 0x1 : 0x0, - exReg + static_cast(cartSwitches.GetRegion() ? 0x1 : 0x0), + static_cast(exReg) }; state.Begin( AsciiId<'S','S','H'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardSunsoft3.cpp b/source/core/board/NstBoardSunsoft3.cpp index 0a799fdb..b1923ada 100644 --- a/source/core/board/NstBoardSunsoft3.cpp +++ b/source/core/board/NstBoardSunsoft3.cpp @@ -93,9 +93,9 @@ namespace Nes { const byte data[3] = { - (irq.unit.enabled ? 0x1U : 0x0U) | (irq.unit.toggle ? 0x2U : 0x0U), - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast((irq.unit.enabled ? 0x1U : 0x0U) | (irq.unit.toggle ? 0x2U : 0x0U)), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'S','3'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardSunsoft4.cpp b/source/core/board/NstBoardSunsoft4.cpp index ee27d981..db32b735 100644 --- a/source/core/board/NstBoardSunsoft4.cpp +++ b/source/core/board/NstBoardSunsoft4.cpp @@ -87,9 +87,9 @@ namespace Nes { const byte data[3] = { - regs.ctrl, - regs.nmt[0] & ~uint(Regs::BANK_OFFSET), - regs.nmt[1] & ~uint(Regs::BANK_OFFSET) + static_cast(regs.ctrl), + static_cast(regs.nmt[0] & ~uint(Regs::BANK_OFFSET)), + static_cast(regs.nmt[1] & ~uint(Regs::BANK_OFFSET)) }; state.Begin( AsciiId<'S','4'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardSunsoft5b.cpp b/source/core/board/NstBoardSunsoft5b.cpp index 94fa732f..60d95f32 100644 --- a/source/core/board/NstBoardSunsoft5b.cpp +++ b/source/core/board/NstBoardSunsoft5b.cpp @@ -241,13 +241,13 @@ namespace Nes { const byte data[4] = { - (holding ? 0x1U : 0x0U) | - (hold ? 0x2U : 0x1U) | - (alternate ? 0x4U : 0x0U) | - (attack ? 0x8U : 0x0U), - count, - length & 0xFF, - length >> 8 + static_cast((holding ? 0x1U : 0x0U) | + (hold ? 0x2U : 0x1U) | + (alternate ? 0x4U : 0x0U) | + (attack ? 0x8U : 0x0U)), + static_cast(count), + static_cast(length & 0xFF), + static_cast(length >> 8) }; state.Begin( chunk ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); @@ -262,9 +262,9 @@ namespace Nes { const byte data[3] = { - (~status & 0x1) | (ctrl << 1), - length & 0xFF, - (length >> 8) | ((status & 0x8) << 1), + static_cast((~status & 0x1) | (ctrl << 1)), + static_cast(length & 0xFF), + static_cast((length >> 8) | ((status & 0x8) << 1)), }; state.Begin( chunk ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardSunsoftFme7.cpp b/source/core/board/NstBoardSunsoftFme7.cpp index dbc9f0bf..96e19e14 100644 --- a/source/core/board/NstBoardSunsoftFme7.cpp +++ b/source/core/board/NstBoardSunsoftFme7.cpp @@ -105,9 +105,9 @@ namespace Nes { const byte data[3] = { - (irq.Connected() ? 0x80U : 0x00U) | (irq.unit.enabled ? 0x1U : 0x0U), - irq.unit.count & 0xFF, - irq.unit.count >> 8 + static_cast((irq.Connected() ? 0x80U : 0x00U) | (irq.unit.enabled ? 0x1U : 0x0U)), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.count >> 8) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardSuperGameLionKing.cpp b/source/core/board/NstBoardSuperGameLionKing.cpp index 17492d93..ba792800 100644 --- a/source/core/board/NstBoardSuperGameLionKing.cpp +++ b/source/core/board/NstBoardSuperGameLionKing.cpp @@ -83,8 +83,8 @@ namespace Nes const byte data[2] = { - exRegs[0], - exRegs[1] + static_cast(exRegs[0]), + static_cast(exRegs[1]) }; state.Begin( AsciiId<'S','L','K'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardSuperGamePocahontas2.cpp b/source/core/board/NstBoardSuperGamePocahontas2.cpp index d0450d27..56a73f21 100644 --- a/source/core/board/NstBoardSuperGamePocahontas2.cpp +++ b/source/core/board/NstBoardSuperGamePocahontas2.cpp @@ -89,9 +89,9 @@ namespace Nes const byte data[3] = { - exRegs[0], - exRegs[1], - exRegs[2] + static_cast(exRegs[0]), + static_cast(exRegs[1]), + static_cast(exRegs[2]) }; state.Begin( AsciiId<'S','P','2'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardTaitoX1017.cpp b/source/core/board/NstBoardTaitoX1017.cpp index 70fa49dd..24958bf5 100644 --- a/source/core/board/NstBoardTaitoX1017.cpp +++ b/source/core/board/NstBoardTaitoX1017.cpp @@ -137,7 +137,7 @@ namespace Nes const byte data[7] = { - regs.ctrl, + static_cast(regs.ctrl), regs.security[0], regs.security[1], regs.security[2], diff --git a/source/core/board/NstBoardTengenRambo1.cpp b/source/core/board/NstBoardTengenRambo1.cpp index 7ee47082..8fc4969b 100644 --- a/source/core/board/NstBoardTengenRambo1.cpp +++ b/source/core/board/NstBoardTengenRambo1.cpp @@ -169,12 +169,12 @@ namespace Nes { const byte data[4] = { - (irq.unit.enabled ? 0x1U : 0x0U) | - (irq.m2.Connected() ? 0x2U : 0x0U) | - (irq.unit.reload ? 0x4U : 0x0U), - irq.unit.latch, - irq.unit.count & 0xFF, - irq.unit.cycles, + static_cast((irq.unit.enabled ? 0x1U : 0x0U) | + (irq.m2.Connected() ? 0x2U : 0x0U) | + (irq.unit.reload ? 0x4U : 0x0U)), + static_cast(irq.unit.latch), + static_cast(irq.unit.count & 0xFF), + static_cast(irq.unit.cycles), }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardUnlA9746.cpp b/source/core/board/NstBoardUnlA9746.cpp index cdeba73b..f5a92f90 100644 --- a/source/core/board/NstBoardUnlA9746.cpp +++ b/source/core/board/NstBoardUnlA9746.cpp @@ -85,7 +85,9 @@ namespace Nes const byte data[] = { - exRegs[0], exRegs[1], exRegs[2] >> 4 + static_cast(exRegs[0]), + static_cast(exRegs[1]), + static_cast(exRegs[2] >> 4) }; state.Begin( AsciiId<'A','9','7'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardUnlMmc3BigPrgRom.cpp b/source/core/board/NstBoardUnlMmc3BigPrgRom.cpp index 74b32973..24cd69f1 100644 --- a/source/core/board/NstBoardUnlMmc3BigPrgRom.cpp +++ b/source/core/board/NstBoardUnlMmc3BigPrgRom.cpp @@ -101,14 +101,14 @@ namespace Nes const byte data[12] = { - regs.ctrl0, - regs.ctrl1, + static_cast(regs.ctrl0), + static_cast(regs.ctrl1), banks.prg[0], banks.prg[1], 0x7E, 0x7F, - banks.chr[0] >> 1, - banks.chr[2] >> 1, + static_cast(banks.chr[0] >> 1), + static_cast(banks.chr[2] >> 1), banks.chr[4], banks.chr[5], banks.chr[6], diff --git a/source/core/board/NstBoardUnlN625092.cpp b/source/core/board/NstBoardUnlN625092.cpp index 86cadf83..3e411658 100644 --- a/source/core/board/NstBoardUnlN625092.cpp +++ b/source/core/board/NstBoardUnlN625092.cpp @@ -76,7 +76,7 @@ namespace Nes { const byte data[] = { - regs[0], regs[1] + static_cast(regs[0]), static_cast(regs[1]) }; state.Begin( AsciiId<'N','6','2'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); diff --git a/source/core/board/NstBoardUnlRetX7Gbl.cpp b/source/core/board/NstBoardUnlRetX7Gbl.cpp index d198f128..bc7373f1 100644 --- a/source/core/board/NstBoardUnlRetX7Gbl.cpp +++ b/source/core/board/NstBoardUnlRetX7Gbl.cpp @@ -77,7 +77,9 @@ namespace Nes const byte data[3] = { - regs[0], regs[1], led + static_cast(regs[0]), + static_cast(regs[1]), + static_cast(led) }; state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardUnlTf1201.cpp b/source/core/board/NstBoardUnlTf1201.cpp index 5f53c690..02da6f22 100644 --- a/source/core/board/NstBoardUnlTf1201.cpp +++ b/source/core/board/NstBoardUnlTf1201.cpp @@ -110,8 +110,8 @@ namespace Nes const byte data[2] = { - irq.unit.enabled ? 0x1 : 0x0, - irq.unit.count & 0xFF + static_cast(irq.unit.enabled ? 0x1 : 0x0), + static_cast(irq.unit.count & 0xFF) }; state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End(); diff --git a/source/core/board/NstBoardWaixingFfv.cpp b/source/core/board/NstBoardWaixingFfv.cpp index 959e0d08..479757e7 100644 --- a/source/core/board/NstBoardWaixingFfv.cpp +++ b/source/core/board/NstBoardWaixingFfv.cpp @@ -50,7 +50,7 @@ namespace Nes void Ffv::SubSave(State::Saver& state) const { - const byte data[2] = { regs[0], regs[1] }; + const byte data[2] = { static_cast(regs[0]), static_cast(regs[1]) }; state.Begin( AsciiId<'W','F','V'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); } diff --git a/source/core/board/NstBoardWaixingFs304.cpp b/source/core/board/NstBoardWaixingFs304.cpp index 837e7489..b5def29b 100644 --- a/source/core/board/NstBoardWaixingFs304.cpp +++ b/source/core/board/NstBoardWaixingFs304.cpp @@ -50,7 +50,12 @@ namespace Nes void Fs304::SubSave(State::Saver& state) const { - const byte data[4] = { regs[0], regs[1], regs[2], regs[3] }; + const byte data[4] = { + static_cast(regs[0]), + static_cast(regs[1]), + static_cast(regs[2]), + static_cast(regs[3]) + }; state.Begin( AsciiId<'3','0','4'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write( data ).End().End(); } diff --git a/source/core/input/NstInpAdapter.cpp b/source/core/input/NstInpAdapter.cpp index 2dda7288..2b06aa36 100644 --- a/source/core/input/NstInpAdapter.cpp +++ b/source/core/input/NstInpAdapter.cpp @@ -181,7 +181,9 @@ namespace Nes { const byte data[3] = { - increaser ^ 1, count[0], count[1] + static_cast(increaser ^ 1), + static_cast(count[0]), + static_cast(count[1]) }; state.Begin( chunk ).Write( data ).End(); diff --git a/source/core/input/NstInpMouse.cpp b/source/core/input/NstInpMouse.cpp index cf1993c2..7fa1331a 100644 --- a/source/core/input/NstInpMouse.cpp +++ b/source/core/input/NstInpMouse.cpp @@ -52,7 +52,7 @@ namespace Nes { const byte data[2] = { - strobe, stream ^ 0xFF + static_cast(strobe), static_cast(stream ^ 0xFF) }; saver.Begin( AsciiId<'M','S'>::R(0,0,id) ).Write( data ).End(); diff --git a/source/core/input/NstInpPad.cpp b/source/core/input/NstInpPad.cpp index 84902079..ca64886c 100644 --- a/source/core/input/NstInpPad.cpp +++ b/source/core/input/NstInpPad.cpp @@ -65,7 +65,7 @@ namespace Nes { const byte data[2] = { - strobe, stream ^ 0xFF + static_cast(strobe), static_cast(stream ^ 0xFF) }; saver.Begin( AsciiId<'P','D'>::R(0,0,id) ).Write( data ).End(); diff --git a/source/core/input/NstInpPowerGlove.cpp b/source/core/input/NstInpPowerGlove.cpp index 5faf3a33..2ce44725 100644 --- a/source/core/input/NstInpPowerGlove.cpp +++ b/source/core/input/NstInpPowerGlove.cpp @@ -76,8 +76,8 @@ namespace Nes { const byte data[4] = { - latch, - stream == ~0U ? 0xFF : stream, + static_cast(latch), + static_cast(stream == ~0U ? 0xFF : stream), output, counter }; diff --git a/source/core/input/NstInpRob.cpp b/source/core/input/NstInpRob.cpp index ccf54c08..50bb9b88 100644 --- a/source/core/input/NstInpRob.cpp +++ b/source/core/input/NstInpRob.cpp @@ -55,12 +55,12 @@ namespace Nes { byte data[6] = { - strobe, - stream ^ 0xFF, - state, + static_cast(strobe), + static_cast(stream ^ 0xFF), + static_cast(state), 0, - code & 0xFF, - code >> 8 + static_cast(code & 0xFF), + static_cast(code >> 8) }; while (!(shifter & 1U << data[3])) diff --git a/source/core/input/NstInpTurboFile.cpp b/source/core/input/NstInpTurboFile.cpp index 23895bdd..c1841e02 100644 --- a/source/core/input/NstInpTurboFile.cpp +++ b/source/core/input/NstInpTurboFile.cpp @@ -65,9 +65,9 @@ namespace Nes const byte data[3] = { - pos & 0xFF, - pos >> 8, - count | (old << 1) | (out << 2) + static_cast(pos & 0xFF), + static_cast(pos >> 8), + static_cast(count | (old << 1) | (out << 2)) }; saver.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End(); diff --git a/source/core/input/NstInpZapper.cpp b/source/core/input/NstInpZapper.cpp index c8e35452..4cff50c6 100644 --- a/source/core/input/NstInpZapper.cpp +++ b/source/core/input/NstInpZapper.cpp @@ -137,8 +137,8 @@ namespace Nes { const byte data[2] = { - arcade ? shifter ? 0x1 : 0x3 : 0x0, - arcade ? stream : 0x00 + static_cast(arcade ? shifter ? 0x1 : 0x3 : 0x0), + static_cast(arcade ? stream : 0x00) }; saver.Begin( AsciiId<'Z','P'>::R(0,0,id) ).Write( data ).End();