29 #include YFM_YCLib_Video
30 #include YFM_YCLib_NativeAPI
37 using ::lcdMainOnBottom;
40 using ::videoSetModeSub;
54 static_assert(
sizeof(PixelType) ==
sizeof(PixelType::Trait::IntegerType),
55 "Wrong size of pixel type found.");
56 static_assert(
yalignof(PixelType) ==
yalignof(PixelType::Trait::IntegerType),
57 "Wrong alignment of pixel type found.");
63 extern const u8 default_font[];
66 ::PrintConsole mainConsole{
68 reinterpret_cast<std::uint16_t*
>(
const_cast<u8*
>(default_font)), \
94 ::videoSetMode(MODE_0_2D);
95 ::vramSetBankA(VRAM_A_MAIN_BG);
96 return ::consoleInit(
nullptr, mainConsole.bgLayer,
97 BgType_Text4bpp, BgSize_T_256x256,
98 mainConsole.mapBase, mainConsole.gfxBase,
true,
true);
109 #define BITALPHA BIT(15)
110 // PrintConsole* p(dspIndex ? consoleMainInit() : consoleDemoInit());
112 if(
YB_LIKELY(dspIndex ? consoleMainInit() : consoleDemoInit()))
115 std::printf(
"\x1b[0;0H");
117 std::uint16_t* bg_palette = dspIndex ? BG_PALETTE : BG_PALETTE_SUB;
119 bg_palette[0] = PixelType(bc).Integer | BITALPHA;
120 bg_palette[255] = PixelType(fc).Integer | BITALPHA;
122 #elif YCL_Win32 || YCL_Android
127 # error "Unsupported platform found."
136 platform_ex::ResetVideo();
137 platform_ex::lcdMainOnTop();
143 namespace platform_ex
159 ::vramSetBanks_EFG(VRAM_E_LCD, VRAM_F_LCD, VRAM_G_LCD),
160 ::vramSetBankH(VRAM_H_LCD),
161 ::vramSetBankI(VRAM_I_LCD);
164 ::videoSetMode(MODE_5_2D);
165 ::videoSetModeSub(MODE_5_2D);
173 id = ::bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
183 id = ::bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
190 ScreenSynchronize(platform::PixelType* buf,
const platform::PixelType* src)
193 using ScreenBufferType = platform::PixelType[SCREEN_WIDTH * SCREEN_HEIGHT];
195 ::DC_FlushRange(src,
sizeof(ScreenBufferType));
196 ::dmaCopyWordsAsynch(3, src, buf,
sizeof(ScreenBufferType));
200 #if YCL_DS || YF_Hosted
202 DSVideoState::IsLCDMainOnTop()
const
205 return REG_POWERCNT & POWER_SWAP_LCDS;
207 return LCD_main_on_top;
212 DSVideoState::SetLCDMainOnTop(
bool b)
215 b ? lcdMainOnTop() : lcdMainOnBottom();
222 DSVideoState::SwapLCD()
227 LCD_main_on_top = !LCD_main_on_top;
YF_API bool InitVideo()
初始化视频输出。
std::size_t size ynothrow
#define yalignof(_type)
指定特定类型的对齐。
YF_API void YConsoleInit(std::uint8_t dspIndex, Color fc=ColorSpace::White, Color bc=ColorSpace::Black)
启动控制台。