From 53a7baf91ff4c4dfe6fbfd16cc199af88896be6f Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Mon, 28 Feb 2022 17:52:23 +0100 Subject: [PATCH] fixed build for linux --- CMakeLists.txt | 2 +- src/Application.cpp | 2 +- src/CMakeLists.txt | 1 + src/CPU.cpp | 8 ++++---- src/CPU.hpp | 2 +- src/gfx/Window.hpp | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 070b8ca..6bd8caf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required (VERSION 3.8) project ("NES Emulator") find_package(glfw3) -if(NOT ${GLFW3_FOUND}) +if(NOT GLFW3_FOUND) add_subdirectory("vendor/glfw") endif() add_subdirectory("vendor/glad") diff --git a/src/Application.cpp b/src/Application.cpp index 968f7c4..5e46fc3 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b70fafc..20cd563 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ target_link_libraries(nesemu spdlog glfw glad + ${CMAKE_DL_LIBS} ) add_custom_command(TARGET nesemu POST_BUILD diff --git a/src/CPU.cpp b/src/CPU.cpp index d5596b4..5b202a5 100644 --- a/src/CPU.cpp +++ b/src/CPU.cpp @@ -6,8 +6,8 @@ #include "Log.hpp" #define BIND(x) (std::bind(&CPU::x, this)) -#define NEW_INSTRUCTION(op, addr, size, cyc) { BIND(op), BIND(addr), Addressing::addr, size, cyc, " " #op } -#define NEW_ILLGL_INSTR(op, addr, size, cyc) { BIND(op), BIND(addr), Addressing::addr, size, cyc, "*" #op } +#define NEW_INSTRUCTION(op, addr, size, cyc) Instruction{ BIND(op), BIND(addr), Addressing::addr, size, cyc, " " #op } +#define NEW_ILLGL_INSTR(op, addr, size, cyc) Instruction{ BIND(op), BIND(addr), Addressing::addr, size, cyc, "*" #op } #define CHECK_NEGATIVE(x) status.Flag.Negative = (((x) & 0x80) == 0x80) #define CHECK_ZERO(x) status.Flag.Zero = ((x) == 0x00) @@ -64,7 +64,7 @@ uint8_t CPU::Tick() pastInstructions.pop_front(); // If the instruction is not set in the lookup table, abort - if (currentInstruction->Operation == nullptr || currentInstruction->Mode == nullptr) + if (currentInstruction->Opcode == nullptr || currentInstruction->Mode == nullptr) { LOG_DEBUG_ERROR("Unknown instruction {0:02X} at ${1:04X}", opcode, pc.Raw); throw std::runtime_error("Encountered unknown opcode"); @@ -75,7 +75,7 @@ uint8_t CPU::Tick() // Invoke addressing mode and instruction accumulatorAddressing = false; currentInstruction->Mode(); - currentInstruction->Operation(); + currentInstruction->Opcode(); APPEND_DEBUG_STRING(std::string(50 - debugString.str().length(), ' ')); diff --git a/src/CPU.hpp b/src/CPU.hpp index 8241d57..89e9170 100644 --- a/src/CPU.hpp +++ b/src/CPU.hpp @@ -53,7 +53,7 @@ union StatusFlag */ struct Instruction { - Operation Operation = nullptr; + Operation Opcode = nullptr; AddressingMode Mode = nullptr; Addressing AddrType = Addressing::IMP; uint8_t Size = 0; diff --git a/src/gfx/Window.hpp b/src/gfx/Window.hpp index 61a92f1..02fffc9 100644 --- a/src/gfx/Window.hpp +++ b/src/gfx/Window.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include class Window {