Home » Fable TLC » Development » Advanced Modding » BigTools
Re: .big Reading [message #66235 is a reply to message #66032] |
Wed, 28 March 2012 20:10 |
|
Alright, I've written some code that seems to work, but I'm not convinced. The output is giving me a bank address of 401621575, which just seems too big to me. Am I missing something?
- edit -
I've fixed an error, and gotten a more reasonable bank address value: 6570567
My Code
/* Reads a Fable: TLC .big file and exports texture files
* Version: 0.1 - Alpha
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INFILE "in.big"
#define BUFFER_SIZE 500
int main()
{
// Open a file stream
FILE *inBig;
char *buffer = (char *) malloc(BUFFER_SIZE);
inBig = fopen(INFILE, "r");
size_t numElementsRead;
if (!inBig)
{
printf("Error opening file! Make sure it is named 'in.big' and placed in the correct folder.");
fclose(inBig);
return -1;
}
numElementsRead = fread(buffer, 4, 4, inBig);
if (numElementsRead != 4)
printf("What the hell!? Read: %d", numElementsRead);
// Capture the bank address
buffer += 2;
long *bankAddress;
bankAddress = (long *) buffer;
buffer -= 2;
printf("Bank Address: %ld", *bankAddress);
fclose(inBig);
return 0;
}
"All of the work, and none of the play, will surely provide for a speedy decay"
[Updated on: Wed, 28 March 2012 20:53] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Nov 24 15:35:09 PST 2024
Total time taken to generate the page: 0.12530 seconds
|