Further TLB fix

Imagine testing 2 segments and having them work perfectly fine, and then you go for the third, and it somehow doesn't work, because clearly you can't trust a system that loads 3 things in a row to just map it to the first 3 :^)
So guess we have a mapping segment table now to track it.
This commit is contained in:
Fazana committed 2021-08-23 14:06:27 +01:00
1 parent bc1fac4b9e
commit bc903a73fc
3 files changed
+15 -4

No files matched your search

+10 -3
View File
@@ -314,15 +314,22 @@ static void level_cmd_init_level(void) {
}
extern s32 gTlbEntries;
extern u8 gTlbSegments[32];
//This clears all the temporary bank TLB maps. group0, common1 and behavourdata are always loaded,
//and they're also loaded first, so that means we just leave the first 3 indexes mapped.
void unmap_tlbs(void)
{
while (gTlbEntries > 3)
s32 i;
for (i = 0; i < 32; i++)
{
osUnmapTLB(gTlbEntries);
gTlbEntries--;
if (gTlbSegments[i] && i != 0x17 && i != 0x16 && i != 0x13)
{
osUnmapTLB(gTlbEntries);
gTlbSegments[i] = 0;
gTlbEntries--;
}
}
}