Skip to content

Commit

Permalink
Allow adding a suffix to the displayed melonDS version
Browse files Browse the repository at this point in the history
  • Loading branch information
nadiaholmquist committed May 11, 2024
1 parent 10798c3 commit c85a210
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ add_library(core STATIC
types.h
Utils.cpp
Utils.h
version.h
Wifi.cpp
WifiAP.cpp

Expand Down Expand Up @@ -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>")
Expand Down
3 changes: 2 additions & 1 deletion src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "Platform.h"
#include "FreeBIOS.h"
#include "Args.h"
#include "version.h"

#include "DSi.h"
#include "DSi_SPI_TSC.h"
Expand Down Expand Up @@ -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]);
}
Expand Down
1 change: 1 addition & 0 deletions src/frontend/qt_sdl/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@

#include "Platform.h"
#include "Config.h"
#include "version.h"
#include "Savestate.h"
#include "LocalMP.h"

Expand Down
6 changes: 5 additions & 1 deletion src/version.h → src/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c85a210

Please sign in to comment.