@@ -4746,48 +4746,13 @@ void Mod::errorHandler(uint16_t error, gc::OSContext::OSContext *context, uint32
4746
4746
" ---- Context 0x%08" PRIX32 " ----" ,
4747
4747
reinterpret_cast <uint32_t >(context));
4748
4748
4749
- // Register names
4750
- static const char *RegisterNames[] =
4751
- {
4752
- " r0" ,
4753
- " r1" ,
4754
- " r2" ,
4755
- " r3" ,
4756
- " r4" ,
4757
- " r5" ,
4758
- " r6" ,
4759
- " r7" ,
4760
- " r8" ,
4761
- " r9" ,
4762
- " r10" ,
4763
- " r11" ,
4764
- " r12" ,
4765
- " r13" ,
4766
- " r14" ,
4767
- " r15" ,
4768
- " r16" ,
4769
- " r17" ,
4770
- " r18" ,
4771
- " r19" ,
4772
- " r20" ,
4773
- " r21" ,
4774
- " r22" ,
4775
- " r23" ,
4776
- " r24" ,
4777
- " r25" ,
4778
- " r26" ,
4779
- " r27" ,
4780
- " r28" ,
4781
- " r29" ,
4782
- " r30" ,
4783
- " r31" ,
4784
- };
4749
+ // Get the general purpose register values
4750
+ uint32_t GeneralRegistersSize = sizeof (ErrorHandler->GeneralRegisterValues ) /
4751
+ sizeof (ErrorHandler->GeneralRegisterValues [0 ]);
4785
4752
4786
- // Get the register values
4787
- uint32_t RegisterNamesSize = sizeof (RegisterNames) / sizeof (RegisterNames[0 ]);
4788
- for (uint32_t i = 0 ; i < RegisterNamesSize; i++)
4753
+ for (uint32_t i = 0 ; i < GeneralRegistersSize; i++)
4789
4754
{
4790
- sprintf (ErrorHandler->RegisterValues [i],
4755
+ sprintf (ErrorHandler->GeneralRegisterValues [i],
4791
4756
" 0x%08" PRIX32,
4792
4757
context->gpr [i]);
4793
4758
}
@@ -5182,8 +5147,8 @@ void Mod::errorHandler(uint16_t error, gc::OSContext::OSContext *context, uint32
5182
5147
int32_t NewPosY = PosY;
5183
5148
5184
5149
// Draw the help text
5185
- const char *HelpText = " Press/hold the D-Pad to move the text\n Press A to zoom in\n Press B to zoom out" ;
5186
- drawString (NewPosX, NewPosY, HelpText , FontScale);
5150
+ const char *Text = " Press/hold the D-Pad to move the text\n Press A to zoom in\n Press B to zoom out" ;
5151
+ drawString (NewPosX, NewPosY, Text , FontScale);
5187
5152
NewPosY += PosYIncrementAmount * 4 ;
5188
5153
5189
5154
// Draw the register OSError if it is valid
@@ -5197,19 +5162,21 @@ void Mod::errorHandler(uint16_t error, gc::OSContext::OSContext *context, uint32
5197
5162
drawString (NewPosX, NewPosY, ErrorHandler->ContextAddress , FontScale);
5198
5163
NewPosY += PosYIncrementAmount;
5199
5164
5200
- // Draw the registers and values in 3 columns
5201
- uint32_t TotalRowsZeroIndexed = (RegisterNamesSize - 1 ) / 3 ;
5165
+ // Draw the general purpose registers and values in 3 columns
5166
+ uint32_t TotalRowsZeroIndexed = (GeneralRegistersSize - 1 ) / 3 ;
5202
5167
uint32_t Counter = 0 ;
5203
5168
int32_t tempPosX = NewPosX;
5204
5169
int32_t tempPosY = NewPosY;
5205
5170
5206
- for (uint32_t i = 0 ; i < RegisterNamesSize; i++)
5171
+ char NameBuffer[4 ];
5172
+ for (uint32_t i = 0 ; i < GeneralRegistersSize; i++)
5207
5173
{
5208
- // Draw the register names
5209
- drawString (tempPosX, tempPosY, RegisterNames[i], FontScale);
5174
+ // Draw the general purpose register names
5175
+ sprintf (NameBuffer, " r%" PRIu32, i);
5176
+ drawString (tempPosX, tempPosY, NameBuffer, FontScale);
5210
5177
5211
- // Draw the register values
5212
- drawString (tempPosX + 40 , tempPosY, ErrorHandler->RegisterValues [i], FontScale);
5178
+ // Draw the general purpose register values
5179
+ drawString (tempPosX + 40 , tempPosY, ErrorHandler->GeneralRegisterValues [i], FontScale);
5213
5180
5214
5181
if (Counter >= TotalRowsZeroIndexed)
5215
5182
{
@@ -5224,7 +5191,7 @@ void Mod::errorHandler(uint16_t error, gc::OSContext::OSContext *context, uint32
5224
5191
Counter++;
5225
5192
}
5226
5193
}
5227
- NewPosY += (PosYIncrementAmount * 11 ) + PosYIncrementAmount;
5194
+ NewPosY += (PosYIncrementAmount * TotalRowsZeroIndexed ) + ( PosYIncrementAmount * 2 ) ;
5228
5195
5229
5196
// Draw the additional registers and values in 2 columns
5230
5197
uint32_t SecondRowAdjustment = 0 ;
@@ -5263,7 +5230,7 @@ void Mod::errorHandler(uint16_t error, gc::OSContext::OSContext *context, uint32
5263
5230
Counter++;
5264
5231
}
5265
5232
}
5266
- NewPosY += (PosYIncrementAmount * 3 ) + PosYIncrementAmount;
5233
+ NewPosY += (PosYIncrementAmount * TotalRowsZeroIndexed ) + ( PosYIncrementAmount * 2 ) ;
5267
5234
5268
5235
// Draw the names for the addresses, back chains, and LR saves in 3 columns
5269
5236
tempPosX = NewPosX;
0 commit comments