From 89fcea15b0fb22094fbf81a4a9158d5b1a4b6a50 Mon Sep 17 00:00:00 2001 From: Zy Date: Wed, 25 Sep 2024 00:26:54 +0200 Subject: [PATCH] docs: add docs/ --- docs/apt.md | 7 +++++ docs/console.md | 13 ++++++++++ docs/gfx.md | 26 +++++++++++++++++++ docs/gspgpu.md | 12 +++++++++ docs/hid.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 docs/apt.md create mode 100644 docs/console.md create mode 100644 docs/gfx.md create mode 100644 docs/gspgpu.md create mode 100644 docs/hid.md diff --git a/docs/apt.md b/docs/apt.md new file mode 100644 index 0000000..54030ad --- /dev/null +++ b/docs/apt.md @@ -0,0 +1,7 @@ +# apt.h +"Applet service." To use everything the 3DS can do. + +## `bool aptMainLoop(void);` +Handle sleep mode and HOME/power buttons, call it at the beginning of +each frame. +If it returns false, that means the program should return. \ No newline at end of file diff --git a/docs/console.md b/docs/console.md new file mode 100644 index 0000000..401fc50 --- /dev/null +++ b/docs/console.md @@ -0,0 +1,13 @@ +# console.h + +## `void consoleInit(gfxScreen_t screen, NULL);` +Show the (default) console on the specified screen. +Apparently no need for any gfx function. + +## `void consoleClear(void);` +Clear the console. + +## CONSOLE_* +CONSOLE_ESC(x): use ASCII escape code. ("\e[" + x) +CONSOLE_RESET: reset font style. +CONSOLE_{BLACK|RED|GREEN|YELLOW|BLUE|MAGENTA|CYAN|WHITE}: use a specific color. diff --git a/docs/gfx.md b/docs/gfx.md new file mode 100644 index 0000000..3856cb8 --- /dev/null +++ b/docs/gfx.md @@ -0,0 +1,26 @@ +# gfx.h +Screen buffers for graphice. + + +## `void gfxInitDefault(void);` +Initialize LCD framebuffers with default parameters: + gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false); +Internally calls `gspInit()`. + +## `void gfxExit(void);` +Destroy everything gfx-related. + +## `void gfxFlushBuffers(void);` +Draw the buffer. + +## `void gfxSwapBuffers(void);` +??? idk call it after gfxFlushBuffer(). + +## `enum gfxScreen_t;` +Represents each screen. +- GFX_TOP: Top screen. +- GFX_BOTTOM: Bottom screen. +## `enum gfx3dSide_t;` +Represent each image for the 3D screen. +GFX_LEFT: Left eye. +GFX_RIGHT: Right eye. \ No newline at end of file diff --git a/docs/gspgpu.md b/docs/gspgpu.md new file mode 100644 index 0000000..8bd3922 --- /dev/null +++ b/docs/gspgpu.md @@ -0,0 +1,12 @@ +# gspgpu.h +Graphical things. + +## `void gspWaitForVBlank(void);` +Wait for the vertical sync to be done??? idk just call it before drawing +anything (TODO visual) + +## Resolutions +GSP_SCREEN_WIDTH: Width of both screens (240). +GSP_SCREEN_HEIGHT_TOP: Height of the top screen (400). +GSP_SCREEN_HEIGHT_TOP_2X: Height of the top screen times 2 (800). +GSP_SCREEN_HEIGHT_TOPBOTTOM: Height of the bottom screen (320). \ No newline at end of file diff --git a/docs/hid.md b/docs/hid.md new file mode 100644 index 0000000..4131541 --- /dev/null +++ b/docs/hid.md @@ -0,0 +1,69 @@ +# hid.h +Self-explanatory lol + +## BASE + +### `Result hidInit(void);` +Inilialize HID. + +### `void hidExit(void);` +Exit HID. + +### `void hidScanInput(void);` +Check the status of each button. Must be called before hidKeys*(). + +## BUTTONS + +### `u32 hidKeys*(void);` +Test a certain condition and return a u32 containing the boolean state for each +button. (TODO visual) +Use `hidKey*() & KEY_*` to have the boolean value for a specific button. +- `u32 hidKeysHeld();` +True if the key is currently pressed. +- `u32 hidKeysDown();` +True if the key has just been pressed. (TODO not only once?) +- `u32 hidKeysDownRepeat();` +TODO +- `u32 hidKeysUp();` +True if the key has just been released. + +### KEY_* +Simple buttons: +- KEY_{A|B|X|Y}: A/B/X/Y buttons. +- KEY_{SELECT|START}: Select/Start buttons. +- KEY_{L|R}: L/R buttons. +Directions: +- KEY_D{RIGHT|LEFT|UP|DOWN}: D-Pad directions. +- KEY_CPAD_{RIGHT|LEFT|UP|DOWN}: Circle Pad directions. +- KEY_{UP|DOWN|LEFT|RIGHT}: Catch Circle Pad and D-Pad at the same time. +New 3DS only: +- KEY_{ZL|ZR}: ZL/ZR buttons (New 3DS only) +- KEY_CSTICK{RIGHT|LEFT|UP|DOWN}: C-Stick directions (New 3DS only) +Uh? +- KEY_TOUCH: (Not implemented? TODO) + +## TOUCH SCREEN + +### `void hidTouchRead(touchPosition *dest);` +Read the current touch position. + +### `typedef touchPosition;` +```c++ +typedef struct { + u16 px; + u16 py; +} touchPosition; +``` + +## TOUCH SCREEN + +### `void hidCircleRead(circlePosition *dest);` +Read the current circle pad position. + +### `typedef circlePosition;` +```c++ +typedef struct { + u16 dx; + u16 dy; +} circlePosition; +``` \ No newline at end of file