Skip to content
Merged
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
Expand Up @@ -16,6 +16,7 @@ import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver2
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserver2.CMsgClientRequestFreeLicense
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverAppinfo.CMsgClientPICSAccessTokenRequest
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverAppinfo.CMsgClientPICSChangesSinceRequest
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverAppinfo.CMsgClientPICSPrivateBetaRequest
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverAppinfo.CMsgClientPICSProductInfoRequest
import `in`.dragonbra.javasteam.steam.handlers.ClientMsgHandler
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.AppOwnershipTicketCallback
Expand All @@ -29,6 +30,7 @@ import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.LicenseListCal
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PICSChangesCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PICSProductInfoCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PICSTokensCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PrivateBetaCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.PurchaseResponseCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.RedeemGuestPassResponseCallback
import `in`.dragonbra.javasteam.steam.handlers.steamapps.callback.VACStatusCallback
Expand All @@ -37,6 +39,7 @@ import `in`.dragonbra.javasteam.types.AsyncJobMultiple
import `in`.dragonbra.javasteam.types.AsyncJobSingle
import `in`.dragonbra.javasteam.types.GameID
import `in`.dragonbra.javasteam.util.NetHelpers
import io.ktor.client.request.request

/**
* This handler is used for interacting with apps and packages on the Steam network.
Expand Down Expand Up @@ -293,7 +296,7 @@ class SteamApps : ClientMsgHandler() {
*/
fun getLegacyGameKey(appId: Int): AsyncJobSingle<LegacyGameKeyCallback> {
val request = ClientMsg(MsgClientGetLegacyGameKey::class.java).apply {
sourceJobID = (client.getNextJobID())
sourceJobID = client.getNextJobID()
body.appId = appId
}

Expand All @@ -302,6 +305,37 @@ class SteamApps : ClientMsgHandler() {
return AsyncJobSingle(client, request.sourceJobID)
}

/**
* Submit a beta password for a given app to retrieve any betas and their encryption keys.
* Results are returned in a [CheckAppBetaPasswordCallback] callback.
* The returned [AsyncJobSingle] can also be awaited to retrieve the callback result.
* @param app App id requested.
* @param accessToken Access token associated with the app.
* @param branch The branch name.
* @param branchPasswordHash The branch password from [CheckAppBetaPasswordCallback]
* @return The Job ID of the request. This can be used to find the appropriate [CheckAppBetaPasswordCallback].
*/
fun picsGetPrivateBeta(
app: Int,
accessToken: Long,
branch: String,
branchPasswordHash: ByteArray,
): AsyncJobSingle<PrivateBetaCallback> {
val request = ClientMsgProtobuf<CMsgClientPICSPrivateBetaRequest.Builder>(
CMsgClientPICSPrivateBetaRequest::class.java,
EMsg.ClientPICSPrivateBetaRequest
).apply {
sourceJobID = client.getNextJobID()

body.appid = app
body.accessToken = accessToken
body.betaName = branch
body.passwordHash = ByteString.copyFrom(branchPasswordHash)
}

return AsyncJobSingle(client, request.sourceJobID)
}

/**
* An event sent to Steam after syncing user files during launch to notify Steam of the
* app that is launching.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package `in`.dragonbra.javasteam.steam.handlers.steamapps.callback

import `in`.dragonbra.javasteam.base.ClientMsgProtobuf
import `in`.dragonbra.javasteam.base.IPacketMsg
import `in`.dragonbra.javasteam.enums.EResult
import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesClientserverAppinfo.CMsgClientPICSPrivateBetaResponse
import `in`.dragonbra.javasteam.steam.steamclient.callbackmgr.CallbackMsg
import `in`.dragonbra.javasteam.types.KeyValue
import `in`.dragonbra.javasteam.util.stream.MemoryStream

/**
* This callback is received when a private beta request has been completed
*/
class PrivateBetaCallback(packetMsg: IPacketMsg) : CallbackMsg() {

/**
* Result of the operation
*/
val result: EResult

/**
* Gets the keyvalue info to be merged into main appinfo
*/
val depotSection: KeyValue

init {
val response = ClientMsgProtobuf<CMsgClientPICSPrivateBetaResponse.Builder>(
CMsgClientPICSPrivateBetaResponse::class.java,
packetMsg
)
val msg = response.body

jobID = response.targetJobID

result = EResult.from(msg.eresult)

depotSection = KeyValue()

if (msg.depotSection != null && msg.depotSection.size() > 0) {
// we don't want to read the trailing null byte
MemoryStream(msg.depotSection.toByteArray(), 0, msg.depotSection.size() - 1).use { ms ->
depotSection.readAsText(ms)
}
}
}
}
10 changes: 10 additions & 0 deletions src/main/steamd/in/dragonbra/javasteam/emsg.steamd
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,8 @@ enum EMsg
ClientPICSProductInfoResponse = 8904;
ClientPICSAccessTokenRequest = 8905;
ClientPICSAccessTokenResponse = 8906;
ClientPICSPrivateBetaRequest = 8907;
ClientPICSPrivateBetaResponse = 8908;

WorkerProcess = 9000;
WorkerProcessPingRequest = 9000;
Expand Down Expand Up @@ -1915,6 +1917,8 @@ enum EMsg
DRMWorkerProcessUnpackBlobResponse = 9131;
DRMWorkerProcessInstallAllRequest = 9132;
DRMWorkerProcessInstallAllResponse = 9133;
DRMWorkerProcessSignFile = 9134;
DRMWorkerProcessSignFileResponse = 9135;

TestWorkerProcess = 9200;
TestWorkerProcessLoadUnloadModuleRequest = 9200;
Expand Down Expand Up @@ -1956,6 +1960,12 @@ enum EMsg
ClientUnlockHEVCResponse = 9514;
RemoteClientStatusRequest = 9515;
RemoteClientStatusResponse = 9516;
RemoteClientAuthorizationRequest = 9517;
RemoteClientAuthorizationResponse = 9518;
RemoteClientAuthorizationCancelRequest = 9519;
RemoteClientAuthorizationConfirmed = 9520;
RemoteClientProofRequest = 9521;
RemoteClientProofResponse = 9522;

ClientConcurrentSessionsBase = 9600;
ClientPlayingSessionState = 9600;
Expand Down
1 change: 1 addition & 0 deletions src/main/steamd/in/dragonbra/javasteam/enums.steamd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

enum EUniverse
{
Invalid = 0;
Expand Down