1
0
mirror of synced 2025-01-19 06:27:23 +01:00

Typing fixes for Pop'n 22-24, event ID limits checked and commented, converted Lapistoria to modern routing.

This commit is contained in:
Jennifer Taylor 2021-09-03 22:42:09 +00:00
parent 9d4eccf66e
commit ab4c82b886
4 changed files with 243 additions and 262 deletions

View File

@ -1,7 +1,7 @@
# vim: set fileencoding=utf-8 # vim: set fileencoding=utf-8
import binascii import binascii
import copy import copy
from typing import Dict, List, Optional from typing import Dict, List
from bemani.backend.popn.base import PopnMusicBase from bemani.backend.popn.base import PopnMusicBase
from bemani.backend.popn.lapistoria import PopnMusicLapistoria from bemani.backend.popn.lapistoria import PopnMusicLapistoria
@ -38,7 +38,7 @@ class PopnMusicEclale(PopnMusicBase):
# Biggest ID in the music DB # Biggest ID in the music DB
GAME_MAX_MUSIC_ID = 1550 GAME_MAX_MUSIC_ID = 1550
def previous_version(self) -> Optional[PopnMusicBase]: def previous_version(self) -> PopnMusicBase:
return PopnMusicLapistoria(self.data, self.config, self.model) return PopnMusicLapistoria(self.data, self.config, self.model)
def __construct_common_info(self, root: Node) -> None: def __construct_common_info(self, root: Node) -> None:
@ -69,7 +69,7 @@ class PopnMusicEclale(PopnMusicBase):
10: 4, 10: 4,
# Unknown event (0-1) # Unknown event (0-1)
11: 1, 11: 1,
# Possibly global event matching related? (0-1) # Possibly net taisen related? (0-1)
12: 1, 12: 1,
# Unknown event (0-4) # Unknown event (0-4)
13: 4, 13: 4,
@ -162,7 +162,7 @@ class PopnMusicEclale(PopnMusicBase):
self.__construct_common_info(info) self.__construct_common_info(info)
return info return info
def handle_lobby22_request(self, request: Node) -> Optional[Node]: def handle_lobby22_request(self, request: Node) -> Node:
# Stub out the entire lobby22 service (yes, its lobby22 in Pop'n 23) # Stub out the entire lobby22 service (yes, its lobby22 in Pop'n 23)
return Node.void('lobby22') return Node.void('lobby22')

View File

