home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / IFOParser / vmg.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-05-06  |  1.5 KB  |  90 lines

  1.  
  2. #include <stdio.h>
  3.  
  4. #include <stdlib.h>
  5. #include <sys/types.h>
  6. //#include <unistd.h>
  7. #include "misc.h"
  8. #include "ifo.h"
  9.  
  10. void ifo_print_audiosub (u_char *ptr)
  11. {
  12.     ifo_hdr_t *hdr = (ifo_hdr_t *) ptr;
  13.     int i;
  14.     u_int *start_list;
  15.  
  16.     printf ("\nAUDIOSUB\n");
  17.     printf ("---\n");
  18.     printf ("number of units: %d\n", bswap_16 (hdr->num));
  19.     printf ("length of table: 0x%x\n", bswap_32 (hdr->len));    
  20.  
  21.  
  22. for (i=0; i<500; i++)
  23. {
  24.     printf ("%x %c  ", *ptr, *ptr);
  25.     ptr++;
  26. }
  27.  
  28.  
  29.     start_list = (u_int *) calloc (bswap_16 (hdr->num), sizeof (u_int));
  30.  
  31.     ptr += IFO_HDR_LEN;
  32.  
  33.     for (i=0; i<bswap_16(hdr->num); i++) {
  34.         start_list[i] = get4bytes (ptr);
  35.  
  36.         ptr+=4;
  37.     }
  38.  
  39.  
  40.     for (i=0; i<bswap_16(hdr->num); i++) {
  41.         int s;
  42.         u_int len;
  43.         u_char *start_ptr;
  44.  
  45.         start_ptr = ptr = (u_char *) hdr + start_list[i];
  46.  
  47.         len = get4bytes (ptr);
  48.         printf ("length of table: 0x%x\n", len);    
  49.         ptr += 4;
  50.  
  51. for (s=0; s<32*8+4; s++)
  52.     printf ("%02x ", *ptr++);
  53.  
  54. {
  55.         char *_ptr;
  56.         int num;
  57.  
  58.         if ((num = ifoGetAudio ((char *)ptr, &_ptr)) < 0)
  59.             break;
  60.         ifoPrintAudio ((ifo_audio_t *) _ptr, num);
  61. }
  62.     
  63.         ptr += 4+8*8;
  64.  
  65. for (s=0; s<12; s++)
  66.     printf ("%02x ", *ptr++);
  67.  
  68. {
  69.         char *_ptr;
  70.         int num;
  71.  
  72.         if ((num = ifoGetSPU ((char *)ptr, &_ptr)) < 0)
  73.             break;
  74.         ifoPrintSPU ((ifo_spu_t *) _ptr, num);
  75. }
  76.         //ifoPrintSPU (ifoGetSPU (ptr));
  77.         ptr += 4+32*6;
  78.  
  79. { int end;
  80.  
  81.     end =  start_ptr + len - ptr;
  82.  
  83.     for (s=0; s<end; s++)
  84.         printf ("%02x ", *ptr++);
  85.  
  86.     printf ("\n");
  87. }
  88.     }
  89. }
  90.