Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
777 changes: 403 additions & 374 deletions docs/CHANGELOG.md → CHANGELOG.md

Large diffs are not rendered by default.

121 changes: 80 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ set(LIBSAMPLERATE_ENABLE_SINC_BEST_CONVERTER FALSE CACHE BOOL "[libsamplerate] E
# does not set mt vs md

# Configure MFC
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
# Debug build requires dynamic MFC.
set(STATIC_MSVCRT 0)
else ()
# Otherwise link MFC statically.
set(STATIC_MSVCRT 1)
endif ()
# Debug build requires dynamic MFC.
# Otherwise link MFC statically.
set(STATIC_MSVCRT $<NOT:$<CONFIG:Debug>>)

include(cmake/mfc.cmake)

# Acts like add_subdirectory(), but replaces Debug flags with RelWithDebugInfo flags.
Expand All @@ -45,20 +42,75 @@ add_subdirectory_optimized("Source/libsamplerate" EXCLUDE_FROM_ALL)
# compiling
include(cmake/exe.cmake)

# builds the .chm file
add_custom_command(TARGET ${exe}
PRE_BUILD
COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compile-chm.bat
COMMAND move Dn-Famitracker.chm ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating help file...")
find_package(Python 3.10)

# update version in Dn-FamiTracker.rc
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Dn-FamiTracker.rc
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.h
COMMAND ${Python_EXECUTABLE} resource_version_update.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Updating version info in resource file."
VERBATIM)

# generate HTMLDefines.h
set(DNHELP_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Dn-help/hlp")
add_custom_command(
OUTPUT ${DNHELP_SRC_DIR}/HTMLDefines.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND call ${CMAKE_CURRENT_SOURCE_DIR}/generate-helpmap.bat
COMMENT "Generating map file for help compiler."
VERBATIM)

# build the .chm file
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${project}.chm
DEPENDS ${DNHELP_SRC_DIR}/HTMLDefines.h
WORKING_DIRECTORY ${DNHELP_SRC_DIR}
COMMAND call ${DNHELP_SRC_DIR}/compile-chm.bat ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Making help file."
VERBATIM)

# update changelog
add_custom_command(
OUTPUT ${DNHELP_SRC_DIR}/changelog.htm
DEPENDS ${DNHELP_SRC_DIR}/changelog-shell.htm
CHANGELOG.md
WORKING_DIRECTORY ${DNHELP_SRC_DIR}
COMMAND call ${DNHELP_SRC_DIR}/update-changelog-htm.bat
COMMENT "Updating changelog.htm."
VERBATIM)

# builds the NSF driver
add_custom_command(TARGET ${exe}
PRE_BUILD
COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}/Source/drivers/build.cmd
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Compiling NSF driver...")
set(DNNSF_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Source/drivers")
add_custom_command(
OUTPUT ${DNNSF_SRC_DIR}/drv_2a03.h
${DNNSF_SRC_DIR}/drv_all.h
${DNNSF_SRC_DIR}/drv_fds.h
${DNNSF_SRC_DIR}/drv_mmc5.h
${DNNSF_SRC_DIR}/drv_n163.h
${DNNSF_SRC_DIR}/drv_s5b.h
${DNNSF_SRC_DIR}/drv_vrc6.h
${DNNSF_SRC_DIR}/drv_vrc7.h
DEPENDS ${DNNSF_SRC_DIR}/asm/longbranch.mac
${DNNSF_SRC_DIR}/asm/init.s
${DNNSF_SRC_DIR}/asm/player.s
${DNNSF_SRC_DIR}/asm/effects.s
${DNNSF_SRC_DIR}/asm/instrument.s
${DNNSF_SRC_DIR}/asm/apu.s
${DNNSF_SRC_DIR}/asm/vrc6.s
${DNNSF_SRC_DIR}/asm/vrc7.s
${DNNSF_SRC_DIR}/asm/mmc5.s
${DNNSF_SRC_DIR}/asm/fds.s
${DNNSF_SRC_DIR}/asm/n163.s
${DNNSF_SRC_DIR}/asm/s5b.s
${DNNSF_SRC_DIR}/asm/periods.s
${DNNSF_SRC_DIR}/asm/vibrato.s
COMMAND call ${DNNSF_SRC_DIR}/build.cmd
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Building NSF driver headers."
VERBATIM)

target_compile_features(${exe} PRIVATE cxx_std_17)

Expand All @@ -71,27 +123,14 @@ endif()

# linking
# Specify static MFC libraries nafxcw and Libcmt to avoid linker order issues
if (STATIC_MSVCRT)
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
TARGET_LINK_LIBRARIES(${exe}
Dbghelp winmm comctl32 Avrt Version htmlhelp
samplerate nafxcwd Libcmtd)
else ()
TARGET_LINK_LIBRARIES(${exe}
Dbghelp winmm comctl32 Avrt Version htmlhelp
samplerate nafxcw Libcmt)
endif ()
else ()
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
TARGET_LINK_LIBRARIES(${exe}
Dbghelp winmm comctl32 Avrt Version htmlhelp
samplerate MSVCRTD)
else ()
TARGET_LINK_LIBRARIES(${exe}
Dbghelp winmm comctl32 Avrt Version htmlhelp
samplerate MSVCRT)
endif ()
endif ()
set(static_msvcrt_libs "nafxcw$<$<CONFIG:Debug>:d>;libcmt$<$<CONFIG:Debug>:d>")
set(dynamic_msvcrt_libs "msvcrt$<$<CONFIG:Debug>:d>")

target_link_libraries(${exe}
$<IF:$<BOOL:STATIC_MSVCRT>,${static_msvcrt_libs},${dynamic_msvcrt_libs}>)

target_link_libraries(${exe}
Dbghelp winmm comctl32 Avrt Version htmlhelp samplerate)

# Dn-FamiTracker.rc includes res/Dn-FamiTracker.manifest.
# To prevent manifest linking errors:
Expand All @@ -104,7 +143,7 @@ set_property(
)

# Generating .pdb files
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_BUILD_TYPE MATCHES "Release")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND $<CONFIG:Release>)
target_compile_options(${exe} PRIVATE /Zi)

# Tell linker to include symbol data
Expand Down
86 changes: 48 additions & 38 deletions docs/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,7 @@

Welcome! Thank you for considering to contribute to Dn-FamiTracker. We really need all the help we can get, since there aren't many people who help maintain FamiTracker and its forks. The following serves as a guide to those who want to get started with contributing.

## Code Guidelines and Formatting

- The code mostly follows Unix style (LF) line endings and TAB indentation format.
- Remove trailing whitespace whenever you edit nearby lines.
- There is not much documentation regarding the FamiTracker source code, so you might need to do some code reading first before you implement or modify a component.
- Document Dn-FamiTracker code behavior as much as possible whenever you are learning about them, this may be useful to other contributors.
- FamiTracker (and most of its forks) is an MFC application with project files made in Visual Studio. Dn-FamiTracker supports being built by Visual Studio and CMake, so if you have implemented a change, be sure to update the CMake files as required.
- If implementing a new feature that affects tracker behavior (such as effects, UI), please update documentation in Dn-help and other areas of the tracker.
- If implementing a new feature that affects file formats (such as envelopes, new data format storage), ***please increment the respective file block version***.
- if this necessitates a new file block, please increment the module file version.

## Git guidelines

- Write pull requests that passes CI builds and tests.
- Make sure to adhere to the [pull request template](Dn-FamiTracker/docs/pull_request_template.md) message guidelines.
- Base your pull request on the `main` branch.
- If a merge conflict happens due to not being updated in a long time, resolve merge conflicts and rebase your pull request to the latest compatible version of the `main` branch.
- Be sure to update [Dn-help](https://github.com/Dn-Programming-Core-Management/Dn-help) on your pull request as needed.
- Create a corresponding pull request on Dn-help that links to your main pull request.
- Then once the PR in Dn-help is merged, update the submodule to point to the main branch

### For Dn-FT maintainers:

- ***Do not push directly to the `main` branch***. Instead, push your changes to a branch first before writing a pull request.
- These branches are designated to be reoccurring may be used for the following:
- `app-emu-module-nsf_driver-dev`
- This branch is for modifying the application itself, such as the NSF driver, the module format, loading and saving code, emulator core, audio drivers, etc.
- `docs-license-ver-meta-dev`
- This branch is for meta related development, such as documentation, updating icons and logos, updating version info and license year text, etc.
- `ci-dev`
- This branch is for continuous integration development, such as GitHub Actions and AppVeyor.
- You will most likely force push this branch to hell and back, so be sure to do it on your own fork repo.
- Other branches may be made for more niche/specific modifications and fixes.
- If your pull request touches two or more of these categories, it's fine but please keep it minimal.
- Otherwise, create a new branch.
---

## Dependencies and Building

Expand All @@ -52,7 +18,7 @@ To edit and/or build the source, you may use Visual Studio 2022, or alternativel
- For miscellaneous custom build scripts:
- [Python 3.10+](https://www.python.org/)
- For any IDE that supports building via CMake:
- CMake
- CMake version 3.16+
- The latest MSVC build tools
- may be installed by VS Installer or by other sources
- Windows 11 SDK (10.0.26100.0)
Expand All @@ -63,17 +29,61 @@ To edit and/or build the source, you may use Visual Studio 2022, or alternativel
- For Visual Studio 2022:
- Windows Universal CRT SDK
- The **Desktop development with C++** workload, including:
- MSVC v142 - VS 2019 C++ x64/x86 build tools (latest version)
- MSVC v143 - VS 2022 C++ x64/x86 build tools (latest version)
- C++ CMake tools for Windows
- C++ AddressSanitizer
- C++ ATL for latest v143 build tools (x86 & x64)
- C++ MFC for latest v143 build tools (x86 & x64)
- Windows 10 SDK version 2104 (10.0.20348.0)
- Windows 11 SDK (10.0.26100.0)
- Alternatively, you can install the components mentioned via the [provided .vsconfig file](../Dn-FT_VS_Dependencies.vsconfig).

---

## Code Guidelines and Formatting

- The code mostly follows Unix style (LF) line endings and TAB indentation format.
- Remove trailing whitespace whenever you edit nearby lines.
- Document Dn-FamiTracker code behavior as much as possible whenever you are learning about them, this may be useful to other contributors.
- There is not much documentation regarding the FamiTracker source code, so you might need to do some code reading first before you implement or modify a component.
- FamiTracker (and most of its forks) is an MFC application with project files made in Visual Studio. Dn-FamiTracker supports being built by Visual Studio and CMake, so if you have implemented a change, be sure to ***update the CMake files as required***.
- If implementing a new feature that affects tracker behavior (such as effects, UI), please ***update documentation*** in Dn-help and other areas of the tracker.
- If implementing a new feature that affects file formats (such as envelopes, new data format storage), ***please increment the respective file block version***.
- if this necessitates a new file block, please increment the module file version.

---

## Git guidelines

- Write pull requests that passes CI builds and tests.
- Make sure to adhere to the [pull request template](Dn-FamiTracker/docs/pull_request_template.md) message guidelines.
- Base your pull request on the `main` branch.
- If a merge conflict happens due to not being updated in a long time, resolve merge conflicts and rebase your pull request to the latest compatible version of the `main` branch.
- Be sure to update [Dn-help](https://github.com/Dn-Programming-Core-Management/Dn-help) on your pull request as needed.
- Create a corresponding pull request on Dn-help that links to your main pull request.
- Then once the PR in Dn-help is merged, update the submodule to point to the main branch

---

## Important Things to Note

- When committing changes, ***file extension case must be the same as the original file!***
- This might result in merge conflicts, because Git is case sensitive, but in Windows systems, the file system is case insensitive by default.
- Additionally, case sensitivity in Windows can be enabled through WSL, but it **must only be enabled to resolve merge conflicts regarding file extension case sensitivity**.
- If case sensitivity is left enabled, Visual Studio throws a lot of errors due to the way IntelliSense capitalizes paths internally.

---

## For D.P.C.M. maintainers

- ***Do not push directly to the `main` branch***. Instead, push your changes to a branch first before writing a pull request.
- These branches are designated to be reoccurring may be used for the following:
- `app-emu-module-nsf_driver-dev`
- This branch is for modifying the application itself, such as the NSF driver, the module format, loading and saving code, emulator core, audio drivers, etc.
- `docs-license-ver-meta-dev`
- This branch is for meta related development, such as documentation, updating icons and logos, updating version info and license year text, etc.
- `ci-dev`
- This branch is for continuous integration development, such as GitHub Actions and AppVeyor.
- You will most likely force push this branch to hell and back, so be sure to do it on your own fork repo.
- Other branches may be made for more niche/specific modifications and fixes.
- If your pull request touches two or more of these categories, it's fine but please keep it minimal.
- Otherwise, create a new branch.
2 changes: 1 addition & 1 deletion Dn-FT_VS_Dependencies.vsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Microsoft.VisualStudio.Component.VC.ATL.Spectre",
"Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.Windows10SDK.20348",
"Microsoft.VisualStudio.Component.Windows11SDK.26100",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre"
Expand Down
Loading