From 33422f6275510a255ad8acffc8ec182d3e37e4de Mon Sep 17 00:00:00 2001 From: Liam Nguyen <41634031+ToaHartor@users.noreply.github.com> Date: Mon, 1 May 2023 15:23:32 +0200 Subject: [PATCH] Some fixes for 2023042500+ (#5) * Increase maximum song number to unlock all songs * Crash fix on random songs starting 2023042500 --- sdvx@asphyxia/handlers/common.ts | 2 +- sdvx@asphyxia/handlers/features.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sdvx@asphyxia/handlers/common.ts b/sdvx@asphyxia/handlers/common.ts index ab1b797..37f0b01 100644 --- a/sdvx@asphyxia/handlers/common.ts +++ b/sdvx@asphyxia/handlers/common.ts @@ -71,7 +71,7 @@ export const common: EPR = async (info, data, send) => { } let songs = []; const gameVersion = getVersion(info); - let songNum = 2000; + let songNum = 3000; if(gameVersion === 2) songNum = 554; if(gameVersion === 3) songNum = 954; if(gameVersion === 4) songNum = 1368; diff --git a/sdvx@asphyxia/handlers/features.ts b/sdvx@asphyxia/handlers/features.ts index fe96650..50126d9 100644 --- a/sdvx@asphyxia/handlers/features.ts +++ b/sdvx@asphyxia/handlers/features.ts @@ -63,6 +63,7 @@ export const hiscore: EPR = async (info, data, send) => { export const rival: EPR = async (info, data, send) => { const refid = $(data).str('refid'); + const version = parseInt(info.model.split(":")[4]); if (!refid) return send.deny(); const rivals = ( @@ -79,7 +80,8 @@ export const rival: EPR = async (info, data, send) => { music: ( await DB.Find(p.__refid, { collection: 'music' }) ).map(r => ({ - param: K.ARRAY('u32', [r.mid, r.type, r.score, r.clear, r.grade]), + // Changes were somehow made in the order of the field for the version 2023042500 + param: K.ARRAY('u32', version < 2023042500 ? [r.mid, r.type, r.score, r.clear, r.grade] : [r.mid, r.type, r.score, r.grade, r.clear]), })), }; })