From 3297bd1e9e51d89b1d883acc7c8f0e06d7a92ebc Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Tue, 31 Oct 2023 23:35:27 -0400 Subject: [PATCH] Patch Folder; NXDN Alias to gN; Patch Docs; --- examples/Install_Notes.md | 31 +++++++- patch/nxdn_alias_to_groupname.patch | 116 ++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 patch/nxdn_alias_to_groupname.patch diff --git a/examples/Install_Notes.md b/examples/Install_Notes.md index 4c0f0ad..b23ab8c 100644 --- a/examples/Install_Notes.md +++ b/examples/Install_Notes.md @@ -172,4 +172,33 @@ cmake .. make -j `nproc` sudo make install sudo ldconfig -``` \ No newline at end of file +``` + +### Applying Patches -- Recommended For Advanced Users Only + +More experimental or potentially functionality changing or temperamental features may be included as seperate .patch files inside of the patch folder, and are not included in the source code by default. +If users wish to try or use these patches, then they can apply patches and build/rebuild with the following procedure. Make sure you have changed to the dsd-fme directory first, either by the top +command, or by otherwise opening the terminal to the clone folder. + +``` +cd dsd-fme +git apply patch/patchname.patch +cd build +make +sudo make install +``` + +If you later wish to update to the latest version via `git pull`, you may first need to reset any patches, perform the `git pull`, and then reapply patches. +A procedure for this is similar to, but not limited to: + +``` +cd dsd-fme +git reset --hard +git pull +git apply patch/xyz.patch +cd build +make +sudo make install +``` + +NOTE: Patches can potential break over time with further changes to code, requiring merge resolution or other manual intervention to re-apply patches. \ No newline at end of file diff --git a/patch/nxdn_alias_to_groupname.patch b/patch/nxdn_alias_to_groupname.patch new file mode 100644 index 0000000..e3fcc6c --- /dev/null +++ b/patch/nxdn_alias_to_groupname.patch @@ -0,0 +1,116 @@ +diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c +index 501124e..e2939e4 100644 +--- a/src/dsd_ncurses.c ++++ b/src/dsd_ncurses.c +@@ -2754,6 +2754,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) + printw ("| "); + printw ("TGT: [%5d] ", tgn); + printw ("SRC: [%5d] ", src); ++ ++ #ifdef LIMAZULUTWEAKS + if (state->nxdn_alias_block_segment[0][0] > 0) + { + printw ("ALIAS: ["); +@@ -2764,23 +2766,30 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) + printw ("%s", state->nxdn_alias_block_segment[i][j]); + } + } +- printw ("]"); ++ printw ("] "); + } ++ #endif + + //Group Name Labels from CSV import + for (int k = 0; k < state->group_tally; k++) + { + if (state->group_array[k].groupNumber == tgn) + { ++ printw ("TG: "); + attron(COLOR_PAIR(4)); +- printw (" [%s]", state->group_array[k].groupName); ++ printw ("[%s]", state->group_array[k].groupName); + printw ("[%s] ", state->group_array[k].groupMode); + } + else if (state->group_array[k].groupNumber == src) + { ++ #ifdef LIMAZULUTWEAKS ++ ; //skip Alias Line ++ #else ++ printw ("ALIAS: "); ++ #endif + attron(COLOR_PAIR(4)); +- printw (" [%s]", state->group_array[k].groupName); +- printw ("[%s] ", state->group_array[k].groupMode); ++ printw ("%s", state->group_array[k].groupName); ++ // printw ("[%s] ", state->group_array[k].groupMode); + } + if (state->carrier == 1) + { +diff --git a/src/nxdn_element.c b/src/nxdn_element.c +index 8907cab..c8c9b30 100644 +--- a/src/nxdn_element.c ++++ b/src/nxdn_element.c +@@ -732,6 +732,63 @@ void NXDN_decode_Alias(dsd_opts * opts, dsd_state * state, uint8_t * Message) + + if (Alias4 > 0x19 && Alias4 < 0x7F) sprintf (state->nxdn_alias_block_segment[blocknumber-1][3], "%c", Alias4); + //else sprintf (state->nxdn_alias_block_segment[blocknumber-1][3], "%c", 0); //space ++ ++ //TEST: Assign to call history (if not already in groupName) ++ char str_a[120]; char str_b[50]; int wr = 0; int tsrc = state->nxdn_last_rid; int z = 0; ++ sprintf (str_a, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", ++ state->nxdn_alias_block_segment[0][0], state->nxdn_alias_block_segment[0][1], state->nxdn_alias_block_segment[0][2], state->nxdn_alias_block_segment[0][3], ++ state->nxdn_alias_block_segment[1][0], state->nxdn_alias_block_segment[1][1], state->nxdn_alias_block_segment[1][2], state->nxdn_alias_block_segment[1][3], ++ state->nxdn_alias_block_segment[2][0], state->nxdn_alias_block_segment[2][1], state->nxdn_alias_block_segment[2][2], state->nxdn_alias_block_segment[2][3], ++ state->nxdn_alias_block_segment[3][0], state->nxdn_alias_block_segment[3][1], state->nxdn_alias_block_segment[3][2], state->nxdn_alias_block_segment[3][3]); ++ ++ #ifdef LIMAZULUTWEAKS //disable saving the alias to call history/groupName and potentially overwriting any imported src names in the array ++ UNUSED(z); UNUSED(tsrc); UNUSED(wr); UNUSED(str_b); UNUSED(str_a); ++ #else ++ ++ //juggle strings here so we don't get compiler warnings on assignment size ++ memcpy (str_b, str_a, 48); str_b[49] = '\0'; ++ ++ if (tsrc != 0) ++ { ++ for (int x = 0; x < state->group_tally; x++) ++ { ++ if (state->group_array[x].groupNumber == tsrc) ++ { ++ wr = 1; //already in there, so no need to assign it ++ z = x; ++ break; ++ } ++ } ++ ++ //NOTE: Assigning D or DE here could still clash with ENC LO and also normal A/B/D/DE from group import ++ //among other issues, so, will need to evaluate and tweak, or stash in the eternal stash of ideas to revisit ++ ++ //if not already in there, so save it there now (find clever way to use this and also ENC LO) ++ if (wr == 0) ++ { ++ state->group_array[state->group_tally].groupNumber = tsrc; ++ if (state->nxdn_cipher_type != 0 && opts->trunk_tune_enc_calls == 0 && state->R == 0) ++ sprintf (state->group_array[state->group_tally].groupMode, "%s", "DE"); ++ else ++ sprintf (state->group_array[state->group_tally].groupMode, "%s", "D"); //could still override a blocked TG, or vice versa ++ sprintf (state->group_array[state->group_tally].groupName, "%s", str_b); ++ state->group_tally++; ++ } ++ ++ //if its in there, but doesn't match (bad/partial decode) -- the mode checks are to help limit overwriting imported src names as long as they don't use the D or DE values ++ else if ( (strcmp(str_b, state->group_array[z].groupName) != 0) && (strcmp("B", state->group_array[z].groupMode) != 0) && (strcmp("A", state->group_array[z].groupMode) != 0) ) ++ { ++ state->group_array[z].groupNumber = tsrc; ++ if (state->nxdn_cipher_type != 0 && opts->trunk_tune_enc_calls == 0 && state->R == 0) ++ sprintf (state->group_array[z].groupMode, "%s", "DE"); //having this here will allow a later lockout to occur if required ++ else ++ sprintf (state->group_array[z].groupMode, "%s", "D"); ++ sprintf (state->group_array[z].groupName, "%s", str_b); ++ } ++ } ++ ++ #endif ++ + } + + //crc errs in one repitition may occlude an otherwise good alias, so test and change if needed