Guest User

main.c

a guest
Dec 9th, 2016
130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <psp2/kernel/processmgr.h>
  2. #include <psp2/ctrl.h>
  3. #include <stdio.h>
  4.  
  5. #include <glib.h>
  6.  
  7. #include "debugScreen.h"
  8.  
  9.  
  10. #define printf psvDebugScreenPrintf
  11.  
  12. void waitPressCircle()
  13. {
  14.  
  15.     SceCtrlData pad;
  16.     printf("          >>>Press CIRCLE ...");
  17.     while (1)
  18.     {
  19.         memset(&pad, 0, sizeof(pad));
  20.         sceCtrlPeekBufferPositive(0, &pad, 1);
  21.        
  22.         if (pad.buttons & SCE_CTRL_CIRCLE)
  23.             break;
  24.     }
  25.  
  26.     printf("And release it to continue\n");
  27.     while (1)
  28.     {
  29.         memset(&pad, 0, sizeof(pad));
  30.         sceCtrlPeekBufferPositive(0, &pad, 1);
  31.        
  32.         if ((pad.buttons & SCE_CTRL_CIRCLE) == 0)
  33.             break;
  34.     }
  35.  
  36. }
  37.  
  38. void etListDir(const char* dirPath){
  39.     GDir *hdir=g_dir_open(dirPath,0,NULL);
  40.     if(hdir==NULL){
  41.         printf("FAIL!");
  42.     }else{
  43.         printf("OPED! Ready to list!");
  44.         waitPressCircle();
  45.        
  46.         const char* dname=NULL;
  47.         int len=0;
  48.         do{
  49.             dname=g_dir_read_name(hdir);
  50.             len=strlen(dname);
  51.             if(len)
  52.                 printf(" - %s \n",dname);
  53.         }while(len);
  54.  
  55.         printf("END of list!\n");
  56.         printf("Closing dir handle\n");
  57.         g_dir_close(hdir);
  58.         printf("CLOSED dir handle");       
  59.     }
  60.     waitPressCircle();
  61. }
  62.  
  63. int main(int argc, char *argv[]) {
  64.     int ret;
  65.     psvDebugScreenInit();
  66.  
  67.     printf("Welcome to the psvDebug eglib test !\n");
  68.  
  69.     const char* dirPath="/";   
  70.     printf("0) dir open and list %s ",dirPath); waitPressCircle();
  71.     etListDir(dirPath);
  72.  
  73.     dirPath="ux0:/";   
  74.     printf("1) dir open and list %s ",dirPath); waitPressCircle();     
  75.     etListDir(dirPath);
  76.  
  77.     dirPath="ux0:/_z_eglib/test2/dir/";
  78.     printf("3) dir create %s ",dirPath); waitPressCircle();
  79.     ret=g_mkdir_with_parents(dirPath,0777);
  80.     if(ret==-1)
  81.         printf("FAIL!");
  82.     else
  83.         printf("SUCC!");
  84.  
  85.     printf("\n\n    End of test. ");
  86.     waitPressCircle();
  87.  
  88.     sceKernelExitProcess(0);
  89.     return 0;
  90. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×