Skip to content

Commit

Permalink
1.42 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
hihkm committed Jun 21, 2020
1 parent 95f6a67 commit a8dbbfd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 43 deletions.
44 changes: 23 additions & 21 deletions AssFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@ int writeAssDanmakuPart(FILE *opF,

DANMAKU *now = NULL;
int cnt;
char EscapedText[MAX_TEXT_LENGTH];
char escapedText[MAX_TEXT_LENGTH];
char tempText[MAX_TEXT_LENGTH];

DANMAKU *signPtr = head, *scanPtr = head;

Expand Down Expand Up @@ -1383,11 +1384,19 @@ int writeAssDanmakuPart(FILE *opF,
textLen = getStrLen((unsigned char *)(now -> text), fontSize, now -> fontSize, fontName);
textHei = getStrHei((unsigned char *)(now -> text), fontSize, now -> fontSize, fontName);

/*特殊字符替换 特殊弹幕单独处理*/
if (abs(now -> type) != 5)
/*特殊字符替换*/
if (*(now->text) == ' ')
{
strrpl(now -> text, EscapedText, " ", "\\h", MAX_TEXT_LENGTH);
strcpy(escapedText, "\\h");
strcat_s(escapedText, MAX_TEXT_LENGTH, now->text);
}
else
{
strSafeCopy(escapedText, now->text, MAX_TEXT_LENGTH);
}

strrpl(escapedText, tempText, "\n ", "\\N\\h", MAX_TEXT_LENGTH);
strrpl(tempText, escapedText, "\n", "\\N", MAX_TEXT_LENGTH);

if(now -> type == 1 || now -> type == -1)/*右左弹幕*/
{
Expand Down Expand Up @@ -1440,7 +1449,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "R2L,,0000,0000,0000,,{\\move(%d,%d,%d,%d)\\q2",
resX + textLen/2, PositionY, -1 * textLen / 2, PositionY);

if(now -> fontSize != 25)
if(textHei != 25)
{
fprintf(opF, "\\fs%d", textHei);
}
Expand All @@ -1451,7 +1460,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "\\c&H%s", toHexColor(now->color, hexColor));
}

fprintf(opF, "}%s", EscapedText);
fprintf(opF, "}%s", escapedText);
}
else if(now -> type == 2 || now -> type == -2)/*左右弹幕*/
{
Expand Down Expand Up @@ -1505,7 +1514,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "L2R,,0000,0000,0000,,{\\move(%d,%d,%d,%d)\\q2",
-1 * textLen / 2, PositionY, resX + textLen/2, PositionY);

if(now -> fontSize != 25)
if(textHei != 25)
{
fprintf(opF, "\\fs%d", textHei);
}
Expand All @@ -1516,7 +1525,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "\\c&H%s", toHexColor(now->color, hexColor));
}

fprintf(opF, "}%s", EscapedText);
fprintf(opF, "}%s", escapedText);
}
else if(now -> type == 3 || now -> type == -3)/*顶端弹幕*/
{
Expand Down Expand Up @@ -1565,7 +1574,7 @@ int writeAssDanmakuPart(FILE *opF,
printTime(opF, now->time + holdTime, ",");
fprintf(opF, "TOP,,0000,0000,0000,,{\\pos(%d,%d)\\q2", resX / 2, PositionY);

if(now -> fontSize != 25)
if(textHei != 25)
{
fprintf(opF, "\\fs%d", textHei);
}
Expand All @@ -1576,7 +1585,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "\\c&H%s", toHexColor(now->color, hexColor));
}

fprintf(opF, "}%s", EscapedText);
fprintf(opF, "}%s", escapedText);
}
else if(now -> type == 4 || now -> type == -4)/*底端弹幕*/
{
Expand Down Expand Up @@ -1630,7 +1639,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "BTM,,0000,0000,0000,,{\\pos(%d,%d)\\q2",
resX / 2, PositionY - textHei + 2);

if(now -> fontSize != 25)
if(textHei != 25)
{
fprintf(opF, "\\fs%d", textHei);
}
Expand All @@ -1641,7 +1650,7 @@ int writeAssDanmakuPart(FILE *opF,
fprintf(opF, "\\c&H%s", toHexColor(now->color, hexColor));
}

