Allow adding a suffix to the displayed melonDS version

This commit is contained in:
Nadia Holmquist Pedersen 2024-05-11 22:40:45 +02:00
parent 10798c3464
commit c85a2103bb
5 changed files with 14 additions and 5 deletions

View File

@ -34,8 +34,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_compile_definitions(MELONDS_VERSION="${melonDS_VERSION}")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")

View File

@ -52,7 +52,6 @@ add_library(core STATIC
types.h
Utils.cpp
Utils.h
version.h
Wifi.cpp
WifiAP.cpp
@ -123,6 +122,12 @@ if (ENABLE_JIT)
endif()
endif()
set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h")
target_sources(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/version.h")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
add_subdirectory(teakra EXCLUDE_FROM_ALL)
# Workaround for building teakra with -O0 on Windows either failing or hanging forever
target_compile_options(teakra PRIVATE "$<$<CONFIG:DEBUG>:-Og>")

View File

@ -35,6 +35,7 @@
#include "Platform.h"
#include "FreeBIOS.h"
#include "Args.h"
#include "version.h"
#include "DSi.h"
#include "DSi_SPI_TSC.h"
@ -2839,7 +2840,7 @@ u8 NDS::ARM9IORead8(u32 addr)
if(addr >= 0x04FFFA00 && addr < 0x04FFFA10)
{
// FIX: GBATek says this should be padded with spaces
static char const emuID[16] = "melonDS " MELONDS_VERSION;
static char const emuID[16] = "melonDS " MELONDS_VERSION_BASE;
auto idx = addr - 0x04FFFA00;
return (u8)(emuID[idx]);
}

View File

@ -72,6 +72,7 @@
#include "Platform.h"
#include "Config.h"
#include "version.h"
#include "Savestate.h"
#include "LocalMP.h"

View File

@ -19,7 +19,11 @@
#ifndef VERSION_H
#define VERSION_H
#define MELONDS_URL "https://melonds.kuribo64.net/"
#define MELONDS_URL "${melonDS_HOMEPAGE_URL}"
#define MELONDS_VERSION_BASE "${melonDS_VERSION}"
#define MELONDS_VERSION_SUFFIX "${MELONDS_VERSION_SUFFIX}"
#define MELONDS_VERSION MELONDS_VERSION_BASE MELONDS_VERSION_SUFFIX
#endif // VERSION_H