Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gccore.h>
- #include <malloc.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <ogcsys.h>
- #include <time.h>
- #include <sys/time.h>
- #include <wiiuse/wpad.h>
- #include <fat.h>
- #ifdef HW_RVL
- #include <wiiuse/wpad.h>
- #include <sdcard/wiisd_io.h>
- #endif
- #include <dirent.h>
- #include <iostream>
- #include <debug.h>
- #include <math.h>
- #include <di/di.h>
- #include <unistd.h>
- static void *xfb = NULL;
- u32 first_frame = 1;
- GXRModeObj *rmode;
- void (*reboot)() = (void(*)())0x80001800;
- void Initialise()
- {
- // Initialise the video system
- VIDEO_Init();
- // This function initialises the attached controllers
- PAD_Init();
- WPAD_Init();
- // Obtain the preferred video mode from the system
- // This will correspond to the settings in the Wii menu
- rmode = VIDEO_GetPreferredMode(NULL);
- // Allocate memory for the display in the uncached region
- xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
- // Initialise the console, required for printf
- console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
- // Set up the video registers with the chosen mode
- VIDEO_Configure(rmode);
- // Tell the video hardware where our display memory is
- VIDEO_SetNextFramebuffer(xfb);
- // Make the display visible
- VIDEO_SetBlack(FALSE);
- // Flush the video register changes to the hardware
- VIDEO_Flush();
- // Wait for Video setup to complete
- VIDEO_WaitVSync();
- if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
- #ifdef HW_RVL
- // Initialize FAT so we can write to SD.
- __io_wiisd.startup();
- fatMountSimple("sd", &__io_wiisd);
- #endif
- }
- int main()
- {
- Initialise();
- printf("Initializing DI...\n");
- DI_Init();
- DI_Mount();
- while (DI_GetStatus() & DVD_INIT) { printf("."); usleep(5000); }
- printf("\n");
- if (DI_GetStatus() & DVD_READY)
- {
- printf("DI Init OK!\n");
- ////////////
- FILE* f = fopen("sd:/di_log.txt", "a");
- if (f)
- {
- for (int i = 0; i < 0x40; i++)
- fprintf(f,"%x", ///[i]);
- fprintf(f, "\n");
- fclose(f);
- }
- else
- {
- printf("\nFailed to open file on SD card!\n");
- usleep(100000);
- }
- delete[] ///;
- }
- else
- {
- printf("DI Init FAILED!\n");
- }
- #ifdef HW_RVL
- fatUnmount("sd");
- __io_wiisd.shutdown();
- #endif
- //for(;;);
- reboot();
- return 0;
- }
Add Comment
Please, Sign In to add comment