From 0a6b03884ba5243764599902017493a6f7373271 Mon Sep 17 00:00:00 2001 From: MonJamp Date: Fri, 1 Jan 2021 21:12:29 -0600 Subject: [PATCH] Fix warngins --- Bus.cpp | 2 +- Cartridge/Cartridge.cpp | 2 +- Cartridge/MBC1.cpp | 5 ++--- Disassembler.cpp | 4 ++-- GUI/Debugger/BreakpointList.cpp | 4 ++-- GUI/Debugger/MemoryBrowser.cpp | 2 +- GUI/Debugger/VramFrame.cpp | 12 ++++++------ GUI/Debugger/VramFrame.h | 2 +- GUI/MainCanvas.cpp | 2 +- GUI/SfmlCanvas.cpp | 2 +- 10 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Bus.cpp b/Bus.cpp index 37faed7..753a29f 100644 --- a/Bus.cpp +++ b/Bus.cpp @@ -509,7 +509,7 @@ Memory::Map& Bus::GetMemoryDump() void Bus::dmaTransfer(uint8_t data) { uint16_t address = data * 0x100; - for (int i = 0; i < map->oam.size(); i++) + for (unsigned int i = 0; i < map->oam.size(); i++) { uint8_t oam_data = Read(address + i); Write(0xFE00 + i, oam_data); diff --git a/Cartridge/Cartridge.cpp b/Cartridge/Cartridge.cpp index 24a6b72..d43a662 100644 --- a/Cartridge/Cartridge.cpp +++ b/Cartridge/Cartridge.cpp @@ -318,7 +318,7 @@ void Cartridge::ParseHeader() void Cartridge::AllocateRAM() { - uint16_t ram_size = 0; + uint32_t ram_size = 0; switch (header.ram_size) { diff --git a/Cartridge/MBC1.cpp b/Cartridge/MBC1.cpp index b850339..33eada0 100644 --- a/Cartridge/MBC1.cpp +++ b/Cartridge/MBC1.cpp @@ -8,7 +8,6 @@ uint8_t GetBankBitMask(uint8_t x) x |= x >> 1; x |= x >> 2; x |= x >> 4; - x |= x >> 8; return x; } @@ -21,8 +20,8 @@ MBC1::MBC1(std::vector& romBanks, std::vector& ramBanks) BANK2 = 0; MODE = 0; - romBankMask = GetBankBitMask(romBanks.size() - 1); - ramBankMask = GetBankBitMask(ramBanks.size() - 1); + romBankMask = GetBankBitMask(static_cast(romBanks.size()) - 1); + ramBankMask = GetBankBitMask(static_cast(ramBanks.size()) - 1); } MBC1::~MBC1() diff --git a/Disassembler.cpp b/Disassembler.cpp index 67e89c7..19af039 100644 --- a/Disassembler.cpp +++ b/Disassembler.cpp @@ -171,7 +171,7 @@ void Debugger::Disassemble() uint32_t ir = 0x00; uint16_t address = pc; - addressTable[address] = disassembly.size(); + addressTable[address] = static_cast(disassembly.size()); uint8_t opcode = bus->cart->ROM_Read(pc++); ir = opcode; @@ -244,7 +244,7 @@ bool Debugger::HitBreakpoint() bool Debugger::RemoveBreakpoint(uint16_t address) { - for(int i = 0; i < breakpoints.size(); i++) + for(unsigned int i = 0; i < breakpoints.size(); i++) { if(breakpoints[i].address == address) { diff --git a/GUI/Debugger/BreakpointList.cpp b/GUI/Debugger/BreakpointList.cpp index 587f7b1..1c42f72 100644 --- a/GUI/Debugger/BreakpointList.cpp +++ b/GUI/Debugger/BreakpointList.cpp @@ -114,7 +114,7 @@ void BreakpointList::OnPopupClick(wxCommandEvent& evt) if(!addressStr.IsEmpty()) { - uint16_t address = strtol(addressStr, NULL, 16); + uint16_t address = static_cast(strtol(addressStr, NULL, 16)); debugger->AddBreakpoint(address); SetItems(); } @@ -124,7 +124,7 @@ void BreakpointList::OnPopupClick(wxCommandEvent& evt) case EventID::RemoveBreakpoint: { long item = reinterpret_cast(static_cast(evt.GetEventObject())->GetClientData()); - uint16_t address = strtol(bpData[item].address, NULL, 16); + uint16_t address = static_cast(strtol(bpData[item].address, NULL, 16)); debugger->RemoveBreakpoint(address); SetItems(); } break; diff --git a/GUI/Debugger/MemoryBrowser.cpp b/GUI/Debugger/MemoryBrowser.cpp index 2626e75..38e7657 100644 --- a/GUI/Debugger/MemoryBrowser.cpp +++ b/GUI/Debugger/MemoryBrowser.cpp @@ -148,7 +148,7 @@ wxString MemoryBrowser::OnGetItemText(long index, long column) const { case ColumnID::CategoryAddress: { - wxString category = GetCategory(index * 0x10 + 0x8000); + wxString category = GetCategory(static_cast(index) * 0x10 + 0x8000); wxString address = intToHexString(index * 0x10 + 0x8000, 2); return category + ":" + address; } diff --git a/GUI/Debugger/VramFrame.cpp b/GUI/Debugger/VramFrame.cpp index 19ca783..2729f17 100644 --- a/GUI/Debugger/VramFrame.cpp +++ b/GUI/Debugger/VramFrame.cpp @@ -4,9 +4,9 @@ VramCanvas::VramCanvas(std::shared_ptr b, wxWindow* parent) : SfmlCanvas(parent), bus(b) { - scale = 3.f; - posX = 0.f; - posY = 0.f; + scale = 3; + posX = 0; + posY = 0; tileIndex = 0; SetMinSize(wxSize(scale * 8 * 16, scale * 8 * 16)); @@ -33,14 +33,14 @@ VramCanvas::VramCanvas(std::shared_ptr b, wxWindow* parent) sf::Sprite sprite; sprite.setTexture(*textures.back()); - sprite.setScale(scale, scale); - sprite.setPosition(posX, posY); + sprite.setScale((float)scale, (float)scale); + sprite.setPosition((float)posX, (float)posY); sprites.push_back(sprite); posX += 8 * scale; if (posX == 8 * scale * 16) { - posX = 0.f; + posX = 0; posY += 8 * scale; } } diff --git a/GUI/Debugger/VramFrame.h b/GUI/Debugger/VramFrame.h index dd1a214..5ba5b23 100644 --- a/GUI/Debugger/VramFrame.h +++ b/GUI/Debugger/VramFrame.h @@ -17,7 +17,7 @@ class VramCanvas : public SfmlCanvas std::vector textures; std::vector sprites; - float scale, posX, posY; + int scale, posX, posY; uint16_t tileIndex; // Keeps track of which tile to draw next }; diff --git a/GUI/MainCanvas.cpp b/GUI/MainCanvas.cpp index 07dca9e..bafb002 100644 --- a/GUI/MainCanvas.cpp +++ b/GUI/MainCanvas.cpp @@ -51,7 +51,7 @@ std::array MainCanvas::GetLine(int line) assert((line * 160 * 4 + (pixels.size() / 4) * 4 + 3) < (image.getSize().x * image.getSize().y * 4)); - for (int i = 0; i < (pixels.size() / 4); i++) + for (unsigned int i = 0; i < (pixels.size() / 4); i++) { pixels[i * 4] = pixelsFull[line * 160 * 4 + i * 4]; pixels[i * 4 + 1] = pixelsFull[line * 160 * 4 + i * 4 + 1]; diff --git a/GUI/SfmlCanvas.cpp b/GUI/SfmlCanvas.cpp index 8f7d76e..dd72297 100644 --- a/GUI/SfmlCanvas.cpp +++ b/GUI/SfmlCanvas.cpp @@ -74,5 +74,5 @@ void SfmlCanvas::OnEraseBackground(wxEraseEvent& evt) void SfmlCanvas::OnSize(wxSizeEvent& evt) { setSize(sf::Vector2u(evt.GetSize().x, evt.GetSize().y)); - setView(sf::View(sf::FloatRect(0, 0, evt.GetSize().x, evt.GetSize().y))); + setView(sf::View(sf::FloatRect(0, 0, (float)evt.GetSize().x, (float)evt.GetSize().y))); }