diff --git a/src/lua_rds.c b/src/lua_rds.c index d1e84ea..a34c13e 100644 --- a/src/lua_rds.c +++ b/src/lua_rds.c @@ -417,7 +417,6 @@ int lua_register_oda(lua_State *localL) { break; case 10: case 4: - case 3: case 1: if(mod->enc->state[mod->enc->program].user_oda.odas[id].group_version == 0) return luaL_error(localL, "Invalid group"); default: @@ -434,6 +433,7 @@ int lua_set_oda_handler(lua_State *localL) { uint8_t idx = luaL_checkinteger(localL, 1); if(idx >= 32) return luaL_error(localL, "There can't be more than 32 registered ODAs"); if(mod->enc->state[mod->enc->program].user_oda.odas[idx].group == 0) return luaL_error(localL, "this oda is not registered"); + if(mod->enc->state[mod->enc->program].user_oda.odas[idx].group == 3) return luaL_error(localL, "this oda cannot have a handler"); luaL_checktype(localL, 2, LUA_TFUNCTION); lua_pushvalue(localL, 2); if(mod->enc->state[mod->enc->program].user_oda.odas[idx].lua_handler != 0) luaL_unref(localL, LUA_REGISTRYINDEX, mod->enc->state[mod->enc->program].user_oda.odas[idx].lua_handler); diff --git a/src/rds_groups.c b/src/rds_groups.c index cdda368..c93ab53 100644 --- a/src/rds_groups.c +++ b/src/rds_groups.c @@ -319,8 +319,10 @@ void get_rds_user_oda_group(RDSEncoder* enc, RDSGroup *group) { RDSODA oda = enc->state[enc->program].user_oda.odas[pointer]; group->b |= 3 << 12; - group->b |= oda.group << 1; - group->b |= oda.group_version; + if(oda.group != 3) { + group->b |= oda.group << 1; + group->b |= oda.group_version; + } group->c = oda.id_data; group->d = oda.id; } @@ -333,7 +335,7 @@ int get_rds_user_oda_group_content(RDSEncoder* enc, RDSGroup *group) { oda_state->oda_runner_pointer = (oda_state->oda_runner_pointer + 1) % oda_state->oda_len; - if (oda_state->odas[current_idx].lua_handler != 0) { + if (oda_state->odas[current_idx].lua_handler != 0 && oda_state->odas[current_idx].group != 3) { lua_group_ref(group, oda_state->odas[current_idx].lua_handler); group->b |= oda_state->odas[current_idx].group << 12; group->b |= oda_state->odas[current_idx].group_version << 11;