From 817e969d4cb50e10eea3e68f2563dfce50bc6765 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:07:36 +0300 Subject: [PATCH 01/12] UpdateEyePodState to net --- lua/entities/gmod_wire_eyepod.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lua/entities/gmod_wire_eyepod.lua b/lua/entities/gmod_wire_eyepod.lua index 37e1f34e94..80950a61b2 100644 --- a/lua/entities/gmod_wire_eyepod.lua +++ b/lua/entities/gmod_wire_eyepod.lua @@ -9,17 +9,14 @@ if CLIENT then local rotate90 = false local freezePitch = true local freezeYaw = true - local previousEnabled = false - usermessage.Hook("UpdateEyePodState", function(um) - if not um then return end - - local eyeAng = um:ReadAngle() - enabled = um:ReadBool() - rotate90 = um:ReadBool() - freezePitch = um:ReadBool() and eyeAng.p - freezeYaw = um:ReadBool() and eyeAng.y + net.Receive("UpdateEyePodState", function() + local eyeAng = net.ReadAngle() + enabled = net.ReadBool() + rotate90 = net.ReadBool() + freezePitch = net.ReadBool() and eyeAng.p + freezeYaw = net.ReadBool() and eyeAng.y end) hook.Add("CreateMove", "WireEyePodEyeControl", function(ucmd) @@ -52,6 +49,7 @@ if CLIENT then end -- Server +util.AddNetworkString("UpdateEyePodState") function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) @@ -203,13 +201,14 @@ end function ENT:updateEyePodState(enabled) self:ColorByLinkStatus(enabled and self.LINK_STATUS_ACTIVE or self.LINK_STATUS_LINKED) - umsg.Start("UpdateEyePodState", self.driver) - umsg.Angle(self.eyeAng) - umsg.Bool(enabled) - umsg.Bool(self.rotate90) - umsg.Bool(self.freezePitch) - umsg.Bool(self.freezeYaw) - umsg.End() + + net.Start("UpdateEyePodState") + net.WriteAngle(self.eyeAng) + net.WriteBool(enabled) + net.WriteBool(self.rotate90) + net.WriteBool(self.freezePitch) + net.WriteBool(self.freezeYaw) + net.Send(self.driver) end hook.Add("PlayerEnteredVehicle","gmod_wire_eyepod_entervehicle",function(ply,vehicle) From c2291d8169853ce0d261fd0500b4d22fb65d7515 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:08:53 +0300 Subject: [PATCH 02/12] e2_remoteupload_request to net --- .../core/custom/cl_remoteupload.lua | 6 +++--- .../gmod_wire_expression2/core/custom/remoteupload.lua | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/custom/cl_remoteupload.lua b/lua/entities/gmod_wire_expression2/core/custom/cl_remoteupload.lua index e8a16123b7..e064ceb589 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/cl_remoteupload.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/cl_remoteupload.lua @@ -1,6 +1,6 @@ -usermessage.Hook("e2_remoteupload_request", function(um) - local target = um:ReadEntity() - local filepath = um:ReadString() +net.Receive("e2_remoteupload_request", function() + local target = net.ReadEntity() + local filepath = net.ReadString() if target and target:IsValid() and filepath and file.Exists("expression2/" .. filepath, "DATA") then local str = file.Read("expression2/" .. filepath) diff --git a/lua/entities/gmod_wire_expression2/core/custom/remoteupload.lua b/lua/entities/gmod_wire_expression2/core/custom/remoteupload.lua index 9f70a91d5f..f5a5fffa74 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/remoteupload.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/remoteupload.lua @@ -11,7 +11,7 @@ local function check(ply) end end -umsg.PoolString("e2_remoteupload_request") +util.AddNetworkString("e2_remoteupload_request") local function checkE2Chip(self, this) if not IsValid(this) then return self:throw("Invalid entity!", nil) end @@ -25,10 +25,10 @@ e2function void entity:remoteUpload( string filepath ) if not checkE2Chip(self, this) then return end if not check(self.player) then return end - umsg.Start( "e2_remoteupload_request", self.player ) - umsg.Entity( this ) - umsg.String( filepath ) - umsg.End() + net.Start( "e2_remoteupload_request" ) + net.WriteEntity( this ) + net.WriteString( filepath ) + net.Send( self.player ) end __e2setcost(250) From 5c279f644d1d33207090d7146fda3df7c0ef9899 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:10:50 +0300 Subject: [PATCH 03/12] wire_clutch_links to net --- lua/wire/stools/clutch.lua | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lua/wire/stools/clutch.lua b/lua/wire/stools/clutch.lua index 4bf03ee713..f482d04fed 100644 --- a/lua/wire/stools/clutch.lua +++ b/lua/wire/stools/clutch.lua @@ -30,15 +30,17 @@ local Send_Links if SERVER then // Send info: constraints associated with the selected clutch controller Send_Links = function( ply, constrained_pairs ) - umsg.Start( "wire_clutch_links", ply ) - local num_constraints = #constrained_pairs - umsg.Short( num_constraints ) + net.Start( "wire_clutch_links" ) - for k, v in pairs( constrained_pairs ) do - umsg.Entity( v.Ent1 ) - umsg.Entity( v.Ent2 ) - end - umsg.End() + local num_constraints = #constrained_pairs + net.WriteUInt( num_constraints, 16 ) + + for k, v in pairs( constrained_pairs ) do + net.WriteEntity( v.Ent1 ) + net.WriteEntity( v.Ent2 ) + end + + net.Send( ply ) end end @@ -52,14 +54,14 @@ if CLIENT then local Unique_Ents = {} -- Table of entities as keys // Receive stage 0 info - local function Receive_links( um ) + local function Receive_links() table.Empty( Linked_Ents ) - local num_constraints = um:ReadShort() or 0 + local num_constraints = net.ReadUInt(16) if num_constraints ~= 0 then for i = 1, num_constraints do - local Ent1 = um:ReadEntity() - local Ent2 = um:ReadEntity() + local Ent1 = net.ReadEntity() + local Ent2 = net.ReadEntity() table.insert( Linked_Ents, {Ent1 = Ent1, Ent2 = Ent2} ) Unique_Ents[Ent1] = true @@ -68,7 +70,7 @@ if CLIENT then end end - usermessage.Hook( "wire_clutch_links", Receive_links ) + net.Receive( "wire_clutch_links", Receive_links ) /*--------------------------------------------------------- -- DrawHUD -- From ef02e2015574a246117a2e38c6fc0e19daab9398 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:13:58 +0300 Subject: [PATCH 04/12] Add missing network string for wire_clutch_links --- lua/wire/stools/clutch.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/wire/stools/clutch.lua b/lua/wire/stools/clutch.lua index f482d04fed..d8080cf81f 100644 --- a/lua/wire/stools/clutch.lua +++ b/lua/wire/stools/clutch.lua @@ -29,6 +29,8 @@ local Send_Links if SERVER then // Send info: constraints associated with the selected clutch controller + util.AddNetworkString( "wire_clutch_links" ) + Send_Links = function( ply, constrained_pairs ) net.Start( "wire_clutch_links" ) From 7830b0bc8830396aacf9fda3c4cf3f1e98242c54 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:45:09 +0300 Subject: [PATCH 05/12] HUD Indicator to net --- .../gmod_wire_hudindicator/cl_init.lua | 121 +++++++++--------- lua/entities/gmod_wire_hudindicator/init.lua | 78 ++++++----- 2 files changed, 103 insertions(+), 96 deletions(-) diff --git a/lua/entities/gmod_wire_hudindicator/cl_init.lua b/lua/entities/gmod_wire_hudindicator/cl_init.lua index 460375604b..8781893760 100644 --- a/lua/entities/gmod_wire_hudindicator/cl_init.lua +++ b/lua/entities/gmod_wire_hudindicator/cl_init.lua @@ -185,72 +185,67 @@ local function CheckHITableElement(eindex) end end --- UserMessage stuff -local function HUDIndicatorRegister( um ) - local eindex = um:ReadShort() - CheckHITableElement(eindex) - - hudindicators[eindex].Description = um:ReadString() - hudindicators[eindex].ShowValue = um:ReadShort() - local tempstyle = um:ReadShort() - if hudindicators[eindex].Style ~= tempstyle then - hudindicators[eindex].Ready = false -- Make sure that everything's ready first before drawing - end - hudindicators[eindex].Style = tempstyle +-- Net stuff +local actions = { + function() -- 1, HUDIndicatorRegister + local eindex = net.ReadUInt(MAX_EDICT_BITS) + CheckHITableElement(eindex) + + hudindicators[eindex].Description = net.ReadString() + hudindicators[eindex].ShowValue = net.ReadInt(16) + local tempstyle = net.ReadInt(16) + if hudindicators[eindex].Style ~= tempstyle then + hudindicators[eindex].Ready = false -- Make sure that everything's ready first before drawing + end + hudindicators[eindex].Style = tempstyle - if not hudindicators[eindex].Factor then -- First-time register - hudindicators[eindex].Factor = 0 - hudindicators[eindex].Value = 0 - hudindicators[eindex].HideHUD = false - hudindicators[eindex].BoxWidth = 100 + if not hudindicators[eindex].Factor then -- First-time register + hudindicators[eindex].Factor = 0 + hudindicators[eindex].Value = 0 + hudindicators[eindex].HideHUD = false + hudindicators[eindex].BoxWidth = 100 + end + HUDFormatDescription( eindex ) + end, + function() -- 2, HUDIndicatorUnRegister + local eindex = net.ReadUInt(MAX_EDICT_BITS) + hudindicators[eindex] = nil + end, + function() -- 3, HUDIndicatorFactor + local eindex = net.ReadUInt(MAX_EDICT_BITS) + CheckHITableElement(eindex) + + hudindicators[eindex].Factor = net.ReadFloat() + hudindicators[eindex].Value = net.ReadFloat() + HUDFormatDescription( eindex ) + end, + function() -- 4, HUDIndicatorHideHUD + local eindex = net.ReadUInt(MAX_EDICT_BITS) + CheckHITableElement(eindex) + + hudindicators[eindex].HideHUD = net.ReadBool() + end, + function() -- 5, HUDIndicatorStylePercent + local eindex = net.ReadUInt(MAX_EDICT_BITS) + local ainfo = string.Explode("|", net.ReadString()) + local binfo = string.Explode("|", net.ReadString()) + CheckHITableElement(eindex) + + hudindicators[eindex].AColor = { r = ainfo[1], g = ainfo[2], b = ainfo[3]} + hudindicators[eindex].BColor = { r = binfo[1], g = binfo[2], b = binfo[3]} + end, + function() -- 6, HUDIndicatorStyleFullCircle + local eindex = net.ReadUInt(MAX_EDICT_BITS) + CheckHITableElement(eindex) + + hudindicators[eindex].FullCircleAngle = net.ReadFloat() + HUDFormatDescription( eindex ) -- So the gauge updates with FullCircleAngle factored in end - HUDFormatDescription( eindex ) -end -usermessage.Hook("HUDIndicatorRegister", HUDIndicatorRegister) - -local function HUDIndicatorUnRegister( um ) - local eindex = um:ReadShort() - hudindicators[eindex] = nil -end -usermessage.Hook("HUDIndicatorUnRegister", HUDIndicatorUnRegister) - -local function HUDIndicatorFactor( um ) - local eindex = um:ReadShort() - CheckHITableElement(eindex) - - hudindicators[eindex].Factor = um:ReadFloat() - hudindicators[eindex].Value = um:ReadFloat() - HUDFormatDescription( eindex ) -end -usermessage.Hook("HUDIndicatorFactor", HUDIndicatorFactor) +} -local function HUDIndicatorHideHUD( um ) - local eindex = um:ReadShort() - CheckHITableElement(eindex) - - hudindicators[eindex].HideHUD = um:ReadBool() -end -usermessage.Hook("HUDIndicatorHideHUD", HUDIndicatorHideHUD) - -local function HUDIndicatorStylePercent( um ) - local eindex = um:ReadShort() - local ainfo = string.Explode("|", um:ReadString()) - local binfo = string.Explode("|", um:ReadString()) - CheckHITableElement(eindex) - - hudindicators[eindex].AColor = { r = ainfo[1], g = ainfo[2], b = ainfo[3]} - hudindicators[eindex].BColor = { r = binfo[1], g = binfo[2], b = binfo[3]} -end -usermessage.Hook("HUDIndicatorStylePercent", HUDIndicatorStylePercent) - -local function HUDIndicatorStyleFullCircle( um ) - local eindex = um:ReadShort() - CheckHITableElement(eindex) - - hudindicators[eindex].FullCircleAngle = um:ReadFloat() - HUDFormatDescription( eindex ) -- So the gauge updates with FullCircleAngle factored in -end -usermessage.Hook("HUDIndicatorStyleFullCircle", HUDIndicatorStyleFullCircle) +net.Receive("HUDIndicatorAction", function() + actions[net.ReadUInt(3)]() +end) -- Check for updates every 1/5 seconds local function HUDIndicatorCheck() diff --git a/lua/entities/gmod_wire_hudindicator/init.lua b/lua/entities/gmod_wire_hudindicator/init.lua index f43f84ef2d..d9240447b5 100644 --- a/lua/entities/gmod_wire_hudindicator/init.lua +++ b/lua/entities/gmod_wire_hudindicator/init.lua @@ -4,6 +4,7 @@ AddCSLuaFile( "shared.lua" ) include('shared.lua') +util.AddNetworkString("HUDIndicatorAction") DEFINE_BASECLASS("base_wire_entity") ENT.WireDebugName = "HUD Indicator" @@ -149,16 +150,19 @@ function ENT:SetupHUDStyle(hudstyle, rplayer) -- Send as string (there should be a way to send colors) local ainfo = self.AR.."|"..self.AG.."|"..self.AB local binfo = self.BR.."|"..self.BG.."|"..self.BB - umsg.Start("HUDIndicatorStylePercent", pl) - umsg.Short(self:EntIndex()) - umsg.String(ainfo) - umsg.String(binfo) - umsg.End() + + net.Start("HUDIndicatorAction") + net.WriteUInt(5, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteString(ainfo) + net.WriteString(binfo) + net.Send(pl) elseif (hudstyle == 3) then -- Full Circle Gauge - umsg.Start("HUDIndicatorStyleFullCircle", pl) - umsg.Short(self:EntIndex()) - umsg.Float(self.FullCircleAngle) - umsg.End() + net.Start("HUDIndicatorAction") + net.WriteUInt(6, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteFloat(self.FullCircleAngle) + net.Send(pl) end end @@ -175,12 +179,14 @@ function ENT:RegisterPlayer(ply, hookhidehud, podonly) self:SetNWBool( plyuid, util.tobool(podonly) ) end - umsg.Start("HUDIndicatorRegister", ply) - umsg.Short(eindex) - umsg.String(self.HUDDesc or "") - umsg.Short(self.HUDShowValue) - umsg.Short(self.HUDStyle) - umsg.End() + net.Start("HUDIndicatorAction", ply) + net.WriteUInt(1, 3) + net.WriteUInt(eindex, MAX_EDICT_BITS) + net.WriteString(self.HUDDesc or "") + net.WriteInt(self.HUDShowValue) + net.WriteInt(self.HUDStyle) + net.Send(ply) + self:SetupHUDStyle(self.HUDStyle, ply) -- Trigger inputs to fully add this player to the list @@ -193,9 +199,11 @@ function ENT:RegisterPlayer(ply, hookhidehud, podonly) end function ENT:UnRegisterPlayer(ply) - umsg.Start("HUDIndicatorUnRegister", ply) - umsg.Short(self:EntIndex()) - umsg.End() + net.Start("HUDIndicatorAction") + net.WriteUInt(2, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.Send(ply) + self.RegisteredPlayers[ply:UniqueID()] = nil end @@ -249,12 +257,14 @@ function ENT:ShowOutput(factor, value) end end - umsg.Start("HUDIndicatorFactor", rf) - umsg.Short(self:EntIndex()) - -- Send both to ensure that all styles work properly - umsg.Float(factor) - umsg.Float(value) - umsg.End() + net.Start("HUDIndicatorAction") + net.WriteUInt(3, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + + -- Send both to ensure that all styles work properly + net.WriteFloat(factor) + net.WriteFloat(value) + net.Send(rf) end end @@ -265,15 +275,17 @@ function ENT:SendHUDInfo(hidehud) for index,rplayer in pairs(self.RegisteredPlayers) do if (rplayer.ply) then if rplayer.ply ~= pl or (self.ShowInHUD or self.PodPly == pl) then - umsg.Start("HUDIndicatorHideHUD", rplayer.ply) - umsg.Short(self:EntIndex()) - -- Check player's preference - if (rplayer.hookhidehud) then - umsg.Bool(hidehud) - else - umsg.Bool(false) - end - umsg.End() + net.Start("HUDIndicatorAction") + net.WriteUInt(4, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + + if (rplayer.hookhidehud) then + net.WriteBool(hidehud) + else + net.WriteBooll(false) + end + + net.Send(rplayer.ply) end else self.RegisteredPlayers[index] = nil From dfd2d2680a694e21a18a024024b3dfc24925d839 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:08:12 +0300 Subject: [PATCH 06/12] GPU to net --- lua/entities/gmod_wire_gpu/cl_init.lua | 97 +++++++++++++------------- lua/entities/gmod_wire_gpu/init.lua | 40 ++++++----- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/lua/entities/gmod_wire_gpu/cl_init.lua b/lua/entities/gmod_wire_gpu/cl_init.lua index e5b91db609..2962290f66 100644 --- a/lua/entities/gmod_wire_gpu/cl_init.lua +++ b/lua/entities/gmod_wire_gpu/cl_init.lua @@ -25,56 +25,53 @@ local function recalculateMonitorLookup() end end -local function GPU_MonitorState(um) - -- Read monitors for this GPU - local gpuIdx = um:ReadLong() - Monitors[gpuIdx] = {} - - -- Fetch all monitors - local count = um:ReadShort() - for i=1,count do - Monitors[gpuIdx][i] = um:ReadLong() - end - - -- Recalculate small lookup table for monitor system - recalculateMonitorLookup() -end -usermessage.Hook("wire_gpu_monitorstate", GPU_MonitorState) - +local actions = { + function() -- 1, wire_gpu_monitorstate + -- Read monitors for this GPU + local gpuIdx = net.ReadUInt(MAX_EDICT_BITS) + Monitors[gpuIdx] = {} + + -- Fetch all monitors + local count = net.ReadUInt(16) + for i=1,count do + Monitors[gpuIdx][i] = net.ReadInt(32) + end --------------------------------------------------------------------------------- --- Update GPU features/memory model --------------------------------------------------------------------------------- -local function GPU_MemoryModel(um) - local GPU = ents.GetByIndex(um:ReadLong()) - if not GPU then return end - if not GPU:IsValid() then return end - - if GPU.VM then - GPU.VM.ROMSize = um:ReadLong() - GPU.VM.SerialNo = um:ReadFloat() - GPU.VM.RAMSize = GPU.VM.ROMSize - else - GPU.ROMSize = um:ReadLong() - GPU.SerialNo = um:ReadFloat() - end - GPU.ChipType = um:ReadShort() -end -usermessage.Hook("wire_gpu_memorymodel", GPU_MemoryModel) - -local function GPU_SetExtensions(um) - local GPU = ents.GetByIndex(um:ReadLong()) - if not GPU then return end - if not GPU:IsValid() then return end - local extstr = um:ReadString() - local extensions = CPULib:FromExtensionString(extstr,"GPU") - if GPU.VM then - GPU.VM.Extensions = extensions - CPULib:LoadExtensions(GPU.VM,"GPU") + -- Recalculate small lookup table for monitor system + recalculateMonitorLookup() + end, + function() -- 2, wire_gpu_memorymodel + local GPU = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + if not GPU then return end + if not GPU:IsValid() then return end + + if GPU.VM then + GPU.VM.ROMSize = net.ReadInt(32) + GPU.VM.SerialNo = net.ReadFloat() + GPU.VM.RAMSize = GPU.VM.ROMSize + else + GPU.ROMSize = net.ReadInt(32) + GPU.SerialNo = net.ReadFloat() + end + GPU.ChipType = net.ReadInt(16) + end, + function() -- 3, wire_gpu_extensions + local GPU = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + if not GPU then return end + if not GPU:IsValid() then return end + local extstr = net.ReadString() + local extensions = CPULib:FromExtensionString(extstr,"GPU") + if GPU.VM then + GPU.VM.Extensions = extensions + CPULib:LoadExtensions(GPU.VM,"GPU") + end + GPU.ZVMExtensions = extstr end - GPU.ZVMExtensions = extstr -end -usermessage.Hook("wire_gpu_extensions", GPU_SetExtensions) +} + +net.Receive("wire_gpu_action", function() + actions[net.ReadUInt(2)]() +end) local wire_gpu_frameratio = CreateClientConVar("wire_gpu_frameratio",4) @@ -374,7 +371,7 @@ function ENT:Draw() -- Draw GPU itself self:DrawModel() - + local tone = render.GetToneMappingScaleLinear() render.SetToneMappingScaleLinear(VECTOR_1_1_1) @@ -458,7 +455,7 @@ function ENT:Draw() end end end - + render.SetToneMappingScaleLinear(tone) Wire_Render(self) end diff --git a/lua/entities/gmod_wire_gpu/init.lua b/lua/entities/gmod_wire_gpu/init.lua index 2815f2ea47..2fc3a7b26d 100644 --- a/lua/entities/gmod_wire_gpu/init.lua +++ b/lua/entities/gmod_wire_gpu/init.lua @@ -4,6 +4,7 @@ AddCSLuaFile("cl_gpuvm.lua") AddCSLuaFile("shared.lua") include("shared.lua") +util.AddNetworkString("wire_gpu_action") DEFINE_BASECLASS("base_wire_entity") ENT.WireDebugName = "ZGPU" @@ -36,13 +37,16 @@ function ENT:Initialize() end function ENT:UpdateClientMonitorState() - umsg.Start("wire_gpu_monitorstate") - umsg.Long(self:EntIndex()) - umsg.Short(#self.Monitors) - for idx=1,#self.Monitors do - umsg.Long(self.Monitors[idx]) - end - umsg.End() + net.Start("wire_gpu_action") + net.WriteUInt(1, 2) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteUInt(#self.Monitors, 16) + + for idx=1,#self.Monitors do + net.WriteInt(self.Monitors[idx], 32) + end + + net.Broadcast() end -------------------------------------------------------------------------------- -- Set processor @@ -65,12 +69,13 @@ function ENT:SetMemoryModel(model,initial) function() if not self:IsValid() then return end - umsg.Start("wire_gpu_memorymodel") - umsg.Long(self:EntIndex()) - umsg.Long (self.RAMSize) - umsg.Float(self.SerialNo) - umsg.Short(self.ChipType) - umsg.End() + net.Start("wire_gpu_action") + net.WriteUInt(2, 2) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteInt(self.RAMSize, 32) + net.WriteFloat(self.SerialNo) + net.WriteInt(self.ChipType, 16) + net.Broadcast() end) end end @@ -81,10 +86,11 @@ function ENT:SetExtensionLoadOrder(extstr) function() if not self:IsValid() then return end - umsg.Start("wire_gpu_extensions") - umsg.Long(self:EntIndex()) - umsg.String(self.ZVMExtensions) - umsg.End() + net.Start("wire_gpu_action") + net.WriteUInt(3, 2) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteString(self.ZVMExtensions) + net.Broadcast() end) end From 8ab806a4291cd92c8d410289d840967be929e7ba Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 18:01:42 +0300 Subject: [PATCH 07/12] SPU to net --- lua/entities/gmod_wire_spu/cl_init.lua | 133 ++++++++++++------------- lua/entities/gmod_wire_spu/init.lua | 55 +++++----- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/lua/entities/gmod_wire_spu/cl_init.lua b/lua/entities/gmod_wire_spu/cl_init.lua index 0155af6f94..4ba2c144e1 100644 --- a/lua/entities/gmod_wire_spu/cl_init.lua +++ b/lua/entities/gmod_wire_spu/cl_init.lua @@ -33,82 +33,73 @@ local function recalculateSoundEmitterLookup() end end -local function SPU_SoundEmitterState(um) - -- Read sound emitters for this SPU - local gpuIdx = um:ReadLong() - SoundEmitters[gpuIdx] = {} - - -- Fetch all sound emitters - local count = um:ReadShort() - for i=1,count do - SoundEmitters[gpuIdx][i] = um:ReadLong() - end - - -- Recalculate small lookup table for sound emitter system - recalculateSoundEmitterLookup() -end -usermessage.Hook("wire_spu_soundstate", SPU_SoundEmitterState) - -local function SPU_SoundSources(um) - local SPU = ents.GetByIndex(um:ReadLong()) - if not SPU then return end - if not SPU:IsValid() then return end - - for i=0,WireSPU_MaxChannels-1 do - local soundsource = ents.GetByIndex(um:ReadLong()) - - if soundsource:IsValid() then - SPU.SoundSources[i] = soundsource - SPU.SoundSources[i]:SetNoDraw(true) - SPU.SoundSources[i]:SetModelScale(0,0) +local actions = { + function() -- 1, wire_spu_soundstate + -- Read sound emitters for this SPU + local gpuIdx = net.ReadUInt(MAX_EDICT_BITS) + SoundEmitters[gpuIdx] = {} + + -- Fetch all sound emitters + local count = net.ReadUInt(16) + for i=1,count do + SoundEmitters[gpuIdx][i] = net.ReadInt(32) end - end - - -- Reset VM - SPU.VM:Reset() - SPU.VM.Memory[65535] = 1 - SPU.VM.Memory[65527] = 300000 -end -usermessage.Hook("wire_spu_soundsources", SPU_SoundSources) - - + -- Recalculate small lookup table for sound emitter system + recalculateSoundEmitterLookup() + end, + function() -- 2, wire_spu_soundsources + local SPU = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + if not SPU then return end + if not SPU:IsValid() then return end + + for i=0,WireSPU_MaxChannels-1 do + local soundsource = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + + if soundsource:IsValid() then + SPU.SoundSources[i] = soundsource + SPU.SoundSources[i]:SetNoDraw(true) + SPU.SoundSources[i]:SetModelScale(0,0) + end + end --------------------------------------------------------------------------------- --- Update SPU features/memory model --------------------------------------------------------------------------------- -local function SPU_MemoryModel(um) - local SPU = ents.GetByIndex(um:ReadLong()) - if not SPU then return end - if not SPU:IsValid() then return end - - if SPU.VM then - SPU.VM.ROMSize = um:ReadLong() - SPU.VM.SerialNo = um:ReadFloat() - SPU.VM.RAMSize = SPU.VM.ROMSize - else - SPU.ROMSize = um:ReadLong() - SPU.SerialNo = um:ReadFloat() - end - SPU.ChipType = um:ReadShort() -end -usermessage.Hook("wire_spu_memorymodel", SPU_MemoryModel) - -local function SPU_SetExtensions(um) - local SPU = ents.GetByIndex(um:ReadLong()) - if not SPU then return end - if not SPU:IsValid() then return end - local extstr = um:ReadString() - local extensions = CPULib:FromExtensionString(extstr,"SPU") - if SPU.VM then - SPU.VM.Extensions = extensions - CPULib:LoadExtensions(SPU.VM,"SPU") + -- Reset VM + SPU.VM:Reset() + SPU.VM.Memory[65535] = 1 + SPU.VM.Memory[65527] = 300000 + end, + function() -- 3, wire_spu_memorymodel + local SPU = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + if not SPU then return end + if not SPU:IsValid() then return end + + if SPU.VM then + SPU.VM.ROMSize = net.ReadInt(32) + SPU.VM.SerialNo = net.ReadFloat() + SPU.VM.RAMSize = SPU.VM.ROMSize + else + SPU.ROMSize = net.ReadInt(32) + SPU.SerialNo = net.ReadFloat() + end + SPU.ChipType = net.ReadInt(16) + end, + function() -- 4, wire_spu_extensions + local SPU = ents.GetByIndex(net.ReadUInt(MAX_EDICT_BITS)) + if not SPU then return end + if not SPU:IsValid() then return end + local extstr = net.ReadString() + local extensions = CPULib:FromExtensionString(extstr,"SPU") + if SPU.VM then + SPU.VM.Extensions = extensions + CPULib:LoadExtensions(SPU.VM,"SPU") + end + SPU.ZVMExtensions = extstr end - SPU.ZVMExtensions = extstr -end -usermessage.Hook("wire_spu_extensions", SPU_SetExtensions) - +} +net.Receive("wire_spu_action", function() + actions[net.ReadUInt(3)]() +end) -------------------------------------------------------------------------------- function ENT:Initialize() diff --git a/lua/entities/gmod_wire_spu/init.lua b/lua/entities/gmod_wire_spu/init.lua index 520728ea98..0bfebc9207 100644 --- a/lua/entities/gmod_wire_spu/init.lua +++ b/lua/entities/gmod_wire_spu/init.lua @@ -4,6 +4,7 @@ AddCSLuaFile("cl_spuvm.lua") AddCSLuaFile("shared.lua") include("shared.lua") +util.AddNetworkString("wire_spu_action") DEFINE_BASECLASS("base_wire_entity") ENT.WireDebugName = "ZSPU" @@ -51,12 +52,15 @@ function ENT:Initialize() function() if not self:IsValid() then return end - umsg.Start("wire_spu_soundsources") - umsg.Long(self:EntIndex()) - for i=0,WireSPU_MaxChannels-1 do - umsg.Long(self.SoundSources[i]:EntIndex()) - end - umsg.End() + net.Start("wire_spu_action") + net.WriteUInt(2, 3) + net.WriteUInt(self:EntIndex(), MAX_PLAYER_BITS) + + for i=0,WireSPU_MaxChannels-1 do + net.WriteUInt(self.SoundSources[i]:EntIndex(), MAX_EDICT_BITS) + end + + net.Broadcast() -- for i=0,WireSPU_MaxChannels-1 do -- self.SoundSources[i]:SetModelScale(Vector(0)) @@ -93,12 +97,13 @@ function ENT:SetMemoryModel(model,initial) function() if not self:IsValid() then return end - umsg.Start("wire_spu_memorymodel") - umsg.Long(self:EntIndex()) - umsg.Long (self.RAMSize) - umsg.Float(self.SerialNo) - umsg.Short(self.ChipType) - umsg.End() + net.Start("wire_spu_action") + net.WriteUInt(3, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteInt(self.RAMSize, 32) + net.WriteFloat(self.SerialNo) + net.WriteInt(self.ChipType, 16) + net.Broadcast() end) end end @@ -109,10 +114,11 @@ function ENT:SetExtensionLoadOrder(extstr) function() if not self:IsValid() then return end - umsg.Start("wire_spu_extensions") - umsg.Long(self:EntIndex()) - umsg.String(self.ZVMExtensions) - umsg.End() + net.Start("wire_spu_action") + net.WriteUInt(4, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteString(self.ZVMExtensions) + net.Broadcast() end) end @@ -336,13 +342,16 @@ function ENT:Think() -- Send update to all clients if soundEmittersChanged then - umsg.Start("wire_spu_soundstate") - umsg.Long(self:EntIndex()) - umsg.Short(#self.SoundEmitters) - for idx=1,#self.SoundEmitters do - umsg.Long(self.SoundEmitters[idx]) - end - umsg.End() + net.Start("wire_spu_action") + net.WriteUInt(1, 3) + net.WriteUInt(self:EntIndex(), MAX_EDICT_BITS) + net.WriteUInt(#self.SoundEmitters, 16) + + for idx=1,#self.SoundEmitters do + net.WriteInt(self.SoundEmitters[idx], 32) + end + + net.Broadcast() end end From 3808b48510bbbad40df5c2e5b2e3ab5860cff363 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 18:55:56 +0300 Subject: [PATCH 08/12] CPU to net --- lua/wire/cpulib.lua | 128 ++++++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 59 deletions(-) diff --git a/lua/wire/cpulib.lua b/lua/wire/cpulib.lua index e5e3c85074..655f17e331 100644 --- a/lua/wire/cpulib.lua +++ b/lua/wire/cpulib.lua @@ -422,43 +422,50 @@ if CLIENT or TESTING then ------------------------------------------------------------------------------ -- Debug data arrived from server - function CPULib.OnDebugData_Registers(um) - CPULib.Debugger.Variables.CS = um:ReadFloat() - CPULib.Debugger.Variables.IP = um:ReadFloat() - CPULib.Debugger.Variables.PHYSPAGE = um:ReadFloat() - CPULib.Debugger.Variables.EAX = um:ReadFloat() - CPULib.Debugger.Variables.EBX = um:ReadFloat() - CPULib.Debugger.Variables.ECX = um:ReadFloat() - CPULib.Debugger.Variables.EDX = um:ReadFloat() - CPULib.Debugger.Variables.ESI = um:ReadFloat() - CPULib.Debugger.Variables.EDI = um:ReadFloat() - CPULib.Debugger.Variables.EBP = um:ReadFloat() - CPULib.Debugger.Variables.ESP = um:ReadFloat() + function CPULib.OnDebugData_Registers() + CPULib.Debugger.Variables.CS = net.ReadFloat() + CPULib.Debugger.Variables.IP = net.ReadFloat() + CPULib.Debugger.Variables.PHYSPAGE = net.ReadFloat() + CPULib.Debugger.Variables.EAX = net.ReadFloat() + CPULib.Debugger.Variables.EBX = net.ReadFloat() + CPULib.Debugger.Variables.ECX = net.ReadFloat() + CPULib.Debugger.Variables.EDX = net.ReadFloat() + CPULib.Debugger.Variables.ESI = net.ReadFloat() + CPULib.Debugger.Variables.EDI = net.ReadFloat() + CPULib.Debugger.Variables.EBP = net.ReadFloat() + CPULib.Debugger.Variables.ESP = net.ReadFloat() CPULib.Debugger.Variables.CSIP = CPULib.Debugger.Variables.CS + CPULib.Debugger.Variables.IP CPULib.Debugger.Variables.PHYSIP = CPULib.Debugger.Variables.PHYSPAGE*128 + CPULib.Debugger.Variables.CSIP%128 for reg=0,31 do - CPULib.Debugger.Variables["R"..reg] = um:ReadFloat() + CPULib.Debugger.Variables["R"..reg] = net.ReadFloat() end CPULib.DebugUpdateHighlights(not CPULib.Debugger.FollowTracker) end - usermessage.Hook("cpulib_debugdata_registers", CPULib.OnDebugData_Registers) - function CPULib.OnDebugData_Variables(um) - local startIndex = um:ReadShort() + function CPULib.OnDebugData_Variables() + local startIndex = net.ReadInt(16) for varIdx = startIndex,startIndex+59 do if CPULib.Debugger.MemoryVariableByIndex[varIdx] then - CPULib.Debugger.Variables[CPULib.Debugger.MemoryVariableByIndex[varIdx]] = um:ReadFloat() + CPULib.Debugger.Variables[CPULib.Debugger.MemoryVariableByIndex[varIdx]] = net.ReadFloat() end end end - usermessage.Hook("cpulib_debugdata_variables", CPULib.OnDebugData_Variables) - function CPULib.OnDebugData_Interrupt(um) - local interruptNo,interruptParameter = um:ReadFloat(),um:ReadFloat() + function CPULib.OnDebugData_Interrupt() + local interruptNo,interruptParameter = net.ReadFloat(), net.ReadFloat() CPULib.InterruptText = "Error #"..interruptNo.. " ["..interruptParameter.."]" end - usermessage.Hook("cpulib_debugdata_interrupt", CPULib.OnDebugData_Interrupt) + + local actions = { + CPULib.OnDebugData_Registers, -- 1, cpulib_debugdata_registers + CPULib.OnDebugData_Variables, -- 2, cpulib_debugdata_variables + CPULib.OnDebugData_Interrupt -- 3, cpulib_debugdata_interrupt + } + + net.Receive("cpulib_debugdata_action", function() + actions[net.ReadUInt(2)]() + end) ------------------------------------------------------------------------------ -- Show ZCPU/ZGPU documentation @@ -701,16 +708,15 @@ if SERVER then } end + util.AddNetworkString("cpulib_debugdata_action") -- Log debug interrupt function CPULib.DebugLogInterrupt(player,interruptNo,interruptParameter,isExternal,cascadeInterrupt) - local umsgrp = RecipientFilter() - umsgrp:AddPlayer(player) - - umsg.Start("cpulib_debugdata_interrupt", umsgrp) - umsg.Float(interruptNo) - umsg.Float(interruptParameter) - umsg.End() + net.Start("cpulib_debugdata_action") + net.WriteUInt(3, 2) + net.WriteFloat(interruptNo) + net.WriteFloat(interruptParameter) + net.Send(player) end -- Send debug log entry to client @@ -720,43 +726,47 @@ if SERVER then -- Send debugging data to client function CPULib.SendDebugData(VM,MemPointers,Player,onlyMemPointers) - local umsgrp = RecipientFilter() - umsgrp:AddPlayer(Player) - if not onlyMemPointers then - umsg.Start("cpulib_debugdata_registers", umsgrp) - umsg.Float(VM.CS) - umsg.Float(VM.IP) - if(VM.CurrentPage.Remapped == 1) then - umsg.Float(VM.CurrentPage.MappedIndex) - else - umsg.Float(math.floor((VM.CS+VM.IP)/128)) - end - umsg.Float(VM.EAX) - umsg.Float(VM.EBX) - umsg.Float(VM.ECX) - umsg.Float(VM.EDX) - umsg.Float(VM.ESI) - umsg.Float(VM.EDI) - umsg.Float(VM.EBP) - umsg.Float(VM.ESP) - - for reg = 0,31 do - umsg.Float(VM["R"..reg]) - end - umsg.End() + net.Start("cpulib_debugdata_action") + net.WriteUInt(1, 2) + net.WriteFloat(VM.CS) + net.WriteFloat(VM.IP) + + if(VM.CurrentPage.Remapped == 1) then + net.WriteFloat(VM.CurrentPage.MappedIndex) + else + net.WriteFloat(math.floor((VM.CS+VM.IP)/128)) + end + + net.WriteFloat(VM.EAX) + net.WriteFloat(VM.EBX) + net.WriteFloat(VM.ECX) + net.WriteFloat(VM.EDX) + net.WriteFloat(VM.ESI) + net.WriteFloat(VM.EDI) + net.WriteFloat(VM.EBP) + net.WriteFloat(VM.ESP) + + for reg = 0,31 do + net.WriteFloat(VM["R"..reg]) + end + + net.Send(Player) end if MemPointers then for msgIdx=0,math.floor(#MemPointers/60) do - umsg.Start("cpulib_debugdata_variables", umsgrp) - umsg.Short(msgIdx*60) - for varIdx=msgIdx*60,msgIdx*60+59 do - if MemPointers[varIdx] then - umsg.Float(VM:ReadCell(MemPointers[varIdx])) - end + net.Start("cpulib_debugdata_action", Player) + net.WriteUInt(2, 2) + net.WriteInt(msgIdx*60, 16) + + for varIdx=msgIdx*60,msgIdx*60+59 do + if MemPointers[varIdx] then + net.WriteFloat(VM:ReadCell(MemPointers[varIdx])) end - umsg.End() + end + + net.Send(Player) end end end From 3248f8d1a23597444879a58897aaa0da651c7c50 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:09:39 +0300 Subject: [PATCH 09/12] wire_gpulib_setent to net --- lua/wire/gpulib.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/wire/gpulib.lua b/lua/wire/gpulib.lua index 62d625cf86..6331d277e3 100644 --- a/lua/wire/gpulib.lua +++ b/lua/wire/gpulib.lua @@ -406,12 +406,12 @@ end -- GPULib switcher functionality if CLIENT then - usermessage.Hook("wire_gpulib_setent", function(um) - local screen = Entity(um:ReadShort()) + net.Receive("wire_gpulib_setent", function() + local screen = Entity(net.ReadUInt(MAX_EDICT_BITS)) if not screen:IsValid() then return end if not screen.GPU then return end - local ent = Entity(um:ReadShort()) + local ent = Entity(net.ReadUInt(MAX_EDICT_BITS)) if not ent:IsValid() then return end screen.GPU.Entity = ent @@ -481,13 +481,15 @@ if CLIENT then end) -- usermessage.Hook elseif SERVER then + util.AddNetworkString("wire_gpulib_setent") function GPULib.switchscreen(screen, ent) screen.GPUEntity = ent - umsg.Start("wire_gpulib_setent") - umsg.Short(screen:EntIndex()) - umsg.Short(ent:EntIndex()) - umsg.End() + + net.Start("wire_gpulib_setent") + net.WriteUInt(screen:EntIndex(), MAX_EDICT_BITS) + net.WriteUInt(ent:EntIndex(), MAX_EDICT_BITS) + net.Broadcast() end end From 811dbaf11691e0061db25f8eaf61ea565c656643 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:19:21 +0300 Subject: [PATCH 10/12] GPULib to net --- lua/wire/gpulib.lua | 86 +++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/lua/wire/gpulib.lua b/lua/wire/gpulib.lua index 6331d277e3..03b486d275 100644 --- a/lua/wire/gpulib.lua +++ b/lua/wire/gpulib.lua @@ -517,9 +517,9 @@ if CLIENT then { "[1-byte]", "[2-byte]", "[4-byte]", "[marker]" }, } ]]-- - local function GPULib_MemorySync(um) + local function GPULib_MemorySync() -- Find the referenced entity - local GPUIdx = um:ReadLong() + local GPUIdx = net.ReadUInt(MAX_EDICT_BITS) local GPU = ents.GetByIndex(GPUIdx) if not GPU then return end if not GPU:IsValid() then return end @@ -534,7 +534,7 @@ if CLIENT then if blockCount > 256 then error("GPULib usermessage read error") return end -- Read block flags - local dataFlags = um:ReadChar()+128 + local dataFlags = net.ReadInt(8)+128 if dataFlags == 240 then return end local offsetSize = dataFlags % 4 @@ -547,20 +547,20 @@ if CLIENT then if offsetSize > 0 then local deltaOffset = 0 - if offsetSize == 1 then deltaOffset = um:ReadChar () end - if offsetSize == 2 then deltaOffset = um:ReadShort() end - if offsetSize == 3 then deltaOffset = um:ReadFloat() end + if offsetSize == 1 then deltaOffset = net.ReadInt(8) end + if offsetSize == 2 then deltaOffset = net.ReadInt(16) end + if offsetSize == 3 then deltaOffset = net.ReadFloat() end currentOffset = currentOffset + deltaOffset --print(" dOffset = "..deltaOffset..", offset = "..currentOffset) end if dataCount == 0 then Count = 1 end - if dataCount == 1 then Count = um:ReadChar()+130 end + if dataCount == 1 then Count = net.ReadInt(8)+130 end if dataCount == 2 then Count = 2 end if dataCount == 3 then Count = 3 end if repeatCount == 0 then Repeat = 1 end - if repeatCount == 1 then Repeat = um:ReadChar()+130 end + if repeatCount == 1 then Repeat = net.ReadInt(8)+130 end if repeatCount == 2 then Repeat = 2 end if repeatCount == 3 then Repeat = 4 end @@ -572,10 +572,10 @@ if CLIENT then for i=1,Count do local Value = 0 - if valueSize == 0 then Value = um:ReadChar() end - if valueSize == 1 then Value = um:ReadShort() end - if valueSize == 2 then Value = um:ReadLong() end - if valueSize == 3 then Value = um:ReadFloat() end + if valueSize == 0 then Value = net.ReadInt(8) end + if valueSize == 1 then Value = net.ReadInt(16) end + if valueSize == 2 then Value = net.ReadInt(32) end + if valueSize == 3 then Value = net.ReadFloat() end for j=1,Repeat do --print(" ["..currentOffset.."] = "..Value) @@ -585,7 +585,7 @@ if CLIENT then end end end - usermessage.Hook("wire_memsync", GPULib_MemorySync) + net.Receive("wire_memsync", GPULib_MemorySync) elseif SERVER then local CACHEMGR = {} CACHEMGR.__index = CACHEMGR @@ -647,14 +647,24 @@ elseif SERVER then ------------------------------------------------------------------------------ -- Send value right away ------------------------------------------------------------------------------ + util.AddNetworkString("wire_memsync") + + local function SendNetMessage(forcePlayer) + if forcePlayer then + net.Send(forcePlayer) + else + net.Broadcast() + end + end + function CACHEMGR:WriteNow(Address,Value,forcePlayer) - umsg.Start("wire_memsync", forcePlayer) - umsg.Long(self.EntIndex) - umsg.Char(195-128) - umsg.Float(Address) - umsg.Float(Value) - umsg.Char(240-128) - umsg.End() + net.Start("wire_memsync") + net.WriteUInt(self.EntIndex, MAX_EDICT_BITS) + net.WriteInt(195-128, 8) + net.WriteFloat(Address) + net.WriteFloat(Value) + net.WriteInt(240-128, 8) + SendNetMessage(forcePlayer) end @@ -749,8 +759,8 @@ elseif SERVER then -- Start the message local messageSize = 4 - umsg.Start("wire_memsync", forcePlayer) - umsg.Long(self.EntIndex) + net.Start("wire_memsync") + net.WriteUInt(self.EntIndex, MAX_EDICT_BITS) -- Start sending all compressed blocks for k,v in ipairs(compressInfo) do @@ -814,7 +824,7 @@ elseif SERVER then if (v.Size == 4) and (not v.IsFloat) then dataFlags = dataFlags + 128 end if (v.Size == 4) and ( v.IsFloat) then dataFlags = dataFlags + 192 end - umsg.Char(dataFlags-128) + net.WriteInt(dataFlags-128, 8) messageSize = messageSize + 4 @@ -823,26 +833,26 @@ elseif SERVER then --======================================================================-- if v.SetOffset then local offsetSize = getSize(v.SetOffset) - if offsetSize == 1 then umsg.Char (v.SetOffset) messageSize = messageSize + 1 end - if offsetSize == 2 then umsg.Short(v.SetOffset) messageSize = messageSize + 2 end - if offsetSize == 4 then umsg.Float(v.SetOffset) messageSize = messageSize + 4 end + if offsetSize == 1 then net.WriteInt(v.SetOffset, 8) messageSize = messageSize + 1 end + if offsetSize == 2 then net.WriteInt(v.SetOffset, 16) messageSize = messageSize + 2 end + if offsetSize == 4 then net.WriteFloat(v.SetOffset) messageSize = messageSize + 4 end end if (#v.Data > 2) then if (#v.Data ~= 3) or (v.IsFloat) then - umsg.Char(#v.Data-130) messageSize = messageSize + 1 + net.WriteInt(#v.Data-130, 8) messageSize = messageSize + 1 end end if (v.Repeat > 1) and (v.Repeat ~= 2) and - (v.Repeat ~= 4) then umsg.Char(v.Repeat-130) messageSize = messageSize + 1 end + (v.Repeat ~= 4) then net.WriteInt(v.Repeat-130, 8) messageSize = messageSize + 1 end for _,value in ipairs(v.Data) do - if v.Size == 1 then umsg.Char (value) messageSize = messageSize + 1 end - if v.Size == 2 then umsg.Short(value) messageSize = messageSize + 2 end - if (v.Size == 4) and (not v.IsFloat) then umsg.Long(value) messageSize = messageSize + 4 end - if (v.Size == 4) and ( v.IsFloat) then umsg.Float(value) messageSize = messageSize + 4 end + if v.Size == 1 then net.WriteInt(value, 8) messageSize = messageSize + 1 end + if v.Size == 2 then net.WriteInt(value, 16) messageSize = messageSize + 2 end + if (v.Size == 4) and (not v.IsFloat) then net.WriteInt(value, 32) messageSize = messageSize + 4 end + if (v.Size == 4) and ( v.IsFloat) then net.WriteFloat(value) messageSize = messageSize + 4 end end @@ -853,16 +863,16 @@ elseif SERVER then if compressInfo[k+1] then local nextSize = #compressInfo[k+1].Data*compressInfo[k+1].Repeat*compressInfo[k+1].Size if nextSize + messageSize > 248 then - umsg.Char(240-128) - umsg.End() + net.WriteInt(240-128, 8) + SendNetMessage(forcePlayer) messageSize = 4 - umsg.Start("wire_memsync", forcePlayer) - umsg.Long(self.EntIndex) + net.Start("wire_memsync") + net.WriteUInt(self.EntIndex, MAX_EDICT_BITS) compressInfo[k+1].SetOffset = compressInfo[k+1].Offset -- Force set offset end else - umsg.Char(240-128) - umsg.End() + net.WriteInt(240-128, 8) + SendNetMessage(forcePlayer) end end From d7cf772a95ac6e8203f926eefe4f81aa58fcd08a Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:20:25 +0300 Subject: [PATCH 11/12] No more blocking because net limits are much higher --- lua/wire/gpulib.lua | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lua/wire/gpulib.lua b/lua/wire/gpulib.lua index 03b486d275..5f554e794c 100644 --- a/lua/wire/gpulib.lua +++ b/lua/wire/gpulib.lua @@ -855,22 +855,7 @@ elseif SERVER then if (v.Size == 4) and ( v.IsFloat) then net.WriteFloat(value) messageSize = messageSize + 4 end end - - --======================================================================-- - -- Check size of next data block. If it fits into usermessage, continue. - -- Otherwise just create new message - --======================================================================-- - if compressInfo[k+1] then - local nextSize = #compressInfo[k+1].Data*compressInfo[k+1].Repeat*compressInfo[k+1].Size - if nextSize + messageSize > 248 then - net.WriteInt(240-128, 8) - SendNetMessage(forcePlayer) - messageSize = 4 - net.Start("wire_memsync") - net.WriteUInt(self.EntIndex, MAX_EDICT_BITS) - compressInfo[k+1].SetOffset = compressInfo[k+1].Offset -- Force set offset - end - else + if not compressInfo[k+1] else net.WriteInt(240-128, 8) SendNetMessage(forcePlayer) end From 96bb97eed11b7d042f951318758cdfcd5351d5f0 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:20:58 +0300 Subject: [PATCH 12/12] Fix typo --- lua/wire/gpulib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/gpulib.lua b/lua/wire/gpulib.lua index 5f554e794c..fdebe54d80 100644 --- a/lua/wire/gpulib.lua +++ b/lua/wire/gpulib.lua @@ -855,7 +855,7 @@ elseif SERVER then if (v.Size == 4) and ( v.IsFloat) then net.WriteFloat(value) messageSize = messageSize + 4 end end - if not compressInfo[k+1] else + if not compressInfo[k+1] then net.WriteInt(240-128, 8) SendNetMessage(forcePlayer) end