|
| 1 | +#ifndef __LIBOGC_CONSOLE_H__ |
| 2 | +#define __LIBOGC_CONSOLE_H__ |
| 3 | + |
| 4 | +/*! |
| 5 | + * \file console.h |
| 6 | + * \brief Console subsystem |
| 7 | + * |
| 8 | + */ |
| 9 | + |
| 10 | +#include "gx_struct.h" |
| 11 | + |
| 12 | +/* macros to support old function names */ |
| 13 | +#define console_init CON_Init |
| 14 | +#define SYS_ConsoleInit CON_InitEx |
| 15 | + |
| 16 | +#define CONSOLE_ESC(x) "\x1b[" #x |
| 17 | +#define CONSOLE_RESET CONSOLE_ESC(0m) |
| 18 | +#define CONSOLE_BLACK CONSOLE_ESC(30m) |
| 19 | +#define CONSOLE_RED CONSOLE_ESC(31;1m) |
| 20 | +#define CONSOLE_GREEN CONSOLE_ESC(32;1m) |
| 21 | +#define CONSOLE_YELLOW CONSOLE_ESC(33;1m) |
| 22 | +#define CONSOLE_BLUE CONSOLE_ESC(34;1m) |
| 23 | +#define CONSOLE_MAGENTA CONSOLE_ESC(35;1m) |
| 24 | +#define CONSOLE_CYAN CONSOLE_ESC(36;1m) |
| 25 | +#define CONSOLE_WHITE CONSOLE_ESC(37;1m) |
| 26 | + |
| 27 | +#ifdef __cplusplus |
| 28 | + extern "C" { |
| 29 | +#endif |
| 30 | + |
| 31 | +/*! |
| 32 | + * \fn CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride) |
| 33 | + * \brief Initializes the console subsystem with given parameters |
| 34 | + * |
| 35 | + * \param[in] framebuffer pointer to the framebuffer used for drawing the characters |
| 36 | + * \param[in] xstart,ystart start position of the console output in pixel |
| 37 | + * \param[in] xres,yres size of the console in pixel |
| 38 | + * \param[in] stride size of one line of the framebuffer in bytes |
| 39 | + * |
| 40 | + * \return none |
| 41 | + */ |
| 42 | +void CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride); |
| 43 | + |
| 44 | +/*! |
| 45 | + * \fn s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight) |
| 46 | + * \brief Initialize stdout console |
| 47 | + * \param[in] rmode pointer to the video/render mode configuration |
| 48 | + * \param[in] conXOrigin starting pixel in X direction of the console output on the external framebuffer |
| 49 | + * \param[in] conYOrigin starting pixel in Y direction of the console output on the external framebuffer |
| 50 | + * \param[in] conWidth width of the console output 'window' to be drawn |
| 51 | + * \param[in] conHeight height of the console output 'window' to be drawn |
| 52 | + * |
| 53 | + * \return 0 on success, <0 on error |
| 54 | + */ |
| 55 | +s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight); |
| 56 | + |
| 57 | +/*! |
| 58 | + * \fn CON_GetMetrics(int *cols, int *rows) |
| 59 | + * \brief retrieve the columns and rows of the current console |
| 60 | + * |
| 61 | + * \param[out] cols,rows number of columns and rows of the current console |
| 62 | + * |
| 63 | + * \return none |
| 64 | + */ |
| 65 | +void CON_GetMetrics(int *cols, int *rows); |
| 66 | + |
| 67 | +/*! |
| 68 | + * \fn CON_GetPosition(int *col, int *row) |
| 69 | + * \brief retrieve the current cursor position of the current console |
| 70 | + * |
| 71 | + * \param[out] col,row current cursor position |
| 72 | + * |
| 73 | + * \return none |
| 74 | + */ |
| 75 | +void CON_GetPosition(int *cols, int *rows); |
| 76 | + |
| 77 | +/*! |
| 78 | + * \fn CON_EnableGecko(int channel, int safe) |
| 79 | + * \brief Enable or disable the USB gecko console. |
| 80 | + * |
| 81 | + * \param[in] channel EXI channel, or -1 ¨to disable the gecko console |
| 82 | + * \param[in] safe If true, use safe mode (wait for peer) |
| 83 | + * |
| 84 | + * \return none |
| 85 | + */ |
| 86 | +void CON_EnableGecko(int channel,int safe); |
| 87 | + |
| 88 | +#ifdef __cplusplus |
| 89 | + } |
| 90 | +#endif |
| 91 | + |
| 92 | +#endif |
0 commit comments