mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-13 17:48:28 +03:00
Fixed incorrect write of obj_set
This commit is contained in:
+1
-1
@@ -2894,7 +2894,7 @@ static void a3dc_write_a3da_key_f16(stream& s, a3da_key& value, a3da_compress_f1
|
||||
head.ep_type_post = value.ep_type_post;
|
||||
head.max_frame = value.max_frame;
|
||||
head.length = len;
|
||||
s.write(head);
|
||||
s.write_data(head);
|
||||
|
||||
switch (f16) {
|
||||
case A3DA_COMPRESS_F32F32F32F32:
|
||||
|
||||
+2
-2
@@ -188,7 +188,7 @@ void dds::read(const wchar_t* path) {
|
||||
goto End;
|
||||
|
||||
DDS_HEADER dds_h = {};
|
||||
if (s.read(dds_h) != sizeof(DDS_HEADER))
|
||||
if (s.read_data(dds_h) != sizeof(DDS_HEADER))
|
||||
goto End;
|
||||
|
||||
if (!((dds_h.flags & DDSD_CAPS) && (dds_h.flags & DDSD_HEIGHT)
|
||||
@@ -362,7 +362,7 @@ void dds::write(const wchar_t* path) {
|
||||
s.open(path_dds, L"wb");
|
||||
if (s.check_not_null()) {
|
||||
s.write_uint32_t_reverse_endianness(DDS_MAGIC, true);
|
||||
s.write(dds_h);
|
||||
s.write_data(dds_h);
|
||||
|
||||
uint32_t index = 0;
|
||||
do
|
||||
|
||||
@@ -38,12 +38,12 @@ public:
|
||||
void open(const wchar_t* path, const wchar_t* mode);
|
||||
|
||||
template <typename T>
|
||||
size_t read(T& data) {
|
||||
size_t read_data(T& data) {
|
||||
return read(&data, sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t write(const T& data) {
|
||||
size_t write_data(const T& data) {
|
||||
return write(&data, sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,12 +44,12 @@ public:
|
||||
void copy(std::vector<uint8_t>& data);
|
||||
|
||||
template <typename T>
|
||||
size_t read(T& data) {
|
||||
size_t read_data(T& data) {
|
||||
return read(&data, sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t write(const T& data) {
|
||||
size_t write_data(const T& data) {
|
||||
return write(&data, sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -146,12 +146,12 @@ public:
|
||||
void write_offset_x(int64_t val);
|
||||
|
||||
template <typename T>
|
||||
size_t read(T& data) {
|
||||
size_t read_data(T& data) {
|
||||
return read(&data, sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
size_t write(const T& data) {
|
||||
size_t write_data(const T& data) {
|
||||
return write(&data, sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
+6
-6
@@ -1495,7 +1495,7 @@ static void obj_classic_read_model(obj* obj, prj::shared_ptr<prj::stack_allocato
|
||||
obj->material_array = alloc->allocate<obj_material_data>(obj->num_material);
|
||||
for (uint32_t i = 0; i < obj->num_material; i++) {
|
||||
obj_material_data& mat_data = obj->material_array[i];
|
||||
s.read(mat_data);
|
||||
s.read_data(mat_data);
|
||||
|
||||
for (obj_material_texture_data& j : mat_data.material.texdata)
|
||||
mat4_transpose(&j.tex_coord_mat, &j.tex_coord_mat);
|
||||
@@ -1551,7 +1551,7 @@ static void obj_classic_write_model(obj* obj, stream& s, int64_t base_offset) {
|
||||
s.write_int32_t(0);
|
||||
s.write_int32_t(0);
|
||||
|
||||
for (int64_t& i : mh->vertex)
|
||||
for (int64_t& j : mh->vertex)
|
||||
s.write_int32_t(0);
|
||||
|
||||
s.write_int32_t(0);
|
||||
@@ -1652,7 +1652,7 @@ static void obj_classic_write_model(obj* obj, stream& s, int64_t base_offset) {
|
||||
s.write_uint32_t(mesh->reserved[3]);
|
||||
s.write_uint32_t(mesh->reserved[4]);
|
||||
s.write_uint32_t(mesh->reserved[5]);
|
||||
s.write(&mesh->name, sizeof(mesh->name) - 1);
|
||||
s.write(mesh->name, sizeof(mesh->name) - 1);
|
||||
s.write_char('\0');
|
||||
}
|
||||
s.position_pop();
|
||||
@@ -1665,7 +1665,7 @@ static void obj_classic_write_model(obj* obj, stream& s, int64_t base_offset) {
|
||||
obj_material_data mat_data = obj->material_array[i];
|
||||
for (obj_material_texture_data& j : mat_data.material.texdata)
|
||||
mat4_transpose(&j.tex_coord_mat, &j.tex_coord_mat);
|
||||
s.write(mat_data);
|
||||
s.write_data(mat_data);
|
||||
}
|
||||
}
|
||||
s.align_write(0x10);
|
||||
@@ -4472,7 +4472,7 @@ static void obj_modern_read_model(obj* obj, prj::shared_ptr<prj::stack_allocator
|
||||
obj->material_array = alloc->allocate<obj_material_data>(obj->num_material);
|
||||
for (uint32_t i = 0; i < obj->num_material; i++) {
|
||||
obj_material_data& mat_data = obj->material_array[i];
|
||||
s.read(mat_data);
|
||||
s.read_data(mat_data);
|
||||
|
||||
if (s.big_endian)
|
||||
obj_material_texture_enrs_table.apply(&mat_data);
|
||||
@@ -4880,7 +4880,7 @@ static void obj_modern_write_model(obj* obj, stream& s,
|
||||
obj_material_data mat_data = obj->material_array[i];
|
||||
for (obj_material_texture_data& j : mat_data.material.texdata)
|
||||
mat4_transpose(&j.tex_coord_mat, &j.tex_coord_mat);
|
||||
s.write(mat_data);
|
||||
s.write_data(mat_data);
|
||||
}
|
||||
}
|
||||
s.align_write(0x10);
|
||||
|
||||
@@ -92,7 +92,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
uint8_t buf[0x400];
|
||||
size_t size;
|
||||
if (encrypt) {
|
||||
while (length && (size = in_file.read(buf))) {
|
||||
while (length && (size = in_file.read_data(buf))) {
|
||||
if (length == size) { // PKCS7 Padding
|
||||
uint8_t align = (uint8_t)(0x10 - size % 0x10);
|
||||
for (uint8_t i = 0; i < align; i++)
|
||||
@@ -107,7 +107,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (length && (size = in_file.read(buf))) {
|
||||
while (length && (size = in_file.read_data(buf))) {
|
||||
aes256_cbc_decrypt_buffer(&ctx, buf, size);
|
||||
|
||||
if (length == size) // PKCS7 Padding
|
||||
@@ -152,7 +152,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
uint8_t buf[0x400];
|
||||
size_t size;
|
||||
if (encrypt) {
|
||||
while (length && (size = in_file.read(buf))) {
|
||||
while (length && (size = in_file.read_data(buf))) {
|
||||
if (length == size) { // PKCS7 Padding
|
||||
uint8_t align = (uint8_t)(0x10 - size % 0x10);
|
||||
for (uint8_t i = 0; i < align; i++)
|
||||
@@ -167,7 +167,7 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (length && (size = in_file.read(buf))) {
|
||||
while (length && (size = in_file.read_data(buf))) {
|
||||
aes256_cbc_decrypt_buffer(&ctx, buf, size);
|
||||
|
||||
if (length == size) // PKCS7 Padding
|
||||
|
||||
Reference in New Issue
Block a user