Guest User

Untitled

a guest
Dec 8th, 2013
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. local uint32 BASE_SIZE = 0x2000;
  2. local uint32 gfx_ofs = 0;
  3.  
  4. void CSeek(uint32 offset) {
  5. FSeek((offset & 0xFFFFFFF) + 0x10);
  6. }
  7.  
  8. void CSeekElem(uint32 offset, uint32 stride, uint32 elem) {
  9. FSeek((offset & 0xFFFFFFF) + 0x10 + (stride * elem));
  10. }
  11.  
  12. void GSeek(uint32 offset) {
  13. FSeek((offset & 0xFFFFFFF) + gfx_ofs + 0x10);
  14. }
  15.  
  16. void GSeekElem(uint32 offset, uint32 stride, uint32 elem) {
  17. FSeek((offset & 0xFFFFFFF) + gfx_ofs + 0x10 + (stride * elem));
  18. }
  19.  
  20. uint32 get_part_size(uint32 flags) {
  21. local uint32 new_base_size = BASE_SIZE << (int)(flags & 0xf);
  22. local int size = (int)((((flags >> 17) & 0x7f) + (((flags >> 11) & 0x3f) << 1) + (((flags >> 7) & 0xf) << 2) + (((flags >> 5) & 0x3) << 3) + (((flags >> 4) & 0x1) << 4)) * new_base_size);
  23. local int i = 0;
  24. for (i = 0; i < 4; ++i) {
  25. size += (((flags >> (24 + i)) & 1) == 1) ? (new_base_size >> (1 + i)) : 0;
  26. }
  27. return size;
  28. }
  29.  
  30. BigEndian();
  31. struct {
  32. uint32 magic;
  33. uint32 version;
  34. uint32 sys_flags;
  35. uint32 gfx_flags;
  36. gfx_ofs = get_part_size(sys_flags);
  37. local int CPUBLOCKSTART = 0x10;
  38. struct {
  39. struct {
  40. uint32 VTable;
  41. uint32 cpu_addr;
  42. uint32 unknown[2];
  43. struct {
  44. uint32 addr;
  45. uint32 flag;
  46. } unk_ptr_tbl[7]; // I've only looked at the [4]th entry in here - section table
  47. uint32 unknown2[7];
  48. } header;
  49.  
  50. struct {
  51. struct {
  52. CSeek(header.unk_ptr_tbl[4].addr);
  53. struct {
  54. uint32 type; // 0xCE501483 = INST
  55. uint32 size;
  56. uint32 offset;
  57. uint32 null; // always 0x11113333
  58. } sections[3];
  59. } sec_hdr;
  60.  
  61. CSeek(sec_hdr.sections[0].offset);
  62. struct {
  63. struct {
  64. uint32 unk[8];
  65. struct {
  66. float x,y,z;
  67. // Below seems to be a flag of some kind. 0x7FC00001 in the samples I looked at.
  68. // This value is also repeated in the unknown 92 bytes of section 1.
  69. uint32 flag;
  70. } loc[4];
  71. } unk;
  72. } sec0;
  73.  
  74. CSeek(sec_hdr.sections[1].offset); // Static objects
  75. struct {
  76. local int i = 0;
  77. local uint32 num_entries = sec_hdr.sections[1].size / 0x70;
  78. CSeekElem(sec_hdr.sections[1].offset, 0x70, i);
  79. struct {
  80. uint32 null;
  81. uint32 hash;
  82. float x, y, z;
  83. char unknown[92]; // Potentially useful stuff in here
  84. } obj_inst[num_entries];
  85. } sec1;
  86.  
  87. CSeek(sec_hdr.sections[2].offset); // Whats this?
  88. struct {
  89. struct {
  90. uint32 unk[8];
  91. } obj;
  92. } sec2;
  93. } sec;
  94. } xmap;
  95. } RSC7;
Advertisement
Add Comment
Please, Sign In to add comment