Skip to content

Commit

Permalink
Fix warngins
Browse files Browse the repository at this point in the history
  • Loading branch information
MonJamp committed Jan 2, 2021
1 parent 5d5f08b commit 0a6b038
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Cartridge/Cartridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void Cartridge::ParseHeader()

void Cartridge::AllocateRAM()
{
uint16_t ram_size = 0;
uint32_t ram_size = 0;

switch (header.ram_size)
{
Expand Down
5 changes: 2 additions & 3 deletions Cartridge/MBC1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ uint8_t GetBankBitMask(uint8_t x)
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;

return x;
}
Expand All @@ -21,8 +20,8 @@ MBC1::MBC1(std::vector<RomBank*>& romBanks, std::vector<RamBank*>& ramBanks)
BANK2 = 0;
MODE = 0;

romBankMask = GetBankBitMask(romBanks.size() - 1);
ramBankMask = GetBankBitMask(ramBanks.size() - 1);
romBankMask = GetBankBitMask(static_cast<uint8_t>(romBanks.size()) - 1);
ramBankMask = GetBankBitMask(static_cast<uint8_t>(ramBanks.size()) - 1);
}

MBC1::~MBC1()
Expand Down
4 changes: 2 additions & 2 deletions Disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void Debugger::Disassemble()
uint32_t ir = 0x00;

uint16_t address = pc;
addressTable[address] = disassembly.size();
addressTable[address] = static_cast<uint16_t>(disassembly.size());
uint8_t opcode = bus->cart->ROM_Read(pc++);
ir = opcode;

Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions GUI/Debugger/BreakpointList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void BreakpointList::OnPopupClick(wxCommandEvent& evt)

if(!addressStr.IsEmpty())
{
uint16_t address = strtol(addressStr, NULL, 16);
uint16_t address = static_cast<uint16_t>(strtol(addressStr, NULL, 16));
debugger->AddBreakpoint(address);
SetItems();
}
Expand All @@ -124,7 +124,7 @@ void BreakpointList::OnPopupClick(wxCommandEvent& evt)
case EventID::RemoveBreakpoint:
{
long item = reinterpret_cast<long>(static_cast<wxMenu*>(evt.GetEventObject())->GetClientData());
uint16_t address = strtol(bpData[item].address, NULL, 16);
uint16_t address = static_cast<uint16_t>(strtol(bpData[item].address, NULL, 16));
debugger->RemoveBreakpoint(address);
SetItems();
} break;
Expand Down
2 changes: 1 addition & 1 deletion GUI/Debugger/MemoryBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>(index) * 0x10 + 0x8000);
wxString address = intToHexString(index * 0x10 + 0x8000, 2);
return category + ":" + address;
}
Expand Down
12 changes: 6 additions & 6 deletions GUI/Debugger/VramFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
VramCanvas::VramCanvas(std::shared_ptr<Bus> 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));
Expand All @@ -33,14 +33,14 @@ VramCanvas::VramCanvas(std::shared_ptr<Bus> 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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion GUI/Debugger/VramFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class VramCanvas : public SfmlCanvas
std::vector<sf::Texture*> textures;
std::vector<sf::Sprite> sprites;

float scale, posX, posY;
int scale, posX, posY;
uint16_t tileIndex; // Keeps track of which tile to draw next
};

Expand Down
2 changes: 1 addition & 1 deletion GUI/MainCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ std::array<uint8_t, 160 * 4> 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];
Expand Down
2 changes: 1 addition & 1 deletion GUI/SfmlCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

0 comments on commit 0a6b038

Please sign in to comment.