exosphere: add new ConfigItem which allows the caller to retrieve the git commit hash. (#493)

This commit is contained in:
thedax 2019-03-29 18:16:03 -04:00 committed by SciresM
parent 81aa5c7ec7
commit fd4d6a4e55
3 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,7 @@ TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/devkitA64/base_rules
AMSBRANCH := $(shell git symbolic-ref --short HEAD)
AMSHASH = $(shell git rev-parse --short=16 HEAD)
AMSREV := $(AMSBRANCH)-$(shell git rev-parse --short HEAD)
ifneq (, $(strip $(shell git status --porcelain 2>/dev/null)))
@ -33,7 +34,7 @@ INCLUDES := include ../common/include
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a -mtune=cortex-a57 -mgeneral-regs-only #<- important
DEFINES := -D__CCPLEX__ -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\"
DEFINES := -D__CCPLEX__ -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\" -DATMOSPHERE_RELEASE_VERSION_HASH="0x$(AMSHASH)"
CFLAGS := \
-g \
-O2 \

View File

@ -260,6 +260,10 @@ uint32_t configitem_get(bool privileged, ConfigItem item, uint64_t *p_outvalue)
/* UNOFFICIAL: The fact that we are executing means we aren't in the process of shutting down. */
*p_outvalue = 0;
break;
case CONFIGITEM_EXOSPHERE_VERHASH:
/* UNOFFICIAL: Gets information about the current exosphere git commit hash. */
*p_outvalue = ATMOSPHERE_RELEASE_VERSION_HASH;
break;
default:
result = 2;
break;

View File

@ -43,6 +43,7 @@ typedef enum {
CONFIGITEM_EXOSPHERE_VERSION = 65000,
CONFIGITEM_NEEDS_REBOOT = 65001,
CONFIGITEM_NEEDS_SHUTDOWN = 65002,
CONFIGITEM_EXOSPHERE_VERHASH = 65003,
} ConfigItem;
#define REBOOT_KIND_NO_REBOOT 0