2021-02-09 15:38:51 -07:00
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
2019-06-21 17:28:32 -06:00
|
|
|
|
2022-05-21 11:54:55 -06:00
|
|
|
include(FixInterfaceIncludes)
|
|
|
|
|
2019-04-30 21:16:54 -06:00
|
|
|
add_library(core STATIC
|
2022-05-21 11:54:55 -06:00
|
|
|
ARCodeFile.cpp
|
|
|
|
AREngine.cpp
|
|
|
|
ARM.cpp
|
|
|
|
ARM_InstrTable.h
|
|
|
|
ARMInterpreter.cpp
|
|
|
|
ARMInterpreter_ALU.cpp
|
|
|
|
ARMInterpreter_Branch.cpp
|
|
|
|
ARMInterpreter_LoadStore.cpp
|
|
|
|
CP15.cpp
|
|
|
|
CRC32.cpp
|
|
|
|
DMA.cpp
|
|
|
|
DMA_Timings.h
|
2023-10-24 15:27:55 -06:00
|
|
|
DMA_Timings.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
DSi.cpp
|
|
|
|
DSi_AES.cpp
|
|
|
|
DSi_Camera.cpp
|
|
|
|
DSi_DSP.cpp
|
|
|
|
DSi_I2C.cpp
|
|
|
|
DSi_NAND.cpp
|
|
|
|
DSi_NDMA.cpp
|
|
|
|
DSi_NWifi.cpp
|
|
|
|
DSi_SD.cpp
|
|
|
|
DSi_SPI_TSC.cpp
|
2023-10-11 09:20:05 -06:00
|
|
|
FATIO.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
FATStorage.cpp
|
|
|
|
FIFO.h
|
|
|
|
GBACart.cpp
|
|
|
|
GPU.cpp
|
|
|
|
GPU2D.cpp
|
|
|
|
GPU2D_Soft.cpp
|
|
|
|
GPU3D.cpp
|
|
|
|
GPU3D_Soft.cpp
|
|
|
|
melonDLDI.h
|
|
|
|
NDS.cpp
|
|
|
|
NDSCart.cpp
|
2023-12-15 00:19:53 -07:00
|
|
|
NDSCartR4.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
Platform.h
|
|
|
|
ROMList.h
|
2023-06-30 05:28:52 -06:00
|
|
|
ROMList.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
FreeBIOS.h
|
2023-09-18 13:09:11 -06:00
|
|
|
FreeBIOS.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
RTC.cpp
|
|
|
|
Savestate.cpp
|
|
|
|
SPI.cpp
|
2023-09-18 13:09:11 -06:00
|
|
|
SPI_Firmware.cpp
|
2022-05-21 11:54:55 -06:00
|
|
|
SPU.cpp
|
|
|
|
types.h
|
Refactor how save data (including SD cards) is initialized (#1898)
* Remove `FATStorage::Open` and `FATStorage::Close`
- That's what the constructor and destructor are for, respectively
* Add `FATStorage::IsReadOnly`
* Slight cleanup of `FATStorage`
- Make it move-constructible and move-assignable
- Represent the absence of a sync directory with `std::optional`, not an empty string
- Add `FATStorageArgs` for later use
* Refactor `CartHomebrew` to accept an optional `FATStorageArgs`
- `CartHomebrew` uses it to load an SD card image
- Not passing a `FATStorage` directly because we won't know if we need to load the card until we parse the ROM
- Store the `FATStorage` inside a `std::optional` instead of a pointer
- `CartHomebrew::Reset` no longer reloads the SD card; the frontend needs to set it with the `SetSDCard` method
* Close `NANDImage::CurFile` when move-assigning
- Whoops
* Add `Args.h`
- To construct a `NDS` or `DSi` with arguments
- Mostly intended for system files
* Fix incorrect `final` placement
* Refactor how `DSi`'s NAND and SD card are set
- Provide them via a `DSiArgs` argument in the constructor
- Give `DSi_MMCStorage` ownership of the `NANDImage` or `FATStorage` as needed, and expose getters/setters
- Replace `DSi_SDHost::Ports` with a `array<unique_ptr, 2>` to reduce the risk of leaks
- Store `DSi_MMCStorage`'s disk images in a `std::variant`
- The SD card and NAND image are no longer reset in `Reset()`; the frontend will need to do that itself
* Add getters/setters on `DSi` itself for its storage media
* Remove newly-unused `Platform::ConfigEntry`s
* Use `DSi::SetNAND` in the frontend
* Add `EmuThread::NeedToRecreateConsole`
* Document `NDSArgs` and give its fields default values
* Refactor how system files are loaded upon construction
- Pass `NDSArgs&&` into `NDS`'s constructor
- Use `std::array` for the emulator's BIOS images and the built-in FreeBIOS, to simplify copying and comparison
- Initialize the BIOS, firmware, and SD cards from `NDSArgs` or `DSiArgs`
- Add a new default constructor for `NDS` (not `DSi`) that initializes the DS with default system files
- Embed `FirmwareMem::Firmware` directly instead of in a `unique_ptr`
- `SPIHost` now takes a `Firmware&&` that it forwards to `FirmwareMem`
- Add `Firmware` getters/setters plus `const` variants for `NDS`, `Firmware`, and `FirmwareMem`
- Simplify installation of firmware
* Initialize the DSi BIOS in the constructor
- Change `DSi::ARM9iBIOS` and `ARM7iBIOS` to `std::array`
* Update the frontend to reflect the core's changes
* Remove `DSi_SDHost::CloseHandles`
* Pass `nullopt` instead of the empty string when folder sync is off
* Deduplicate ROM extraction logic
- `LoadGBAROM` and `LoadROM` now delegate to `LoadROMData`
- Also use `unique_ptr` instead of `new[]`
* Oops, missed some `get()`'s
* Move `NDS::IsLoadedARM9BIOSBuiltIn` to the header
- So it's likelier to be inlined
- Same for the ARM7 version
* Remove `NDS::SetConsoleType`
* Add `NDS::SetFirmware`
* Move `GBACart::SetupSave` to be `protected`
- It was only ever used inside the class
* Rename `GBACart::LoadSave` to `SetSaveMemory`
- Same for the cart slot
* Declare `GBACartSlot` as a friend of `GBACart::CartCommon`
* Revise `GBACartSlot`'s getters and setters
- Rename `InsertROM` and `LoadROM` to `SetCart`
- Add a `GetCart` method
* Clean up getters and setters for NDS and GBA carts
* Clean up how carts are inserted into the slots
- Remove setters that operate directly on pointers, to simplify error-handling (use ParseROM instead)
- Add overloads for all carts that accept a `const u8*` (to copy the ROM data) and a `unique_ptr<u8[]>` (to move the ROM data)
- Store all ROM and RAM data in `unique_ptr`
- Default-initialize all fields
- Simplify constructors and destructors, inheriting where applicable
* Refactor GBA save data insertion
- Make `SetupSave` private and non-virtual and move its logic to be in `SetSaveMemory`
- Add overloads for setting save data in the constructor
- Update the SRAM completely in `SetSaveMemory`
* Clean up `NDSCart::CartCommon::SetSaveMemory`
- Move its declaration next to the other `SaveMemory` methods
- Move its (empty) implementation to the header
* Add some comments
* Add Utils.cpp and Utils.h
* Rename some functions in Utils for clarity
* Add `GBACart::ParseROM` and `NDSCart::ParseROM` overloads that accept `unique_ptr<u8[]>`
- The `u8*` overloads delegate to these new overloads
- Also move `SetupSave` for both kinds of carts to be private non-virtual methods
* Finalize the `NDSCart` refactor
- Add `NDSCartArgs` to pass to `ParseROM`
- Add SRAM arguments for all retail carts
- Initialize SRAM inside the constructor
- Delegate to other constructors where possible
* Replace `ROMManager::NDSSave` and `GBASave` with `unique_ptr`
* Make both cart slots return the previously-inserted cart in `EjectCart`
- Primarily intended for reusing carts when resetting the console
* Make `NDS::EjectCart` return the old cart
* Initialize both cart slots with the provided ROM (if any)
* Make `NDS::EjectGBACart` return the ejected cart
* Clean up some comments in Args.h
* Rename `ROMManager::LoadBIOS` to `BootToMenu`
- Clarifies the intent
* Add `ROMManager::LoadDLDISDCard`
* Add a doc comment
* Refactor how the `NDS` is created or updated
- Rewrite `CreateConsole` to read from `Config` and load system files, but accept carts as arguments
- Fail without creating an `NDS` if any required system file doesn't load
- Add `UpdateConsole`, which delegates to `CreateConsole` if switching modes or starting the app
- Use `std::variant` to indicate whether a cart should be removed, inserted, or reused
- Load all system files (plus SD cards) in `UpdateConsole`
- Eject the cart and reinsert it into the new console if applicable
* Respect some more `Config` settings in the `Load*` functions
* Remove `InstallNAND` in favor of `LoadNAND`
* Fix some potential bugs in `LoadROMData`
* Oops, forgot to delete the definition of `InstallNAND`
* Add functions to get `FATStorageArgs`
- Not the cards themselves, but to get the arguments you _would_ use to load the cards
* Refactor `ROMManager::LoadROM`
- Load the ROM and save data before trying to initialize the console
* Clean up `ROMManager::Reset` and `BootToMenu`
- Let `EmuThread::UpdateConsole` do the heavy lifting
* Clean up `LoadGBAROM`
* Remove some unused functions
* Set the default DSi BIOS to be broken in `DSiArgs`
* Respect `Config::DSiFullBIOSBoot` when loading DSi BIOS files
* Remove some more unused functions
* Remove redundant `virtual` specifiers
* Refactor `NDSCart::CartCommon::Type()` to return a member instead of a constant
- One less virtual dispatch
- The cart type is read in `NDSCartSlot::DoSavestate`, which is a path downstream (due to rewinding)
* Remove a hash that I computed for debugging purposes
* Make `ByteSwap` `constexpr`
* Remove an unused `#include`
* Remove unnecessary functions from the NDS carts
- Mostly overrides that added nothing
* Default-initialize all NDSCart fields
* Make `GBACart::Type()` not rely on virtual dispatch
- `GBACartSlot::DoSavestate` calls it, and savestates can be a hot path downstream
* Don't forget to reset the base class in `CartGameSolarSensor::Reset()`
* Remove redundant `virtual` specifiers
* Default-initialize some fields in `GBACart`
* Fix ROMs not loading from archives in the frontend
- Whoops
* Change how the `Firmware` member is declared
* Forgot an include in Utils.cpp
* Rename `FirmwareMem::Firmware` to `FirmwareData` to fix a build error on Linux
- One of these days I'll convince you people to let me use `camelCaseMemberNames`
* Add `override` to places in `DSi_MMCStorage` that warrant it
* Fix firmware saving on the frontend
- Remove `GetConfigString` and `ConfigEntry::WifiSettingsPath` while I'm at it
* Add a non-const `GetNAND()`
2023-12-04 09:57:22 -07:00
|
|
|
Utils.cpp
|
|
|
|
Utils.h
|
2022-05-21 11:54:55 -06:00
|
|
|
version.h
|
|
|
|
Wifi.cpp
|
|
|
|
WifiAP.cpp
|
|
|
|
|
|
|
|
fatfs/ff.c
|
|
|
|
fatfs/ffsystem.c
|
|
|
|
fatfs/ffunicode.c
|
|
|
|
fatfs/ffconf.h
|
|
|
|
|
|
|
|
sha1/sha1.c
|
|
|
|
tiny-AES-c/aes.c
|
|
|
|
xxhash/xxhash.c)
|
2019-06-21 17:28:32 -06:00
|
|
|
|
2023-10-22 07:35:31 -06:00
|
|
|
if (ENABLE_GDBSTUB)
|
|
|
|
message(NOTICE "Enabling GDB stub")
|
|
|
|
target_sources(core PRIVATE
|
|
|
|
debug/GdbStub.cpp
|
|
|
|
debug/GdbProto.cpp
|
|
|
|
debug/GdbCmds.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-09-30 15:58:42 -06:00
|
|
|
if (ENABLE_OGLRENDERER)
|
2022-05-21 11:54:55 -06:00
|
|
|
target_sources(core PRIVATE
|
|
|
|
GPU_OpenGL.cpp
|
|
|
|
GPU_OpenGL_shaders.h
|
|
|
|
GPU3D_OpenGL.cpp
|
|
|
|
GPU3D_OpenGL_shaders.h
|
|
|
|
OpenGLSupport.cpp)
|
2022-10-17 14:55:11 -06:00
|
|
|
|
|
|
|
target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED)
|
2020-09-30 15:58:42 -06:00
|
|
|
endif()
|
|
|
|
|
2019-07-14 11:24:00 -06:00
|
|
|
if (ENABLE_JIT)
|
2022-05-21 11:54:55 -06:00
|
|
|
enable_language(ASM)
|
|
|
|
|
|
|
|
target_sources(core PRIVATE
|
|
|
|
ARM_InstrInfo.cpp
|
|
|
|
|
|
|
|
ARMJIT.cpp
|
|
|
|
ARMJIT_Memory.cpp
|
|
|
|
|
|
|
|
dolphin/CommonFuncs.cpp)
|
|
|
|
|
|
|
|
if (ARCHITECTURE STREQUAL x86_64)
|
|
|
|
target_sources(core PRIVATE
|
|
|
|
dolphin/x64ABI.cpp
|
|
|
|
dolphin/x64CPUDetect.cpp
|
|
|
|
dolphin/x64Emitter.cpp
|
|
|
|
|
|
|
|
ARMJIT_x64/ARMJIT_Compiler.cpp
|
|
|
|
ARMJIT_x64/ARMJIT_ALU.cpp
|
|
|
|
ARMJIT_x64/ARMJIT_LoadStore.cpp
|
|
|
|
ARMJIT_x64/ARMJIT_Branch.cpp
|
|
|
|
|
|
|
|
ARMJIT_x64/ARMJIT_Linkage.S)
|
|
|
|
endif()
|
|
|
|
if (ARCHITECTURE STREQUAL ARM64)
|
|
|
|
target_sources(core PRIVATE
|
|
|
|
dolphin/Arm64Emitter.cpp
|
|
|
|
dolphin/MathUtil.cpp
|
|
|
|
|
|
|
|
ARMJIT_A64/ARMJIT_Compiler.cpp
|
|
|
|
ARMJIT_A64/ARMJIT_ALU.cpp
|
|
|
|
ARMJIT_A64/ARMJIT_LoadStore.cpp
|
|
|
|
ARMJIT_A64/ARMJIT_Branch.cpp
|
|
|
|
|
|
|
|
ARMJIT_A64/ARMJIT_Linkage.S)
|
|
|
|
endif()
|
2019-07-14 11:24:00 -06:00
|
|
|
endif()
|
2019-04-30 21:16:54 -06:00
|
|
|
|
2021-06-06 10:27:26 -06:00
|
|
|
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
2022-10-12 12:49:15 -06:00
|
|
|
# Workaround for building teakra with -O0 on Windows either failing or hanging forever
|
|
|
|
target_compile_options(teakra PRIVATE "$<$<CONFIG:DEBUG>:-Og>")
|
2022-05-21 11:54:55 -06:00
|
|
|
target_link_libraries(core PRIVATE teakra)
|
2021-06-06 10:27:26 -06:00
|
|
|
|
2023-12-28 06:54:31 -07:00
|
|
|
if (NOT MSVC)
|
|
|
|
# MSVC has its own compiler flag syntax; if we ever support it,
|
|
|
|
# be sure to silence any equivalent warnings there.
|
|
|
|
|
|
|
|
target_compile_options(core PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>")
|
|
|
|
# These warnings are excessive, and are only triggered in the ARMJIT code
|
|
|
|
# (which is fundamentally non-portable, so this is fine)
|
|
|
|
endif()
|
|
|
|
|
2022-05-21 11:54:55 -06:00
|
|
|
find_library(m MATH_LIBRARY)
|
|
|
|
|
|
|
|
if (MATH_LIBRARY)
|
|
|
|
target_link_libraries(core PRIVATE ${MATH_LIBRARY})
|
|
|
|
endif()
|
2021-06-06 10:27:26 -06:00
|
|
|
|
2022-05-21 11:54:55 -06:00
|
|
|
if (ENABLE_JIT)
|
|
|
|
target_compile_definitions(core PUBLIC JIT_ENABLED)
|
|
|
|
|
|
|
|
if (ENABLE_JIT_PROFILING)
|
2023-04-12 17:46:10 -06:00
|
|
|
include(../cmake/FindVTune.cmake)
|
2022-05-21 11:54:55 -06:00
|
|
|
add_definitions(-DJIT_PROFILING_ENABLED)
|
2021-01-22 11:20:32 -07:00
|
|
|
endif()
|
2022-05-21 11:54:55 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (WIN32)
|
2023-10-22 07:35:31 -06:00
|
|
|
target_link_libraries(core PRIVATE ole32 comctl32 wsock32 ws2_32)
|
2024-02-07 15:15:30 -07:00
|
|
|
elseif(NOT APPLE AND NOT HAIKU)
|
2023-07-07 17:36:22 -06:00
|
|
|
check_library_exists(rt shm_open "" NEED_LIBRT)
|
|
|
|
if (NEED_LIBRT)
|
|
|
|
target_link_libraries(core PRIVATE rt)
|
|
|
|
endif()
|
2024-02-07 15:15:30 -07:00
|
|
|
elseif(HAIKU)
|
|
|
|
target_link_libraries(core PRIVATE network)
|
2021-01-11 15:01:23 -07:00
|
|
|
endif()
|
2021-07-24 08:20:03 -06:00
|
|
|
|
|
|
|
if (ENABLE_JIT_PROFILING)
|
2023-04-12 17:46:10 -06:00
|
|
|
target_include_directories(core PRIVATE "${VTUNE_INCLUDE_DIR}")
|
|
|
|
target_link_libraries(core PRIVATE "${VTUNE_LIBRARY}")
|
2021-12-29 10:13:22 -07:00
|
|
|
endif()
|
2023-10-22 07:35:31 -06:00
|
|
|
|
|
|
|
#if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
# set(
|
|
|
|
# CMAKE_C_FLAGS
|
|
|
|
# "${CMAKE_C_FLAGS} -fsanitize=undefined -fsanitize=address"
|
|
|
|
# )
|
|
|
|
# target_link_options(core
|
|
|
|
# BEFORE PUBLIC -fsanitize=undefined PUBLIC -fsanitize=address
|
|
|
|
# )
|
|
|
|
#endif()
|
|
|
|
|