1
0
mirror of synced 2024-09-23 19:08:21 +02:00

Better support for Pop'n music Omnimix v2

omnimix songs are now saved in a different version
This commit is contained in:
Shinrin Ouja Moriking 2023-03-02 03:10:49 -06:00 committed by Jennifer Taylor
parent 7cfe788dee
commit 645c27180f
7 changed files with 45 additions and 25 deletions

View File

@ -440,13 +440,13 @@ command once for every version, giving the correct DLL file:
For add songs of a XML from omnimix v2, run a command like this:
```
./read --config config/server.yaml --series pnm --version 22 --bin popn22.dll --xml your_songs_db.xml
./read --config config/server.yaml --series pnm --version omni-24 --bin popn24.dll --xml your_songs_db.xml
```
If you have more than one XML you want to add, you can run this command with a folder with all your XML files:
```
./read --config config/server.yaml --series pnm --version 22 --bin popn22.dll --folder my_path_with_xmls
./read --config config/server.yaml --series pnm --version omni-24 --bin popn24.dll --folder my_path_with_xmls
```
### Jubeat

View File

@ -219,6 +219,7 @@ class CatalogObject(BaseObject):
GameConstants.IIDX,
GameConstants.MUSECA,
GameConstants.JUBEAT,
GameConstants.POPN_MUSIC,
}:
if self.omnimix:
return self.version + DBConstants.OMNIMIX_VERSION_BUMP

View File

@ -226,6 +226,7 @@ class RecordsObject(BaseObject):
GameConstants.IIDX,
GameConstants.MUSECA,
GameConstants.JUBEAT,
GameConstants.POPN_MUSIC,
}:
if self.omnimix:
return self.version + DBConstants.OMNIMIX_VERSION_BUMP

View File

@ -30,6 +30,7 @@ class StatisticsObject(BaseObject):
GameConstants.IIDX,
GameConstants.MUSECA,
GameConstants.JUBEAT,
GameConstants.POPN_MUSIC,
}:
if self.omnimix:
return self.version + DBConstants.OMNIMIX_VERSION_BUMP

View File

@ -11,8 +11,9 @@ from bemani.common import (
GameConstants,
DBConstants,
BroadcastConstants,
Model,
)
from bemani.data import UserID, Achievement, ScoreSaveException
from bemani.data import UserID, Achievement, ScoreSaveException, Config, Data
from bemani.protocol import Node
@ -68,6 +69,19 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
# properly.
supports_expired_profiles: bool = False
def __init__(self, data: Data, config: Config, model: Model) -> None:
super().__init__(data, config, model)
if model.rev == "X":
self.omnimix = True
else:
self.omnimix = False
@property
def music_version(self) -> int:
if self.omnimix:
return DBConstants.OMNIMIX_VERSION_BUMP + self.version
return self.version
def previous_version(self) -> Optional["PopnMusicBase"]:
"""
Returns the previous version of the game, based on this game. Should
@ -229,7 +243,7 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
oldscore = self.data.local.music.get_score(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,
@ -283,7 +297,7 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
# Write the new score back
self.data.local.music.put_score(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,
@ -298,7 +312,7 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
# Save the history of this score too
self.data.local.music.put_attempt(
self.game,
self.version,
self.music_version,
userid,
songid,
chart,
@ -327,7 +341,7 @@ class PopnMusicBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
) -> None:
# Generate scorecard
profile = self.get_profile(userid)
song = self.data.local.music.get_song(self.game, self.version, songid, chart)
song = self.data.local.music.get_song(self.game, self.music_version, songid, chart)
card_medal = {
self.PLAY_MEDAL_CIRCLE_FAILED: "Failed",

View File

@ -2,8 +2,7 @@
import re
from typing import Any, Dict
from flask import Blueprint, request, Response, url_for, abort
from bemani.common import ID, GameConstants, VersionConstants
from bemani.common import ID, GameConstants, VersionConstants, DBConstants
from bemani.data import UserID
from bemani.frontend.app import loginrequired, jsonify, render_react
from bemani.frontend.popn.popn import PopnMusicFrontend
@ -187,19 +186,20 @@ def viewtopscores(musicid: int) -> Response:
difficulties = [0, 0, 0, 0]
for version in versions:
for chart in [0, 1, 2, 3]:
details = g.data.local.music.get_song(
GameConstants.POPN_MUSIC, version, musicid, chart
)
if details is not None:
if name is None:
name = details.name
if artist is None:
artist = details.artist
if genre is None:
genre = details.genre
if difficulties[chart] == 0:
difficulties[chart] = details.data.get_int("difficulty")
for omniadd in [0, DBConstants.OMNIMIX_VERSION_BUMP]:
for chart in [0, 1, 2, 3]:
details = g.data.local.music.get_song(
GameConstants.POPN_MUSIC, version + omniadd, musicid, chart
)
if details is not None:
if name is None:
name = details.name
if artist is None:
artist = details.artist
if genre is None:
genre = details.genre
if difficulties[chart] == 0:
difficulties[chart] = details.data.get_int("difficulty")
if name is None:
# Not a real song!

View File

@ -398,6 +398,9 @@ class ImportPopn(ImportBase):
"24": VersionConstants.POPN_MUSIC_USANEKO,
"25": VersionConstants.POPN_MUSIC_PEACE,
"26": VersionConstants.POPN_MUSIC_KAIMEI_RIDDLES,
"omni-24": VersionConstants.POPN_MUSIC_USANEKO + DBConstants.OMNIMIX_VERSION_BUMP, #Omnimix v2 only works for 24 - 26
"omni-25": VersionConstants.POPN_MUSIC_PEACE + DBConstants.OMNIMIX_VERSION_BUMP ,
"omni-26": VersionConstants.POPN_MUSIC_KAIMEI_RIDDLES + DBConstants.OMNIMIX_VERSION_BUMP,
}.get(version, -1)
if actual_version == VersionConstants.POPN_MUSIC_TUNE_STREET:
@ -990,7 +993,7 @@ class ImportPopn(ImportBase):
mask & 0x4000000 > 0, # Battle hyper chart bit
)
elif self.version == VersionConstants.POPN_MUSIC_USANEKO:
elif self.version == VersionConstants.POPN_MUSIC_USANEKO or self.version == (VersionConstants.POPN_MUSIC_USANEKO + DBConstants.OMNIMIX_VERSION_BUMP):
# Based on M39:J:A:A:2018101500
# Normal offset for music DB, size
@ -1080,7 +1083,7 @@ class ImportPopn(ImportBase):
mask & 0x4000000 > 0, # Battle hyper chart bit
)
elif self.version == VersionConstants.POPN_MUSIC_PEACE:
elif self.version == VersionConstants.POPN_MUSIC_PEACE or self.version == (VersionConstants.POPN_MUSIC_PEACE + DBConstants.OMNIMIX_VERSION_BUMP):
# Based on M39:J:A:A:2020092800
# Normal offset for music DB, size
@ -1170,7 +1173,7 @@ class ImportPopn(ImportBase):
mask & 0x4000000 > 0, # Battle hyper chart bit
)
elif self.version == VersionConstants.POPN_MUSIC_KAIMEI_RIDDLES:
elif self.version == VersionConstants.POPN_MUSIC_KAIMEI_RIDDLES or self.version == (VersionConstants.POPN_MUSIC_KAIMEI_RIDDLES + DBConstants.OMNIMIX_VERSION_BUMP):
# Based on M39:J:A:A:2022061300
# Normal offset for music DB, size