mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-29 10:12:02 +05:30
Added simplier pld unpacking
This commit is contained in:
parent
0ea47e44c3
commit
a7cee528f3
16
test/main.c
16
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) {
|
||||
if (filedata == NULL || filesize <= 0) {
|
||||
return false;
|
||||
}
|
||||
struct PldHeader h;
|
||||
if (filedata != NULL && filesize > 0) {
|
||||
getpldh(&h, filedata);
|
||||
}
|
||||
int size = 0;
|
||||
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