MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / ParseAndDisplayString

Method ParseAndDisplayString

Source/SysPSP/Debug/DBGConsolePSP.cpp:86–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void IDebugConsole::ParseAndDisplayString( const char * p_string, ETerminalColour default_colour )
87{
88 SetCurrentTerminalColour( default_colour );
89
90 char current_string[ 1024 ];
91 u32 out_idx( 0 );
92 u32 string_len( strlen(p_string) );
93 for ( u32 in_idx = 0; in_idx < string_len; ++in_idx )
94 {
95 if (p_string[in_idx] == '[')
96 {
97 ETerminalColour tc = GetTerminalColour(p_string[in_idx+1]);
98 if(tc != TC_INVALID)
99 {
100 // Flush the current string and update the colour
101 current_string[out_idx] = 0;
102 DisplayString( current_string );
103 out_idx = 0;
104 SetCurrentTerminalColour( tc );
105 }
106 else
107 {
108 switch (p_string[in_idx+1])
109 {
110 case '[':
111 case ']':
112 current_string[out_idx] = p_string[in_idx+1];
113 out_idx++;
114 break;
115 }
116 }
117
118 // Skip colour character
119 in_idx++;
120 }
121 else if (p_string[in_idx] == ']')
122 {
123 // Flush the current string and update the colour
124 current_string[out_idx] = 0;
125 DisplayString( current_string );
126 out_idx = 0;
127 SetCurrentTerminalColour( default_colour );
128 }
129 else
130 {
131 current_string[out_idx] = p_string[in_idx];
132 out_idx++;
133 }
134 }
135
136 // Flush the current string and restore the colour
137 current_string[out_idx] = 0;
138 DisplayString( current_string );
139
140 SetCurrentTerminalColour( TC_DEFAULT );
141}
142
143void IDebugConsole::Msg(u32 type, const char * format, ...)

Callers

nothing calls this directly

Calls 1

GetTerminalColourFunction · 0.85

Tested by

no test coverage detected