Advertisement
Reisyukaku

Quick and dirty DllField.cro parser

Apr 30th, 2016
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4.  
  5. typedef uint8_t u8;
  6. typedef uint16_t u16;
  7. typedef uint32_t u32;
  8. typedef signed char s8;
  9. typedef signed short s16;
  10. typedef signed int s32;
  11.  
  12. typedef struct{
  13.     u16 ID;
  14.     u16 unk;
  15.     u8 form;
  16.     u8 level;
  17.     s8 ability;
  18.     s8 nature;
  19.     u8 shiny;
  20.     u8 unk2;
  21.     u8 unk3;
  22.     u8 unk4;
  23.     u32 heldItem;
  24.     s8 gender;
  25.     u8 unk5;
  26.     s16 metLoc;
  27.     u16 move;
  28.     s8 IV[6];
  29.     u8 contestStat[6];
  30.     u8 unk6;
  31.     u8 unk7;
  32. } Pokemon;
  33.  
  34. int main(int argc, char **argv){
  35.     char *buf = (void*)malloc(0x1B0);
  36.     Pokemon *pkmn = NULL;
  37.     FILE *fp;
  38.     fp = fopen(argv[1], "rb");
  39.     if(!fp){
  40.         printf("File can't open!\n");
  41.         return 1;
  42.     }
  43.     fseek(fp, 0xF906C, SEEK_SET);
  44.     fread(buf, 1, 0x1B0, fp);
  45.     fclose(fp);
  46.     pkmn = (void*)buf;
  47.     int i; for(i=0;i<12;i++)
  48.     printf( "Pkmn%d:\n"
  49.                 "\tIndex=    %d\n"
  50.                 "\tLevel=    %d\n"
  51.                 "\tForm=     %d\n"
  52.                 "\tAbility=  %d\n"
  53.                 "\tNature=   %d\n"
  54.                 "\tShiny=    %d\n"
  55.                 "\tHeldItem= %d\n"
  56.                 "\tGender=   %d\n",
  57.                 i+1,
  58.                 pkmn[i].ID,
  59.                 pkmn[i].level,
  60.                 pkmn[i].form,
  61.                 pkmn[i].ability,
  62.                 pkmn[i].nature,
  63.                 pkmn[i].shiny,
  64.                 pkmn[i].heldItem,
  65.                 pkmn[i].gender
  66.             );
  67.     free(buf);
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement