Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Macros | Enumerations | Functions
n64graphics.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <stb/stb_image.h>
#include <stb/stb_image_write.h>
#include "n64graphics.h"
#include "utils.h"

Macros

#define STBI_NO_LINEAR
 
#define STBI_NO_HDR
 
#define STBI_NO_TGA
 
#define STB_IMAGE_IMPLEMENTATION
 
#define STB_IMAGE_WRITE_IMPLEMENTATION
 
#define SCALE_5_8(VAL_)   (((VAL_) * 0xFF) / 0x1F)
 
#define SCALE_8_5(VAL_)   ((((VAL_) + 4) * 0x1F) / 0xFF)
 
#define SCALE_4_8(VAL_)   ((VAL_) * 0x11)
 
#define SCALE_8_4(VAL_)   ((VAL_) / 0x11)
 
#define SCALE_3_8(VAL_)   ((VAL_) * 0x24)
 
#define SCALE_8_3(VAL_)   ((VAL_) / 0x24)
 

Enumerations

enum  img_format {
  IMG_FORMAT_RGBA, IMG_FORMAT_IA, IMG_FORMAT_I, IMG_FORMAT_CI,
  IMG_FORMAT_CI
}
 

Functions

rgbaraw2rgba (const uint8_t *raw, int width, int height, int depth)
 
iaraw2ia (const uint8_t *raw, int width, int height, int depth)
 
iaraw2i (const uint8_t *raw, int width, int height, int depth)
 
rgbarawci2rgba (const uint8_t *rawci, const uint8_t *palette, int width, int height, int depth)
 
int rgba2raw (uint8_t *raw, const rgba *img, int width, int height, int depth)
 
int ia2raw (uint8_t *raw, const ia *img, int width, int height, int depth)
 
int i2raw (uint8_t *raw, const ia *img, int width, int height, int depth)
 
int rgba2png (const char *png_filename, const rgba *img, int width, int height)
 
int ia2png (const char *png_filename, const ia *img, int width, int height)
 
rgbapng2rgba (const char *png_filename, int *width, int *height)
 
iapng2ia (const char *png_filename, int *width, int *height)
 
const charn64graphics_get_read_version (void)
 
const charn64graphics_get_write_version (void)
 

Macro Definition Documentation

◆ SCALE_3_8

#define SCALE_3_8 (   VAL_)    ((VAL_) * 0x24)

◆ SCALE_4_8

#define SCALE_4_8 (   VAL_)    ((VAL_) * 0x11)

◆ SCALE_5_8

#define SCALE_5_8 (   VAL_)    (((VAL_) * 0xFF) / 0x1F)

◆ SCALE_8_3

#define SCALE_8_3 (   VAL_)    ((VAL_) / 0x24)

◆ SCALE_8_4

#define SCALE_8_4 (   VAL_)    ((VAL_) / 0x11)

◆ SCALE_8_5

#define SCALE_8_5 (   VAL_)    ((((VAL_) + 4) * 0x1F) / 0xFF)

◆ STB_IMAGE_IMPLEMENTATION

#define STB_IMAGE_IMPLEMENTATION

◆ STB_IMAGE_WRITE_IMPLEMENTATION

#define STB_IMAGE_WRITE_IMPLEMENTATION

◆ STBI_NO_HDR

#define STBI_NO_HDR

◆ STBI_NO_LINEAR

#define STBI_NO_LINEAR

◆ STBI_NO_TGA

#define STBI_NO_TGA

Enumeration Type Documentation

◆ img_format

enum img_format
Enumerator
IMG_FORMAT_RGBA 
IMG_FORMAT_IA 
IMG_FORMAT_I 
IMG_FORMAT_CI 
IMG_FORMAT_CI 

Function Documentation

◆ i2raw()

int i2raw ( uint8_t *  raw,
const ia img,
int  width,
int  height,
int  depth 
)

◆ ia2png()

int ia2png ( const char png_filename,
const ia img,
int  width,
int  height 
)

◆ ia2raw()

int ia2raw ( uint8_t *  raw,
const ia img,
int  width,
int  height,
int  depth 
)

◆ n64graphics_get_read_version()

const char* n64graphics_get_read_version ( void  )

◆ n64graphics_get_write_version()

const char* n64graphics_get_write_version ( void  )

◆ png2ia()

ia* png2ia ( const char png_filename,
int width,
int height 
)

◆ png2rgba()

rgba* png2rgba ( const char png_filename,
int width,
int height 
)

◆ raw2i()

ia* raw2i ( const uint8_t *  raw,
int  width,
int  height,
int  depth 
)

◆ raw2ia()

ia* raw2ia ( const uint8_t *  raw,
int  width,
int  height,
int  depth 
)

◆ raw2rgba()

rgba* raw2rgba ( const uint8_t *  raw,
int  width,
int  height,
int  depth 
)

◆ rawci2rgba()

rgba* rawci2rgba ( const uint8_t *  rawci,
const uint8_t *  palette,
int  width,
int  height,
int  depth 
)

◆ rgba2png()

int rgba2png ( const char png_filename,
const rgba img,
int  width,
int  height 
)

◆ rgba2raw()

int rgba2raw ( uint8_t *  raw,
const rgba img,
int  width,
int  height,
int  depth 
)