mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-22 07:04:47 -04:00
Add version and debug state (#437)
* cmake: Correctly set PROJECT_VERSION This needs CI to adjust Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Log version Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Show version and debug state Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Log debug mode toggling Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Finish version string Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Update CMakeLists.txt * Update CMakeLists.txt * Try to fix execute_process() from within CI Signed-off-by: Thomas Rohloff <v10lator@myway.de> * CI: Checkout with tags Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Fix PR CIs, too Signed-off-by: Thomas Rohloff <v10lator@myway.de> * Add config button for version Signed-off-by: Thomas Rohloff <v10lator@myway.de> --------- Signed-off-by: Thomas Rohloff <v10lator@myway.de> Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
@@ -10,6 +10,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Update machine
|
||||
run: sudo apt update
|
||||
|
||||
@@ -10,6 +10,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: brew install ninja cmake
|
||||
|
||||
@@ -50,6 +50,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -80,6 +82,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: brew install ninja cmake
|
||||
@@ -116,6 +120,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Update machine
|
||||
run: sudo apt update
|
||||
@@ -205,6 +211,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Update machine
|
||||
run: sudo apt update
|
||||
@@ -306,8 +314,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Docker caching
|
||||
uses: ScribeMD/docker-cache@0.5.0
|
||||
id: cache
|
||||
@@ -330,6 +339,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
@@ -10,6 +10,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: recursive
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -20,4 +22,4 @@ jobs:
|
||||
with:
|
||||
name: spaghetti-windows
|
||||
path: ./build/x64/Debug
|
||||
retention-days: 1
|
||||
retention-days: 1
|
||||
|
||||
+18
-4
@@ -11,6 +11,22 @@ set(NATO_PHONETIC_ALPHABET
|
||||
"Xray" "Yankee" "Zulu"
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git describe --tags
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE PROJECT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REPLACE "-" ";" PROJECT_VERSION_LIST "${PROJECT_VERSION}")
|
||||
list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_PATCH)
|
||||
string(REPLACE "." ";" PROJECT_VERSION_LIST "${PROJECT_VERSION_PATCH}")
|
||||
list(LENGTH PROJECT_VERSION_LIST PROJECT_VERSION_LIST_LENGTH)
|
||||
if (${PROJECT_VERSION_LIST_LENGTH} LESS 3)
|
||||
set(PROJECT_VERSION_PATCH 0)
|
||||
else()
|
||||
list(GET PROJECT_VERSION_LIST 2 PROJECT_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
# Get the patch version number from the project version
|
||||
math(EXPR PATCH_INDEX "${PROJECT_VERSION_PATCH}")
|
||||
|
||||
@@ -35,9 +51,6 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
|
||||
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
|
||||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Spaghettify)
|
||||
set(PROJECT_TEAM "MegaMech")
|
||||
set(PROJECT_VERSION_MAJOR 1)
|
||||
set(PROJECT_VERSION_MINOR 0)
|
||||
set(PROJECT_VERSION_PATCH 0)
|
||||
#add_compile_options(-fsanitize=address)
|
||||
#add_link_options(-fsanitize=address)
|
||||
|
||||
@@ -125,6 +138,7 @@ add_compile_definitions(
|
||||
NON_MATCHING=1
|
||||
NON_EQUIVALENT=1
|
||||
AVOID_UB=1
|
||||
SPAGHETTI_VERSION="${PROJECT_VERSION}"
|
||||
)
|
||||
|
||||
# Find necessary libraries
|
||||
@@ -453,7 +467,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch")
|
||||
nx_generate_nacp(${PROJECT_NAME}.nacp
|
||||
NAME "${PROJECT_NAME}"
|
||||
AUTHOR "${PROJECT_TEAM}"
|
||||
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
)
|
||||
|
||||
nx_create_nro(${PROJECT_NAME}
|
||||
|
||||
@@ -6366,6 +6366,24 @@ void add_menu_item(s32 type, s32 column, s32 row, s8 priority) {
|
||||
GLOBAL_ASM("asm/non_matchings/menu_items/add_menu_item.s")
|
||||
#endif
|
||||
|
||||
static void draw_debug(void) {
|
||||
if (CVarGetInteger("gEnableDebugMode", 0) != 0) {
|
||||
set_text_color(TEXT_RED);
|
||||
print_text1_right(0x138, 0xEA, "DEBUG", 0, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_version(void) {
|
||||
s32 column = 0x138;
|
||||
|
||||
if (CVarGetInteger("gEnableDebugMode", 0) != 0) {
|
||||
column -= (s32) ((f32) (get_string_width("DEBUG") + 5 )) * 0.5f;
|
||||
}
|
||||
|
||||
set_text_color(TEXT_GREEN);
|
||||
print_text1_right(column, 0xEA, SPAGHETTI_VERSION, 0, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// https://decomp.me/scratch/MatRp
|
||||
// Biggest diff left is in the case 0x12 though 0x19 handling. Not really sure what's going on there
|
||||
@@ -6508,6 +6526,10 @@ void render_menus(MenuItem* arg0) {
|
||||
case MENU_ITEM_UI_GAME_SELECT:
|
||||
gDisplayListHead =
|
||||
render_menu_textures(gDisplayListHead, seg2_game_select_texture, arg0->column, arg0->row);
|
||||
if (CVarGetInteger("gShowSpaghettiVersion", true)) {
|
||||
draw_version();
|
||||
draw_debug();
|
||||
}
|
||||
break;
|
||||
case MENU_ITEM_UI_1P_GAME:
|
||||
case MENU_ITEM_UI_2P_GAME:
|
||||
|
||||
@@ -199,6 +199,9 @@ GameEngine::GameEngine() {
|
||||
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
|
||||
#endif
|
||||
|
||||
SPDLOG_INFO("Spaghetti Kart " SPAGHETTI_VERSION);
|
||||
SPDLOG_INFO(CVarGetInteger("gEnableDebugMode", 0) == 0 ? "Debug Mode deactivated" : "Debug Mode activated");
|
||||
|
||||
wnd->SetRendererUCode(ucode_f3dex);
|
||||
this->context->InitGfxDebugger();
|
||||
|
||||
|
||||
@@ -379,6 +379,10 @@ void PortMenu::AddEnhancements() {
|
||||
|
||||
AddWidget(path, "Harder CPU", WIDGET_CVAR_CHECKBOX).CVar("gHarderCPU");
|
||||
|
||||
AddWidget(path, "Show Spaghetti version", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar("gShowSpaghettiVersion")
|
||||
.Options(CheckboxOptions().Tooltip("Show the Spaghetti Kart version on the Mario Kart menu").DefaultValue(true));
|
||||
|
||||
path = { "Enhancements", "Cheats", SECTION_COLUMN_1 };
|
||||
AddSidebarEntry("Enhancements", "Cheats", 3);
|
||||
AddWidget(path, "Moon Jump", WIDGET_CVAR_CHECKBOX).CVar("gEnableMoonJump");
|
||||
@@ -438,6 +442,9 @@ void PortMenu::AddDevTools() {
|
||||
.Options(CheckboxOptions().Tooltip("Changes the menu display from overlay to windowed."));
|
||||
AddWidget(path, "Debug Mode", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar("gEnableDebugMode")
|
||||
.Callback([](WidgetInfo& info) {
|
||||
SPDLOG_INFO(CVarGetInteger("gEnableDebugMode", 0) == 0 ? "Debug Mode deactivated" : "Debug Mode activated");
|
||||
})
|
||||
.Options(CheckboxOptions().Tooltip("Enables Debug Mode."));
|
||||
AddWidget(path, "Modify Interpolation Target FPS", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar("gModifyInterpolationTargetFPS")
|
||||
|
||||
Reference in New Issue
Block a user