From b763fd119dcecbd773a7d0c03a6bab8b593d0e9d Mon Sep 17 00:00:00 2001 From: red031000 Date: Tue, 26 May 2020 16:21:52 +0100 Subject: OS_ownerInfo --- arm9/asm/OS_ownerInfo.s | 59 -------------------------- arm9/lib/include/MI_memory.h | 1 + arm9/lib/include/OS_entropy.h | 7 +--- arm9/lib/include/OS_ownerInfo.h | 28 +++++++++++++ arm9/lib/include/gx.h | 2 +- arm9/lib/include/mmap.h | 2 +- arm9/lib/include/userInfo.h | 92 +++++++++++++++++++++++++++++++++++++++++ arm9/lib/src/OS_ownerInfo.c | 27 ++++++++++++ 8 files changed, 151 insertions(+), 67 deletions(-) delete mode 100644 arm9/asm/OS_ownerInfo.s create mode 100644 arm9/lib/include/OS_ownerInfo.h create mode 100644 arm9/lib/include/userInfo.h create mode 100644 arm9/lib/src/OS_ownerInfo.c diff --git a/arm9/asm/OS_ownerInfo.s b/arm9/asm/OS_ownerInfo.s deleted file mode 100644 index 0abf080b..00000000 --- a/arm9/asm/OS_ownerInfo.s +++ /dev/null @@ -1,59 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start OS_GetOwnerRtcOffset -OS_GetOwnerRtcOffset: ; 0x020CD510 - ldr r1, _020CD520 ; =0x027FFC80 - ldr r0, [r1, #0x68] - ldr r1, [r1, #0x6c] - bx lr - .balign 4 -_020CD520: .word 0x027FFC80 - - arm_func_start OS_GetOwnerInfo -OS_GetOwnerInfo: ; 0x020CD524 - stmdb sp!, {r4,lr} - ldr ip, _020CD59C ; =0x027FFC80 - mov r4, r0 - ldrh r2, [r12, #0x64] - add r0, r12, #0x6 - add r1, r4, #0x4 - mov r2, r2, lsl #0x1d - mov r2, r2, lsr #0x1d - strb r2, [r4, #0x0] - ldrb r3, [r12, #0x2] - mov r2, #0x14 - mov r3, r3, lsl #0x1c - mov r3, r3, lsr #0x1c - strb r3, [r4, #0x1] - ldrb r3, [r12, #0x3] - strb r3, [r4, #0x2] - ldrb r3, [r12, #0x4] - strb r3, [r4, #0x3] - ldrb r3, [r12, #0x1a] - strh r3, [r4, #0x18] - ldrb r3, [r12, #0x50] - strh r3, [r4, #0x4e] - bl MIi_CpuCopy16 - ldr r0, _020CD59C ; =0x027FFC80 - add r1, r4, #0x1a - add r0, r0, #0x1c - mov r2, #0x34 - bl MIi_CpuCopy16 - ldmia sp!, {r4,lr} - bx lr - .balign 4 -_020CD59C: .word 0x027FFC80 - - arm_func_start OS_GetMacAddress -OS_GetMacAddress: ; 0x020CD5A0 - ldr ip, _020CD5B4 ; =MI_CpuCopy8 - mov r1, r0 - ldr r0, _020CD5B8 ; =0x027FFCF4 - mov r2, #0x6 - bx r12 - .balign 4 -_020CD5B4: .word MI_CpuCopy8 -_020CD5B8: .word 0x027FFCF4 diff --git a/arm9/lib/include/MI_memory.h b/arm9/lib/include/MI_memory.h index d9935a5f..0ebb3560 100644 --- a/arm9/lib/include/MI_memory.h +++ b/arm9/lib/include/MI_memory.h @@ -6,5 +6,6 @@ void MI_CpuCopy8(void const *src, void *dest, u32 size); static inline void MI_CpuClear8(void *dest, u32 size) { MI_CpuFill8(dest, 0, size); } +void MIi_CpuCopy16(const void *src, void *dst, u32 size); #endif //NITRO_MI_MEMORY_H_ diff --git a/arm9/lib/include/OS_entropy.h b/arm9/lib/include/OS_entropy.h index 78ac71b7..b0f2781a 100644 --- a/arm9/lib/include/OS_entropy.h +++ b/arm9/lib/include/OS_entropy.h @@ -6,15 +6,10 @@ #define POKEDIAMOND_OS_ENTROPY_H #include "consts.h" +#include "userInfo.h" void OS_GetLowEntropyData(u32 * arr); -typedef struct NVRAMConfig{ - u8 ncd[110]; // todo: typeof NVRAMConfigData - u16 saveCount; - u16 rc16; -} NVRAMConfig; - extern vu64 OSi_TickCounter; extern u16 OS_GetTickLo(void); diff --git a/arm9/lib/include/OS_ownerInfo.h b/arm9/lib/include/OS_ownerInfo.h new file mode 100644 index 00000000..13bae06e --- /dev/null +++ b/arm9/lib/include/OS_ownerInfo.h @@ -0,0 +1,28 @@ +#ifndef POKEDIAMOND_OS_OWNERINFO_H +#define POKEDIAMOND_OS_OWNERINFO_H + +#include "consts.h" +#include "userInfo.h" + +typedef struct OSBirthday +{ + u8 month; + u8 day; +} OSBirthday; + +typedef struct OSOwnerInfo +{ + u8 language; + u8 favoriteColour; + OSBirthday birthday; + u16 nickName[10]; //either 10 or 8 + u16 nickNameLength; + u16 comment[26]; + u16 commentLength; +} OSOwnerInfo; + +void OS_GetMacAddress(u8 *macAddress); +void OS_GetOwnerInfo(OSOwnerInfo* info); +s64 OS_GetOwnerRtcOffset(void); + +#endif //POKEDIAMOND_OS_OWNERINFO_H diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h index 8abe4e40..79b707fc 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -2,6 +2,7 @@ #define GUARD_GX_H #include "fx.h" +#include "MI_memory.h" //temporary while other files aren't decompiled @@ -14,7 +15,6 @@ void MI_Copy64B(void *src, void *dst); void MI_WaitDma(u32); void MI_DmaCopy32Async(u32, const void *, void *, u32, void *, void *); void MI_DmaCopy16(u32 unk, const void *src, void *dst, u32 size); -void MIi_CpuCopy16(const void *src, void *dst, u32 size); void MI_DmaCopy32(u32 unk, const void *src, void *dst, u32 size); void MIi_CpuCopy32(const void *src, void *dst, u32 size); void OSi_UnlockVram(u16, u16); diff --git a/arm9/lib/include/mmap.h b/arm9/lib/include/mmap.h index 207e0509..65b93e1e 100644 --- a/arm9/lib/include/mmap.h +++ b/arm9/lib/include/mmap.h @@ -98,7 +98,7 @@ typedef struct { u16 mmem_checker_subp; // 3fa-3fb: 2bytes MainMomory Size Checker for Sub processor u8 padding4[2]; // 3fc-3fd: (2bytes) u16 command_area; // 3fe-3ff: 2bytes Command Area -} OSSystemWork; +} OSSystemWork; //0x027FFC00 #define OS_GetSystemWork() ((OSSystemWork *)HW_MAIN_MEM_SYSTEM) diff --git a/arm9/lib/include/userInfo.h b/arm9/lib/include/userInfo.h new file mode 100644 index 00000000..a4f67d3f --- /dev/null +++ b/arm9/lib/include/userInfo.h @@ -0,0 +1,92 @@ +#ifndef POKEDIAMOND_USERINFO_H +#define POKEDIAMOND_USERINFO_H + +typedef struct NVRAMConfigDate +{ + u8 month; + u8 day; +} NVRAMConfigDate; + +typedef struct NVRAMConfigNickname +{ + u16 str[10]; + u8 length; + u8 rsv; +} NVRAMConfigNickname; + +typedef struct NVRAMConfigComment +{ + u16 str[26]; + u8 length; + u8 rsv; +} NVRAMConfigComment; + +typedef struct NVRAMConfigOwnerInfo +{ + u8 favouriteColour:4; + u8 rsv:4; + NVRAMConfigDate birthday; + u8 pad; + NVRAMConfigNickname nickname; + NVRAMConfigComment comment; +} NVRAMConfigOwnerInfo; + +typedef struct NVRAMConfigAlarm +{ + u8 hour; + u8 minute; + u8 second; + u8 pad; + u16 enableWeek:7; + u16 alarmOn:1; + u16 rsv:8; +} NVRAMConfigAlarm; + +typedef struct NVRAMConfigTpCalibData +{ + u16 raw_x1; + u16 raw_y1; + u8 dx1; + u8 dy1; + u16 raw_x2; + u16 raw_y2; + u8 dx2; + u8 dy2; +} NVRAMConfigTpCalibData; + +typedef struct NVRAMConfigOption +{ + u16 language:3; + u16 agbLcd:1; + u16 detectPullOutCardFlag:1; + u16 detectPullOutCtrdgFlag:1; + u16 autoBootFlag:1; + u16 rsv:4; + u16 input_favouriteColour:1; + u16 input_tp:1; + u16 input_language:1; + u16 input_rtc:1; + u16 input_nickname:1; + u8 timeZone; + u8 rtcClockAdjust; + s64 rtcOffset; +} NVRAMConfigOption; + +typedef struct NVRAMConfigData +{ + u8 version; + u8 pad; + NVRAMConfigOwnerInfo owner; + NVRAMConfigAlarm alarm; + NVRAMConfigTpCalibData tp; + NVRAMConfigOption option; +} NVRAMConfigData; + +typedef struct NVRAMConfig +{ + NVRAMConfigData ncd; + u16 saveCount; + u16 crc16; +} NVRAMConfig; + +#endif //POKEDIAMOND_USERINFO_H diff --git a/arm9/lib/src/OS_ownerInfo.c b/arm9/lib/src/OS_ownerInfo.c new file mode 100644 index 00000000..10a638fb --- /dev/null +++ b/arm9/lib/src/OS_ownerInfo.c @@ -0,0 +1,27 @@ +#include "function_target.h" +#include "OS_ownerInfo.h" +#include "MI_memory.h" + +ARM_FUNC void OS_GetMacAddress(u8 *macAddress) +{ + MI_CpuCopy8((void *)0x027FFCF4, macAddress, 0x6); +} + +ARM_FUNC void OS_GetOwnerInfo(OSOwnerInfo* info) +{ + NVRAMConfig *src = (NVRAMConfig *)OS_GetSystemWork()->nvramUserInfo; + info->language = (u8)src->ncd.option.language; + info->favoriteColour = (u8)src->ncd.owner.favouriteColour; + info->birthday.month = (u8)src->ncd.owner.birthday.month; + info->birthday.day = (u8)src->ncd.owner.birthday.day; + info->nickNameLength = (u16)src->ncd.owner.nickname.length; + info->commentLength = (u16)src->ncd.owner.comment.length; + MIi_CpuCopy16(src->ncd.owner.nickname.str, info->nickName, 10 * sizeof(u16)); + MIi_CpuCopy16(src->ncd.owner.comment.str, info->comment, 26 * sizeof(u16)); +} + +ARM_FUNC s64 OS_GetOwnerRtcOffset(void) +{ + NVRAMConfig *src = (NVRAMConfig *)OS_GetSystemWork()->nvramUserInfo; + return src->ncd.option.rtcOffset; +} -- cgit v1.2.3 From e53771f12f33b4fb5c4a7c4a2f4aa5031d27f050 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 27 May 2020 00:00:44 +0100 Subject: offset and size comments --- arm9/lib/include/userInfo.h | 122 ++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/arm9/lib/include/userInfo.h b/arm9/lib/include/userInfo.h index a4f67d3f..31d102d8 100644 --- a/arm9/lib/include/userInfo.h +++ b/arm9/lib/include/userInfo.h @@ -3,90 +3,90 @@ typedef struct NVRAMConfigDate { - u8 month; - u8 day; -} NVRAMConfigDate; + u8 month; //0x00 + u8 day; //0x01 +} NVRAMConfigDate; //0x2 typedef struct NVRAMConfigNickname { - u16 str[10]; - u8 length; - u8 rsv; -} NVRAMConfigNickname; + u16 str[10]; //0x00 + u8 length; //0x14 + u8 rsv; //0x15 +} NVRAMConfigNickname; //0x16 typedef struct NVRAMConfigComment { - u16 str[26]; - u8 length; - u8 rsv; -} NVRAMConfigComment; + u16 str[26]; //0x00 + u8 length; //0x34 + u8 rsv; //0x35 +} NVRAMConfigComment; //0x36 typedef struct NVRAMConfigOwnerInfo { - u8 favouriteColour:4; - u8 rsv:4; - NVRAMConfigDate birthday; - u8 pad; - NVRAMConfigNickname nickname; - NVRAMConfigComment comment; -} NVRAMConfigOwnerInfo; + u8 favouriteColour:4; //0x00 (1-4) + u8 rsv:4; //0x00 (5-8) + NVRAMConfigDate birthday; //0x01 + u8 pad; //0x03 + NVRAMConfigNickname nickname; //0x04 + NVRAMConfigComment comment; //0x1a +} NVRAMConfigOwnerInfo; //0x50 typedef struct NVRAMConfigAlarm { - u8 hour; - u8 minute; - u8 second; - u8 pad; - u16 enableWeek:7; - u16 alarmOn:1; - u16 rsv:8; -} NVRAMConfigAlarm; + u8 hour; //0x00 + u8 minute; //0x01 + u8 second; //0x02 + u8 pad; //0x03 + u16 enableWeek:7; //0x04 (1-7) + u16 alarmOn:1; //0x04 (8) + u16 rsv:8; //0x04 (9-16) +} NVRAMConfigAlarm; //0x06 typedef struct NVRAMConfigTpCalibData { - u16 raw_x1; - u16 raw_y1; - u8 dx1; - u8 dy1; - u16 raw_x2; - u16 raw_y2; - u8 dx2; - u8 dy2; -} NVRAMConfigTpCalibData; + u16 raw_x1; //0x00 + u16 raw_y1; //0x02 + u8 dx1; //0x04 + u8 dy1; //0x05 + u16 raw_x2; //0x06 + u16 raw_y2; //0x08 + u8 dx2; //0x0a + u8 dy2; //0x0b +} NVRAMConfigTpCalibData; //0x0c typedef struct NVRAMConfigOption { - u16 language:3; - u16 agbLcd:1; - u16 detectPullOutCardFlag:1; - u16 detectPullOutCtrdgFlag:1; - u16 autoBootFlag:1; - u16 rsv:4; - u16 input_favouriteColour:1; - u16 input_tp:1; - u16 input_language:1; - u16 input_rtc:1; - u16 input_nickname:1; - u8 timeZone; - u8 rtcClockAdjust; - s64 rtcOffset; -} NVRAMConfigOption; + u16 language:3; //0x00 (1-3) + u16 agbLcd:1; //0x00 (4) + u16 detectPullOutCardFlag:1; //0x00 (5) + u16 detectPullOutCtrdgFlag:1; //0x00 (6) + u16 autoBootFlag:1; //0x00 (7) + u16 rsv:4; //0x00 (8-11) + u16 input_favouriteColour:1; //0x00 (12) + u16 input_tp:1; //0x00 (13) + u16 input_language:1; //0x00 (14) + u16 input_rtc:1; //0x00 (15) + u16 input_nickname:1; //0x00 (16) + u8 timeZone; //0x02 + u8 rtcClockAdjust; //0x03 + s64 rtcOffset; //0x04 +} NVRAMConfigOption; //0xc typedef struct NVRAMConfigData { - u8 version; - u8 pad; - NVRAMConfigOwnerInfo owner; - NVRAMConfigAlarm alarm; - NVRAMConfigTpCalibData tp; - NVRAMConfigOption option; -} NVRAMConfigData; + u8 version; //0x00 + u8 pad; //0x01 + NVRAMConfigOwnerInfo owner; //0x02 + NVRAMConfigAlarm alarm; //0x52 + NVRAMConfigTpCalibData tp; //0x58 + NVRAMConfigOption option; //0x64 +} NVRAMConfigData; //0x70 typedef struct NVRAMConfig { - NVRAMConfigData ncd; - u16 saveCount; - u16 crc16; -} NVRAMConfig; + NVRAMConfigData ncd; // 0x0 + u16 saveCount; //0x70 + u16 crc16; //0x72 +} NVRAMConfig; //0x74 #endif //POKEDIAMOND_USERINFO_H -- cgit v1.2.3 From ea7accf231c8374d5e335c104d6bbbb4bad1d752 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 27 May 2020 00:08:58 +0100 Subject: align comments and 0 index bitfields --- arm9/lib/include/userInfo.h | 118 ++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/arm9/lib/include/userInfo.h b/arm9/lib/include/userInfo.h index 31d102d8..690dcf54 100644 --- a/arm9/lib/include/userInfo.h +++ b/arm9/lib/include/userInfo.h @@ -3,90 +3,90 @@ typedef struct NVRAMConfigDate { - u8 month; //0x00 - u8 day; //0x01 -} NVRAMConfigDate; //0x2 + u8 month; //0x00 + u8 day; //0x01 +} NVRAMConfigDate; //0x02 typedef struct NVRAMConfigNickname { - u16 str[10]; //0x00 - u8 length; //0x14 - u8 rsv; //0x15 -} NVRAMConfigNickname; //0x16 + u16 str[10]; //0x00 + u8 length; //0x14 + u8 rsv; //0x15 +} NVRAMConfigNickname; //0x16 typedef struct NVRAMConfigComment { - u16 str[26]; //0x00 - u8 length; //0x34 - u8 rsv; //0x35 -} NVRAMConfigComment; //0x36 + u16 str[26]; //0x00 + u8 length; //0x34 + u8 rsv; //0x35 +} NVRAMConfigComment; //0x36 typedef struct NVRAMConfigOwnerInfo { - u8 favouriteColour:4; //0x00 (1-4) - u8 rsv:4; //0x00 (5-8) - NVRAMConfigDate birthday; //0x01 - u8 pad; //0x03 + u8 favouriteColour:4; //0x00 (0-3) + u8 rsv:4; //0x00 (4-7) + NVRAMConfigDate birthday; //0x01 + u8 pad; //0x03 NVRAMConfigNickname nickname; //0x04 - NVRAMConfigComment comment; //0x1a -} NVRAMConfigOwnerInfo; //0x50 + NVRAMConfigComment comment; //0x1a +} NVRAMConfigOwnerInfo; //0x50 typedef struct NVRAMConfigAlarm { - u8 hour; //0x00 - u8 minute; //0x01 - u8 second; //0x02 - u8 pad; //0x03 - u16 enableWeek:7; //0x04 (1-7) - u16 alarmOn:1; //0x04 (8) - u16 rsv:8; //0x04 (9-16) -} NVRAMConfigAlarm; //0x06 + u8 hour; //0x00 + u8 minute; //0x01 + u8 second; //0x02 + u8 pad; //0x03 + u16 enableWeek:7; //0x04 (0-6) + u16 alarmOn:1; //0x04 (7) + u16 rsv:8; //0x04 (8-15) +} NVRAMConfigAlarm; //0x06 typedef struct NVRAMConfigTpCalibData { - u16 raw_x1; //0x00 - u16 raw_y1; //0x02 - u8 dx1; //0x04 - u8 dy1; //0x05 - u16 raw_x2; //0x06 - u16 raw_y2; //0x08 - u8 dx2; //0x0a - u8 dy2; //0x0b + u16 raw_x1; //0x00 + u16 raw_y1; //0x02 + u8 dx1; //0x04 + u8 dy1; //0x05 + u16 raw_x2; //0x06 + u16 raw_y2; //0x08 + u8 dx2; //0x0a + u8 dy2; //0x0b } NVRAMConfigTpCalibData; //0x0c typedef struct NVRAMConfigOption { - u16 language:3; //0x00 (1-3) - u16 agbLcd:1; //0x00 (4) - u16 detectPullOutCardFlag:1; //0x00 (5) - u16 detectPullOutCtrdgFlag:1; //0x00 (6) - u16 autoBootFlag:1; //0x00 (7) - u16 rsv:4; //0x00 (8-11) - u16 input_favouriteColour:1; //0x00 (12) - u16 input_tp:1; //0x00 (13) - u16 input_language:1; //0x00 (14) - u16 input_rtc:1; //0x00 (15) - u16 input_nickname:1; //0x00 (16) - u8 timeZone; //0x02 - u8 rtcClockAdjust; //0x03 - s64 rtcOffset; //0x04 -} NVRAMConfigOption; //0xc + u16 language:3; //0x00 (0-2) + u16 agbLcd:1; //0x00 (3) + u16 detectPullOutCardFlag:1; //0x00 (4) + u16 detectPullOutCtrdgFlag:1; //0x00 (5) + u16 autoBootFlag:1; //0x00 (6) + u16 rsv:4; //0x00 (7-10) + u16 input_favouriteColour:1; //0x00 (11) + u16 input_tp:1; //0x00 (12) + u16 input_language:1; //0x00 (13) + u16 input_rtc:1; //0x00 (14) + u16 input_nickname:1; //0x00 (15) + u8 timeZone; //0x02 + u8 rtcClockAdjust; //0x03 + s64 rtcOffset; //0x04 +} NVRAMConfigOption; //0x0c typedef struct NVRAMConfigData { - u8 version; //0x00 - u8 pad; //0x01 - NVRAMConfigOwnerInfo owner; //0x02 - NVRAMConfigAlarm alarm; //0x52 - NVRAMConfigTpCalibData tp; //0x58 - NVRAMConfigOption option; //0x64 -} NVRAMConfigData; //0x70 + u8 version; //0x00 + u8 pad; //0x01 + NVRAMConfigOwnerInfo owner; //0x02 + NVRAMConfigAlarm alarm; //0x52 + NVRAMConfigTpCalibData tp; //0x58 + NVRAMConfigOption option; //0x64 +} NVRAMConfigData; //0x70 typedef struct NVRAMConfig { - NVRAMConfigData ncd; // 0x0 - u16 saveCount; //0x70 - u16 crc16; //0x72 -} NVRAMConfig; //0x74 + NVRAMConfigData ncd; //0x00 + u16 saveCount; //0x70 + u16 crc16; //0x72 +} NVRAMConfig; //0x74 #endif //POKEDIAMOND_USERINFO_H -- cgit v1.2.3 From b1c99b0d050cc9990766bbd81cf554623af36469 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 26 May 2020 20:46:10 -0400 Subject: Update calcrom.cpp --- .travis/calcrom/.gitignore | 1 + .travis/calcrom/calcrom.cpp | 16 +++++++++++++--- .travis/calcrom/webhook.sh | 5 ++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.travis/calcrom/.gitignore b/.travis/calcrom/.gitignore index a2e06b56..e4016dbe 100644 --- a/.travis/calcrom/.gitignore +++ b/.travis/calcrom/.gitignore @@ -1 +1,2 @@ calcrom +*.exe diff --git a/.travis/calcrom/calcrom.cpp b/.travis/calcrom/calcrom.cpp index 8b43e010..fe43939a 100644 --- a/.travis/calcrom/calcrom.cpp +++ b/.travis/calcrom/calcrom.cpp @@ -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 @@ -42,11 +45,17 @@ public: } }; -int main() +int main(int argc, char ** argv) { fstream elf; Elf32_Ehdr ehdr; vector 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); diff --git a/.travis/calcrom/webhook.sh b/.travis/calcrom/webhook.sh index fc02eef1..90752989 100644 --- a/.travis/calcrom/webhook.sh +++ b/.travis/calcrom/webhook.sh @@ -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 -- cgit v1.2.3 From 4477940af33b5d3ded2becce1c3d434033bac49e Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Tue, 26 May 2020 21:27:24 -0400 Subject: fix webhook.sh --- .travis/calcrom/webhook.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .travis/calcrom/webhook.sh diff --git a/.travis/calcrom/webhook.sh b/.travis/calcrom/webhook.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From 57fd8e20784d3025eea9c4aa25ccc0723a9f4620 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 May 2020 08:29:01 -0400 Subject: Extra security on ELF header (calcrom) --- .travis/calcrom/calcrom.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis/calcrom/calcrom.cpp b/.travis/calcrom/calcrom.cpp index fe43939a..272bcf17 100644 --- a/.travis/calcrom/calcrom.cpp +++ b/.travis/calcrom/calcrom.cpp @@ -11,10 +11,12 @@ * - Must be placed in ".travis/calcrom/". * * Changelog: - * - 1.0.0 (26 May 2020): + * - 0.1.0 (26 May 2020): * Initial implementation - * - 1.0.1 (26 May 2020): + * - 0.1.1 (26 May 2020): * Allow program to be run from wherever + * 0.1.2 (27 May 2020): + * Extra security on ELF header */ #include @@ -74,7 +76,10 @@ int main(int argc, char ** argv) fname_s = fname_s.replace(fname_s.rfind('.'), 4, ".o"); elf.open(fname_s, ios_base::in | ios_base::binary); elf.read((char *)&ehdr, sizeof(ehdr)); - if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { + if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 + || ehdr.e_ehsize != sizeof(Elf32_Ehdr) + || ehdr.e_shentsize != sizeof(Elf32_Shdr)) + { elf.close(); stringstream ss; ss << "Error validating " << fname_s << " as an ELF file" << endl; -- cgit v1.2.3 From fafa7f0dccbd910af75412cc9e4fa606b504c7de Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 27 May 2020 08:42:37 -0400 Subject: Fix webhook.sh output --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 681bddc5..5ce0b5e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,4 +33,4 @@ notifications: email: false after_success: - - .travis/calcrom/webhook.sh + - .travis/calcrom/webhook.sh pokediamond -- cgit v1.2.3