Documentation
¶
Index ¶
- Constants
- Variables
- type AnmModel
- type AnmService
- func (m *AnmService) ConvertAnmToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *AnmService) ConvertJsonToAnm(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *AnmService) ReadAnmFile(path string) (*COM3D2.Anm, error)
- func (m *AnmService) WriteAnmFile(path string, anmData *COM3D2.Anm) error
- type ArcService
- func (a *ArcService) CopyFile(fs *arc.Arc, srcPath string, dstPath string) error
- func (a *ArcService) CreateFile(fs *arc.Arc, path string, data []byte) error
- func (a *ArcService) DeleteFile(fs *arc.Arc, path string) error
- func (a *ArcService) ExtractFile(fs *arc.Arc, path string, outPath string) error
- func (a *ArcService) ExtractFiles(fs *arc.Arc, paths []string, outDir string) error
- func (a *ArcService) GetFileList(fs *arc.Arc) []string
- func (a *ArcService) MergeArc(fromArc *arc.Arc, toArc *arc.Arc, keepDupes bool) *arc.Arc
- func (a *ArcService) NewArc(name string) *arc.Arc
- func (a *ArcService) PackArc(dirPath string, arcPath string) error
- func (a *ArcService) ReadArc(path string) (*arc.Arc, error)
- func (a *ArcService) ReadArcLazy(path string) (*arc.Arc, io.Closer, error)
- func (a *ArcService) UnpackArc(path string, outDir string) error
- type ColModel
- type ColService
- func (m *ColService) ConvertColToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *ColService) ConvertJsonToCol(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *ColService) ReadColFile(path string) (*COM3D2.Col, error)
- func (m *ColService) WriteColFile(path string, colData *COM3D2.Col) error
- type CommonService
- type CovertTexToImageResult
- type DanceBytesType
- type DanceService
- func (s *DanceService) ConvertDanceObjectDataToJson(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
- func (s *DanceService) ConvertJsonToDanceObjectData(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
- func (s *DanceService) ConvertJsonToTimelineData(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
- func (s *DanceService) ConvertTimelineDataToJson(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
- func (s *DanceService) ReadDanceObjectDataFile(path string) (*COM3D2.DanceObjectData, error)
- func (s *DanceService) ReadTimelineDataFile(path string) (*COM3D2.TimelineData, error)
- func (s *DanceService) SniffDanceBytesType(path string) (DanceBytesType, error)
- func (s *DanceService) WriteDanceObjectDataFile(path string, data *COM3D2.DanceObjectData) error
- func (s *DanceService) WriteTimelineDataFile(path string, data *COM3D2.TimelineData) error
- type FileHeader
- type FileInfo
- type MateModel
- type MateService
- func (m *MateService) ConvertJsonToMate(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *MateService) ConvertMateToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *MateService) ReadMateFile(path string) (*COM3D2.Mate, error)
- func (m *MateService) WriteMateFile(path string, mateData *COM3D2.Mate) error
- type MenuModel
- type MenuService
- func (s *MenuService) ConvertJsonToMenu(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *MenuService) ConvertMenuToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *MenuService) ReadMenuFile(path string) (*COM3D2.Menu, error)
- func (s *MenuService) WriteMenuFile(path string, menuData *COM3D2.Menu) error
- type ModelModel
- type ModelService
- func (m *ModelService) ConvertJsonToModel(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *ModelService) ConvertModelToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *ModelService) ReadModelFile(path string) (*COM3D2.Model, error)
- func (m *ModelService) ReadModelMaterial(path string) ([]*COM3D2.Material, error)
- func (m *ModelService) ReadModelMetadata(path string) (*COM3D2.ModelMetadata, error)
- func (m *ModelService) WriteModelFile(outputPath string, modelData *COM3D2.Model) error
- func (m *ModelService) WriteModelMaterial(inputPath string, outputPath string, materials []*COM3D2.Material) error
- func (m *ModelService) WriteModelMetadata(inputPath string, outputPath string, metadata *COM3D2.ModelMetadata) error
- type NeiModel
- type NeiService
- func (s *NeiService) CSVFileToNei(path string) (*COM3D2.Nei, error)
- func (s *NeiService) CSVFileToNeiFile(inputPath string, outputPath string) error
- func (s *NeiService) CSVFileToNeiFileWithEncoding(inputPath string, outputPath string, encoding COM3D2.NeiTextEncoding) error
- func (s *NeiService) CSVToNei(csvData [][]string) (*COM3D2.Nei, error)
- func (s *NeiService) NeiFileToCSV(inputPath string) (csvData [][]string, err error)
- func (s *NeiService) NeiFileToCSVFile(inputPath string, outputPath string) error
- func (s *NeiService) NeiToCSV(neiData *COM3D2.Nei) (csvDate [][]string, err error)
- func (s *NeiService) NeiToCSVFile(neiData *COM3D2.Nei, outputPath string) error
- func (s *NeiService) ReadNeiFile(path string) (*COM3D2.Nei, error)
- func (s *NeiService) WriteNeiFile(neiData *COM3D2.Nei, path string) error
- type PMatModel
- type PMatService
- func (s *PMatService) ConvertJsonToPMat(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *PMatService) ConvertPMatToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *PMatService) ReadPMatFile(path string) (*COM3D2.PMat, error)
- func (s *PMatService) WritePMatFile(path string, PMatData *COM3D2.PMat) error
- type PhyModel
- type PhyService
- func (m *PhyService) ConvertJsonToPhy(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *PhyService) ConvertPhyToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *PhyService) ReadPhyFile(path string) (*COM3D2.Phy, error)
- func (m *PhyService) WritePhyFile(path string, phyData *COM3D2.Phy) error
- type PresetModel
- type PresetService
- func (s *PresetService) ConvertJsonToPreset(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *PresetService) ConvertPresetToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (s *PresetService) ReadPresetFile(path string) (*COM3D2.Preset, error)
- func (s *PresetService) ReadPresetFileMetadata(path string) (*COM3D2.PresetMetadata, error)
- func (s *PresetService) WritePresetFile(path string, PresetData *COM3D2.Preset) error
- type PskModel
- type PskService
- func (m *PskService) ConvertJsonToPsk(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *PskService) ConvertPskToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
- func (m *PskService) ReadPskFile(path string) (*COM3D2.Psk, error)
- func (m *PskService) WritePskFile(path string, pskData *COM3D2.Psk) error
- type TexModel
- type TexService
- func (t *TexService) CheckImageMagick() bool
- func (t *TexService) ConvertAnyToAnyAndWrite(inputPath string, texName string, compress bool, forcePNG bool, ...) error
- func (t *TexService) ConvertAnyToPng(inputPath string) (Base64EncodedPngData string, err error)
- func (t *TexService) ConvertImageToTex(inputPath string, texName string, compress bool, forcePNG bool) (*COM3D2.Tex, error)
- func (t *TexService) ConvertImageToTexAndWrite(inputPath string, texName string, compress bool, forcePNG bool, ...) error
- func (t *TexService) ConvertTexToImageAndWrite(inputPath string, outputPath string, forcePng bool) error
- func (t *TexService) CovertTexToImage(inputPath string, forcePng bool) (covertTexToImageResult CovertTexToImageResult, err error)
- func (t *TexService) ReadTexFile(path string) (*COM3D2.Tex, error)
- func (t *TexService) WriteTexFile(path string, TexData *COM3D2.Tex) error
Constants ¶
const ( UnknowGame = "Unknown" NoneGame = "None" GameCOM3D2 = "COM3D2" GameKCES = "KCES" )
游戏名称
const ( FormatUnknown = "Unknown" FormatBinary = "binary" FormatJSON = "json" FormatCSV = "csv" )
文件类型
const ( UnknownFileType = "Unknown" UnknownSignature = "Unknown" )
const (
SignatureNone = "None"
)
Variables ¶
var NoneGameFileTypeSet = map[string]struct{}{
"csv": {},
"json": {},
}
var SpecialFileTypeSet = map[string]struct{}{
"nei": {},
"bytes": {},
}
SpecialFileTypeSet 特殊文件类型集合,用于判断文件类型
Functions ¶
This section is empty.
Types ¶
type AnmService ¶
type AnmService struct{}
AnmService 专门处理 .anm 文件的读写
func (*AnmService) ConvertAnmToJson ¶
func (m *AnmService) ConvertAnmToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertAnmToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*AnmService) ConvertJsonToAnm ¶
func (m *AnmService) ConvertJsonToAnm(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToAnm 接收输入文件路径和输出文件路径,将输入文件转换为 .anm 文件
func (*AnmService) ReadAnmFile ¶
func (m *AnmService) ReadAnmFile(path string) (*COM3D2.Anm, error)
ReadAnmFile 读取 .anm 或 .anm.json 文件并返回对应结构体
func (*AnmService) WriteAnmFile ¶
func (m *AnmService) WriteAnmFile(path string, anmData *COM3D2.Anm) error
WriteAnmFile 接收 Anm 数据并写入 .anm 文件或 .anm.json 文件
type ArcService ¶
type ArcService struct{}
func (*ArcService) CreateFile ¶
CreateFile 在 Arc 中创建或更新文件 在目录树中,相对于给定的父目录,在指定路径处创建一个文件节点。
func (*ArcService) DeleteFile ¶
func (a *ArcService) DeleteFile(fs *arc.Arc, path string) error
DeleteFile 在 Arc 中删除文件
func (*ArcService) ExtractFile ¶
ExtractFile 从 Arc 中提取单个文件
func (*ArcService) ExtractFiles ¶
ExtractFiles 从 Arc 中提取多个文件到指定目录
func (*ArcService) GetFileList ¶
func (a *ArcService) GetFileList(fs *arc.Arc) []string
GetFileList 获取 Arc 中的所有文件列表(相对路径)
func (*ArcService) MergeArc ¶
MergeArc 将 fromArc 合并到 toArc 中。如果 keepDupes 为真,则使用文件的完整路径作为键;否则使用最后一个段。
func (*ArcService) PackArc ¶
func (a *ArcService) PackArc(dirPath string, arcPath string) error
PackArc 将文件夹打包为 .arc 文件
func (*ArcService) ReadArc ¶
func (a *ArcService) ReadArc(path string) (*arc.Arc, error)
ReadArc 读取 .arc 文件并返回对应结构体 arc 数据将被完整读入内存,请注意占用
func (*ArcService) ReadArcLazy ¶
ReadArcLazy 读取 .arc 文件并返回对应结构体 不会将所有数据都读入内存,而是在需要时从文件读取 因此读取完成后,调用者必须关闭返回的 io.Closer
type ColModel ¶
type ColModel struct{}
ColModel 用于让 wails 识别 col 对应结构体
func (*ColModel) Dummy ¶
func (s *ColModel) Dummy(COM3D2.Col, COM3D2.DynamicBoneColliderBase, COM3D2.DynamicBoneCollider, COM3D2.DynamicBoneMuneCollider, COM3D2.DynamicBonePlaneCollider, COM3D2.MissingCollider)
Dummy 用于让 wails 识别 col 对应结构体,需要在签名中使用所有结构体
type ColService ¶
type ColService struct{}
ColService 专门处理 .col 文件的读写
func (*ColService) ConvertColToJson ¶
func (m *ColService) ConvertColToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertColToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*ColService) ConvertJsonToCol ¶
func (m *ColService) ConvertJsonToCol(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToCol 接收输入文件路径和输出文件路径,将输入文件转换为 .col 文件
func (*ColService) ReadColFile ¶
func (m *ColService) ReadColFile(path string) (*COM3D2.Col, error)
ReadColFile 读取 .col 或 .col.json 文件并返回对应结构体
func (*ColService) WriteColFile ¶
func (m *ColService) WriteColFile(path string, colData *COM3D2.Col) error
WriteColFile 接收 Col 数据并写入 .col 或 .col.json 文件
type CommonService ¶
type CommonService struct{}
func (*CommonService) FileTypeDetermine ¶
func (m *CommonService) FileTypeDetermine(path string, strictMode bool) (fileInfo FileInfo, err error)
FileTypeDetermine 判断文件类型,支持二进制和 JSON 格式 strictMode 为 true 时,严格按照文件内容判断文件类型 strictMode 为 false 时,优先根据文件后缀判断文件类型,如果无法判断再根据文件内容判断
func (*CommonService) TryFileTypeDetermine ¶
func (m *CommonService) TryFileTypeDetermine(path string) (fileInfo FileInfo, matched bool, err error)
TryFileTypeDetermine performs a cheap, exact COM3D2 signature probe. Unlike FileTypeDetermine in strict mode it does not try image, NEI, CSV, or extension heuristics, so CLI callers can put the common COM3D2 path first without reading an entire unrelated KCES bundle before falling back to KCES probes.
type CovertTexToImageResult ¶
type CovertTexToImageResult struct {
Base64EncodedImageData string
Format string
Rects []COM3D2.TexRect
}
CovertTexToImageResult 前端不接受多个返回值,因此使用结构体
type DanceBytesType ¶
type DanceBytesType string
DanceBytesType 表示 .bytes 文件子类型
const ( DanceBytesTimeline DanceBytesType = "timeline" // timeline_data.bytes DanceBytesObjectData DanceBytesType = "object_data" // maid_data.bytes / item_data.bytes / event_data.bytes DanceBytesUnknown DanceBytesType = "unknown" // 无法识别 )
type DanceService ¶
type DanceService struct{}
DanceService 处理舞蹈相关的 .bytes 文件读写
func (*DanceService) ConvertDanceObjectDataToJson ¶
func (s *DanceService) ConvertDanceObjectDataToJson(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
ConvertDanceObjectDataToJson 将 .bytes 转为 .json
func (*DanceService) ConvertJsonToDanceObjectData ¶
func (s *DanceService) ConvertJsonToDanceObjectData(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
ConvertJsonToDanceObjectData 将 .json 转为 .bytes
func (*DanceService) ConvertJsonToTimelineData ¶
func (s *DanceService) ConvertJsonToTimelineData(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
ConvertJsonToTimelineData 将 .json 转为 timeline_data.bytes
func (*DanceService) ConvertTimelineDataToJson ¶
func (s *DanceService) ConvertTimelineDataToJson(ctx context.Context, inputPath, outputPath string, maxOutputBytes int64) error
ConvertTimelineDataToJson 将 timeline_data.bytes 转为 .json
func (*DanceService) ReadDanceObjectDataFile ¶
func (s *DanceService) ReadDanceObjectDataFile(path string) (*COM3D2.DanceObjectData, error)
ReadDanceObjectDataFile 读取 maid_data/item_data/event_data .bytes 或 .json 文件
func (*DanceService) ReadTimelineDataFile ¶
func (s *DanceService) ReadTimelineDataFile(path string) (*COM3D2.TimelineData, error)
ReadTimelineDataFile 读取 timeline_data.bytes 或对应 .json 文件
func (*DanceService) SniffDanceBytesType ¶
func (s *DanceService) SniffDanceBytesType(path string) (DanceBytesType, error)
SniffDanceBytesType 通过读取文件头判断 .bytes 文件子类型 "BaseData" 字符串开头则为 timeline;否则视为 object_data(其首字段为 int32 count)
func (*DanceService) WriteDanceObjectDataFile ¶
func (s *DanceService) WriteDanceObjectDataFile(path string, data *COM3D2.DanceObjectData) error
WriteDanceObjectDataFile 写出 maid_data/item_data/event_data .bytes 或 .json 文件
func (*DanceService) WriteTimelineDataFile ¶
func (s *DanceService) WriteTimelineDataFile(path string, data *COM3D2.TimelineData) error
WriteTimelineDataFile 写出 timeline_data.bytes 或对应 .json 文件
type FileHeader ¶
FileHeader 用于 JSON 部分读取的结构
type FileInfo ¶
type FileInfo struct {
FileType string `json:"FileType"` // 文件类型名称
StorageFormat string `json:"StorageFormat"` // 用于区分二进制和 JSON 格式 binary/json,见顶部常量定义
Game string `json:"Game"` // 游戏名称 COM3D2/KCES,见顶部常量定义
Signature string `json:"Signature"` // 文件签名
Version int32 `json:"Version"` // 文件版本
Path string `json:"Path"` // 文件路径
Size int64 `json:"Size"` // 文件大小
}
FileInfo 用于表示文件类型的结构
type MateModel ¶
type MateModel struct{}
MateModel 用于让 wails 识别 mate 对应结构体
func (*MateModel) Dummy ¶
func (s *MateModel) Dummy(COM3D2.Mate, COM3D2.Material, COM3D2.TexProperty, COM3D2.Tex2DSubProperty, COM3D2.TexRTSubProperty, COM3D2.ColProperty, COM3D2.VecProperty, COM3D2.FProperty, COM3D2.RangeProperty, COM3D2.TexOffsetProperty, COM3D2.TexScaleProperty, COM3D2.KeywordProperty, COM3D2.Keyword)
Dummy 用于让 wails 识别 mate 对应结构体,需要在签名中使用所有结构体
type MateService ¶
type MateService struct{}
MateService 专门处理 .mate 文件的读写
func (*MateService) ConvertJsonToMate ¶
func (m *MateService) ConvertJsonToMate(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToMate 接收输入文件路径和输出文件路径,将输入文件转换为 .mate 文件
func (*MateService) ConvertMateToJson ¶
func (m *MateService) ConvertMateToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertMateToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*MateService) ReadMateFile ¶
func (m *MateService) ReadMateFile(path string) (*COM3D2.Mate, error)
ReadMateFile 读取 .mate 或 .mate.json 文件并返回对应结构体
func (*MateService) WriteMateFile ¶
func (m *MateService) WriteMateFile(path string, mateData *COM3D2.Mate) error
WriteMateFile 接收 Mate 数据并写入 .mate 或 .mate.json 文件
type MenuService ¶
type MenuService struct{}
MenuService 专门处理 .menu 文件的读写
func (*MenuService) ConvertJsonToMenu ¶
func (s *MenuService) ConvertJsonToMenu(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToMenu 接收输入文件路径和输出文件路径,将输入文件转换为 .menu 文件
func (*MenuService) ConvertMenuToJson ¶
func (s *MenuService) ConvertMenuToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertMenuToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*MenuService) ReadMenuFile ¶
func (s *MenuService) ReadMenuFile(path string) (*COM3D2.Menu, error)
ReadMenuFile 读取 .menu 或 .menu.json 文件并返回对应结构体
func (*MenuService) WriteMenuFile ¶
func (s *MenuService) WriteMenuFile(path string, menuData *COM3D2.Menu) error
WriteMenuFile 接收 Menu 数据并写入 .menu 或 .menu.json 文件
type ModelModel ¶
type ModelModel struct{}
func (*ModelModel) Dummy ¶
func (s *ModelModel) Dummy(COM3D2.Model, COM3D2.Bone, COM3D2.Vertex, COM3D2.Vertex, COM3D2.BoneWeight, COM3D2.Matrix4x4, COM3D2.MorphData, COM3D2.SkinThickness, COM3D2.ThickGroup, COM3D2.ThickPoint, COM3D2.ThickDefPerAngle, COM3D2.Vector2, COM3D2.Vector3, COM3D2.Quaternion, COM3D2.Material)
Dummy 用于让 wails 识别 model 对应结构体,需要在签名中使用所有结构体
type ModelService ¶
type ModelService struct{}
ModelService 专门处理 .model 文件的读写
func (*ModelService) ConvertJsonToModel ¶
func (m *ModelService) ConvertJsonToModel(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToModel 接收输入文件路径和输出文件路径,将输入文件转换为 .model 文件
func (*ModelService) ConvertModelToJson ¶
func (m *ModelService) ConvertModelToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertModelToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*ModelService) ReadModelFile ¶
func (m *ModelService) ReadModelFile(path string) (*COM3D2.Model, error)
ReadModelFile 读取 .model 或 .model.json 文件并返回对应结构体
func (*ModelService) ReadModelMaterial ¶
func (m *ModelService) ReadModelMaterial(path string) ([]*COM3D2.Material, error)
ReadModelMaterial 读取 .model 文件,但只返回其中的材质数据
func (*ModelService) ReadModelMetadata ¶
func (m *ModelService) ReadModelMetadata(path string) (*COM3D2.ModelMetadata, error)
ReadModelMetadata 读取.model 文件,但只返回其中的元数据
func (*ModelService) WriteModelFile ¶
func (m *ModelService) WriteModelFile(outputPath string, modelData *COM3D2.Model) error
WriteModelFile 接收 Model 数据并写入 .model 文件或 .model.json 文件
func (*ModelService) WriteModelMaterial ¶
func (m *ModelService) WriteModelMaterial(inputPath string, outputPath string, materials []*COM3D2.Material) error
WriteModelMaterial 接收 Material 数据并写入.model 文件 因为 Material 数据是在 Model 结构体中,所以需要先读取整个 Model 结构体,然后修改其中的 Material 数据,最后再写入文件 因此这里需要传入输入文件路径和输出文件路径,分别用于读取和写入.model 文件,可以为相同路径
func (*ModelService) WriteModelMetadata ¶
func (m *ModelService) WriteModelMetadata(inputPath string, outputPath string, metadata *COM3D2.ModelMetadata) error
WriteModelMetadata 将元数据写入现有的 .model 文件
type NeiService ¶
type NeiService struct{}
NeiService 专门处理 .nei 文件的读写
func (*NeiService) CSVFileToNei ¶
func (s *NeiService) CSVFileToNei(path string) (*COM3D2.Nei, error)
CSVFileToNei 读取 .csv 文件并返回对应的 Nei 结构体
func (*NeiService) CSVFileToNeiFile ¶
func (s *NeiService) CSVFileToNeiFile(inputPath string, outputPath string) error
CSVFileToNeiFile 将 CSV 文件转换为 Nei 文件,单元格按 Shift-JIS 编码写出 CSVFileToNeiFile converts a CSV file to a Nei file, writing cells in Shift-JIS
func (*NeiService) CSVFileToNeiFileWithEncoding ¶
func (s *NeiService) CSVFileToNeiFileWithEncoding(inputPath string, outputPath string, encoding COM3D2.NeiTextEncoding) error
CSVFileToNeiFileWithEncoding 将 CSV 文件转换为使用指定单元格编码的 Nei 文件 COM3D2 按 Shift-JIS 读取 .nei,KCES 按 UTF-8 读取,选错编码会让游戏显示乱码 CSVFileToNeiFileWithEncoding converts a CSV file to a Nei file using the selected cell encoding COM3D2 reads .nei as Shift-JIS while KCES reads it as UTF-8, and the wrong choice makes the game display garbage
func (*NeiService) CSVToNei ¶
func (s *NeiService) CSVToNei(csvData [][]string) (*COM3D2.Nei, error)
CSVToNei 将 CSV 结构转换为 Nei 结构体
func (*NeiService) NeiFileToCSV ¶
func (s *NeiService) NeiFileToCSV(inputPath string) (csvData [][]string, err error)
NeiFileToCSV 读取 .nei 文件并返回对应的 CSV 结构体
func (*NeiService) NeiFileToCSVFile ¶
func (s *NeiService) NeiFileToCSVFile(inputPath string, outputPath string) error
NeiFileToCSVFile 将 Nei 文件转换为 CSV 文件
func (*NeiService) NeiToCSV ¶
func (s *NeiService) NeiToCSV(neiData *COM3D2.Nei) (csvDate [][]string, err error)
NeiToCSV 将 Nei 结构体转换为 CSV 结构
func (*NeiService) NeiToCSVFile ¶
func (s *NeiService) NeiToCSVFile(neiData *COM3D2.Nei, outputPath string) error
NeiToCSVFile 将 Nei 结构体转换为 CSV 文件
func (*NeiService) ReadNeiFile ¶
func (s *NeiService) ReadNeiFile(path string) (*COM3D2.Nei, error)
ReadNeiFile 读取 .nei 文件并返回对应结构体
func (*NeiService) WriteNeiFile ¶
func (s *NeiService) WriteNeiFile(neiData *COM3D2.Nei, path string) error
WriteNeiFile 接收 Nei 数据并写入 .nei 文件
type PMatService ¶
type PMatService struct{}
PMatService 专门处理 .pmat 文件的读写
func (*PMatService) ConvertJsonToPMat ¶
func (s *PMatService) ConvertJsonToPMat(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToPMat 接收输入文件路径和输出文件路径,将输入文件转换为 .pmat 文件
func (*PMatService) ConvertPMatToJson ¶
func (s *PMatService) ConvertPMatToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertPMatToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*PMatService) ReadPMatFile ¶
func (s *PMatService) ReadPMatFile(path string) (*COM3D2.PMat, error)
ReadPMatFile 读取 .pmat 或 .pmat.json 文件并返回对应结构体
func (*PMatService) WritePMatFile ¶
func (s *PMatService) WritePMatFile(path string, PMatData *COM3D2.PMat) error
WritePMatFile 接收 PMat 数据并写入 .pmat 或 .pmat.json 文件
type PhyService ¶
type PhyService struct{}
PhyService 专门处理 .phy 文件的读写
func (*PhyService) ConvertJsonToPhy ¶
func (m *PhyService) ConvertJsonToPhy(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToPhy 接收输入文件路径和输出文件路径,将输入文件转换为 .phy 文件
func (*PhyService) ConvertPhyToJson ¶
func (m *PhyService) ConvertPhyToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertPhyToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*PhyService) ReadPhyFile ¶
func (m *PhyService) ReadPhyFile(path string) (*COM3D2.Phy, error)
ReadPhyFile 读取 .phy 或 .phy.json 文件并返回对应结构体
func (*PhyService) WritePhyFile ¶
func (m *PhyService) WritePhyFile(path string, phyData *COM3D2.Phy) error
WritePhyFile 接收 Phy 数据并写入 .phy 或 .phy.json 文件
type PresetModel ¶
type PresetModel struct{}
func (*PresetModel) Dummy ¶
func (s *PresetModel) Dummy(COM3D2.Preset, COM3D2.PresetMetadata, COM3D2.PresetProperty, COM3D2.PresetPropertyList, COM3D2.BoneAttachPosEntry, COM3D2.VtxAttachPosEntry, COM3D2.MatPropSaveEntry, COM3D2.BoneLengthEntry, COM3D2.SubProp, COM3D2.BoneAttachPos, COM3D2.VtxAttachPos, COM3D2.MatPropSave, COM3D2.MultiColor, COM3D2.PartsColor, COM3D2.BodyProperty, serializationKCES.ExpandedKCESPreset, serializationKCES.ExpandedKCESPresetCore, serializationKCES.KCESPresetPropertyList, serializationKCES.KCESPresetColorData, serializationKCES.KCESPresetBodyData, serializationKCES.KCESPresetEditBaseData, serializationKCES.KCESPresetEditUnitData, serializationKCES.KCESPresetEditColorPreset, serializationKCES.ColorPreset)
Dummy 用于让 wails 识别 preset 对应结构体,需要在签名中使用所有结构体
type PresetService ¶
type PresetService struct{}
PresetService 专门处理 .preset 文件的读写
func (*PresetService) ConvertJsonToPreset ¶
func (s *PresetService) ConvertJsonToPreset(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToPreset 接收输入文件路径和输出文件路径,将输入文件转换为 .preset 文件
func (*PresetService) ConvertPresetToJson ¶
func (s *PresetService) ConvertPresetToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertPresetToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*PresetService) ReadPresetFile ¶
func (s *PresetService) ReadPresetFile(path string) (*COM3D2.Preset, error)
ReadPresetFile 读取 .preset 或 .preset.json 文件并返回对应结构体
func (*PresetService) ReadPresetFileMetadata ¶
func (s *PresetService) ReadPresetFileMetadata(path string) (*COM3D2.PresetMetadata, error)
ReadPresetFileMetadata 读取 .preset 或 .preset.json 文件并返回对应结构体,仅包含预览图等元数据
func (*PresetService) WritePresetFile ¶
func (s *PresetService) WritePresetFile(path string, PresetData *COM3D2.Preset) error
WritePresetFile 接收 Preset 数据并写入 .preset 或 .preset.json 文件
type PskService ¶
type PskService struct{}
PskService 专门处理 .psk 文件的读写
func (*PskService) ConvertJsonToPsk ¶
func (m *PskService) ConvertJsonToPsk(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertJsonToPsk 接收输入文件路径和输出文件路径,将输入文件转换为 .psk 文件
func (*PskService) ConvertPskToJson ¶
func (m *PskService) ConvertPskToJson(ctx context.Context, inputPath string, outputPath string, maxOutputBytes int64) error
ConvertPskToJson 接收输入文件路径和输出文件路径,将输入文件转换为 .json 文件
func (*PskService) ReadPskFile ¶
func (m *PskService) ReadPskFile(path string) (*COM3D2.Psk, error)
ReadPskFile 读取 .psk 或 .psk.json 文件并返回对应结构体
func (*PskService) WritePskFile ¶
func (m *PskService) WritePskFile(path string, pskData *COM3D2.Psk) error
WritePskFile 接收 Psk 数据并写入 .psk 或 .psk.json 文件
type TexService ¶
type TexService struct{}
TexService 专门处理 .tex 文件的读写
func (*TexService) CheckImageMagick ¶
func (t *TexService) CheckImageMagick() bool
CheckImageMagick 检查是否安装了 ImageMagick
func (*TexService) ConvertAnyToAnyAndWrite ¶
func (t *TexService) ConvertAnyToAnyAndWrite(inputPath string, texName string, compress bool, forcePNG bool, outputPath string) error
ConvertAnyToAnyAndWrite 任意 ImageMagick 支持的格式和 .tex 转换为任意 ImageMagick 支持的格式,并写出 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 转换为图片时: 输出格式根据输出路径后缀决定,如果 forcePng 为 true 则强制输出为 PNG,但是如果输出格式为 .tex 则输出为.tex 转换为 .tex 时: 如果 forcePNG 为 true,且 compress 为 false,则 tex 的数据位是原始 PNG 数据或转换为 PNG 如果 forcePNG 为 false,且 compress 为 false,那么检查输入格式是否是 PNG 或 JPG,如果是则数据位直接使用原始图片,否则如果原始格式有损且无透明通道则转换为 JPG,否则转换为 PNG 如果 forcePNG 为 true,且 compress 为 true,那么 compress 标识会被忽略,结果同 forcePNG 为 true,且 compress 为 false 如果 forcePNG 为 false,且 compress 为 true,那么会对结果进行 DXT 压缩,数据位为 DDS 数据,根据有无透明通道选择 DXT1 或 DXT5 如果输入输出都是 .tex,则原样复制,只不过是先读取再写出
func (*TexService) ConvertAnyToPng ¶
func (t *TexService) ConvertAnyToPng(inputPath string) (Base64EncodedPngData string, err error)
ConvertAnyToPng 任意 ImageMagick 支持的格式转换为 PNG,包括 .tex 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 输出为 base64 编码的 PNG 数据
func (*TexService) ConvertImageToTex ¶
func (t *TexService) ConvertImageToTex(inputPath string, texName string, compress bool, forcePNG bool) (*COM3D2.Tex, error)
ConvertImageToTex 将任意 ImageMagick 支持的文件格式转换为 tex 格式,但不写出 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 如果 forcePNG 为 true,且 compress 为 false,则 tex 的数据位是原始 PNG 数据或转换为 PNG 如果 forcePNG 为 false,且 compress 为 false,那么检查输入格式是否是 PNG 或 JPG,如果是则数据位直接使用原始图片,否则如果原始格式有损且无透明通道则转换为 JPG,否则转换为 PNG 如果 forcePNG 为 true,且 compress 为 true,那么 compress 标识会被忽略,结果同 forcePNG 为 true,且 compress 为 false 如果 forcePNG 为 false,且 compress 为 true,那么会对结果进行 DXT 压缩,数据位为 DDS 数据,根据有无透明通道选择 DXT1 或 DXT5 如果要生成 1011 版本的 tex(纹理图集),需要在图片目录下有一个同名的 .uv.csv 文件(例如 foo.png 对应 foo.png.uv.csv),文件内容为矩形数组 x, y, w, h 一行一组 否则生成 1010 版本的 tex
func (*TexService) ConvertImageToTexAndWrite ¶
func (t *TexService) ConvertImageToTexAndWrite(inputPath string, texName string, compress bool, forcePNG bool, outputPath string) error
ConvertImageToTexAndWrite 将任意 ImageMagick 支持的文件格式转换为 tex 格式,但不写出 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 如果 forcePNG 为 true,且 compress 为 false,则 tex 的数据位是原始 PNG 数据或转换为 PNG 如果 forcePNG 为 false,且 compress 为 false,那么检查输入格式是否是 PNG 或 JPG,如果是则数据位直接使用原始图片,否则如果原始格式有损且无透明通道则转换为 JPG,否则转换为 PNG 如果 forcePNG 为 true,且 compress 为 true,那么 compress 标识会被忽略,结果同 forcePNG 为 true,且 compress 为 false 如果 forcePNG 为 false,且 compress 为 true,那么会对结果进行 DXT 压缩,数据位为 DDS 数据,根据有无透明通道选择 DXT1 或 DXT5 如果要生成 1011 版本的 tex(纹理图集),需要在图片目录下有一个同名的 .uv.csv 文件(例如 foo.png 对应 foo.png.uv.csv),文件内容为矩形数组 x, y, w, h 一行一组,否则生成 1010 版本的 tex 如果输入输出都是 .tex,则原样复制
func (*TexService) ConvertTexToImageAndWrite ¶
func (t *TexService) ConvertTexToImageAndWrite(inputPath string, outputPath string, forcePng bool) error
ConvertTexToImageAndWrite 将 .tex 文件转换为图像文件,并写出 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 如果 forcePNG 为 false 那么如果图像是有损格式且没有透明通道,则保存为 JPG,否则保存为 PNG 如果 forcePNG 为 true 则强制保存为 PNG,不考虑图像格式和透明通道 如果是 1011 版本的 tex(纹理图集),则还会生成一个 .uv.csv 文件(例如 foo.png 对应 foo.png.uv.csv),文件内容为矩形数组 x, y, w, h 一行一组
func (*TexService) CovertTexToImage ¶
func (t *TexService) CovertTexToImage(inputPath string, forcePng bool) (covertTexToImageResult CovertTexToImageResult, err error)
CovertTexToImage 将 .tex 文件转换为图像文件,但不写出 依赖外部库 ImageMagick,且有 Path 环境变量可以直接调用 magick 命令 如果 forcePNG 为 false 那么如果图像数据位是 JPG 或 PNG 则直接返回数据为,否则根据有没有透明通道保存为 JPG 或 PNG 如果 forcePNG 为 true 则强制保存为 PNG,不考虑图像格式和透明通道 如果是 1011 版本的 tex(纹理图集),则还会返回 rects
func (*TexService) ReadTexFile ¶
func (t *TexService) ReadTexFile(path string) (*COM3D2.Tex, error)
ReadTexFile 读取 .tex 文件并返回对应结构体
func (*TexService) WriteTexFile ¶
func (t *TexService) WriteTexFile(path string, TexData *COM3D2.Tex) error
WriteTexFile 接收 Tex 数据并写入 .tex 文件