private void SavePlayerData() { playerData.VocaloidPoint = Manipulator.ReadInt32(PLAYER_VP_ADDRESS); playerData.ActToggle = Manipulator.ReadByte(PLAYER_ACT_TOGGLE_ADDRESS); playerData.ActVol = Manipulator.ReadInt32(PLAYER_ACT_VOL_ADDRESS);; playerData.ActSlideVol = Manipulator.ReadInt32(PLAYER_ACT_SLVOL_ADDRESS); playerData.HpVol = Manipulator.ReadInt32(PLAYER_HP_VOL_ADDRESS); playerData.PvSortKind = Manipulator.ReadInt32(PLAYER_PV_SORT_KIND_ADDRESS); // if (playerData.SetPlayData) playerData.PlayDataId = playIdx; // Write to file var serializer = new XmlSerializer(typeof(PlayerData)); using (var writer = new StreamWriter(PLAYER_DATA_PATH)) { serializer.Serialize(writer, playerData); writer.Close(); } if (divaScore != null) { divaScore.SavePlayerScoreData(); } }
internal void GetScoreResults() { if (!isInitialized) { return; } var rank = Manipulator.ReadInt32(RESULTS_BASE_ADDRESS + 0xE8); var insurance = Manipulator.ReadByte(GAME_INFO_ADDRESS + 0x14); if (insurance != 0) { return; } // ========== Get Score Results ========== // var recordDate = DateTime.UtcNow; var resultBase = Manipulator.ReadInt64(RESULTS_BASE_ADDRESS + 0x100); var pvId = Manipulator.ReadInt32(resultBase + 0x2c); var difficulty = Manipulator.ReadInt32(resultBase + 0x34); var edition = Manipulator.ReadInt32(resultBase + 0x44); var modifier = Manipulator.ReadInt32(resultBase + 0x70); var cntHitTypes = Manipulator.ReadInt32Array(resultBase + 0x158, 5); var pctHitTypes = Manipulator.ReadInt32Array(resultBase + 0x16c, 5); var combo = Manipulator.ReadInt32(resultBase + 0x180); var challengeScore = Manipulator.ReadInt32(resultBase + 0x184); var holdScore = Manipulator.ReadInt32(resultBase + 0x188); var score = Manipulator.ReadInt32(resultBase + 0x18c); var percent = Manipulator.ReadInt32(resultBase + 0x190); var slideScore = Manipulator.ReadInt32(resultBase + 0x194); var songNameLen = Manipulator.ReadInt32(CURRENT_SONG_NAME_ADDRESS + 0x18); var songNameAdr = songNameLen < 0x10 ? CURRENT_SONG_NAME_ADDRESS : Manipulator.ReadInt64(CURRENT_SONG_NAME_ADDRESS); var songName = Manipulator.ReadUtf8String(songNameAdr); // ========== Get Player Data ========== // var playerNameAdr = Manipulator.ReadInt64(PLAYER_NAME_ADDRESS); var playerName = Manipulator.ReadUtf8String(playerNameAdr); var levelNameAdr = Manipulator.ReadInt64(PLAYER_LEVEL_NAME_ADDRESS); var levelName = Manipulator.ReadUtf8String(levelNameAdr); var level = Manipulator.ReadInt32(PLAYER_LEVEL_ADDRESS); var plateId = Manipulator.ReadInt32(PLAYER_PLATE_ID_ADDRESS); var plateEff = Manipulator.ReadInt32(PLAYER_PLATE_EFF_ADDRESS); var moduleEquip = Manipulator.ReadInt32Array(PLAYER_MODULE_EQUIP_ADDRESS, 6); // ========== Get High Score Record ========== // var entry = playerScore.GetScoreEntry(pvId, difficulty, edition); int alltimeScore = entry.AlltimeScore; int alltimePercent = entry.AlltimePercent; int alltimeRank = entry.AlltimeRank; int alltimeModifiers = entry.AlltimeModifiers; // ========== Process Score Data ========== // if (alltimeScore == -1) { alltimeScore = entry.Score; } if (alltimePercent == -1) { alltimePercent = entry.Percent; } if (alltimeRank == -1) { alltimeRank = entry.Rank; } if (alltimeModifiers == -1) { alltimeModifiers = entry.Modifiers > 0 ? 1 << (entry.Modifiers - 1) : 0; } var isNewScore = (score > alltimeScore); var isNewPercent = (percent > alltimePercent); var isNewRank = (rank > alltimeRank); var notes = new List <NoteScoreEntry>(); for (int i = 0; i < 5; i++) { notes.Add(new NoteScoreEntry() { Id = i, Count = cntHitTypes[i], Percent = pctHitTypes[i] }); } // ========== Update Score History Record ========== // var record = new ScoreEntry() { PvId = pvId, Difficulty = difficulty, Edition = edition, SongName = songName.Trim(), PlayerName = playerName.Trim(), LevelName = levelName.Trim(), Level = level, PlateId = plateId, PlateEff = plateEff, AlltimeScore = (isNewScore) ? score : alltimeScore, AlltimePercent = (isNewPercent) ? percent : alltimePercent, AlltimeRank = (isNewRank) ? rank : alltimeRank, AlltimeModifiers = alltimeModifiers | ((rank > 1 && modifier > 0) ? (1 << (modifier - 1)) : 0), Rank = rank, Score = score, Percent = percent, Modifiers = modifier, Notes = notes, Combo = combo, ChallengeScore = challengeScore, HoldScore = holdScore, SlideScore = slideScore, IsNewScore = isNewScore ? 1 : 0, IsNewPercent = isNewPercent ? 1 : 0, ModuleEquip = moduleEquip, RecordDate = recordDate, }; scoreHistory.Scores.Add(record); // ========== Update High Score Record ========== // if (isNewPercent || (rank > 1 && (isNewScore || isNewRank))) { playerScore.UpdateScoreEntry(pvId, difficulty, edition, record); } // ========== Update Pd_Pv Record ========== // SaveCurrentPvSetting(pvId); UpdateSingleScoreCacheEntry(pvId, difficulty, edition); UpdateClearCounts(); SaveScoreHistoryData(); }