Guest User

Untitled

a guest
Oct 20th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1.  
  2. #ifdef intraFont_6XX
  3.  
  4. //5.00のcptblをデータ化したもの
  5. #include "cptbl_500.h"
  6.  
  7. #endif
  8.  
  9. int cccLoadTable(const char *filename, unsigned char cp) {
  10.     if (cp >= CCC_N_CP) return CCC_ERROR_UNSUPPORTED;
  11.    
  12.     void* table_data = NULL;
  13.     unsigned int filesize = 0;
  14.    
  15.     /* read in (compressed) table_data */
  16.  
  17. #ifdef intraFont_6XX
  18.  
  19.     //include in cptbl_500.h
  20.     table_data = (void*)data_cptbl;
  21.     filesize = size_cptbl;
  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.         if ((cp == 0) || (cp == header[0])) {
  46.             void* table = (void*)malloc(header[4]);
Add Comment
Please, Sign In to add comment