You've already forked rdsspy-lua-host
mirror of
https://github.com/KubaPro010/rdsspy-lua-host.git
synced 2026-02-26 18:35:01 +01:00
lps and also complete the ecc table
This commit is contained in:
@@ -6,6 +6,7 @@ local last_super_pi = 0
|
||||
local ert_string = string.rep("_", 128)
|
||||
local rt_a = string.rep("_", 64)
|
||||
local rt_b = string.rep("_", 64)
|
||||
local lps = string.rep("_", 32)
|
||||
|
||||
local ptyn_toggle = false
|
||||
local ptyn = string.rep(" ", 8)
|
||||
@@ -16,6 +17,8 @@ local ert_display = ""
|
||||
local last_rt = false
|
||||
local rta_display = ""
|
||||
local rtb_display = ""
|
||||
local lps_display = ""
|
||||
|
||||
|
||||
local current_menu = 1
|
||||
|
||||
@@ -51,6 +54,409 @@ local tp = false
|
||||
local ta = false
|
||||
local dpty = false
|
||||
|
||||
local ecc = 0
|
||||
local pi_code_to_country = {
|
||||
"Encoder fault",
|
||||
"CM DE GR KW MA MD ME NA SL AI BO GT PR US VI AUS-CT KI LA",
|
||||
"CF CZ DZ EE IE LR QA ZW AG CO HN PR US VI AUS-NSW BT TH",
|
||||
"PL AD DJ EH GH KG MK MZ SM TR AW BR JM PR US VI AUS-V BD KH TO",
|
||||
"Cabinda CH IL MG MR UG VA FK MQ PR US VI AUS-Q PK WS",
|
||||
"IT JO ML RW SK ST SZ TJ BB MS PR US VI AUS-SA FJ IN",
|
||||
"AO BE CV FI KE LS OM SY UA BZ PR TT US VI AUS-WA MO",
|
||||
"GQ Kosovo LU RU SN SO TN KY NI PR US VI AUS-T NR VN",
|
||||
"BG GA GM NE NL PS PT SC CR PR SR US VI AUS-NT CH IR PH",
|
||||
"AL BI DK GN LI LV SA SI TD CU PA PR US UY VI CH JP NZ PG",
|
||||
"AM AT GI GW IS LB MU SH SS ZA AR DM PR KN US VI AF SG SB",
|
||||
"AZ BF BW CD HU IQ MC UZ YE BR CA DO MX PR LC US VI BN MV MH MM",
|
||||
"CG CI GB GE HR KM LT MT SD BM BR CA CL SN PR VC US VI CH ID LK",
|
||||
"AE DE KZ LY RS TG TZ BR CA GD HT MX AN PR US VI KP TW", -- kp is the best here man, also tw? wtf
|
||||
"Bahrein BJ ES ET RO SE TM ZM CA GP MX TB PR US VE VI KR FM NP",
|
||||
"BA BY EG ER FR MN MW NG NO BS GL GY MX PM VG HK MY VU",
|
||||
}
|
||||
|
||||
local pi_ecc_to_country = {
|
||||
e0 = {
|
||||
"Encoder fault", -- 0
|
||||
"Federal Republic of Germany", -- 1
|
||||
"People's Democratic Republic of Algeria", -- 2
|
||||
"Principality of Andorra", -- 3
|
||||
"State of Israel", -- 4
|
||||
"Italian Republic", -- 5
|
||||
"Kingdom of Belgium", -- 6
|
||||
"Russian Federation", -- 7
|
||||
"State of Palestine", -- 8
|
||||
"Republic of Albania", -- 9
|
||||
"Federal Republic of Austria", -- 10 A
|
||||
"Hungary", -- 11 B
|
||||
"Republic of Malta", -- 12 C
|
||||
"Federal Republic of Germany", -- 13 D
|
||||
"Unknown", -- 14 E
|
||||
"Arab Republic of Egypt", -- 15 F
|
||||
},
|
||||
e1 = {
|
||||
"Encoder fault", -- 0
|
||||
"Hellenic Republic (Greece)", -- 1
|
||||
"Libya", -- 2
|
||||
"Republic of San Marino", -- 3
|
||||
"Swiss Confederation", -- 4
|
||||
"Hashemite Kingdom of Jordan", -- 5
|
||||
"Republic of Finland", -- 6
|
||||
"Grand Duchy of Luxembourg", -- 7
|
||||
"Republic of Bulgaria", -- 8
|
||||
"Kingdom of Denmark", -- 9
|
||||
"United Kingdom of Great Britain and Northern Ireland (Gibraltar)", -- 10 A
|
||||
"Republic of Iraq", -- 11 B
|
||||
"United Kingdom of Great Britain and Northern Ireland", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Romania", -- 14 E
|
||||
"Republic of France", -- 15 F wish i could nuke this
|
||||
},
|
||||
e2 = {
|
||||
"Encoder fault", -- 0
|
||||
"Kingdom of Morocco", -- 1
|
||||
"Czech Republic", -- 2
|
||||
"Republic of Poland", -- 3
|
||||
"Vatican City State", -- 4 : not an UN member, had to google them and not just copy from the pdf
|
||||
"Slovak Republic", -- 5
|
||||
"Syrian Arab Republic", -- 6
|
||||
"Republic of Tunisia", -- 7
|
||||
"Unknown", -- 8
|
||||
"Principality of Liechtenstein", -- 9
|
||||
"Republic of Iceland", -- 10 A
|
||||
"Principality of Monaco", -- 11 B
|
||||
"Republic of Lithuania", -- 12 C
|
||||
"Republic of Serbia", -- 13 D
|
||||
"Kingdom of Spain", -- 14 E
|
||||
"Kingdom of Norway", -- 15 F
|
||||
},
|
||||
e3 = {
|
||||
"Encoder fault", -- 0
|
||||
"Montenegro", -- 1
|
||||
"Ireland", -- 2
|
||||
"Republic of Turkey", -- 3
|
||||
"Unknown", -- 4
|
||||
"Republic of Tajikistan", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"Kingdom of the Netherlands", -- 8
|
||||
"Republic of Latvia", -- 9
|
||||
"Republic of Lebanon", -- 10 A
|
||||
"Republic of Azerbaijan", -- 11 B
|
||||
"Republic of Croatia", -- 12 C
|
||||
"Republic of Kazakhstan", -- 13 D
|
||||
"Kingdom of Sweden", -- 14 E
|
||||
"Republic of Belarus", -- 15 F
|
||||
},
|
||||
e4 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Moldova", -- 1
|
||||
"Republic of Estonia", -- 2
|
||||
"The former Yugoslav Republic of Macedonia", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Ukraine", -- 6
|
||||
"Republic of Kosovo", -- 7 : had to google this one too, no un
|
||||
"Republic of Portugal", -- 8
|
||||
"Republic of Slovenia", -- 9
|
||||
"Republic of Armenia", -- 10 A
|
||||
"Republic of Uzbekistan", -- 11 B
|
||||
"Georgia", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Turkmenistan", -- 14 E
|
||||
"Bosnia and Herzegovina", -- 15 F
|
||||
},
|
||||
e5 = {
|
||||
"Encoder fault", -- 0
|
||||
"Unknown", -- 1
|
||||
"Unknown", -- 2
|
||||
"Kyrgyz Republic (Kyrgyzstan)", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"Unknown", -- 8
|
||||
"Unknown", -- 9
|
||||
"Unknown", -- 10 A
|
||||
"Unknown", -- 11 B
|
||||
"Unknown", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Unknown", -- 14 E
|
||||
"Unknown", -- 15 F
|
||||
},
|
||||
a0 = {
|
||||
"Encoder fault", -- 0
|
||||
"United States of America", -- 1
|
||||
"United States of America", -- 2
|
||||
"United States of America", -- 3
|
||||
"United States of America", -- 4
|
||||
"United States of America", -- 5
|
||||
"United States of America", -- 6
|
||||
"United States of America", -- 7
|
||||
"United States of America", -- 8
|
||||
"United States of America", -- 9
|
||||
"United States of America", -- 10 A
|
||||
"United States of America", -- 11 B
|
||||
"United States of America", -- 12 C
|
||||
"United States of America", -- 13 D
|
||||
"United States of America", -- 14 E
|
||||
-- fucking great
|
||||
"Unknown", -- 15 F
|
||||
},
|
||||
a1 = {
|
||||
"Encoder fault", -- 0
|
||||
"Unknown", -- 1
|
||||
"Unknown", -- 2
|
||||
"Unknown", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"Unknown", -- 8
|
||||
"Unknown", -- 9
|
||||
"Unknown", -- 10 A
|
||||
"Canada", -- 11 B
|
||||
"Canada", -- 12 C
|
||||
"Canada", -- 13 D
|
||||
"Cananda", -- 14 E
|
||||
"Greenland", -- 15 F
|
||||
},
|
||||
a2 = {
|
||||
"Encoder fault", -- 0
|
||||
"United Kingdom of Great Britain and Northern Ireland (Anguilla)", -- 1
|
||||
"Antigua and Barbuda", -- 2
|
||||
"Federative Republic of Brazil / Republic of Ecuador", -- 3 : R22_039_1 has a fucking error, its not "Ecuador", but fucking "Equator"? THE FUCKING STANDARD HAS A WRONG COUNTRY NAME
|
||||
"United Kingdom of Great Britain and Northern Ireland (Falkland Islands)", -- 4
|
||||
"Barbados", -- 5
|
||||
"Belize", -- 6
|
||||
"United Kingdom of Great Britain and Northern Ireland (Cayman Islands)", -- 7
|
||||
"Republic of Costa Rica", -- 8
|
||||
"Republic of Cuba", -- 9
|
||||
"Republic of Argentina", -- 10 A
|
||||
"Federative Republic of Brazil", -- 11 B
|
||||
"United Kingdom of Great Britain and Northern Ireland (Bermuda) / Federative Republic of Brazil", -- 12 C
|
||||
"Netherlands Antilles (governemnt does not exist) / Federative Republic of Brazil", -- 13 D : Yes, it ceased to exist in 2010 but its not like they care
|
||||
"Republic of France (Guadeloupe)", -- 14 E
|
||||
"Commonwealth of the Bahamas", -- 15 F
|
||||
},
|
||||
a3 = {
|
||||
"Encoder fault", -- 0
|
||||
"Plurinational State of Bolivia", -- 1
|
||||
"Republic of Colombia", -- 2
|
||||
"Jamaica", -- 3
|
||||
"Republic of France (Martinique)", -- 4
|
||||
"Unknown", -- 5
|
||||
"Republic of Paraguay", -- 6
|
||||
"Republic of Nicaragua", -- 7
|
||||
"Unknown", -- 8
|
||||
"Republic of Panama", -- 9
|
||||
"Commonwealth of Dominica", -- 10 A
|
||||
"Dominican Republic", -- 11 B
|
||||
"Republic of Chile", -- 12 C
|
||||
"Grenada", -- 13 D
|
||||
"United Kingdom of Great Britain and Northern Ireland (Turks and Caicos Islands)", -- 14 E
|
||||
"Republic of Guyana", -- 15 F
|
||||
},
|
||||
a4 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Guatemala", -- 1
|
||||
"Republic of Honduras", -- 2
|
||||
"Kingdom of the Netherlands (Aruba)", -- 3
|
||||
"Unknown", -- 4
|
||||
"United Kingdom of Great Britain and Northern Ireland (Montserrat)", -- 5
|
||||
"Republic of Trinidad and Tobago", -- 6
|
||||
"Republic of Peru", -- 7
|
||||
"Republic of Suriname", -- 8
|
||||
"Oriental Republic of Uruguay", -- 9
|
||||
"Saint Kitts and Nevis", -- 10 A
|
||||
"Saint Lucia", -- 11 B
|
||||
"Republic of El Salvador", -- 12 C
|
||||
"Republic of Haiti", -- 13 D
|
||||
"Bolivarian Republic of Venezuela", -- 14 E
|
||||
"United Kingdom of Great Britain and Northern Ireland (Virgin Islands)", -- 15 F
|
||||
},
|
||||
a5 = {
|
||||
"Encoder fault", -- 0
|
||||
"Unknown", -- 1
|
||||
"Unknown", -- 2
|
||||
"Unknown", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"Unknown", -- 8
|
||||
"Unknown", -- 9
|
||||
"Unknown", -- 10 A
|
||||
"United Mexican States", -- 11 B
|
||||
"Saint Vincent and the Grenadines", -- 12 C
|
||||
"United Mexican States", -- 13 D
|
||||
"United Mexican States", -- 14 E
|
||||
"United Mexican States", -- 15 F
|
||||
},
|
||||
d0 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Cameroon", -- 1
|
||||
"Central African Republic", -- 2
|
||||
"Republic of Djibouti", -- 3
|
||||
"Republic of Madagascar", -- 4
|
||||
"Republic of Mali", -- 5
|
||||
"Republic of Angola", -- 6
|
||||
"Republic of Equatorial Guinea", -- 7
|
||||
"Gabonese Republic", -- 8
|
||||
"Republic of Guinea", -- 9
|
||||
"Republic of South Africa", -- 10 A
|
||||
"Burkina Faso", -- 11 B
|
||||
"Republic of the Congo", -- 12 C
|
||||
"Republic of Togo", -- 13 D
|
||||
"Republic of Benin", -- 14 E
|
||||
"Republic of Malawi", -- 15 F
|
||||
},
|
||||
d1 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Namibia", -- 1
|
||||
"Republic of Liberia", -- 2
|
||||
"Republic of Ghana", -- 3
|
||||
"Islamic Republic of Mauritania", -- 4
|
||||
"Democratic Republic of Sao Tome and Principe", -- 5
|
||||
"Republic of Cabo Verde (Capo Verde)", -- 6
|
||||
"Republic of Senegal", -- 7
|
||||
"Islamic Republic of the Gambia", -- 8
|
||||
"Republic of Burundi", -- 9
|
||||
"United Kingdom of Great Britain and Northern Ireland (Ascension Island)", -- 10 A
|
||||
"Republic of Botswana", -- 11 B
|
||||
"Union of the Comoros", -- 12 C
|
||||
"United Republic of Tanzania", -- 13 D
|
||||
"Federal Democratic Republic of Ethiopia", -- 14 E
|
||||
"Federal Republic of Nigeria", -- 15 F : nigeria haha
|
||||
},
|
||||
d2 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Sierra Leone", -- 1
|
||||
"Republic of Zimbabwe", -- 2
|
||||
"Republic of Mozambique", -- 3
|
||||
"Republic of Uganda", -- 4
|
||||
"Kingdom of Swaziland", -- 5
|
||||
"Republic of Kenya", -- 6
|
||||
"Federal Republic of Somalia", -- 7
|
||||
"Republic of the Niger", -- 8 : niger haha
|
||||
"Republic of Chad", -- 9
|
||||
"Republic of Guinea-Bissau", -- 10 A
|
||||
"Democratic Republic of the Congo", -- 11 B
|
||||
"Republic of Côte d'Ivoire (Ivory Coast)", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Republic of Zambia", -- 14 E
|
||||
"State of Eritrea", -- 15 F
|
||||
},
|
||||
d3 = {
|
||||
"Encoder fault", -- 0
|
||||
"Unknown", -- 1
|
||||
"Unknown", -- 2
|
||||
"Polisario Front / Kingdom of Morocco (Western Sahara)", -- 3
|
||||
"Republic of Cabinda / Republic of Angola", -- 4 : intresting
|
||||
"Republic of Rwanda", -- 5
|
||||
"Kingdom of Lesotho", -- 6
|
||||
"Unknown", -- 7
|
||||
"Republic of Seychelles", -- 8
|
||||
"Unknown", -- 9
|
||||
"Republic of Mauritius", -- 10 A
|
||||
"Unknown", -- 11 B
|
||||
"Republic of the Sudan", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Unknown", -- 14 E
|
||||
"Unknown", -- 15 F
|
||||
},
|
||||
d4 = {
|
||||
"Encoder fault", -- 0
|
||||
"Unknown", -- 1
|
||||
"Unknown", -- 2
|
||||
"Unknown", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"Unknown", -- 8
|
||||
"Unknown", -- 9
|
||||
"Republic of South Sudan", -- 10 A
|
||||
"Unknown", -- 11 B
|
||||
"Unknown", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Unknown", -- 14 E
|
||||
"Unknown", -- 15 F
|
||||
-- Just one?
|
||||
},
|
||||
f0 = {
|
||||
"Encoder fault", -- 0
|
||||
"Commonwealth of Australia - Capital Territory", -- 1
|
||||
"Commonwealth of Australia - New South Wales", -- 2
|
||||
"Commonwealth of Australia - Victoria", -- 3
|
||||
"Commonwealth of Australia - Queensland", -- 4
|
||||
"Commonwealth of Australia - South Australia", -- 5
|
||||
"Commonwealth of Australia - Western Australia", -- 6
|
||||
"Commonwealth of Australia - Tasmania", -- 7
|
||||
"Commonwealth of Australia - Northern Territory", -- 8 : why tf is australia the only one like this, was the ecc code designers from there?
|
||||
"Kingdom of Saudi Arabia", -- 9
|
||||
"Islamic Republic of Afghanistan", -- 10 A
|
||||
"Republic of the Union of Myanmar (Burma)", -- 11 B
|
||||
"People's Republic of China", -- 12 C
|
||||
"Democratic People's Republic of Korea (North Korea)", -- 13 D : what if i start transmitting with ECC f0 and pi D000, AND PLAY SOUTH KOREAN MUSIC
|
||||
"Kingdom of Bahrain", -- 14 E : docs refer to it as Bahrein with no iso code
|
||||
"Malaysia", -- 15 F
|
||||
},
|
||||
f1 = {
|
||||
"Encoder fault", -- 0
|
||||
"Republic of Kiribati", -- 1
|
||||
"Kingdom of Bhutan", -- 2
|
||||
"People's Republic of Bangladesh", -- 3
|
||||
"Islamic Republic of Pakistan", -- 4
|
||||
"Republic of Fiji", -- 5
|
||||
"Sultanate of Oman", -- 6
|
||||
"Republic of Nauru", -- 7
|
||||
"Islamic Republic of Iran", -- 8
|
||||
"New Zealand", -- 9
|
||||
"Solomon Islands", -- 10 A
|
||||
"Negara Brunei Darussalam", -- 11 B
|
||||
"Democratic Socialist Republic of Sri Lanka", -- 12 C
|
||||
"Republic of China (Taiwan)", -- 13 D
|
||||
"Republic of Korea (South Korea)", -- 14 E
|
||||
"People's Republic of China (Hong Kong)", -- 15 F
|
||||
},
|
||||
f2 = {
|
||||
"Encoder fault", -- 0
|
||||
"State of Kuwait", -- 1
|
||||
"State of Qatar", -- 2
|
||||
"Kingdom of Cambodia", -- 3
|
||||
"Independent State of Samoa", -- 4
|
||||
"Republic of India", -- 5
|
||||
"People's Republic of China (Macao)", -- 6
|
||||
"Socialist Republic of Viet Nam", -- 7
|
||||
"Republic of the Philippines", -- 8
|
||||
"Japan", -- 9
|
||||
"Republic of Singapore", -- 10 A
|
||||
"Republic of Maldives", -- 11 B
|
||||
"Republic of Indonesia", -- 12 C
|
||||
"United Arab Emirates", -- 13 D
|
||||
"Federal Democratic Republic of Nepal", -- 14 E : discord election ahh
|
||||
"Republic of Vanuatu", -- 15 F : apparantly this is un but i don't have it on the pdf?
|
||||
},
|
||||
f3 = {
|
||||
"Encoder fault", -- 0
|
||||
"Lao People's Democratic Republic", -- 1
|
||||
"Kingdom of Thailand", -- 2
|
||||
"Kingdom of Tonga", -- 3
|
||||
"Unknown", -- 4
|
||||
"Unknown", -- 5
|
||||
"Unknown", -- 6
|
||||
"Unknown", -- 7
|
||||
"People's Republic of China", -- 8
|
||||
"Independent State of Papua New Guinea", -- 9
|
||||
"Unknown", -- 10 A
|
||||
"Republic of Yemen", -- 11 B
|
||||
"Unknown", -- 12 C
|
||||
"Unknown", -- 13 D
|
||||
"Federated States of Micronesia", -- 14 E
|
||||
"Mongolia", -- 15 F
|
||||
},
|
||||
}
|
||||
|
||||
local last_render_hash = 0
|
||||
local function crc(data)
|
||||
local crc = 0xFF
|
||||
@@ -81,9 +487,20 @@ function render_menu()
|
||||
out = out .. string.format("PTYN: %s\r\n\r\n", ptyn)
|
||||
out = out .. string.format("RT[A]: %s%s\r\n", last_rt and ">" or " ", rta_display)
|
||||
out = out .. string.format("RT[B]: %s%s\r\n\r\n", (not last_rt) and ">" or " ", rtb_display)
|
||||
out = out .. string.format("ERT: %s\r\n", ert_display)
|
||||
elseif current_menu == 3 then
|
||||
set_font_size(24)
|
||||
out = out .. string.format("LPS: %s\r\n\r\n", lps_display)
|
||||
|
||||
local country_name = "Unknown"
|
||||
local country_id = (last_pi & 0xF000) >> 12
|
||||
local ecc_key = string.format("%x", ecc)
|
||||
|
||||
if ecc ~= 0 and pi_ecc_to_country[ecc_key] and pi_ecc_to_country[ecc_key][country_id + 1] then country_name = pi_ecc_to_country[ecc_key][country_id + 1]
|
||||
elseif ecc == 0 then country_name = pi_code_to_country[country_id+1] end
|
||||
out = out .. string.format("Country: %s (%X)\r\n\r\n", country_name, ecc)
|
||||
|
||||
out = out .. string.format("ERT: %s\r\n\r\n", ert_display)
|
||||
|
||||
local oda_string = ""
|
||||
for grp, data in pairs(odas) do
|
||||
local ver_char = (data.version == 0) and "A" or "B"
|
||||
@@ -103,13 +520,24 @@ function event(event)
|
||||
current_menu = event
|
||||
end
|
||||
|
||||
local function ternary(cond, a, b)
|
||||
if cond then return a else return b end
|
||||
end
|
||||
|
||||
function command(cmd, param)
|
||||
if cmd:lower() == "request" and param:lower() == "decoderdata" then
|
||||
db.add_value("RT.A", rta_display)
|
||||
db.add_value("RT.B", rtb_display)
|
||||
db.add_value("RT.Type", "0" and last_rt or "1")
|
||||
db.add_value("RT.Type", ternary(last_rt, "0", "1"))
|
||||
db.add_value("PTYN", ptyn)
|
||||
db.add_value("ERT", ert_display)
|
||||
db.add_value("TP", "1" and tp or "0")
|
||||
db.add_value("TA", "1" and ta or "0")
|
||||
db.add_value("DI", "8" and dpty or "0")
|
||||
db.add_value("PTY.Code", tostring(pty))
|
||||
db.add_value("PTY.Name", string.format("%s / %s", pty_rds[pty+1], pty_rbds[pty+1]))
|
||||
db.add_value("ECC", string.format("%X", ecc))
|
||||
db.add_value("LPS", lps_display)
|
||||
elseif cmd:lower() == "resetdata" then
|
||||
ert_string = string.rep("_", 128)
|
||||
rt_a = string.rep("_", 64)
|
||||
@@ -123,6 +551,8 @@ function command(cmd, param)
|
||||
dpty = false
|
||||
ptyn = string.rep(" ", 8)
|
||||
ptyn_toggle = false
|
||||
ecc = 0
|
||||
lps = string.rep("_", 32)
|
||||
elseif cmd:lower() == "superpi" then
|
||||
last_super_pi = tonumber(param, 16)
|
||||
end
|
||||
@@ -172,6 +602,9 @@ function group(stream, b_corr, a, b, c, d)
|
||||
local segment = b & 0x3
|
||||
if di_bit and segment == 0 then dpty = true
|
||||
elseif segment == 0 then dpty = false end
|
||||
elseif group_type == 1 and group_version == 0 then
|
||||
local variant = (c & 0x7000) >> 12
|
||||
if variant == 0 then ecc = c & 0xfff end
|
||||
elseif group_type == 10 and group_version == 0 then
|
||||
local toggle = ((b & 0x10) >> 4) ~= 0
|
||||
if toggle ~= ptyn_toggle then
|
||||
@@ -179,10 +612,9 @@ function group(stream, b_corr, a, b, c, d)
|
||||
ptyn_toggle = toggle
|
||||
end
|
||||
local segment = b & 1
|
||||
local new_chars = string.char(db.char_conv((c >> 8) & 0xff)) .. string.char(db.char_conv(c & 0xff)) .. string.char(db.char_conv((d >> 8) & 0xff)) .. string.char(db.char_conv(d & 0xff))
|
||||
local start_pos = (segment * 4) + 1
|
||||
ptyn = rt_a:sub(1, ptyn - 1) .. new_chars .. rt_a:sub(ptyn + 4)
|
||||
|
||||
local new_chars = string.char(db.char_conv((c >> 8) & 0xff)) .. string.char(db.char_conv(c & 0xff)) .. string.char(db.char_conv((d >> 8) & 0xff)) .. string.char(db.char_conv(d & 0xff))
|
||||
ptyn = ptyn:sub(1, start_pos - 1) .. new_chars .. ptyn:sub(start_pos + 4)
|
||||
elseif group_type == 2 and group_version == 0 then -- TODO 2B
|
||||
local rt_state = b & 0xF
|
||||
local rt_toggle = (b >> 4) & 1
|
||||
@@ -204,6 +636,16 @@ function group(stream, b_corr, a, b, c, d)
|
||||
if carriage then rtb_display = rt_b:sub(1, carriage - 1)
|
||||
else rtb_display = rt_b:gsub("%s+$", "") end
|
||||
end
|
||||
elseif group_type == 15 and group_version == 0 then
|
||||
local state = b & 7
|
||||
local new_chars = string.char(db.char_conv((c >> 8) & 0xff)) .. string.char(db.char_conv(c & 0xff)) .. string.char(db.char_conv((d >> 8) & 0xff)) .. string.char(db.char_conv(d & 0xff))
|
||||
local start_pos = (state * 4) + 1
|
||||
|
||||
lps = lps:sub(1, start_pos - 1) .. new_chars .. lps:sub(start_pos + 4)
|
||||
|
||||
local carriage = lps:find("\r", 1, true)
|
||||
if carriage then lps_display = lps:sub(1, carriage - 1)
|
||||
else lps_display = lps:gsub("%s+$", "") end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user