Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "genfile.h"
  2. #include "datafile.h"
  3. #include "harness/trace.h"
  4.  
  5. #include "CORE/V1DB/chunkids.h"
  6. #include <stddef.h>
  7. #include <stdlib.h>
  8.  
  9. br_file_enum_member file_type_FM[10] = {
  10.     { FILE_TYPE_NONE, "FILE_TYPE_NONE" },
  11.     { FILE_TYPE_ACTORS, "FILE_TYPE_ACTORS" },
  12.     { FILE_TYPE_PIXELMAP, "FILE_TYPE_PIXELMAP" },
  13.     { FILE_TYPE_LIGHT, "FILE_TYPE_LIGHT" },
  14.     { FILE_TYPE_CAMERA, "FILE_TYPE_CAMERA" },
  15.     { FILE_TYPE_MATERIAL_OLD, "FILE_TYPE_MATERIAL_OLD" },
  16.     { FILE_TYPE_MODEL, "FILE_TYPE_MODEL" },
  17.     { FILE_TYPE_ANIMATION, "FILE_TYPE_ANIMATION" },
  18.     { FILE_TYPE_TREE, "FILE_TYPE_TREE" },
  19.     { FILE_TYPE_MATERIAL, "FILE_TYPE_MATERIAL" },
  20. };
  21. br_file_enum file_type_F = { BR_ASIZE(file_type_FM), file_type_FM };
  22.  
  23. br_file_struct_member file_info_FM[2] = {
  24.     { DF_TYPE_ENUM_32,  offsetof(file_info, type), "type", &file_type_F },
  25.     { DF_TYPE_BR_UINT_32, offsetof(file_info, version), "version", NULL },
  26. };
  27. br_file_struct file_info_F = { "file_info", BR_ASIZE(file_info_FM), file_info_FM, sizeof(file_info) };
  28.  
  29. // IDA: int __usercall FopRead_END@<EAX>(br_datafile *df@<EAX>, br_uint_32 id@<EDX>, br_uint_32 length@<EBX>, br_uint_32 count@<ECX>)
  30. int FopRead_END(br_datafile* df, br_uint_32 id, br_uint_32 length, br_uint_32 count) {
  31.     return 1;
  32. }
  33.  
  34. // IDA: int __usercall FopWrite_END@<EAX>(br_datafile *df@<EAX>)
  35. int FopWrite_END(br_datafile* df) {
  36.     LOG_TRACE("(%p)", df);
  37.  
  38.     df->prims->chunk_write(df, CHUNKID_END, 0);
  39.     return 1; // Pierre-Marie Baty -- function must return a value
  40. }
  41.  
  42. // IDA: int __usercall FopWrite_FILE_INFO@<EAX>(br_datafile *df@<EAX>, br_uint_32 type@<EDX>)
  43. int FopWrite_FILE_INFO(br_datafile* df, br_uint_32 type) {
  44.     file_info fi;
  45.     LOG_TRACE("(%p, %d)", df, type);
  46.  
  47.     fi.type = type;
  48.     fi.version = 2;
  49.     df->prims->chunk_write(df, CHUNKID_FILE_INFO, df->prims->struct_size(df, &file_info_F, &fi));
  50.     df->prims->struct_write(df, &file_info_F, &fi);
  51.     return 0;
  52. }
  53.