Fixed oob crashes on 64 bit

This commit is contained in:
Kevin Alexis Contreras 2022-05-31 00:29:14 -05:00
parent fa21734a98
commit 22a305028f
3 changed files with 7 additions and 4 deletions

View File

@ -183,7 +183,7 @@ void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
* The different icons are given in the MessageBoxIcon enum. * The different icons are given in the MessageBoxIcon enum.
*/ */
void Font_LoadMessageBoxIcon(Font* font, u16 icon) { void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
memcpy(font->iconBuf, msgStaticTbl[4 + icon], FONT_CHAR_TEX_SIZE); memcpy(font->iconBuf, ResourceMgr_LoadTexByName(msgStaticTbl[4 + icon]), FONT_CHAR_TEX_SIZE);
} }
/** /**

View File

@ -1106,16 +1106,18 @@ void Message_LoadItemIcon(GlobalContext* globalCtx, u16 itemId, s16 y) {
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language]; R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
R_TEXTBOX_ICON_YPOS = y + 6; R_TEXTBOX_ICON_YPOS = y + 6;
R_TEXTBOX_ICON_SIZE = 32; R_TEXTBOX_ICON_SIZE = 32;
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, gItemIcons[itemId], 0x1000); memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x1000);
// "Item 32-0" // "Item 32-0"
osSyncPrintf("アイテム32-0\n"); osSyncPrintf("アイテム32-0\n");
} else { } else {
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language]; R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language];
R_TEXTBOX_ICON_YPOS = y + 10; R_TEXTBOX_ICON_YPOS = y + 10;
R_TEXTBOX_ICON_SIZE = 24; R_TEXTBOX_ICON_SIZE = 24;
memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, gItemIcons[itemId], 0x900); memcpy((uintptr_t)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
ResourceMgr_LoadTexByName(gItemIcons[itemId]), 0x900);
// "Item 24" // "Item 24"
osSyncPrintf("アイテム24%d (%d) {%d}\n", itemId, itemId - ITEM_KOKIRI_EMERALD, 84); // osSyncPrintf("アイテム24%d (%d) {%d}\n", itemId, itemId - ITEM_KOKIRI_EMERALD, 84);
} }
msgCtx->msgBufPos++; msgCtx->msgBufPos++;
msgCtx->choiceNum = 1; msgCtx->choiceNum = 1;

View File

@ -326,6 +326,7 @@ void BossGoma_ClearPixels32x32Rgba16(s16* rgba16image, u8* clearPixelTable, s16
* Clear pixels from Gohma's textures * Clear pixels from Gohma's textures
*/ */
void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) { void BossGoma_ClearPixels(u8* clearPixelTable, s16 i) {
return;
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaBodyTex), clearPixelTable, i); BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaBodyTex), clearPixelTable, i);
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaShellUndersideTex), clearPixelTable, i); BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaShellUndersideTex), clearPixelTable, i);
BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaDarkShellTex), clearPixelTable, i); BossGoma_ClearPixels16x16Rgba16(SEGMENTED_TO_VIRTUAL(gGohmaDarkShellTex), clearPixelTable, i);