Compare commits

...

1 Commits

Author SHA1 Message Date
coah
6b76527392 KPAD 14/29; BS2Mach/wad closer (worker e55f27dd) 2026-09-30 17:10:08 +00:00
8 changed files with 541 additions and 128 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 98.04% | 84.69% | 58.20% | 90.34% |
| 98.06% | 84.71% | 58.20% | 90.34% |
units 778/1027 complete, functions 12069/12563 matched.
units 778/1027 complete, functions 12070/12563 matched.
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->

View File

@@ -189,10 +189,10 @@ void* KPADGetWPADCLRingBuffer(s32 chan) {
static void* get_ring_buffer_by_kpad1_style(s32 chan, void* buffer, s32 style) {
KPADInside* kpad = &inside_kpads[chan];
u32 i;
int enabled;
s32 index;
s32 latest;
int enabled;
u32 i;
s32 size;
u32 type;
switch (style) {
@@ -480,10 +480,10 @@ static void calc_acc_horizon(KPADInside* kpad) {
f32 deltaCircleX;
f32 circleY;
f32 deltaCircleY;
if (magnitude != 0.0f) {
if (magnitude >= 2.0f) {
return;
}
if (magnitude == 0.0f || magnitude >= 2.0f) {
return;
}
{
normalizedX = kpad->accelerationX / magnitude;
normalizedY = kpad->accelerationY / magnitude;
if (magnitude > 1.0f) {
@@ -573,7 +573,7 @@ static void read_kpad_acc(KPADInside* kpad, KPADSample* status) {
return;
}
{
Vec previous = kpad->status.acc;
Vec previous;
f32 target;
f32 delta;
f32 magnitude;
@@ -613,6 +613,7 @@ static void read_kpad_acc(KPADInside* kpad, KPADSample* status) {
limit = target;
}
kpad->accelerationZ = limit;
previous = kpad->status.acc;
delta = kpad->accelerationX - previous.x;
magnitude = delta;
if (magnitude < 0.0f) {
@@ -761,13 +762,13 @@ static s8 select_2obj_first(KPADInside* kpad) {
KPADDPDObject* first = 0;
KPADDPDObject* second = 0;
f32 best = kp_err_first_inpr;
s32 i;
s32 j;
for (i = 0; i < 4; i++) {
if ((s8)objects[i].metadata.bytes.flags != 0) {
KPADDPDObject* object;
KPADDPDObject* other;
for (object = objects; object < objects + 3; object++) {
if ((s8)object->metadata.bytes.flags != 0) {
continue;
}
for (j = i + 1; j < 4; j++) {
for (other = object + 1; other <= objects + 3; other++) {
f32 dx;
f32 dy;
f32 scale;
@@ -778,11 +779,11 @@ static s8 select_2obj_first(KPADInside* kpad) {
f32 y;
f32 dot;
f32 score;
if ((s8)objects[j].metadata.bytes.flags != 0) {
if ((s8)other->metadata.bytes.flags != 0) {
continue;
}
dx = objects[j].x - objects[i].x;
dy = objects[j].y - objects[i].y;
dx = other->x - object->x;
dy = other->y - object->y;
scale = 1.0f / (f32)sqrt(dx * dx + dy * dy);
nx = dx * scale;
ny = dy * scale;
@@ -798,13 +799,13 @@ static s8 select_2obj_first(KPADInside* kpad) {
score = -score;
if (score > best) {
best = score;
first = &objects[j];
second = &objects[i];
first = other;
second = object;
}
} else if (score > best) {
best = score;
first = &objects[i];
second = &objects[j];
first = object;
second = other;
}
}
}
@@ -821,13 +822,13 @@ static s8 select_2obj_continue(KPADInside* kpad) {
KPADDPDObject* first = 0;
KPADDPDObject* second = 0;
f32 best = 2.0f;
s32 i;
s32 j;
for (i = 0; i < 4; i++) {
if ((s8)objects[i].metadata.bytes.flags != 0) {
KPADDPDObject* object;
KPADDPDObject* other;
for (object = objects; object < objects + 3; object++) {
if ((s8)object->metadata.bytes.flags != 0) {
continue;
}
for (j = i + 1; j < 4; j++) {
for (other = object + 1; other <= objects + 3; other++) {
f32 dx;
f32 dy;
f32 scale;
@@ -839,11 +840,11 @@ static s8 select_2obj_continue(KPADInside* kpad) {
f32 dot;
f32 score;
BOOL reverse;
if ((s8)objects[j].metadata.bytes.flags != 0) {
if ((s8)other->metadata.bytes.flags != 0) {
continue;
}
dx = objects[j].x - objects[i].x;
dy = objects[j].y - objects[i].y;
dx = other->x - object->x;
dy = other->y - object->y;
scale = 1.0f / (f32)sqrt(dx * dx + dy * dy);
distance = scale * kpad->value510;
nx = dx * scale;
@@ -874,11 +875,11 @@ static s8 select_2obj_continue(KPADInside* kpad) {
if (score < best) {
best = score;
if (reverse) {
first = &objects[j];
second = &objects[i];
first = other;
second = object;
} else {
first = &objects[i];
second = &objects[j];
first = object;
second = other;
}
}
}
@@ -915,23 +916,17 @@ static s8 select_1obj_first(KPADInside* kpad) {
rightPosition.y = y + offsetY;
if (leftPosition.x <= kpad->value4F4 || leftPosition.x >= kpad->value4FC || leftPosition.y <= kpad->value4F8 || leftPosition.y >= kpad->value500) {
if (rightPosition.x > kpad->value4F4 && rightPosition.x < kpad->value4FC && rightPosition.y > kpad->value4F8 && rightPosition.y < kpad->value500) {
u32* objectWords = (u32*)object;
u32* statusWords = (u32*)&kpad->dpdState.candidates[1].x;
statusWords[0] = objectWords[0];
statusWords[1] = objectWords[1];
statusWords[2] = objectWords[2];
memcpy(&kpad->dpdState.candidates[0].x, &leftPosition, sizeof(leftPosition));
kpad->dpdState.candidates[1] = *object;
kpad->dpdState.candidates[0].x = leftPosition.x;
kpad->dpdState.candidates[0].y = leftPosition.y;
kpad->dpdState.candidates[0].metadata.bytes.flags = 0;
kpad->dpdState.candidates[0].metadata.bytes.status = 0xFF;
return -1;
}
} else if (rightPosition.x <= kpad->value4F4 || rightPosition.x >= kpad->value4FC || rightPosition.y <= kpad->value4F8 || rightPosition.y >= kpad->value500) {
u32* objectWords = (u32*)object;
u32* statusWords = (u32*)&kpad->dpdState.candidates[0];
statusWords[0] = objectWords[0];
statusWords[1] = objectWords[1];
statusWords[2] = objectWords[2];
memcpy(&kpad->dpdState.candidates[1].x, &rightPosition, sizeof(rightPosition));
kpad->dpdState.candidates[0] = *object;
kpad->dpdState.candidates[1].x = rightPosition.x;
kpad->dpdState.candidates[1].y = rightPosition.y;
kpad->dpdState.candidates[1].metadata.bytes.flags = 0;
kpad->dpdState.candidates[1].metadata.bytes.status = 0xFF;
return -1;
@@ -988,9 +983,9 @@ static s8 select_1obj_continue(KPADInside* kpad) {
tangentX = axisX * normY;
directionX = horizontal + tangentY;
directionY = vertical - tangentX;
offsetX = distance * directionX;
offsetX = directionX * distance;
kpad->dpdObjectDirectionX = directionX;
offsetY = distance * directionY;
offsetY = directionY * distance;
kpad->dpdObjectDirectionY = directionY;
if (matchedCandidate == candidates) {
kpad->dpdState.candidates[1].x = matchedCandidate->x + offsetX;
@@ -1016,11 +1011,13 @@ static void calc_dpd_variable(KPADInside* kpad, s8 valid) {
return;
}
{
Vec2 horizon;
f32 x = kpad->horizonTangentX * kpad->dpdObjectDirectionX + kpad->horizonTangentY * kpad->dpdObjectDirectionY;
f32 y = kpad->horizonTangentY * kpad->dpdObjectDirectionX - kpad->horizonTangentX * kpad->dpdObjectDirectionY;
horizon.x = x;
horizon.y = y;
if (kpad->status.dpd_valid_fg == 0) {
kpad->status.horizon.x = x;
kpad->status.horizon.y = y;
kpad->status.horizon = horizon;
kpad->status.hori_vec = Vec2_0;
kpad->status.hori_speed = 0.0f;
} else {
@@ -1080,7 +1077,7 @@ static void calc_dpd_variable(KPADInside* kpad, s8 valid) {
}
}
{
f32 rotatedX = kpad->dpdObjectDirectionX * kpad->horizonTangentX + kpad->dpdObjectDirectionY * kpad->horizonTangentY;
f32 rotatedX = kpad->horizonTangentX * kpad->dpdObjectDirectionX + kpad->horizonTangentY * kpad->dpdObjectDirectionY;
f32 rotatedY = -kpad->dpdObjectDirectionY * kpad->horizonTangentX + kpad->dpdObjectDirectionX * kpad->horizonTangentY;
f32 scaleX = 0.5f * (kpad->dpdState.candidates[0].x + kpad->dpdState.candidates[1].x);
f32 scaleY = 0.5f * (kpad->dpdState.candidates[0].y + kpad->dpdState.candidates[1].y);
@@ -1329,8 +1326,8 @@ static void read_kpad_stick(KPADInside* kpad, KPADSample* status) {
clamp = clamp_stick_circle;
}
device = status->device;
format = status->dataFormat;
if (device == 1) {
format = status->dataFormat;
if ((u8)(format + 0xFD) <= 2) {
if (kpad->flag51E != 0) {
kpad->flag51E = 0;
@@ -1344,6 +1341,7 @@ static void read_kpad_stick(KPADInside* kpad, KPADSample* status) {
clamp(&extension->fs.stick, status->extension.fs.stickX, status->extension.fs.stickY, kp_fs_fstick_min, kp_fs_fstick_max);
}
} else if (device == 2) {
format = status->dataFormat;
if ((u8)(format + 0xFA) > 2) {
return;
}
@@ -1745,9 +1743,7 @@ static void KPADiSamplingCallback(s32 chan) {
} else {
height -= kpad->sensorBarCenterY;
}
if (x >= height) {
x = height;
}
x = x < height ? x : height;
distance = angle / x;
kpad->sensorBarScale = distance;
kpad->sensorHeightPending = 0;

View File

@@ -441,26 +441,26 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
} else {
contentCount = titleMeta->head.numContents;
}
contentMeta = titleMeta->contents;
for (index = 0; index < contentCount; index++) {
if (workspace.unpackInfo.cidxMode >= 1) {
s32 selectedIndex = _WADGetCidx(workspace.unpackInfo.contentIndex, index);
if ((selectedIndex < 0) ||
(titleMeta->head.numContents <= selectedIndex)) {
(selectedIndex >= titleMeta->head.numContents)) {
result = -3001;
goto cleanup;
}
contentMeta = titleMeta->contents + selectedIndex;
result = 0;
} else {
contentMeta = titleMeta->contents + index;
}
if ((contentMeta->type & 0x8000) != 0) {
blocks->sharedInodes++;
blocks->sharedBlocks += ((u32)contentMeta->size + 0x3FFF) >> 14;
blocks->sharedInodes++;
} else {
blocks->privateInodes++;
blocks->privateBlocks += ((u32)contentMeta->size + 0x3FFF) >> 14;
blocks->privateInodes++;
}
contentMeta++;
}
}
if ((workspace.unpackInfo.fileListSize != 0) &&
@@ -471,7 +471,8 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
workspace.unpackInfo.fileCount * 0x48)) != 0)) {
fileOffset = workspace.unpackInfo.fileOffset;
for (index = 0; index < workspace.unpackInfo.fileCount; index++) {
WADFileHeader* fileHeader = &workspace.fileHeader;
WADFileHeader* fileHeader;
fileHeader = &workspace.fileHeader;
result = WADReadStream(&workspace.stream, (void**)&fileHeader, 0x80,
offset + fileOffset);
if (result != 0x80) {
@@ -1218,6 +1219,8 @@ s32 WADBackupEx(u64 titleId, u32 ticketId, MEMAllocator* allocator, char* path,
OSThread exportThread;
NANDFileInfo savedFile ALIGN32;
WADBackupHeaderBlock headerBlock ALIGN64;
char currentDirectory[NAND_MAX_PATH];
WADBackupFileHeader fileHeader ALIGN32;
ESContentMask existingContentMask ALIGN32;
u8 hashContext[0x60] ALIGN64;
u8 digest[0x40] ALIGN32;
@@ -1306,6 +1309,10 @@ s32 WADBackupEx(u64 titleId, u32 ticketId, MEMAllocator* allocator, char* path,
}
}
if ((flags & 2) != 0) {
result = NANDGetCurrentDir(currentDirectory);
if (result != 0) {
goto cleanup;
}
result = _WADBackupGetFiles(0, flags, allocator, &fileCount, 0);
if (result != 0) {
goto cleanup;
@@ -1536,6 +1543,8 @@ s32 WADBackupEx(u64 titleId, u32 ticketId, MEMAllocator* allocator, char* path,
size_t nameLength = strlen(file->path);
_WADRandPad(file->path + nameLength + 1,
0x75 - (nameLength + 1));
memcpy(&fileHeader, file, sizeof(fileHeader));
file = &fileHeader;
result = SHA1Input(hashContext, file, sizeof(WADBackupHeaderBlock));
if (result != 0) {
goto cleanup;
@@ -1823,30 +1832,30 @@ s32 WADOpenStream(WADLocation location, const char* path, WADStream* stream, u32
WADContentPath* contentPath = (WADContentPath*)path;
s32 result;
if (write != 0) {
result = -3004;
return -3004;
} else {
result = contentOpenDVD(contentPath->handle, contentPath->name,
&stream->handle.contentDvd);
if (result != 0) {
result = -3004;
return -3004;
}
}
return result;
return 0;
}
case WAD_LOCATION_CNT_NAND: {
WADContentPath* contentPath = (WADContentPath*)path;
s32 result;
if (write != 0) {
result = -3004;
return -3004;
} else {
result = contentOpenNAND(contentPath->handle, contentPath->name,
&stream->handle.contentNand);
if (result != 0) {
result = -3004;
return -3004;
}
}
return result;
return 0;
}
case (WADLocation)0:
@@ -1860,24 +1869,19 @@ s32 WADOpenStream(WADLocation location, const char* path, WADStream* stream, u32
{
s32 result;
if (write != 0) {
result = -3004;
} else if (DVDOpen(path, &stream->handle.dvd)) {
result = 0;
} else {
result = -3004;
return -3004;
}
return result;
if (!DVDOpen(path, &stream->handle.dvd)) {
return -3004;
}
return 0;
}
case WAD_LOCATION_NAND:
{
s32 result;
if (write == 0) {
result = NANDPrivateOpen(path, &stream->handle.nand, 1);
if (result != 0) {
return -3004;
}
return result;
goto openNandRead;
}
result = NANDPrivateOpen(path, &stream->handle.nand, 3);
if (result == -12) {
@@ -1903,11 +1907,7 @@ s32 WADOpenStream(WADLocation location, const char* path, WADStream* stream, u32
fileSize = offset - fileSize;
while (fileSize != 0) {
u32 writeSize;
if (fileSize > sizeof(zeroes)) {
writeSize = sizeof(zeroes);
} else {
writeSize = fileSize;
}
writeSize = fileSize > sizeof(zeroes) ? sizeof(zeroes) : fileSize;
if (NANDWrite(&stream->handle.nand, zeroes, writeSize) != writeSize) {
return -3004;
}
@@ -1916,6 +1916,12 @@ s32 WADOpenStream(WADLocation location, const char* path, WADStream* stream, u32
result = NANDSeek(&stream->handle.nand, offset, 0);
}
return result != offset ? -3004 : 0;
openNandRead:
result = NANDPrivateOpen(path, &stream->handle.nand, 1);
if (result != 0) {
return -3004;
}
return result;
}
case WAD_LOCATION_SD_CARD: {
@@ -2458,10 +2464,11 @@ static s32 _WADUnpackBackup(WADHeader* header, WADStream* stream, WADUnpackInfo*
}
result = 0;
}
result = 0;
sectionOffset += (backupHeader->tmdSize + WAD_STREAM_ALIGNMENT - 1) &
~(WAD_STREAM_ALIGNMENT - 1);
if ((flags & 2) != 0) {
return 0;
goto done;
}
}
@@ -2478,7 +2485,7 @@ static s32 _WADUnpackBackup(WADHeader* header, WADStream* stream, WADUnpackInfo*
if ((flags & 1) == 0) {
result = WADVerify(stream, allocator, offset, backupHeader->backupAreaLen);
if (result != 0) {
return result;
goto done;
}
}
}
@@ -2590,6 +2597,7 @@ static s32 _WADCanImportFile(const WADFileHeader* fileHeader, u32 transferId, co
static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator* allocator,
u32* fileCount, WADBackupFileHeader* files) {
s32 result;
NANDFileInfo fileInfo;
char fullFilePath[NAND_MAX_PATH];
char currentDirectory[NAND_MAX_PATH] ALIGN32;
@@ -2606,7 +2614,6 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
u32 totalFiles = 0;
u32 nameIndex;
BOOL absolutePaths = FALSE;
s32 result;
if (allocator == 0 || fileCount == 0) {
result = -3000;
@@ -2772,11 +2779,10 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
u32 selectedCount;
u32 contentIndex;
u32 fileIndex;
s32 result = 0;
if ((titleMeta != 0) && (titleMetaSize != 0)) {
if (((flags & 1) != 0) || ((flags & 0x20) != 0)) {
result = ES_GetTmdSizeFromView(titleMeta, titleMetaSize);
s32 result = ES_GetTmdSizeFromView(titleMeta, titleMetaSize);
if (result != 0) {
return result;
}
@@ -2786,7 +2792,7 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
selectedCount = _WADGetCidxCount(contentMask);
for (contentIndex = 0; contentIndex < selectedCount; contentIndex++) {
s32 tmdIndex = _WADGetCidx(contentMask, contentIndex);
if ((tmdIndex < 0) || (titleMeta->head.numContents <= tmdIndex)) {
if ((tmdIndex < 0) || (tmdIndex >= titleMeta->head.numContents)) {
return -3009;
}
contentSize += ((u32)titleMeta->contents[tmdIndex].size + 0x3F) & ~0x3F;
@@ -2813,7 +2819,7 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
if (totalSize != 0) {
*totalSize = titleSize + contentSize + filesSize;
}
return result;
return 0;
}
#pragma dont_inline reset
@@ -2839,13 +2845,15 @@ static void _WADFreeMemory(WADUnpackInfo* info, MEMAllocator* allocator) {
static void _WADRandPad(void* buffer, u32 size) {
u32* words = buffer;
u32 wordCount = size >> 2;
u32 remainder = size & 3;
u32 wordCount;
u32 remainder;
u32 wordIndex;
if (size == 0) {
return;
}
wordCount = size >> 2;
remainder = size & 3;
for (wordIndex = 0; wordIndex < wordCount; wordIndex++) {
*words++ = (((u32)rand() << 17) | ((u32)rand() << 2)) | (rand() & 3);
}
@@ -2895,8 +2903,8 @@ static s32 WAD_815C43E0(WADHashThreadArgs* args) {
static s32 _WADHash(WADStream* stream, u32 offset, u32 size, void* context, void* buffer,
u32 chunkSize, void* secondBuffer, void* threadStack, u32 threadStackSize) {
s32 result;
void* readBuffer;
s32 result = 0;
u32 completed = 0;
if (stream == 0 || context == 0 || buffer == 0) {
@@ -2915,12 +2923,10 @@ static s32 _WADHash(WADStream* stream, u32 offset, u32 size, void* context, void
result = -3000;
goto done;
}
result = 0;
if (secondBuffer == 0 || threadStack == 0) {
while (size != 0) {
u32 readSize = size;
if (size > chunkSize) {
readSize = chunkSize;
}
u32 readSize = size < chunkSize ? size : chunkSize;
readBuffer = buffer;
result = WADReadStream(stream, &readBuffer, readSize, offset + completed);
if ((u32)result != readSize) {
@@ -2952,11 +2958,8 @@ static s32 _WADHash(WADStream* stream, u32 offset, u32 size, void* context, void
}
OSResumeThread(&thread);
while (size != 0 && transfer.error == 0) {
u32 readSize = size;
u32 readSize = size < chunkSize ? size : chunkSize;
OSMutex* mutex = &transfer.mutex[bufferIndex];
if (size > chunkSize) {
readSize = chunkSize;
}
OSLockMutex(mutex);
while (transfer.ready[bufferIndex] != 0 && transfer.error == 0) {
OSWaitCond(&transfer.waitCond[bufferIndex], mutex);
@@ -2994,6 +2997,7 @@ done:
s32 WADVerify(WADStream* stream, MEMAllocator* allocator, u32 offset, u32 size) {
void* readBuffer ALIGN64 = 0;
void* allocatedBuffer = 0;
u8 digest[0x40] ALIGN64;
u8 hashContext[0x60] ALIGN64;
void* verificationBuffer = 0;
@@ -3007,10 +3011,10 @@ s32 WADVerify(WADStream* stream, MEMAllocator* allocator, u32 offset, u32 size)
} else if (size <= 0x340) {
result = -3000;
} else {
readBuffer = _WADMemAlloc(allocator, 0x8000);
if (readBuffer == 0) {
allocatedBuffer = _WADMemAlloc(allocator, 0x8000);
if (allocatedBuffer == 0) {
result = -3003;
} else if (((u32)readBuffer & 0x3F) != 0) {
} else if (((u32)allocatedBuffer & 0x3F) != 0) {
result = -3007;
} else {
u32 hashSize = size - 0x340;
@@ -3018,10 +3022,11 @@ s32 WADVerify(WADStream* stream, MEMAllocator* allocator, u32 offset, u32 size)
signatureOffset = offset + hashSize;
SHA1Reset(hashContext);
result = _WADHash(stream, offset, hashSize, hashContext,
readBuffer, 0x8000, 0, 0, 0x1000);
allocatedBuffer, 0x8000, 0, 0, 0x1000);
if (result == 0) {
result = SHA1Result(hashContext, digest);
if (result == 0) {
readBuffer = allocatedBuffer;
result = WADReadStream(stream, &readBuffer, 0x340,
signatureOffset);
if (result == 0x340) {
@@ -3051,8 +3056,8 @@ s32 WADVerify(WADStream* stream, MEMAllocator* allocator, u32 offset, u32 size)
}
}
if (readBuffer != 0) {
_WADMemFree(allocator, readBuffer);
if (allocatedBuffer != 0) {
_WADMemFree(allocator, allocatedBuffer);
}
if (verificationBuffer != 0) {
_WADMemFree(allocator, verificationBuffer);
@@ -3428,8 +3433,7 @@ s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
}
memset(&parts, 0, sizeof(parts));
result = WAD_815C2F44(&header, parts.headerInfo);
if (result != 2) {
if (WAD_815C2F44(&header, parts.headerInfo) != 2) {
result = -3000;
goto cleanup;
}
@@ -3527,12 +3531,10 @@ s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
remainingContentSize = ((u32)contentMeta->size + 0xF) & ~0xF;
while (remainingContentSize != 0) {
u32 chunkSize = remainingContentSize;
u32 chunkSize = remainingContentSize < remainingBufferSize ?
remainingContentSize : remainingBufferSize;
u32 readSize;
if (chunkSize > remainingBufferSize) {
chunkSize = remainingBufferSize;
}
readSize = (chunkSize + 0x1F) & ~0x1F;
readResult = DVDReadPrio(&fileInfo, contentBuffer, readSize, sectionOffset, 2);
if ((u32)readResult != readSize) {

View File

@@ -294,11 +294,11 @@ extern vu32 __DVDLayoutFormat;
void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
u8 *block = start;
do {
for (; blockCount != 0; --blockCount) {
DCZeroRange(block, 32);
DCFlushRange(block, 32);
block += 32;
} while (--blockCount != 0);
}
((void (*)(u32))entryPoint)(argument);
}
@@ -1195,7 +1195,8 @@ BOOL CheckBS2CommandStatus() {
partCount = ((DVDGameTOC *)DataToc)->partitionCount;
chunkLength = OSRoundUp32B(partCount * sizeof(DVDPartitionInfo)) + 32;
CacheCommandComplete = 1;
CacheLength = CacheLength + chunkLength;
CacheLength = CacheLength + OSRoundUp32B(partCount * sizeof(DVDPartitionInfo));
CacheLength += 32;
if ((unsigned int)CacheLength > 0xb00000) {
BS2NANDCallback(-1, NULL);
return 1;
@@ -1374,12 +1375,12 @@ BS2State BS2Tick() {
State = BS2_STT_3;
currentTime = __OSGetSystemTime();
ResetTime = currentTime;
if (BS2WaitSpinup == 0 || BS2BootFromCache != 0) {
if (BS2WaitSpinup != 0 && BS2BootFromCache == 0) {
currentTime = __OSGetSystemTime();
SpinupDeadline = currentTime;
SpinupDeadline = (u64)((OS_BUS_CLOCK >> 2) * 5) + currentTime;
} else {
currentTime = __OSGetSystemTime();
SpinupDeadline = currentTime + (u64)((OS_BUS_CLOCK >> 2) * 5);
SpinupDeadline = currentTime;
}
}
break;
@@ -1398,12 +1399,12 @@ BS2State BS2Tick() {
AudioBufferUnconfigured = 1;
currentTime = __OSGetSystemTime();
ResetTime = currentTime;
if (BS2BootFromCache == 0) {
currentTime = __OSGetSystemTime();
SpinupDeadline = currentTime + (u64)((OS_BUS_CLOCK >> 2) * 7);
} else {
if (BS2BootFromCache != 0) {
currentTime = __OSGetSystemTime();
SpinupDeadline = currentTime;
} else {
currentTime = __OSGetSystemTime();
SpinupDeadline = (u64)((OS_BUS_CLOCK >> 2) * 7) + currentTime;
}
__OSClearRTCFlags();
DVDResetAsync(&Block, BS2DVDCallback);
@@ -1481,9 +1482,9 @@ BS2State BS2Tick() {
memcpy((void *)0x80000000, &DiskID, 0x20);
if ((*(u32 *)0x80000018) == 0x5d1c9ea3) {
status = strncmp((char *)0x80000000, "RAAE", 4);
if ((((status == 0) || (status = strncmp((char *)0x80000000, "408", 3), status == 0)) ||
(status = strncmp((char *)0x80000000, "410", 3), status == 0)) ||
(status = strncmp((char *)0x80000000, "410", 3), status == 0))
if (status == 0 || strncmp((char *)0x80000000, "408", 3) == 0 ||
strncmp((char *)0x80000000, "410", 3) == 0 ||
strncmp((char *)0x80000000, "410", 3) == 0)
regionMatches = FALSE;
else
regionMatches = TRUE;

View File

@@ -102,9 +102,11 @@ static void* UpdateThread(void* argument) {
BS2UpdateEntry* selectedSeats;
u32 selectedSeatCount;
BOOL regionValid;
u8 titleRegion;
u32 titleRegion;
BS2Report("Start update thread\n");
StartUpdate = 0;
CancelUpdate = 0;
missingFile = FALSE;
selectedCount = 0;
requiredBytes = 0;
@@ -114,8 +116,6 @@ static void* UpdateThread(void* argument) {
freeBlocks = 0;
freeInodes = 0;
selectedSeatCount = 0;
StartUpdate = 0;
CancelUpdate = 0;
State = 0;
ContainsSeatTitles = FALSE;
if (ES_GetTitleId(&titleId) != 0) {

View File

@@ -7171,3 +7171,168 @@ diffs 186: [5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 22, 42, 46, 47, 50, 51, 53, 57, 6
599 M clrlwi r5, r30, 0x18
B clrlwi r5, r26, 0x18
```
## BS2, KPAD, and WAD block reconstruction
Baseline 94e6d862. Attempt candidates and full instruction diffs: /tmp/sol-med-attempts. Each initially open function has at least three distinct compiling attempts. Each attempt built its object, checked the string pool, ran ctxdiff, and generated objdiff.
| Unit | Function | Attempt | Change | Result |
| --- | --- | --- | --- | --- |
| src/BS2/BS2Mach | BS2Tick | 1 | translate case 0 deadline blocks in target address order | 74.78608 -> 75.32371; src 0x1dc4 base 0x1e50 insns 1905/1940; kept |
| src/BS2/BS2Mach | BS2Tick | 2 | translate case 2 cache deadline blocks in target address order | 75.32371 -> 75.74536; src 0x1dc4 base 0x1e50 insns 1905/1940; kept |
| src/BS2/BS2Mach | BS2Tick | 3 | use signed time temporary for signed deadline comparisons | 75.74536 -> 75.74536; src 0x1dc4 base 0x1e50 insns 1905/1940; reverted |
| src/BS2/BS2Mach | BS2Tick | 4 | translate disc signature checks as direct short-circuit branches | 75.74536 -> 76.66908; src 0x1db8 base 0x1e50 insns 1902/1940; kept |
| src/BS2/BS2Mach | BS2Tick | 5 | load country code only after command completion block | 76.66908 -> 76.22113; src 0x1db8 base 0x1e50 insns 1902/1940; reverted |
| src/BS2/BS2Mach | BS2Tick | 6 | translate unsigned disk audio byte and defer load until configured check | 76.66908 -> 76.16392; src 0x1dac base 0x1e50 insns 1899/1940; reverted |
| src/BS2/BS2Mach | CheckBS2CommandStatus | 1 | translate cache length update before completion flag | 80.13300 -> 80.10838; src 0x60c base 0x658 insns 387/406; reverted |
| src/BS2/BS2Mach | CheckBS2CommandStatus | 2 | translate partition byte accumulation in target addition order | 80.13300 -> 80.69704; src 0x610 base 0x658 insns 388/406; kept |
| src/BS2/BS2Mach | CheckBS2CommandStatus | 3 | translate success state as early branch before failure callback | 80.69704 -> 57.50246; src 0x610 base 0x658 insns 388/406; reverted |
| src/BS2/BS2Mach | BS2StartGame | 1 | translate initial idle polling block as command state field | 95.49618 -> 93.94402; src 0x644 base 0x624 insns 401/393; reverted |
| src/BS2/BS2Mach | BS2StartGCGame | 1 | translate initial idle polling block as command state field | 98.24561 -> 95.57018; src 0x38c base 0x390 insns 227/228; reverted |
| src/BS2/BS2Mach | BS2StartGCGame | 2 | translate time multiplication in target operand order | 98.24561 -> 98.11404; src 0x38c base 0x390 insns 227/228; reverted |
| src/BS2/BS2Mach | BS2StartGCGame | 3 | translate reset register through a named value temporary | 98.24561 -> 98.24561; src 0x38c base 0x390 insns 227/228; reverted |
| src/BS2/BS2Mach | BS2StartGame | 2 | translate low-read completion loops as target empty polling blocks | 95.49618 -> 98.54962; src 0x614 base 0x624 insns 389/393; rejected after semantic review; original polling restored before commit |
| src/BS2/BS2Mach | BS2StartGame | 3 | translate DI control update with direct bit expression | 98.54962 -> 98.05344; src 0x614 base 0x624 insns 389/393; reverted |
| src/BS2/BS2Mach | BS2NANDDivideReadAsync | 1 | translate request with the argument buffer rather than reloaded global | 60.31915 -> 47.87234; src 0xc0 base 0xbc insns 48/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideReadAsync | 2 | translate initial block limit with a chunk-length temporary | compile failed |
| src/BS2/BS2Mach | BS2NANDDivideReadAsync | 3 | translate request setup stores in target scheduling order | 60.31915 -> 60.31915; src 0xb4 base 0xbc insns 45/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideWriteAsync | 1 | translate request with the argument buffer rather than reloaded global | 60.31915 -> 47.87234; src 0xc0 base 0xbc insns 48/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideWriteAsync | 2 | translate initial block limit with a chunk-length temporary | compile failed |
| src/BS2/BS2Mach | BS2NANDDivideWriteAsync | 3 | translate request setup stores in target scheduling order | 60.31915 -> 60.31915; src 0xb4 base 0xbc insns 45/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideCallback | 1 | translate negative and cancelled blocks as early returns | 85.03906 -> 85.03906; src 0x1dc base 0x200 insns 119/128; reverted |
| src/BS2/BS2Mach | BS2NANDDivideCallback | 2 | translate transferred byte and buffer updates in target load order | 85.03906 -> 85.00000; src 0x1dc base 0x200 insns 119/128; reverted |
| src/BS2/BS2Mach | BS2NANDDivideCallback | 3 | translate remaining byte calculation through a named temporary | compile failed |
| src/BS2/BS2Mach | Run | 1 | translate cache clearing as a count-controlled for loop | 0.00000 -> 0.88372; src 0x78 base 0xac insns 30/43; kept |
| src/BS2/BS2Mach | BS2NANDDivideReadAsync | 4 | declare chunk length at block start then translate initial limit | 60.31915 -> 52.44681; src 0xc0 base 0xbc insns 48/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideWriteAsync | 4 | declare chunk length at block start then translate initial limit | 60.31915 -> 52.44681; src 0xc0 base 0xbc insns 48/47; reverted |
| src/BS2/BS2Mach | BS2NANDDivideCallback | 4 | declare remaining byte temporary at function start | 85.03906 -> 70.85938; src 0x1dc base 0x200 insns 119/128; reverted |
| src/BS2/BS2Mach | Run | 2 | translate cache clearing with indexed iteration | 0.88372 -> 0.00000; src 0x84 base 0xac insns 33/43; reverted |
| src/BS2/BS2Mach | Run | 3 | translate entry call using a named function pointer | 0.88372 -> 0.88372; src 0x78 base 0xac insns 30/43; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADRead | 1 | translate sample cursor as signed ring index | 83.57952 -> 83.53595; src 0x75c base 0x72c insns 471/459; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADRead | 2 | translate target zero result initialization before status check | 83.57952 -> 83.57952; src 0x75c base 0x72c insns 471/459; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADRead | 3 | translate reverse-copy pointer from count before decrement | 83.57952 -> 83.50109; src 0x764 base 0x72c insns 473/459; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 1 | translate target multiplication operand order | 96.57895 -> 95.52631; src 0x4c base 0x4c insns 19/19; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 2 | translate scale factor at point of final multiply | 96.57895 -> 95.78947; src 0x4c base 0x4c insns 19/19; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 3 | translate scale double before spatial temporaries | 96.57895 -> 95.00000; src 0x4c base 0x4c insns 19/19; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADSetSensorHeight | 1 | translate diagonal square before center assignments | 99.23077 -> 99.23077; src 0xd0 base 0xd0 insns 52/52; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADSetSensorHeight | 2 | translate kpad base after dimensions are prepared | 99.23077 -> 99.23077; src 0xd0 base 0xd0 insns 52/52; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADSetSensorHeight | 3 | translate diagonal expression without squared temporaries | 99.23077 -> 99.23077; src 0xd0 base 0xd0 insns 52/52; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_acc | 1 | translate format dispatch as switch in target comparison tree | 65.73500 -> 65.40000; src 0x648 base 0x640 insns 402/400; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_acc | 2 | load previous acceleration after raw clamping blocks | 65.73500 -> 66.56500; src 0x640 base 0x640 insns 400/400; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_acc | 3 | translate clamp branches with explicit target rejection direction | 65.73500 -> 65.73500; src 0x640 base 0x640 insns 400/400; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 4 | translate projection expressions directly from straight-line target | 96.57895 -> 96.05263; src 0x4c base 0x4c insns 19/19; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 5 | translate scaled vector then apply horizontal projection | 96.57895 -> 96.31579; src 0x4c base 0x4c insns 19/19; reverted |
| libs/RVL_SDK/src/kpad/KPAD | get_ring_buffer_by_kpad1_style | 1 | translate metadata comparison using a signed promoted byte | 99.58334 -> 98.95834; src 0x180 base 0x180 insns 96/96; reverted |
| libs/RVL_SDK/src/kpad/KPAD | get_ring_buffer_by_kpad1_style | 2 | translate ring traversal as remaining count loop | 99.58334 -> 98.01041; src 0x17c base 0x180 insns 95/96; reverted |
| libs/RVL_SDK/src/kpad/KPAD | get_ring_buffer_by_kpad1_style | 3 | translate interrupt token before ring-loop locals | 99.58334 -> 100.00000; src 0x180 base 0x180 insns 96/96; reverted |
| libs/RVL_SDK/src/kpad/KPAD | reset_kpad | 1 | translate acceleration copy as named vector components | 69.37607 -> 63.94872; src 0x1b0 base 0x1d4 insns 108/117; reverted |
| libs/RVL_SDK/src/kpad/KPAD | reset_kpad | 2 | translate object invalidation as descending indexed loops | 69.37607 -> 58.18803; src 0x1d8 base 0x1d4 insns 118/117; reverted |
| libs/RVL_SDK/src/kpad/KPAD | reset_kpad | 3 | translate sensor distance quotient after stored reference scale | 69.37607 -> 69.37607; src 0x1f8 base 0x1d4 insns 126/117; reverted |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 1 | translate smoothing addition operand order | 95.89109 -> 95.89109; src 0x190 base 0x194 insns 100/101; reverted |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 2 | translate normalized axes from loaded acceleration locals | 95.89109 -> 93.26733; src 0x188 base 0x194 insns 98/101; reverted |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 3 | translate magnitude rejection as early returns | 95.89109 -> 96.98020; src 0x194 base 0x194 insns 101/101; reverted |
| libs/RVL_SDK/src/kpad/KPAD | get_ring_buffer_by_kpad1_style | 4 | recheck exact candidate with exact-code measure priority | 99.58334 -> 100.00000; unit 82.437195 -> 82.44945; src 0x180 base 0x180 insns 96/96; reverted |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 4 | recheck target-sized early-return candidate against code measures | 95.89109 -> 96.98020; unit 82.437195 -> 82.470894; src 0x194 base 0x194 insns 101/101; reverted |
| libs/RVL_SDK/src/kpad/KPAD | get_ring_buffer_by_kpad1_style | 5 | recheck exact candidate using gate pool fallback for absent .data | 99.58334 -> 100.00000; unit 82.437195 -> 82.44945; src 0x180 base 0x180 insns 96/96; kept |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 5 | recheck early-return candidate with gate pool fallback | 95.89109 -> 96.98020; unit 82.44945 -> 82.48315; src 0x194 base 0x194 insns 101/101; kept |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_acc | 4 | recheck delayed previous acceleration load with gate pool fallback | 65.73500 -> 66.56500; unit 82.48315 -> 82.58486; src 0x640 base 0x640 insns 400/400; kept |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_dpd | 1 | translate object coordinates in target multiply operand order | 73.54317 -> 73.54317; unit 82.58486 -> 82.58486; src 0x464 base 0x458 insns 281/278; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_dpd | 2 | translate reverse object copy as target do-while bound | 73.54317 -> 73.54317; unit 82.58486 -> 82.58486; src 0x464 base 0x458 insns 281/278; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_dpd | 3 | translate invalidation loop with descending bound | 73.54317 -> 72.41727; unit 82.58486 -> 82.48897; src 0x480 base 0x458 insns 288/278; reverted |
| libs/RVL_SDK/src/kpad/KPAD | calc_dpd_variable | 1 | translate initial horizon through a vector stack local | 73.56000 -> 77.84800; unit 82.58486 -> 82.9133; src 0x3bc base 0x3e8 insns 239/250; kept |
| libs/RVL_SDK/src/kpad/KPAD | calc_dpd_variable | 2 | translate rotated coordinates in target multiply order | 77.84800 -> 80.02400; unit 82.9133 -> 83.07996; src 0x3bc base 0x3e8 insns 239/250; kept |
| libs/RVL_SDK/src/kpad/KPAD | calc_dpd_variable | 3 | translate distance speed absolute value with one store | 80.02400 -> 78.34800; unit 83.07996 -> 82.95159; src 0x3b4 base 0x3e8 insns 237/250; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_first | 1 | translate pair-search basic blocks as target pointer traversal | 72.86066 -> 76.18033; unit 83.07996 -> 83.20404; src 0x1f4 base 0x1e8 insns 125/122; kept |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_first | 2 | translate outer-loop bound to exclude object without successors | 76.18033 -> 76.13934; unit 83.20404 -> 83.202515; src 0x1f4 base 0x1e8 insns 125/122; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_first | 3 | translate normalization into explicit length before reciprocal | 76.18033 -> 76.18033; unit 83.20404 -> 83.20404; src 0x1f4 base 0x1e8 insns 125/122; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_continue | 1 | translate pair-search basic blocks as target pointer traversal | 86.34782 -> 89.39130; unit 83.20404 -> 83.33272; src 0x22c base 0x228 insns 139/138; kept |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_continue | 2 | translate outer-loop bound to exclude object without successors | 89.39130 -> 89.35507; unit 83.33272 -> 83.33119; src 0x22c base 0x228 insns 139/138; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_continue | 3 | translate normalization into explicit length before reciprocal | 89.39130 -> 89.39130; unit 83.33272 -> 83.33272; src 0x22c base 0x228 insns 139/138; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_first | 1 | translate candidate vector copy as named component stores | 73.02752 -> 88.52293; unit 83.33272 -> 83.85018; src 0x1b4 base 0x1b4 insns 109/109; kept |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_first | 2 | translate object record copies as struct assignments | 88.52293 -> 90.83486; unit 83.85018 -> 83.92739; src 0x1b4 base 0x1b4 insns 109/109; kept |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_first | 3 | translate offset scaling in target operand order | 90.83486 -> 90.83486; unit 83.92739 -> 83.92739; src 0x1b4 base 0x1b4 insns 109/109; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_continue | 1 | translate pointer loops with explicit increments in bodies | 80.07527 -> 80.07527; unit 83.92739 -> 83.92739; src 0x17c base 0x174 insns 95/93; reverted |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_continue | 2 | translate distance scale multiplication in target operand order | 80.07527 -> 80.18279; unit 83.92739 -> 83.93045; src 0x17c base 0x174 insns 95/93; kept |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_continue | 3 | translate negative validity return with a conditional expression | 80.18279 -> 76.88172; unit 83.93045 -> 83.836395; src 0x178 base 0x174 insns 94/93; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_stick | 1 | translate data-format load inside each extension branch | 95.34810 -> 96.58227; unit 83.93045 -> 83.9902; src 0x274 base 0x278 insns 157/158; kept |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_stick | 2 | translate classic trigger ratio with signed limit temporaries | 96.58227 -> 87.76582; unit 83.9902 -> 83.563416; src 0x264 base 0x278 insns 153/158; reverted |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_stick | 3 | translate clamp selection as conditional initializer | 96.58227 -> 96.58227; unit 83.9902 -> 83.9902; src 0x274 base 0x278 insns 157/158; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADInit | 1 | translate repeat defaults from initialized delay field | 72.46487 -> 72.46487; unit 83.9902 -> 83.9902; src 0x320 base 0x2e4 insns 200/185; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADInit | 2 | translate channel setup as pointer-bound loop | 72.46487 -> 68.34595; unit 83.9902 -> 83.75674; src 0x318 base 0x2e4 insns 198/185; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADInit | 3 | translate angular multiplication in target operand order | 72.46487 -> 72.35676; unit 83.9902 -> 83.98407; src 0x320 base 0x2e4 insns 200/185; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADiSamplingCallback | 1 | translate ring index as promoted unsigned byte | 88.14835 -> 88.14835; unit 83.9902 -> 83.9902; src 0x2d8 base 0x2d8 insns 182/182; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADiSamplingCallback | 2 | translate classic format tier in target switch value order | 88.14835 -> 88.14835; unit 83.9902 -> 83.9902; src 0x2d8 base 0x2d8 insns 182/182; reverted |
| libs/RVL_SDK/src/kpad/KPAD | KPADiSamplingCallback | 3 | translate minimum sensor span with target conditional expression | 88.14835 -> 89.30220; unit 83.9902 -> 84.054535; src 0x2d8 base 0x2d8 insns 182/182; kept |
| src/BS2/BS2Update | UpdateThread | 1 | translate target stack workspace in actual address order | compile failed |
| src/BS2/BS2Update | UpdateThread | 2 | translate product-region basic blocks as boolean assignment | 84.05586 -> 82.34611; unit 84.19941 -> 82.65844; src 0xd88 base 0xe44 insns 866/913; reverted |
| src/BS2/BS2Update | UpdateThread | 3 | translate initialization stores in target block order | 84.05586 -> 84.42607; unit 84.19941 -> 84.53307; src 0xd80 base 0xe44 insns 864/913; kept |
| src/BS2/BS2Update | BS2UpdateInit | 1 | translate thread argument with named thread pointer | 79.87500 -> 79.87500; unit 84.53307 -> 84.53307; src 0x11c base 0x120 insns 71/72; reverted |
| src/BS2/BS2Update | BS2UpdateInit | 2 | translate stack end as address of final stack element | 79.87500 -> 79.87500; unit 84.53307 -> 84.53307; src 0x11c base 0x120 insns 71/72; reverted |
| src/BS2/BS2Update | BS2UpdateInit | 3 | translate zeroing length from selected update-entry array | 79.87500 -> 79.87500; unit 84.53307 -> 84.53307; src 0x11c base 0x120 insns 71/72; reverted |
| src/BS2/BS2Update | UpdateThread | 4 | correct workspace member references and retest target stack layout | 84.42607 -> 84.39869; unit 84.53307 -> 84.50839; src 0xd80 base 0xe44 insns 864/913; reverted |
| src/BS2/BS2Update | UpdateThread | 5 | translate title-region byte as promoted unsigned local | 84.42607 -> 84.51698; unit 84.53307 -> 84.615005; src 0xd70 base 0xe44 insns 860/913; kept |
| src/BS2/BS2Update | UpdateThread | 6 | translate region rejection at each switch exit block | 84.51698 -> 83.96276; unit 84.615005 -> 84.1155; src 0xd9c base 0xe44 insns 871/913; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportEx | 1 | translate result local before pointer workspace declarations | 72.73997 -> 72.68935; unit 85.703674 -> 85.69421; src 0x11ac base 0x11e8 insns 1131/1146; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportEx | 2 | translate open-state initialization with declarations in target order | 72.73997 -> 72.73909; unit 85.703674 -> 85.70351; src 0x11ac base 0x11e8 insns 1131/1146; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportEx | 3 | translate transfer counters at their owning block boundaries | 72.73997 -> 72.73997; unit 85.703674 -> 85.703674; src 0x11ac base 0x11e8 insns 1131/1146; reverted |
| libs/RVL_SDK/src/wad/wad | WADBackupEx | 1 | translate missing file-header stack copy before hash and write blocks | 67.81261 -> 68.01507; unit 85.703674 -> 85.73878; src 0xe14 base 0x1098 insns 901/1062; kept |
| libs/RVL_SDK/src/wad/wad | WADBackupEx | 2 | translate current-directory validation before file enumeration | 68.01507 -> 68.56780; unit 85.73878 -> 85.83461; src 0xe28 base 0x1098 insns 906/1062; kept |
| libs/RVL_SDK/src/wad/wad | WADBackupEx | 3 | translate file enumeration counts in target local declaration order | 68.56780 -> 68.56027; unit 85.83461 -> 85.833305; src 0xe28 base 0x1098 insns 906/1062; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidx | 1 | translate bit traversal as simple loop for compiler unrolling | 99.14286 -> 96.96429; unit 85.83461 -> 82.64359; src 0xe0 base 0xe0 insns 56/56; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidx | 2 | translate requested ordinal using a signed countdown | 99.14286 -> 99.14286; unit 85.83461 -> 85.83461; src 0xe0 base 0xe0 insns 56/56; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidx | 3 | translate decrement inside explicit set-bit branch | 99.14286 -> 99.14286; unit 85.83461 -> 85.83461; src 0xe0 base 0xe0 insns 56/56; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidxCount | 1 | translate bit count as simple loop for compiler unrolling | 95.05000 -> 96.62500; unit 85.83461 -> 83.40865; src 0xa0 base 0xa0 insns 40/40; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidxCount | 2 | translate bit index as signed target shift operand | 95.05000 -> 89.17500; unit 85.83461 -> 85.79624; src 0xa0 base 0xa0 insns 40/40; reverted |
| libs/RVL_SDK/src/wad/wad | _WADGetCidxCount | 3 | translate bit tests as conditional count addition | 95.05000 -> 1.55000; unit 85.83461 -> 82.16131; src 0xd0 base 0xa0 insns 52/40; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815BFFA8 | 1 | translate transfer locals in target fd/result/count declaration order | 97.17742 -> 96.66129; unit 85.83461 -> 85.82939; src 0xf8 base 0xf8 insns 62/62; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815BFFA8 | 2 | translate chunk selection with conditional minimum | 97.17742 -> 94.51613; unit 85.83461 -> 85.80767; src 0xf4 base 0xf8 insns 61/62; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815BFFA8 | 3 | translate alternating buffer as arithmetic toggle | 97.17742 -> 96.37096; unit 85.83461 -> 85.82645; src 0xf8 base 0xf8 insns 62/62; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C1288 | 1 | translate transfer locals in target fd/result/count declaration order | 96.39344 -> 96.27869; unit 85.83461 -> 85.833466; src 0xf4 base 0xf4 insns 61/61; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C1288 | 2 | translate chunk selection with conditional minimum | 96.39344 -> 94.50819; unit 85.83461 -> 85.815834; src 0xf0 base 0xf4 insns 60/61; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C1288 | 3 | translate alternating buffer as arithmetic toggle | 96.39344 -> 95.57377; unit 85.83461 -> 85.82645; src 0xf4 base 0xf4 insns 61/61; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C43E0 | 1 | translate transfer locals in target fd/result/count declaration order | 97.17742 -> 97.17742; unit 85.83461 -> 85.83461; src 0xf8 base 0xf8 insns 62/62; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C43E0 | 2 | translate chunk selection with conditional minimum | 97.17742 -> 94.51613; unit 85.83461 -> 85.80767; src 0xf4 base 0xf8 insns 61/62; reverted |
| libs/RVL_SDK/src/wad/wad | WAD_815C43E0 | 3 | translate alternating buffer as arithmetic toggle | 97.17742 -> 96.37096; unit 85.83461 -> 85.82645; src 0xf8 base 0xf8 insns 62/62; reverted |
| libs/RVL_SDK/src/wad/wad | _WADUnpackBackup | 1 | translate result initialization before content section blocks | 95.84071 -> 96.37168; unit 85.83461 -> 85.844406; src 0x1c8 base 0x1c4 insns 114/113; kept |
| libs/RVL_SDK/src/wad/wad | _WADUnpackBackup | 2 | translate verification failure as shared return branch | 96.37168 -> 97.34513; unit 85.844406 -> 85.862366; src 0x1c4 base 0x1c4 insns 113/113; kept |
| libs/RVL_SDK/src/wad/wad | _WADUnpackBackup | 3 | translate device comparison with target operand order | 97.34513 -> 97.25664; unit 85.862366 -> 85.86073; src 0x1c4 base 0x1c4 insns 113/113; reverted |
| libs/RVL_SDK/src/wad/wad | _WADCheckContents | 1 | translate result local ahead of frame buffer declaration | 96.70588 -> 96.70588; unit 85.862366 -> 85.862366; src 0x154 base 0x154 insns 85/85; reverted |
| libs/RVL_SDK/src/wad/wad | _WADCheckContents | 2 | translate required-content rejection as nested target branch | 96.70588 -> 96.70588; unit 85.862366 -> 85.862366; src 0x154 base 0x154 insns 85/85; reverted |
| libs/RVL_SDK/src/wad/wad | _WADCheckContents | 3 | translate result as direct failure and success returns | 96.70588 -> 96.30589; unit 85.862366 -> 85.85682; src 0x154 base 0x154 insns 85/85; reverted |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 1 | translate content-open success blocks as explicit zero returns | 88.52217 -> 90.54680; unit 85.862366 -> 85.92947; src 0x32c base 0x32c insns 203/203; kept |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 2 | translate NAND read-open block after write-open path | 90.54680 -> 98.09360; unit 85.92947 -> 86.17959; src 0x330 base 0x32c insns 204/203; kept |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 3 | translate NAND zero-fill chunk with target min expression | 98.09360 -> 98.33991; unit 86.17959 -> 86.18775; src 0x330 base 0x32c insns 204/203; kept |
| libs/RVL_SDK/src/wad/wad | _WADRandPad | 1 | translate size test before quotient and remainder calculations | 87.30769 -> 93.78022; unit 86.18775 -> 86.28392; src 0x164 base 0x16c insns 89/91; kept |
| libs/RVL_SDK/src/wad/wad | _WADRandPad | 2 | translate random word components with target evaluation temporaries | 93.78022 -> 77.20879; unit 86.28392 -> 86.03771; src 0x154 base 0x16c insns 85/91; reverted |
| libs/RVL_SDK/src/wad/wad | _WADRandPad | 3 | translate tail copy by indexed bytes from random word | 93.78022 -> 69.34066; unit 86.28392 -> 85.920815; src 0x154 base 0x16c insns 85/91; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportGetBlocks | 1 | derive content pointer from address-order index on both branches | 76.88926 -> 77.91275; unit 86.28392 -> 86.33372; src 0x424 base 0x4a8 insns 265/298; kept |
| libs/RVL_SDK/src/wad/wad | WADImportGetBlocks | 2 | accumulate rounded content blocks before inode stores | 77.91275 -> 83.90604; unit 86.33372 -> 86.625305; src 0x424 base 0x4a8 insns 265/298; kept |
| libs/RVL_SDK/src/wad/wad | WADImportGetBlocks | 3 | use positive selected-content bound and direct file header address | 83.90604 -> 83.95637; unit 86.625305 -> 86.627754; src 0x424 base 0x4a8 insns 265/298; kept |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetFiles | 1 | initialize directory count immediately before the API output call | 96.01893 -> 95.70347; unit 86.627754 -> 86.61143; src 0x4f8 base 0x4f4 insns 318/317; reverted |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetFiles | 2 | declare result before path and count locals to align frame slots | 96.01893 -> 96.22398; unit 86.627754 -> 86.63837; src 0x4f4 base 0x4f4 insns 317/317; kept |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetFiles | 3 | advance output file and count in target store order | 96.22398 -> 95.62460; unit 86.63837 -> 86.607346; src 0x4f4 base 0x4f4 insns 317/317; reverted |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetSize | 1 | limit ES result lifetime and return successful status directly | 86.77419 -> 87.80645; unit 86.63837 -> 86.66449; src 0x280 base 0x26c insns 160/155; kept |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetSize | 2 | put content index on left side of target bounds comparison | 87.80645 -> 87.90323; unit 86.66449 -> 86.66694; src 0x280 base 0x26c insns 160/155; kept |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetSize | 3 | iterate backup file pointer instead of indexing the file array | 87.90323 -> 85.54839; unit 86.66694 -> 86.607346; src 0x274 base 0x26c insns 157/155; reverted |
| libs/RVL_SDK/src/wad/wad | _WADHash | 1 | initialize status after alignment validation before hash loops | 88.89175 -> 92.34021; unit 86.66694 -> 86.77616; src 0x304 base 0x308 insns 193/194; kept |
| libs/RVL_SDK/src/wad/wad | _WADHash | 2 | declare status before inout read pointer for target frame slots | 92.34021 -> 92.42268; unit 86.77616 -> 86.77878; src 0x304 base 0x308 insns 193/194; kept |
| libs/RVL_SDK/src/wad/wad | _WADHash | 3 | use conditional minimum in synchronous and asynchronous read blocks | 92.42268 -> 96.08247; unit 86.77878 -> 86.89469; src 0x304 base 0x308 insns 193/194; kept |
| libs/RVL_SDK/src/wad/wad | WADVerify | 1 | preserve allocation ownership separately from stream inout pointer | 86.86395 -> 89.21769; unit 86.89469 -> 86.95119; src 0x21c base 0x24c insns 135/147; kept |
| libs/RVL_SDK/src/wad/wad | WADVerify | 2 | declare signature offset before result to align scalar lifetimes | 89.21769 -> 89.21769; unit 86.95119 -> 86.95119; src 0x21c base 0x24c insns 135/147; reverted |
| libs/RVL_SDK/src/wad/wad | WADVerify | 3 | flatten hash and signature rejection blocks to target cleanup branches | 89.21769 -> 89.21769; unit 86.95119 -> 86.95119; src 0x21c base 0x24c insns 135/147; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportDVDExForBS | 1 | keep successful header classification out of import status | 89.33079 -> 89.63879; unit 86.95119 -> 86.96441; src 0x40c base 0x41c insns 259/263; kept |
| libs/RVL_SDK/src/wad/wad | WADImportDVDExForBS | 2 | delay content buffer derivation until after capacity validation | 89.63879 -> 89.04182; unit 86.96441 -> 86.938774; src 0x40c base 0x41c insns 259/263; reverted |
| libs/RVL_SDK/src/wad/wad | WADImportDVDExForBS | 3 | use target bounded chunk expression for DVD content reads | 89.63879 -> 89.79088; unit 86.96441 -> 86.97094; src 0x410 base 0x41c insns 260/263; kept |
| libs/RVL_SDK/src/wad/wad | _WADGetCidx | 4 | advance selected mask index once per unrolled block as target asm | 99.14286 -> 92.89286; unit 86.97094 -> 86.913795; src 0xe0 base 0xe0 insns 56/56; reverted |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 4 | return successful status through common switch exit for NAND read | 98.33991 -> 98.38916; unit 86.97094 -> 86.97257; src 0x330 base 0x32c insns 204/203; kept |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 5 | translate DVD open rejection as sequential early returns | 98.38916 -> 97.41379; unit 86.97257 -> 86.94025; src 0x328 base 0x32c insns 202/203; reverted |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 6 | align read-size comparison operand order in zero-fill loop | 98.38916 -> 98.33991; unit 86.97257 -> 86.97094; src 0x330 base 0x32c insns 204/203; reverted |
Source review: the BS2StartGame empty-poll variant was restored because MWCC hoisted the completion load. The _WADBackupGetSize local-result transformation accidentally changed its ES failure return; that return is restored and all final measurements are regenerated after the correction.
Source review: read_kpad_stick now loads dataFormat in both device branches. The earlier retained branch-local experiment missed the classic-controller assignment; its old measurements are superseded by the final gate.
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 7 | preserve zero NAND open result through direct read-path return | 98.38916 -> 98.85714; unit 86.9889 -> 87.00441; src 0x32c base 0x32c insns 203/203; kept |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 8 | spell DVD success after rejection to preserve target branch direction | 98.85714 -> 98.89162; unit 87.00441 -> 87.005554; src 0x32c base 0x32c insns 203/203; kept |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 9 | branch to successful NAND seek return instead of conditional select | 98.89162 -> 98.89162; unit 87.005554 -> 87.005554; src 0x32c base 0x32c insns 203/203; reverted |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 10 | keep SD offset validation as nested seek block from target | 98.89162 -> 98.89162; unit 87.005554 -> 87.005554; src 0x32c base 0x32c insns 203/203; reverted |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 11 | name NAND write and SD seek results before bounded comparisons | compile failed |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 12 | compare target read status to zero directly at NAND cleanup | 98.89162 -> 98.84236; unit 87.005554 -> 87.00392; src 0x32c base 0x32c insns 203/203; reverted |

View File

@@ -0,0 +1,87 @@
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/BS2/BS2Mach] pool: IDENTICAL
[src/BS2/BS2Mach] objdiff: code 4052/16980 data 155504/158528 functions 21/29 fuzzy 84.6464 linked code 0
[src/BS2/BS2Mach] instruction-exact functions: 21/29
[src/BS2/BS2Mach] section .bss size 155232 match 100.0
[src/BS2/BS2Mach] section .data size 3024 match None
[src/BS2/BS2Mach] section .sbss size 240 match 100.0
[src/BS2/BS2Mach] section .sdata size 32 match 100.0
[src/BS2/BS2Mach] section .text size 16980 match 84.64641
[src/BS2/BS2Mach] below 100: Run 0.88372093
[src/BS2/BS2Mach] below 100: BS2StartGame 95.496185
[src/BS2/BS2Mach] below 100: BS2StartGCGame 98.24561
[src/BS2/BS2Mach] below 100: BS2NANDDivideCallback 85.03906
[src/BS2/BS2Mach] below 100: BS2NANDDivideReadAsync 60.31915
[src/BS2/BS2Mach] below 100: BS2NANDDivideWriteAsync 60.31915
[src/BS2/BS2Mach] below 100: CheckBS2CommandStatus 80.697044
[src/BS2/BS2Mach] below 100: BS2Tick 76.669075
[src/BS2/BS2Mach] baseline: code 4052/16980 data 155504 functions 21 fuzzy 83.7230
[libs/RVL_SDK/src/kpad/KPAD] pool: IDENTICAL
[libs/RVL_SDK/src/kpad/KPAD] objdiff: code 2404/13056 data 7712/8032 functions 14/29 fuzzy 84.0867 linked code 0
[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 14/29
[libs/RVL_SDK/src/kpad/KPAD] section .bss size 7680 match 100.0
[libs/RVL_SDK/src/kpad/KPAD] section .data size 88 match None
[libs/RVL_SDK/src/kpad/KPAD] section .sbss size 32 match 100.0
[libs/RVL_SDK/src/kpad/KPAD] section .sdata size 112 match 94.545456
[libs/RVL_SDK/src/kpad/KPAD] section .sdata2 size 120 match 85.71429
[libs/RVL_SDK/src/kpad/KPAD] section .text size 13056 match 84.0867
[libs/RVL_SDK/src/kpad/KPAD] below 100: reset_kpad 69.37607
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADGetProjectionPos 96.57895
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADSetSensorHeight 99.23077
[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_acc_horizon 96.9802
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_acc 66.565
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_2obj_first 76.18033
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_2obj_continue 89.391304
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_first 90.83486
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_continue 80.18279
[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_dpd_variable 80.024
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_dpd 73.54317
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_stick 97.24683
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADRead 83.57952
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADInit 72.46487
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADiSamplingCallback 89.3022
[libs/RVL_SDK/src/kpad/KPAD] baseline: code 2020/13056 data 7712 functions 13 fuzzy 82.4372
[src/BS2/BS2Update] pool: IDENTICAL
[src/BS2/BS2Update] objdiff: code 112/4052 data None/10488 functions 8/10 fuzzy 84.6150 linked code 0
[src/BS2/BS2Update] instruction-exact functions: 8/10
[src/BS2/BS2Update] section .bss size 9056 match 72.9682
[src/BS2/BS2Update] section .data size 1328 match None
[src/BS2/BS2Update] section .sbss size 80 match 78.947365
[src/BS2/BS2Update] section .sdata size 24 match 94.117645
[src/BS2/BS2Update] section .text size 4052 match 84.615005
[src/BS2/BS2Update] below 100: BS2UpdateInit 79.875
[src/BS2/BS2Update] below 100: UpdateThread 84.516975
[src/BS2/BS2Update] baseline: code 112/4052 data None functions 8 fuzzy 84.1994
[libs/RVL_SDK/src/wad/wad] pool: IDENTICAL
[libs/RVL_SDK/src/wad/wad] objdiff: code 7080/24500 data 64/528 functions 23/40 fuzzy 87.0056 linked code 0
[libs/RVL_SDK/src/wad/wad] instruction-exact functions: 23/40
[libs/RVL_SDK/src/wad/wad] section .data size 464 match 99.34924
[libs/RVL_SDK/src/wad/wad] section .sdata size 64 match 100.0
[libs/RVL_SDK/src/wad/wad] section .text size 24500 match 87.005554
[libs/RVL_SDK/src/wad/wad] below 100: WADImportGetBlocks 83.956375
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815BFFA8 97.17742
[libs/RVL_SDK/src/wad/wad] below 100: WADImportEx 72.73997
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815C1288 96.39344
[libs/RVL_SDK/src/wad/wad] below 100: WADBackupEx 68.567795
[libs/RVL_SDK/src/wad/wad] below 100: _WADCheckContents 96.70588
[libs/RVL_SDK/src/wad/wad] below 100: WADOpenStream 98.891624
[libs/RVL_SDK/src/wad/wad] below 100: _WADUnpackBackup 97.34513
[libs/RVL_SDK/src/wad/wad] below 100: _WADGetCidxCount 95.05
[libs/RVL_SDK/src/wad/wad] below 100: _WADGetCidx 99.14286
[libs/RVL_SDK/src/wad/wad] below 100: _WADBackupGetFiles 96.223976
[libs/RVL_SDK/src/wad/wad] below 100: _WADBackupGetSize 88.548386
[libs/RVL_SDK/src/wad/wad] below 100: _WADRandPad 93.78022
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815C43E0 97.17742
[libs/RVL_SDK/src/wad/wad] below 100: _WADHash 96.08247
[libs/RVL_SDK/src/wad/wad] below 100: WADVerify 89.21769
[libs/RVL_SDK/src/wad/wad] below 100: WADImportDVDExForBS 89.79088
[libs/RVL_SDK/src/wad/wad] baseline: code 7080/24500 data 64 functions 23 fuzzy 85.7037
regressions vs baseline: 0
global matched_code_percent: 84.60095 -> 84.61377
global fuzzy_match_percent: 97.98296 -> 98.00660
global complete_code_percent: 58.20100 -> 58.20100
global matched_data_percent: 90.32545 -> 90.32545
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS

View File

@@ -0,0 +1,162 @@
# BS2, KPAD, and WAD final matching report
Baseline: 94e6d862. Final full gate rebuilt all 43U objects from scratch. Matching only; configuration and link status were unchanged.
| Unit | Instruction exact before -> after | Code bytes before -> after | Data bytes before -> after | Fuzzy before -> after |
| --- | --- | --- | --- | --- |
| src/BS2/BS2Mach | 21 -> 21/29 | 4052 -> 4052/16980 | 155504 -> 155504/158528 | 83.72297 -> 84.64641 |
| libs/RVL_SDK/src/kpad/KPAD | 13 -> 14/29 | 2020 -> 2404/13056 | 7712 -> 7712/8032 | 82.43720 -> 84.08670 |
| src/BS2/BS2Update | 8 -> 8/10 | 112 -> 112/4052 | 0 -> 0/10488 | 84.19941 -> 84.61500 |
| libs/RVL_SDK/src/wad/wad | 23 -> 23/40 | 7080 -> 7080/24500 | 64 -> 64/528 | 85.70367 -> 87.00555 |
## New exact function
```text
libs/RVL_SDK/src/kpad/KPAD: get_ring_buffer_by_kpad1_style
src 0x180 base 0x180 insns 96/96
diffs 0: []
```
## Remaining functions
| Unit | Function | Objdiff | Compiling attempts | Remaining evidence |
| --- | --- | --- | --- | --- |
| src/BS2/BS2Mach | Run | 0.88372% | 3 | original register and stack reset cannot be expressed by this C call; instruction/block structure remains: 30/43 instructions |
| src/BS2/BS2Mach | BS2StartGame | 95.49618% | 3 | completion reload and time-multiply scheduling; empty-poll candidate rejected; instruction/block structure remains: 401/393 instructions |
| src/BS2/BS2Mach | BS2StartGCGame | 98.24561% | 3 | completion reload and startup sequencing; instruction/block structure remains: 227/228 instructions |
| src/BS2/BS2Mach | BS2NANDDivideCallback | 85.03906% | 3 | IPA eliminates target global reloads around empty report calls; instruction/block structure remains: 119/128 instructions |
| src/BS2/BS2Mach | BS2NANDDivideReadAsync | 60.31915% | 3 | IPA eliminates target global reloads around empty report calls; instruction/block structure remains: 45/47 instructions |
| src/BS2/BS2Mach | BS2NANDDivideWriteAsync | 60.31915% | 3 | IPA eliminates target global reloads around empty report calls; instruction/block structure remains: 45/47 instructions |
| src/BS2/BS2Mach | CheckBS2CommandStatus | 80.69704% | 3 | instruction/block structure remains: 388/406 instructions |
| src/BS2/BS2Mach | BS2Tick | 76.66908% | 6 | instruction/block structure remains: 1902/1940 instructions |
| libs/RVL_SDK/src/kpad/KPAD | reset_kpad | 69.37607% | 3 | instruction/block structure remains: 126/117 instructions |
| libs/RVL_SDK/src/kpad/KPAD | KPADGetProjectionPos | 96.57895% | 5 | register/operand assignment; 9 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | KPADSetSensorHeight | 99.23077% | 3 | register/operand assignment; 7 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | calc_acc_horizon | 96.98020% | 5 | instruction ordering, branch layout or operands; 39 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_acc | 66.56500% | 4 | instruction ordering, branch layout or operands; 381 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_first | 76.18033% | 3 | instruction/block structure remains: 125/122 instructions |
| libs/RVL_SDK/src/kpad/KPAD | select_2obj_continue | 89.39130% | 3 | instruction/block structure remains: 139/138 instructions |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_first | 90.83486% | 3 | instruction ordering, branch layout or operands; 50 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | select_1obj_continue | 80.18279% | 3 | instruction/block structure remains: 95/93 instructions |
| libs/RVL_SDK/src/kpad/KPAD | calc_dpd_variable | 80.02400% | 3 | instruction/block structure remains: 239/250 instructions |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_dpd | 73.54317% | 3 | instruction/block structure remains: 281/278 instructions |
| libs/RVL_SDK/src/kpad/KPAD | read_kpad_stick | 97.24683% | 3 | instruction ordering, branch layout or operands; 20 differing instructions |
| libs/RVL_SDK/src/kpad/KPAD | KPADRead | 83.57952% | 3 | instruction/block structure remains: 471/459 instructions |
| libs/RVL_SDK/src/kpad/KPAD | KPADInit | 72.46487% | 3 | instruction/block structure remains: 200/185 instructions |
| libs/RVL_SDK/src/kpad/KPAD | KPADiSamplingCallback | 89.30220% | 3 | instruction ordering, branch layout or operands; 108 differing instructions |
| src/BS2/BS2Update | BS2UpdateInit | 79.87500% | 3 | instruction/block structure remains: 71/72 instructions |
| src/BS2/BS2Update | UpdateThread | 84.51698% | 5 | instruction/block structure remains: 860/913 instructions |
| libs/RVL_SDK/src/wad/wad | WADImportGetBlocks | 83.95637% | 3 | instruction/block structure remains: 265/298 instructions |
| libs/RVL_SDK/src/wad/wad | WAD_815BFFA8 | 97.17742% | 3 | register/operand assignment; 30 differing instructions |
| libs/RVL_SDK/src/wad/wad | WADImportEx | 72.73997% | 3 | instruction/block structure remains: 1131/1146 instructions |
| libs/RVL_SDK/src/wad/wad | WAD_815C1288 | 96.39344% | 3 | register/operand assignment; 34 differing instructions |
| libs/RVL_SDK/src/wad/wad | WADBackupEx | 68.56780% | 3 | instruction/block structure remains: 906/1062 instructions |
| libs/RVL_SDK/src/wad/wad | _WADCheckContents | 96.70588% | 3 | instruction ordering, branch layout or operands; 19 differing instructions |
| libs/RVL_SDK/src/wad/wad | WADOpenStream | 98.89162% | 11 | instruction ordering, branch layout or operands; 30 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADUnpackBackup | 97.34513% | 3 | instruction ordering, branch layout or operands; 12 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADGetCidxCount | 95.05000% | 3 | instruction ordering, branch layout or operands; 25 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADGetCidx | 99.14286% | 4 | instruction ordering, branch layout or operands; 8 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetFiles | 96.22398% | 3 | instruction ordering, branch layout or operands; 89 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADBackupGetSize | 88.54839% | 3 | instruction/block structure remains: 159/155 instructions |
| libs/RVL_SDK/src/wad/wad | _WADRandPad | 93.78022% | 3 | instruction/block structure remains: 89/91 instructions |
| libs/RVL_SDK/src/wad/wad | WAD_815C43E0 | 97.17742% | 3 | register/operand assignment; 30 differing instructions |
| libs/RVL_SDK/src/wad/wad | _WADHash | 96.08247% | 3 | instruction/block structure remains: 193/194 instructions |
| libs/RVL_SDK/src/wad/wad | WADVerify | 89.21769% | 3 | original contains two dormant cleanup paths; dummy allocations were not introduced; instruction/block structure remains: 135/147 instructions |
| libs/RVL_SDK/src/wad/wad | WADImportDVDExForBS | 89.79088% | 3 | instruction/block structure remains: 260/263 instructions |
## Limits
Three units gained fuzzy accuracy without increasing their instruction-exact counts. The exact-count increase requirement is achieved for KPAD only. The full gate passes; this is partial matching progress. No touched unit is fully matched or linked. KPAD lacks a source .data section: pool_diff was attempted first, and the gate string-pool comparison was used when pool_diff raised KeyError. The final gate verifies every touched pool, all baseline exact functions, zero regressions, the forbidden-pattern scan and the DOL hash.
## Final full gate
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/BS2/BS2Mach] pool: IDENTICAL
[src/BS2/BS2Mach] objdiff: code 4052/16980 data 155504/158528 functions 21/29 fuzzy 84.6464 linked code 0
[src/BS2/BS2Mach] instruction-exact functions: 21/29
[src/BS2/BS2Mach] section .bss size 155232 match 100.0
[src/BS2/BS2Mach] section .data size 3024 match None
[src/BS2/BS2Mach] section .sbss size 240 match 100.0
[src/BS2/BS2Mach] section .sdata size 32 match 100.0
[src/BS2/BS2Mach] section .text size 16980 match 84.64641
[src/BS2/BS2Mach] below 100: Run 0.88372093
[src/BS2/BS2Mach] below 100: BS2StartGame 95.496185
[src/BS2/BS2Mach] below 100: BS2StartGCGame 98.24561
[src/BS2/BS2Mach] below 100: BS2NANDDivideCallback 85.03906
[src/BS2/BS2Mach] below 100: BS2NANDDivideReadAsync 60.31915
[src/BS2/BS2Mach] below 100: BS2NANDDivideWriteAsync 60.31915
[src/BS2/BS2Mach] below 100: CheckBS2CommandStatus 80.697044
[src/BS2/BS2Mach] below 100: BS2Tick 76.669075
[src/BS2/BS2Mach] baseline: code 4052/16980 data 155504 functions 21 fuzzy 83.7230
[libs/RVL_SDK/src/kpad/KPAD] pool: IDENTICAL
[libs/RVL_SDK/src/kpad/KPAD] objdiff: code 2404/13056 data 7712/8032 functions 14/29 fuzzy 84.0867 linked code 0
[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 14/29
[libs/RVL_SDK/src/kpad/KPAD] section .bss size 7680 match 100.0
[libs/RVL_SDK/src/kpad/KPAD] section .data size 88 match None
[libs/RVL_SDK/src/kpad/KPAD] section .sbss size 32 match 100.0
[libs/RVL_SDK/src/kpad/KPAD] section .sdata size 112 match 94.545456
[libs/RVL_SDK/src/kpad/KPAD] section .sdata2 size 120 match 85.71429
[libs/RVL_SDK/src/kpad/KPAD] section .text size 13056 match 84.0867
[libs/RVL_SDK/src/kpad/KPAD] below 100: reset_kpad 69.37607
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADGetProjectionPos 96.57895
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADSetSensorHeight 99.23077
[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_acc_horizon 96.9802
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_acc 66.565
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_2obj_first 76.18033
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_2obj_continue 89.391304
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_first 90.83486
[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_continue 80.18279
[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_dpd_variable 80.024
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_dpd 73.54317
[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_stick 97.24683
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADRead 83.57952
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADInit 72.46487
[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADiSamplingCallback 89.3022
[libs/RVL_SDK/src/kpad/KPAD] baseline: code 2020/13056 data 7712 functions 13 fuzzy 82.4372
[src/BS2/BS2Update] pool: IDENTICAL
[src/BS2/BS2Update] objdiff: code 112/4052 data None/10488 functions 8/10 fuzzy 84.6150 linked code 0
[src/BS2/BS2Update] instruction-exact functions: 8/10
[src/BS2/BS2Update] section .bss size 9056 match 72.9682
[src/BS2/BS2Update] section .data size 1328 match None
[src/BS2/BS2Update] section .sbss size 80 match 78.947365
[src/BS2/BS2Update] section .sdata size 24 match 94.117645
[src/BS2/BS2Update] section .text size 4052 match 84.615005
[src/BS2/BS2Update] below 100: BS2UpdateInit 79.875
[src/BS2/BS2Update] below 100: UpdateThread 84.516975
[src/BS2/BS2Update] baseline: code 112/4052 data None functions 8 fuzzy 84.1994
[libs/RVL_SDK/src/wad/wad] pool: IDENTICAL
[libs/RVL_SDK/src/wad/wad] objdiff: code 7080/24500 data 64/528 functions 23/40 fuzzy 87.0056 linked code 0
[libs/RVL_SDK/src/wad/wad] instruction-exact functions: 23/40
[libs/RVL_SDK/src/wad/wad] section .data size 464 match 99.34924
[libs/RVL_SDK/src/wad/wad] section .sdata size 64 match 100.0
[libs/RVL_SDK/src/wad/wad] section .text size 24500 match 87.005554
[libs/RVL_SDK/src/wad/wad] below 100: WADImportGetBlocks 83.956375
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815BFFA8 97.17742
[libs/RVL_SDK/src/wad/wad] below 100: WADImportEx 72.73997
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815C1288 96.39344
[libs/RVL_SDK/src/wad/wad] below 100: WADBackupEx 68.567795
[libs/RVL_SDK/src/wad/wad] below 100: _WADCheckContents 96.70588
[libs/RVL_SDK/src/wad/wad] below 100: WADOpenStream 98.891624
[libs/RVL_SDK/src/wad/wad] below 100: _WADUnpackBackup 97.34513
[libs/RVL_SDK/src/wad/wad] below 100: _WADGetCidxCount 95.05
[libs/RVL_SDK/src/wad/wad] below 100: _WADGetCidx 99.14286
[libs/RVL_SDK/src/wad/wad] below 100: _WADBackupGetFiles 96.223976
[libs/RVL_SDK/src/wad/wad] below 100: _WADBackupGetSize 88.548386
[libs/RVL_SDK/src/wad/wad] below 100: _WADRandPad 93.78022
[libs/RVL_SDK/src/wad/wad] below 100: WAD_815C43E0 97.17742
[libs/RVL_SDK/src/wad/wad] below 100: _WADHash 96.08247
[libs/RVL_SDK/src/wad/wad] below 100: WADVerify 89.21769
[libs/RVL_SDK/src/wad/wad] below 100: WADImportDVDExForBS 89.79088
[libs/RVL_SDK/src/wad/wad] baseline: code 7080/24500 data 64 functions 23 fuzzy 85.7037
regressions vs baseline: 0
global matched_code_percent: 84.60095 -> 84.61377
global fuzzy_match_percent: 97.98296 -> 98.00660
global complete_code_percent: 58.20100 -> 58.20100
global matched_data_percent: 90.32545 -> 90.32545
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```