Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. #include <gccore.h>
  2. #include <malloc.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <ogcsys.h>
  6. #include <time.h>
  7. #include <sys/time.h>
  8. #include <wiiuse/wpad.h>
  9. #include <fat.h>
  10. #ifdef HW_RVL
  11. #include <wiiuse/wpad.h>
  12. #include <sdcard/wiisd_io.h>
  13. #endif
  14. #include <dirent.h>
  15.  
  16. #include <iostream>
  17. #include <debug.h>
  18. #include <math.h>
  19.  
  20. #include <di/di.h>
  21. #include <unistd.h>
  22.  
  23. static void *xfb = NULL;
  24.  
  25. u32 first_frame = 1;
  26. GXRModeObj *rmode;
  27.  
  28. void (*reboot)() = (void(*)())0x80001800;
  29.  
  30. void Initialise()
  31. {
  32. // Initialise the video system
  33. VIDEO_Init();
  34.  
  35. // This function initialises the attached controllers
  36. PAD_Init();
  37. WPAD_Init();
  38.  
  39. // Obtain the preferred video mode from the system
  40. // This will correspond to the settings in the Wii menu
  41. rmode = VIDEO_GetPreferredMode(NULL);
  42.  
  43. // Allocate memory for the display in the uncached region
  44. xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
  45.  
  46. // Initialise the console, required for printf
  47. console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
  48.  
  49. // Set up the video registers with the chosen mode
  50. VIDEO_Configure(rmode);
  51.  
  52. // Tell the video hardware where our display memory is
  53. VIDEO_SetNextFramebuffer(xfb);
  54.  
  55. // Make the display visible
  56. VIDEO_SetBlack(FALSE);
  57.  
  58. // Flush the video register changes to the hardware
  59. VIDEO_Flush();
  60.  
  61. // Wait for Video setup to complete
  62. VIDEO_WaitVSync();
  63. if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
  64.  
  65. #ifdef HW_RVL
  66. // Initialize FAT so we can write to SD.
  67. __io_wiisd.startup();
  68. fatMountSimple("sd", &__io_wiisd);
  69. #endif
  70. }
  71.  
  72. int main()
  73. {
  74. Initialise();
  75.  
  76. printf("Initializing DI...\n");
  77. DI_Init();
  78. DI_Mount();
  79. while (DI_GetStatus() & DVD_INIT) { printf("."); usleep(5000); }
  80. printf("\n");
  81. if (DI_GetStatus() & DVD_READY)
  82. {
  83. printf("DI Init OK!\n");
  84. ////////////
  85.  
  86. FILE* f = fopen("sd:/di_log.txt", "a");
  87. if (f)
  88. {
  89. for (int i = 0; i < 0x40; i++)
  90. fprintf(f,"%x", ///[i]);
  91. fprintf(f, "\n");
  92. fclose(f);
  93. }
  94. else
  95. {
  96. printf("\nFailed to open file on SD card!\n");
  97. usleep(100000);
  98. }
  99. delete[] ///;
  100. }
  101. else
  102. {
  103. printf("DI Init FAILED!\n");
  104. }
  105.  
  106. #ifdef HW_RVL
  107. fatUnmount("sd");
  108. __io_wiisd.shutdown();
  109. #endif
  110.  
  111. //for(;;);
  112.  
  113. reboot();
  114.  
  115. return 0;
  116. }
Add Comment
Please, Sign In to add comment