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

Commit

Permalink
v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SKGleba committed Oct 14, 2019
1 parent 9aa9fb0 commit 296bf0e
Show file tree
Hide file tree
Showing 17 changed files with 1,193 additions and 918 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Expand Up @@ -50,6 +50,8 @@ vita_create_self(${SHORT_NAME}.self ${SHORT_NAME} UNSAFE)
vita_create_vpk(${SHORT_NAME}.vpk ${VITA_TITLEID} ${SHORT_NAME}.self
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE ${CMAKE_BINARY_DIR}/plugin/cbs.skprx cbs.skprx
FILE ${CMAKE_BINARY_DIR}/plugin/user/cbsm.suprx cbsm.suprx
FILE ${CMAKE_BINARY_DIR}/plugin/kernel/cbsm.skprx cbsm.skprx
FILE ${CMAKE_SOURCE_DIR}/banim.xgif banim.xgif
FILE ${CMAKE_SOURCE_DIR}/lbanim.xgif lbanim.xgif
)
674 changes: 0 additions & 674 deletions LICENSE

This file was deleted.

29 changes: 17 additions & 12 deletions README.md
@@ -1,5 +1,5 @@
# CBS
This tool can display a Image/Animation during the PSVita boot process.<br>
# CBS-Manager
This tool can display an Image/Animation/Console Info during the PSVita boot process.<br>
<br>
The boot logo that is displayed at the beginning can not be hidden with this plugin. Use https://github.com/skgleba/enso_ex instead.<br>
<br>
Expand All @@ -9,14 +9,19 @@ If Enso 3.65-update365 is installed and boot_config.txt exists in vs0:tai/ CBS w
https://github.com/TheOfficialFloW/enso/releases<br>
<br>

# Functions usage
- BootLogo:
- location: ur0:tai/boot_splash.img
- file format: raw (rgba) or gzipped raw (rgba) 960x544 image.
- BootAnimation:
- location: ur0:tai/boot_animation.img
- file format: custom (see https://github.com/SKGleba/enso_ex/tree/master/cbanim).
- Delay (5/10/15 sec) - delay at boot, useful to test out the animation.
# Setting up CBS-M
1) Download and install the VPK, if you have an older version of CBS/CBS-M please remove/uninstall it first.
2) Open the newly installed app, it will install CBSM to enso's boot_config and taihen's config.txt.
3) Reboot
4) Go to Settings->Theme & Background, there should be a new entry: "Boot Screen". That's it!

# Notes
- This is a mod/extension of https://github.com/Princess-of-Sleeping/PSP2-CustomBootSplash, all credits go to PrincessOfSleeping for their awesome tool.
# Usage
- Use https://github.com/SKGleba/PSP2-CBAnim to create a CBSM-compatible static image/animation file.
- "Static image" should be a RGBA raw or gzipped image, put it in "ur0:tai/boot_splash.img"
- "Animation" is a custom file format generated by CBANIM, put it in "ur0:tai/boot_animation.img"
- "Console info" also supports a 960x128 animation, custom file format generated by CBANIM, put it in "ur0:tai/lboot_animation.img"

# Credits
- PrincessOfSleeping for the original CBS
- Team Molecule for henkaku and enso.
- Dots-Tb for the kernel blit
8 changes: 0 additions & 8 deletions exports.yml

This file was deleted.

Binary file added lbanim.xgif
Binary file not shown.
23 changes: 17 additions & 6 deletions plugin/CMakeLists.txt → plugin/kernel/CMakeLists.txt
Expand Up @@ -8,27 +8,38 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()
endif()

project(custom_boot_splash)
project(cbsm)
include("${VITASDK}/share/vita.cmake" REQUIRED)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -nostdlib")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions")

