Git Product home page Git Product logo

phigros-save-manager's Introduction

phigros-save-manager

A simple libaray for modify Phigros cloud save data.

996.icu LICENSE npm


Features

  • Load binary format save files from local or cloud. Supported version:
    • user: 1 (Latest)
    • settings: 1 (Latest)
    • gameRecord: 1 (Latest)
    • gameKey: 2 (Latest)
    • gameProgress: 3 (Latest)
  • Easly modify save from code.
  • (Re)Create binary save files from code.
  • Download save file from cloud.
  • Upload modified save file to cloud.
  • Convient shortcuts
    • re8
      • re8: Reset the chapter 8
      • parcialRe8: Reset half of the chapter 8
      • rere8: Unlock all songs in the chapter 8

CLI Usage

phigros-save-manager provides a useful CLI to easily reset chapter 8, backup your cloud save, and other debug utilities.

You can use the following command to get detialed subcommand explaination.

phigrous-save-manager

Future plans

  • Add support for calculating B19.
  • Add tests.
  • Migrate old code.

Examples

// Example: re8 (aka clear unlocks in chapter 8)

import { PhigrosSaveManager } from 'phigros-save-manager'

const saveManager = await PhigrosSaveManager.loadCloudSave("<Your Session Token>")
await saveManager.re8().uploadSave()
// Example: Edit in-game currency (money):

import { PhigrosSaveManager } from 'phigros-save-manager'

const saveManager = await PhigrosSaveManager.loadCloudSave("<Your Session Token>")

saveManager.gameProgress.money[0] = 99
saveManager.gameProgress.money[1] = 99
saveManager.gameProgress.money[2] = 99
saveManager.gameProgress.money[3] = 99
saveManager.gameProgress.money[4] = 99

await saveManager.uploadSave()
// Exmaple: Edit 'gameProgress' from binary

import { PhigrosSaveManager, PlayerGameProgress } from "."
import fs from 'fs'

const binary = new PlayerGameProgress(PhigrosSaveManager.decrypt(fs.readFileSync("/path/to/gameProgress")));
binary.money[0] = 99

// You'll need a type because the version number is inserted at here
fs.writeFileSync("/path/to/gameProgress", PhigrosSaveManager.encrypt(binary.save(), 'gameProgress'))

phigros-save-manager's People

Contributors

lamadaemon avatar

Stargazers

 avatar MirrorX avatar 233355607 avatar 千柒 avatar BlingCc avatar  avatar  avatar Rice avatar  avatar Qumolama.d avatar

Watchers

Rice avatar  avatar

phigros-save-manager's Issues

Chart constants are incorrect

phigros-save-manager is using a old chart constant table and many CC are changed in the past several updates. CC table needs an update

Severe bugs

Hi there... Yet I don't have my own PC to make pull requests so I can just issue it here....

In your project I found some severe bugs that mess everything up, and I tried to fix them on my own.

1. Malformed Binary Data?

In the structure LevelRecord there is a field called unknown value. In binary data, it takes a byte in every pieces of records.
图片

Actually it matters. It represents the size of that piece of record. After reading all the necessary fields (e.g. score, accuracy), you are supposed to directly move the cursor to the next piece, skipping rest of bytes (I don't know why there they are , but they do exist. Maybe they represents the performance of Legacy chart or something).

But no skips are seen in readFromDefinition. Everything will be messed up since the program doesn't move the cursor to where it should be. To handle it, I made an if branch in the code that acts as what I mentioned above. The modified code looks like this:
图片

Similarly, writeFromDefiniton should take this byte into consideration, too:
图片

By making it a fixed length with zero-padding, everything can be formed well. However I am not sure that whether discarding those rest-bytes is okay or not, for they may represent meaningful data or something, so before they are checked no final resolution should be made in my point of view.

2. Incorrect Results after Reading?

I found that performances of different levels in one song all come to the same... See my readFromDefinition. You should not directly assign definition.base to the local variable obj... Instead you can use {...definition.base} to make clones, or they all refers to one particular object... That's why everything became same...

3. Details That Cause Errors?

  • In cli.ts, function allphi, the full marks of Phigros should be 1000000 instead of 1e8.
  • In function rere8, you should call rere8() instead of partialre8(). Is it a mistake from Ctrl CV?
  • Typos: 'difficulties', 'readVariableShort', 'levelExistenceFlag'...
    ...

I am not meaning to criticize anyone. I sincerely appreciate the repo owner who made save-managements available for us. I just want to suggest that code be tested before publishing them as a public repo.

Pardon my poor English expressions.

Some function are broken after the game update

  • when i use decrypt func , it occurs:
phigros-save-manager decrypt S-T save-1711515509883.save
Now trying to decrypt save...
node:fs:579
  path = getValidatedPath(path);
         ^
  • when i use get command , it occurs:
phigros-save-manager get S-T
Fetching profile
/Users/ccbling/WebstormProjects/phigros-save-manager/dist/cli.js:248
      throw new PhigrosBinaryParseError("Index exceeds!");
            ^

how can i fix them , maybe its 'cause of the version update of phi,

Some problems about class definition

in record.ts ,there's a constructor that records the geme records.
i found this is only effective for EZ level , whose 'songName' is ended with .0

  {
      type: 'byte',
      field: 'fcFlag'
  }, 

so i wonder if there's a way to make any level fc.

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.