Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit b4f94b1e authored by Deucе's avatar Deucе 👌🏾
Browse files

Add an argument to cterm_end() to not free fonts

While we're doing that, actually use it in SyncTERM so the offline
scrollback retains fonts.

Also, fix an issue where the current mode would be updated with
the custom parameters when you changed them.

Finally, remove some unused variables.
parent 99eec30f
Pipeline #2249 passed with stage
in 7 minutes and 37 seconds
......@@ -5565,7 +5565,7 @@ void cterm_closelog(struct cterminal *cterm)
}
FILE *dbg;
void cterm_end(struct cterminal *cterm)
void cterm_end(struct cterminal *cterm, int free_fonts)
{
int i;
......@@ -5575,11 +5575,13 @@ void cterm_end(struct cterminal *cterm)
FREE_AND_NULL(BD->vmem);
FREE_AND_NULL(BD);
#else
for(i=CONIO_FIRST_FREE_FONT; i < 256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
if (free_fonts) {
for(i=CONIO_FIRST_FREE_FONT; i < 256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
}
#endif
if(cterm->playnote_thread_running) {
......
......@@ -277,7 +277,7 @@ CIOLIBEXPORT struct cterminal* cterm_init(int height, int width, int xpos, int y
CIOLIBEXPORT char* cterm_write(struct cterminal *cterm, const void *buf, int buflen, char *retbuf, size_t retsize, int *speed);
CIOLIBEXPORT int cterm_openlog(struct cterminal *cterm, char *logfile, int logtype);
CIOLIBEXPORT void cterm_closelog(struct cterminal *cterm);
CIOLIBEXPORT void cterm_end(struct cterminal *cterm);
CIOLIBEXPORT void cterm_end(struct cterminal *cterm, int free_fonts);
CIOLIBEXPORT void cterm_clearscreen(struct cterminal *cterm, char attr);
CIOLIBEXPORT void cterm_start(struct cterminal *cterm);
void cterm_gotoxy(struct cterminal *cterm, int x, int y);
......
......@@ -1080,8 +1080,6 @@ void sdl_video_event_thread(void *data)
for (; list; list = old_next) {
SDL_Rect src;
SDL_Rect dst;
int idealw;
int idealh;
old_next = list->next;
if (list->next == NULL) {
......
......@@ -161,7 +161,7 @@ int spyon(char *sockname) {
}
}
}
cterm_end(cterm);
cterm_end(cterm, 1);
puttext(1,1,ti.screenwidth,ti.screenheight,scrn);
window(ti.winleft,ti.wintop,ti.winright,ti.winbottom);
textattr(ti.attribute);
......
......@@ -917,7 +917,6 @@ static int
get_rip_version(int oldver, int *changed)
{
int cur = oldver;
int bar = 0;
uifc.helpbuf= "`RIP Version`\n\n"
"RIP v1 requires EGA mode while RIP v3\n"
......@@ -1550,7 +1549,7 @@ custom_mode_adjusted(int *cur, char **opt)
gettextinfo(&ti);
if (ti.currmode != CIOLIB_MODE_CUSTOM) {
cvmode = find_vmode(ti.currmode);
cvmode = find_vmode(CIOLIB_MODE_CUSTOM);
if (cvmode >= 0) {
vparams[cvmode].cols = settings.custom_cols;
vparams[cvmode].rows = settings.custom_rows;
......@@ -1563,7 +1562,7 @@ custom_mode_adjusted(int *cur, char **opt)
uifcbail();
textmode(0);
cvmode = find_vmode(ti.currmode);
cvmode = find_vmode(CIOLIB_MODE_CUSTOM);
if (cvmode >= 0) {
vparams[cvmode].cols = settings.custom_cols;
vparams[cvmode].rows = settings.custom_rows;
......
......@@ -9775,7 +9775,7 @@ reinit_screen(uint8_t *font, int fx, int fy)
hold_update = 0;
cterm->logfile = NULL;
cterm->log = CTERM_LOG_NONE;
cterm_end(cterm);
cterm_end(cterm, 0);
normal_palette();
// TODO: You know this is insane right?
// Patch vstat font, font size, and cols
......
......@@ -1764,6 +1764,13 @@ int main(int argc, char **argv)
fprintf(log_fp,"%.15s Log opened\n", ctime(&now)+4);
}
for(i=CONIO_FIRST_FREE_FONT; i<256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
load_font_files();
if(doterm(bbs))
quitting=TRUE;
fake_mode = -1;
......@@ -1777,13 +1784,6 @@ int main(int argc, char **argv)
log_fp=NULL;
}
textmode(txtinfo.currmode);
for(i=CONIO_FIRST_FREE_FONT; i<256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
load_font_files();
settitle("SyncTERM");
}
if(quitting || url[0]) {
......@@ -1823,6 +1823,12 @@ int main(int argc, char **argv)
}
bbs=NULL;
}
for(i=CONIO_FIRST_FREE_FONT; i<256; i++) {
FREE_AND_NULL(conio_fontdata[i].eight_by_sixteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_fourteen);
FREE_AND_NULL(conio_fontdata[i].eight_by_eight);
FREE_AND_NULL(conio_fontdata[i].desc);
}
if (bbs_alloc)
free(bbs);
if (last_bbs)
......
......@@ -2555,7 +2555,7 @@ BOOL doterm(struct bbslist *bbs)
check_exit(FALSE);
cterm_clearscreen(cterm, cterm->attr); /* Clear screen into scrollback */
scrollback_lines=cterm->backpos;
cterm_end(cterm);
cterm_end(cterm, 0);
cterm=NULL;
conn_close();
hidemouse();
......@@ -2881,7 +2881,7 @@ BOOL doterm(struct bbslist *bbs)
setup_mouse_events(&ms);
cterm_clearscreen(cterm,cterm->attr); /* Clear screen into scrollback */
scrollback_lines=cterm->backpos;
cterm_end(cterm);
cterm_end(cterm, 0);
cterm=NULL;
conn_close();
hidemouse();
......@@ -2912,7 +2912,7 @@ BOOL doterm(struct bbslist *bbs)
case -1:
cterm_clearscreen(cterm, cterm->attr); /* Clear screen into scrollback */
scrollback_lines=cterm->backpos;
cterm_end(cterm);
cterm_end(cterm, 0);
cterm=NULL;
conn_close();
hidemouse();
......@@ -2953,7 +2953,7 @@ BOOL doterm(struct bbslist *bbs)
#endif
cterm_clearscreen(cterm, cterm->attr); /* Clear screen into scrollback */
scrollback_lines=cterm->backpos;
cterm_end(cterm);
cterm_end(cterm, 0);
cterm=NULL;
conn_close();
hidemouse();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment