patches-src/optimize_theme_cache/patch.c
Philip Minakov 662ffd12d5
Add patches
2025-02-14 22:33:11 +04:00

34 lines
1 KiB
C

#include <swilib.h>
#ifdef NEWSGOLD
#ifdef E71_45
#include "E71_45.h"
#endif
#endif
#define _wstrlen ((size_t (*)(const WSHDR *))(ADDR_wstrlen))
#define _GetIMGHDRFromThemeCache ((IMGHDR *(*)(int index))(ADDR_GetIMGHDRFromThemeCache))
__attribute__((target("thumb")))
__attribute__((section(".text.Hook_1")))
int Hook_1(const WSHDR *ws) {
register const unsigned int ***p asm ("r8");
const unsigned int *addr = **p;
if (addr == ADDR_background_picture_headline_fullscreen || addr == ADDR_background_picture_body_tab ||
addr == ADDR_background_picture_bottom_fullscreen || addr == ADDR_statusbar_fullscreen) {
return 0;
}
return _wstrlen(ws);
}
__attribute__((target("thumb")))
__attribute__((section(".text.Hook_2")))
IMGHDR *Hook_2(int index) {
if (index == HEADLINE_FULLSCREEN || index == BODY_TAB ||
index == BOTTOM_FULLSCREEN || index == STATUSBAR_FULLSCREEN) {
return NULL;
}
MENUITEM_DESC
return _GetIMGHDRFromThemeCache(index);
}