mirror of
https://github.com/DragonMinded/bemaniutils.git
synced 2026-03-21 17:24:33 -05:00
Support premium song score saving in DanEvo two-player mode.
This commit is contained in:
parent
1bfb1defcd
commit
df4a9c712d
|
|
@ -84,6 +84,8 @@ class DanceEvolution(
|
|||
DATA03_FIRST_HIGH_SCORE_OFFSET: Final[int] = 14
|
||||
DATA03_SECOND_SONG_OFFSET: Final[int] = 15
|
||||
DATA03_SECOND_HIGH_SCORE_OFFSET: Final[int] = 16
|
||||
DATA03_THIRD_SONG_OFFSET: Final[int] = 17
|
||||
DATA03_THIRD_HIGH_SCORE_OFFSET: Final[int] = 18
|
||||
|
||||
DATA04_TOTAL_SCORE_EARNED_OFFSET: Final[int] = 9
|
||||
|
||||
|
|
@ -390,14 +392,22 @@ class DanceEvolution(
|
|||
if "DATA03" in usergamedata:
|
||||
strdatalist = usergamedata["DATA03"]["strdata"].split(b",")
|
||||
|
||||
# First two are represented in the hex section.
|
||||
first_song_played = int(strdatalist[self.DATA03_FIRST_SONG_OFFSET].decode("shift-jis"), 16)
|
||||
second_song_played = int(strdatalist[self.DATA03_SECOND_SONG_OFFSET].decode("shift-jis"), 16)
|
||||
first_song_scored = int(strdatalist[self.DATA03_FIRST_HIGH_SCORE_OFFSET].decode("shift-jis"), 16)
|
||||
second_song_scored = int(strdatalist[self.DATA03_SECOND_HIGH_SCORE_OFFSET].decode("shift-jis"), 16)
|
||||
|
||||
# They really just stuck this in as floats. I couldn't make this up.
|
||||
third_song_played = int(strdatalist[self.DATA03_THIRD_SONG_OFFSET].decode("shift-jis").split(".")[0])
|
||||
third_song_scored = int(
|
||||
strdatalist[self.DATA03_THIRD_HIGH_SCORE_OFFSET].decode("shift-jis").split(".")[0]
|
||||
)
|
||||
|
||||
for played, scored in [
|
||||
(first_song_played, first_song_scored),
|
||||
(second_song_played, second_song_scored),
|
||||
(third_song_played, third_song_scored),
|
||||
]:
|
||||
if played not in valid_ids:
|
||||
# Game might be set to 1 song.
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ class DanceEvolutionClient(BaseClient):
|
|||
}
|
||||
|
||||
def verify_scores_send(self, ref_id: str, name: str, scores: List[Dict[str, int]]) -> None:
|
||||
if len(scores) > 2:
|
||||
if len(scores) > 3:
|
||||
raise Exception("DanEvo can only save two scores at once!")
|
||||
|
||||
# This is identical to usergamedata_send, but the function was getting out of hand.
|
||||
|
|
@ -486,8 +486,11 @@ class DanceEvolutionClient(BaseClient):
|
|||
elif offset == 1:
|
||||
profiledata["DATA03"][15] = _to_hex(sid)
|
||||
profiledata["DATA03"][16] = _to_hex(score["points"])
|
||||
elif offset == 2:
|
||||
profiledata["DATA03"][17] = str(float(sid)).encode("shift-jis")
|
||||
profiledata["DATA03"][18] = str(float(score["points"])).encode("shift-jis")
|
||||
else:
|
||||
raise Exception("Logic error, can't save more than two scores!")
|
||||
raise Exception("Logic error, can't save more than three scores!")
|
||||
|
||||
# Make binary data blobs.
|
||||
blobs: Dict[int, bytes] = {}
|
||||
|
|
@ -779,7 +782,7 @@ class DanceEvolutionClient(BaseClient):
|
|||
},
|
||||
]
|
||||
|
||||
scorechunks = [dummyscores[x : (x + 2)] for x in range(0, len(dummyscores), 2)]
|
||||
scorechunks = [dummyscores[x : (x + 3)] for x in range(0, len(dummyscores), 3)]
|
||||
|
||||
for chunk in scorechunks:
|
||||
self.verify_scores_send(ref_id, self.NAME1, chunk)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user