Skip to content

Commit

Permalink
Introduces a very early debugger feature for quaesar (#25)
Browse files Browse the repository at this point in the history
* Introduces a very early debugger feature for quaesar

+ EASTL lib
+ added some not very functional debugger windows
+ CMake flags for VC Windows development

* removed old cpp files & format fixed

make clang & gcc happy

gcc compile errors fixed

* Fix ImGui cmake file for SDL include path
  • Loading branch information
dartfnm authored Oct 9, 2024
1 parent bf02f49 commit b021be8
Show file tree
Hide file tree
Showing 347 changed files with 122,408 additions and 742 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"[m68k]": {
"editor.rulers": []
},
"C_Cpp.formatting": "clangFormat",
"C_Cpp.clang_format_style": "file",
"C_Cpp.clang_format_fallbackStyle": "Google"
}
21 changes: 19 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ add_subdirectory(external/zlib)
add_subdirectory(external/ADFlib)
add_subdirectory(external/dear_imgui)
add_subdirectory(external/capstone)
add_subdirectory(external/EASTL)

if (APPLE OR LINUX OR UNIX)
find_package(SDL2 REQUIRED)
endif()


add_definitions(-DEASTL_EASTDC_VSNPRINTF=0)

if (WIN32)
add_definitions(-D_HAS_STD_BYTE=0)
if(MSVC) # Enable Edit and Continue for Debug builds
string(REGEX REPLACE "/Z[iI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI")
add_link_options("/INCREMENTAL")
endif()
endif()

include_directories(uae_src/include uae_src src .)
Expand Down Expand Up @@ -201,7 +210,8 @@ add_executable(quaesar

# Recursively glob for all .cpp files in the src directory
file(GLOB_RECURSE CROSS_FILES "src/*.cpp")
target_sources(quaesar PRIVATE ${CROSS_FILES})
file(GLOB_RECURSE QUAE_HEADERS "src/*.h")
target_sources(quaesar PRIVATE ${CROSS_FILES} ${QUAE_HEADERS})

if (APPLE OR LINUX OR UNIX)
target_compile_options(quaesar PRIVATE -DUAE=1 -D_cdecl= -DFILEFLAG_WRITE=1 -DOS_NAME=\"linux\")
Expand Down Expand Up @@ -235,4 +245,11 @@ target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/ADFlib/
target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/dear_imgui")
target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external")
target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/capstone/include")
target_link_libraries(quaesar PRIVATE ${SDL2_LIBRARIES} zlibstatic adf imgui capstone)
target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/EASTL/include")
target_link_libraries(quaesar PRIVATE ${SDL2_LIBRARIES} zlibstatic adf imgui capstone EASTL)


if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/imgui.ini")
file(COPY_FILE "${CMAKE_CURRENT_LIST_DIR}/bin/install/default_layout.ini" "${CMAKE_CURRENT_BINARY_DIR}/imgui.ini")
endif()

74 changes: 74 additions & 0 deletions bin/install/default_layout.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[Window][Quaesar debugger]
Pos=0,17
Size=1280,703
Collapsed=0

[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][Disassembly]
Pos=8,42
Size=320,670
Collapsed=0
DockId=0x00000001,0

[Window][Registers]
Pos=1011,42
Size=261,495
Collapsed=0
DockId=0x0000000A,0

[Window][Console]
Pos=330,539
Size=942,173
Collapsed=0
DockId=0x00000003,1

[Window][Screen]
Pos=330,42
Size=679,495
Collapsed=0
DockId=0x00000009,0

[Window][Palette]
Pos=1011,42
Size=261,495
Collapsed=0
DockId=0x0000000A,1

[Window][Memory graph]
Pos=330,42
Size=679,495
Collapsed=0
DockId=0x00000009,1

[Window][Memory]
Pos=330,539
Size=942,173
Collapsed=0
DockId=0x00000003,0

[Table][0x6038E043,3]
RefScale=13
Column 0 Width=70
Column 1 Width=84
Column 2 Width=175

[Table][0xF68F8465,4]
RefScale=13
Column 0 Width=14
Column 1 Width=70
Column 2 Width=14
Column 3 Width=70

[Docking][Data]
DockSpace ID=0x7A095824 Window=0xBB552D6F Pos=8,42 Size=1264,670 Split=X
DockNode ID=0x00000001 Parent=0x7A095824 SizeRef=320,670 Selected=0x19EDEE42
DockNode ID=0x00000004 Parent=0x7A095824 SizeRef=942,670 Split=Y
DockNode ID=0x00000002 Parent=0x00000004 SizeRef=1264,495 Split=X Selected=0x5B855092
DockNode ID=0x00000009 Parent=0x00000002 SizeRef=679,262 Selected=0x5B855092
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=261,262 Selected=0xEAEE9E08
DockNode ID=0x00000003 Parent=0x00000004 SizeRef=1264,173 CentralNode=1 Selected=0xB2805FDB

106 changes: 106 additions & 0 deletions external/EASTL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#-------------------------------------------------------------------------------------------
# Copyright (C) Electronic Arts Inc. All rights reserved.
#-------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.15)
#include(FetchContent)
project(EASTL CXX)

#-------------------------------------------------------------------------------------------
# Options
#-------------------------------------------------------------------------------------------
option(EASTL_BUILD_BENCHMARK "Enable generation of build files for benchmark" OFF)
option(EASTL_BUILD_TESTS "Enable generation of build files for tests" OFF)
option(EASTL_STD_ITERATOR_CATEGORY_ENABLED "Enable compatibility with std:: iterator categories" OFF)


option(EASTL_DISABLE_APRIL_2024_DEPRECATIONS "Enable use of API marked for removal in April 2024." OFF)
option(EASTL_DISABLE_SEPT_2024_DEPRECATIONS "Enable use of API marked for removal in September 2024." OFF)
option(EASTL_DISABLE_APRIL_2025_DEPRECATIONS "Enable use of API marked for removal in April 2025." OFF)

#-------------------------------------------------------------------------------------------
# Compiler Flags
#-------------------------------------------------------------------------------------------
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/scripts/CMake")
#include(CommonCppFlags)

#-------------------------------------------------------------------------------------------
# Library definition
#-------------------------------------------------------------------------------------------
file(GLOB EASTL_SOURCES "source/*.cpp")
file(GLOB_RECURSE EASTL_HEADERS "include/EASTL/**.h")
add_library(EASTL ${EASTL_SOURCES} ${EASTL_HEADERS})
target_compile_features(EASTL PUBLIC cxx_std_14)

# include both source and headers in the files tab in Visual Studio
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${EASTL_HEADERS})

if (MSVC)
set(EASTL_NATVIS_DIR "doc")
set(EASTL_NATVIS_FILE "${EASTL_NATVIS_DIR}/EASTL.natvis")
target_sources(EASTL INTERFACE
$<INSTALL_INTERFACE:${EASTL_NATVIS_FILE}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${EASTL_NATVIS_FILE}>
)
endif()

if(EASTL_BUILD_BENCHMARK)
add_subdirectory(benchmark)
endif()

if(EASTL_BUILD_TESTS)
add_subdirectory(test)
endif()

#-------------------------------------------------------------------------------------------
# Defines
#-------------------------------------------------------------------------------------------
add_definitions(-D_CHAR16T)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-DEASTL_OPENSOURCE=1)
if (EASTL_STD_ITERATOR_CATEGORY_ENABLED)
add_definitions(-DEASTL_STD_ITERATOR_CATEGORY_ENABLED=1)
endif()

