Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6406402
Don't reset cached persona state on profile-only PersonaState replies
LossyDragon Nov 12, 2026
fbc511f
Bump to new version
LossyDragon Nov 12, 2026
9e2fa03
Don't reset cached persona state on profile-only PersonaState replies
LossyDragon Nov 12, 2026
64dae1b
Bump to new version
LossyDragon Nov 12, 2026
167bf30
Enable parallel sync
LossyDragon Nov 12, 2026
dcad448
Merge remote-tracking branch 'origin/post-fixes' into post-fixes
LossyDragon Nov 12, 2026
5563bae
Fail depot downloads instead of hanging or silently completing. Add o…
LossyDragon Nov 13, 2026
0b474cb
Remove unneeded array copies and allocations per depot chunk. Fix VZs…
LossyDragon Nov 13, 2026
ffb7eec
Silly lint issues
LossyDragon Nov 13, 2026
d06f428
Add todo about remaining lint warning
LossyDragon Nov 13, 2026
a5f1767
Log depot chunk download failures once, in DepotDownloader
LossyDragon Nov 14, 2026
6e74dda
lshal silently crashed on Android, bail Android out quicker when getM…
LossyDragon Nov 14, 2026
dd39f7a
I just want DD to be optimized. Reuse the Zstd input buffer between d…
LossyDragon Nov 14, 2026
960063d
Fix cdn.Client.close() shutting down the shared HTTP client. Fix work…
LossyDragon Nov 14, 2026
b6a7d22
Use java.util.zip.Adler32 for Adler32 and correct for the seed. This …
LossyDragon Nov 14, 2026
12300e9
Allow cdn.Client.downloadDepotChunk to use a destination longer tha…
LossyDragon Nov 14, 2026
566f756
Pool depot chunk buffers in DepotDownloader. Add maxDecompress parameter
LossyDragon Nov 14, 2026
25ee7fc
Decrypt depot chunks in place with the platform AES provider. Add a D…
LossyDragon Nov 14, 2026
a312aab
Cancel timed out jobs with AsyncJobTimeoutException. Fire onChunkComp…
LossyDragon Nov 16, 2026
e978b51
Sync and add new protos
LossyDragon Nov 16, 2026
55169fd
Fix bad compille from new protos
LossyDragon Nov 16, 2026
57d6820
Fix bad compille from new protos
LossyDragon Nov 16, 2026
3209cd8
Merge remote-tracking branch 'origin/post-fixes' into post-fixes
LossyDragon Nov 16, 2026
32bb2dc
add friendslist webui proto
LossyDragon Nov 16, 2026
11651eb
Add webui wishlist proto
LossyDragon Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ Maven
to add the [protobuf-java](https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java) dependency.
* Note: To eliminate any errors or warnings, you should try and match the same version JavaSteam uses.
<br><br>
* Content Downloading:
* Add the following dependencies to your project: [XZ For Java](https://mvnrepository.com/artifact/org.tukaani/xz) and [ZSTD JNI](https://mvnrepository.com/artifact/com.github.luben/zstd-jni).
* ZSTD for android uses `aar` for the libray type.
* Content Downloading (required if you download depots, otherwise optional):
* Add [XZ For Java](https://mvnrepository.com/artifact/org.tukaani/xz) and [ZSTD JNI](https://mvnrepository.com/artifact/com.github.luben/zstd-jni) to your project.
Without them, downloads fail with a `NoClassDefFoundError`.
* On Android, ZSTD must be the `aar` artifact: `implementation("com.github.luben:zstd-jni:<version>@aar")`

You can find the latest version of these dependencies JavaSteam
supports [here](https://github.com/Longi94/JavaSteam/blob/master/gradle/libs.versions.toml).
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {

allprojects {
group = "in.dragonbra"
version = "1.8.1-SNAPSHOT"
version = "1.9.0-SNAPSHOT"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class RpcGenTask : DefaultTask {
outputDir.deleteRecursively()
outputDir.mkdirs()

val protoParser = ProtoParser(outputDir)
val protoParser = ProtoParser(outputDir, protoDirectory)

protoDirectory.walkTopDown()
.filter { it.isFile && it.extension == "proto" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import java.io.File
import java.util.*

class ProtoParser(private val outputDir: File) {
class ProtoParser(private val outputDir: File, private val protoRoot: File) {

private companion object {
private const val RPC_PACKAGE = "in.dragonbra.javasteam.rpc"
Expand All @@ -19,6 +19,60 @@ class ProtoParser(private val outputDir: File) {
.addMember("%S", "RedundantVisibilityModifier") // KotlinPoet is an explicit API generator
.addMember("%S", "unused") // All methods could be used.
.build()

private val topLevelMessageRegex = Regex("""(?m)^message\s+(\w+)""")
private val importRegex = Regex("""(?m)^import\s+(?:public\s+)?"([^"]+)"\s*;""")
}

// Top-level message names declared by each .proto file.
private val messagesByFile = mutableMapOf<File, Set<String>>()

// Files imported by each .proto file, limited to the ones that live under [protoRoot].
private val importsByFile = mutableMapOf<File, List<File>>()

private fun messagesOf(file: File): Set<String> = messagesByFile.getOrPut(file) {
topLevelMessageRegex.findAll(file.readText()).map { it.groupValues[1] }.toSet()
}

private fun importsOf(file: File): List<File> = importsByFile.getOrPut(file) {
importRegex.findAll(file.readText())
.map { File(protoRoot, it.groupValues[1]).canonicalFile }
.filter { it.isFile }
.toList()
}

/**
* Find the .proto file that declares [type], starting at [file] and then walking its imports breadth first.
* A service can use messages declared in an imported file (e.g. webui services and common.proto),
* and the generated Java class is nested in the outer class of the declaring file.
* Falls back to [file] if no declaration is found.
*/
private fun findDeclaringFile(file: File, type: String): File {
val start = file.canonicalFile
val visited = mutableSetOf(start)
val queue = ArrayDeque<File>().apply { add(start) }

while (queue.isNotEmpty()) {
val current = queue.removeFirst()
if (type in messagesOf(current)) {
return current
}
importsOf(current).filter(visited::add).forEach(queue::add)
}

return start
}

/**
* The generated protobuf class of [type], as referenced from [file].
*/
private fun messageClassName(file: File, type: String): ClassName {
val declaringFile = findDeclaringFile(file, type)
return ClassName(
packageName = "in.dragonbra.javasteam.protobufs." +
"${declaringFile.parentFile.name}.${transformProtoFileName(declaringFile.name)}",
type
)
}

/**
Expand Down Expand Up @@ -85,8 +139,6 @@ class ProtoParser(private val outputDir: File) {
* Build the [Service] to a class with all known RPC methods.
*/
private fun buildClass(file: File, service: Service) {
val protoFileName = transformProtoFileName(file.name)

val parentPathName = file.parentFile.name

// Class Builder
Expand Down Expand Up @@ -132,10 +184,7 @@ class ProtoParser(private val outputDir: File) {
if (method.responseType != "NoResponse") {
// HAS Response
numResponse++
val className = ClassName(
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.responseType
)
val className = messageClassName(file, method.responseType)
responseBlock.addStatement(
"\"${method.methodName}\" -> postResponseMsg<%T.Builder>(\n%T::class.java,\npacketMsg\n)",
className,
Expand All @@ -144,10 +193,7 @@ class ProtoParser(private val outputDir: File) {
} else {
// NO Response
numNotification++
val className = ClassName(
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
)
val className = messageClassName(file, method.requestType)
notificationBlock.addStatement(
"\"${method.methodName}\" -> postNotificationMsg<%T.Builder>(\n%T::class.java,\npacketMsg\n)",
className,
Expand Down Expand Up @@ -201,10 +247,7 @@ class ProtoParser(private val outputDir: File) {
.addModifiers(KModifier.PUBLIC)
.addParameter(
"request",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
)
messageClassName(file, method.requestType)
)

if (method.responseType != "NoResponse") {
Expand All @@ -217,16 +260,13 @@ class ProtoParser(private val outputDir: File) {
funcBuilder.returns(
asyncJobSingleClass.parameterizedBy(
serviceMethodResponseClass.parameterizedBy(
ClassName.bestGuess("in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName.${method.responseType}.Builder")
messageClassName(file, method.responseType).nestedClass("Builder")
)
)
)
funcBuilder.addStatement(
format = "return unifiedMessages!!.sendMessage(\n%T.Builder::class.java,\n%S,\nrequest\n)",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.responseType
),
messageClassName(file, method.responseType),
"${service.name}.${method.methodName}#1"
)
} else {
Expand All @@ -238,10 +278,7 @@ class ProtoParser(private val outputDir: File) {
)
funcBuilder.addStatement(
format = "unifiedMessages!!.sendNotification<%T.Builder>(\n%S,\nrequest\n)",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
),
messageClassName(file, method.requestType),
"${service.name}.${method.methodName}#1"
)
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ org.gradle.jvmargs=-Xmx4g -Didea.max.content.load.filesize=65536
kotlin.daemon.jvmargs=-Xmx2048m -Didea.max.content.load.filesize=65536

org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

# Enabled parallel sync for Gradle 9.4+
org.gradle.tooling.parallel=true
10 changes: 0 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jacoco = "0.8.16" # https://www.eclemma.org/jacoco
# Standard Library versions
commons-lang3 = "3.21.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
kotlin-coroutines = "1.11.0" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
ktor = "3.6.1" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
okHttp = "5.5.1" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
protobuf = "4.36.2" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
protobuf-gradle = "0.10.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
Expand Down Expand Up @@ -42,9 +41,6 @@ qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-q
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-stdib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-websocket = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
okHttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okHttp" }
okHttp-coroutines = { module = "com.squareup.okhttp3:okhttp-coroutines", version.ref = "okHttp" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }
Expand Down Expand Up @@ -96,12 +92,6 @@ testing = [
"zstd",
]

ktor = [
"ktor-client-core",
"ktor-client-cio",
"ktor-client-websocket",
]

okHttp = [
"okHttp",
"okHttp-coroutines",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ message CSVCMsg_Menu {
}

message CSVCMsg_UserMessage {
option (maximum_size_bytes) = 0;

optional int32 msg_type = 1;
optional bytes msg_data = 2;
optional int32 passthrough = 3;
Expand Down Expand Up @@ -419,9 +421,10 @@ message CSVCMsg_CreateStringTable {
optional int32 user_data_size_bits = 5;
optional int32 flags = 6;
optional bytes string_data = 7;
optional int32 uncompressed_size = 8;
optional bool data_compressed = 9;
optional bool using_varint_bitcounts = 10;

reserved 8;
}

message CSVCMsg_UpdateStringTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ message CMsgSource2SystemSpecs {
optional string cpu_brand = 2;
optional uint32 cpu_model = 3;
optional uint32 cpu_num_physical = 4;
optional uint32 cpu_num_logical = 5;
optional uint32 cpu_num_performance = 6;
optional uint32 cpu_num_efficiency = 7;
optional uint32 ram_physical_total_mb = 21;
optional string gpu_rendersystem_dll_name = 41;
optional uint32 gpu_vendor_id = 42;
Expand All @@ -39,6 +42,7 @@ message CMsgSource2SystemSpecs {
optional uint32 gpu_texture_memory_size_mb = 47;
optional uint32 backbuffer_width = 51;
optional uint32 backbuffer_height = 52;
optional uint32 thread_pool_workers = 61;
}

message CMsgSource2VProfLiteReportItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ message CSOAccountHeroInfo {
optional uint32 wins = 4;
optional uint32 hero_xp = 6;
optional uint32 brawl_wins = 7;
optional uint32 losses = 8;
optional uint32 brawl_losses = 9;
}

message CSOAccountChallenge {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ enum ECitadelGameMode {
k_ECitadelGameMode_StreetBrawl = 4;
k_ECitadelGameMode_ExploreNYC = 5;
k_ECitadelGameMode_Internal = 6;
k_ECitadelGameMode_Internal02 = 7;
}

enum ELobbyServerState {
Expand Down Expand Up @@ -263,6 +264,7 @@ message CSOCitadelHideoutLobby {
optional uint32 account_id = 1;
optional bool hideout_holiday_award_2024 = 30;
optional bool hideout_holiday_award_2025 = 32;
optional uint32 ranked_season_1_season_rank = 33;
}

enum EServerStatus {
Expand Down Expand Up @@ -380,6 +382,7 @@ message CSOCitadelParty {
optional uint32 rank_display_badge = 3;
repeated uint32 unlocked_heroes = 5;
optional bool in_calibration = 6;
optional uint32 max_rank_display_badge = 7;
}

message Member {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ message CMsgMatchData {
optional uint32 flags = 5;
optional uint32 imbued_ability_id = 6;
optional uint32 upgrade_info = 7;
optional uint32 purchase_source = 8;
}

message AuxStat {
Expand Down
12 changes: 11 additions & 1 deletion javasteam-depotdownloader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@ tasks.withType<FormatTask> {
dependencies {
implementation(rootProject)

implementation(libs.bundles.ktor)
implementation(libs.bundles.okHttp)
implementation(libs.commons.lang3)
implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.serialization.json)
implementation(libs.kotlin.stdib)
implementation(libs.okio)
implementation(libs.protobuf.java)

testImplementation(platform(libs.tests.junit.bom))
testImplementation(libs.tests.junit.jupiter)
testImplementation(libs.test.mock.webserver3)
testRuntimeOnly(libs.tests.junit.platform)
}

/* Testing */
tasks.test {
useJUnitPlatform()
}

/* Artifact publishing */
Expand Down
Loading
Loading