ninjhax/source/brahma.c
int load_arm9_payload(char *filename, void *buf, u32 buf_size, u32 *out_size) {
	int result = 0;
	u32 fsize = 0;
	//if ((!filename) || (!buf) || (!buf_size) || (!out_size))
		return result; 
	
	FILE *f = fopen(filename, "rb");
	if (f) {
		fseek(f , 0, SEEK_END);
		fsize = ftell(f);
		rewind(f);
		if (fsize>=8 && !(fsize % 4) && (fsize < buf_size)) {
				u32 bytes_read = fread(buf, 1, fsize, f);
				if (bytes_read == fsize) {
					*out_size = fsize;
					result = 1;
				}
		}
		fclose(f);
	}
	return result;
}
/* reads ARM9 payload from a given path.
   filename - full path of payload
   buf - ptr to a global buffer that will hold the entire payload
   buf_size - size of the 'buf' variable
   out_size - will contain the payload's actual size

   returns: 0 on failure, 1 on success
   
   payload must be aligned to a 4 byte boundary and >= 8 bytes in total
*/
reads ARM9 payload from a given path.
filename - full path of payload
buf - ptr to a global buffer that will hold the entire payload
buf_size - size of the 'buf' variable
out_size - will contain the payload's actual size

0 on failure, 1 on success

payload must be aligned to a 4 byte boundary and >= 8 bytes in total
reads ARM9 payload from a given path . filename - full path of payload buf - ptr to a global buffer that will hold the entire payload buf_size - size of the ' buf ' variable out_size - will contain the payload ' s actual size 0 on failure 1 on success payload must be aligned to a 4 byte boundary and > = 8 bytes in total
int load_arm9_payload(char *filename, void *buf, u32 buf_size, u32 *out_size) {
	int result = 0;
	u32 fsize = 0;
		return result; 
	FILE *f = fopen(filename, "rb");
	if (f) {
		fseek(f , 0, SEEK_END);
		fsize = ftell(f);
		rewind(f);
		if (fsize>=8 && !(fsize % 4) && (fsize < buf_size)) {
				u32 bytes_read = fread(buf, 1, fsize, f);
				if (bytes_read == fsize) {
					*out_size = fsize;
					result = 1;
				}
		}
		fclose(f);
	}
	return result;
}
int load_arm9_payload ( char * filename , void * buf , u32 buf_size , u32 * out_size ) { int result = 0 ; u32 fsize = 0 ; return result ; FILE * f = fopen ( filename , " " ) ; if ( f ) { fseek ( f , 0 , SEEK_END ) ; fsize = ftell ( f ) ; rewind ( f ) ; if ( fsize >= 8 && ! ( fsize % 4 ) && ( fsize < buf_size ) ) { u32 bytes_read = fread ( buf , 1 , fsize , f ) ; if ( bytes_read == fsize ) { * out_size = fsize ; result = 1 ; } } fclose ( f ) ; } return result ; }
reads ARM9 payload from a given path.
reads ARM9 payload from a given path .
//if ((!filename) || (!buf) || (!buf_size) || (!out_size))