fix: make minor rom versions always use the major rom key
Some checks failed
Build and Publish Docker Image / build-and-push (push) Has been cancelled

This commit is contained in:
raymonable
2026-05-28 14:51:41 -04:00
parent 367a26c109
commit 06eec89dfe
2 changed files with 8 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ Card Maker has encryption features in the client, but they are not supported due
```json
{
"code": "SDHD",
"versions": [215, 216],
"versions": [215],
"key": "DECAFBADDECAFBADDECAFBADDECAFBADDECAFBADDECAFBADDECAFBADDECAFBAD",
"iv": "DECAFBADDECAFBADDECAFBADDECAFBAD",
"salt": "DECAFBADDECAFBAD",
@@ -27,7 +27,7 @@ Card Maker has encryption features in the client, but they are not supported due
Replace `code` with the correct code for your game (`SDHD` for Chunithm JP, `SDEZ` for Maimai JP, etc.).<br>
Set `versions` to be an array of game versions without the decimal (215 for 2.15, 150 for 1.50, etc.).<br>
You MUST include rom patch versions in this array or it will not encrypt correctly.
You must include the rom major version. Minor versions will automatically round down to use the major key.
- Maimai DX does NOT use iterations, you do not need to include it
- Ongeki always uses 64 iterations (you must include it)

View File

@@ -19,7 +19,7 @@ import java.util.*
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
import kotlin.math.floor
/**
* @author samnyan (privateamusement@protonmail.com)
@@ -36,6 +36,10 @@ class CompressionFilter(
}
fun truncateVersion(version: Number): Number {
return floor(version.toFloat() / 5.0) * 5;
}
var keys = gameData.chu3GameEncryption + gameData.mai2GameEncryption + gameData.ogkGameEncryption
fun getEncryptionKeys(path: String): GameEncryptionKey? {
val endpoint = path.split("/").last()
@@ -43,7 +47,7 @@ class CompressionFilter(
val game = path.split("/")[2]
val version = path.split("/")[3].filterNot { it == '.' }.toInt()
return keys.find { it.versions.contains(version) && it.code == game }
return keys.find { it.versions.contains(truncateVersion(version)) && it.code == game }
}
@OptIn(ExperimentalStdlibApi::class)