N64 QOI Encoder Demo 1.0.1
Encoder for N64 that saves it to SD card
Loading...
Searching...
No Matches
main.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <libdragon.h>
#include "config.h"
#include "qoi_enc_n64.h"
#include "colorconv.h"

Go to the source code of this file.

Macros

#define ENC_BUFFER_SIZE   4096
 Small buffer size for encoder because of memory constrant of 4MB for N64 without the 4MB Expansion Pak.

Enumerations

enum  whichScreenshotType {
  SCREENSHOT_NEVER_TAKEN , SCREENSHOT_TYPE_NULL , SCREENSHOT_TYPE_RAW , SCREENSHOT_TYPE_QOI ,
  SCREENSHOT_FRAME_CAPTURED , SCREENSHOT_NO_SD_CARD
}
 Checks what type of screenshot was taken to perform different actions based on the type of screenshot taken, such as displaying different information on the screen or saving the screenshot in a different way. More...

Functions

bool save_screenshot (surface_t *disp, const char *filename, uint32_t *bytesWritten)
 Saves the screenshot to the SD card if it somehow exists.
bool save_screenshot_null (surface_t *disp, uint32_t *bytesWritten)
 Saves the screenshot to null, which is used for testing the performance of the encoder without the bottleneck of writing to the SD card.
bool save_screenshot_raw (surface_t *disp, const char *filename, uint32_t *bytesWritten)
 Saves the raw screenshot to the SD card if it somehow exists.
int main (void)
 Entry point for this N64 ROM.

Variables

enum whichScreenshotType whichScreenshotType

Macro Definition Documentation

◆ ENC_BUFFER_SIZE

#define ENC_BUFFER_SIZE   4096

Small buffer size for encoder because of memory constrant of 4MB for N64 without the 4MB Expansion Pak.

Definition at line 49 of file main.c.

Enumeration Type Documentation

◆ whichScreenshotType

Checks what type of screenshot was taken to perform different actions based on the type of screenshot taken, such as displaying different information on the screen or saving the screenshot in a different way.

Enumerator
SCREENSHOT_NEVER_TAKEN 

No screenshot has been taken yet.

SCREENSHOT_TYPE_NULL 

The screenshot was saved to null, which is used for testing the performance of the encoder without the bottleneck of writing to the SD card.

SCREENSHOT_TYPE_RAW 

The screenshot was saved as a raw file, which is used for testing the performance of writing to the SD card without the bottleneck of encoding the image.

SCREENSHOT_TYPE_QOI 

The screenshot was saved as a QOI file, which is the main functionality of this project.

SCREENSHOT_FRAME_CAPTURED 

The screenshot was captured into a buffer but not saved, which is used for testing the performance of capturing the framebuffer without the bottleneck of encoding or writing to the SD card.

SCREENSHOT_NO_SD_CARD 

The screenshot was not saved because the SD card doesn't exist, which is used for testing the performance of the encoder and framebuffer capture.

Definition at line 52 of file main.c.

Function Documentation

◆ main()

int main ( void )

Entry point for this N64 ROM.

Parameters
nothingbecause we are running this on the N64 and we don't have access to command line arguments
Returns
nothing

mutex_unlock(&mutex);

Definition at line 232 of file main.c.

◆ save_screenshot()

bool save_screenshot ( surface_t * disp,
const char * filename,
uint32_t * bytesWritten )

Saves the screenshot to the SD card if it somehow exists.

Parameters
dispThe surface to capture, which is the framebuffer of the N64 display
filenameThe name of the file to save the screenshot to
bytesWrittenThe number of bytes written to the file
Returns
Success of saving the screenshot

Definition at line 75 of file main.c.

◆ save_screenshot_null()

bool save_screenshot_null ( surface_t * disp,
uint32_t * bytesWritten )

Saves the screenshot to null, which is used for testing the performance of the encoder without the bottleneck of writing to the SD card.

Parameters
dispThe surface to capture, which is the framebuffer of the N64 display
bytesWrittenThe number of bytes written to the file
Returns
Success of saving the screenshot

Definition at line 146 of file main.c.

◆ save_screenshot_raw()

bool save_screenshot_raw ( surface_t * disp,
const char * filename,
uint32_t * bytesWritten )

Saves the raw screenshot to the SD card if it somehow exists.

Parameters
dispThe surface to capture, which is the framebuffer of the N64 display
filenameThe name of the file to save the screenshot to
bytesWrittenThe number of bytes written to the file
Returns
Success of saving the screenshot

Definition at line 207 of file main.c.

Variable Documentation

◆ whichScreenshotType