Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Functions
libmio0.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libmio0.h"
#include "utils.h"

Data Structures

struct  lookback
 

Macros

#define MIO0_VERSION   "0.1"
 
#define GET_BIT(buf, bit)   ((buf)[(bit) / 8] & (1 << (7 - ((bit) % 8))))
 
#define LOOKBACK_COUNT   256
 
#define LOOKBACK_INIT_SIZE   128
 

Functions

static lookbacklookback_init (void)
 
static void lookback_free (lookback *lb)
 
static void lookback_push (lookback *lkbk, unsigned char val, int index)
 
static void PUT_BIT (unsigned char *buf, int bit, int val)
 
static int find_longest (const unsigned char *buf, int start_offset, int max_search, int *found_offset, lookback *lkbk)
 
int mio0_decode_header (const unsigned char *buf, mio0_header_t *head)
 
void mio0_encode_header (unsigned char *buf, const mio0_header_t *head)
 
int mio0_decode (const unsigned char *in, unsigned char *out, unsigned int *end)
 
int mio0_encode (const unsigned char *in, unsigned int length, unsigned char *out)
 
int mio0_decode_file (const char *in_file, unsigned long offset, const char *out_file)
 
int mio0_encode_file (const char *in_file, const char *out_file)
 

Macro Definition Documentation

◆ GET_BIT

#define GET_BIT (   buf,
  bit 
)    ((buf)[(bit) / 8] & (1 << (7 - ((bit) % 8))))

◆ LOOKBACK_COUNT

#define LOOKBACK_COUNT   256

◆ LOOKBACK_INIT_SIZE

#define LOOKBACK_INIT_SIZE   128

◆ MIO0_VERSION

#define MIO0_VERSION   "0.1"

Function Documentation

◆ find_longest()

static int find_longest ( const unsigned char buf,
int  start_offset,
int  max_search,
int found_offset,
lookback lkbk 
)
static

◆ lookback_free()

static void lookback_free ( lookback lb)
static

◆ lookback_init()

static lookback* lookback_init ( void  )
static

◆ lookback_push()

static void lookback_push ( lookback lkbk,
unsigned char  val,
int  index 
)
inlinestatic

◆ mio0_decode()

int mio0_decode ( const unsigned char in,
unsigned char out,
unsigned int end 
)

◆ mio0_decode_file()

int mio0_decode_file ( const char in_file,
unsigned long  offset,
const char out_file 
)

◆ mio0_decode_header()

int mio0_decode_header ( const unsigned char buf,
mio0_header_t head 
)

◆ mio0_encode()

int mio0_encode ( const unsigned char in,
unsigned int  length,
unsigned char out 
)

◆ mio0_encode_file()

int mio0_encode_file ( const char in_file,
const char out_file 
)

◆ mio0_encode_header()

void mio0_encode_header ( unsigned char buf,
const mio0_header_t head 
)

◆ PUT_BIT()

static void PUT_BIT ( unsigned char buf,
int  bit,
int  val 
)
static