Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2011
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. //ModuleChecker test3 SourceCode
  2.  
  3. //Zooner氏、Dadrfy氏、Akubi氏からソースを頂きました、ありがとうございます。
  4. //SnyFbSx氏、J416氏に感謝します。
  5.  
  6. #include <pspkernel.h>
  7. #include <pspdebug.h>
  8. #include <pspctrl.h>
  9.  
  10. PSP_MODULE_INFO("ModuleChecker test3", 0, 1, 1);
  11. PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
  12.  
  13. #define printf pspDebugScreenPrintf
  14.  
  15. char FILE_PATH[300] = "flash0:/vsh/etc/version.txt";
  16.  
  17. int FileCheack(const char *filename)
  18. {
  19. SceIoStat stat;
  20. return sceIoGetstat(filename, &stat);
  21. }
  22.  
  23.  
  24. typedef struct {
  25. char* mod_name;
  26. char* model;
  27. }hoge_t;
  28.  
  29. hoge_t hoge[] = {
  30. { "flash0:/vsh/etc/index_01g.dat", "01g" },
  31. { "flash0:/vsh/etc/index_02g.dat", "02g" },
  32. { "flash0:/vsh/etc/index_03g.dat", "03g" },
  33. { "flash0:/vsh/etc/index_04g.dat", "04g" },
  34. { "flash0:/vsh/etc/index_05g.dat", "05g" },
  35. { "flash0:/vsh/etc/index_07g.dat", "07g" },
  36. { "flash0:/vsh/etc/index_09g.dat", "09g" },
  37. { "flash0:/vsh/etc/index_11g.dat", "11g" },
  38. };
  39.  
  40.  
  41. int main(void)
  42. {
  43. pspDebugScreenInit();
  44. pspDebugScreenPrintf("ModuleChecker test3 by volotax.¥n¥n");
  45.  
  46. char buffer[200] = "";
  47. SceUID fd = sceIoOpen( FILE_PATH, PSP_O_RDONLY, 0777);
  48. int nRead = sceIoRead( fd, buffer, 200 );
  49. buffer[nRead] = '¥0';
  50.  
  51. printf( buffer );
  52. printf("¥n¥n");
  53.  
  54. int i;
  55. for(i=0; i < 7; i++) {
  56. if( FileCheack( hoge[i].mod_name ) >= 0) {
  57. printf("Your PSP is %s.", hoge[i].model);
  58. goto end;
  59. }
  60. }
  61.  
  62. printf("Unknown Module.");
  63.  
  64. end:
  65.  
  66. printf("¥n");
  67. printf("Press X to exit.¥n");
  68.  
  69. SceCtrlData pad;
  70.  
  71. while(1){
  72. sceCtrlReadBufferPositive(&pad,1);
  73. if( pad.Buttons & PSP_CTRL_CROSS ){
  74. break;
  75. }
  76. }
  77.  
  78. sceKernelExitGame();
  79.  
  80. return 0;
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement