Skip to content

Commit

Permalink
added git build version to the settings menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dimok789 committed May 12, 2016
1 parent a0c73ed commit bfed87d
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
/udp_debug_reader/GeckoLog.txt
/installer/sd_loader.h
/languages/*.pot
/src/gitrev.c
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
FILELIST := $(shell bash ./filelist.sh)
GIT_REV := $(shell bash ./gitrev.sh)
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
export HFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.h)))
Expand Down
46 changes: 46 additions & 0 deletions gitrev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /bin/bash
#
rev_new=$(git rev-parse --short=7 HEAD)

rev_old=$(cat ./src/gitrev.c 2>/dev/null | tr -d '\n' | awk -F"\"" '{print $2}' | awk -F"\"" '{print $1}')


if [ "$rev_new" != "$rev_old" ] || [ ! -f ./src/gitrev.c ]; then

if [ -n "$rev_new" ]; then
echo "Changed Rev $rev_old to $rev_new" >&2
fi

cat <<EOF > ./src/gitrev.c
#define GIT_REV "$rev_new"
const char *GetRev()
{
return GIT_REV;
}
EOF

rev_date=`date -u +%Y%m%d%H%M%S`

cat <<EOF > ./meta/meta.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1">
<name>Loadiine GX2</name>
<coder>Dimok, Maschell, n1ghty, dibas</coder>
<version>0.3 r$rev_new</version>
<release_date>$rev_date</release_date>
<short_description>WiiU game loader</short_description>
<long_description>Loads games from SD card.
Compatibility list:
http://wiki.gbatemp.net/wiki/Loadiine_compatibility_list
Sources:
https://github.com/dimok789/loadiine_gx2
</long_description>
</app>
EOF

fi

echo $rev_new
7 changes: 3 additions & 4 deletions meta/meta.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1">
<name>Loadiine GX2</name>
<coder>Dimok</coder>
<version>0.3</version>
<release_date>20160328120000</release_date>
<coder>Dimok, Maschell, n1ghty, dibas</coder>
<version>0.3 ra0c73ed</version>
<release_date>20160512174132</release_date>
<short_description>WiiU game loader</short_description>
<long_description>Loads games from SD card.

Expand All @@ -13,5 +13,4 @@
Sources:
https://github.com/dimok789/loadiine_gx2
</long_description>

</app>
14 changes: 14 additions & 0 deletions src/gitrev.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef __GITREV_H_
#define __GITREV_H_

#ifdef __cplusplus
extern "C" {
#endif

const char *GetRev();

#ifdef __cplusplus
}
#endif

#endif // __GITREV_H_
3 changes: 2 additions & 1 deletion src/menu/SettingsMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "SettingsCategoryMenu.h"
#include "settings/SettingsDefs.h"
#include "settings/SettingsEnums.h"
#include "gitrev.h"

static const float smallIconScale = 0.4f;

Expand Down Expand Up @@ -123,7 +124,7 @@ SettingsMenu::SettingsMenu(int w, int h)
versionText.setFontSize(42);
versionText.setAlignment(ALIGN_TOP | ALIGN_RIGHT);
versionText.setPosition(-50, -80);
versionText.setText("Loadiine GX2 " LOADIINE_VERSION);
versionText.setTextf("Loadiine GX2 %s (build %s)", LOADIINE_VERSION, GetRev());
categorySelectionFrame.append(&versionText);

const u32 cuCategoriesCount = sizeof(stSettingsCategories) / sizeof(stSettingsCategories[0]);
Expand Down

1 comment on commit bfed87d

@mariogamer2
Copy link

@mariogamer2 mariogamer2 commented on bfed87d May 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to create a file to do this,see: roxas75/rxTools@81566b7 ( the CFLAGS can be not the same,since it's not the same console)

EDIT: Ah.ok it's for editing the XML file... But you can "short" it.

Please sign in to comment.