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
28 changes: 14 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5

- name: Install alsa dev
if: runner.os == 'Linux'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build -p kissmp-bridge --verbose --release

- name: Store Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build_results_bridge
name: build_results_bridge-${{ matrix.os }}
path: |
./target/release/kissmp-bridge
./target/release/kissmp-bridge.exe
Expand All @@ -41,19 +41,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build -p kissmp-server --verbose --release

- name: Store Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build_results_server
name: build_results_server-${{ matrix.os }}
path: |
./target/release/kissmp-server
./target/release/kissmp-server.exe
Expand All @@ -62,17 +62,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5

- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build -p kissmp-master --verbose --release

- name: Store Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build_results_master_server
path: |
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ default-members = [
"kissmp-bridge",
"kissmp-server"
]
[workspace.package]
version = "0.6.0"
authors = ["hellbox"]
edition = "2018"
4 changes: 3 additions & 1 deletion KISSMultiplayer/lua/ge/extensions/kissmp/ui/names.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ local function draw()
ColorF(1, 1, 1, 1),
true,
false,
ColorI(0, 0, 0, 255)
ColorI(0, 0, 0, 255),
false,
false
)
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local M = {}
local imgui = ui_imgui
local http = require("socket.http")
local VERSION_PRTL = "0.6.0"
local VERSION_PRTL = "0.7.0"

local filter_servers_notfull = imgui.BoolPtr(false)
local filter_servers_notempty = imgui.BoolPtr(false)
Expand Down
45 changes: 38 additions & 7 deletions KISSMultiplayer/lua/ge/extensions/network.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local M = {}

M.VERSION_STR = "0.6.0"
M.VERSION_STR = "0.7.0"

M.downloads = {}
M.downloading = false
Expand Down Expand Up @@ -28,6 +28,7 @@ M.connection = {
}

local FILE_TRANSFER_CHUNK_SIZE = 16384;
local CHUNK_SIZE = 65000 -- Safe size under 65536 limit

local message_handlers = {}

Expand Down Expand Up @@ -179,23 +180,53 @@ local function send_data(raw_data, reliable)
print("NOT IMPLEMENTED. PLEASE REPORT TO KISSMP DEVELOPERS. CODE: "..raw_data)
return
end
if not M.connection.connected then return -1 end
local data = ""
-- Used in context of it being called from vehicle lua, where it's already encoded into json
if type(raw_data) == "string" then
data = raw_data
else
data = jsonEncode(raw_data)
end
if not M.connection.connected then return -1 end
local len = #data
local len = ffi.string(ffi.new("uint32_t[?]", 1, {len}), 4)
local data_size = #data
-- Auto-chunk if data is too large
if data_size > CHUNK_SIZE then
print("Large data detected: " .. data_size .. " bytes, sending in chunks")
local num_chunks = math.ceil(data_size / CHUNK_SIZE)

for i = 0, num_chunks - 1 do
local start_pos = i * CHUNK_SIZE + 1
local end_pos = math.min((i + 1) * CHUNK_SIZE, data_size)
local chunk = data:sub(start_pos, end_pos)

local chunk_data = jsonEncode({
DataChunk = {
chunk_index = i,
total_chunks = num_chunks,
data = chunk
}
})

local len = ffi.string(ffi.new("uint32_t[?]", 1, {#chunk_data}), 4)
M.connection.tcp:send(string.char(1)..len)
M.connection.tcp:send(chunk_data)

print("Sent chunk " .. (i + 1) .. "/" .. num_chunks)
end

print("All chunks sent successfully")
return 0
end

-- Send normally
local len = ffi.string(ffi.new("uint32_t[?]", 1, {data_size}), 4)
if reliable then
reliable = 1
else
reliable = 0
end
M.connection.tcp:send(string.char(reliable)..len)
M.connection.tcp:send(data)
return 0
end

local function sanitize_addr(addr)
Expand Down Expand Up @@ -277,15 +308,15 @@ local function connect(addr, player_name)

local steamid64 = nil
if Steam and Steam.isWorking then
steamid64 = Steam.getAccountIDStr() ~= "0" and Steam.getAccountIDStr() or nil
steamid64 = Steam.accountID ~= "0" and Steam.accountID or nil
end

local client_info = {
ClientInfo = {
name = player_name,
secret = generate_secret(server_info.server_identifier),
steamid64 = steamid64,
client_version = {0, 6}
client_version = {0, 7}
}
}
send_data(client_info, true)
Expand Down
7 changes: 4 additions & 3 deletions kissmp-bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "kissmp-bridge"
version = "0.6.0"
authors = ["hellbox"]
edition = "2018"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
Expand Down Expand Up @@ -32,3 +32,4 @@ cpal = "0.13"
fon = "0.5.0"
log = "0.4"
indoc = "1.0"
rcgen = "0.8.2"
Loading
Loading