devil1tex.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef DEVIL1TEX_H
  2. #define DEVIL1TEX_H
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. // disable struct padding
  6. // to easily impose struct on plain data.
  7. #pragma pack(push, 1)
  8. struct TexturePack {
  9. char id[4];
  10. int32_t batchNumber;
  11. uint32_t firstBatchOffset; // <format=hex>
  12. uint32_t unknownA;
  13. };
  14. struct TextureBatchDescriptor{
  15. int32_t batchIdx;
  16. uint32_t hash; // <format=hex>
  17. uint32_t texNumber;
  18. uint32_t unknownA[8]; // <format=hex>
  19. uint32_t textureSize; // <format=hex>
  20. uint32_t unknownB[30];
  21. };
  22. struct Texture {
  23. // size of array is defined by descriptor
  24. // textureSize
  25. unsigned char *data;
  26. };
  27. struct TextureBatch {
  28. // quantity of textures are defined by descriptor
  29. // texNumber
  30. struct Texture *batch;
  31. };
  32. #pragma pack(pop)
  33. typedef struct {
  34. // input: pointer to struct
  35. void (* const printheader) (struct TexturePack*);
  36. // input: pointer to struct
  37. void (* const printbatchdesc)(struct TextureBatchDescriptor*);
  38. // input: pointer to struct, file data
  39. bool (* const getheader) (struct TexturePack**, const char*);
  40. // input: pointer of pointer to struct, order, file data, file size
  41. // ** = 'pass by reference' of a pointer to struct
  42. bool (* const getbatchdesc) (struct TextureBatchDescriptor**,
  43. unsigned int,
  44. const char *,
  45. unsigned int);
  46. // input: pointer of pointer to struct, order, file data, file size
  47. // ** = 'pass by reference' of a pointer to struct
  48. bool (* const getbatch) (struct TextureBatch**,
  49. unsigned int,
  50. const char*,
  51. unsigned int);
  52. // input: pointer to struct, order, file data, file size
  53. bool (* const gettextures) (struct Texture*,
  54. unsigned int,
  55. const char*,
  56. const unsigned int);
  57. } fn_devil1tex;
  58. extern fn_devil1tex const DEVIL1TEX;
  59. #endif