diff --git a/CMakeLists.txt b/CMakeLists.txt index 2554e8f2..818f9680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,24 @@ cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) # Set the project version and language -project(Ghostship VERSION 0.1.0 LANGUAGES C CXX ASM) +project(Ghostship VERSION 1.0.0 LANGUAGES C CXX ASM) +include(FetchContent) + +set(NATO_PHONETIC_ALPHABET + "Alfa" "Bravo" "Charlie" "Delta" "Echo" "Foxtrot" "Golf" "Hotel" + "India" "Juliett" "Kilo" "Lima" "Mike" "November" "Oscar" "Papa" + "Quebec" "Romeo" "Sierra" "Tango" "Uniform" "Victor" "Whiskey" + "Xray" "Yankee" "Zulu" +) + +# Get the patch version number from the project version +math(EXPR PATCH_INDEX "${PROJECT_VERSION_PATCH}") + +# Use the patch number to select the correct word +list(GET NATO_PHONETIC_ALPHABET ${PATCH_INDEX} PROJECT_PATCH_WORD) + +set(PROJECT_BUILD_NAME "Barnard ${PROJECT_PATCH_WORD}" CACHE STRING "" FORCE) +set(PROJECT_TEAM "Lywx" CACHE STRING "" FORCE) if(APPLE) enable_language(OBJCXX) @@ -32,11 +49,6 @@ set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) endif() -if(NOT EXISTS ${CMAKE_BINARY_DIR}/config.yml) - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "${CMAKE_BINARY_DIR}/config.yml") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/assets/" "${CMAKE_BINARY_DIR}/assets/") -endif() - if (MSVC) set(CPP "${CMAKE_C_COMPILER}" "/EP") else() @@ -107,6 +119,8 @@ if (UNIX AND NOT APPLE) find_package(OpenGL REQUIRED) endif() +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY) + # Include directories include_directories( ${CMAKE_CURRENT_SOURCE_DIR} @@ -228,7 +242,6 @@ endif() # Libultraship Integration # #==============================================================================# - add_subdirectory(libultraship ${CMAKE_CURRENT_SOURCE_DIR}/libultraship) add_dependencies(${PROJECT_NAME} libultraship) target_link_libraries(${PROJECT_NAME} PRIVATE libultraship) @@ -291,8 +304,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") "$<$:SDL2_net::SDL2_net-static>" ) elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + find_package(SDL2) set(ADDITIONAL_LIBRARY_DEPENDENCIES -lglad + SDL2::SDL2 ) elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS") set(ADDITIONAL_LIBRARY_DEPENDENCIES @@ -336,6 +351,7 @@ nx_generate_nacp(${PROJECT_NAME}.nacp nx_create_nro(${PROJECT_NAME} NACP ${PROJECT_NAME}.nacp + ICON ${CMAKE_CURRENT_SOURCE_DIR}/nx-logo.jpg ) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.nro DESTINATION . COMPONENT ${PROJECT_NAME}) @@ -504,6 +520,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") else() if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") set(CPU_OPTION -msse2 -mfpmath=sse) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + set(CPU_OPTION -mcpu=native) endif() target_compile_options(${PROJECT_NAME} PRIVATE @@ -534,6 +552,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") endif() endif() +add_custom_command( + TARGET ${PROJECT_NAME} POST_BUILD + COMMENT "Copying asset yamls..." + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "$/config.yml" + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/assets/" "$/assets/" +) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") include(ExternalProject) ExternalProject_Add(TorchExternal @@ -551,25 +576,22 @@ add_custom_target( ExtractAssets DEPENDS TorchExternal WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${TORCH_EXECUTABLE} o2r baserom.jp.z64 + COMMAND ${TORCH_EXECUTABLE} o2r baserom.us.z64 COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/sm64.o2r" "${CMAKE_BINARY_DIR}/sm64.o2r" ) add_custom_target( - ExtractHeaders - DEPENDS TorchExternal - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${TORCH_EXECUTABLE} header -o baserom.jp.z64 -) - -add_custom_target( - GeneratePortOTR + GeneratePortO2R DEPENDS TorchExternal WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${TORCH_EXECUTABLE} pack port ghostship.o2r o2r COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/ghostship.o2r" "${CMAKE_BINARY_DIR}/ghostship.o2r" ) +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + install(FILES "${CMAKE_BINARY_DIR}/ghostship.o2r" DESTINATION . COMPONENT ${PROJECT_NAME}) +endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin") add_custom_target(CreateOSXIcons COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/ghostship.iconset diff --git a/ExecutableResource.h b/ExecutableResource.h new file mode 100644 index 00000000..8a193b3e --- /dev/null +++ b/ExecutableResource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Resource.rc +// +#define IDI_ICON1 111 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 113 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Resource.rc b/Resource.rc new file mode 100644 index 00000000..0fbd7982 --- /dev/null +++ b/Resource.rc @@ -0,0 +1,115 @@ +// Microsoft Visual C++ generated resource script. +// +#include "ExecutableResource.h" +#include "properties.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "ExecutableResource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Version Info +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VER_FILEVERSION + PRODUCTVERSION VER_PRODUCTVERSION + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", VER_COMPANYNAME_STR + VALUE "FileDescription", VER_FILEDESCRIPTION_STR + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", VER_INTERNALNAME_STR + VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR + VALUE "ProductName", VER_PRODUCTNAME_STR + VALUE "ProductVersion", VER_PRODUCTVERSION_str + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "ghostship.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "ghostship.manifest" + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Torch b/Torch index b5ed22ae..19b3ca70 160000 --- a/Torch +++ b/Torch @@ -1 +1 @@ -Subproject commit b5ed22ae838d252366e40b242a07639e0615acbe +Subproject commit 19b3ca70788dc5a9a0ea1fba62b4caa97674d6db diff --git a/ghostship.ico b/ghostship.ico new file mode 100644 index 00000000..afb3c9cf Binary files /dev/null and b/ghostship.ico differ diff --git a/ghostship.manifest b/ghostship.manifest new file mode 100644 index 00000000..6f47a937 --- /dev/null +++ b/ghostship.manifest @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + permonitorv2,permonitor + + + diff --git a/logo.png b/logo.png index 56ddadf1..ed29996f 100644 Binary files a/logo.png and b/logo.png differ diff --git a/nx-logo.jpg b/nx-logo.jpg new file mode 100644 index 00000000..a15838e8 Binary files /dev/null and b/nx-logo.jpg differ diff --git a/properties.h b/properties.h new file mode 100644 index 00000000..eb51cb99 --- /dev/null +++ b/properties.h @@ -0,0 +1,14 @@ + +#define VER_FILEVERSION 1, 0, 0, 0 +#define VER_FILEVERSION_STR "1.0.0\0" + +#define VER_PRODUCTVERSION 1, 0, 0, 0 +#define VER_PRODUCTVERSION_str "1.0.0\0" + +#define VER_COMPANYNAME_STR "Lywx\0" +#define VER_PRODUCTNAME_STR "Ghostship\0" + +#define VER_INTERNALNAME_STR "Ghostship\0" +#define VER_ORIGINALFILENAME_STR "Ghostship.exe\0" + +#define VER_FILEDESCRIPTION_STR "Ghostship - Barnard Alfa\0" diff --git a/properties.h.in b/properties.h.in new file mode 100644 index 00000000..c0b09749 --- /dev/null +++ b/properties.h.in @@ -0,0 +1,14 @@ + +#define VER_FILEVERSION @CMAKE_PROJECT_VERSION_MAJOR@, @CMAKE_PROJECT_VERSION_MINOR@, @CMAKE_PROJECT_VERSION_PATCH@, 0 +#define VER_FILEVERSION_STR "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@\0" + +#define VER_PRODUCTVERSION @CMAKE_PROJECT_VERSION_MAJOR@, @CMAKE_PROJECT_VERSION_MINOR@, @CMAKE_PROJECT_VERSION_PATCH@, 0 +#define VER_PRODUCTVERSION_str "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@\0" + +#define VER_COMPANYNAME_STR "@PROJECT_TEAM@\0" +#define VER_PRODUCTNAME_STR "Ghostship\0" + +#define VER_INTERNALNAME_STR "@PROJECT_NAME@\0" +#define VER_ORIGINALFILENAME_STR "@PROJECT_NAME@.exe\0" + +#define VER_FILEDESCRIPTION_STR "Ghostship - @PROJECT_BUILD_NAME@\0"