@ -1,6 +1,6 @@
# vim: set fileencoding=utf-8 # vim: set fileencoding=utf-8
import copy import copy
from typing import Dict, List, Optional from typing import Dict, List
from bemani.backend.popn.base import PopnMusicBase from bemani.backend.popn.base import PopnMusicBase
from bemani.backend.popn.sunnypark import PopnMusicSunnyPark from bemani.backend.popn.sunnypark import PopnMusicSunnyPark
@ -38,57 +38,53 @@ class PopnMusicLapistoria(PopnMusicBase):
# Max valud music ID for conversions and stuff # Max valud music ID for conversions and stuff
GAME_MAX_MUSIC_ID = 1422 GAME_MAX_MUSIC_ID = 1422
def previous_version(self) -> Optional[PopnMusicBase]: def previous_version(self) -> PopnMusicBase:
return PopnMusicSunnyPark(self.data, self.config, self.model) return PopnMusicSunnyPark(self.data, self.config, self.model)
def handle_info22_request(self, request: Node) -> Optional[Node]: def handle_info22_common_request(self, request: Node) -> Node:
method = request.attribute('method')
if method == 'common':
# TODO: Hook these up to config so we can change this # TODO: Hook these up to config so we can change this
phases = { phases = {
# Unknown event # Unknown event (0-16)
0: 0, 0: 0,
# Unknown event # Unknown event (0-11)
1: 0, 1: 0,
# Pop'n Aura, max 10 (remove all aura requirements) # Pop'n Aura, max (0-11) (remove all aura requirements)
2: 10, 2: 11,
# Story # Story (0-24)
3: 1, 3: 1,
# BEMANI ruins Discovery! # BEMANI ruins Discovery! (0-2)
4: 0, 4: 0,
# Unknown event # Unknown event, something to do with net taisen (0-2)
5: 0, 5: 0,
# Unknown event # Unknown event (0-1)
6: 0, 6: 0,
# Unknown event # Unknown event (0-1)
7: 0, 7: 0,
# Unknown event # Unknown event (0-1)
8: 0, 8: 0,
# Unknown event # Unknown event (0-11)
9: 0, 9: 0,
# Unknown event # Unknown event (0-2)
10: 0, 10: 0,
# Unknown event # Unknown event (0-3)
11: 0, 11: 0,
# Unknown event # Unknown event (0-1)
12: 0, 12: 0,
# Unknown event # Unknown event (0-2)
13: 0, 13: 0,
# Unknown event # Unknown event (0-4)
14: 0, 14: 0,
# Unknown event # Unknown event (0-2)
15: 0, 15: 0,
# Unknown event # Unknown event (0-2)
16: 0, 16: 0,
# Unknown event # Unknown event (0-12)
17: 0, 17: 0,
# Unknown event # Unknown event (0-2)
18: 0, 18: 0,
# Unknown event # Unknown event (0-7)
19: 0, 19: 0,
} }
stories = list(range(173))
root = Node.void('info22') root = Node.void('info22')
for phaseid in phases: for phaseid in phases:
@ -97,7 +93,7 @@ class PopnMusicLapistoria(PopnMusicBase):
phase.add_child(Node.s16('event_id', phaseid)) phase.add_child(Node.s16('event_id', phaseid))
phase.add_child(Node.s16('phase', phases[phaseid])) phase.add_child(Node.s16('phase', phases[phaseid]))
for storyid in stories: for storyid in range(173):
story = Node.void('story') story = Node.void('story')
root.add_child(story) root.add_child(story)
story.add_child(Node.u32('story_id', storyid)) story.add_child(Node.u32('story_id', storyid))
@ -106,32 +102,22 @@ class PopnMusicLapistoria(PopnMusicBase):
return root return root
# Invalid method def handle_pcb22_boot_request(self, request: Node) -> Node:
return None
def handle_pcb22_request(self, request: Node) -> Optional[Node]:
method = request.attribute('method')
if method == 'boot':
return Node.void('pcb22') return Node.void('pcb22')
elif method == 'error':
def handle_pcb22_error_request(self, request: Node) -> Node:
return Node.void('pcb22') return Node.void('pcb22')
elif method == 'write':
def handle_pcb22_write_request(self, request: Node) -> Node:
# Update the name of this cab for admin purposes # Update the name of this cab for admin purposes
self.update_machine_name(request.child_value('pcb_setting/name')) self.update_machine_name(request.child_value('pcb_setting/name'))
return Node.void('pcb22') return Node.void('pcb22')
# Invalid method def handle_lobby22_request(self, request: Node) -> Node:
return None
def handle_lobby22_request(self, request: Node) -> Optional[Node]:
# Stub out the entire lobby22 service # Stub out the entire lobby22 service
return Node.void('lobby22') return Node.void('lobby22')
def handle_player22_request(self, request: Node) -> Optional[Node]: def handle_player22_read_request(self, request: Node) -> Node:
method = request.attribute('method')
if method == 'read':
refid = request.child_value('ref_id') refid = request.child_value('ref_id')
# Pop'n Music 22 doesn't send a modelstring to load old profiles, # Pop'n Music 22 doesn't send a modelstring to load old profiles,
# it just expects us to know. So always look for old profiles in # it just expects us to know. So always look for old profiles in
@ -142,7 +128,7 @@ class PopnMusicLapistoria(PopnMusicBase):
root.set_attribute('status', str(Status.NO_PROFILE)) root.set_attribute('status', str(Status.NO_PROFILE))
return root return root
elif method == 'new': def handle_player22_new_request(self, request: Node) -> Node:
refid = request.child_value('ref_id') refid = request.child_value('ref_id')
name = request.child_value('name') name = request.child_value('name')
root = self.new_profile_by_refid(refid, name) root = self.new_profile_by_refid(refid, name)
@ -151,13 +137,13 @@ class PopnMusicLapistoria(PopnMusicBase):
root.set_attribute('status', str(Status.NO_PROFILE)) root.set_attribute('status', str(Status.NO_PROFILE))
return root return root
elif method == 'start': def handle_player22_start_request(self, request: Node) -> Node:
return Node.void('player22') return Node.void('player22')
elif method == 'logout': def handle_player22_logout_request(self, request: Node) -> Node:
return Node.void('player22') return Node.void('player22')
elif method == 'write': def handle_player22_write_request(self, request: Node) -> Node:
refid = request.child_value('ref_id') refid = request.child_value('ref_id')
root = Node.void('player22') root = Node.void('player22')
@ -176,7 +162,7 @@ class PopnMusicLapistoria(PopnMusicBase):
return root return root
elif method == 'friend': def handle_player22_friend_request(self, request: Node) -> Node:
refid = request.attribute('ref_id') refid = request.attribute('ref_id')
no = int(request.attribute('no', '-1')) no = int(request.attribute('no', '-1'))
@ -263,7 +249,7 @@ class PopnMusicLapistoria(PopnMusicBase):
return root return root
elif method == 'conversion': def handle_player22_conversion_request(self, request: Node) -> Node:
refid = request.child_value('ref_id') refid = request.child_value('ref_id')
name = request.child_value('name') name = request.child_value('name')
chara = request.child_value('chara') chara = request.child_value('chara')
@ -273,7 +259,7 @@ class PopnMusicLapistoria(PopnMusicBase):
root.set_attribute('status', str(Status.NO_PROFILE)) root.set_attribute('status', str(Status.NO_PROFILE))
return root return root
elif method == 'write_music': def handle_player22_write_music_request(self, request: Node) -> Node:
refid = request.child_value('ref_id') refid = request.child_value('ref_id')
root = Node.void('player22') root = Node.void('player22')
@ -316,9 +302,6 @@ class PopnMusicLapistoria(PopnMusicBase):
self.update_score(userid, songid, chart, points, medal, combo=combo, stats=stats) self.update_score(userid, songid, chart, points, medal, combo=combo, stats=stats)
return root return root
# Invalid method
return None
def format_profile(self, userid: UserID, profile: Profile) -> Node: def format_profile(self, userid: UserID, profile: Profile) -> Node:
root = Node.void('player22') root = Node.void('player22')

