From 82c5ae3ad765eb22fdffb4e3452692c59ae896a3 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 7 Dec 2023 16:07:17 -0500 Subject: [PATCH 01/28] wacca: fix housing/start on lilyr and above --- titles/wacca/lilyr.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/titles/wacca/lilyr.py b/titles/wacca/lilyr.py index 0bb12ed..e3162d6 100644 --- a/titles/wacca/lilyr.py +++ b/titles/wacca/lilyr.py @@ -3,11 +3,14 @@ from datetime import datetime, timedelta import json from core.config import CoreConfig +from titles.wacca.handlers import Dict from titles.wacca.lily import WaccaLily from titles.wacca.config import WaccaConfig from titles.wacca.const import WaccaConstants from titles.wacca.handlers import * +from core.const import AllnetCountryCode + class WaccaLilyR(WaccaLily): def __init__(self, cfg: CoreConfig, game_cfg: WaccaConfig) -> None: @@ -36,6 +39,37 @@ class WaccaLilyR(WaccaLily): (210003, 0), ] + def handle_housing_start_request(self, data: Dict) -> Dict: + req = HousingStartRequestV2(data) + + machine = self.data.arcade.get_machine(req.chipId) + if machine is not None: + arcade = self.data.arcade.get_arcade(machine["arcade"]) + allnet_region_id = arcade["region_id"] + + if req.appVersion.country == AllnetCountryCode.JAPAN.value: + if allnet_region_id is not None: + region = WaccaConstants.allnet_region_id_to_wacca_region( + allnet_region_id + ) + + if region is None: + region_id = self.region_id + else: + region_id = region + + else: + region_id = self.region_id + + elif req.appVersion.country in WaccaConstants.VALID_COUNTRIES: + region_id = WaccaConstants.Region[req.appVersion.country] + + else: + region_id = WaccaConstants.Region.NONE + + resp = HousingStartResponseV1(region_id) + return resp.make() + def handle_user_status_create_request(self, data: Dict) -> Dict: req = UserStatusCreateRequest(data) resp = super().handle_user_status_create_request(data) From 21492fbfb3db8f52ad438e278f578be0e4e78bec Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 7 Dec 2023 18:53:51 -0500 Subject: [PATCH 02/28] wacca: hotfix handle_housing_start_request --- titles/wacca/lilyr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/titles/wacca/lilyr.py b/titles/wacca/lilyr.py index e3162d6..7204761 100644 --- a/titles/wacca/lilyr.py +++ b/titles/wacca/lilyr.py @@ -41,6 +41,7 @@ class WaccaLilyR(WaccaLily): def handle_housing_start_request(self, data: Dict) -> Dict: req = HousingStartRequestV2(data) + allnet_region_id = None machine = self.data.arcade.get_machine(req.chipId) if machine is not None: From c1412ca9a88ffa21650f4c9132f1a3c732680c35 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 10 Dec 2023 17:27:50 -0500 Subject: [PATCH 03/28] sao: fix title server port --- titles/sao/index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/titles/sao/index.py b/titles/sao/index.py index b70f02a..1607aa1 100644 --- a/titles/sao/index.py +++ b/titles/sao/index.py @@ -76,13 +76,13 @@ class SaoServlet(BaseServlet): return True def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: - if not self.core_cfg.server.is_using_proxy and Utils.get_title_port_ssl(self.core_cfg): + if not self.core_cfg.server.is_using_proxy and Utils.get_title_port_ssl(self.core_cfg) != 443: return ( - f"https://{self.core_cfg.title.hostname}:{self.core_cfg.title.port_ssl}/", + f"https://{self.core_cfg.title.hostname}:{Utils.get_title_port_ssl(self.core_cfg)}/", f"{self.core_cfg.title.hostname}/", ) - return (f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/", "") + return (f"http://{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/", "") def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: if not self.game_cfg.server.enable: From 26cdc6c10f095e1fc0b19b7205a1ded38e4100bc Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 10 Dec 2023 17:36:29 -0500 Subject: [PATCH 04/28] maidx: ignore guest upserts, fixes #74 --- titles/mai2/base.py | 4 ++++ titles/mai2/dx.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/titles/mai2/base.py b/titles/mai2/base.py index b896b4f..2f40176 100644 --- a/titles/mai2/base.py +++ b/titles/mai2/base.py @@ -237,6 +237,10 @@ class Mai2Base: def handle_upsert_user_all_api_request(self, data: Dict) -> Dict: user_id = data["userId"] upsert = data["upsertUserAll"] + + if int(user_id) & 1000000000001 == 1000000000001: + self.logger.info("Guest play, ignoring.") + return {"returnCode": 1, "apiName": "UpsertUserAllApi"} if "userData" in upsert and len(upsert["userData"]) > 0: upsert["userData"][0].pop("accessCode") diff --git a/titles/mai2/dx.py b/titles/mai2/dx.py index a0a7d6f..508cebb 100644 --- a/titles/mai2/dx.py +++ b/titles/mai2/dx.py @@ -96,6 +96,10 @@ class Mai2DX(Mai2Base): def handle_upsert_user_all_api_request(self, data: Dict) -> Dict: user_id = data["userId"] upsert = data["upsertUserAll"] + + if int(user_id) & 1000000000001 == 1000000000001: + self.logger.info("Guest play, ignoring.") + return {"returnCode": 1, "apiName": "UpsertUserAllApi"} if "userData" in upsert and len(upsert["userData"]) > 0: upsert["userData"][0]["isNetMember"] = 1 From 283cf41bcebaf6f816947f745ff801a9d159a5f9 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 10 Dec 2023 17:41:05 -0500 Subject: [PATCH 05/28] chuni: bandaid fix for if a user or team is named 'true' or 'false', fixes #65 --- core/data/schema/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/data/schema/base.py b/core/data/schema/base.py index a53392f..ef980e5 100644 --- a/core/data/schema/base.py +++ b/core/data/schema/base.py @@ -157,6 +157,8 @@ class BaseData: def fix_bools(self, data: Dict) -> Dict: for k, v in data.items(): + if k == "userName" or k == "teamName": + continue if type(v) == str and v.lower() == "true": data[k] = True elif type(v) == str and v.lower() == "false": From 5491266a850beb5687cf4dbc8a76c369f5990d0c Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 10 Dec 2023 18:35:59 -0500 Subject: [PATCH 06/28] sao: fix https --- titles/sao/config.py | 6 ++++++ titles/sao/index.py | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/titles/sao/config.py b/titles/sao/config.py index 33d319b..dfae3c0 100644 --- a/titles/sao/config.py +++ b/titles/sao/config.py @@ -29,6 +29,12 @@ class SaoServerConfig: self.__config, "sao", "server", "auto_register", default=True ) + @property + def use_https(self) -> bool: + return CoreConfig.get_config_field( + self.__config, "sao", "server", "use_https", default=False + ) + class SaoCryptConfig: def __init__(self, parent_config: "SaoConfig"): self.__config = parent_config diff --git a/titles/sao/index.py b/titles/sao/index.py index 1607aa1..78d641e 100644 --- a/titles/sao/index.py +++ b/titles/sao/index.py @@ -76,13 +76,17 @@ class SaoServlet(BaseServlet): return True def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: - if not self.core_cfg.server.is_using_proxy and Utils.get_title_port_ssl(self.core_cfg) != 443: - return ( - f"https://{self.core_cfg.title.hostname}:{Utils.get_title_port_ssl(self.core_cfg)}/", - f"{self.core_cfg.title.hostname}/", - ) + port_ssl = Utils.get_title_port_ssl(self.core_cfg) + port_normal = Utils.get_title_port(self.core_cfg) - return (f"http://{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/", "") + proto = "http" + port = f":{port_normal}" if not self.core_cfg.server.is_using_proxy and port_normal != 80 else "" + + if self.game_cfg.server.use_https: + proto = "https" + port = f":{port_ssl}" if not self.core_cfg.server.is_using_proxy and port_ssl != 443 else "" + + return (f"{proto}://{self.core_cfg.title.hostname}{port}/", "") def get_mucha_info(self, core_cfg: CoreConfig, cfg_dir: str) -> Tuple[bool, str]: if not self.game_cfg.server.enable: @@ -96,7 +100,9 @@ class SaoServlet(BaseServlet): iv = b"" req_raw = request.content.read() - sao_request = req_raw.hex() + if len(req_raw) < 40: + self.logger.warn(f"Malformed request to {endpoint} - {req_raw.hex()}") + return b"" req_header = SaoRequestHeader(req_raw) cmd_str = f"{req_header.cmd:04x}" From 59db7ad44a23206369da08fe7f101b04e2c430bf Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 05:56:40 +0000 Subject: [PATCH 07/28] Fixed a null condition when importing from Aqua --- titles/chuni/base.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 7272e54..43cad83 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -240,7 +240,6 @@ class ChuniBase: "isDumpUpload": "false", "isAou": "false", } - def handle_get_user_activity_api_request(self, data: Dict) -> Dict: user_activity_list = self.data.profile.get_profile_activity( data["userId"], data["kind"] @@ -873,9 +872,12 @@ class ChuniBase: if "userPlaylogList" in upsert: for playlog in upsert["userPlaylogList"]: # convert the player names to utf-8 - playlog["playedUserName1"] = self.read_wtf8(playlog["playedUserName1"]) - playlog["playedUserName2"] = self.read_wtf8(playlog["playedUserName2"]) - playlog["playedUserName3"] = self.read_wtf8(playlog["playedUserName3"]) + if playlog["playedUserName1"] is not None: + playlog["playedUserName1"] = self.read_wtf8(playlog["playedUserName1"]) + if playlog["playedUserName2"] is not None: + playlog["playedUserName2"] = self.read_wtf8(playlog["playedUserName2"]) + if playlog["playedUserName3"] is not None: + playlog["playedUserName3"] = self.read_wtf8(playlog["playedUserName3"]) self.data.score.put_playlog(user_id, playlog, self.version) if "userTeamPoint" in upsert: @@ -947,4 +949,4 @@ class ChuniBase: return { "userId": data["userId"], "userNetBattleData": {"recentNBSelectMusicList": []}, - } + } \ No newline at end of file From 32362dbe1e2a0ba013cc78200e422cf7122cffdd Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 05:58:22 +0000 Subject: [PATCH 08/28] Added const support for both International and Sun Plus --- titles/chuni/const.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/titles/chuni/const.py b/titles/chuni/const.py index b3a4cb5..3e83378 100644 --- a/titles/chuni/const.py +++ b/titles/chuni/const.py @@ -1,6 +1,7 @@ class ChuniConstants: GAME_CODE = "SDBT" GAME_CODE_NEW = "SDHD" + GAME_CODE_INT = "SDGS" CONFIG_NAME = "chuni.yaml" @@ -18,7 +19,7 @@ class ChuniConstants: VER_CHUNITHM_NEW = 11 VER_CHUNITHM_NEW_PLUS = 12 VER_CHUNITHM_SUN = 13 - + VER_CHUNITHM_SUN_PLUS = 14 VERSION_NAMES = [ "CHUNITHM", "CHUNITHM PLUS", @@ -33,9 +34,10 @@ class ChuniConstants: "CHUNITHM PARADISE", "CHUNITHM NEW!!", "CHUNITHM NEW PLUS!!", - "CHUNITHM SUN" + "CHUNITHM SUN", + "CHUNITHM SUN PLUS" ] @classmethod def game_ver_to_string(cls, ver: int): - return cls.VERSION_NAMES[ver] + return cls.VERSION_NAMES[ver] \ No newline at end of file From 15204f8d8aaaf1e7ae702c5beb1c2fc544636631 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:01:31 +0000 Subject: [PATCH 09/28] Added Sun Plus support, and Int workaround Int versions of Chunithm use nearly the same endpoints, just with C3Exp at the end. We can treat them the same as the regular versions of the game for now by simply removing the C3Exp portion of the endpoints and running our current logic. Note that later we should treat Int and JP as separate versions --- titles/chuni/index.py | 89 ++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/titles/chuni/index.py b/titles/chuni/index.py index 670dbe8..434d22f 100644 --- a/titles/chuni/index.py +++ b/titles/chuni/index.py @@ -31,6 +31,7 @@ from .paradise import ChuniParadise from .new import ChuniNew from .newplus import ChuniNewPlus from .sun import ChuniSun +from .sunplus import ChuniSunPlus class ChuniServlet(BaseServlet): @@ -58,6 +59,7 @@ class ChuniServlet(BaseServlet): ChuniNew, ChuniNewPlus, ChuniSun, + ChuniSunPlus, ] self.logger = logging.getLogger("chuni") @@ -120,8 +122,8 @@ class ChuniServlet(BaseServlet): return ( [], [ - ("render_POST", "/{version}/ChuniServlet/{endpoint}", {}), - ("render_POST", "/{version}/ChuniServlet/MatchingServer/{endpoint}", {}) + ("render_POST", "/{game}/{version}/ChuniServlet/{endpoint}", {}), + ("render_POST", "/{game}/{version}/ChuniServlet/MatchingServer/{endpoint}", {}) ] ) @@ -139,53 +141,69 @@ class ChuniServlet(BaseServlet): return False return True - + def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: if not self.core_cfg.server.is_using_proxy and Utils.get_title_port(self.core_cfg) != 80: - return (f"http://{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_ver}/", self.core_cfg.title.hostname) + return (f"http://{self.core_cfg.title.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_code}/{game_ver}/", self.core_cfg.title.hostname) - return (f"http://{self.core_cfg.title.hostname}/{game_ver}/", self.core_cfg.title.hostname) + return (f"http://{self.core_cfg.title.hostname}/{game_code}/{game_ver}/", self.core_cfg.title.hostname) def render_POST(self, request: Request, game_code: str, matchers: Dict) -> bytes: endpoint = matchers['endpoint'] version = int(matchers['version']) - + game_code = matchers['game'] + if endpoint.lower() == "ping": return zlib.compress(b'{"returnCode": "1"}') req_raw = request.content.getvalue() + encrtped = False internal_ver = 0 client_ip = Utils.get_ip_addr(request) - if version < 105: # 1.0 - internal_ver = ChuniConstants.VER_CHUNITHM - elif version >= 105 and version < 110: # PLUS - internal_ver = ChuniConstants.VER_CHUNITHM_PLUS - elif version >= 110 and version < 115: # AIR - internal_ver = ChuniConstants.VER_CHUNITHM_AIR - elif version >= 115 and version < 120: # AIR PLUS - internal_ver = ChuniConstants.VER_CHUNITHM_AIR_PLUS - elif version >= 120 and version < 125: # STAR - internal_ver = ChuniConstants.VER_CHUNITHM_STAR - elif version >= 125 and version < 130: # STAR PLUS - internal_ver = ChuniConstants.VER_CHUNITHM_STAR_PLUS - elif version >= 130 and version < 135: # AMAZON - internal_ver = ChuniConstants.VER_CHUNITHM_AMAZON - elif version >= 135 and version < 140: # AMAZON PLUS - internal_ver = ChuniConstants.VER_CHUNITHM_AMAZON_PLUS - elif version >= 140 and version < 145: # CRYSTAL - internal_ver = ChuniConstants.VER_CHUNITHM_CRYSTAL - elif version >= 145 and version < 150: # CRYSTAL PLUS - internal_ver = ChuniConstants.VER_CHUNITHM_CRYSTAL_PLUS - elif version >= 150 and version < 200: # PARADISE - internal_ver = ChuniConstants.VER_CHUNITHM_PARADISE - elif version >= 200 and version < 205: # NEW!! - internal_ver = ChuniConstants.VER_CHUNITHM_NEW - elif version >= 205 and version < 210: # NEW PLUS!! - internal_ver = ChuniConstants.VER_CHUNITHM_NEW_PLUS - elif version >= 210: # SUN - internal_ver = ChuniConstants.VER_CHUNITHM_SUN + if game_code == "SDHD" or game_code == "SDBT": # JP + if version < 105: # 1.0 + internal_ver = ChuniConstants.VER_CHUNITHM + elif version >= 105 and version < 110: # PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_PLUS + elif version >= 110 and version < 115: # AIR + internal_ver = ChuniConstants.VER_CHUNITHM_AIR + elif version >= 115 and version < 120: # AIR PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_AIR_PLUS + elif version >= 120 and version < 125: # STAR + internal_ver = ChuniConstants.VER_CHUNITHM_STAR + elif version >= 125 and version < 130: # STAR PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_STAR_PLUS + elif version >= 130 and version < 135: # AMAZON + internal_ver = ChuniConstants.VER_CHUNITHM_AMAZON + elif version >= 135 and version < 140: # AMAZON PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_AMAZON_PLUS + elif version >= 140 and version < 145: # CRYSTAL + internal_ver = ChuniConstants.VER_CHUNITHM_CRYSTAL + elif version >= 145 and version < 150: # CRYSTAL PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_CRYSTAL_PLUS + elif version >= 150 and version < 200: # PARADISE + internal_ver = ChuniConstants.VER_CHUNITHM_PARADISE + elif version >= 200 and version < 205: # NEW!! + internal_ver = ChuniConstants.VER_CHUNITHM_NEW + elif version >= 205 and version < 210: # NEW PLUS!! + internal_ver = ChuniConstants.VER_CHUNITHM_NEW_PLUS + elif version >= 210 and version < 215: # SUN + internal_ver = ChuniConstants.VER_CHUNITHM_SUN + elif version >= 215: # SUN + internal_ver = ChuniConstants.VER_CHUNITHM_SUN_PLUS + elif game_code == "SDGS": # Int + if version < 110: # SUPERSTAR + internal_ver = ChuniConstants.PARADISE + elif version >= 110 and version < 115: # NEW + internal_ver = ChuniConstants.VER_CHUNITHM_NEW + elif version >= 115 and version < 120: # NEW PLUS!! + internal_ver = ChuniConstants.VER_CHUNITHM_NEW_PLUS + elif version >= 120 and version < 125: # SUN + internal_ver = ChuniConstants.VER_CHUNITHM_SUN + elif version >= 125: # SUN PLUS + internal_ver = ChuniConstants.VER_CHUNITHM_SUN_PLUS if all(c in string.hexdigits for c in endpoint) and len(endpoint) == 32: # If we get a 32 character long hex string, it's a hash and we're @@ -250,6 +268,7 @@ class ChuniServlet(BaseServlet): self.logger.info(f"v{version} {endpoint} request from {client_ip}") self.logger.debug(req_data) + endpoint = endpoint.replace("C3Exp", "") if game_code == "SDGS" else endpoint func_to_find = "handle_" + inflection.underscore(endpoint) + "_request" handler_cls = self.versions[internal_ver](self.core_cfg, self.game_cfg) @@ -284,4 +303,4 @@ class ChuniServlet(BaseServlet): bytes.fromhex(self.game_cfg.crypto.keys[internal_ver][1]), ) - return crypt.encrypt(padded) + return crypt.encrypt(padded) \ No newline at end of file From ed731e74077adae2f24bc53220985970581abad4 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:02:32 +0000 Subject: [PATCH 10/28] Added Sun Plus support --- titles/chuni/sunplus.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 titles/chuni/sunplus.py diff --git a/titles/chuni/sunplus.py b/titles/chuni/sunplus.py new file mode 100644 index 0000000..66a7f3b --- /dev/null +++ b/titles/chuni/sunplus.py @@ -0,0 +1,37 @@ +from typing import Dict, Any + +from core.config import CoreConfig +from titles.chuni.sun import ChuniSun +from titles.chuni.const import ChuniConstants +from titles.chuni.config import ChuniConfig + + +class ChuniSunPlus(ChuniSun): + def __init__(self, core_cfg: CoreConfig, game_cfg: ChuniConfig) -> None: + super().__init__(core_cfg, game_cfg) + self.version = ChuniConstants.VER_CHUNITHM_SUN_PLUS + + def handle_get_game_setting_api_request(self, data: Dict) -> Dict: + ret = super().handle_get_game_setting_api_request(data) + ret["gameSetting"]["romVersion"] = self.game_cfg.version.version(self.version)["rom"] + ret["gameSetting"]["dataVersion"] = self.game_cfg.version.version(self.version)["data"] + ret["gameSetting"][ + "matchingUri" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/215/ChuniServlet/" + ret["gameSetting"][ + "matchingUriX" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/215/ChuniServlet/" + ret["gameSetting"][ + "udpHolePunchUri" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/215/ChuniServlet/" + ret["gameSetting"][ + "reflectorUri" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/215/ChuniServlet/" + return ret + + def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict: + user_data = super().handle_cm_get_user_preview_api_request(data) + + # I don't know if lastDataVersion is going to matter, I don't think CardMaker 1.35 works this far up + user_data["lastDataVersion"] = "2.15.00" + return user_data From a0dc8421eb52b62ed04720cd070989ef47a26cb8 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:04:21 +0000 Subject: [PATCH 11/28] Updated schema for changes in Sun Plus isClear and isSuccess are now integers to represent different clear types, although more research is needed into what those types mean. --- titles/chuni/schema/score.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/titles/chuni/schema/score.py b/titles/chuni/schema/score.py index 7712e3f..7e41b8f 100644 --- a/titles/chuni/schema/score.py +++ b/titles/chuni/schema/score.py @@ -24,7 +24,7 @@ course = Table( Column("scoreMax", Integer), Column("isFullCombo", Boolean), Column("isAllJustice", Boolean), - Column("isSuccess", Boolean), + Column("isSuccess", Integer), Column("scoreRank", Integer), Column("eventId", Integer), Column("lastPlayDate", String(25)), @@ -32,7 +32,7 @@ course = Table( Column("param2", Integer), Column("param3", Integer), Column("param4", Integer), - Column("isClear", Boolean), + Column("isClear", Integer), Column("theoryCount", Integer), Column("orderId", Integer), Column("playerRating", Integer), @@ -60,7 +60,7 @@ best_score = Table( Column("maxComboCount", Integer), Column("isFullCombo", Boolean), Column("isAllJustice", Boolean), - Column("isSuccess", Boolean), + Column("isSuccess", Integer), Column("fullChain", Integer), Column("maxChain", Integer), Column("scoreRank", Integer), @@ -125,7 +125,7 @@ playlog = Table( Column("characterId", Integer), Column("skillId", Integer), Column("playKind", Integer), - Column("isClear", Boolean), + Column("isClear", Integer), Column("skillLevel", Integer), Column("skillEffect", Integer), Column("placeName", String(255)), @@ -136,6 +136,7 @@ playlog = Table( Column("judgeHeaven", Integer), Column("regionId", Integer), Column("machineType", Integer), + Column("ticketId", Integer), mysql_charset="utf8mb4" ) @@ -255,4 +256,3 @@ class ChuniScoreData(BaseData): if result is None: return None return result.fetchall() - From ec4ae98beb8f25e0c5f2f620411911e30b6a6eae Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:05:46 +0000 Subject: [PATCH 12/28] Updated matchnaming URLs to utilize game codes --- titles/chuni/sun.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/titles/chuni/sun.py b/titles/chuni/sun.py index 86784b5..9a82a65 100644 --- a/titles/chuni/sun.py +++ b/titles/chuni/sun.py @@ -17,16 +17,16 @@ class ChuniSun(ChuniNewPlus): ret["gameSetting"]["dataVersion"] = self.game_cfg.version.version(self.version)["data"] ret["gameSetting"][ "matchingUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/210/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/210/ChuniServlet/" ret["gameSetting"][ "matchingUriX" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/210/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/210/ChuniServlet/" ret["gameSetting"][ "udpHolePunchUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/210/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/210/ChuniServlet/" ret["gameSetting"][ "reflectorUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/210/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/210/ChuniServlet/" return ret def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict: @@ -34,4 +34,4 @@ class ChuniSun(ChuniNewPlus): # hardcode lastDataVersion for CardMaker 1.35 A032 user_data["lastDataVersion"] = "2.10.00" - return user_data + return user_data \ No newline at end of file From 1bfe3584b1be427f4a935df9c50bf7203b86872a Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:06:16 +0000 Subject: [PATCH 13/28] Updated matchmaking URLs to reflect game codes --- titles/chuni/newplus.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/titles/chuni/newplus.py b/titles/chuni/newplus.py index 1a6876c..749173c 100644 --- a/titles/chuni/newplus.py +++ b/titles/chuni/newplus.py @@ -21,16 +21,16 @@ class ChuniNewPlus(ChuniNew): ] ret["gameSetting"][ "matchingUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/205/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/205/ChuniServlet/" ret["gameSetting"][ "matchingUriX" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/205/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/205/ChuniServlet/" ret["gameSetting"][ "udpHolePunchUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/205/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/205/ChuniServlet/" ret["gameSetting"][ "reflectorUri" - ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/205/ChuniServlet/" + ] = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/205/ChuniServlet/" return ret def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict: @@ -38,4 +38,4 @@ class ChuniNewPlus(ChuniNew): # hardcode lastDataVersion for CardMaker 1.35 A028 user_data["lastDataVersion"] = "2.05.00" - return user_data + return user_data \ No newline at end of file From 97963adf38a00482e304feb21395560403bd3c06 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:07:40 +0000 Subject: [PATCH 14/28] Updated matchnaming URLs to use game codes --- titles/chuni/new.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/titles/chuni/new.py b/titles/chuni/new.py index fd495f1..8a658bf 100644 --- a/titles/chuni/new.py +++ b/titles/chuni/new.py @@ -71,11 +71,11 @@ class ChuniNew(ChuniBase): "matchErrorLimit": 9999, "romVersion": self.game_cfg.version.version(self.version)["rom"], "dataVersion": self.game_cfg.version.version(self.version)["data"], - "matchingUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/200/ChuniServlet/", - "matchingUriX": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/200/ChuniServlet/", + "matchingUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/200/ChuniServlet/", + "matchingUriX": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/200/ChuniServlet/", # might be really important for online battle to connect the cabs via UDP port 50201 - "udpHolePunchUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/200/ChuniServlet/", - "reflectorUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/200/ChuniServlet/", + "udpHolePunchUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/200/ChuniServlet/", + "reflectorUri": f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}/SDHD/200/ChuniServlet/", }, "isDumpUpload": False, "isAou": False, From 00601226139b213c1c648c8f6e80645cd9506f5a Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:09:02 +0000 Subject: [PATCH 15/28] Recognize Chunithm Int code --- titles/chuni/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/titles/chuni/__init__.py b/titles/chuni/__init__.py index 0c3cc79..7708cef 100644 --- a/titles/chuni/__init__.py +++ b/titles/chuni/__init__.py @@ -6,5 +6,5 @@ from titles.chuni.read import ChuniReader index = ChuniServlet database = ChuniData reader = ChuniReader -game_codes = [ChuniConstants.GAME_CODE, ChuniConstants.GAME_CODE_NEW] -current_schema_version = 4 +game_codes = [ChuniConstants.GAME_CODE, ChuniConstants.GAME_CODE_NEW, ChuniConstants.GAME_CODE_INT] +current_schema_version = 4 \ No newline at end of file From b6d1f2cd3a92705e758dc26b3bcdaacf44873463 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:33:06 +0000 Subject: [PATCH 16/28] Updated playlog and best tables for Sun Plus Lord have mercy, this is my first schema update --- core/data/schema/versions/SDBT_5_upgrade.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 core/data/schema/versions/SDBT_5_upgrade.sql diff --git a/core/data/schema/versions/SDBT_5_upgrade.sql b/core/data/schema/versions/SDBT_5_upgrade.sql new file mode 100644 index 0000000..ab362bb --- /dev/null +++ b/core/data/schema/versions/SDBT_5_upgrade.sql @@ -0,0 +1,12 @@ +SET FOREIGN_KEY_CHECKS = 0; + +ALTER TABLE chuni_score_playlog + CHANGE COLUMN isClear isClear TINYINT(6) NULL DEFAULT NULL; + +ALTER TABLE aime.chuni_score_best + CHANGE COLUMN isSuccess isSuccess INT(11) NULL DEFAULT NULL ; + +ALTER TABLE chuni_score_playlog + ADD COLUMN ticketId INT(11) NULL AFTER machineType; + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From 9b9d1f664ddcee48fbcbc0ff0fbff41b5fe76449 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:34:32 +0000 Subject: [PATCH 17/28] Rollback for Sun Plus changed should hopefully never need to use this --- core/data/schema/versions/SDBT_4_rollback.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 core/data/schema/versions/SDBT_4_rollback.sql diff --git a/core/data/schema/versions/SDBT_4_rollback.sql b/core/data/schema/versions/SDBT_4_rollback.sql new file mode 100644 index 0000000..90a0e4f --- /dev/null +++ b/core/data/schema/versions/SDBT_4_rollback.sql @@ -0,0 +1,12 @@ +SET FOREIGN_KEY_CHECKS = 0; + +ALTER TABLE chuni_score_playlog + CHANGE COLUMN isClear isClear TINYINT(1) NULL DEFAULT NULL; + +ALTER TABLE aime.chuni_score_best + CHANGE COLUMN isSuccess isSuccess TINYINT(1) NULL DEFAULT NULL ; + +ALTER TABLE chuni_score_playlog + DROP COLUMN ticketId; + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file From a6b315185d7e839a47c16c230384687b1bd87833 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:35:55 +0000 Subject: [PATCH 18/28] Incremented schema version --- titles/chuni/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/titles/chuni/__init__.py b/titles/chuni/__init__.py index 7708cef..dc0e2f4 100644 --- a/titles/chuni/__init__.py +++ b/titles/chuni/__init__.py @@ -7,4 +7,4 @@ index = ChuniServlet database = ChuniData reader = ChuniReader game_codes = [ChuniConstants.GAME_CODE, ChuniConstants.GAME_CODE_NEW, ChuniConstants.GAME_CODE_INT] -current_schema_version = 4 \ No newline at end of file +current_schema_version = 5 \ No newline at end of file From a2d238857c063df8b2637e3a2255acdd162dfe15 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 06:37:30 +0000 Subject: [PATCH 19/28] Fixed CM compatibility with new Chuni URL structure --- titles/cm/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/titles/cm/base.py b/titles/cm/base.py index c95beb5..b911983 100644 --- a/titles/cm/base.py +++ b/titles/cm/base.py @@ -45,7 +45,7 @@ class CardMakerBase: { "modelKind": 0, "type": 1, - "titleUri": f"{uri}/{self._parse_int_ver(games_ver['chuni'])}/ChuniServlet/", + "titleUri": f"{uri}/SDHD/{self._parse_int_ver(games_ver['chuni'])}/ChuniServlet/", }, # maimai DX { From 40e6e42c8755580e0ebf882fc719248837c8d792 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 07:33:01 +0000 Subject: [PATCH 20/28] Updated readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c527090..cbd89c9 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ A network service emulator for games running SEGA'S ALL.NET service, and similar Games listed below have been tested and confirmed working. Only game versions older then the version currently active in arcades, or games versions that have not recieved a major update in over one year, are supported. + CHUNITHM - + All versions up to SUN + + All versions up to SUN PLUS + crossbeats REV. + All versions + omnimix From 626ea58f7587e931056f9f27725ad00e2a2ca814 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 07:34:37 +0000 Subject: [PATCH 21/28] Updated game specific info for Sun Plus Also removed some old info about rank scaling, since it got YEETed --- docs/game_specific_info.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 8d1aa1d..8723580 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -54,6 +54,7 @@ Games listed below have been tested and confirmed working. | 11 | CHUNITHM NEW!! | | 12 | CHUNITHM NEW PLUS!! | | 13 | CHUNITHM SUN | +| 14 | CHUNITHM SUN PLUS | ### Importer @@ -132,12 +133,6 @@ INSERT INTO aime.chuni_profile_team (teamName) VALUES (); ``` Team names can be regular ASCII, and they will be displayed ingame. -On smaller installations, you may also wish to enable scaled team rankings. By default, Chunithm determines team ranking within the first 100 teams. This can be configured in the YAML: -```yaml -team: - rank_scale: True # Scales the in-game ranking based on the number of teams within the database, rather than the default scale of ~100 that the game normally uses. -``` - ### Favorite songs You can set the songs that will be in a user's Favorite Songs category using the following SQL entries: ```sql From b5462276f576fbb84c6e1176d2e24f0e5d223ca1 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 07:35:07 +0000 Subject: [PATCH 22/28] Last remnant. Goodbye, rank scaling. --- docs/game_specific_info.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 8723580..5810ff8 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -75,7 +75,6 @@ Config file is located in `config/chuni.yaml`. |------------------|----------------------------------------------------------------------------------------------------------------| | `news_msg` | If this is set, the news at the top of the main screen will be displayed (up to Chunithm Paradise Lost) | | `name` | If this is set, all players that are not on a team will use this one by default. | -| `rank_scale` | Scales the in-game ranking based on the number of teams within the database | | `use_login_bonus`| This is used to enable the login bonuses | | `crypto` | This option is used to enable the TLS Encryption | From fd0fefa48b8144356be5aeabb52f49b7e530a375 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 12:28:28 +0000 Subject: [PATCH 23/28] Added Sun Plus to example config my bad --- example_config/chuni.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/example_config/chuni.yaml b/example_config/chuni.yaml index 578bcb3..72a1d98 100644 --- a/example_config/chuni.yaml +++ b/example_config/chuni.yaml @@ -19,6 +19,9 @@ version: 13: rom: 2.10.00 data: 2.10.00 + 14: + rom: 2.15.00 + data: 2.15.00 crypto: encrypted_only: False \ No newline at end of file From d0f8568e172a14b98f5b3cff5191bf88fa62f6bc Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Wed, 13 Dec 2023 23:28:00 +0000 Subject: [PATCH 24/28] Fixed Rival Music API not returning everything due to iteration issues --- titles/chuni/base.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 43cad83..674fb9c 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -419,13 +419,13 @@ class ChuniBase: all_entries = self.data.score.get_rival_music(rival_id) # Process the entries based on max_count and nextIndex - for music in all_entries[next_index:]: + for music in all_entries: music_id = music["musicId"] level = music["level"] score = music["scoreMax"] rank = music["scoreRank"] - # Create a music entry for the current music_id + # Create a music entry for the current music_id if it's unique music_entry = next((entry for entry in user_rival_music_list if entry["musicId"] == music_id), None) if music_entry is None: music_entry = { @@ -435,15 +435,20 @@ class ChuniBase: } user_rival_music_list.append(music_entry) - # Create a level entry for the current level - level_entry = { - "level": level, - "scoreMax": score, - "scoreRank": rank - } - music_entry["userRivalMusicDetailList"].append(level_entry) + # Create a level entry for the current level if it's unique or has a higher score + level_entry = next((entry for entry in music_entry["userRivalMusicDetailList"] if entry["level"] == level), None) + if level_entry is None: + level_entry = { + "level": level, + "scoreMax": score, + "scoreRank": rank + } + music_entry["userRivalMusicDetailList"].append(level_entry) + elif score > level_entry["scoreMax"]: + level_entry["scoreMax"] = score + level_entry["scoreRank"] = rank - # Calculate the length for each "musicId" by counting the levels + # Calculate the length for each "musicId" by counting the unique levels for music_entry in user_rival_music_list: music_entry["length"] = len(music_entry["userRivalMusicDetailList"]) @@ -451,11 +456,11 @@ class ChuniBase: result = { "userId": data["userId"], "rivalId": data["rivalId"], - "nextIndex": str(next_index + len(all_entries) if len(all_entries) <= len(user_rival_music_list) else -1), - "userRivalMusicList": user_rival_music_list[:max_count] + "nextIndex": str(next_index + len(user_rival_music_list[next_index: next_index + max_count]) if max_count <= len(user_rival_music_list[next_index: next_index + max_count]) else -1), + "userRivalMusicList": user_rival_music_list[next_index: next_index + max_count] } - return result + def handle_get_user_favorite_item_api_request(self, data: Dict) -> Dict: user_fav_item_list = [] From 37b1f41b44a59d8bef98ea1f8aa00a5805bc983e Mon Sep 17 00:00:00 2001 From: Midorica Date: Fri, 15 Dec 2023 22:21:05 -0500 Subject: [PATCH 25/28] fixing the upgrade & downgrade script for chunithm --- core/data/schema/versions/SDBT_4_rollback.sql | 2 +- core/data/schema/versions/SDBT_5_upgrade.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/data/schema/versions/SDBT_4_rollback.sql b/core/data/schema/versions/SDBT_4_rollback.sql index 90a0e4f..81366ea 100644 --- a/core/data/schema/versions/SDBT_4_rollback.sql +++ b/core/data/schema/versions/SDBT_4_rollback.sql @@ -3,7 +3,7 @@ SET FOREIGN_KEY_CHECKS = 0; ALTER TABLE chuni_score_playlog CHANGE COLUMN isClear isClear TINYINT(1) NULL DEFAULT NULL; -ALTER TABLE aime.chuni_score_best +ALTER TABLE chuni_score_best CHANGE COLUMN isSuccess isSuccess TINYINT(1) NULL DEFAULT NULL ; ALTER TABLE chuni_score_playlog diff --git a/core/data/schema/versions/SDBT_5_upgrade.sql b/core/data/schema/versions/SDBT_5_upgrade.sql index ab362bb..81a094a 100644 --- a/core/data/schema/versions/SDBT_5_upgrade.sql +++ b/core/data/schema/versions/SDBT_5_upgrade.sql @@ -3,7 +3,7 @@ SET FOREIGN_KEY_CHECKS = 0; ALTER TABLE chuni_score_playlog CHANGE COLUMN isClear isClear TINYINT(6) NULL DEFAULT NULL; -ALTER TABLE aime.chuni_score_best +ALTER TABLE chuni_score_best CHANGE COLUMN isSuccess isSuccess INT(11) NULL DEFAULT NULL ; ALTER TABLE chuni_score_playlog From bf7d709b49f7ce85ef36fe61a1e10905142c3b1a Mon Sep 17 00:00:00 2001 From: Midorica Date: Fri, 15 Dec 2023 22:22:36 -0500 Subject: [PATCH 26/28] chuni: fixing the network encryption for Sun Plus --- titles/chuni/index.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/titles/chuni/index.py b/titles/chuni/index.py index 434d22f..fa8a394 100644 --- a/titles/chuni/index.py +++ b/titles/chuni/index.py @@ -101,8 +101,14 @@ class ChuniServlet(BaseServlet): ] for method in method_list: method_fixed = inflection.camelize(method)[6:-7] - # number of iterations was changed to 70 in SUN - iter_count = 70 if version >= ChuniConstants.VER_CHUNITHM_SUN else 44 + # number of iterations was changed to 70 in SUN and then to 36 + if version == ChuniConstants.VER_CHUNITHM_SUN_PLUS: + iter_count = 36 + elif version == ChuniConstants.VER_CHUNITHM_SUN: + iter_count = 70 + else: + iter_count = 44 + hash = PBKDF2( method_fixed, bytes.fromhex(keys[2]), From 32419faf019dae19f1b3e9546f9ba9f232385dbd Mon Sep 17 00:00:00 2001 From: Midorica Date: Fri, 29 Dec 2023 03:20:44 +0000 Subject: [PATCH 27/28] Update docs/game_specific_info.md Removing unused option details for cxb --- docs/game_specific_info.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 5810ff8..a06f17f 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -165,15 +165,6 @@ The importer for crossbeats REV. will import Music. Config file is located in `config/cxb.yaml`. -| Option | Info | -| --------------------- | ---------------------------------------------------------- | -| `hostname` | Requires a proper `hostname` (not localhost!) to run | -| `ssl_enable` | Enables/Disables the use of the `ssl_cert` and `ssl_key` | -| `port` | Set your unsecure port number | -| `port_secure` | Set your secure/SSL port number | -| `ssl_cert`, `ssl_key` | Enter your SSL certificate (requires not self signed cert) | - - ## maimai DX ### Versions From 19baf05d7bb19971dcae189388cda1c114146a4d Mon Sep 17 00:00:00 2001 From: Midorica Date: Fri, 29 Dec 2023 13:59:53 -0500 Subject: [PATCH 28/28] cxb: fixing get_allnet_info --- titles/cxb/index.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/titles/cxb/index.py b/titles/cxb/index.py index af728c6..04bbc92 100644 --- a/titles/cxb/index.py +++ b/titles/cxb/index.py @@ -76,13 +76,21 @@ class CxbServlet(BaseServlet): return True def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: - if not self.core_cfg.server.is_using_proxy and Utils.get_title_port_ssl(self.core_cfg): - return ( - f"https://{self.core_cfg.title.hostname}:{self.core_cfg.title.port_ssl}", - "", - ) + title_port_int = Utils.get_title_port(self.core_cfg) + title_port_ssl_int = Utils.get_title_port_ssl(self.core_cfg) + + proto = "https" if title_port_ssl_int != 443 else "http" - return (f"https://{self.core_cfg.title.hostname}", "") + if proto == "https": + t_port = f":{title_port_ssl_int}" if title_port_ssl_int and not self.core_cfg.server.is_using_proxy else "" + + else: + t_port = f":{title_port_int}" if title_port_int and not self.core_cfg.server.is_using_proxy else "" + + return ( + f"{proto}://{self.core_cfg.title.hostname}{t_port}", + "", + ) def get_endpoint_matchers(self) -> Tuple[List[Tuple[str, str, Dict]], List[Tuple[str, str, Dict]]]: return (