Skip to content

Instantly share code, notes, and snippets.

@zaksabeast
Last active November 23, 2021 21:38
Show Gist options
  • Save zaksabeast/c2140499a1c8280602d63d08937d22f9 to your computer and use it in GitHub Desktop.
Save zaksabeast/c2140499a1c8280602d63d08937d22f9 to your computer and use it in GitHub Desktop.
Calculates an ORAS seed
#include <stdio.h>
#include <stdlib.h>
typedef uint64_t u64;
typedef uint32_t u32;
// Usage: ./calc 0x<save value> <epoch in milliseconds>
// saveValue is pulled from 0x8C71DB8 in v1.4. The value is the random number pulled 26 frames after pressing "A" to save
// epochTime is the current time in milliseconds
u32 calculateORASSeed(u32 saveValue, u64 epochTime)
{
u64 osTime = (epochTime - 946684800000);
return saveValue + osTime;
}
int main(int argc, char *argv[])
{
if (argc <= 2)
{
printf("Missing arguments!\n");
printf("Usage: ./seed saveValue osTime\n");
return 1;
}
u32 saveValue = strtol(argv[1], NULL, 0);
u64 epochTime = strtoull(argv[2], NULL, 10);
u32 seed = calculateORASSeed(saveValue, epochTime);
printf("Seed: %08X\n", seed);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment