GBDK 2020 Docs  4.4.0
API Documentation for GBDK 2020
model.h File Reference
#include <gbdk/platform.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define MEGADUCK_HANDHELD_STANDARD   0u
 
#define MEGADUCK_LAPTOP_SPANISH   1u
 
#define MEGADUCK_LAPTOP_GERMAN   2u
 

Functions

uint8_t duck_check_model (void)
 

Macro Definition Documentation

◆ MEGADUCK_HANDHELD_STANDARD

#define MEGADUCK_HANDHELD_STANDARD   0u

◆ MEGADUCK_LAPTOP_SPANISH

#define MEGADUCK_LAPTOP_SPANISH   1u

◆ MEGADUCK_LAPTOP_GERMAN

#define MEGADUCK_LAPTOP_GERMAN   2u

Function Documentation

◆ duck_check_model()

uint8_t duck_check_model ( void  )

Returns which MegaDuck Model the program is being run on

Possible models are:

This detection should be called immediately at the start of the program for most reliable results, since it relies on inspecting uncleared VRAM contents.

It works by checking for distinct font VRAM Tile Patterns (which aren't cleared before cart program launch) between the Spanish and German Laptop models which have slightly different character sets.

So VRAM must not be cleared or modified at program startup until after this function is called (not by the crt0.s, not by the program itself).

Note
This detection may not work in emulators which don't simulate the preloaded Laptop System ROM font tiles in VRAM.