Minor fixes

This commit is contained in:
Sour 2021-06-06 13:29:45 -04:00
parent ac70611897
commit ab0fe3c6e1
12 changed files with 31 additions and 34 deletions

View file

@ -417,7 +417,7 @@ LoadRomResult Gameboy::LoadRom(VirtualFile& romFile)
GbCart* cart = GbCartFactory::CreateCart(header.CartType);
if(cart) {
Init(cart, romData, header.GetCartRamSize(), header.HasBattery(), (header.CgbFlag & 0x80) != false);
Init(cart, romData, header.GetCartRamSize(), header.HasBattery(), (header.CgbFlag & 0x80) != 0);
return LoadRomResult::Success;
}
}

View file

@ -21,7 +21,7 @@ private:
__forceinline uint32_t GetPixel(uint16_t* ppuFrame, uint32_t offset);
protected:
void OnBeforeApplyFilter();
void OnBeforeApplyFilter() override;
public:
GbDefaultVideoFilter(Emulator* emu);
@ -29,5 +29,5 @@ public:
FrameInfo GetFrameInfo() override;
void ApplyFilter(uint16_t* ppuOutputBuffer);
void ApplyFilter(uint16_t* ppuOutputBuffer) override;
};

View file

@ -60,7 +60,6 @@ public:
int32_t cyclesToRun = targetCycle - _previousCycle;
if(cyclesToRun > _timer) {
cyclesToRun -= _timer + 1;
_previousCycle += _timer + 1;
_timer = _period;
return true;

View file

@ -400,7 +400,6 @@ uint32_t NesAssembler::AssembleCode(string code, uint32_t startAddress, int16_t*
std::unordered_map<string, uint16_t> temporaryLabels;
std::unordered_map<string, uint16_t> currentPassLabels;
size_t i = 0;
vector<int16_t> output;
output.reserve(1000);

View file

@ -20,7 +20,7 @@ struct NesLineData
bool HasOpeningParenthesis = false;
};
class NesAssembler : public IAssembler
class NesAssembler final : public IAssembler
{
private:
std::unordered_map<string, unordered_set<int>> _availableModesByOpName;
@ -36,6 +36,7 @@ private:
public:
NesAssembler(shared_ptr<LabelManager> labelManager);
virtual ~NesAssembler() = default;
uint32_t AssembleCode(string code, uint32_t startAddress, int16_t* assembledCode);
};

View file

@ -691,6 +691,7 @@ unique_ptr<BaseMapper> MapperFactory::InitializeFromFile(NesConsole* console, Vi
} else {
//File is a valid NES file, but it couldn't be loaded
result = LoadRomResult::Failure;
return nullptr;
}
}
result = LoadRomResult::UnknownType;

View file

@ -18,7 +18,7 @@ private:
protected:
void DecodePpuBuffer(uint16_t* ppuOutputBuffer, uint32_t* outputBuffer, bool displayScanlines);
void OnBeforeApplyFilter();
void OnBeforeApplyFilter() override;
public:
NesDefaultVideoFilter(Emulator* emu);
@ -26,5 +26,5 @@ public:
static void GenerateFullColorPalette(uint32_t paletteBuffer[512]);
static void GetFullPalette(uint32_t palette[512], NesConfig& nesCfg, PpuModel model);
void ApplyFilter(uint16_t* ppuOutputBuffer);
void ApplyFilter(uint16_t* ppuOutputBuffer) override;
};

View file

