Coder Social home page Coder Social logo

lucksystem's Introduction

Important

This project only accepts bug issues and pull requests, and does not provide assistance in use
此项目仅接受现有功能的BUG反馈和Pull requests,不提供使用上的帮助

Luck System

LucaSystem 引擎解析工具

使用方法:Usage

插件手册:Plugin

LucaSystem解析完成进度

Luca Pak 封包文件

  • 导出完成
  • 导入完成
    • 仅支持替换文件数据

Luca CZImage 图片文件

CZ0

  • 导出完成 32位
  • 导入完成 32位

CZ1

  • 导出完成 8位
  • 导入完成 8位

CZ2

  • 导出完成 8位
  • 导入完成 8位

CZ3

  • 导出完成 32位 24位
  • 导入完成 32位 24位

CZ4

  • LucaSystemTools中完成

CZ5

  • 未遇到

Luca Script 脚本文件

  • 导出完成
  • 导入完成
  • 简单的模拟执行
  • 支持插件扩展(gpython)
    • 非标准的Python,语法类似Python3.4,缺少大量的内置库和一些特性,基本使用没有问题
    • 插件手册 Plugin

笔记

根据时间,可以LucaSystem的脚本类型分为三个版本,目前仅研究V3版本,即最新版本。LucaSystemTools支持V2版本的脚本解析

类型 长度 名称 说明
uint16 2 len 代码长度
uint8 1 opcode 指令索引
uint8 1 flag 一个标志,值0~3
[]uint16 2 * n data0 未知参数,其中n=flag(flag<3),n=2(flag==3)
params len -4 -2*n params 参数
uint8 k align 补齐位,其中k=len%2

Luca Font 字体文件

  • 解析完成
  • 能够简单使用,生成指定文本的图像
  • 导出完成
  • 导入、制作完成

info文件

  • 导出完成
  • 导入完成

Luca OggPak 音频封包

  • 导出完成

目前支持的游戏

  1. 《LOOPERS》 Steam
  2. LB_EN:《Little Busters! English Edition》 Steam
  3. SP:《Summer Pockets》 Nintendo Switch

目前支持的指令

  • MESSAGE (LB_EN、SP、LOOPERS)

  • SELECT (LB_EN、SP)

  • IMAGELOAD (LB_EN、SP)

  • BATTLE (LB_EN)

  • EQU

  • EQUN

  • EQUV

  • ADD

  • RANDOM

  • IFN

  • IFY

  • GOTO

  • JUMP

  • FARCALL

  • GOSUB

更新日志

2.2.1 (2023.12.4)

  • 支持CartagraHD脚本导入导出(未测试)

2.2.0 (2023.12.3)

  • 支持CZ2的导入(未实际测试)

2.1.0 (2023.11.28)

  • 支持CZ2的导出

2023.10.7

  • 支持LOOPERS导入和导出(已测试)
  • 支持Plugin扩展以支持任意游戏
  • 内置SummerPockets(未测试)和LOOPERS默认Plugin插件和OPCODE
  • 移除模拟器相关代码

6.26

  • 完全重构cmd使用方式
    • 暂不支持script脚本的cmd调用
  • 支持24位cz3图像,修复缺少Colorblock值导致的错误
  • font插入新字符改为追加替换模式,总字符数增加或保持不变

3.15

  • 修复cz图像导出时alpha通道异常的问题

3.11

  • 修复script导入导出交互bug
  • 测试部分交互
  • 新增Usage文档

3.03

  • 完整的控制台交互接口(未测试)
  • 帮助文档

2.17

  • 统一cz、info、font、pak、script的接口
  • 完善测试用例

2.10

  • 统一接口规范

2.9

  • 修复script导入导出中换行、空行的问题
  • Merge AEBus pr
      1. Fixed situation when LuckSystem would stop parsing scripts after finding END opcode
      1. Added handling of TASK, SAYAVOICETEXT, VARSTR_SET opcodes, and fixed handling of BATTLE opcode.
      1. Added opcode names for LB_EN, changed first three opcodes to EQU, EQUN, EQUV as specified in LITBUS_WIN32.exe, added handling of these opcodes in LB_EN.go

