Skip to content

Commit

Permalink
Revision 228 (#45)
Browse files Browse the repository at this point in the history
* fix: make .txt transcripts of bin differ in last-modified timestamp

This ensures that tools such as notepad will pick up on changes to the
file, as they rely on the last-modified date changing.
The new implementation will begin the timestamp at .bin +1ms,
incrementing by +1ms every time the tool is re-ran, if the .txt file
already exists. Visually the timestamps will remain the same, but
for sorting purposes, and file-change-listeners, it'll behave as
one would want.

* feat: revision 228 (initial copy of 227)

* feat: update client prots to 228

* feat: fill in loc add change v2 (incomplete)

* feat: server prots

* feat: update proxy service to revision 228

* feat: update transcriber to support loc_add_change_v2

* fix: increment loc add change v2's op indices so it doesn't start at 0
  • Loading branch information
Z-Kris authored Jan 16, 2025
1 parent adfe663 commit 0f7071f
Show file tree
Hide file tree
Showing 256 changed files with 10,872 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprox.protocol.game.outgoing.model.util.OpFlags
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v223.game.outgoing.decoder.prot.GameServerProt

internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChange> {
internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChangeV1> {
override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE

override fun decode(
buffer: JagByteBuf,
session: Session,
): LocAddChange {
): LocAddChangeV1 {
val locProperties = LocProperties(buffer.g1Alt2())
val opFlags = OpFlags(buffer.g1Alt3())
val coordInZone = CoordInZone(buffer.g1Alt3())
val id = buffer.g2Alt2()
return LocAddChange(
return LocAddChangeV1(
id,
coordInZone,
locProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprox.protocol.game.outgoing.model.util.OpFlags
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v224.game.outgoing.decoder.prot.GameServerProt

internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChange> {
internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChangeV1> {
override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE

override fun decode(
buffer: JagByteBuf,
session: Session,
): LocAddChange {
): LocAddChangeV1 {
val locProperties = LocProperties(buffer.g1Alt2())
val coordInZone = CoordInZone(buffer.g1())
val opFlags = OpFlags(buffer.g1Alt2())
val id = buffer.g2Alt1()
return LocAddChange(
return LocAddChangeV1(
id,
coordInZone,
locProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprox.protocol.game.outgoing.model.util.OpFlags
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v225.game.outgoing.decoder.prot.GameServerProt

internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChange> {
internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChangeV1> {
override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE

override fun decode(
buffer: JagByteBuf,
session: Session,
): LocAddChange {
): LocAddChangeV1 {
val id = buffer.g2Alt2()
val opFlags = OpFlags(buffer.g1Alt2())
val locProperties = LocProperties(buffer.g1Alt2())
val coordInZone = CoordInZone(buffer.g1Alt2())
return LocAddChange(
return LocAddChangeV1(
id,
coordInZone,
locProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprox.protocol.game.outgoing.model.util.OpFlags
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v226.game.outgoing.decoder.prot.GameServerProt

internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChange> {
internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChangeV1> {
override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE

override fun decode(
buffer: JagByteBuf,
session: Session,
): LocAddChange {
): LocAddChangeV1 {
val locProperties = LocProperties(buffer.g1Alt3())
val opFlags = OpFlags(buffer.g1Alt3())
val id = buffer.g2Alt1()
val coordInZone = CoordInZone(buffer.g1Alt1())
return LocAddChange(
return LocAddChangeV1(
id,
coordInZone,
locProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprox.protocol.game.outgoing.model.util.OpFlags
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange
import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone
import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v227.game.outgoing.decoder.prot.GameServerProt

internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChange> {
internal class LocAddChangeDecoder : ProxyMessageDecoder<LocAddChangeV1> {
override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE

override fun decode(
buffer: JagByteBuf,
session: Session,
): LocAddChange {
): LocAddChangeV1 {
val opFlags = OpFlags(buffer.g1Alt1())
val id = buffer.g2()
val locProperties = LocProperties(buffer.g1Alt3())
val coordInZone = CoordInZone(buffer.g1())
return LocAddChange(
return LocAddChangeV1(
id,
coordInZone,
locProperties,
Expand Down
14 changes: 14 additions & 0 deletions protocol/osrs-228/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dependencies {
implementation(platform(rootProject.libs.netty.bom))
implementation(rootProject.libs.netty.buffer)
implementation(rootProject.libs.netty.transport)
implementation(rootProject.libs.netty.handler)
implementation(rootProject.libs.rsprot.buffer)
implementation(rootProject.libs.rsprot.compression)
implementation(rootProject.libs.rsprot.protocol)
implementation(rootProject.libs.rsprot.crypto)
implementation(platform(rootProject.libs.log4j.bom))
implementation(rootProject.libs.bundles.log4j)
implementation(projects.protocol)
implementation(projects.cache.cacheApi)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.rsprox.protocol.v228

import net.rsprot.buffer.JagByteBuf
import net.rsprot.compression.HuffmanCodec
import net.rsprot.protocol.message.IncomingMessage
import net.rsprox.protocol.ClientPacketDecoder
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v228.game.incoming.decoder.prot.ClientMessageDecoderRepository

public class ClientPacketDecoderServiceV228(
huffmanCodec: HuffmanCodec,
) : ClientPacketDecoder {
@OptIn(ExperimentalStdlibApi::class)
private val repository = ClientMessageDecoderRepository.build(huffmanCodec)

override fun decode(
opcode: Int,
payload: JagByteBuf,
session: Session,
): IncomingMessage {
return repository
.getDecoder(opcode)
.decode(payload, session)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.rsprox.protocol.v228

import net.rsprox.protocol.ProtProvider
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt

public data object GameClientProtProviderV228 : ProtProvider<GameClientProt> {
override fun get(opcode: Int): GameClientProt {
return GameClientProt.entries.firstOrNull { it.opcode == opcode }
?: throw IllegalArgumentException("Unknown game client prot: $opcode")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.rsprox.protocol.v228

import net.rsprox.protocol.ProtProvider
import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt

public data object GameServerProtProviderV228 : ProtProvider<GameServerProt> {
override fun get(opcode: Int): GameServerProt {
return GameServerProt.entries.firstOrNull { it.opcode == opcode }
?: throw IllegalArgumentException("Unknown game server prot: $opcode")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.rsprox.protocol.v228

import net.rsprot.buffer.JagByteBuf
import net.rsprot.compression.HuffmanCodec
import net.rsprot.protocol.message.IncomingMessage
import net.rsprox.cache.api.CacheProvider
import net.rsprox.protocol.ServerPacketDecoder
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.v228.game.outgoing.decoder.prot.ServerMessageDecoderRepository

public class ServerPacketDecoderServiceV228(
huffmanCodec: HuffmanCodec,
cache: CacheProvider,
) : ServerPacketDecoder {
@OptIn(ExperimentalStdlibApi::class)
private val repository =
ServerMessageDecoderRepository.build(
huffmanCodec,
cache,
)

override fun decode(
opcode: Int,
payload: JagByteBuf,
session: Session,
): IncomingMessage {
return repository
.getDecoder(opcode)
.decode(payload, session)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons

import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.game.incoming.model.buttons.If1Button
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprot.protocol.metadata.Consistent
import net.rsprot.protocol.util.gCombinedId

@Consistent
public class If1ButtonDecoder : ProxyMessageDecoder<If1Button> {
override val prot: ClientProt = GameClientProt.IF_BUTTON

override fun decode(
buffer: JagByteBuf,
session: Session,
): If1Button {
val combinedId = buffer.gCombinedId()
return If1Button(combinedId)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons

import net.rsprot.buffer.JagByteBuf
import net.rsprox.protocol.game.incoming.model.buttons.If3Button
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprot.protocol.metadata.Consistent
import net.rsprot.protocol.util.gCombinedId
import net.rsprox.protocol.session.Session

@Consistent
public class If3ButtonDecoder(
override val prot: GameClientProt,
private val op: Int,
) : ProxyMessageDecoder<If3Button> {
override fun decode(
buffer: JagByteBuf,
session: Session,
): If3Button {
val combinedId = buffer.gCombinedId()
val sub = buffer.g2()
val obj = buffer.g2()
return If3Button(
combinedId,
sub,
obj,
op,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons

import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.game.incoming.model.buttons.IfButtonD
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprot.protocol.util.gCombinedId

public class IfButtonDDecoder : ProxyMessageDecoder<IfButtonD> {
override val prot: ClientProt = GameClientProt.IF_BUTTOND

override fun decode(
buffer: JagByteBuf,
session: Session,
): IfButtonD {
val selectedObj = buffer.g2()
val targetSub = buffer.g2Alt2()
val selectedSub = buffer.g2Alt2()
val targetCombinedId = buffer.gCombinedId()
val targetObj = buffer.g2()
val selectedCombinedId = buffer.gCombinedId()
return IfButtonD(
selectedCombinedId,
selectedSub,
selectedObj,
targetCombinedId,
targetSub,
targetObj,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons

import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.game.incoming.model.buttons.IfButtonT
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprot.protocol.util.gCombinedIdAlt1
import net.rsprot.protocol.util.gCombinedIdAlt2

public class IfButtonTDecoder : ProxyMessageDecoder<IfButtonT> {
override val prot: ClientProt = GameClientProt.IF_BUTTONT

override fun decode(
buffer: JagByteBuf,
session: Session,
): IfButtonT {
val selectedCombinedId = buffer.gCombinedIdAlt1()
val targetSub = buffer.g2()
val targetCombinedId = buffer.gCombinedIdAlt2()
val selectedSub = buffer.g2Alt3()
val targetObj = buffer.g2Alt3()
val selectedObj = buffer.g2()
return IfButtonT(
selectedCombinedId,
selectedSub,
selectedObj,
targetCombinedId,
targetSub,
targetObj,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons

import net.rsprot.buffer.JagByteBuf
import net.rsprot.protocol.ClientProt
import net.rsprox.protocol.session.Session
import net.rsprox.protocol.game.incoming.model.buttons.IfSubOp
import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt
import net.rsprox.protocol.ProxyMessageDecoder
import net.rsprot.protocol.metadata.Consistent
import net.rsprot.protocol.util.gCombinedId

@Consistent
public class IfSubOpDecoder : ProxyMessageDecoder<IfSubOp> {
override val prot: ClientProt = GameClientProt.IF_SUBOP

override fun decode(
buffer: JagByteBuf,
session: Session,
): IfSubOp {
val combinedId = buffer.gCombinedId()
val sub = buffer.g2()
val obj = buffer.g2()
val subop = buffer.g1()
val op = buffer.g1()
return IfSubOp(
combinedId,
sub,
obj,
op + 1,
subop,
)
}
}
Loading

0 comments on commit 0f7071f

Please sign in to comment.