View File

@ -1,6 +1,4 @@
# vim: set fileencoding=utf-8 # vim: set fileencoding=utf-8
from typing import Optional
from bemani.backend.popn.base import PopnMusicBase from bemani.backend.popn.base import PopnMusicBase
from bemani.backend.popn.usaneko import PopnMusicUsaNeko from bemani.backend.popn.usaneko import PopnMusicUsaNeko
from bemani.common import VersionConstants from bemani.common import VersionConstants
@ -11,5 +9,5 @@ class PopnMusicPeace(PopnMusicBase):
name = "Pop'n Music peace" name = "Pop'n Music peace"
version = VersionConstants.POPN_MUSIC_PEACE version = VersionConstants.POPN_MUSIC_PEACE
def previous_version(self) -> Optional[PopnMusicBase]: def previous_version(self) -> PopnMusicBase:
return PopnMusicUsaNeko(self.data, self.config, self.model) return PopnMusicUsaNeko(self.data, self.config, self.model)

View File

@ -48,7 +48,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
# Biggest ID in the music DB # Biggest ID in the music DB
GAME_MAX_MUSIC_ID = 1704 GAME_MAX_MUSIC_ID = 1704
def previous_version(self) -> Optional[PopnMusicBase]: def previous_version(self) -> PopnMusicBase:
return PopnMusicEclale(self.data, self.config, self.model) return PopnMusicEclale(self.data, self.config, self.model)
def extra_services(self) -> List[str]: def extra_services(self) -> List[str]:
@ -111,7 +111,7 @@ class PopnMusicUsaNeko(PopnMusicBase):
return self.GAME_PLAY_RANK_AAA return self.GAME_PLAY_RANK_AAA
return self.GAME_PLAY_RANK_S return self.GAME_PLAY_RANK_S
def handle_lobby24_request(self, request: Node) -> Optional[Node]: def handle_lobby24_request(self, request: Node) -> Node:
# Stub out the entire lobby24 service # Stub out the entire lobby24 service
return Node.void('lobby24') return Node.void('lobby24')