Guest User

Untitled

a guest
Oct 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. #ifdef intraFont_6XX
  2.  
  3. //FW5.00cptblf[^
  4. #include "cptbl_500.h"
  5.  
  6. #endif
  7.  
  8. int cccLoadTable(const char *filename, unsigned char cp) {
  9.     if (cp >= CCC_N_CP) return CCC_ERROR_UNSUPPORTED;
  10.    
  11.     void* table_data = NULL;
  12.     unsigned int filesize = 0;
  13.    
  14.     /* read in (compressed) table_data */
  15.  
  16. #ifdef intraFont_6XX
  17.  
  18.     //in cptbl_500.h
  19.     table_data = (void*)data_cptbl;
  20.     filesize = size_cptbl;
  21.  
  22. #else
  23.    
  24.     SceUID fd = sceIoOpen(filename, PSP_O_RDONLY, 0777);
  25.     if (fd < 0) return CCC_ERROR_FILE_READ;
  26.     filesize = sceIoLseek(fd, 0, SEEK_END);
  27.     sceIoLseek(fd, 0, SEEK_SET);
  28.     table_data = (void*)malloc(filesize);
  29.     if (!table_data) {
  30.         sceIoClose(fd);
  31.         return CCC_ERROR_MEM_ALLOC;
  32.     }
  33.     if (sceIoRead(fd, table_data, filesize) != filesize) {
  34.         sceIoClose(fd);
  35.         free(table_data);
  36.         return CCC_ERROR_FILE_READ;
  37.     }
  38.     sceIoClose(fd);
  39.  
  40. #endif
  41.  
  42.     /* decompress requested tables */
  43.     unsigned int *header = (unsigned int*)table_data;
  44.     while (header[0]) {
  45. .
  46. .
  47. .
Add Comment
Please, Sign In to add comment