1.25

  • 完成pak导入导出交互

1.22

  • 完成CZ1导入
  • 完成CZ0导出导入
  • 支持LB_EN BATTLE指令
  • 修正PAK文件ID,与脚本中的ID对应
  • 更换日志库为glog
  • 引入tui库tview

1.21

  • 完成LZW压缩
  • 完成图像拆分算法
  • 支持CZ3格式替换图像

2022.1.19

  • 支持替换pak文件内容并打包
    • 不支持修改文件名和增加文件
  • 不再以LucaSystem引擎模拟器为目标,现以替代LucaSystemTools项目为目标

8.13

  • 项目更名为LuckSystem
    • 目标为实现LucaSystem引擎的模拟器

8.12

  • 支持字库的加载
    • 字库info文件的解析与应用
    • 字库CZ1图像的解析
  • 现已支持根据文字内容,按指定字体生成文字图像

8.11

  • 支持动态加载pak中的文件
    • 加载pak仅加载pak文件头,内部文件需要时读取
  • 支持音频文件的oggpak的解包
  • 开始编写CZ图像解析
    • 完成通用lzw解压
    • 支持CZ3图像的加载

8.7

  • 完美支持脚本导出为文本、导入为脚本
  • 开始设计与编写模拟器主体

8.3

  • 支持pak文件的加载

8.1

  • 完成大部分导出模式功能
    • 解析文本
    • 合并导出参数和原脚本参数
    • 将文本中的数据合并到原脚本,并转为字节数据

7.28

  • 完善导出模式,支持更多指令

7.27 累积

  • 为虚拟机增加导入模式和导出模式
    • 导出模式:不执行引擎层代码,将脚本转为字符串并导出
    • 导入模式:开始设计与编写

7.13

  • 增加engine结构,即引擎层,与虚拟机做区分
    • 虚拟机:执行脚本内容,保存、计算变量等逻辑相关操作
    • 引擎:执行模拟器的显示、交互等

7.12

  • 支持表达式计算
    • 表达式的读取以及中缀表达式转后缀表达式
    • 后缀表达式的计算
  • 引擎中使用内置数据类型,不在使用包装数据类型

7.11

  • 重构代码结构,使用vm来处理脚本执行相关
  • 增加context,在执行中传递变量表等数据
  • 增加变量表,储存运行时变量
  • 优化参数的读取
  • 统一接口代码,虚拟机与引擎前端交互接口

6.30

  • 支持多游戏
  • 设计参数、函数等结构

6.28

  • 框架设计与编写
  • 第三方包的选择与测试
  • 支持LB_EN基本解析

计划

  • 支持更多LucaSystem引擎的游戏脚本解析
  • 完善引擎函数
  • 引擎层交互的初步实现

lucksystem's People

Contributors

aebus avatar wetor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lucksystem's Issues

Vertical text

Do you know how to change the text orientation from vertical to horizontal?
Screenshot 2024-01-09 154723

About CZ2 files

Hello, I understand that Lucksystem currently does not support decompressing cz2 files due to some issues your team is facing. However, it's sad that the Loopers (Steam) uses this cz2 format for fonts, and the project may postpone if this font type cannot be decompressed.

I thought that you are quite busy, so I researched on my own. In the end, I went down a similar dead-end as you: the images in the cz2 file are compressed using the lzw algorithm with some modifications, and it's quite peculiar.