fprintf(opF, "}%s", EscapedText);
fprintf(opF, "}%s", escapedText);
}
else if(now -> type == 5 || now -> type == -5)/*特殊弹幕*/
{
Expand Down Expand Up @@ -1714,7 +1723,7 @@ int writeAssDanmakuPart(FILE *opF,

if(now -> fontSize != 25)
{/*字号*/
fprintf(opF, "\\fs%d", fontSize + (now -> fontSize - 25));
fprintf(opF, "\\fs%d", now -> fontSize);
}

if(now -> color != 0xFFFFFF)
Expand Down Expand Up @@ -1746,15 +1755,8 @@ int writeAssDanmakuPart(FILE *opF,
{/*字体*/
fprintf(opF, "\\fn%s", now -> special -> fontName);
}

/*特殊字符替换*/
{
char tempText[MAX_TEXT_LENGTH];
strrpl(now -> text, tempText, " ", "\\h", MAX_TEXT_LENGTH);
strrpl(tempText, EscapedText, "\n", "\\N", MAX_TEXT_LENGTH);
}

fprintf(opF, "}%s", EscapedText);
fprintf(opF, "}%s", escapedText);
}
else if(now -> type == 8)/*代码弹幕*/
{
Expand Down
2 changes: 1 addition & 1 deletion Define/CLIDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
#ifndef __CLIDEF_H__
#define __CLIDEF_H__

#define VERSION "1.41 CLI Release"
#define VERSION "1.42 CLI Beta"
#define CONFIG_FILE_NAME "DanmakuFactoryConfig.json"
#define FILENAME_LEN 512
#define FORMAT_LEN 16
Expand Down
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ DanmakuFactory是一款弹幕文件转换工具,支持特殊弹幕,支持ass

##### Windows

[DanmakuFactory_1.41_CLI Beta(蓝奏云)](https://hihkm.lanzous.com/i9pU4dsdl7c)
[DanmakuFactory_1.42_CLI Beta(蓝奏云)](https://hihkm.lanzous.com/i9pU4dsdl7c)

[DanmakuFactory_1.41_CLI Beta(GITHUB)](https://github.com/hihkm/DanmakuFactory/releases)
[DanmakuFactory_1.42_CLI Beta(GITHUB)](https://github.com/hihkm/DanmakuFactory/releases)

[DanmakuFactory_GUI(~~在做了在做了~~)]()

[1.31 Release](Compiled/release/DanmakuFactory_1.31_release.zip)
[1.31 Release(有指引的控制台应用)](Compiled/release/DanmakuFactory_1.31_release.zip)



Expand Down Expand Up @@ -174,40 +174,32 @@ DanmakuFactory -o [输出文件格式] 输出文件名 -i [输入文件1格式]
##### 1.40

- 增加了ass弹幕读入功能,并兼容第三方软件生成的ass弹幕文件

- 增加了xml弹幕写出功能

- 增加了json弹幕读入功能(实验)

- 增加了json弹幕写出功能(实验)

- 增加了写出ass文件时屏蔽弹幕以注释方式保留

- 增加了xml弹幕转义符解析

- 增加了多文件弹幕合并



- 修复了特殊弹幕不换行的问题

- 修复了特殊弹幕解析有概率崩溃的问题

- 修复了普通弹幕过长可能导致的崩溃问题



- 优化了部分模块,执行效率有所提高

- 改用json文件存储配置信息,便于修改查看



- 去除了原本不稳定的编码转换模块(后续可能会使用第三方库)

##### 1.41

- 适配linux
- 修复了部分xml特殊弹幕无法正常解析的问题
- 修复了ass输出后空格失效的问题
- 优化排序,对于原本正序的输入无需重新排序
- 优化排序,对于原本正序的输入无需重新排序

**1.42**

- 修复了部分xml特殊弹幕无法正常解析的问题

- 修复了部分xml特殊弹幕回车或空格显示错误问题

- 取消了特殊弹幕等比缩放
3 changes: 2 additions & 1 deletion XmlFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ int readXml(const char *const ipFile, DANMAKU **head, const char *mode, const fl

/*文本部分*/
strGetLeftPart(NULL, &textPtr, '\"', MAX_TEXT_LENGTH);
strGetLeftPart(textPart, &textPtr, '\"', MAX_TEXT_LENGTH);
strGetLeftPart(tempText, &textPtr, '\"', MAX_TEXT_LENGTH);
strrpl(tempText, textPart, "/n", "\n", MAX_TEXT_LENGTH);//远古弹幕转义换行符
strGetLeftPart(NULL, &textPtr, ',', MAX_TEXT_LENGTH);

now->special->frZ = atoi(deQuotMarks(strGetLeftPart(tempText, &textPtr, ',', MAX_TEXT_LENGTH)));
Expand Down

0 comments on commit a8dbbfd

Please sign in to comment.