Skip to content
Snippets Groups Projects
Commit d3a2fa5a authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix screen save/restore for manual uploads

While it was properly entering the mode for the file picker, it
restored the screen before the protocol picker, which resulted in
the palette/charset from the connection being used for the transfer
window.

Fixes ticket 202

While we're here, wrap the whole "put everything in CP437 mode"
into a new function and use it everywhere.
parent b8446602
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ Add support for DECSC/DECRC control codes ...@@ -11,6 +11,7 @@ Add support for DECSC/DECRC control codes
Fix crash when first ANSI music note played is in background Fix crash when first ANSI music note played is in background
Fix binary mode tracking, which could cause issues after transfers Fix binary mode tracking, which could cause issues after transfers
Fix SDL and GDI issue with textmode() when font is changed Fix SDL and GDI issue with textmode() when font is changed
Fix manual upload screen when not in cp437+ANSI mode
Version 1.6 Version 1.6
------------ ------------
......
...@@ -323,6 +323,20 @@ static struct vmem_cell *status_bar; ...@@ -323,6 +323,20 @@ static struct vmem_cell *status_bar;
size_t status_bar_sz; size_t status_bar_sz;
bool force_status_update = false; bool force_status_update = false;
struct ciolib_screen *
cp437_savescrn(void)
{
struct ciolib_screen *ret = savescreen();
set_modepalette(palettes[COLOUR_PALETTE]);
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
setvideoflags(getvideoflags() & (CIOLIB_VIDEO_NOBLINK | CIOLIB_VIDEO_BGBRIGHT));
return ret;
}
void void
update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv) update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
{ {
...@@ -938,16 +952,15 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch) ...@@ -938,16 +952,15 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch)
}; };
struct text_info txtinfo; struct text_info txtinfo;
struct ciolib_screen *savscrn; struct ciolib_screen *savscrn;
struct ciolib_screen *savscrn2;
if (safe_mode) if (safe_mode)
return; return;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); suspend_rip(true);
setfont(0, false, 1); savscrn = cp437_savescrn();
setfont(0, false, 2); savscrn2 = savescreen();
setfont(0, false, 3);
setfont(0, false, 4);
init_uifc(false, false); init_uifc(false, false);
if (!isdir(bbs->uldir)) { if (!isdir(bbs->uldir)) {
...@@ -956,6 +969,7 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch) ...@@ -956,6 +969,7 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch)
uifcbail(); uifcbail();
restorescreen(savscrn); restorescreen(savscrn);
freescreen(savscrn); freescreen(savscrn);
freescreen(savscrn2);
gotoxy(txtinfo.curx, txtinfo.cury); gotoxy(txtinfo.curx, txtinfo.cury);
return; return;
} }
...@@ -967,12 +981,14 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch) ...@@ -967,12 +981,14 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch)
uifcbail(); uifcbail();
restorescreen(savscrn); restorescreen(savscrn);
freescreen(savscrn); freescreen(savscrn);
freescreen(savscrn2);
gotoxy(txtinfo.curx, txtinfo.cury); gotoxy(txtinfo.curx, txtinfo.cury);
return; return;
} }
SAFECOPY(path, fpick.selected[0]); SAFECOPY(path, fpick.selected[0]);
filepick_free(&fpick); filepick_free(&fpick);
restorescreen(savscrn); restorescreen(savscrn2);
freescreen(savscrn2);
if ((fp = fopen(path, "rb")) == NULL) { if ((fp = fopen(path, "rb")) == NULL) {
SAFEPRINTF2(str, "Error %d opening %s for read", errno, path); SAFEPRINTF2(str, "Error %d opening %s for read", errno, path);
...@@ -985,7 +1001,6 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch) ...@@ -985,7 +1001,6 @@ begin_upload(struct bbslist *bbs, bool autozm, int lastch)
} }
setvbuf(fp, NULL, _IOFBF, 0x10000); setvbuf(fp, NULL, _IOFBF, 0x10000);
suspend_rip(true);
if (autozm) { if (autozm) {
zmodem_upload(bbs, fp, path); zmodem_upload(bbs, fp, path);
} }
...@@ -1042,11 +1057,7 @@ begin_download(struct bbslist *bbs) ...@@ -1042,11 +1057,7 @@ begin_download(struct bbslist *bbs)
return; return;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
init_uifc(false, false); init_uifc(false, false);
...@@ -1253,11 +1264,7 @@ zmodem_duplicate_callback(void *cbdata, void *zm_void) ...@@ -1253,11 +1264,7 @@ zmodem_duplicate_callback(void *cbdata, void *zm_void)
int old_hold = hold_update; int old_hold = hold_update;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
window(1, 1, txtinfo.screenwidth, txtinfo.screenheight); window(1, 1, txtinfo.screenwidth, txtinfo.screenheight);
init_uifc(false, false); init_uifc(false, false);
hold_update = false; hold_update = false;
...@@ -1664,11 +1671,7 @@ xmodem_duplicate(xmodem_t *xm, struct bbslist *bbs, char *path, size_t pathsize, ...@@ -1664,11 +1671,7 @@ xmodem_duplicate(xmodem_t *xm, struct bbslist *bbs, char *path, size_t pathsize,
int old_hold = hold_update; int old_hold = hold_update;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
window(1, 1, txtinfo.screenwidth, txtinfo.screenheight); window(1, 1, txtinfo.screenwidth, txtinfo.screenheight);
init_uifc(false, false); init_uifc(false, false);
...@@ -2058,11 +2061,7 @@ music_control(struct bbslist *bbs) ...@@ -2058,11 +2061,7 @@ music_control(struct bbslist *bbs)
int i; int i;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
init_uifc(false, false); init_uifc(false, false);
i = cterm->music_enable; i = cterm->music_enable;
...@@ -2086,11 +2085,7 @@ font_control(struct bbslist *bbs, struct cterminal *cterm) ...@@ -2086,11 +2085,7 @@ font_control(struct bbslist *bbs, struct cterminal *cterm)
if (safe_mode) if (safe_mode)
return; return;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
init_uifc(false, false); init_uifc(false, false);
switch (cio_api.mode) { switch (cio_api.mode) {
...@@ -2148,11 +2143,7 @@ capture_control(struct bbslist *bbs) ...@@ -2148,11 +2143,7 @@ capture_control(struct bbslist *bbs)
if (safe_mode) if (safe_mode)
return; return;
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
cap = (char *)alloca(cterm->height * cterm->width * 2); cap = (char *)alloca(cterm->height * cterm->width * 2);
gettext(cterm->x, cterm->y, cterm->x + cterm->width - 1, cterm->y + cterm->height - 1, cap); gettext(cterm->x, cterm->y, cterm->x + cterm->width - 1, cterm->y + cterm->height - 1, cap);
...@@ -4344,22 +4335,16 @@ doterm(struct bbslist *bbs) ...@@ -4344,22 +4335,16 @@ doterm(struct bbslist *bbs)
/* Have full sequence (Assumes /* Have full sequence (Assumes
* zrinit and zrqinit are same * zrinit and zrqinit are same
* length */ * length */
struct ciolib_screen *savscrn;
WRITE_OUTBUF(); WRITE_OUTBUF();
suspend_rip(true); suspend_rip(true);
savscrn = savescreen(); if (!strcmp((char *)zrqbuf, (char *)zrqinit)) {
set_modepalette(palettes[COLOUR_PALETTE]); struct ciolib_screen *savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
setvideoflags(getvideoflags() & (CIOLIB_VIDEO_NOBLINK | CIOLIB_VIDEO_BGBRIGHT));
if (!strcmp((char *)zrqbuf, (char *)zrqinit))
zmodem_download(bbs); zmodem_download(bbs);
else
begin_upload(bbs, true, inch);
restorescreen(savscrn); restorescreen(savscrn);
freescreen(savscrn); freescreen(savscrn);
}
else
begin_upload(bbs, true, inch);
setup_mouse_events(&ms); setup_mouse_events(&ms);
suspend_rip(false); suspend_rip(false);
zrqbuf[0] = 0; zrqbuf[0] = 0;
...@@ -4553,11 +4538,7 @@ doterm(struct bbslist *bbs) ...@@ -4553,11 +4538,7 @@ doterm(struct bbslist *bbs)
{ {
char title[LIST_NAME_MAX + 13]; char title[LIST_NAME_MAX + 13];
struct ciolib_screen *savscrn; struct ciolib_screen *savscrn;
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
show_bbslist(bbs->name, true); show_bbslist(bbs->name, true);
sprintf(title, "SyncTERM - %s\n", bbs->name); sprintf(title, "SyncTERM - %s\n", bbs->name);
settitle(title); settitle(title);
...@@ -4627,11 +4608,7 @@ doterm(struct bbslist *bbs) ...@@ -4627,11 +4608,7 @@ doterm(struct bbslist *bbs)
case 0x2300: /* Alt-H - Hangup */ case 0x2300: /* Alt-H - Hangup */
{ {
struct ciolib_screen *savscrn; struct ciolib_screen *savscrn;
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
if (quitting if (quitting
|| confirm("Disconnect... Are you sure?", || confirm("Disconnect... Are you sure?",
"Selecting Yes closes the connection\n")) { "Selecting Yes closes the connection\n")) {
...@@ -4728,11 +4705,7 @@ doterm(struct bbslist *bbs) ...@@ -4728,11 +4705,7 @@ doterm(struct bbslist *bbs)
struct ciolib_screen *savscrn; struct ciolib_screen *savscrn;
char title[LIST_NAME_MAX + 13]; char title[LIST_NAME_MAX + 13];
savscrn = savescreen(); savscrn = cp437_savescrn();
setfont(0, false, 1);
setfont(0, false, 2);
setfont(0, false, 3);
setfont(0, false, 4);
show_bbslist(bbs->name, true); show_bbslist(bbs->name, true);
sprintf(title, "SyncTERM - %s\n", bbs->name); sprintf(title, "SyncTERM - %s\n", bbs->name);
settitle(title); settitle(title);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment