Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="javasteam [wrapper --gradle-version 8.12]" type="GradleRunConfiguration" factoryName="Gradle" nameIsGenerated="true">
<configuration default="false" name="javasteam [wrapper --gradle-version 8.14]" type="GradleRunConfiguration" factoryName="Gradle" nameIsGenerated="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
Expand All @@ -12,7 +12,7 @@
<list>
<option value="wrapper" />
<option value="--gradle-version" />
<option value="8.12" />
<option value="8.14" />
</list>
</option>
<option name="vmOptions" />
Expand Down
17 changes: 11 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,26 @@ tasks.jar {
}
}

/* Dependencies */
tasks["lintKotlinMain"].dependsOn("formatKotlin")
/* Tasks */
tasks["check"].dependsOn("jacocoTestReport")
tasks["compileJava"].dependsOn("generateSteamLanguage", "generateProjectVersion", "generateRpcMethods")
tasks["compileKotlin"].dependsOn("generateSteamLanguage", "generateProjectVersion", "generateRpcMethods")
tasks["generateRpcMethods"].dependsOn("extractProto", "extractIncludeProto")

// tasks["build"].finalizedBy("dokkaGenerate")
afterEvaluate {
tasks.named("lintKotlin") {
dependsOn("formatKotlin")
}
}

/* Kotlinter */
tasks.withType<LintTask> {
this.source = this.source.minus(fileTree("build/generated")).asFileTree
val generatedFile = "${File.separator}build${File.separator}generated"
exclude { it.file.path.contains(generatedFile) }
}

tasks.withType<FormatTask> {
this.source = this.source.minus(fileTree("build/generated")).asFileTree
val generatedFile = "${File.separator}build${File.separator}generated"
exclude { it.file.path.contains(generatedFile) }
}

/* JDK and Mockito self attachment fix */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ class JavaGen(

if ((node as ClassNode).ident != null) {
if (node.name.contains("MsgGC")) {
imports.add("in.dragonbra.javasteam.base.IGCSerializableMessage")
imports.add("in.dragonbra.javasteam.base.gc.IGCSerializableMessage")
} else {
imports.add("in.dragonbra.javasteam.base.ISteamSerializableMessage")
imports.add("in.dragonbra.javasteam.enums.EMsg")
}
} else if (node.name.contains("Hdr")) {
if (node.name.contains("MsgGC")) {
imports.add("in.dragonbra.javasteam.base.IGCSerializableHeader")
imports.add("in.dragonbra.javasteam.base.gc.IGCSerializableHeader")
} else {
imports.add("in.dragonbra.javasteam.base.ISteamSerializableHeader")
}
Expand Down
24 changes: 12 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@

[versions]
java = "11"
kotlin = "2.2.0" # https://kotlinlang.org/docs/releases.html#release-details
kotlin = "2.2.21" # https://kotlinlang.org/docs/releases.html#release-details
dokka = "2.0.0" # https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin
kotlinter = "5.1.1" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
jacoco = "0.8.13" # https://www.eclemma.org/jacoco
kotlinter = "5.3.0" # https://plugins.gradle.org/plugin/org.jmailen.kotlinter
jacoco = "0.8.14" # https://www.eclemma.org/jacoco

# Standard Library versions
commons-lang3 = "3.18.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
commons-lang3 = "3.20.0" # https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
kotlin-coroutines = "1.10.2" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
ktor = "3.2.2" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
okHttp = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
ktor = "3.3.3" # https://mvnrepository.com/artifact/io.ktor/ktor-client-cio
okHttp = "5.3.2" # https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
protobuf = "4.31.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
protobuf-gradle = "0.9.5" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
publishPlugin = "2.0.0" # https://mvnrepository.com/artifact/io.github.gradle-nexus/publish-plugin
xz = "1.10" # https://mvnrepository.com/artifact/org.tukaani/xz
zstd = "1.5.7-4" # https://search.maven.org/artifact/com.github.luben/zstd-jni
xz = "1.11" # https://mvnrepository.com/artifact/org.tukaani/xz
zstd = "1.5.7-6" # https://search.maven.org/artifact/com.github.luben/zstd-jni

# Testing Lib versions
commons-io = "2.20.0" # https://mvnrepository.com/artifact/commons-io/commons-io
commonsCodec = "1.19.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
commons-io = "2.21.0" # https://mvnrepository.com/artifact/commons-io/commons-io
commonsCodec = "1.20.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec
junit5 = "5.13.4" # https://mvnrepository.com/artifact/org.junit/junit-bom
mockWebServer = "5.1.0" # https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3-junit5
mockitoVersion = "5.18.0" # https://mvnrepository.com/artifact/org.mockito/mockito-core

# Samples
bouncyCastle = "1.81" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
gson = "2.13.1" # https://mvnrepository.com/artifact/com.google.code.gson/gson
bouncyCastle = "1.83" # https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
gson = "2.13.2" # https://mvnrepository.com/artifact/com.google.code.gson/gson
qrCode = "1.0.1" # https://mvnrepository.com/artifact/pro.leaco.qrcode/console-qrcode

[libraries]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package in.dragonbra.javasteamsamples._030_counterstrikegc;

import in.dragonbra.javasteam.base.ClientGCMsgProtobuf;
import in.dragonbra.javasteam.base.gc.ClientGCMsgProtobuf;
import in.dragonbra.javasteam.base.ClientMsgProtobuf;
import in.dragonbra.javasteam.enums.EAccountType;
import in.dragonbra.javasteam.enums.EMsg;
Expand Down
132 changes: 0 additions & 132 deletions src/main/java/in/dragonbra/javasteam/base/AClientMsgProtobuf.java

This file was deleted.

121 changes: 121 additions & 0 deletions src/main/java/in/dragonbra/javasteam/base/AClientMsgProtobuf.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package `in`.dragonbra.javasteam.base

import `in`.dragonbra.javasteam.enums.EMsg
import `in`.dragonbra.javasteam.generated.MsgHdrProtoBuf
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesBase
import `in`.dragonbra.javasteam.types.JobID
import `in`.dragonbra.javasteam.types.SteamID
import `in`.dragonbra.javasteam.util.log.LogManager
import `in`.dragonbra.javasteam.util.log.Logger
import `in`.dragonbra.javasteam.util.stream.MemoryStream
import java.io.IOException

/**
* Represents a protobuf backed client message. Only contains the header information.
*/
@Suppress("unused")
open class AClientMsgProtobuf : MsgBase<MsgHdrProtoBuf> {

companion object {
private val logger: Logger = LogManager.getLogger(AClientMsgProtobuf::class.java)
}

/**
* Shorthand accessor for the protobuf header.
*/
val protoHeader: SteammessagesBase.CMsgProtoBufHeader.Builder
get() = header.proto

/**
* Gets a value indicating whether this client message is protobuf backed.
* Client messages of this type are always protobuf backed.
* @return **true** if this instance is protobuf backed; otherwise, **false**.
*/
override val isProto: Boolean
get() = true

/**
* Gets the network message type of this client message.
* @return The network message type.
*/
override val msgType: EMsg
get() = header.msg

/**
* Gets or Sets the session id for this client message.
*/
override var sessionID: Int
get() = protoHeader.clientSessionid
set(value) {
protoHeader.clientSessionid = value
}

/**
* Gets or Sets the [SteamID] for this client message.
*/
override var steamID: SteamID?
get() = SteamID(protoHeader.steamid)
set(value) {
protoHeader.steamid = value!!.convertToUInt64()
}

/**
* Gets or Sets the target job id for this client message.
*/
override var targetJobID: JobID
get() = JobID(protoHeader.jobidTarget)
set(value) {
protoHeader.jobidTarget = value.value
}

/**
* Gets or Sets the source job id for this client message.
*/
override var sourceJobID: JobID
get() = JobID(protoHeader.jobidSource)
set(value) {
protoHeader.jobidSource = value.value
}

/**
* Initializes a new instance of the [AClientMsgProtobuf] class.
* This is a recieve constructor.
* @param msg The packet message to build this client message from.
*/
constructor(msg: IPacketMsg) : this(msg.msgType) {
if (!msg.isProto) {
logger.error("ClientMsgProtobuf used for non-proto message!")
}

deserialize(msg.data)
}

private constructor() : this(0)

internal constructor(payloadReserve: Int) : super(MsgHdrProtoBuf::class.java, payloadReserve)

private constructor(eMsg: EMsg, payloadReserve: Int = 0) : super(MsgHdrProtoBuf::class.java, payloadReserve) {
// set our emsg
header.setEMsg(eMsg)
}

/**
* Serializes this client message instance to a byte array.
* @throws UnsupportedOperationException This class is for reading Protobuf messages only. If you want to create a protobuf message, use [ClientMsgProtobuf].
*/
override fun serialize(): ByteArray = throw UnsupportedOperationException("ClientMsgProtobuf is for reading only. Use ClientMsgProtobuf<T> for serializing messages.")

/**
* Initializes this client message by deserializing the specified data.
* @param data The data representing a client message.
*/
override fun deserialize(data: ByteArray) {
try {
MemoryStream(data).use { ms ->
header.deserialize(ms)
}
} catch (e: IOException) {
logger.error(e)
}
}
}
Loading