Skip to main content

Phigros Cloud Save Codec Library

Project description

Phi-Save-Codec-Bind-Python

Phi-Save-Codec 的 Python 绑定,用于解析和构建 Phigros 的云端存档格式。

安装

pip install -r requirements.txt

使用

from phi_save_codec import PhiSaveCodec, PhiSaveCodecError

# 初始化编解码器
codec = PhiSaveCodec("phi_save_codec.wasm")

# 解析二进制数据
try:
    user_data = codec.parse_user(binary_data)
    print(user_data)
except PhiSaveCodecError as e:
    print(f"解析失败: {e}")

# 构建二进制数据
try:
    binary_data = codec.build_user(user_dict)
except PhiSaveCodecError as e:
    print(f"构建失败: {e}")

支持的操作

  • parse_user() / build_user() - 用户数据
  • parse_summary() / build_summary() - 摘要数据
  • parse_game_record() / build_game_record() - 游戏记录
  • parse_game_progress() / build_game_progress() - 游戏进度
  • parse_game_key() / build_game_key() - 游戏密钥
  • parse_settings() / build_settings() - 设置数据

异常处理

所有 API 方法在错误时抛出 PhiSaveCodecError 异常:

try:
    data = codec.parse_user(binary_data)
except PhiSaveCodecError as e:
    # 获取详细的错误信息
    print(f"错误: {e}")

内存管理

该库自动处理与 WASM 模块之间的内存管理,包括:

  • 分配和释放内存
  • 获取和清空错误信息
  • 确保在函数调用前后正确管理临时内存

依赖

  • msgpack - 数据序列化
  • wasmtime - WASM 运行时支持

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phi_save_codec-0.2.2.tar.gz (120.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phi_save_codec-0.2.2-py3-none-any.whl (121.2 kB view details)

Uploaded Python 3

File details

Details for the file phi_save_codec-0.2.2.tar.gz.

File metadata

  • Download URL: phi_save_codec-0.2.2.tar.gz
  • Upload date:
  • Size: 120.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.23.1 CPython/3.13.2 Windows/11

File hashes

Hashes for phi_save_codec-0.2.2.tar.gz
Algorithm Hash digest
SHA256 03d856a280207e9856fbac281f330b72aa965a4ac6d9d1cc1352671e14540d39
MD5 555ddd056873e125d9aa886bd1f8852b
BLAKE2b-256 c3b98c61b77b93a3b67593b3df593ac5b462fbf22472d2111e5f56355c1fe377

See more details on using hashes here.

File details

Details for the file phi_save_codec-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: phi_save_codec-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 121.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.23.1 CPython/3.13.2 Windows/11

File hashes

Hashes for phi_save_codec-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a60fd2a1b9714eac9556b439b9625b21598a4eb7efc837e8e3de3abe895e1fc1
MD5 72a81196bccc913b3341de53c7381922
BLAKE2b-256 3618ee84897c27adf965ffa299dd5a3d1bf6576fc2b2b6c08e2f7e59c39cdd27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page