Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
v3.1
Browse files Browse the repository at this point in the history
removed the delay option, cleaned the code up a bit
  • Loading branch information
SKGleba committed Oct 14, 2019
1 parent 296bf0e commit 59463cc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 72 deletions.
30 changes: 16 additions & 14 deletions plugin/kernel/main.c
Expand Up @@ -148,7 +148,7 @@ static int livebanimthread(SceSize args, void *argp) {
ksceIoRead(fd, flags, sizeof(flags));
uid = ksceKernelAllocMemBlock("SceDisplay", 0x6020D006, 0x200000, &optp);
ksceKernelGetMemBlockBase(uid, (void**)&fb_addr);
ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
memset(fb_addr, 0, 0x1FE000);
yid = ksceKernelAllocMemBlock("temp_anim", SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RW, 0x200000, NULL);
ksceKernelGetMemBlockBase(yid, (void**)&gz_addr);
ksceIoLseek(fd, 0, 0);
Expand Down Expand Up @@ -246,6 +246,7 @@ static int LoadBootlogoSingle(void) {
ksceIoGetstat("ur0:tai/boot_splash.img", &stat);
uid = ksceKernelAllocMemBlock("SceDisplay", 0x6020D006, 0x200000, &optp);
ksceKernelGetMemBlockBase(uid, (void**)&fb_addr);
memset(fb_addr, 0, 0x1FE000);
if (stat.st_size < 0x1FE000) {
yid = ksceKernelAllocMemBlock("gz", SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RW, 0x200000, NULL);
ksceKernelGetMemBlockBase(yid, (void**)&gz_addr);
Expand All @@ -256,7 +257,6 @@ static int LoadBootlogoSingle(void) {
ksceIoRead(fd, (void *)fb_addr, 0x1FE000);
}
ksceIoClose(fd);
ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
fb.size = sizeof(fb);
fb.base = fb_addr;
fb.pitch = 960;
Expand Down Expand Up @@ -295,7 +295,7 @@ static int banimthread(SceSize args, void *argp) {
ksceIoRead(fd, flags, sizeof(flags));
uid = ksceKernelAllocMemBlock("SceDisplay", 0x6020D006, 0x200000, &optp);
ksceKernelGetMemBlockBase(uid, (void**)&fb_addr);
ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
memset(fb_addr, 0, 0x1FE000);
fb.base = fb_addr;
ksceDisplaySetFrameBuf(&fb, 1);
if (stat.st_size < 0x200000 && flags[2] == 0) { // optimized for small anims, copy to mem, then loop
Expand All @@ -319,7 +319,10 @@ static int banimthread(SceSize args, void *argp) {
curpos = curpos + sizeof(rsz);
ksceGzipDecompress((void *)fb_addr, 0x1FE000, (void *)(gz_addr + curpos), NULL);
curpos = curpos + csz;
if (flags[3] > 0) ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
if (flags[3] > 0) {
ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
memset(fb_addr, 0, 0x1FE000);
}
ksceDisplayWaitVblankStart();
cur++;
}
Expand Down Expand Up @@ -351,7 +354,10 @@ static int banimthread(SceSize args, void *argp) {
} else {
ksceIoRead(fd, fb_addr, csz);
}
if (flags[3] > 0) ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
if (flags[3] > 0) {
ksceKernelCpuDcacheAndL2WritebackInvalidateRange(fb_addr, 0x1FE000);
memset(fb_addr, 0, 0x1FE000);
}
ksceDisplayWaitVblankStart();
cur++;
}
Expand All @@ -361,21 +367,19 @@ static int banimthread(SceSize args, void *argp) {
ksceKernelExitDeleteThread(0);
return 1;
}

void _start() __attribute__ ((weak, alias ("module_start")));
int module_start(SceSize argc, const void *args){

static char uwu[4] = {0x30, 0x30, 0x30, 0}; // IMGTYPE, ION, DELAY, DELAYTIMESEC
static char uwu[4] = {0x30, 0x30, 0x30, 0x30}; // IMGTYPE, MAGIC1, MAGIC2, VER
SceUID fd = ksceIoOpen("ur0:tai/cbs_cfg.bin", SCE_O_RDONLY, 0);
if (fd < 0)
return SCE_KERNEL_START_FAILED;
ksceIoRead(fd, uwu, 4);
ksceIoClose(fd);

if (uwu[1] != 0x31)
return SCE_KERNEL_START_FAILED;

if (uwu[0] == 0x31 && ex("ur0:tai/boot_splash.img") == 1) {
if (uwu[0] == 0x30 || uwu[1] != 0x3C || uwu[2] != 0x3B || uwu[3] != 0x33) {
return SCE_KERNEL_START_SUCCESS;
} else if (uwu[0] == 0x31 && ex("ur0:tai/boot_splash.img") == 1) {
LoadBootlogoSingle();
} else if (uwu[0] == 0x32 && ex("ur0:tai/boot_animation.img") == 1) {
SceUID athid = ksceKernelCreateThread("b", banimthread, 0x00, 0x1000, 0, 0, 0);
Expand All @@ -384,8 +388,6 @@ int module_start(SceSize argc, const void *args){
SceUID bthid = ksceKernelCreateThread("l", livebanimthread, 0x00, 0x1000, 0, 0, 0);
ksceKernelStartThread(bthid, 0, NULL);
}

if (uwu[2] == 0x31) ksceKernelDelayThread(uwu[3] * 1000 * 1000);

return SCE_KERNEL_START_SUCCESS;
}
Expand Down
34 changes: 8 additions & 26 deletions plugin/user/theme_settings.xml
Expand Up @@ -9,32 +9,14 @@
<user_custom id="user_custom_custom_themes"/>
</setting_list>

<setting_list id="id_cbsm"
title=" Boot Screen">
<toggle_switch id="enable_cbsm"
key="/CONFIG/CBSM/ion"
title="Use CBS-M"
description="Enables the CBS-M plugin"
icon="tex_spanner"/>
<list id="id_cbsm_imgt"
key="/CONFIG/CBSM/imgt"
title="Boot Image Type">
<list_item id="id_cbsm_imgt_static" title="Static Image" value="1"/>
<list_item id="id_cbsm_imgt_anim" title="Animation" value="2"/>
<list_item id="id_cbsm_imgt_info" title="Console Info" value="3"/>
</list>
<toggle_switch id="dfl"
key="/CONFIG/CBSM/dfl"
title="Delay boot"/>
<list id="id_cbsm_dtime"
key="/CONFIG/CBSM/deltime"
title="Delay duration">
<list_item id="id_cbsm_dtime_5" title="5s" value="5"/>
<list_item id="id_cbsm_dtime_10" title="10s" value="10"/>
<list_item id="id_cbsm_dtime_15" title="15s" value="15"/>
<list_item id="id_cbsm_dtime_20" title="20s" value="20"/>
</list>
</setting_list>
<list id="id_cbsm_imgt"
key="/CONFIG/CBSM/imgt"
title=" Boot Screen">
<list_item id="id_cbsm_imgt_disabled" title="Default" value="0"/>
<list_item id="id_cbsm_imgt_static" title="Static Image" value="1"/>
<list_item id="id_cbsm_imgt_anim" title="Animation" value="2"/>
<list_item id="id_cbsm_imgt_info" title="Console Info" value="3"/>
</list>

<!-- スタート画面 -->
<setting_list id="setting_list_start_screen" title="msg_start_screen">
Expand Down
39 changes: 7 additions & 32 deletions plugin/user/user.c
Expand Up @@ -10,21 +10,7 @@

#define CONFIG_PATH "ur0:tai/cbs_cfg.bin"

#define LOG(...) \
do { \
char buffer[256]; \
sceClibSnprintf(buffer, sizeof(buffer), ##__VA_ARGS__); \
logg(buffer, sceClibStrnlen(buffer, sizeof(buffer)), "ur0:temp/xmldmp.raw", 2); \
} while (0)

#define LOG_START(...) \
do { \
char buffer[256]; \
sceClibSnprintf(buffer, sizeof(buffer), ##__VA_ARGS__); \
logg(buffer, sceClibStrnlen(buffer, sizeof(buffer)), "ur0:temp/xmldmp.raw", 1); \
} while (0)

static char cfg[4] = {0x30, 0x30, 0x30, 0}; // IMGTYPE, ION, DELAY, DELAYTIMESEC
static char cfg[4] = {0x30, 0x3C, 0x3B, 0x33}; // IMGTYPE, ION, DELAY, DELAYTIMESEC

extern unsigned char _binary_theme_settings_xml_start;
extern unsigned char _binary_theme_settings_xml_size;
Expand Down Expand Up @@ -64,6 +50,10 @@ static int load_config_user(void) {
if (fd >= 0) {
sceIoRead(fd, &cfg, sizeof(cfg));
sceIoClose(fd);
if (cfg[3] != 0x33) {
cfg[0] = 0x30, cfg[1] = 0x3C, cfg[2] = 0x3B, cfg[3] = 0x33;
save_config_user();
}
return 0;
}
save_config_user();
Expand All @@ -75,15 +65,8 @@ static int sceRegMgrGetKeyInt_SceSystemSettingsCore_patched(const char *category
if (sceClibStrncmp(category, "/CONFIG/CBSM", 12) == 0) {
if (value) {
load_config_user();
if (sceClibStrncmp(name, "imgt", 4) == 0) {
if (sceClibStrncmp(name, "imgt", 4) == 0)
*value = (cfg[0] - 0x30);
} else if (sceClibStrncmp(name, "ion", 3) == 0) {
*value = (cfg[1] - 0x30);
} else if (sceClibStrncmp(name, "dfl", 3) == 0) {
*value = (cfg[2] - 0x30);
} else if (sceClibStrncmp(name, "deltime", 7) == 0) {
*value = cfg[3];
}
}
return 0;
}
Expand All @@ -93,15 +76,8 @@ static int sceRegMgrGetKeyInt_SceSystemSettingsCore_patched(const char *category
static tai_hook_ref_t g_sceRegMgrSetKeyInt_SceSystemSettingsCore_hook;
static int sceRegMgrSetKeyInt_SceSystemSettingsCore_patched(const char *category, const char *name, int value) {
if (sceClibStrncmp(category, "/CONFIG/CBSM", 12) == 0) {
if (sceClibStrncmp(name, "imgt", 4) == 0) {
if (sceClibStrncmp(name, "imgt", 4) == 0)
cfg[0] = (value + 0x30);
} else if (sceClibStrncmp(name, "ion", 3) == 0) {
cfg[1] = (value + 0x30);
} else if (sceClibStrncmp(name, "dfl", 3) == 0) {
cfg[2] = (value + 0x30);
} else if (sceClibStrncmp(name, "deltime", 7) == 0) {
cfg[3] = value;
}
save_config_user();
return 0;
}
Expand Down Expand Up @@ -179,7 +155,6 @@ static int sceKernelStopUnloadModule_SceSettings_patched(SceUID modid, SceSize a

void _start() __attribute__ ((weak, alias ("module_start")));
int module_start(SceSize argc, const void *args) {
LOG_START("started");
sceClibMemset(&cfg, 0, sizeof(cfg));
load_config_user();
g_hooks[0] = taiHookFunctionImport(&g_sceKernelLoadStartModule_SceSettings_hook,
Expand Down

0 comments on commit 59463cc

Please sign in to comment.