Skip to content

Commit

Permalink
fix typo debug (#660)
Browse files Browse the repository at this point in the history
Co-authored-by: MegaMech <[email protected]>
  • Loading branch information
coco875 and MegaMech authored Aug 1, 2024
1 parent 9b779c1 commit 2f288fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions src/debug/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ static u32 variable_to_u64(variableWatchAttributes *attribute) {
u32 variable;

switch (attribute->variableSize) {
case sizeof(u8):
case sizeof(u8):
variable = *((u8*) attribute->variablePointer);
break;
case sizeof(u16):
case sizeof(u16):
variable = *((u16*) attribute->variablePointer);
break;
case sizeof(u32):
case sizeof(u64):
case sizeof(u64):
variable = *((u32*) attribute->variablePointer); // no floating point rounding
break;
default:
Expand All @@ -103,7 +103,7 @@ static void round_up_float(u32 *variable, u8 variableSize) {
switch (variableSize) {
case sizeof(u64):
case sizeof(u32):
*variable = (u32) (*(f32*) &*variable);
*variable = (u32) (*(f32*) &*variable);
break;
default:
sDisplayListState = BAD;
Expand Down Expand Up @@ -131,7 +131,7 @@ static void u64_to_string(variableWatchAttributes *attribute, u32 variable, u8 b
switch (variableSize) {
case sizeof(u8):
signedVariable = (s8) variable;
if (signedVariable < 0) {
if (signedVariable < 0) {
signedVariable = -signedVariable;
variable = (u8) signedVariable;
*bufferedString = '-';
Expand All @@ -150,7 +150,7 @@ static void u64_to_string(variableWatchAttributes *attribute, u32 variable, u8 b
case sizeof(u32):
case sizeof(u64):
signedVariable = (s32) variable;
if (signedVariable < 0) {
if (signedVariable < 0) {
signedVariable = -signedVariable;
variable = (u32) signedVariable;
*bufferedString = '-';
Expand All @@ -164,11 +164,11 @@ static void u64_to_string(variableWatchAttributes *attribute, u32 variable, u8 b

// convert u64 into a string but it gets put in reverse
if (base != HEXIDECIMAL) {
do {
do {
stringLength++;
*bufferedString = variable % base + '0';
bufferedString++;
variable /= base;
variable /= base;
} while (variable != 0);
} else {
do {
Expand All @@ -186,8 +186,8 @@ static void u64_to_string(variableWatchAttributes *attribute, u32 variable, u8 b
} while (variable != 0);
}

bufferedString -= stringLength;
upperIndex = stringLength - 1;
bufferedString -= stringLength;
upperIndex = stringLength - 1;

// flip string 4321 --> 1234
for (lowerIndex = 0; lowerIndex < stringLength >> 1; lowerIndex++) {
Expand Down Expand Up @@ -228,7 +228,7 @@ static void u64_to_string(variableWatchAttributes *attribute, u32 variable, u8 b

static u32 _strlen(const char *str) {
u32 len;

len = 0;
for (; *str != '\0'; str++) {
len++;
Expand All @@ -245,7 +245,7 @@ static void _memcpy(char *destStr, const char *copyStr, u32 copySize) {
*destStr = *copyStr;
destStr++;
copyStr++;
}
}
}

#endif
14 changes: 7 additions & 7 deletions src/debug/debug.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,50 @@

extern s32 gGlobalTimer;

/**
/**
* Edit this to edit what displays on the screen while the DVDL is active.
* The Size of the structure array is calculated at compile time.
*/
variableWatchAttributes gMainVariableWatchList[] = {
{
"Global Timer: ",
&gGlobalTimer,
sizeof(gGlobalTimer),
sizeof(gGlobalTimer),
DISPLAY_DECIMAL_NUMBER | DISPLAY_SIGNED_NUMBER,
0, 0
},
{
"Actors: ",
&gNumActors,
sizeof(gNumActors),
sizeof(gNumActors),
DISPLAY_DECIMAL_NUMBER,
0, 0
},
{
"Player Type: ",
&gPlayers[0].type,
sizeof(gPlayerOne->type),
sizeof(gPlayerOne->type),
DISPLAY_HEXIDECIMAL_NUMBER,
0, 0
},
{
"X ",
&gPlayers[0].pos[0],
sizeof(gPlayerOne->pos[0]),
sizeof(gPlayerOne->pos[0]),
DISPLAY_FLOAT_NUMBER,
0, 0
},
{
"Y ",
&gPlayers[0].pos[1],
sizeof(gPlayerOne->pos[1]),
sizeof(gPlayerOne->pos[1]),
DISPLAY_FLOAT_NUMBER,
0, 0
},
{
"Z ",
&gPlayers[0].pos[2],
sizeof(gPlayerOne->pos[2]),
sizeof(gPlayerOne->pos[2]),
DISPLAY_FLOAT_NUMBER,
0, 0
},
Expand Down

0 comments on commit 2f288fb

Please sign in to comment.