@ -431,7 +431,6 @@ uint32_t SnesAssembler::AssembleCode(string code, uint32_t startAddress, int16_t
std::unordered_map<string, uint32_t> temporaryLabels;
std::unordered_map<string, uint32_t> currentPassLabels;
size_t i = 0;
vector<int16_t> output;
output.reserve(1000);

View file

@ -19,7 +19,7 @@ private:
__forceinline uint32_t GetPixel(uint16_t* ppuFrame, uint32_t offset);
protected:
void OnBeforeApplyFilter();
void OnBeforeApplyFilter() override;
public:
SnesDefaultVideoFilter(Emulator* emu);

View file

@ -269,8 +269,6 @@ void ShortcutKeyHandler::ProcessShortcutReleased(EmulatorShortcut shortcut)
void ShortcutKeyHandler::CheckMappedKeys()
{
EmuSettings* settings = _emu->GetSettings();
//Let the UI handle these shortcuts
for(uint64_t i = 0; i < (uint64_t)EmulatorShortcut::ShortcutCount; i++) {
EmulatorShortcut shortcut = (EmulatorShortcut)i;

View file

@ -7,7 +7,7 @@
class Emulator;
class ShortcutKeyHandler : public INotificationListener, public std::enable_shared_from_this<ShortcutKeyHandler>
class ShortcutKeyHandler final : public INotificationListener, public std::enable_shared_from_this<ShortcutKeyHandler>
{
private:
Emulator* _emu;
@ -43,7 +43,7 @@ private:
public:
ShortcutKeyHandler(Emulator* emu);
~ShortcutKeyHandler();
virtual ~ShortcutKeyHandler();
bool IsShortcutAllowed(EmulatorShortcut shortcut);
void ProcessKeys();

View file

@ -21,45 +21,45 @@ MESENFLAGS=
libretro : MESENFLAGS=-D LIBRETRO
ifeq ($(USE_GCC),true)
CPPC=g++
CXX=g++
CC=gcc
PROFILE_GEN_FLAG=-fprofile-generate
PROFILE_USE_FLAG=-fprofile-use
else
CPPC=clang++
CXX=clang++
CC=clang
PROFILE_GEN_FLAG = -fprofile-instr-generate=$(CURDIR)/PGOHelper/pgo.profraw
PROFILE_USE_FLAG = -fprofile-instr-use=$(CURDIR)/PGOHelper/pgo.profdata
endif
GCCOPTIONS=-fPIC -Wall --std=c++17 -O3 $(MESENFLAGS) -I/usr/include/SDL2 -I $(realpath ./) -I $(realpath ./Core) -I $(realpath ./Utilities) -I $(realpath ./Linux)
CCOPTIONS=-fPIC -Wall -O3 $(MESENFLAGS)
CXXFLAGS=-fPIC -Wall --std=c++17 -O3 $(MESENFLAGS) -I/usr/include/SDL2 -I $(realpath ./) -I $(realpath ./Core) -I $(realpath ./Utilities) -I $(realpath ./Linux)
CFLAGS=-fPIC -Wall -O3 $(MESENFLAGS)
LINKOPTIONS=
ifeq ($(MESENPLATFORM),x86)
MESENPLATFORM=x86
GCCOPTIONS += -m32
CCOPTIONS += -m32
CXXFLAGS += -m32
CFLAGS += -m32
else
MESENPLATFORM=x64
GCCOPTIONS += -m64
CCOPTIONS += -m64
CXXFLAGS += -m64
CFLAGS += -m64
endif
ifeq ($(LTO),true)
CCOPTIONS += -flto
GCCOPTIONS += -flto
CFLAGS += -flto
CXXFLAGS += -flto
endif
ifeq ($(PGO),profile)
CCOPTIONS += ${PROFILE_GEN_FLAG}
GCCOPTIONS += ${PROFILE_GEN_FLAG}
CFLAGS += ${PROFILE_GEN_FLAG}
CXXFLAGS += ${PROFILE_GEN_FLAG}
endif
ifeq ($(PGO),optimize)
CCOPTIONS += ${PROFILE_USE_FLAG}
GCCOPTIONS += ${PROFILE_USE_FLAG}
CFLAGS += ${PROFILE_USE_FLAG}
CXXFLAGS += ${PROFILE_USE_FLAG}
endif
ifeq ($(STATICLINK),true)
@ -121,29 +121,29 @@ runtests:
testhelper: InteropDLL/$(OBJFOLDER)/$(SHAREDLIB)
mkdir -p TestHelper/$(OBJFOLDER)
$(CPPC) $(GCCOPTIONS) -Wl,-z,defs -o testhelper TestHelper/*.cpp InteropDLL/ConsoleWrapper.cpp $(SEVENZIPOBJ) $(LUAOBJ) $(LINUXOBJ) $(LIBEVDEVOBJ) $(UTILOBJ) $(COREOBJ) -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
$(CXX) $(CXXFLAGS) -Wl,-z,defs -o testhelper TestHelper/*.cpp InteropDLL/ConsoleWrapper.cpp $(SEVENZIPOBJ) $(LUAOBJ) $(LINUXOBJ) $(LIBEVDEVOBJ) $(UTILOBJ) $(COREOBJ) -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
mv testhelper TestHelper/$(OBJFOLDER)
pgohelper: InteropDLL/$(OBJFOLDER)/$(SHAREDLIB)
mkdir -p PGOHelper/$(OBJFOLDER) && cd PGOHelper/$(OBJFOLDER) && $(CPPC) $(GCCOPTIONS) -Wl,-z,defs -o pgohelper ../PGOHelper.cpp ../../bin/pgohelperlib.so -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
mkdir -p PGOHelper/$(OBJFOLDER) && cd PGOHelper/$(OBJFOLDER) && $(CXX) $(CXXFLAGS) -Wl,-z,defs -o pgohelper ../PGOHelper.cpp ../../bin/pgohelperlib.so -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
%.o: %.c
$(CC) $(CCOPTIONS) -c $< -o $@
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
$(CPPC) $(GCCOPTIONS) -c $< -o $@
$(CXX) $(CXXFLAGS) -c $< -o $@
InteropDLL/$(OBJFOLDER)/$(SHAREDLIB): $(SEVENZIPOBJ) $(LUAOBJ) $(UTILOBJ) $(COREOBJ) $(LIBEVDEVOBJ) $(LINUXOBJ) $(DLLOBJ)
mkdir -p bin
mkdir -p InteropDLL/$(OBJFOLDER)
$(CPPC) $(GCCOPTIONS) $(LINKOPTIONS) -Wl,-z,defs -shared -o $(SHAREDLIB) $(DLLOBJ) $(SEVENZIPOBJ) $(LUAOBJ) $(LINUXOBJ) $(LIBEVDEVOBJ) $(UTILOBJ) $(COREOBJ) $(SDL2INC) -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
$(CXX) $(CXXFLAGS) $(LINKOPTIONS) -Wl,-z,defs -shared -o $(SHAREDLIB) $(DLLOBJ) $(SEVENZIPOBJ) $(LUAOBJ) $(LINUXOBJ) $(LIBEVDEVOBJ) $(UTILOBJ) $(COREOBJ) $(SDL2INC) -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
cp $(SHAREDLIB) bin/pgohelperlib.so
mv $(SHAREDLIB) InteropDLL/$(OBJFOLDER)
Libretro/$(OBJFOLDER)/$(LIBRETROLIB): $(SEVENZIPOBJ) $(UTILOBJ) $(COREOBJ) Libretro/libretro.cpp
mkdir -p bin
mkdir -p Libretro/$(OBJFOLDER)
$(CPPC) $(GCCOPTIONS) $(LINKOPTIONS) -Wl,-z,defs -shared -o $(LIBRETROLIB) Libretro/*.cpp $(SEVENZIPOBJ) $(UTILOBJ) $(COREOBJ) -pthread
$(CXX) $(CXXFLAGS) $(LINKOPTIONS) -Wl,-z,defs -shared -o $(LIBRETROLIB) Libretro/*.cpp $(SEVENZIPOBJ) $(UTILOBJ) $(COREOBJ) -pthread
cp $(LIBRETROLIB) bin/pgohelperlib.so
mv $(LIBRETROLIB) Libretro/$(OBJFOLDER)