regomne / chinesize Goto Github PK
View Code? Open in Web Editor NEWMy chinesize tools, scripts and codes
My chinesize tools, scripts and codes
Kimi ni Semaru Otome no Lesson
https://drive.google.com/file/d/1naPt3GPiygy0lLqquui1zDMlLj7aEhR5/view?usp=sharing
While analyzing BGI and the tool posted here, I noticed this:
https://github.com/regomne/chinesize/blob/master/BGI/BGIunpack/CBG.h#L478
This should be changed to >= 64
. T004C0180
's size is 64, so T004C0180[64]
causes UB. SK
is derived from the Huffman table which is taken from the file itself, so corrupt file can lead to crash.
The bytefile not is a valid module to import here....
i try with, Python 2.7.9, 3.2 and 3.4
you can send-me py of this module?
I heard this file is compressed with zlib like .fes file but I can't seem to find tool to extract/pack it
qdb.zip
in your few py files I find import strfile
, however I couldn't find any module or any files named strfile ?
sample: Xuse/extIndex.py
i test this tool now, and the text has extracted (Thanks for this)
but to repack the script output is equal to original...
I try view the py file and change .replace('._bin','.txt') to .replace('.bin', '.txt')
The script now is edited but Corrupted... view the printscreen...
Yours Source:
for f in os.listdir(path1):
fs=open(path1+f,'rb')
stm=bytefile.ByteIO(fs.read())
if os.path.exists(path2+f.replace('._bin','.txt')):
fs=open(path2+f.replace('._bin','.txt'),'rb')
lines=fs.read().decode('U16').encode('936','replace').split(b'\r\n')
stm=packTxt(stm,lines)
fs=open(path3+f.replace('._bin','.bin'),'wb')
fs.write(stm[0:])
I Edited to:
for f in os.listdir(path1):
fs=open(path1+f,'rb')
stm=bytefile.ByteIO(fs.read())
if os.path.exists(path2+f.replace('.bin','.txt')):
fs=open(path2+f.replace('.bin','.txt'),'rb')
lines=fs.read().decode('U16').encode('936','replace').split(b'\r\n')
stm=packTxt(stm,lines)
fs=open(path3+f.replace('.bin','.bin'),'wb')
fs.write(stm[0:])
Before asking, Thank you for making great tools.
I have problems extracting and packing ybn file in euphoria.
In 'yurisybn3.0.py', result of YSTB() and CODE2YSTB() is different to original ybn file(file size is larger than original. Exactly, number of code count, codeData, ArgData, OffList is same, ResData is different)
In 'extYbn.go', program exit at guessYbnOp() because 'Can't guess the opcode'.
Why I try to do is,
euphoria english version seems to use image font. Related code is in data\script\eris\es_font.yst (yst00011.ybn). First, in this code, 'cgsys/font/font18/' folder is mentioned and in that folder, font image actually exist. Other, es_font.yst look differ to original es_font.yst file in yu-ris engine distribution package, and in this code there are many charactors are listed and patterend.
So, I assume if I can change es_font.yst then, I can print other charactor not included as default.
In addition, texts are also in yst, so I will modify text detail whether able to extract and repack. (In same length, I can change)
ref: d1c6139
If decryption is end where offset address is not multiple of 4 each code, argument, ressource, offlist block
yst0008.ybn header
59 53 54 42 DA 01 00 00 3F 02 00 00 FC 08 00 00
A4 31 00 00 EA 22 00 00 FC 08 00 00 00 00 00 00
So contents should be
Section | Address | Size(Hex) | Size |
---|---|---|---|
Code | 0x00000020 ~ 0x0000091B | 8FC | 2300 |
Args | 0x0000091C ~ 0x00003ABF | 31A4 | 12708 |
Res | 0x00003AC0 ~ 0x00005DA9 | 22EA | 8938 |
OffList | 0x00005DAA ~ 0x000066A5 | 8FC | 2300 |
Size of res is not multiple of 4. so decrypt ends after second XOR operation.
Then, decrypt start from first XOR operation in offlist.
I checked using ollydbg reverse engineering debugger.
So, I change extYbn.go code
from
chinesize/yuris/extYbn/extYbn.go
Lines 78 to 85 in 4211cae
chinesize/yuris/extYbn/extYbn.go
Lines 87 to 154 in 4211cae
chinesize/yuris/extYbn/extYbn.go
Lines 262 to 268 in 4211cae
func decryptYbn(stm []byte, key []byte, start uint32, length uint32) {
if len(key) != 4 {
panic("key length error")
}
for i := start; i < start+length; i++ {
stm[i] ^= key[(i-start)&3]
}
}
func parseYbn(oriStm []byte, key []byte) (script ybnInfo, err error) {
stm := bytes.NewReader(oriStm)
binary.Read(stm, binary.LittleEndian, &script.Header)
logln("header:", script.Header)
header := &script.Header
if bytes.Compare(header.Magic[:], []byte("YSTB")) != 0 ||
header.CodeSize != header.InstCnt*4 {
err = fmt.Errorf("not a ybn file or file format error")
return
}
fileSize, _ := stm.Seek(0, 2)
if uint32(binary.Size(header))+header.CodeSize+header.ArgSize+header.ResourceSize+
header.OffSize != uint32(fileSize) {
err = fmt.Errorf("file size error")
return
}
if header.Resv != 0 {
fmt.Println("reserved is not 0, maybe can't extract all the info")
}
var decryptedStm io.ReadSeeker
if bytes.Compare(key, []byte("\x00\x00\x00\x00")) != 0 {
logf("decrypting, key is:%02x %02x %02x %02x\n", key[0], key[1], key[2], key[3])
decryptYbn(oriStm, key, uint32(binary.Size(header)), header.CodeSize)
decryptYbn(oriStm, key, uint32(binary.Size(header))+header.CodeSize, header.ArgSize)
decryptYbn(oriStm, key, uint32(binary.Size(header))+header.CodeSize+header.ArgSize, header.ResourceSize)
decryptYbn(oriStm, key, uint32(binary.Size(header))+header.CodeSize+header.ArgSize+header.ResourceSize, header.OffSize)
decryptedStm = bytes.NewReader(oriStm)
} else {
decryptedStm = bytes.NewReader(oriStm)
}
logln("write decrypted file...")
s := []string{*inYbnName, ".decrypt"}
err1 := ioutil.WriteFile(strings.Join(s, ""), oriStm, 0644)
fmt.Println(err1)
logln("reading sections...")
decryptedStm.Seek(int64(binary.Size(header)), 0)
script.Insts = make([]instInfo, header.InstCnt)
rawInsts := make([]YInst, header.InstCnt)
binary.Read(decryptedStm, binary.LittleEndian, &rawInsts)
var tArg YArg
rargs := make([]YArg, header.ArgSize/uint32(binary.Size(tArg)))
binary.Read(decryptedStm, binary.LittleEndian, &rargs)
resStartOff, _ := decryptedStm.Seek(0, 1)
rargIdx := 0
logln("parsing instructions...")
for i, rinst := range rawInsts {
inst := &script.Insts[i]
inst.Op = rinst.Op
inst.Unk = rinst.Unk
inst.Args = make([]argInfo, rinst.ArgCnt)
for j := 0; j < int(rinst.ArgCnt); j++ {
rarg := &rargs[rargIdx]
rargIdx++
if rargIdx > len(rargs) {
err = fmt.Errorf("count of arguments exceed limit")
return
}
inst.Args[j].Type = rarg.Type
inst.Args[j].Value = rarg.Value
if rarg.Type == 0 && rinst.ArgCnt != 1 {
inst.Args[j].ResInfo = rarg.ResSize
inst.Args[j].ResOffset = rarg.ResOffset
} else {
decryptedStm.Seek(resStartOff+int64(rarg.ResOffset), 0)
res := &inst.Args[j].Res
if rarg.Type == 3 {
var resInfo YResInfo
binary.Read(decryptedStm, binary.LittleEndian, &resInfo)
res.Type = resInfo.Type
res.Res = make([]byte, resInfo.Len)
decryptedStm.Read(res.Res)
} else {
res.ResRaw = make([]byte, rarg.ResSize)
decryptedStm.Read(res.ResRaw)
}
}
}
}
offTblOffset := uint32(binary.Size(header)) + header.CodeSize + header.ArgSize + header.ResourceSize
decryptedStm.Seek(int64(offTblOffset), 0)
script.Offs = make([]uint32, header.InstCnt)
binary.Read(decryptedStm, binary.LittleEndian, &script.Offs)
return
}
// if bytes.Compare(key, []byte("\x00\x00\x00\x00")) != 0 {
// logf("decrypting, key is:%02x %02x %02x %02x\n", key[0], key[1], key[2], key[3])
// decryptYbn(oriStm, key)
// }
logln("parsing ybn...")
script, err := parseYbn(oriStm, key)
In euphoria, dummy size of YSTL is 20byte. So, I changed
chinesize/yuris/yurisybn3.0.py
Line 83 in 4211cae
dummy=YBN.read(20)
ref: 6e868b7
Result of YSTB() contain '<', '>' and ':' charactors in args or res code.
Variable sample and regexp
So, I change full logic
from
chinesize/yuris/yurisybn3.0.py
Lines 217 to 224 in 4211cae
import re
LQuote=0
while True:
LQuote=Res.find('<',LQuote)
doubleQueta = Res.find('"', LQuote)
RQuote=Res.find('>',LQuote)
if LQuote==-1: break
if (doubleQueta==-1 or RQuote<doubleQueta) and RQuote!=-1:
Res=Res[:LQuote]+TXT[int(Res[LQuote+1:RQuote])]+Res[RQuote+1:]
LQuote+=1
ResLen=0
ResStr=[]
for Res1 in re.findall("(?:[^ ]*?:)(?:\"(?: |[^\"])*?\"|.*?)(?:,|$)", Res):
if Res1[-1]==',':
Res1 = Res1[0:-1]
ResType, Str = [n.strip() for n in re.split(':', Res1, 1)]
大大好,我最近在研究favorite的汉化技术,看到大大写的hook代码感觉还是挺有帮助的。
不过就像问下ScriptObject* obj = (ScriptObject*)(regs->ebx + 0xf1b58);里面0xf1b58的地址是怎么来的。
顺便再问问exthcb里面parser.ParseTxt的exBlocks里面四个函数地址是怎么找到,谢谢。
导出Catsystem2的cst文件并汉化后,以gbk或者utf-8格式封包回去,游戏可以正常运行,但是会出现动态立绘失效的问题,我找了所有的kcs文件和fes文件,遗憾的是都没有找到可以解决这个问题的内容。
请问作者了解怎么解决这个问题吗?
at first, it was look like this, the text is cutted, but i wont bother to create an issue since i thought it was my game problem
but then this commit fix this issue
and the latest commit crash the game, it say something about yst00087.ybn, but i didnt even touch that file, since i'm working with yst00108.ybn
actually it doesnt matter since i can use the earlier version, but i just want to let you know it
感谢大佬的工具。
github里没有exe文件,所以我自己编译了一个。
通过Dir-A的教程找到了密钥0x96AC6FD3,同时Dir-A的密钥自动寻找工具也给了这个密钥。
在寻找opecodes时报错,调换大小端顺序没有效果。尝试了后二十个和前两个ybn文件也不行。
以下是我的命令和报错信息。
能帮忙看一下吗,谢谢!
命令:
./extybn -e -ybn yst00283.ybn -key 0x9bac6fd3 -output-opcode
错误信息:
runtime: VirtualAlloc of 1816657920 bytes failed with errno=1455
fatal error: out of memory
runtime stack:
runtime.throw({0xe1f3a8?, 0xd08b5ec000?})
A:/Programs/Go/src/runtime/panic.go:1077 +0x65 fp=0xbdc69ff528 sp=0xbdc69ff4f8 pc=0xd63d05
runtime.sysUsedOS(0xd07f282000, 0x6c480000)
A:/Programs/Go/src/runtime/mem_windows.go:83 +0x1bb fp=0xbdc69ff588 sp=0xbdc69ff528 pc=0xd4579b
runtime.sysUsed(...)
A:/Programs/Go/src/runtime/mem.go:77
runtime.(*mheap).allocSpan(0xf2c520, 0x36240, 0x0, 0x60?)
A:/Programs/Go/src/runtime/mheap.go:1351 +0x487 fp=0xbdc69ff628 sp=0xbdc69ff588 pc=0xd55547
runtime.(*mheap).alloc.func1()
A:/Programs/Go/src/runtime/mheap.go:968 +0x5c fp=0xbdc69ff670 sp=0xbdc69ff628 pc=0xd54cfc
traceback: unexpected SPWRITE function runtime.systemstack
runtime.systemstack()
A:/Programs/Go/src/runtime/asm_amd64.s:509 +0x49 fp=0xbdc69ff680 sp=0xbdc69ff670 pc=0xd8cbc9
大大您好,请问extYbn是不是不能解包yuris 555版本的ybn文件?我已经提取到密钥了,用extYbn 执行该命令:extYbn -e -ybn yst00274.ybn -txt yst00274.txt -key 0xEF16F974 来提取文本会报内存溢出的错误,如果用别的软件是可以解包出文本,但是导出来的是日文编码,最后导入只能用日文编码,这样会有一些中文词完全没法写入,因而希望能用extYbn来解决这个问题。
没有在release里找到extYbn.exe,于是自己编译了一个,使用的时候出现问题
通过观察得知密钥为0x263b0130
以下是我的报错,如果密钥不对,会出现内存不足的情况
D:\(workplace\yuris\extYbn>extYbn -e -ybn yst00007.ybn -output-opcode -key 0x30013b26 runtime: VirtualAlloc of 372916224 bytes failed with errno=1455 fatal error: out of memory
后来注意到大小端,再试了一下无法猜出opcodes,不知道是为什么
D:\(workplace\yuris\extYbn>extYbn -e -ybn yst00007.ybn -output-opcode -key 0x263b0130 Guess opcodes failed, msg op:0x0, call op:0x0
以下是ysbin附件,请大佬指教
ysbin.zip
这个格式是Lua5.3的编译脚本,咱试过luadec没能成功反编译。
不过我试了下和你一样的游戏,会抛出异常。估计可能是地址不对。
所以想来请教一下这个地址是怎么找的。
谢谢。
Hello!
Can you add game support?
Sono Hanabira ni Kuchizuke o *
在分析MalieSystem的时候文本回封出现了点问题,想借鉴一下巨巨的程序。奈何实在不会脱壳ThemIDA。
When I try to export ybn scripts from 00000 it gives me "cant guess the opcode", but trying to export 0018X, I got the desired result. Please help, I'm not good at programming at all...
I hope I'm not filling the bag, the last time you helped me a lot here by github issues and I came here to ask if you know any tool to repackage .pack files QLIE I to desperate and do not know who to ask, then I saw that you have the folder Qlie and decided to ask TT-TT sorry for the inconvenience
--sorry my english (i use google translate)
--i'am brazilian
(to koiken otome)
VN: eden*
Link: https://store.steampowered.com/app/315810/eden/
Engine: Musica (minori)
File extension: .paz
Hello! I had been wanting to retranslate this visual novel to my native language for a while now. Could your tools help with unpacking and repacking files? From what I've gathered so far, fuckpaz (from Inori/FuckGalEngine) and GARbro can decode earlier versions of eden*, but not the Steam version as it has different keys. I've asked here Inori/FuckGalEngine#37 and received instructions, but haven't been successful so far. Recently someone else Inori/FuckGalEngine#47 had successfully discovered 2 of 3 needed parts, so dat_key is remaining. Could you possibly help with that or know anyone else who could or already has done it? I have zero programming knowledge so any help or pointers are very appreciated.
Wonder if I did anything wrong.
https://user-images.githubusercontent.com/91543117/143775455-94c2f7fb-0562-4d99-8101-e0f2b0ce29b6.mp4
Hello, i have some issue when i want to build your catsystem2 tools
i run on win xp sp3, go 1.9.2 with internet connection
here is what i already tried:
download bstream and eutil,
extract them to working directory, didnt work
extract them to go path (go\bin\src) directory, didnt work
extract them to go root (go\bin) directory, didnt work
if i put them in the wrong place, where should i put them?
and since i think that the code may need some dependencies, i turn on my internet, but still no luck...
Hi. I would like to know if the tools are relevant for rugp 6.2? (Schwarzesmarken (https://vndb.org/v14910))
If so, how do I use them? As I see it, the tools are for python 2, not python 3.
In fact, the translation of Schwarzesmarken has been ready since 2019, but the translation has never been able to be built into the game.
大大您好,这里yuris版本479,密钥应是0x96ac6fd3,
extYbn 执行该命令extybn -e -ybn yst00027.ybn -key 0x96ac6fd3 -txt yst00027.ybn.txt
来提取文本会出现Guess opcodes failed, msg op:0x0, call op:0x1d
考虑到有大小端的区别,改执行extybn -e -ybn yst00027.ybn -key 0xd36fac96 -txt yst00027.ybn.txt
也会报错如下
也附上了解出来的ysbin文件,想请教大大这个问题是密钥出错还是缺少其他部分,感谢!
ysbin.zip
runtime: VirtualAlloc of 2527887360 bytes failed with errno=1455
fatal error: out of memory
runtime stack:
runtime.throw({0xfdab51?, 0xc611b57000?})
D:/go/src/runtime/panic.go:1047 +0x65 fp=0x3a5fbff570 sp=0x3a5fbff540 pc=0xf14d25
runtime.sysUsedOS(0xc5e2e08000, 0x96ac8000)
D:/go/src/runtime/mem_windows.go:83 +0x1c5 fp=0x3a5fbff5d0 sp=0x3a5fbff570 pc=0xef6385
runtime.sysUsed(0x10ee0a0?, 0x16d0203bb58?, 0xc000080100?)
D:/go/src/runtime/mem.go:77 +0x25 fp=0x3a5fbff5f0 sp=0x3a5fbff5d0 pc=0xef5e85
runtime.(*mheap).allocSpan(0x10ee0a0, 0x4b564, 0x0, 0x45?)
D:/go/src/runtime/mheap.go:1340 +0x455 fp=0x3a5fbff688 sp=0x3a5fbff5f0 pc=0xf060b5
runtime.(*mheap).alloc.func1()
D:/go/src/runtime/mheap.go:961 +0x65 fp=0x3a5fbff6d0 sp=0x3a5fbff688 pc=0xf05885
runtime.systemstack()
D:/go/src/runtime/asm_amd64.s:496 +0x48 fp=0x3a5fbff6d8 sp=0x3a5fbff6d0 pc=0xf3dd88
How to repack scripts, unpacked with ScriptParser?
如题所示。
直接Insert以后Shift_JIS以外的字符不兼容该令何解,如何兼容简中/繁中汉字和带调号的拼音呢?
Originally posted by @Shinya-Shimokawa in #15 (comment)
when i try to extract the script, it gave me "cant guess the op code"
Hi,
In yuris/extypf.py,
#py3.2
import struct
import zlib
import pdb
import bytefile
but there is no module named 'bytefile' in python3, would you tell me where to get this lib?
thanks~
Your extYbn go application lacks a guessing method for the XOR cipher key. I wrote an extraction tool for all the binary files of a ypf archive and discovered, that all code blocks of ybn files end with an END instruction, which seems to not change its value. As seen in my code here, it can be simply extracted for all cases I encountered. Since I pretty much abandoned my extractor and yours is almost at the top of search results and thus people new to the matter will find this first, I'd like to suggest adding this here aswell. For those without the proper keys.
Cheers
菊苣我想问一下在reallive里面那个extseen.py中的import strfile,这个貌似是自己写的库?可是我好像并没有找到这个文件。想问一下这个文件的具体实现,谢谢!
Hello, may I ask if the strfile package in some py files was written by myself? I did not find strfile.py in all files, may I ask if it was lost?
2016年后CIRCUS更新了引擎,新版的CIRCUS引擎的CRX图片貌似稍微更新了一下,不过还能用GARbro提取出来,但是用大佬你的DCPC图片编码处理回去后图片能够读取,但是整个图片就完全模糊了。
是不是和位深有关?新版的CRX的位深是24位,用DCPC图片编码后的位深是32位。另外是否和zlib压缩的级别有关?
I have tried it with the go build command, but i still get the same error report:
What am I doing wrong? I have downloaded all the packages and my program reports no issues until I start the go command (go run / go build)
And what should I insert here? th name of the .ybn-file?
And thanks for answering my last issue.
Hi when I using your tool ,click on the ext.exe to open it nothing happened ,I also tried to drag sys_title.hg3 from my game file into the exe but nothing come out
Can you make a wiki guide on how to use it and also the command example ?
https://disk.yandex.ru/d/LBurawmVm5KvHg
here is the sample file
ysbin.zip
Your extrld.py is the best code I can found for Exhibit on github right now, so I wonder if there will be an update for insert function since Ineditor is out of update? I can manage with the encryption, so what really bother me is how to insert the text back.
在extListBin.py里面似乎需要一个关于*.bin的toml文件,这玩意儿似乎需要自己写。
不过没怎么看明白要写些什么东西,可以说一下toml里面要记录些什么吗?
I've figured out most of the missing fields in the PNA per-frame structure. all fields except base X and Y are u32, base coordinates are i32.
Following steps 1 and 2, I was able to export 2 more files, but 00000 to 00122 are empty.
noiz.zip
yst00001.txt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.