docs: add docs/

This commit is contained in:
Zy 2024-09-25 00:26:54 +02:00
parent 747816c5fd
commit 89fcea15b0
5 changed files with 127 additions and 0 deletions

7
docs/apt.md Normal file
View file

@ -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.

13
docs/console.md Normal file
View file

@ -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.

26
docs/gfx.md Normal file
View file

@ -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.

12
docs/gspgpu.md Normal file
View file

@ -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).

69
docs/hid.md Normal file
View file

@ -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;
```