├── linux ├── Makefile └── main.c ├── windows ├── Makefile └── main.c └── README.md /linux/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS= 3 | LDFLAGS= 4 | SOURCES=main.c 5 | EXECUTABLE=cbanim 6 | all: 7 | $(CC) $(CFLAGS) $(SOURCES) $(LDFLAGS) -o $(EXECUTABLE) 8 | clean: 9 | rm -rf $(EXECUTABLE) 10 | -------------------------------------------------------------------------------- /windows/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS= 3 | LDFLAGS= 4 | SOURCES=main.c 5 | EXECUTABLE=cbanim 6 | all: 7 | $(CC) $(CFLAGS) $(SOURCES) $(LDFLAGS) -o $(EXECUTABLE) 8 | clean: 9 | rm -rf $(EXECUTABLE) 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PSP2-CBAnim 2 | BootAnimation creator for enso_ex v3.X and CBS-Manager 3 | 4 | # THIS TOOL IS OUTDATED, PLEASE USE https://github.com/SKGleba/VitaTools#vita-bootanim INSTEAD 5 | 6 | # Usage 7 | "cbanim -intype filename%d [optional flags]" 8 | - intype: input file type [ -r: raw | -g: gif | -p: png/jpg | -i: STATIC output]. Note: there is also a resize parameter "s" (screen res) or "l" (lanimation), it can be used with -g/-p/-i (-sg/-sp/-si), if set, cbanim will resize the input data to 960x544 or 960x128 (the file remains untouched). 9 | - filename%d: the base file name where the %d is instead of the frame number (e.g frame_%d.bin for frame_0.bin, frame_1.bin, ..) 10 | - noloop: the animation will be played once 11 | - nocompress: the animation will not be compressed (very slow, not recommended) 12 | - nopreload: the animation will not be loaded to ram, but directly read from the img file 13 | - slowmode: animation will be slower, but it wont have possible artifacts 14 | 15 | example: "./cbanim -g anim.gif -noloop" 16 | # Notes: 17 | - You need ImageMagick and gzip (or convert.exe and gzip.exe) to use this tool. 18 | -------------------------------------------------------------------------------- /linux/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | cbanim by SKGleba 3 | All Rights Reserved 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | 13 | int main(int argc, char **argv){ 14 | 15 | uint32_t cur = 0, maxx = 0, sz = 0; 16 | 17 | char mbuff[128], cbuff[128], syscmdc[128], syscmdg[128], max[4]; 18 | 19 | char flags[4] = { 1, 1, 0, 0 }; 20 | 21 | int compress = 1, l = 1; 22 | int png = -1, gif = -1; 23 | FILE *fp; 24 | if(argc < 3){ 25 | printf("\nusage: cbanim -intype filename%%d [optional flags]\n intypes:\n -r: raw\n -p: png/jpg/any supported static image format\n -g: gif\n -i: static OUTPUT image\n Note: you can add a \"s\" to resize to 960x544 or \"l\" to resize to 960x128.\n\n optional flags:\n -noloop: show the animation one time\n -nocompress: disable compression (slow, not recommended)\n -nopreload: dont load to RAM first (directly read from the *.img)\n -slowmode: make it slower, but stable (no artifacts)\n\n ex1: cbanim -p frame_%%d.png -noloop => add PNGs to the bootanimation starting from frame_0.png, set to run-once mode\n ex2: cbanim -sg anim.gif => resize and convert the anim.gif GIF to the bootanimation, the animation will loop\n\n"); 26 | return -1; 27 | } 28 | 29 | if (strcmp("-g", argv[1]) == 0){ 30 | gif = 1; 31 | png = 1; 32 | } else if (strcmp("-p", argv[1]) == 0){ 33 | png = 1; 34 | } else if (strcmp("-sg", argv[1]) == 0){ 35 | gif = 2; 36 | png = 2; 37 | } else if (strcmp("-sp", argv[1]) == 0){ 38 | png = 2; 39 | } else if (strcmp("-lg", argv[1]) == 0){ 40 | gif = 3; 41 | png = 3; 42 | } else if (strcmp("-lp", argv[1]) == 0){ 43 | png = 3; 44 | } else if (strcmp("-i", argv[1]) == 0) { 45 | png = 4; 46 | } else if (strcmp("-si", argv[1]) == 0){ 47 | png = 4; 48 | gif = 4; 49 | } 50 | 51 | if (argc > 3){ 52 | int i = argc - 1; 53 | while (i > 2) { 54 | if (strcmp("-noloop", argv[i]) == 0){ 55 | flags[0] = 0; 56 | } else if (strcmp("-nocompress", argv[i]) == 0){ 57 | compress = 0; 58 | flags[1] = 0; 59 | } else if (strcmp("-nopreload", argv[i]) == 0){ 60 | flags[2] = 1; 61 | } else if (strcmp("-slowmode", argv[i]) == 0){ 62 | flags[3] = 1; 63 | } 64 | i = i - 1; 65 | } 66 | } 67 | 68 | if (png == -1) { 69 | printf("\nusage: cbanim -intype filename%%d -optional flags-\n intypes:\n -r: raw\n -p: png/jpg/any supported static image format\n -g: gif\n -i: static OUTPUT image\n Note: you can add a \"s\" to resize to 960x544 or \"l\" to resize to 960x128.\noptional flags:\n -noloop: show the animation one time\n -nocompress: disable compression (slow, not recommended)\n -nopreload: dont load to RAM first (directly read from the *.img)\n -slowmode: make it slower, but stable (no artifacts)\n\n ex1: cbanim -p frame_%%d.png -noloop => add PNGs to the bootanimation starting from frame_0.png, set it to run-once mode\n ex2: cbanim -sg anim.gif => resize and convert the anim.gif GIF to the bootanimation, the animation will loop until vita boots\n\n"); 70 | return -1; 71 | } 72 | 73 | if (png == 4) { 74 | printf("creating static image...\n"); 75 | sprintf(cbuff, argv[2], 0); 76 | fp = fopen(cbuff, "rb"); 77 | if (fp == NULL) 78 | return 0; 79 | fclose(fp); 80 | printf("converting...\n"); 81 | if (gif == 4) { 82 | sprintf(syscmdg, "convert %s -resize 960x544! temp.rgba", cbuff); 83 | system(syscmdg); 84 | } else { 85 | sprintf(syscmdg, "convert %s temp.rgba", cbuff); 86 | system(syscmdg); 87 | } 88 | if (compress == 1) { 89 | printf("compressing...\n"); 90 | system("gzip -9 -k temp.rgba"); 91 | printf("creating output file [boot_splash.img]\n"); 92 | system("cat temp.rgba.gz >> boot_splash.img"); 93 | printf("done...\n"); 94 | unlink("temp.rgba"); 95 | unlink("temp.rgba.gz"); 96 | } else { 97 | printf("creating output file [boot_splash.img]\n"); 98 | system("cat temp.rgba >> boot_splash.img"); 99 | printf("done...\n"); 100 | unlink("temp.rgba"); 101 | } 102 | 103 | return 1; 104 | } 105 | 106 | if (gif > 0) { 107 | printf("extracting...\n"); 108 | sprintf(cbuff, argv[2], 0); 109 | printf("wait ( %s )\n", cbuff); 110 | sprintf(syscmdg, "convert %s -coalesce temp.gif", cbuff); 111 | system(syscmdg); 112 | system("convert temp.gif frame.png"); 113 | printf("...done\n"); 114 | unlink("temp.gif"); 115 | argv[2] = "frame-%d.png"; 116 | } 117 | 118 | cur = 0; 119 | 120 | if (png > 0) printf("converting...\n"); 121 | while (png > 0) { 122 | sprintf(cbuff, argv[2], cur); 123 | fp = fopen(cbuff, "rb"); 124 | if (fp == NULL) break; 125 | fclose(fp); 126 | printf("converting %s\n", cbuff); 127 | if (png == 2) { 128 | sprintf(syscmdg, "convert %s -resize 960x544! frame_%d.rgba", cbuff, cur); 129 | } else if (png == 3) { 130 | sprintf(syscmdg, "convert %s -resize 960x128! frame_%d.rgba", cbuff, cur); 131 | } else { 132 | sprintf(syscmdg, "convert %s frame_%d.rgba", cbuff, cur); 133 | } 134 | system(syscmdg); 135 | if (gif > 0) unlink(cbuff); 136 | cur++; 137 | } 138 | if (png > 0) { 139 | printf("...done\n"); 140 | png = 1; 141 | } 142 | 143 | cur = 0; 144 | 145 | if (compress == 1) printf("compressing...\n"); 146 | while (compress == 1 && png == 0) { 147 | sprintf(cbuff, argv[2], cur); 148 | fp = fopen(cbuff, "rb"); 149 | if (fp == NULL) break; 150 | fclose(fp); 151 | printf("compressing %s\n", cbuff); 152 | sprintf(syscmdg, "gzip -9 -k %s", cbuff); 153 | system(syscmdg); 154 | cur++; 155 | } 156 | while (compress == 1 && png == 1) { 157 | sprintf(cbuff, "frame_%d.rgba", cur); 158 | fp = fopen(cbuff, "rb"); 159 | if (fp == NULL) break; 160 | fclose(fp); 161 | printf("compressing %s\n", cbuff); 162 | sprintf(syscmdg, "gzip -9 -k %s", cbuff); 163 | system(syscmdg); 164 | unlink(cbuff); 165 | cur++; 166 | } 167 | if (compress == 1) printf("...done\n"); 168 | printf("creating output file [boot_animation.img]\n"); 169 | cur = 0; 170 | fp = fopen("boot_animation.img", "wb+"); 171 | memcpy(max, &maxx, sizeof(maxx)); 172 | fwrite(max, 4, 1, fp); 173 | fwrite(flags, 4, 1, fp); 174 | fclose(fp); 175 | printf("combining [boot_animation.img]...\n"); 176 | while (l == 1) { 177 | if (compress == 1) { 178 | if (png == 0) { 179 | sprintf(cbuff, argv[2], cur); 180 | sprintf(mbuff, "%s.gz", cbuff); 181 | } else { 182 | sprintf(mbuff, "frame_%d.rgba.gz", cur); 183 | } 184 | } else { 185 | if (png == 0) { 186 | sprintf(mbuff, argv[2], cur); 187 | } else { 188 | sprintf(mbuff, "frame_%d.rgba", cur); 189 | } 190 | } 191 | fp = fopen(mbuff, "rb"); 192 | if (fp == NULL) { 193 | if (cur > 0) maxx = cur - 1; 194 | fp = fopen("boot_animation.img", "rb+"); 195 | memcpy(max, &maxx, sizeof(maxx)); 196 | fwrite(max, 4, 1, fp); 197 | fclose(fp); 198 | printf("...done [boot_animation.img]\n"); 199 | l = 0; 200 | exit(0); 201 | } 202 | printf("adding %s\n", mbuff); 203 | fseek(fp, 0, SEEK_END); 204 | sz = ftell(fp); 205 | memcpy(max, &sz, sizeof(sz)); 206 | fclose(fp); 207 | fp = fopen("boot_animation.img", "ab"); 208 | fwrite(max, 4, 1, fp); 209 | fclose(fp); 210 | sprintf(syscmdg, "cat %s >> boot_animation.img", mbuff); 211 | system(syscmdg); 212 | if (compress == 1) unlink(mbuff); 213 | cur++; 214 | } 215 | 216 | return 1; 217 | } 218 | -------------------------------------------------------------------------------- /windows/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | cbanim by SKGleba 3 | All Rights Reserved 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | 13 | int main(int argc, char **argv){ 14 | 15 | uint32_t cur = 0, maxx = 0, sz = 0; 16 | 17 | char mbuff[128], cbuff[128], syscmdc[128], syscmdg[128], max[4]; 18 | 19 | char flags[4] = { 1, 1, 0, 0 }; 20 | 21 | int compress = 1, l = 1; 22 | int png = -1, gif = -1; 23 | FILE *fp; 24 | if(argc < 3){ 25 | printf("\nusage: cbanim -intype filename%%d -optional flags-\n intypes:\n -r: raw\n -p: png/jpg/any supported static image format\n -g: gif\n -i: static OUTPUT image\n Note: you can add a \"s\" to resize to 960x544 or \"l\" to resize to 960x128.\noptional flags:\n -noloop: show the animation one time\n -nocompress: disable compression (slow, not recommended)\n -nopreload: dont load to RAM first (directly read from the *.img)\n -slowmode: make it slower, but stable (no artifacts)\n\n ex1: cbanim -p frame_%%d.png -noloop => add PNGs to the bootanimation starting from frame_0.png, set it to run-once mode\n ex2: cbanim -sg anim.gif => resize and convert the anim.gif GIF to the bootanimation, the animation will loop until vita boots\n\n"); 26 | return -1; 27 | } 28 | 29 | if (strcmp("-g", argv[1]) == 0){ 30 | gif = 1; 31 | png = 1; 32 | } else if (strcmp("-p", argv[1]) == 0){ 33 | png = 1; 34 | } else if (strcmp("-sg", argv[1]) == 0){ 35 | gif = 2; 36 | png = 2; 37 | } else if (strcmp("-sp", argv[1]) == 0){ 38 | png = 2; 39 | } else if (strcmp("-lg", argv[1]) == 0){ 40 | gif = 3; 41 | png = 3; 42 | } else if (strcmp("-lp", argv[1]) == 0){ 43 | png = 3; 44 | } else if (strcmp("-i", argv[1]) == 0) { 45 | png = 4; 46 | } else if (strcmp("-si", argv[1]) == 0){ 47 | png = 4; 48 | gif = 4; 49 | } 50 | 51 | if (argc > 3){ 52 | int i = argc - 1; 53 | while (i > 2) { 54 | if (strcmp("-noloop", argv[i]) == 0){ 55 | flags[0] = 0; 56 | } else if (strcmp("-nocompress", argv[i]) == 0){ 57 | compress = 0; 58 | flags[1] = 0; 59 | } else if (strcmp("-nopreload", argv[i]) == 0){ 60 | flags[2] = 1; 61 | } else if (strcmp("-slowmode", argv[i]) == 0){ 62 | flags[3] = 1; 63 | } 64 | i = i - 1; 65 | } 66 | } 67 | 68 | if (png == -1) { 69 | printf("\nusage: cbanim -intype filename%%d -optional flags-\n intypes:\n -r: raw\n -p: png/jpg/any supported static image format\n -g: gif\n -i: static OUTPUT image\n Note: you can add a \"s\" to resize to 960x544 or \"l\" to resize to 960x128.\noptional flags:\n -noloop: show the animation one time\n -nocompress: disable compression (slow, not recommended)\n -nopreload: dont load to RAM first (directly read from the *.img)\n -slowmode: make it slower, but stable (no artifacts)\n\n ex1: cbanim -p frame_%%d.png -noloop => add PNGs to the bootanimation starting from frame_0.png, set it to run-once mode\n ex2: cbanim -sg anim.gif => resize and convert the anim.gif GIF to the bootanimation, the animation will loop until vita boots\n\n"); 70 | return -1; 71 | } 72 | 73 | if (png == 4) { 74 | printf("creating static image...\n"); 75 | sprintf(cbuff, argv[2], 0); 76 | fp = fopen(cbuff, "rb"); 77 | if (fp == NULL) 78 | return 0; 79 | fclose(fp); 80 | printf("converting...\n"); 81 | if (gif == 4) { 82 | sprintf(syscmdg, "convert %s -resize 960x544! temp.rgba", cbuff); 83 | system(syscmdg); 84 | } else { 85 | sprintf(syscmdg, "convert %s temp.rgba", cbuff); 86 | system(syscmdg); 87 | } 88 | if (compress == 1) { 89 | printf("compressing...\n"); 90 | system("gzip -9 -k temp.rgba"); 91 | printf("creating output file [boot_splash.img]\n"); 92 | system("type temp.rgba.gz >> boot_splash.img"); 93 | printf("done...\n"); 94 | unlink("temp.rgba"); 95 | unlink("temp.rgba.gz"); 96 | } else { 97 | printf("creating output file [boot_splash.img]\n"); 98 | system("type temp.rgba >> boot_splash.img"); 99 | printf("done...\n"); 100 | unlink("temp.rgba"); 101 | } 102 | 103 | return 1; 104 | } 105 | 106 | if (gif > 0) { 107 | printf("extracting...\n"); 108 | sprintf(cbuff, argv[2], 0); 109 | printf("wait ( %s )\n", cbuff); 110 | sprintf(syscmdg, "convert %s -coalesce temp.gif", cbuff); 111 | system(syscmdg); 112 | system("convert temp.gif frame.png"); 113 | printf("...done\n"); 114 | unlink("temp.gif"); 115 | argv[2] = "frame-%d.png"; 116 | } 117 | 118 | cur = 0; 119 | 120 | if (png > 0) printf("converting...\n"); 121 | while (png > 0) { 122 | sprintf(cbuff, argv[2], cur); 123 | fp = fopen(cbuff, "rb"); 124 | if (fp == NULL) break; 125 | fclose(fp); 126 | printf("converting %s\n", cbuff); 127 | if (png == 2) { 128 | sprintf(syscmdg, "convert %s -resize 960x544! frame_%d.rgba", cbuff, cur); 129 | } else if (png == 3) { 130 | sprintf(syscmdg, "convert %s -resize 960x128! frame_%d.rgba", cbuff, cur); 131 | } else { 132 | sprintf(syscmdg, "convert %s frame_%d.rgba", cbuff, cur); 133 | } 134 | system(syscmdg); 135 | if (gif > 0) unlink(cbuff); 136 | cur++; 137 | } 138 | if (png > 0) { 139 | printf("...done\n"); 140 | png = 1; 141 | } 142 | 143 | cur = 0; 144 | 145 | if (compress == 1) printf("compressing...\n"); 146 | while (compress == 1 && png == 0) { 147 | sprintf(cbuff, argv[2], cur); 148 | fp = fopen(cbuff, "rb"); 149 | if (fp == NULL) break; 150 | fclose(fp); 151 | printf("compressing %s\n", cbuff); 152 | sprintf(syscmdg, "gzip -9 -k %s", cbuff); 153 | system(syscmdg); 154 | cur++; 155 | } 156 | while (compress == 1 && png == 1) { 157 | sprintf(cbuff, "frame_%d.rgba", cur); 158 | fp = fopen(cbuff, "rb"); 159 | if (fp == NULL) break; 160 | fclose(fp); 161 | printf("compressing %s\n", cbuff); 162 | sprintf(syscmdg, "gzip -9 -k %s", cbuff); 163 | system(syscmdg); 164 | unlink(cbuff); 165 | cur++; 166 | } 167 | if (compress == 1) printf("...done\n"); 168 | printf("creating output file [boot_animation.img]\n"); 169 | cur = 0; 170 | fp = fopen("boot_animation.img", "wb+"); 171 | memcpy(max, &maxx, sizeof(maxx)); 172 | fwrite(max, 4, 1, fp); 173 | fwrite(flags, 4, 1, fp); 174 | fclose(fp); 175 | printf("combining [boot_animation.img]...\n"); 176 | while (l == 1) { 177 | if (compress == 1) { 178 | if (png == 0) { 179 | sprintf(cbuff, argv[2], cur); 180 | sprintf(mbuff, "%s.gz", cbuff); 181 | } else { 182 | sprintf(mbuff, "frame_%d.rgba.gz", cur); 183 | } 184 | } else { 185 | if (png == 0) { 186 | sprintf(mbuff, argv[2], cur); 187 | } else { 188 | sprintf(mbuff, "frame_%d.rgba", cur); 189 | } 190 | } 191 | fp = fopen(mbuff, "rb"); 192 | if (fp == NULL) { 193 | if (cur > 0) maxx = cur - 1; 194 | fp = fopen("boot_animation.img", "rb+"); 195 | memcpy(max, &maxx, sizeof(maxx)); 196 | fwrite(max, 4, 1, fp); 197 | fclose(fp); 198 | printf("...done [boot_animation.img]\n"); 199 | l = 0; 200 | exit(0); 201 | } 202 | printf("adding %s\n", mbuff); 203 | fseek(fp, 0, SEEK_END); 204 | sz = ftell(fp); 205 | memcpy(max, &sz, sizeof(sz)); 206 | fclose(fp); 207 | fp = fopen("boot_animation.img", "ab"); 208 | fwrite(max, 4, 1, fp); 209 | fclose(fp); 210 | sprintf(syscmdg, "type %s >> boot_animation.img", mbuff); 211 | system(syscmdg); 212 | if (compress == 1) unlink(mbuff); 213 | cur++; 214 | } 215 | 216 | return 1; 217 | } 218 | --------------------------------------------------------------------------------