diff options
author | Revo <projectrevotpp@hotmail.com> | 2020-05-03 14:33:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-03 14:33:48 -0400 |
commit | c82690dca094b624944b155e5119631c185bca5c (patch) | |
tree | 422d68b44548901dba0dfa4f238ddd071b446c70 /arm9/lib/src/OS_entropy.c | |
parent | af8f18b496b6fafb8253e17f3a0f0743a05d442d (diff) | |
parent | 9691f79d2e0c2b8442f1b669990cd9a939a0253b (diff) |
Merge pull request #58 from red031000/temp
OS_GetLowEntropyData
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)); +} |