mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-25 16:28:57 +05:30
Added simplier pld unpacking
This commit is contained in:
parent
0ea47e44c3
commit
a7cee528f3
14
test/main.c
14
test/main.c
@ -93,16 +93,22 @@ char *loadfile(const char *fname, unsigned int *s) {
|
||||
bool unpackpld(const char *filedata,
|
||||
unsigned int filesize,
|
||||
const char *filename) {
|
||||
struct PldHeader h;
|
||||
if (filedata != NULL && filesize > 0) {
|
||||
getpldh(&h, filedata);
|
||||
if (filedata == NULL || filesize <= 0) {
|
||||
return false;
|
||||
}
|
||||
struct PldHeader h;
|
||||
getpldh(&h, filedata);
|
||||
char *fn = NULL;
|
||||
fn = (char*)malloc(strlen(filename) + 3 + 4);
|
||||
int size = 0;
|
||||
unsigned int i = 0;
|
||||
for (i = 0; i < h.numOffset; i++) {
|
||||
size = sizeofpldstruct(&h, i, filesize);
|
||||
printf("%x\n", size);
|
||||
sprintf(fn, "%s_%d", filename, i);
|
||||
write(fn, filedata + h.offsets[i], size);
|
||||
}
|
||||
free(fn);
|
||||
return true;
|
||||
}
|
||||
|
||||
void write(const char *filename,
|
||||
|
Loading…
Reference in New Issue
Block a user