mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-20 05:04:53 -04:00
allow all MAP files to be read from DDL archive
This commit is contained in:
parent
96eaeb4851
commit
73a4187f79
18 changed files with 185 additions and 165 deletions
|
@ -18,6 +18,8 @@ typedef struct _temp_storage_file_wr {
|
|||
typedef struct _temp_storage_file_rd {
|
||||
std::string_view _data;
|
||||
int skp = 0;
|
||||
void (*deleter)(void *ctx) = nullptr;
|
||||
void *deleter_ctx = nullptr;
|
||||
} TMPFILE_RD;
|
||||
|
||||
struct icompare {
|
||||
|
@ -87,6 +89,7 @@ TMPFILE_WR* temp_storage_append(const char *name) {
|
|||
}
|
||||
|
||||
void temp_storage_close_rd(TMPFILE_RD *f) {
|
||||
if (f->deleter) f->deleter(f->deleter_ctx);
|
||||
delete f;
|
||||
}
|
||||
|
||||
|
@ -167,3 +170,9 @@ void temp_storage_ungetc(TMPFILE_RD *f) {
|
|||
TMPFILE_RD *temp_storage_from_string(const char *content) {
|
||||
return new TMPFILE_RD{{content, std::strlen(content)}};
|
||||
}
|
||||
TMPFILE_RD *temp_storage_from_binary(const void *content, size_t sz, void (*deleter)(void *ctx), void *ctx) {
|
||||
return new TMPFILE_RD{{static_cast<const char *>(content), sz}, 0, deleter, ctx};
|
||||
}
|
||||
uint32_t temp_storage_remain_size(TMPFILE_RD *f) {
|
||||
return f->_data.size();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue