|
@@ -3,10 +3,10 @@
|
|
#include "EasyLogging++/easylogging++.h"
|
|
#include "EasyLogging++/easylogging++.h"
|
|
#include <DatOperationResult.h>
|
|
#include <DatOperationResult.h>
|
|
|
|
|
|
-#include "DatSubsystems/DatIO.h"
|
|
|
|
#include <algorithm>
|
|
#include <algorithm>
|
|
#include <locale>
|
|
#include <locale>
|
|
#include <DatSubsystems/DatIO.h>
|
|
#include <DatSubsystems/DatIO.h>
|
|
|
|
+#include <zconf.h>
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
@@ -238,7 +238,8 @@ namespace LOTRO_DAT {
|
|
if (data_offset + size > data.size())
|
|
if (data_offset + size > data.size())
|
|
return DatOperationResult<>(ERROR, "IOWRITEDATA: writing more than BinaryData size.");
|
|
return DatOperationResult<>(ERROR, "IOWRITEDATA: writing more than BinaryData size.");
|
|
|
|
|
|
- UpdateBufferIfNeeded(size);
|
|
|
|
|
|
+ if (offset + size > actual_dat_size_)
|
|
|
|
+ UpdateBufferIfNeeded(offset + size - actual_dat_size_);
|
|
|
|
|
|
if (offset != ftell(file_handler_))
|
|
if (offset != ftell(file_handler_))
|
|
fseek(file_handler_, offset, SEEK_SET);
|
|
fseek(file_handler_, offset, SEEK_SET);
|
|
@@ -260,9 +261,10 @@ namespace LOTRO_DAT {
|
|
*/
|
|
*/
|
|
|
|
|
|
DatOperationResult<> DatIO::DeInit() {
|
|
DatOperationResult<> DatIO::DeInit() {
|
|
- if (file_handler_ != nullptr) {
|
|
|
|
|
|
+ if (file_handler_ != nullptr)
|
|
fclose(file_handler_);
|
|
fclose(file_handler_);
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ truncate64(filename_.c_str(), actual_dat_size_);
|
|
|
|
|
|
filename_ = "none";
|
|
filename_ = "none";
|
|
file_handler_ = nullptr;
|
|
file_handler_ = nullptr;
|
|
@@ -276,6 +278,7 @@ namespace LOTRO_DAT {
|
|
fragmentation_journal_end = 0;
|
|
fragmentation_journal_end = 0;
|
|
root_directory_offset = 0;
|
|
root_directory_offset = 0;
|
|
fragmentation_journal_offset = 0;
|
|
fragmentation_journal_offset = 0;
|
|
|
|
+ elapsed_eof_buffer_ = 0;
|
|
|
|
|
|
return DatOperationResult<>(SUCCESS, "File deinitialisation successfull");
|
|
return DatOperationResult<>(SUCCESS, "File deinitialisation successfull");
|
|
}
|
|
}
|