add_executable(custom_boot_splash
add_executable(cbsm
main.c
blit.c
font.c
)

target_link_libraries(custom_boot_splash
target_link_libraries(cbsm
SceSysmemForDriver_stub
SceSysrootForDriver_stub
SceKernelUtilsForDriver_stub
SceCpuForDriver_stub
SceThreadmgrForDriver_stub
SceIofilemgrForDriver_stub
SceDisplayForDriver_stub
SceSysclibForDriver_stub
SceSysrootForKernel_stub
SceDipswForDriver_stub
k
gcc
)

vita_create_self(cbs.skprx custom_boot_splash
set_target_properties(cbsm
PROPERTIES LINK_FLAGS "-nostdlib"
)

vita_create_self(cbsm.skprx cbsm
CONFIG exports.yml
UNSELF
)
161 changes: 161 additions & 0 deletions plugin/kernel/blit.c
@@ -0,0 +1,161 @@
/*
PSP VSH 24bpp text bliter
*/
#include <libk/stdarg.h>
#include <libk/stdio.h>
#include <libk/string.h>


#include "blit.h"

#define ALPHA_BLEND 1

extern unsigned char msx[];

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
static int pwidth, pheight, bufferwidth, pixelformat;
static unsigned int* vram32;

static uint32_t fcolor = 0x00ffffff;
static uint32_t bcolor = 0xff000000;

#if ALPHA_BLEND
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
static uint32_t adjust_alpha(uint32_t col)
{
uint32_t alpha = col>>24;
uint8_t mul;
uint32_t c1,c2;

if(alpha==0) return col;
if(alpha==0xff) return col;

c1 = col & 0x00ff00ff;
c2 = col & 0x0000ff00;
mul = (uint8_t)(255-alpha);
c1 = ((c1*mul)>>8)&0x00ff00ff;
c2 = ((c2*mul)>>8)&0x0000ff00;
return (alpha<<24)|c1|c2;
}
#endif

#define printf ksceDebugPrintf

/////////////////////////////////////////////////////////////////////////////
// blit text
/////////////////////////////////////////////////////////////////////////////
void blit_set_color(int fg_col,int bg_col)
{
fcolor = fg_col;
bcolor = bg_col;
}

/////////////////////////////////////////////////////////////////////////////
// blit text
/////////////////////////////////////////////////////////////////////////////
int blit_string(int sx,int sy,const char *msg)
{
int x,y,p;
int offset;
char code;
unsigned char font;
uint32_t fg_col,bg_col;

#if ALPHA_BLEND
uint32_t col,c1,c2;
uint32_t alpha;

fg_col = adjust_alpha(fcolor);
bg_col = adjust_alpha(bcolor);
#else
fg_col = fcolor;
bg_col = bcolor;
#endif

//Kprintf("MODE %d WIDTH %d\n",pixelformat,bufferwidth);
if( (bufferwidth==0) || (pixelformat!=0)) return -1;

for(x=0;msg[x] && x<(pwidth/18);x++)
{
code = msg[x] & 0x7f; // 7bit ANK
for(y=0;y<8;y++)
{
offset = (sy+(y*2))*bufferwidth + sx+x*18;
font = y>=7 ? 0x00 : msx[ code*8 + y ];
for(p=0;p<8;p++)
{
#if ALPHA_BLEND
col = (font & 0x80) ? fg_col : bg_col;
alpha = col>>24;
if(alpha==0)
{
memcpy((void *)(&vram32[offset]), &col, sizeof(col));
memcpy((void *)(&vram32[offset + 1]), &col, sizeof(col));
memcpy((void *)(&vram32[offset + bufferwidth]), &col, sizeof(col));
memcpy((void *)(&vram32[offset + bufferwidth + 1]), &col, sizeof(col));
}
else if(alpha!=0xff)
{
memcpy(&c2, (void *)(vram32[offset]), sizeof(unsigned int));
c1 = c2 & 0x00ff00ff;
c2 = c2 & 0x0000ff00;
c1 = ((c1*alpha)>>8)&0x00ff00ff;
c2 = ((c2*alpha)>>8)&0x0000ff00;
uint32_t color = (col&0xffffff) + c1 + c2;
memcpy((void *)(vram32 + offset), &color, sizeof(uint32_t));
memcpy((void *)(vram32 + offset + 1), &color, sizeof(uint32_t));
memcpy((void *)(vram32 + offset + bufferwidth), &color, sizeof(uint32_t));
memcpy((void *)(vram32 + offset + bufferwidth + 1), &color, sizeof(uint32_t));

}
#else
uint32_t color = (font & 0x80) ? fg_col : bg_col;
memcpy((void *)(vram32 + offset + 1), &color, sizeof(uint32_t));
memcpy((void *)(vram32 + offset + bufferwidth), &color, sizeof(uint32_t));
memcpy((void *)(vram32 + offset + bufferwidth + 1), &color, sizeof(uint32_t));
#endif

font <<= 1;
offset+=2;
}
}
}
return x;
}

int blit_string_ctr(int sy,const char *msg)
{
int sx = (960 / 2) - (strlen(msg) * (18 / 2));
return blit_string(sx,sy,msg);
}

int blit_stringf(int sx, int sy, const char *msg, ...)
{
va_list list;
char string[512];

va_start(list, msg);
vsnprintf(string, 512, msg, list);
va_end(list);

return blit_string(sx, sy, string);
}

int blit_set_frame_buf(const SceDisplayFrameBuf *param)
{

pwidth = param->width;
pheight = param->height;
vram32 = param->base;
bufferwidth = param->pitch;
pixelformat = param->pixelformat;

if( (bufferwidth==0) || (pixelformat!=0)) return -1;

fcolor = 0x00ffffff;
bcolor = 0xff000000;

return 0;
}
21 changes: 21 additions & 0 deletions plugin/kernel/blit.h
@@ -0,0 +1,21 @@
#ifndef __BLIT_H__
#define __BLIT_H__

#include <vitasdkkern.h>

#define COLOR_CYAN 0x00ffff00
#define COLOR_MAGENDA 0x00ff00ff
#define COLOR_YELLOW 0x0000ffff

#define RGB(R,G,B) (((B)<<16)|((G)<<8)|(R))
#define RGBT(R,G,B,T) (((T)<<24)|((B)<<16)|((G)<<8)|(R))

#define CENTER(num) ((960/2)-(num*(16/2)))

void blit_set_color(int fg_col,int bg_col);
int blit_string(int sx,int sy,const char *msg);
int blit_string_ctr(int sy,const char *msg);
int blit_stringf(int sx, int sy, const char *msg, ...);
int blit_set_frame_buf(const SceDisplayFrameBuf *param);

#endif
File renamed without changes.

0 comments on commit 296bf0e

Please sign in to comment.