#-------------------------------------------------------------------------------------------
# Include dirs
#-------------------------------------------------------------------------------------------
target_include_directories(EASTL PUBLIC include)

#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
#FetchContent_Declare(
# EABase
# GIT_REPOSITORY https://github.com/electronicarts/EABase.git
# GIT_TAG 123363eb82e132c0181ac53e43226d8ee76dea12
# GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase.
#)

#FetchContent_MakeAvailable(EABase)

#target_link_libraries(EASTL EABase)

#-------------------------------------------------------------------------------------------
# Deprecations
#-------------------------------------------------------------------------------------------
if(EASTL_DISABLE_APRIL_2024_DEPRECATIONS)
target_compile_definitions(EASTL PUBLIC EA_DEPRECATIONS_FOR_2024_APRIL=EA_DISABLED)
endif()
if(EASTL_DISABLE_SEPT_2024_DEPRECATIONS)
target_compile_definitions(EASTL PUBLIC EA_DEPRECATIONS_FOR_2024_SEPT=EA_DISABLED)
endif()
if(EASTL_DISABLE_APRIL_2025_DEPRECATIONS)
target_compile_definitions(EASTL PUBLIC EA_DEPRECATIONS_FOR_2025_APRIL=EA_DISABLED)
endif()


#-------------------------------------------------------------------------------------------
# Installation
#-------------------------------------------------------------------------------------------
install(TARGETS EASTL DESTINATION lib)
install(DIRECTORY include/EASTL DESTINATION include)

if (MSVC)
install(FILES ${EASTL_NATVIS_FILE} DESTINATION ${EASTL_NATVIS_DIR})
endif()
29 changes: 29 additions & 0 deletions external/EASTL/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2019, Electronic Arts
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit b021be8

Please sign in to comment.