summaryrefslogtreecommitdiff
path: root/src/JSystem
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-11-11 17:10:34 -0800
committerJasper St. Pierre <jstpierre@mecheye.net>2023-11-11 17:10:34 -0800
commitbd412feae7ef3c2fc2ce0ccf240ea9d0a8d15fb8 (patch)
tree6f764880afb749c09ed3fbd6b91852521b91db6c /src/JSystem
parentfef715c69bfa5a593c7653698566398d53851ab9 (diff)
JUT work
Diffstat (limited to 'src/JSystem')
-rw-r--r--src/JSystem/JKernel/JKRExpHeap.cpp17
-rw-r--r--src/JSystem/JUtility/JUTDirectPrint.cpp7
-rw-r--r--src/JSystem/JUtility/JUTException.cpp40
3 files changed, 32 insertions, 32 deletions
diff --git a/src/JSystem/JKernel/JKRExpHeap.cpp b/src/JSystem/JKernel/JKRExpHeap.cpp
index 7cbc894e..24260f2f 100644
--- a/src/JSystem/JKernel/JKRExpHeap.cpp
+++ b/src/JSystem/JKernel/JKRExpHeap.cpp
@@ -817,7 +817,7 @@ bool JKRExpHeap::dump() {
}
/* 802B2D5C-802B2F5C .text dump_sort_by_address__10JKRExpHeapFv */
-// regalloc, stack
+// regalloc
bool JKRExpHeap::dump_sort_by_address() {
/* Nonmatching */
lock();
@@ -828,16 +828,17 @@ bool JKRExpHeap::dump_sort_by_address() {
JUTReportConsole(" attr address: size gid aln prev_ptr next_ptr\n");
CMemBlock* block;
- for (CMemBlock* var1 = NULL; true; var1 = block) {
- CMemBlock* block = (CMemBlock*)0xffffffff;
+ for (CMemBlock* nextBlock = NULL; ; nextBlock = block) {
+ block = (CMemBlock*)0xffffffff;
+
for (CMemBlock* iterBlock = mHeadFreeList; iterBlock; iterBlock = iterBlock->getNextBlock()) {
- if (var1 < iterBlock && iterBlock < block) {
+ if (nextBlock < iterBlock && iterBlock < block) {
block = iterBlock;
}
}
for (CMemBlock* iterBlock = mHeadUsedList; iterBlock; iterBlock = iterBlock->getNextBlock()) {
- if (var1 < iterBlock && iterBlock < block) {
+ if (nextBlock < iterBlock && iterBlock < block) {
block = iterBlock;
}
}
@@ -860,15 +861,13 @@ bool JKRExpHeap::dump_sort_by_address() {
int offset = block->getAlignment();
void* content = block->getContent();
const char* type = block->_isTempMemBlock() ? " temp" : "alloc";
- JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", type, content, block->getSize(),
- block->getGroupId(), offset, block->getPrevBlock(), block->getNextBlock());
+ JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", type, content, block->getSize(), block->getGroupId(), offset, block->getPrevBlock(), block->getNextBlock());
usedBytes += sizeof(CMemBlock) + block->size + block->getAlignment();
usedCount++;
}
float percent = ((float)usedBytes / (float)mSize) * 100.0f;
- JUTReportConsole_f("%d / %d bytes (%6.2f%%) used (U:%d F:%d)\n", usedBytes, mSize, percent,
- usedCount, freeCount);
+ JUTReportConsole_f("%d / %d bytes (%6.2f%%) used (U:%d F:%d)\n", usedBytes, mSize, percent, usedCount, freeCount);
unlock();
return result;
}
diff --git a/src/JSystem/JUtility/JUTDirectPrint.cpp b/src/JSystem/JUtility/JUTDirectPrint.cpp
index 07d68d2c..9c092fc4 100644
--- a/src/JSystem/JUtility/JUTDirectPrint.cpp
+++ b/src/JSystem/JUtility/JUTDirectPrint.cpp
@@ -85,13 +85,6 @@ u32 JUTDirectPrint::sFontData2[77] = {
0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000,
};
-static u32 twiceBit[4] = {
- 0,
- 3,
- 12,
- 15,
-};
-
/* 802C7074-802C71E0 .text drawChar__14JUTDirectPrintFiii */
void JUTDirectPrint::drawChar(int position_x, int position_y, int ch) {
int codepoint = (100 <= ch) ? ch - 100 : ch;
diff --git a/src/JSystem/JUtility/JUTException.cpp b/src/JSystem/JUtility/JUTException.cpp
index bf2b8021..7eb2a9de 100644
--- a/src/JSystem/JUtility/JUTException.cpp
+++ b/src/JSystem/JUtility/JUTException.cpp
@@ -863,18 +863,25 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
char section_name[16];
char buffer[0x200];
JUTDirectFile file;
- int i = 0;
+ int section_idx = 0;
if (!file.fopen(mapPath)) {
return false;
}
- int result = 0;
+ bool result = false;
+
do {
- char* src = buffer;
- int found_section = 0;
+ bool found_section;
+ u32 addr;
+ int size;
+
do {
- i++;
+ found_section = false;
+ section_idx++;
while (true) {
+ char* src;
+ char* dst;
+
while (true) {
int length = file.fgets(buffer, ARRAY_SIZE(buffer));
if (length < 0)
@@ -883,9 +890,9 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
break;
}
- char* dst = section_name;
int i = 0;
- char* src = buffer + 1;
+ src = buffer + 1;
+ dst = section_name;
for (; *src != '\0'; i++, dst++, src++) {
*dst = *src;
if (*src == ' ' || i == 0xf)
@@ -901,13 +908,13 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
break;
}
}
- if ((found_section & 0xFF) == 0)
+
+next_section:
+
+ if (!found_section)
goto end;
- } while (section_id >= 0 && section_id != i);
- next_section:;
+ } while (section_id >= 0 && section_id != section_idx);
- u32 addr;
- int size;
do {
int length;
do {
@@ -928,9 +935,10 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
*out_size = size;
if (out_line) {
- src = buffer + 0x1e;
+ char* src = buffer + 0x1e;
char* dst = out_line;
u32 length = 0;
+
for (; length < line_length - 1; src++) {
u32 ch = *(u8*)src;
if (ch < ' ' && ch != '\t')
@@ -962,8 +970,8 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
result = true;
- next_symbol:;
- } while (section_id >= 0 && section_id != i);
+next_symbol: ;
+ } while (section_id < 0 || section_id != section_idx);
if (print && begin_with_newline) {
sConsole->print("\n");
@@ -971,7 +979,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
end:
file.fclose();
- bool bresult = (result & 0xff) != 0;
+ bool bresult = result != false;
return bresult;
}