diff --git a/libpandory.c b/libpandory.c index ab967d4..ec35d22 100644 --- a/libpandory.c +++ b/libpandory.c @@ -38,7 +38,15 @@ char *libpandory_rot13(const char *src) { return result; } -int isReadonly(char const *path) +void libpandory_shufflemusic() +{ + system("umount /tmp/pandory/share/retroarch/assets/sounds/bgm.mp3"); + system("cd /mnt/Pandory/.user/bgm && ls | sed -n \"$((RANDOM%$(ls | wc -l)+1))p\" > /tmp/pandory_track"); + system("busybox mount -o bind /mnt/Pandory/.user/bgm/$(cat /tmp/pandory_track) /tmp/pandory/share/retroarch/assets/sounds/bgm.mp3"); +} + + +int libpandory_isreadonly(char const *path) { struct statvfs info; statvfs(path, &info); @@ -48,11 +56,14 @@ int isReadonly(char const *path) void libpandory_lefcheck(void) { printf("TeamPandory - Pandory500 - by emuchicken and dajoho\n"); - if (!isReadonly("/")) { + if (!libpandory_isreadonly("/")) { printf("[WARNING]: Your system currently has a writeable NAND storage. This may have been caused by another modification. This is dangerous. Pandory will now exit.\n"); exit(1); } + // do the red dwarf shuffle + libpandory_shufflemusic(); + char fname[80]; strcpy(fname, libpandory_rot13("/zag/Cnaqbel/.sf/cnaqbel.fdkm")); int chk = 0;