Skip to content

Instantly share code, notes, and snippets.

@thrimbor
Created April 10, 2019 23:31
Show Gist options
  • Save thrimbor/33386186df27241a724022d28c5759fd to your computer and use it in GitHub Desktop.
Save thrimbor/33386186df27241a724022d28c5759fd to your computer and use it in GitHub Desktop.
List files with NXDK
#include <xboxrt/debug.h>
#include <pbkit/pbkit.h>
#include <hal/xbox.h>
#include "stdio.h"
#include <hal/fileio.h>
void main(void)
{
int i;
switch(pb_init())
{
case 0: break;
default:
XSleep(2000);
XReboot();
return;
}
pb_show_debug_screen();
XBOX_FIND_DATA findData;
unsigned int handle = XFindFirstFile("C:\\", "*", &findData);
if (handle == INVALID_HANDLE_VALUE)
debugPrint("oh noes!\n");
while (handle != INVALID_HANDLE_VALUE)
{
debugPrint("file: %s\n", findData.cFileName);
int result = XFindNextFile(handle, &findData);
if (result == ERROR_NO_MORE_FILES) {
XFindClose(handle);
break;
}
}
debugPrint("\ndone\n");
while(1) {
XSleep(2000);
}
pb_kill();
XReboot();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment