comparison SaveLoad.cpp @ 817:448e6d979c7a

Merge
author Nomad
date Tue, 26 Mar 2013 12:41:41 +0200
parents cfc65feef029 35122475edd7
children bebc19f3d2af
comparison
equal deleted inserted replaced
816:cfc65feef029 817:448e6d979c7a
20 #include "texts.h" 20 #include "texts.h"
21 #include "Log.h" 21 #include "Log.h"
22 22
23 #include "mm7_data.h" 23 #include "mm7_data.h"
24 24
25
26
27 struct SaveDataHeader
28 {
29 int Signature;
30 char txt_ver[4];
31 int compressed_size;
32 int uncompressed_size;
33 };
34 25
35 26
36 27
37 28
38 struct SavegameList *pSavegameList = new SavegameList; 29 struct SavegameList *pSavegameList = new SavegameList;
290 char Str[120]; // [sp+190h] [bp-E0h]@8 281 char Str[120]; // [sp+190h] [bp-E0h]@8
291 int v51; // [sp+208h] [bp-68h]@2 282 int v51; // [sp+208h] [bp-68h]@2
292 int pPositionX; // [sp+20Ch] [bp-64h]@2 283 int pPositionX; // [sp+20Ch] [bp-64h]@2
293 int v53; // [sp+210h] [bp-60h]@2 284 int v53; // [sp+210h] [bp-60h]@2
294 int v54; // [sp+214h] [bp-5Ch]@2 285 int v54; // [sp+214h] [bp-5Ch]@2
295 SaveDataHeader Src; // [sp+218h] [bp-58h]@30 286 ODMHeader Src; // [sp+218h] [bp-58h]@30
296 char v56; // [sp+21Ch] [bp-54h]@30 287 char v56; // [sp+21Ch] [bp-54h]@30
297 char v57; // [sp+21Dh] [bp-53h]@30 288 char v57; // [sp+21Dh] [bp-53h]@30
298 char v58; // [sp+21Eh] [bp-52h]@30 289 char v58; // [sp+21Eh] [bp-52h]@30
299 char v59; // [sp+21Fh] [bp-51h]@30 290 char v59; // [sp+21Fh] [bp-51h]@30
300 int v60; // [sp+220h] [bp-50h]@30 291 int v60; // [sp+220h] [bp-50h]@30
434 { 425 {
435 //__debugbreak(); 426 //__debugbreak();
436 CompactLayingItemsList(); 427 CompactLayingItemsList();
437 compressed_buf = (char*)malloc(1000000); 428 compressed_buf = (char*)malloc(1000000);
438 // v71 = (std::string *)compressed_buf; 429 // v71 = (std::string *)compressed_buf;
439 Src.Signature = 91969; 430 Src.uVersion = 91969;
440 Src.txt_ver[0] = 'm'; 431 Src.pMagic[0] = 'm';
441 Src.txt_ver[1] = 'v'; 432 Src.pMagic[1] = 'v';
442 Src.txt_ver[2] = 'i'; 433 Src.pMagic[2] = 'i';
443 Src.txt_ver[3] = 'i'; 434 Src.pMagic[3] = 'i';
444 Src.compressed_size = 0; 435 Src.uCompressedSize = 0;
445 Src.uncompressed_size = 0; 436 Src.uDecompressedSize = 0;
446 data_write_pos = uncompressed_buff; 437 data_write_pos = uncompressed_buff;
447 memcpy((void *)compressed_buf, &Src, 0x10); 438 memcpy((void *)compressed_buf, &Src, 0x10);
448 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 439 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
449 { 440 {
450 pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces; 441 pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
568 { 559 {
569 memcpy((void *)(compressed_buf + 16), uncompressed_buff, Size); 560 memcpy((void *)(compressed_buf + 16), uncompressed_buff, Size);
570 compressed_block_size = Size; 561 compressed_block_size = Size;
571 } 562 }
572 compressed_block_size += 16; 563 compressed_block_size += 16;
573 memcpy(&((SaveDataHeader *)compressed_buf)->compressed_size, &compressed_block_size, 4); 564 memcpy(&((ODMHeader *)compressed_buf)->uCompressedSize, &compressed_block_size, 4);
574 memcpy(&((SaveDataHeader *)compressed_buf)->uncompressed_size, &Size, 4); 565 memcpy(&((ODMHeader *)compressed_buf)->uDecompressedSize, &Size, 4);
575 sprintf(Source, "%s%s", &Filename, &Ext); 566 sprintf(Source, "%s%s", &Filename, &Ext);
576 strcpy((char *)&pLodDirectory, Source); 567 strcpy((char *)&pLodDirectory, Source);
577 pLodDirectory.uDataSize = compressed_block_size; 568 pLodDirectory.uDataSize = compressed_block_size;
578 if ( pNew_LOD->Write(&pLodDirectory, (const void *)compressed_buf, 0) ) 569 if ( pNew_LOD->Write(&pLodDirectory, (const void *)compressed_buf, 0) )
579 { 570 {