diff options
author | Made-s <made111@gmx.de> | 2020-05-04 17:15:10 +0200 |
---|---|---|
committer | Made-s <made111@gmx.de> | 2020-05-04 17:15:10 +0200 |
commit | 88d142a33b9973f35c913b3fdad7f6a4394a05cd (patch) | |
tree | c6ad861213ccebb62919e27f6d7f3f1080e1ee76 /arm9/lib/src/OS_entropy.c | |
parent | ab28b0b37f2fd9fba6010e48e15bd31170d678d7 (diff) | |
parent | c82690dca094b624944b155e5119631c185bca5c (diff) |
Merge branch 'master' of https://github.com/martmists/pokediamond
Diffstat (limited to 'arm9/lib/src/OS_entropy.c')
-rw-r--r-- | arm9/lib/src/OS_entropy.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arm9/lib/src/OS_entropy.c b/arm9/lib/src/OS_entropy.c new file mode 100644 index 00000000..b33781cc --- /dev/null +++ b/arm9/lib/src/OS_entropy.c @@ -0,0 +1,22 @@ +// +// Created by red031000 on 2020-05-03. +// + +#include "function_target.h" +#include "consts.h" +#include "OS_entropy.h" + +ARM_FUNC void OS_GetLowEntropyData(u32 * arr) +{ + const OSSystemWork* work = OS_GetSystemWork(); + const u8 * macAddress = (u8 *)((u32)(work->nvramUserInfo) + ((sizeof(NVRAMConfig) + 3) & ~3)); + arr[0] = (u32)((GX_GetVCount() << 16) | OS_GetTickLo()); + arr[1] = (u32)(*(u16 *)(macAddress + 4) << 16) ^ (u32)(OSi_TickCounter); + arr[2] = (u32)(OSi_TickCounter >> 32) ^ *(u32 *)macAddress ^ work->vblankCount; + arr[2] ^= reg_G3X_GXSTAT; + arr[3] = *(u32 *)(&work->real_time_clock[0]); + arr[4] = *(u32 *)(&work->real_time_clock[4]); + arr[5] = (((u32)work->mic_sampling_data) << 16) ^ work->mic_last_address; + arr[6] = (u32) ((*(u16 *)(&work->touch_panel[0]) << 16) | *(u16 *)(&work->touch_panel[2])); + arr[7] = (u32)((work->wm_rssi_pool << 16) | (reg_PAD_KEYINPUT | *(vu16 *)HW_BUTTON_XY_BUF)); +} |