You've already forked pico-launcher
mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-01-09 16:28:48 -08:00
Initial commit
This commit is contained in:
28
common/logger/PicoAgbAdapterOutputStream.cpp
Normal file
28
common/logger/PicoAgbAdapterOutputStream.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "common.h"
|
||||
#include "picoAgbAdapter.h"
|
||||
#include "PicoAgbAdapterOutputStream.h"
|
||||
|
||||
void PicoAgbAdapterOutputStream::Write(const char* str)
|
||||
{
|
||||
#ifdef LIBTWL_ARM9
|
||||
char c;
|
||||
vu16* ring = PICO_AGB_PRINT_ARM9_RING;
|
||||
u32 writePtr = PICO_AGB_PRINT_ARM9_WRITE_PTR;
|
||||
u32 readPtr = PICO_AGB_PRINT_ARM9_READ_PTR;
|
||||
while ((c = *str++) != 0)
|
||||
{
|
||||
u32 newWritePtr = (writePtr + 1) & (PICO_AGB_PRINT_RING_LENGTH - 1);
|
||||
while (newWritePtr == readPtr)
|
||||
{
|
||||
PICO_AGB_PRINT_ARM9_WRITE_PTR = writePtr;
|
||||
readPtr = PICO_AGB_PRINT_ARM9_READ_PTR;
|
||||
}
|
||||
if (writePtr & 1)
|
||||
ring[writePtr >> 1] = (ring[writePtr >> 1] & 0xFF) | (c << 8);
|
||||
else
|
||||
ring[writePtr >> 1] = (ring[writePtr >> 1] & 0xFF00) | c;
|
||||
writePtr = newWritePtr;
|
||||
}
|
||||
PICO_AGB_PRINT_ARM9_WRITE_PTR = writePtr;
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user