0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00

some adjustments and smart detections

This commit is contained in:
2025-12-28 16:01:15 +01:00
parent c56e932c93
commit 0c61435a26
5 changed files with 86 additions and 47 deletions

View File

@@ -2,6 +2,8 @@ _Rft_oda_id = nil
_Rft_file = ""
_Rft_file_segment = 0
_Rft_toggle = false
_Rft_last_id = -1
_Rft_version = 0 -- TODO
local function start_rft()
if _Rft_oda_id == nil then
@@ -23,7 +25,6 @@ local function start_rft()
_Rft_file_segment = seg + 1
if _Rft_file_segment >= total_segments then
_Rft_file_segment = 0
_Rft_toggle = not _Rft_toggle
end
return true, (2 << 12) | word1, word2, word3, word4
@@ -35,7 +36,12 @@ end
---Loads the file into RFT and initializes it if needed, note that this needs RDR2 mode 2
---@param path string
---@param id integer
function load_rft_file(path, id)
function load_station_logo(path, id)
if id == _Rft_last_id then
_Rft_toggle = not _Rft_toggle
_Rft_version = _Rft_version + 1
if _Rft_version > 7 then _Rft_version = 0 end
end
local file = io.open(path, "rb")
if not file then error("Could not open file") end
_Rft_file = file:read("*a")
@@ -44,5 +50,6 @@ function load_rft_file(path, id)
if #_Rft_file > 262143 then error("The file is too large", 2) end
if _Rft_oda_id == nil then start_rft() end
---@diagnostic disable-next-line: param-type-mismatch
set_oda_id_data_rds2(_Rft_oda_id, #_Rft_file | id << 18)
set_oda_id_data_rds2(_Rft_oda_id, #_Rft_file | (id & 63) << 18 | (_Rft_version & 7) << 24 | 0 << 27)
_Rft_last_id = id
end