mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
Use mt19937_xorcode helper function
This commit is contained in:
+1
-4
@@ -95,10 +95,7 @@ static uint8_t *chr_get(int id)
|
||||
free(data);
|
||||
data = NULL;
|
||||
} else {
|
||||
struct mt19937 mt;
|
||||
mt19937_init(&mt, 12753);
|
||||
for (size_t i = 4; i < size; i++)
|
||||
data[i] ^= mt19937_genrand(&mt);
|
||||
mt19937_xorcode(data + 4, size - 4, 12753);
|
||||
slot->value = data;
|
||||
}
|
||||
free(path);
|
||||
|
||||
+1
-4
@@ -274,10 +274,7 @@ static int DataFile_Open(int link)
|
||||
uint8_t *compressed_data = xmalloc(compressed_size);
|
||||
buffer_read_bytes(&r, compressed_data, compressed_size);
|
||||
archive_free_data(dfile);
|
||||
struct mt19937 mt;
|
||||
mt19937_init(&mt, 4588163);
|
||||
for (size_t i = 0; i < compressed_size; i++)
|
||||
compressed_data[i] ^= mt19937_genrand(&mt);
|
||||
mt19937_xorcode(compressed_data, compressed_size, 4588163);
|
||||
|
||||
uint8_t *raw = xmalloc(uncompressed_size);
|
||||
int rv = uncompress(raw, &uncompressed_size, compressed_data, compressed_size);
|
||||
|
||||
+1
-4
@@ -95,10 +95,7 @@ static bool MapLoader_Load(int map_no)
|
||||
free(map_data);
|
||||
map_data = NULL;
|
||||
} else {
|
||||
struct mt19937 mt;
|
||||
mt19937_init(&mt, 12753);
|
||||
for (size_t i = 4; i < map_size; i++)
|
||||
map_data[i] ^= mt19937_genrand(&mt);
|
||||
mt19937_xorcode(map_data + 4, map_size - 4, 12753);
|
||||
}
|
||||
free(path);
|
||||
return !!map_data;
|
||||
|
||||
+1
-1
Submodule subprojects/libsys4 updated: 7ee34d622b...c5d3cb955e
Reference in New Issue
Block a user