-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb51b7f
commit b1138d3
Showing
10 changed files
with
333 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef NW4R_DB_DBG_PRINT_BASE_H | ||
#define NW4R_DB_DBG_PRINT_BASE_H | ||
|
||
#include "types_nw4r.h" | ||
#include "ut_CharWriter.h" | ||
|
||
namespace nw4r | ||
{ | ||
namespace db | ||
{ | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef NW4R_DB_CONSOLE_H | ||
#define NW4R_DB_CONSOLE_H | ||
|
||
#include "types_nw4r.h" | ||
#include "ut_TextWriterBase.h" | ||
#include "ut_CharWriter.h" | ||
|
||
namespace nw4r | ||
{ | ||
namespace db | ||
{ | ||
namespace detail | ||
{ | ||
struct ConsoleHead | ||
{ | ||
u8* textBuf; // at 0x0 | ||
u16 width; // at 0x4 | ||
u16 height; // at 0x6 | ||
u16 priority; // at 0x8 | ||
u16 attr; // at 0xA | ||
u16 printTop; // at 0xC | ||
u16 printXPos; // at 0xE | ||
u16 ringTop; // at 0x10 | ||
long ringTopLineCnt; // at 0x14 | ||
long viewTopLine; // at 0x18 | ||
s16 viewPosX; // at 0x1C | ||
s16 viewPosY; // at 0x1E | ||
u16 viewLines; // at 0x20 | ||
u8 isVisible; // at 0x22 | ||
u8 padding_[1]; // at 0x23 | ||
ut::TextWriterBase<char>* writer; // at 0x24 | ||
ConsoleHead* next; // at 0x28 | ||
}; | ||
} | ||
|
||
typedef enum ConsoleOutputType { | ||
CONSOLE_OUTPUT_NONE, | ||
CONSOLE_OUTPUT_DISPLAY, | ||
CONSOLE_OUTPUT_TERMINAL, | ||
CONSOLE_OUTPUT_ALL, | ||
} ConsoleOutputType; | ||
|
||
typedef void (*VisitStringCallback)(detail::ConsoleHead* console, u8* r4, long r5, u32 r6); | ||
|
||
//unused | ||
u8 Console_SetVisible(detail::ConsoleHead* console, bool isVisible) { | ||
u8 before; | ||
return 0; | ||
} | ||
|
||
//unused | ||
long Console_SetViewBaseLine(detail::ConsoleHead* console, long line) { | ||
long before; | ||
return 0; | ||
} | ||
|
||
detail::ConsoleHead* Console_Create(void* buffer, u16 width, u16 height, u16 viewHeight, u16 priority, u16 attr); | ||
void Console_Destroy(detail::ConsoleHead* console); | ||
void Console_Clear(detail::ConsoleHead* console); | ||
void Console_Draw(detail::ConsoleHead* console, ut::TextWriterBase<char>& writer); | ||
void Console_DrawDirect(detail::ConsoleHead* console); | ||
void Console_DrawAll(); | ||
void Console_DrawDirectAll(); | ||
void Console_VFPrintf(ConsoleOutputType type, detail::ConsoleHead* console, const char* format, va_list* vlist); | ||
void Console_FPrintf(ConsoleOutputType type, detail::ConsoleHead* console, const char * format); | ||
void Console_Printf(detail::ConsoleHead* console, const char* format, ...); | ||
void Console_PrintfD(detail::ConsoleHead* console, const char* format, ...); | ||
void Console_PrintfT(detail::ConsoleHead* console, const char* format, ...); | ||
u16 Console_ChangePriority(detail::ConsoleHead* console, u16 r4); | ||
void Console_VisitString(detail::ConsoleHead* console, VisitStringCallback visitor); | ||
long Console_GetTotalLines(detail::ConsoleHead* console); | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "db_DbgPrintBase.h" | ||
|
||
namespace nw4r | ||
{ | ||
namespace db | ||
{ | ||
//Dummy function to force SetTextColor to be generated here | ||
void dummy(ut::CharWriter* pCharWriter){ | ||
ut::Color color; | ||
pCharWriter->SetTextColor(color); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
#include "db_console.h" | ||
#include <revolution/OS.h> | ||
|
||
namespace nw4r | ||
{ | ||
namespace db | ||
{ | ||
//unused | ||
static OSMutex sMutex; | ||
|
||
//unused | ||
static void TerminateLine_(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
static u8* GetTextPtr_(detail::ConsoleHead* console, u16 line, u16 xPos) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static u8* NextLine_(detail::ConsoleHead* console) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static u8* PutTab_(detail::ConsoleHead* console, u8* dstPtr) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static u32 GetTabSize_(detail::ConsoleHead* console) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static u32 PutChar_(detail::ConsoleHead* console, const u8* str, u8* dstPtr) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static u32 CodeWidth_(const u8* p) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static detail::ConsoleHead* SearchConsoleFromListByPriority_(u16 r3) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
//unused | ||
static void AppendConsoleToList_(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
static void RemoveConsoleFromList_(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
detail::ConsoleHead* Console_Create(void* buffer, u16 width, u16 height, u16 viewHeight, u16 priority, u16 attr) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_Destroy(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_Clear(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
static void UnlockMutex_(OSMutex* mutex) | ||
{ | ||
} | ||
|
||
//unused | ||
static bool TryLockMutex_(OSMutex* mutex) | ||
{ | ||
return false; | ||
} | ||
|
||
//unused | ||
static void DoDrawString_(detail::ConsoleHead* console, u32 printLine, const u8* str, ut::TextWriterBase<char>* writer) | ||
{ | ||
} | ||
|
||
//unused | ||
static void DoDrawConsole_(detail::ConsoleHead* console, ut::TextWriterBase<char>* writer) | ||
{ | ||
} | ||
|
||
static u16 GetRingUsedLines_(detail::ConsoleHead* console); | ||
|
||
static u16 GetActiveLines_(detail::ConsoleHead* console) | ||
{ | ||
u16 lines = GetRingUsedLines_(console); | ||
if(console->printXPos != 0){ | ||
lines++; | ||
} | ||
|
||
return lines; | ||
} | ||
|
||
static u16 GetRingUsedLines_(detail::ConsoleHead* console) | ||
{ | ||
long lines = console->printTop - console->ringTop; | ||
if(lines < 0){ | ||
lines += console->height; | ||
} | ||
return (u16)lines; | ||
} | ||
|
||
//unused | ||
void Console_Draw(detail::ConsoleHead* console, ut::TextWriterBase<char>& writer) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_DrawDirect(detail::ConsoleHead* console) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_DrawAll() | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_DrawDirectAll() | ||
{ | ||
} | ||
|
||
//unused | ||
static void PrintToBuffer_(detail::ConsoleHead* console, const u8* str) | ||
{ | ||
} | ||
|
||
//unused | ||
static u8* SearchEndOfLine_(const u8* str) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
static void Console_PrintString_(ConsoleOutputType type, detail::ConsoleHead* console, const u8* str) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_VFPrintf(ConsoleOutputType type, detail::ConsoleHead* console, const char* format, va_list* vlist) | ||
{ | ||
static u8 sStrBuf[1024]; | ||
} | ||
|
||
//unused | ||
void Console_FPrintf(ConsoleOutputType type, detail::ConsoleHead* console, const char * format) | ||
{ | ||
} | ||
|
||
void Console_Printf(detail::ConsoleHead* console, const char* format, ...) | ||
{ | ||
va_list vlist; | ||
va_start(vlist, format); | ||
} | ||
|
||
//unused | ||
void Console_PrintfD(detail::ConsoleHead* console, const char* format, ...) | ||
{ | ||
} | ||
|
||
//unused | ||
void Console_PrintfT(detail::ConsoleHead* console, const char* format, ...) | ||
{ | ||
} | ||
|
||
//unused | ||
u16 Console_ChangePriority(detail::ConsoleHead* console, u16 r4) | ||
{ | ||
return 0; | ||
} | ||
|
||
//unused | ||
void Console_VisitString(detail::ConsoleHead* console, VisitStringCallback visitor) | ||
{ | ||
} | ||
|
||
long Console_GetTotalLines(detail::ConsoleHead* console) | ||
{ | ||
BOOL enabled = OSDisableInterrupts(); | ||
|
||
long count = GetActiveLines_(console) + console->ringTopLineCnt; | ||
|
||
OSRestoreInterrupts(enabled); | ||
|
||
return count; | ||
} | ||
} | ||
} |