Update calcrom.cpp

This commit is contained in:
PikalaxALT 2020-05-26 20:46:10 -04:00
parent c9ccaa3ed1
commit b1c99b0d05
3 changed files with 16 additions and 6 deletions

View File

@ -1 +1,2 @@
calcrom
*.exe

View File

@ -11,7 +11,10 @@
* - Must be placed in ".travis/calcrom/".
*
* Changelog:
* - 1.0 (26 May 2020): Initial implementation
* - 1.0.0 (26 May 2020):
* Initial implementation
* - 1.0.1 (26 May 2020):
* Allow program to be run from wherever
*/
#include <iostream>
@ -42,11 +45,17 @@ public:
}
};
int main()
int main(int argc, char ** argv)
{
fstream elf;
Elf32_Ehdr ehdr;
vector<Elf32_Shdr> shdr;
stringstream pattern;
if (argc < 2) {
cout << "usage: calcrom PROJECT_DIR" << endl;
throw invalid_argument("missing required argument: PROJECT_DIR\n");
}
// Accumulate sizes
// src asm
@ -55,7 +64,8 @@ int main()
unsigned sizes[2][2] = {{0, 0}, {0, 0}};
char * shstrtab = NULL;
size_t shstrsz = 0;
for (char const * & fname : Glob("../../arm9/{src,asm,lib/{src,asm},modules/*/{src,asm}}/*.{c,s,cpp}"))
pattern << argv[1] << "/arm9/{src,asm,lib/{src,asm},modules/*/{src,asm}}/*.{c,s,cpp}";
for (char const * & fname : Glob(pattern.str()))
{
string fname_s(fname);
string ext = fname_s.substr(fname_s.rfind('.'), 4);

View File

@ -12,8 +12,7 @@ if [ ! -f $map_file ]; then
exit 1
fi
pushd $(dirname "$0")
make
output=$(./calcrom | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
make -C ${TRAVIS_BUILD_DIR}/.travis/calcrom
output=$(${TRAVIS_BUILD_DIR}/.travis/calcrom/calcrom ${TRAVIS_BUILD_DIR} | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL
popd