If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Notes:¡Qué pasa, NENG!

From The Cutting Room Floor
Jump to navigation Jump to search

This page contains notes for the game ¡Qué pasa, NENG!.

The game's ISO consists of a Music folder, a Video folder, a Modules folder, and all the game resources (models, textures, sounds) in a uncompressed BIGFILE.PKF packed file.

The fact that textures are uncompressed, and game files for each level are at different positions in the PKF can explain the long loading times that were criticized at the time.

Since I (juanmv94) didn't find any tools working for unpacking this PKF file on the internet, I made this one:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

#define PATHLENGTH 128

struct Entry 
{ 
    unsigned long offset;
    unsigned long size;
    char *name;
    struct Entry *next; 
};

void createDirTree(char *path)
{
    char *start = path, *end = start + strlen(path);
    while (start < end)
    {
        char *slash = strchr(start, '\\');
	if (slash) {
		*slash = 0;
		CreateDirectory(path, NULL);
		//printf("going to make %s\n", path);
		*slash = '\\';
		start = slash + 1;
	}
        else break;
    }
}

int main(int argc, char** argv) {
	unsigned long p;
	FILE *f=fopen(argv[1],"rb");
	if (f==NULL) return -1;
	fseek(f,-4,SEEK_END);
	fread(&p,4,1,f);
	fseek(f,p,SEEK_SET);
	struct Entry mainEntry={.next= NULL};
	struct Entry *curEntry=&mainEntry;
	while (fread(&(curEntry->offset),4,1,f)==1 && fread(&(curEntry->size),4,1,f)==1) {
		if (curEntry->offset==0 && curEntry->size==0) break;
		curEntry->name=malloc(PATHLENGTH);
		for (int i=0;i<PATHLENGTH;i++) {
			curEntry->name[i]=fgetc(f);
			if (curEntry->name[i]==0) break;
		}
		curEntry=curEntry->next=malloc(sizeof(struct Entry));
		curEntry->next=NULL;
	}
	
	curEntry=&mainEntry;
	while(curEntry->next!=NULL) {
		fseek(f,curEntry->offset,SEEK_SET);
		void *pt=malloc(curEntry->size);
		if (fread(pt,curEntry->size,1,f)!=1) return -3;
		createDirTree(curEntry->name);
		printf("Creating: %s\n",curEntry->name);
		FILE *n=fopen(curEntry->name,"wb");
		if (n==NULL) return -4;
		if (fwrite(pt,curEntry->size,1,n)!=1) return -5;
		fclose(n);
		curEntry=curEntry->next;
	}
	fclose(f);
	puts("Completed!");
	return 0;
}

It gets the PKF file as parameter and unpacks it at the current folder.