Below is my analysis (please note that I'm not specialized in reverse engineering):

  • Taking the example of the file 明朝32, the compressed image data starts from offset 446h. I noticed that almost UInt16 values after that are even numbers
    image

  • So I made adjustments to the lzw algorithm in LucaSystemTool (I used the old tool because it already had a base implementation for cz2) as follows:
    image
    image

  • And this is result:
    明朝32

  • I believe this chaos begins at offset 102ECh, at which point Uint16 has a value of 159, which is the first odd value. This corresponds to the 32595th value in the List compressed. At this stage, I can't think of anything else to overcome the issue.

You may have thoroughly understood the analysis I raised above but haven't been able to resolve it yet. I hope that some day in the future, your team can discover a decompressed mechanism for this file type.
PS: this is font 明朝32.zip

Instruction for editing font file

I don't know how to append a character using ttf font file :)
My code:
lucksystem font edit -a -o "path to output file" -s ゴシック15 -S info15 -O "path to info output" -f "NotoSansMonoEX.ttf" -c a.txt
It runs without any errors but I can't extract the output file as cz1 image.
When replacing output in font.pak file, CLANNAD_SS keeps crashing.

Cannot decompile script because something wrong in python file

This is an error I encountered while decompiling the script, and it appears to be a Python file issue. Specifically, it cannot find the base.loopers library.
image

I noticed that the .gitignore file has excluded library file from the repository. I hope you can push them up.
image
Honestly, I don't have experience with Python nor Golang, so if there are any my mistakes, please correct me.
Thank you.

Bug for import image

When converting to CZ3, tool is using compressed size from source as some kind of limitation of how big 1 compressed image can be, which is not always correct. For Summer Pockets max size per each layer is 0xFEFD, and for some reason images converted by this tool with more than 1 layer are rendered as garbage by game except for first layer.

同学,您这个项目引入了12个开源组件,存在1个漏洞,辛苦升级一下

检测到 wetor/LuckSystem 一共引入了12个开源组件,存在1个漏洞

漏洞标题:go-yaml < 2.2.8拒绝服务漏洞
缺陷组件:gopkg.in/[email protected]
漏洞编号:CVE-2019-11254
漏洞描述:gopkg.in/yaml.v2是go语言中用于处理yaml格式的包。
在2.2.8之前的版本中,处理恶意的yaml数据时,会导致CPU资源耗尽。
漏洞由Kubernetes开发者在fuzz测试中发现并提交修复补丁。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-35519
影响范围:(∞, 2.2.8)
最小修复版本:2.2.8
缺陷组件引入路径:lucksystem@->gopkg.in/[email protected]

另外还有几个漏洞,详细报告:https://mofeisec.com/jr?p=a822f6

[Feature] Allow converting PNG to CZ without providing source

Since we don't have CZ2, CZ4 and CZ5 importer, current image import is blocking PNG images from converting into any CZ textures.

I know that some informations from header after converting to PNG are lost.
So either allow in CMD to set custom values, or just put default values (if image is 1280x720, put anchor at (0,0) and other dimensions at 1280x720) and people will fix it with hex editor if necessary.

Need help with Opcode- from Vietnam Key Fanclub

Hi!

I'm here representing Vietnam Key Fanclub and Minata Hatsune to open an issue regarding our problems with LuckSystem.

We are currently doing a patch for Loopers Steam version, and we are in trouble with the Script extracting because of opcode.txt. We tried to do something with your opcode tool, following the steps written in there but we couldn't make it.

So we hope that your team can give us a more detailed, clear guide about how to use that tool, and it will help us so much if you can provide something like videos recording the process or a careful step by step guide since we are all amateurs about coding stuff.

Sincerely thanks for your kind offer of assistance.

Add Support to Extract Extensionless Script

There don't seem to be any public tools that seem to support extracting scripts without an extension or header from SCRIPT.PAK so would it be possible to add support for it? I have provided the original SCRIPT.PAK file and one of the script files. The game in question is the PS Vita version of Amatsutsumi.
Thanks!
SCRIPT.zip

CZ4 files are not supported

I'm currently working with LOOPERS, their files have some CZ4 files, which can not be handled by this tool yet.
I wonder are there a way to work with CZ4 files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.