From 51b8fc1b31feb871a1083e39918e2b2883db4f25 Mon Sep 17 00:00:00 2001 From: Toyobayashi Date: Sat, 7 Oct 2017 16:01:31 +0800 Subject: [PATCH] update 1.6 --- CGSSAssetsDownloader.cpp | 310 ++++++--------------------------------- CGSSAssetsDownloader.h | 294 ++++++++++++++++++++++++++++++++++++- README.md | 36 +++-- 3 files changed, 365 insertions(+), 275 deletions(-) diff --git a/CGSSAssetsDownloader.cpp b/CGSSAssetsDownloader.cpp index 0c49b96..ab08d3c 100644 --- a/CGSSAssetsDownloader.cpp +++ b/CGSSAssetsDownloader.cpp @@ -1,265 +1,14 @@ #include "CGSSAssetsDownloader.h" -string update_list = ""; - -int string_index_of(char* arr[], char* str, int length) { - for (int i = 0; i < length; i++) { - if (strcmp(arr[i], str) == 0) { - return i; - } - } - return -1; -} - -void exec_sync(string cmd) { - system(cmd.c_str()); -} - -void is_db_ok(int &r, char *&errmsg) { - if (r != SQLITE_OK) { - fprintf(stderr, "SQL error: %s\n", errmsg); - sqlite3_free(errmsg); - exit(0); - } -} - -void hcadec(string hcafile) { - unsigned int count = 0; - char *filenameOut = NULL; - float volume = 1; - unsigned int ciphKey1 = 0xF27E3B22; - unsigned int ciphKey2 = 0x00003657; - int mode = 16; - int loop = 0; - - char path[MAX_PATH]; - if (!(filenameOut&&filenameOut[0])) { - strcpy_s(path, sizeof(path), hcafile.c_str()); - char *d1 = strrchr(path, '\\'); - char *d2 = strrchr(path, '/'); - char *e = strrchr(path, '.'); - if (e&&d1 [-o option or filename] [-u]\n\n"); + printf("Usage: \n"); + printf("CGSSAssetsDownloader <-v resource_version> [-a] [-u] [-mp3]\n"); + printf("CGSSAssetsDownloader <-v resource_version> [-o option or filename] [-u] [-mp3]\n\n"); + + printf("Example: \n"); + printf("CGSSAssetsDownloader -v 10027700 -o -bgm -u\n"); + printf("CGSSAssetsDownloader -v 10028005 -o gachaselect_30145.unity3d\n"); + printf("CGSSAssetsDownloader -v 10031250 -a -u -mp3\n\n"); + + printf("Arguments: \n"); + printf("<-v resource_version> [NECESSARY] Set the resource version of game and download database.\n"); + printf("[-a] [OPTIONAL] Auto update bgm, live, card, icon, score assets.\n"); + printf("[-o bgm|live|card|icon|score|(filename)] [OPTIONAL] Read the detail below.\n"); + printf("[-u] [OPTIONAL] Copy files to \"dl\\\" folder.\n"); + printf("[-mp3] [OPTIONAL] WAV to MP3.Default: WAV.\n\n"); printf("If you don't know the , try to visit\nhttps://starlight.kirara.ca/api/v1/info\n\n"); - printf("option could be: \n"); + printf("-o detail: \n"); printf(" bgm \t all background music will be downloaded.\n"); printf(" live \t all live music will be downloaded.\n"); printf(" card \t all unity3d files that contain card background will be downloaded.\n"); @@ -438,20 +225,19 @@ int main(int argc, char* argv[]) { printf(" score \t all bdb files that contain music score will be downloaded.\n\n"); printf("You can use \"DB Browser for SQLite\" open the manifest database file in data\\ to browse file names\n\n"); - printf("Example:\nCGSSAssetsDownloader -v 10027700 -o bgm -u\n"); - printf("CGSSAssetsDownloader -v 10028005 -o gachaselect_30145.unity3d\n\n"); - + printf("Developed by github@toyobayashi, tieba@y_Nyanko, weibo@TTPTs\n\n"); printf("Powered by:\n"); printf("hcadec\n"); printf("OpenCGSS/Deretore\n"); + printf("ffmpeg\n"); printf("SQLite\n"); printf("UnityLz4\n\n"); printf("The copyright of CGSS and its related content is held by BANDAI NAMCO Entertainment Inc.\n\n"); - system("pause"); + system("pause>nul"); } return 0; } diff --git a/CGSSAssetsDownloader.h b/CGSSAssetsDownloader.h index 61eed22..69409cd 100644 --- a/CGSSAssetsDownloader.h +++ b/CGSSAssetsDownloader.h @@ -9,7 +9,7 @@ #include #include -#define WIN32_LEAN_AND_MEAN +// #define WIN32_LEAN_AND_MEAN using namespace std; class Downloader { @@ -21,16 +21,308 @@ class Downloader { static int max; static int exists; static int copy; + static int mp3; + static int auto_update; + static string update_list; Downloader(string, string); void check_manifest(); void download_manifest(); void download_asset(); void download_single(string); + void set_type(string); }; int Downloader::current = 0; int Downloader::max = 0; int Downloader::exists = 0; int Downloader::copy = 0; +int Downloader::mp3 = 0; +int Downloader::auto_update = 0; +string Downloader::update_list = ""; +int string_index_of(char* arr[], char* str, int length) { + for (int i = 0; i < length; i++) { + if (strcmp(arr[i], str) == 0) { + return i; + } + } + return -1; +} + +void exec_sync(string cmd) { + system(cmd.c_str()); +} + +void is_db_ok(int &r, char *&errmsg) { + if (r != SQLITE_OK) { + fprintf(stderr, "SQL error: %s\n", errmsg); + sqlite3_free(errmsg); + exit(0); + } +} + +void hcadec(string hcafile) { + unsigned int count = 0; + char *filenameOut = NULL; + float volume = 1; + unsigned int ciphKey1 = 0xF27E3B22; + unsigned int ciphKey2 = 0x00003657; + int mode = 16; + int loop = 0; + + char path[MAX_PATH]; + if (!(filenameOut&&filenameOut[0])) { + strcpy_s(path, sizeof(path), hcafile.c_str()); + char *d1 = strrchr(path, '\\'); + char *d2 = strrchr(path, '/'); + char *e = strrchr(path, '.'); + if (e&&d1 [-o option or filename] [-u] +CGSSAssetsDownloader <-v resource_version> [-o option or filename] [-u] +CGSSAssetsDownloader <-v resource_version> [-a] [-u] [-mp3] ``` -If you don't know the , try to visit https://starlight.kirara.ca/api/v1/info - -option could be: +## Example -【bgm】All background music will be downloaded. +``` Bash +CGSSAssetsDownloader -v 10027700 -o -bgm -u +CGSSAssetsDownloader -v 10028005 -o gachaselect_30145.unity3d +CGSSAssetsDownloader -v 10031250 -a -u -mp3 +``` -【live】All live music will be downloaded. +## Arguments -【card】All unity3d files that contain card background will be downloaded. +<-v resource_version> [NECESSARY] Set the resource version of game and download database. +[-a] [OPTIONAL] Auto update bgm, live, card, icon, score assets. +[-o bgm|live|card|icon|score|(filename)] [OPTIONAL] Read the detail below. +[-u] [OPTIONAL] Copy files to "dl\" folder. +[-mp3] [OPTIONAL] WAV to MP3.Default: WAV. -【icon】All unity3d files that contain 124x124 card icon will be downloaded. +If you don't know the , try to visit https://starlight.kirara.ca/api/v1/info -【score】All bdb files that contain music score will be downloaded. +-o detail: -If you use -u, the file will be copied to dl\. +[bgm] All background music will be downloaded. +[live] All live music will be downloaded. +[card] All unity3d files that contain card background will be downloaded. +[icon] All unity3d files that contain 124x124 card icon will be downloaded. +[score] All bdb files that contain music score will be downloaded. ## Powered by * [hcadec](https://github.com/alama/hcadec) -* [OpenCGSS/DereTore](https://github.com/OpenCGSS/DereTore) +* [OpenCGSS/DereTore](https://github.com/OpenCGSS/DereTore) +* [ffmpeg](http://ffmpeg.org/) * [SQLite](https://sqlite.org/) * [UnityLz4](https://github.com/subdiox/UnityLz4) ## Copyright -The copyright of CGSS and its related content is held by [BANDAI NAMCO Entertainment, Inc.](https://bandainamcoent.co.jp/) +The copyright of CGSS and its related content is held by [BANDAI NAMCO Entertainment Inc.](https://bandainamcoent.co.jp/)